The building blocks of Forge delegation — how SKILL.md works, what the fallback ladder does, and how AGENTS.md keeps getting smarter over time.
When you invoke /forge, Claude activates Forge delegation mode. In this mode, Claude does not write code directly. Instead, it acts as a task orchestrator — composing structured prompts, submitting them to Forge, monitoring output, and handling failures.
The key insight is that Forge (ForgeCode) is a specialized coding agent that operates autonomously. Claude's role is to communicate the task clearly, not to do the implementation itself.
/forge is active, all coding tasks are delegated to Forge. To return to Claude doing implementation directly, deactivate with /forge:deactivate.All Forge delegation behavior is defined in skills/forge/SKILL.md. This file is loaded when you invoke /forge and contains every rule Claude follows: how to write task prompts, when to escalate failures, how to update AGENTS.md, and what token limits to observe.
SKILL.md has these sections, added across four implementation phases:
Claude continuously monitors Forge's output for three failure signals:
Error:, Failed:, fatal:, or a non-zero exit codeAny of these signals triggers the fallback ladder.
The fallback ladder is a three-level automatic recovery system. When Forge fails, Claude escalates through levels rather than immediately taking over or giving up.
Forge has access to four bootstrap skills that Claude can inject into task prompts via the INJECTED SKILLS field. Claude selects skills based on the task type:
| Skill | Task Type |
|---|---|
| testing-strategy | Writing or fixing tests, TDD tasks |
| code-review | Code quality, refactoring, review-driven changes |
| security | Auth, input validation, credential handling |
| quality-gates | Multi-phase delivery, release preparation |
For general code changes and refactoring, inject code-review. Add quality-gates for multi-phase delivery tasks.
Claude enforces an injection budget: inject ≤2 skills per task unless the task is clearly multi-domain. Over-injection bloats the prompt and degrades Forge's focus.
After every completed Forge task, Claude extracts learnings and writes them to AGENTS.md. This is the mechanism by which delegation gets smarter over time.
Claude writes to three locations after each task:
~/forge/AGENTS.md — global cross-project knowledge./AGENTS.md — project-specific instructionsdocs/sessions/YYYY-MM-DD-session.md — per-session evolution logBefore every AGENTS.md write, Claude runs a two-phase check: first an exact substring match, then a semantic similarity check. If either matches an existing entry, the write is skipped entirely — no partial appends.
Task prompts to Forge are capped at 2,000 tokens. Claude enforces this by:
Context compaction in .forge.toml uses validated defaults:
Sidekick supports two providers for Forge. The provider and model are set in ~/forge/.forge.toml (global, not per-project). API credentials are stored separately in ~/forge/.credentials.json.
OpenRouter routes requests to the forge/forge-code model. This is the default and recommended provider — it has the broadest availability and is the model Sidekick is optimized for.
MiniMax is an alternative provider with different rate limits and pricing. Use it if you have a MiniMax account or prefer its model characteristics. Switch by updating ~/forge/.forge.toml:
~/forge/.credentials.json and ~/forge/.forge.toml live in your home directory and apply to all projects. The project-root .forge.toml contains only compaction settings and is gitignored automatically.