specgate/docs v1.8.0

What to tell your agent#

Specgate does not run your coding agent's thinking for it, and it does not need your agent to study it either. It hands the agent what each step needs: AGENTS.md (the contract), specgate status (the next step), DRAFTING.md (the prompt for a module of the brief) and specgate change instructions <artifact> --json (the exact format of any file). What you give the agent is short: where to start, and what it must never do.

You need: a project where specgate init or specgate adopt has run, and your agent's steps installed with specgate agents init --tool <codex|opencode|claude>.

What each agent gets from Specgate, and which controls hold where A table of four agents against four things Specgate gives them. Claude Code: the rules in AGENTS.md; slash commands such as /specgate:apply in .claude/commands/; the MCP server through the plugin's .mcp.json; and hooks, the guard, from agents init --tool claude-plugin. Codex: AGENTS.md; skills such as $specgate-apply in .agents/skills/; the MCP server through mcp install --client codex; and hooks from --tool codex-hooks, written to .codex/hooks.json. OpenCode: AGENTS.md; commands such as /specgate-apply in .opencode/commands/; the MCP server through mcp install --client opencode; and hooks from --tool opencode-plugin. Any other agent CLI: AGENTS.md and the prompt that specgate status --prompt prints, to paste; the MCP server if it speaks MCP; no hooks, so no guard. Below, which controls hold where. Everywhere: the gate (specgate check), the seals, and approval first. With hooks: the guard, which enforces test first and refuses a person's acts and writes to sealed tests and control files. With a harness or CI: the outside judge, which reads the controls before the agent starts and compares them when it stops. RULES COMMANDS · SKILLS MCP SERVER HOOKS — THE GUARD Claude Code Codex OpenCode Any other agent CLI AGENTS.md the contract /specgate:apply … .claude/commands/ the plugin's .mcp.json --tool claude-plugin the guard AGENTS.md the contract $specgate-apply … .agents/skills/ mcp install --client codex --tool codex-hooks the guard AGENTS.md the contract /specgate-apply … .opencode/commands/ mcp install --client opencode --tool opencode-plugin the guard AGENTS.md the contract paste what status --prompt if it speaks MCP mcp serve no hooks no guard WHICH CONTROLS HOLD WHERE Everywhere the gate — specgate check the seals by hash approval first With hooks: the guard test first a person's acts refused sealed tests, control files refused With a harness or CI the outside judge: reads the controls before the agent starts, compares them when it stops A tool with no hooks has no guard; the gate, the seals and approval first still hold.
Every agent gets the rules and the steps; the hooks add the guard, the gate and the seals hold for all of them, and a harness or CI adds the outside judge.

Get the prompt from the project#

bash
specgate status --prompt         # the next step, the brief's modules left to draft
specgate status --prompt draft   # the next module of the brief
specgate status --prompt build   # the next requirements, one at a time

It prints a prompt in English, written from the project as it is now — paste it into Codex, OpenCode, Claude Code or any other agent. --json gives it as data. The sections below are the same prompts, to read before you paste one.

How each agent calls specgate's steps#

AgentStepsInstalled by
Codex$specgate-draft, $specgate-apply, $specgate-check… (skills)specgate agents init --tool codex → .agents/skills/
OpenCode/specgate-draft, /specgate-apply, /specgate-check…specgate agents init --tool opencode → .opencode/commands/
Claude Code/specgate:draft, /specgate:apply, /specgate:check…specgate agents init --tool claude → .claude/commands/

The harness runs the agent agent: in harness.config.yaml names. agents init --tool codex sets Codex's (codex exec -s workspace-write - < {prompt_file}); change it with specgate config set agent "<command>".

A new project, from a brief#

You write docs/brief.md — what the product is, its actors and its modules (Write the brief) — then give the agent:

text
This project uses specgate for spec-driven development. specgate is installed: run it as `specgate`.
Read AGENTS.md first: it is the contract you work under. Do not study specgate's own documentation;
specgate tells you what to do next.

Draft the modules of docs/brief.md, one at a time:
1. Run `specgate propose --from-brief <module>`. It opens the draft and writes DRAFTING.md in it.
2. Follow that DRAFTING.md: it is your prompt.
3. Run `specgate propose --from-brief <module>` again until it says "Ready to review".
4. Stop and say so: a person reviews each draft and answers its questions.

A person then reviews the draft, answers questions.md and approves it (specgate change approve <change> --layer …, or the studio's Changes).

An existing project#

After specgate adopt:

text
This project uses specgate. Read AGENTS.md first.
Write the first requirement from code that already exists: run `specgate propose <change-id>`,
write one requirement — one sentence of what the system SHALL do and a scenario with a real
example, the numbers an existing test already uses — then name it in that test and run
`specgate check`. Stop for a person to review it.

Every day#

text
This project uses specgate. Read AGENTS.md first.
Build the next requirement:
1. Run `specgate status` and take the next requirement it names.
2. Write its test first, naming the requirement (REQ-NNN); see it fail.
3. Write the code until `specgate check` passes.
4. Run `specgate apply <REQ>`.
Repeat one requirement at a time. Stop when status names a step for a person.

Or leave it to the harness: specgate harness run gives each requirement to the agent on its own branch and keeps only what passes the gate (The harness).

What the agent never does#

Put this under every prompt; specgate status --prompt does:

text
Rules you never break:
- Write the test first, and name the requirement in it: that mention is the link.
- Run `specgate check` before you say anything is done; only what it passes is done.
- Never edit spec.md, features/ or docs/specs/ to make a test pass.
- Never archive a change, approve a layer or answer a question in questions.md yourself: a person does.
- When a value is missing, ask (`specgate ask`) or record an assumption; never invent one.

The guards enforce the first two, and the "never approve" of the fourth, in Claude Code, OpenCode and Codex, whatever the agent decides: the code waits for a test that names the requirement, a red gate stops the session from ending, and specgate change approve is refused from the session. Approving needs a person at a terminal.

Next#