The complete flow for delegating a coding task to Forge — from activation through output review and the post-session AGENTS.md update.
Type /forge in Claude Code. Claude loads skills/forge/SKILL.md and executes the activation sequence:
Claude verifies: (1) the Forge binary is on PATH, (2) ~/forge/.credentials.json has a valid api_key, (3) ~/forge/.forge.toml has a valid provider_id and model_id, (4) OpenRouter (or MiniMax) is reachable, and (5) the configured model is available. Any failure halts activation with a specific error message.
If ./AGENTS.md does not exist, Claude creates it with a project-specific template: Code Style, Testing, Git Workflow, Forge Behavior, and Project Conventions sections. If ~/forge/AGENTS.md doesn't exist, it creates that too.
Claude writes a zero-byte marker to ~/.claude/.forge-delegation-active and confirms: "Forge delegation mode active." All subsequent coding tasks in this session will be delegated to Forge until you run /forge:deactivate.
~/forge/.credentials.json.When you describe a task, Claude builds a structured 5-field prompt capped at 2,000 tokens:
Claude streams Forge's output and checks for three failure signals on every response:
Error:, Failed:, fatal:, or non-zero exitIf no failure signal is detected and SUCCESS CRITERIA are met, the task is complete — skip to Step 5.
Failures trigger the three-level fallback ladder automatically — no user input required until L3:
Claude diagnoses the failure, rewrites the prompt with a tighter DESIRED STATE and code references, and resubmits. If this succeeds, jump to Step 5. If it fails, escalate to L2.
Claude breaks the task into atomic subtasks (≤200 tokens each) and submits them one at a time. Up to 3 attempts. If any subtask fails 3 times, escalate to L3.
Delegation restriction lifted. Claude implements the task. After completion, produces a DEBRIEF with TASK / FORGE_FAILURE / LEARNED / AGENTS_UPDATE fields to capture what happened and update AGENTS.md.
Whether Forge succeeded or Claude took over at L3, Claude presents a structured output summary for your review. The summary is drawn from Forge's output block fields:
Confirm the output looks correct. If something needs adjustment, describe the change in plain language — Claude will compose a new 5-field delegation prompt for the follow-up task. There is no need to re-activate; delegation mode remains active.
After each task (success or L3 takeover), Claude runs the AGENTS.md mentoring loop. This is automatic — you don't need to trigger it.
./AGENTS.md and ~/forge/AGENTS.mdAGENTS_UPDATE field is applied directly, capturing what Forge failed on and what the correct approach isdocs/sessions/YYYY-MM-DD-session.md, recording every task, outcome, and AGENTS.md change from the sessionBefore every write, Claude runs a two-phase dedup check: exact substring match first, then semantic similarity. If either matches an existing AGENTS.md entry, the write is skipped — preventing duplicate or contradictory instructions from accumulating.
Forge delegation mode persists for the entire session. You can delegate as many tasks as needed without re-running /forge. To return to direct Claude implementation:
This removes the ~/.claude/.forge-delegation-active marker and restores normal Claude behavior. All AGENTS.md updates from the session are preserved and will be loaded on the next /forge invocation.