A structured agent development scaffold for Claude Code, Gemini CLI, Codex, and OpenCode.
Specialist agents, slash commands, automatic quality hooks, cross-platform agent generation, role-based model routing, a ticket context system that resumes across sessions, deterministic harness evals, run-trace events for retrospective pattern mining, and a multi-stage /pattern-mine command that proposes new skills or agents from recurring patterns. Copy it into any new project and start with the harness you actually use.
- Copy this folder into your project
- Open
CLAUDE.mdand fill in the PROJECT SETUP block at the top: project name, tech stack, issue tracker URL - If you use Gemini CLI, review
GEMINI.md - If you use Codex CLI or the Codex macOS app, review
AGENTS.mdand.codex/AGENTS.md - If you use OpenCode, review
.opencode/README.mdand runnode scripts/gen-opencode-assets.js - If you want reusable machine-level skills, set
AI_SHARED_SKILLS_DIRand readSHARED-SKILLS.md - Run
node scripts/export-codex-skills.jsafter changing canonical skills inskills/ - (Optional) Run
bash scripts/sync-project-template-to-codex.shto sync the baseline into~/.codexand generate prompt-based command files - (Optional) Install the opt-in global git safety hooks with
bash scripts/install-global-git-hooks.sh - (Optional) Ask Claude or Gemini:
"Read BUILDING-SETUP.md and follow the instructions"— sets up your build journal and then deletes itself - Start working — the harness-specific config and workflow files are already included
Codex still does not provide true Claude-style hook parity. This template adds the closest practical equivalents: generated prompt files, Codex role configs, shared/global skill sync, and optional global git safety hooks.
Explore → Plan → Issues → Implement → Review
- Explore — Free-form thinking in chat. No code, no commands. Clarify the problem.
- Plan — Run
/plan. The planner agent produces a phased plan. Confirm it before moving on. - Issues — Break the plan into atomic, sequenced issues in your tracker (GitHub, Linear, etc.).
- Implement — Open a fresh session. Run
/tdd ISSUE-ID. The agent reads the ticket context, creates a worktree at.ai/worktrees/{ISSUE-ID}/on a fresh branch, and works test-first. - Review — Run
/code-reviewwhen done. Fix findings. Open PR.
Run /handoff at the end of any session to save state. The next session picks up exactly where you left off. /checkpoint for a git commit save state.
Agents are defined once in .ai/agents/ + scripts/agent-config.json. Models are routed from models.json by role (plan / execute / review / think / critique / observe / fallback). Run the generators to materialize agents for each platform:
node scripts/gen-agents.js # Claude Code + Gemini CLI
node scripts/gen-opencode-assets.js # OpenCode prompts, commands, opencode.json
node scripts/gen-codex-assets.js # Codex .toml agents + config.toml entriesEdit models.json to change which model handles a role; one regen propagates to every platform.
Every session writes structured events to .ai/runs/{ticket}/events.jsonl:
tool_use(per tool call, PostToolUse hook)user_message(per prompt, UserPromptSubmit hook)session_end(Stop hook)compaction(PreCompact hook, withparent_session_idlineage)
Retrospective analysis via /pattern-mine:
/pattern-mine mine all sessions
/pattern-mine --since 30d last 30 days
/pattern-mine --dry-run cluster summary, no LLM callsThree stages: deterministic clustering (zero LLM tokens) → Sonnet semantic enrichment → Hermes-style constraint gates → per-candidate approval before saving as a skill or agent.
Before committing new skills or agents:
node scripts/validate-additions.js # schema + duplicates + similarity + safety
node scripts/validate-additions.js --eval-gate # also runs evals/run-evals.jsDeterministic regression tests for harness behavior in evals/fixtures/. 15 check types: file-read order, edit constraints, branch naming, diff size, tool dispatch, finding severity, ticket compliance.
node evals/run-evals.js evals/fixtures/<name>.mdNew skills and agents from /pattern-mine must pass the full suite before being saved.
| Path | Purpose |
|---|---|
CLAUDE.md |
Authoritative workflow guide for Claude Code |
GEMINI.md |
Authoritative workflow guide for Gemini CLI |
AGENTS.md |
Shared cross-harness workflow baseline, auto-read by Codex |
SHARED-SKILLS.md |
Machine-level shared skill architecture and sync workflow |
USER-GUIDE.md |
Explains every component and why it exists |
models.json |
Single source of truth for role → model routing across all 4 platforms |
.codex/ |
Codex config, supplement, multi-agent role definitions (3 originals + 4 promoted from skills) |
.opencode/ |
OpenCode config (regenerated from agent-config.json + models.json), instructions, commands, prompts |
BUILDING-SETUP.md |
Self-installing wizard that generates your build journal |
.claude/agents/ |
14 specialist agents (planner, tdd-guide, code-reviewer, architect, security-reviewer, harness-optimizer, eval-harness, skill-stocktake, deep-research, security-scan, more) |
.claude/commands/ |
21 slash commands incl. /plan, /tdd, /code-review, /handoff, /harness-audit, /model-route, /quality-gate, /loop-start, /loop-status, /pattern-mine |
.claude/settings.json |
Hooks: PreToolUse (push reminder, doc warning, compact suggest), PostToolUse (format, typecheck, console.log warn, PR logger, trace-tool-use), UserPromptSubmit (trace-user-prompt), Stop (session-end, console scan), SessionStart, PreCompact (+ lineage) |
.ai/agents/ |
Platform-agnostic agent body source — edit here, regenerate for all 4 platforms |
.ai/tickets/ |
Per-issue context files preserving confirmed plans across sessions |
.ai/runs/ |
Per-ticket JSONL trace events (gitignored) |
.ai/worktrees/ |
Per-ticket git worktrees from /tdd (gitignored) |
evals/ |
Deterministic harness regression suite — fixtures + grader |
scripts/ |
Generators (gen-agents, gen-opencode-assets, gen-codex-assets), trace utilities, pattern miner, ShareGPT exporter, validator, shared-skill sync, optional global git hooks |
skills/ |
69 canonical skills with Hermes 4-section template (When to Use / Procedure / Pitfalls / Verification) |