Main-agent-direct single-scope implementation. The main agent reads, edits, verifies, and commits directly — no subagent delegation for the edit itself. Use when session context on the target area is warm and scope fits direct-edit capacity.
Target: $ARGUMENTS
~/.claude/infra/impl-playbook.md for test strategy, verify, failure diagnosis, deviation protocol, and mechanical-edit criteria.python3 ~/.claude/infra/list-mental-model.py <target-paths> and read every listed file.## AI Context./delegate-implement or /proceed if scope grows beyond single-scope direct-edit capacity.judge: needs-review fires, spawn a one-shot reviewer — no team, fresh context per iteration.ai-docs/_index.md, ticket status) runs before reporting to the user.--plan path.judge: skeleton-check requires a skeleton and none exists, stop and suggest /write-skeleton.python3 ~/.claude/infra/list-mental-model.py <target-paths>; read every listed file.~/.claude/infra/impl-playbook.md.## AI Context.Apply judge: needs-review.
team_name):Agent(
description = "Review /implement diff",
subagent_type = "reviewer",
model = "sonnet",
prompt = """
Diff range: <first-commit>..HEAD
Scope: main-agent-direct implementation — <brief scope description>
Follow your standard review process (CLAUDE.md + mental-model sweep + diff).
Return findings report.
"""
)
On findings:
Loop until no Critical/Important issues remain.
ai-docs/_index.md — update inventory, descriptions, and layout to reflect current state.Report to the user:
| Decision | When |
|---|---|
| Proceed with /implement | Main agent is warm on the target area; change is small (single file or tightly coupled pair, or clear cross-module changes with established pattern); verifiable with focused tests |
| Escalate to /delegate-implement | Cross-module without clear pattern, or main agent cannot hold full context while editing, or scope exceeds 3+ files with new public API |
| Escalate to /proceed | Upstream artifact missing (ticket, skeleton, or plan) |
| Decision | When |
|---|---|
| Proceed without skeleton | Change is a small isolated edit (single file, no new public contracts) |
| Require skeleton | Change touches public interfaces or cross-module boundaries |
| Decision | When |
|---|---|
| Skip | Single file, no public contract changes, follows established patterns |
| Review | 2+ files, or public API modification, or new pattern introduced |
Scope exceeding 3+ files with new public API or architectural change is already out of /implement capacity — judge: scope-bound escalates to /delegate-implement before review fires.
Implement optimizes for session-context preservation during code changes — the main agent retains its accumulated understanding of the task through editing rather than forking that context to a subagent and reconstructing it across the boundary. When review fires, the reviewer fork is fresh per iteration, so the main agent's continuity is preserved while the reviewer provides uncommitted judgment on the diff. When a rule is ambiguous, apply whichever interpretation better preserves the main agent's continuous context over the change's full lifecycle.