agentleFS
lgulliverlgulliver/derrick/AGENTS.md

derrick

AGENTS.md2 starsChanged 6 months agoMITView on GitHub

Read this first. Then your specialist file under .claude/agents/, .codex/agents/, or .github/agents/ depending on where you live. Derrick is a unified front door over speckit, an in-process assay (adversarial plan review), and a derrick-native execution substrate. One install, one config (derrick.yaml), one primary command (/drill). The full design is in DESIGN.md. It is the source of truth. Eighty-eight decisions are recorded in §12 as D1–D88; do not re-litigate them without filing a design-question issue and updating §12 with a new…

The file

We split this AGENTS.md into the rules it gives an agent

9 rules. About 0 are common, 4 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every change is checked against these.

    line 20
  2. Very specific:

    When that bar is met, the orchestrator (Claude main session) should propose the switch, get human confirmation, and from that point on …

    line 105
  3. Distinctive:

    No external runtime dependencies beyond SQLite: No daemon, no port, no server-side state.

    line 117
  4. Very specific:

    Hosts own their own context: When derrick invokes claude / codex / copilot, those hosts load their own AGENTS.md, sub-agents, skills, hooks.

    line 119
  5. Very specific:

    The substrate trait is the only contract: Don't reach into SQLite from outside derrick-substrate-native.

    line 123
  6. Very specific:

    No mock databases: Use a real SQLite file in tests via tempfile.

    line 126
  7. Distinctive:

    When you are a hand (Copilot, Codex, or Claude acting as implementer) and you have finished work on a ticket, follow this sequence before …

    line 171
  8. Distinctive:

    If the code review fails after all configured rounds, stop and surface the final review report to the human.

    line 188
  9. Very specific:

    Stop and ask the human via derrick mail --human (crew mode) or print an explicit message (solo/copilot mode) when:

    line 201

≈ “Common” is an estimate: at least 1 in 5 of the 16,597 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md — the contract for agents building derrick

Read this first. Then your specialist file under .claude/agents/, .codex/agents/, or .github/agents/ depending on where you live.

What derrick is

Derrick is a unified front door over speckit, an in-process assay (adversarial plan review), and a derrick-native execution substrate. One install, one config (derrick.yaml), one primary command (/drill).

The full design is in DESIGN.md. It is the source of truth. Eighty-eight decisions are recorded in §12 as D1–D88; do not re-litigate them without filing a design-question issue and updating §12 with a new D entry.

Architectural pillars (§9)

Every change is checked against these. If you can't make it memory-aware, token-efficient, and parallel-safe, don't ship it.

  • Memory — derrick seeds and curates persistent memory so the assistant doesn't relearn the rig every turn (§9.A).
  • Tokens — every byte across a model boundary earns its place via tiering, scrubbing, caveman compression, prompt caching, lazy artifact loading, transcript-parsed telemetry (§9.B).
  • Parallelism — independent work runs concurrently by default; serial work is a justified exception (§9.C).

Workspace (§3.1)

Cargo workspace, one binary (derrick), many crates. Each crate has a specialist agent (.claude/agents/<name>.md). The specialist agents own their crate; cross-crate changes go through rust-architect.

Orchestration model — how derrick gets built

Derrick is built using its own pattern. Three roles, three hosts:

RoleHostModelWhat it does
OrchestratorClaude (Claude Code main session)HaikuReads designs, picks the specialist, decomposes work into tickets, dispatches to implementers, verifies results, runs tests, updates DESIGN.md. Does not write production code itself. Haiku is sufficient because orchestration is pattern-following; heavy thinking lives in the specialists (for design/planning) and in the reviewer/implementer roles (for code).
ReviewerCodex (codex CLI)gpt-5.5 (codex default; or auto)Adversarial pass on plans and PRs before merge. Different-family scrutiny per the assay pattern. May also implement assigned tickets when explicitly handed one.
ImplementerGitHub Copilot (copilot CLI)auto (foreman picks per ticket)Writes code for individual tickets. Lives at the leaf of the dispatch tree.

