Combine agents

Claude Code plans. Codex builds. OpenCode reviews.

How agents coordinate

Agents do not talk to each other directly. They coordinate by claiming phases through sprint.shand reading each other's artifacts from disk. Agent 1 finishes a phase and writes an artifact. Agent 2 reads that artifact and starts its phase. The filesystem is the message bus.

Agent 1 (Claude Code):
  /think → saves .nanostack/think/artifact.json
  /nano  → saves .nanostack/plan/artifact.json

Agent 2 (Codex):
  reads plan artifact → builds → saves build output

Agent 3 (OpenCode):
  reads build output → /review → saves .nanostack/review/artifact.json

Verified adapters

Verified adapters today: the five hosts with a capability declaration in the repo. The installer auto-detects and configures these:

  • Claude Code — native slash command support via .claude/commands/
  • Cursor — loads skills through .cursor/rules/
  • OpenAI Codex — uses AGENTS.md and instructions files
  • OpenCode — uses .opencode/ config
  • Gemini CLI — loads as extensions or via GEMINI.md

The skill files are plain text, so other agents may load them, but only those five have a verified adapter and capability declaration. The source of truth is adapters/<host>.json in the repo. Hard enforcement for guard, phase gate, and Write/Edit parity depends on the host capability file.

Example workflow

Here is a realistic three-agent workflow for a feature sprint:

# Terminal 1 — Claude Code (planning and orchestration)
> /think --autopilot
  Scope locked. Plan saved.
> /conductor
  Sprint started. Waiting for build...

# Terminal 2 — Codex (building)
$ sprint.sh claim build
  Claimed: build
$ codex "Build the feature following the plan in .nanostack/plan/artifact.json"
  ... builds files ...
$ sprint.sh complete build

# Terminal 1 — Claude Code
  Build complete. Starting parallel phases.

# Terminal 2 — OpenCode (review)
$ sprint.sh batch
  Auto-claimed: review
$ opencode "/review --standard"
$ sprint.sh complete review

# Terminal 3 — Claude Code (security, auto-claimed by conductor)
  Auto-claimed: security
  Running /security --standard ...
  Complete.

# Terminal 1 — Claude Code
  All phases complete. Running /ship.

Agent detection

Each agent sets environment variables that nanostack reads to identify it. This matters for the sprint journal and lock files, which record which agent performed each phase.

Claude Code:  CLAUDE_CODE=1
Codex:        CODEX_AGENT=1 or OPENAI_CODEX=1
Cursor:       CURSOR_SESSION=<id>
Gemini CLI:   GEMINI_CLI=1
OpenCode:     OPENCODE=1

If no known variable is found, the agent is logged as unknown. Everything still works; you just will not see the agent name in status output.

Tips

  • Let the strongest planner handle /think and /nano. Claude Code and Gemini are typically better at scope analysis. Codex is fast at building.
  • Run /security in the agent you trust most for nuanced analysis. Security findings need judgment, not just pattern matching.
  • Use the same project directory for all agents. Nanostack artifacts are project-scoped, so agents need to share the filesystem.
  • Do not run two agents on the same phase. The lock prevents it, but attempting and failing wastes time.
Previous/conductorNextArtifacts