Start with an agent
One prompt to paste into any coding agent. It installs Stoic, wires the gate into the agent's tools, writes the spec first, and runs the loop until verify passes.
You don't have to learn Stoic before your agent uses it. Paste the prompt below into Claude Code, Codex, Gemini CLI, Cursor, Copilot or any other coding agent, in the root of your repository. It sets the project up, writes a spec of what the code does now, stops to have you read that spec back, and only then locks it and writes the tests.
The prompt
Set this repository up with Stoic, a small spec language whose toolchain
locks tests and checks every change against them. Its docs, as Markdown,
start at https://stoic-lang.org/llms.txt
1. If `stoic --version` fails, install it. On macOS or Linux:
curl -LsSf https://stoic-lang.org/install.sh | sh
On Windows (PowerShell):
irm https://stoic-lang.org/install.ps1 | iex
Or, with Rust: cargo install stoic-lang
Each puts stoic in ~/.cargo/bin; add it to PATH if it isn't there.
Before Stoic's first release, only this works:
cargo install --git https://github.com/stoic-lang/stoic stoic-lang
2. In the repository root, run `stoic init`, then
`stoic gate --install all git`. That writes an example spec.stoic, a CI
workflow, hooks that make agent tools ask `stoic gate` before they write
code, an AGENTS.md section, the Stoic agent skill and a git pre-commit
hook. Read the AGENTS.md section and the skill (`stoic guide --skill`)
before you go on. Then write stoic.code beside the lock: one glob per
line for the implementation code (src/**, say).
3. Replace the example spec.stoic with a spec of what this project does
now, one module or feature at a time: the things it has, the rules on
each field with an example on each side of every limit, and tests that
check values. Run `stoic check .` until it passes.
4. Show me what the compiler reads back (`stoic spec.stoic`) and ask me
whether it says what I mean. Change the spec until I say it does.
5. Then run `stoic lock .` and implement every test `stoic brief .` lists,
in this project's test framework. The tests write results.txt through
the reporter `stoic harness --lang node --out stoic-results.cjs` prints
(or --lang python, or --lang sh). Set TEST_COMMAND and the install URL
in .github/workflows/stoic-verify.yml.
6. Run `stoic verify results.txt --run "<test command>" --strict` until it
passes, then commit the spec, stoic.lock, stoic.code and the tests.
From then on, every change starts in the spec: edit it, `stoic check .`,
`stoic lock .`, then write the code. When `stoic gate` refuses a write, do
what its `next:` line says. Never edit stoic.lock by hand. If a locked test
looks wrong, have it record `dispute ID: why` and tell me.
Step 4 is the one that matters. The compiler's reading is plain English, so you can tell whether the agent understood your project before a single test exists. Everything after it is checked by the toolchain, not by the agent's good intentions.
What it sets up
stoic init
created spec.stoic
created .gitattributes
created CODEOWNERS.stoic.example
created .github/workflows/stoic-verify.yml
stoic gate --install all git
created .claude/settings.json
created .codex/hooks.json (Codex runs it once you trust it: /hooks in Codex)
created .gemini/settings.json
created .factory/hooks.json
created AGENTS.md
created .claude/skills/stoic/
created .agents/skills/stoic/
created .kiro/skills/stoic/
created .git/hooks/pre-commitThree layers, each catching what the one before can miss:
- The hooks run
stoic gate --hookbefore every file the agent writes. Until this ticket's spec change is locked, implementation code is refused, and the refusal tells the model the one next step. - The AGENTS.md section and the skill tell the agent the loop before it starts, so it rarely hits the gate at all. The skill is listed by name and read only when a task needs it.
- Git's pre-commit hook and CI check what is committed, whatever wrote it. CI runs
stoic verify --againstthe base branch, which no prompt can talk around.
The gate and verify are explained in full on Agents.
Per tool
Claude Code. The hook is in .claude/settings.json and the skill in .claude/skills/stoic/. Claude Code reads AGENTS.md only when the project has no CLAUDE.md; if yours keeps one, add a line @AGENTS.md to it so the section is read too.
Codex. The hook is in .codex/hooks.json, and Codex runs it once you trust it (/hooks in Codex). Codex reads AGENTS.md, and the skill from .agents/skills/stoic/.
Gemini CLI. The hook is in .gemini/settings.json, before write_file and replace, and the skill comes from .agents/skills/stoic/. Gemini CLI reads GEMINI.md by default: add AGENTS.md to context.fileName in .gemini/settings.json, or add the section to GEMINI.md. For some accounts Google has replaced Gemini CLI with Antigravity CLI, which Stoic installs no hook for; check its docs.
Factory Droid. The hook is in .factory/hooks.json. Droid reads AGENTS.md, and the skill from .agents/skills/stoic/.
Cursor. Cursor has a hook before tool calls, but Stoic doesn't install one for it yet: its docs don't name the field that holds the written file. So the AGENTS.md section, the pre-commit hook and CI are the gate. Cursor reads AGENTS.md, and the skill from .agents/skills/stoic/.
GitHub Copilot. Copilot has hooks (in the CLI, the cloud agent and VS Code), but Stoic doesn't install one for them yet, for the same reason: the pre-commit hook and CI are the gate. Copilot's agents read AGENTS.md, and the skill from .agents/skills/ or .claude/skills/.
Kiro. Kiro reads AGENTS.md, and the skill from .kiro/skills/stoic/. Stoic installs no hook for it, so the pre-commit hook and CI are the gate.
Anything else. If the tool reads AGENTS.md, it has the loop. If it loads Agent Skills from another folder, stoic guide --skill prints the skill to put there. If it reads neither, give it the prompt above, or stoic brief spec/ for a single task: the brief is the whole job in one page.
When the agent joins an existing Stoic project
The prompt above is for adopting Stoic. In a repository that already has a spec, an agent needs much less:
This project uses Stoic. Run `stoic brief spec/` (add `--as <your name>`
if there is a stoic.segments file) and follow it exactly. Don't edit .stoic
files or stoic.lock. When you're done, run the verify command at the end of
the brief and include its output in your report.For the agent itself
Every page of these docs has a Markdown twin: add .md to its path, as in /docs/start-with-an-agent.md. /llms.txt lists them all, and /llms-full.txt is every page in one file. On each docs page, "Copy page" puts the Markdown on your clipboard, ready to paste into a chat.