The nine specialist subagents under .claude/agents/ each pin their own model in frontmatter according to the work they do, not according to who invokes them. The orchestrator (Haiku) spawns a specialist when it needs that specialist's level of reasoning — Haiku for pattern routing, Opus or Sonnet for the actual specialist work:

SpecialistModelWhy
rust-architectOpusCross-crate trait/seam decisions; rare, high-consequence.
substrate-engineerOpusOwns the load-bearing crate (schema, foreman, worktrees).
flow-engineerOpusState-heavy pipeline + brownfield adoption logic.
integrations-engineerOpusMany provider edge cases, auth, assay reconciliation.
git-stackerOpusDestructive ops (rebase, force-push) — want it right.
token-economistSonnetMechanical text shaping with strong tests; sonnet sufficient.
tui-engineerSonnetIterative UI work; sonnet's the right cost/quality point.
test-engineerSonnetPattern-heavy fixture and assertion work.
design-keeperSonnetDocument maintenance; precise edits, not invention.

Practical contract:

  • If you are Claude, your job is orchestration. Plan the work against the relevant specialist contract, write the ticket / brief, hand it to Codex (for review) or Copilot (for implementation), then verify and integrate the result. Production code changes pass through Codex or Copilot, not through you directly. Exceptions: trivial doc tweaks, DESIGN.md updates, decision-log entries, and emergency fixes the user explicitly asks you to make.
  • If you are Codex, your default role is adversarial review. You may also be handed a ticket to implement; when you are, the ticket scopes the work.
  • If you are Copilot, your default role is implementation against a ticket Claude has dispatched. Stay in scope; the ticket is the contract.

Engineering standards (style, SOLID, DRY, coverage) are in CONTRIBUTING.md.

Dogfooding milestone

Once derrick can drive /drill end-to-end against itself, we switch to dogfooding: orchestration moves out of ad-hoc Claude Code + raw codex/copilot invocations and into derrick's own pipeline. The minimum bar is the four crates below being implemented well enough that a fresh /drill "..." run in this repo produces a working spec, an accepted assay verdict, and a tasks.md (the substrate-backed ticket dispatch is a bonus — not strictly required for the switch).

CrateWhat unblocks
derrick-config ✅ (T001)Pipeline reads its config
derrick-substrate (T002, this ticket)Tickets and batches exist as a contract
derrick-substrate-native (T003+)Tickets and batches exist as storage
derrick-cli + derrick-flow minimal init / runEnd-to-end driver

When that bar is met, the orchestrator (Claude main session) should propose the switch, get human confirmation, and from that point on every ticket goes through /drill rather than direct codex/copilot invocations. The agent contracts and quality gates stay the same — the difference is who issues the brief.

House rules

  1. Vocabulary: derrick speaks site / ticket / batch / hand / foreman / dispatch / activity. Never re-introduce gastown's words (rig / bead / convoy / polecat / mayor / sling / trail).
  2. No external runtime dependencies beyond SQLite. No daemon, no port, no server-side state.
  3. Hosts own their own context. When derrick invokes claude / codex / copilot, those hosts load their own AGENTS.md, sub-agents, skills, hooks. Derrick passes the cwd and the prompt; it does not inject system prompts (§6.5).
  4. The substrate trait is the only contract. Don't reach into SQLite from outside derrick-substrate-native. Don't reach into the Substrate trait from anywhere except by going through it.
  5. No mock databases. Use a real SQLite file in tests via tempfile. Mocks have lied to us before; the substrate is too load-bearing to fake.
  6. Stay in scope. A bug fix or feature stays inside the crate that owns it. Cross-cutting changes ("rename a type", "add a field everywhere") get a planning pass through design-keeper first.
  7. DESIGN.md is the rulebook, CLAUDE.md is a pointer. All substantive rules live in DESIGN.md so every host (Claude, Codex, Copilot) reads the same content. AGENTS.md (this file) is the operational contract.
  8. State machine integrity is non-negotiable (D31/D32/D33, DESIGN.md §8.6). Ticket state transitions to Done are never authoritative on hand self-report alone — the foreman observes the merge. State changes are append-only at the event log. The foreman cross-references against git, not just substrate state. Worktree and ticket cleanup is continuous (prune-on-startup + periodic), never trusts "eventually consistent" state. We banked these as design decisions specifically to avoid the autonomous-mode bugs we observed in a comparable system at scale.

Specialist routing

Pick the right specialist before starting work:

DomainSpecialistOwns
Rust idioms, workspace, traits, perfrust-architectCross-crate Rust concerns
SQLite schema, foreman loop, ticket model, worktreessubstrate-engineerderrick-substrate*
Pipeline state machine, step runner, run manifestsflow-engineerderrick-flow
Brownfield detection, init flow, speckit detect-then-deferflow-engineerderrick-adopt, derrick-config
Host CLI adapters, host-delegated providers + model catalogue, agent rule respectintegrations-engineerderrick-tools, derrick-models, derrick-copilot
Scrubber, caveman, memory, telemetry, prompt cachingtoken-economistderrick-scrub, derrick-caveman, derrick-memory
PR stacking, branches, restack, gh/graphite/git-spicegit-stackerderrick-stack
ratatouille dashboard, file watcher, terminal UXtui-engineerderrick-tui
Assay logic, codex prompting, multi-reviewer reconciliationintegrations-engineer (assay role)derrick-assay
Tests, fixtures, integration harnesstest-engineerTest code anywhere
DESIGN.md, decision log, open questionsdesign-keeperDESIGN.md only

Cross-crate changes route through rust-architect (technical) and design-keeper (intent recorded).

Hand completion protocol

When you are a hand (Copilot, Codex, or Claude acting as implementer) and you have finished work on a ticket, follow this sequence before transitioning to InReview:

# 1. Run adversarial code review (repeats up to tools.code_review.rounds times)
derrick ticket code-review <ticket-id> --branch <your-branch> --round 0

# If exit code is 3 (issues found): read the review in .derrick/reviews/<id>/round-0.md,
# fix the issues, commit, then retry:
derrick ticket code-review <ticket-id> --branch <your-branch> --round 1
# ... up to the configured rounds limit

# 2. Only when code review exits 0 (pass): transition to InReview
derrick ticket review <ticket-id> --branch <your-branch> --head-sha <sha> [--pr-url <url>]

If the code review fails after all configured rounds, stop and surface the final review report to the human. Do NOT open a PR on a failed review.

Exit codes:

  • 0 — pass (proceed to ticket review)
  • 1 — infrastructure error (check config, git, substrate)
  • 3 — issues found (fix and retry with --round N+1)

The review file is always written to .derrick/reviews/<id>/round-N.md so the human can audit the review history regardless of outcome.

Stop conditions

Stop and ask the human via derrick mail --human (crew mode) or print an explicit message (solo/copilot mode) when:

  • A change would violate a D entry in §12.
  • A change would alter the substrate schema in a non-migration- safe way.
  • A test cannot be written for a change. (Untestable change → no change.)
  • The assay reviewer rejects the same plan twice.
  • The code review still fails after tools.code_review.rounds attempts.
  • The host's own AGENTS.md / CLAUDE.md / hooks would need derrick-side coordination to work. We don't coordinate; the host's rules stand.

How to find your file

  • Claude Code: .claude/agents/<your-name>.md
  • Codex: .codex/agents/<your-name>.md (also referenced from .codex/instructions.md)
  • GitHub Copilot: .github/agents/<your-name>.md (also referenced from .github/copilot-instructions.md)
  • OpenCode: .opencode/agents/<your-name>.md

The body is identical across hosts. Only the frontmatter format differs (Claude Code uses YAML; Codex and Copilot use plain markdown with the same fields).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.