mini
An agent harness built for teaching: a core of about 1,500 lines of Python and two dependencies, small enough to read in one sitting.
Other minimal harnesses exist, but none has goal mode, permissions, skills and MCP servers. I wanted a fully working one to explain how a harness is built, down to Anthropic's server-side compaction. That's why it's built around Claude's API. It also runs other models: GPT, Grok, DeepSeek, popular OpenRouter models and local Ollama models by name, and any other model through Anthropic's Messages format, OpenAI's Responses format or Chat Completions, from Gemini and OpenRouter to Ollama on your own machine (Models).
It has a tool loop, five local tools plus web search, sessions you can resume, compaction, Agent Skills, MCP servers, subagents, a /goal mode with an independent reviewer, permission prompts with an optional AI judge, and memory kept in markdown files.
What's different
- Built to be read. One small folder, with no framework and no plugin system. Every part exists because something specific broke without it.
- The worker never grades itself. In
/goalmode, a claimed "done" counts only after the verify command passes and a reviewer with a fresh context checks the work. - Permissions with an AI judge. Risky actions ask you, or go to a small decision model that answers in about 0.3 seconds for a fraction of a cent.
- Never edits what it already sent. The conversation is append-only, which keeps Claude's thinking valid and the cache warm across long sessions, resumes and compaction.
- Uses existing formats. Skills and MCP servers set up for Claude Code work as they are, and hosted OAuth servers like Linear connect through
mcp-remote.
How it compares
As of November 2026. Pi is built to be extended; mini is built to be read.
The same table as text
| Mini Harness | mini-swe-agent | nanocode | Pi | Codex CLI | Claude Code | |
|---|---|---|---|---|---|---|
| Code | ~1,500 lines (Python, core) | ~4,000 lines (Python) | ~220 lines (one Python file) | ~115K lines (TypeScript; loop alone ~1,800) | ~1.4M lines (Rust) | |
| Dependencies | 2 (anthropic, mcp) | 14 (litellm, pydantic, textual...) | 0 (standard library) | 22 (5 are its own packages) | 77 (52 are its own crates) | |
| Tools | 5 + web search (+ subagent, ask user, goal done) | bash only | 6 | 4 (+6 optional) | many | many |
| Sessions | yes | no | no | yes, branching | yes, branching | yes, branching |
| Compaction | yes | no | no | yes | yes | yes |
| Claude's server compaction | yes | no | no | no, own summary, drops thinking | no, no Claude models | no, own summary, drops thinking |
| Permissions | yes, plus judge | yes, confirm mode; container optional | no | no, docs advise a container | yes | yes |
| Subagents | yes | no | no | no, by design | yes | yes |
| Goal mode | yes, verify command + reviewer | no | no | no | yes, the worker marks it done | yes, a judge model, no tools |
| MCP | yes | no | no | yes | yes | yes |
| Skills | yes | no | no | yes | yes | yes |
On Terminal-Bench 2.1
Terminal-Bench 2.1 gives an agent a job in a Docker container, such as building a Cython extension, setting up a git web server or booting an Alpine VM in QEMU, and checks the result with hidden tests. On all 89 tasks, run through Harbor with Claude Haiku 5.5 at high effort for every harness, three runs each, mini 1.0.3 passed 72.0 on average: third of nine harnesses, behind Kilo Code (74.0) and Claude Code (72.7), with the fewest agent minutes (571 a run) and for $3.28 a run.
Most gaps are within run-to-run noise: each harness's score moved by 2 to 9 tasks between its own runs. Kilo Code, Claude Code, Hermes Agent and Pi ran together; Mini Harness and then the other four ran right after, with the same tasks, settings and machine size.
The same benchmark on DeepSeek V4.1 Flash 1017 at high effort, with all nine harnesses running side by side: mini 1.0.4 passed 75.0 on average, fourth of nine, behind Claude Code (77.7), mini-swe-agent (77.3) and OpenCode (75.7), for $2.25 a run.
Here too most gaps are noise: a harness's score moved by 1 to 9 tasks between its own runs. Cost is each harness's tokens at DeepSeek's off-peak price, thinking included.
Every run behind these charts, plus Terminal-Bench 2.0 (Claude and DeepSeek) and Bug Hunt Bench, is in benchmarks/.
Install
mini is a Python program, installed with uv, which also fetches Python 3.12+ if you don't have it.
macOS / Linux (Terminal)
curl -LsSf https://astral.sh/uv/install.sh | sh
# open a new terminal window, so uv is on PATH
uv tool install git+https://github.com/phuryn/mini-harness
Windows (PowerShell)
winget install Git.Git # uv needs git to fetch mini; mini's bash tool runs Git Bash
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
# open a new PowerShell window, so git and uv are on PATH
uv tool install git+https://github.com/phuryn/mini-harness
Either way, the last command ends with Installed 1 executable: mini. Update later with uv tool upgrade mini; remove with uv tool uninstall mini.
In a container that also runs tests (a benchmark task, a CI job): if the machine has no Python 3.12 or newer, uv downloads one for mini, and later uv run calls on that machine pick it over the system Python the tests expect. Install mini with its own Python folder, which uv run doesn't search, and set the same variable for uv tool upgrade:
UV_PYTHON_INSTALL_DIR=/opt/mini-python uv tool install git+https://github.com/phuryn/mini-harness
Keys
mini reads its keys from environment variables: the one for the model you run (Claude's, by default), and OpenRouter's if you want the judge.
| Variable | What it's for | Where to get it |
|---|---|---|
ANTHROPIC_API_KEY |
Claude models (the default) | console.anthropic.com |
OPENROUTER_API_KEY |
The permission judge, Jev. With this key set, Jev approves risky actions it's sure about and asks you only when it isn't. Also models on OpenRouter (--model z-ai/glm-5.3) |
openrouter.ai/keys |
DEEPSEEK_API_KEY |
DeepSeek models (--model deepseek-flash, or any deepseek- name) |
platform.deepseek.com |
OPENAI_API_KEY |
OpenAI's GPT models (--model gpt-6.2-sol, or any gpt- name) |
platform.openai.com |
XAI_API_KEY |
xAI's Grok models (--model grok-4.7, or any grok- name) |
console.x.ai |
Set them once, so every new terminal has them:
# macOS (zsh); on Linux use ~/.bashrc
echo 'export ANTHROPIC_API_KEY="sk-ant-..."' >> ~/.zshrc
echo 'export OPENROUTER_API_KEY="sk-or-..."' >> ~/.zshrc
source ~/.zshrc
# Windows: saved for new windows, so open a new PowerShell afterwards
setx ANTHROPIC_API_KEY "sk-ant-..."
setx OPENROUTER_API_KEY "sk-or-..."
Any other provider's key goes in a variable you name, and --key-env tells mini which (Models). A model whose key is missing refuses to start and says which variable to set. Keys never go on the command line or in a config file.
First run
Interactive. Start it in a project and talk to it. /help lists commands, /exit quits. The first line shows the model and who approves risky actions: permissions judge when the OpenRouter key is set, permissions ask otherwise.
cd ~/some/project
mini # or start on another model: mini --model claude-sonnet-5-5
Unattended. -p runs one prompt, prints the answer and exits. Nobody is there to approve risky actions, so they're denied unless --allow covers them. It exits with code 1 when the run didn't finish (an error, an interrupt, the output limit) or, with --goal, when the goal isn't done, so a script can tell.
cd ~/some/project
mini -p "explain this repo in five bullets"
The flags work the same in both modes: --model, --effort, --permissions and --allow all apply to an interactive session too. mini --models lists the models mini knows: your account's Claude models when the Anthropic key is set, the others from models.json (gpt-* stands for any gpt- name). Every flag is under Using it.
The bash tool runs bash: from PATH on macOS and Linux (falling back to /bin/sh without it), Git Bash on Windows. On Windows without Git for Windows it falls back to cmd.exe; MINI_BASH points it to another bash.exe. MINI_NO_WEB=1 leaves web search out of the tools, for runs that must not look anything up. MINI_NO_TASK=1 leaves out subagents (the /goal reviewer still runs).
To work on mini itself: git clone https://github.com/phuryn/mini-harness && cd mini-harness && uv sync && uv run pytest -q, then uv run --project <clone> mini from any folder.
Using it
| Command | What it does |
|---|---|
/new [model] |
Start a fresh session, on another model if given |
/effort [level] |
Show or change the effort for the next requests |
/permissions [mode] |
ask, judge or yes: who approves risky calls |
/sessions, /resume [id] |
List this directory's sessions, newest first, with last update, prompts and the first prompt as a title (* marks the one you're in); resume the latest or one by id prefix |
/context |
How full the context is (the size the API reported for the last request) and what fills it: system prompt, mini's tools, MCP tools, web search, conversation |
/compact |
Replace the history with a summary now |
/dream |
Tidy memory/: merge duplicates, drop what's stale |
/goal <objective> |
Keep working until the objective is done; also resume, clear, status |
/exit |
Quit. Every message is already saved |
Ctrl-C stops the current turn and keeps the session valid.
| Flag | What it does |
|---|---|
-p "..." |
Run one prompt headless and print the answer (--json for one JSON line with status and cost) |
-c / -r <id> |
Continue the latest session, or resume one |
--model, --effort |
Model (default: main in models.json) and effort (default high, or the nearest level the model takes); --models lists the models mini knows |
--base-url, --api, --key-env |
Where a model mini doesn't know runs, which format it speaks (messages, responses or chat) and which variable holds its key (Models) |
--window 64000, --prices 1.25,10 |
The model's context window, and its prices in dollars per million tokens: input, output, then optionally cached input read and written. --prices reported takes the cost the provider reports with each reply (OpenRouter) |
--allow "python3 -m pytest" |
Pre-approve bash commands starting with these words, or MCP tools starting with this prefix (repeatable). Headless mode denies everything else |
--permissions ask|judge|yes |
Who approves risky calls: you, the Jev judge, or nobody (yes: only in a sandbox). Default: judge when OPENROUTER_API_KEY is set, else ask; headless runs default to ask |
--goal "..." --verify "pytest -q" |
Headless goal mode; done only when the verify command passes and a fresh reviewer agrees |
--max-turns N, --budget 2.50 |
Limits for goal mode |
Project files it reads. AGENTS.md (instructions), memory/INDEX.md (memory, which the model keeps up to date), skills in skills/, .claude/skills/ or .agents/skills/ (plus ~/.mini/skills/), and MCP servers in mcp.json or .mcp.json (plus ~/.mini/mcp.json). Skills and MCP use the same formats as Claude Code, so existing ones work as they are. Only each skill's name and description go into the prompt; the model reads the full SKILL.md when a task matches.
MCP. Servers run over stdio, as any command:
{"mcpServers": {
"github": {"command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"]},
"linear": {"command": "npx", "args": ["-y", "mcp-remote", "https://mcp.linear.app/mcp"]}
}}
Hosted servers with OAuth go through mcp-remote, which runs the login in your browser once and keeps the token. Tested with Linear. Every MCP call asks first unless --allow covers it (e.g. --allow mcp__linear__list_ for Linear's read-only list tools). Tool names are mcp__server__tool, cut to 64 characters, the most OpenAI accepts.
Models
Most models need only a name, and a key if the provider needs one. A model whose name starts with one of these prefixes takes its provider's endpoint, key, limits and effort levels from the family's entry, so a model released after this version runs without an update (mini --model gpt-7). Every shipped setting can be changed, for one run with a flag or for good in your own file (Where the settings come from).
| Provider | Key | Any model named | Shipped with prices |
|---|---|---|---|
| Anthropic | ANTHROPIC_API_KEY |
claude-... |
claude-opus-5-5 (the default), claude-sonnet-5-5, claude-haiku-5-5, claude-opus-5, claude-opus-4-8, claude-sonnet-5 |
| OpenAI | OPENAI_API_KEY |
gpt-... |
gpt-6.2-sol, gpt-6-luna |
| xAI | XAI_API_KEY |
grok-... |
grok-4.7 |
| DeepSeek | DEEPSEEK_API_KEY |
deepseek-... |
deepseek-flash, deepseek-v4-pro |
| OpenRouter | OPENROUTER_API_KEY |
deepseek/..., google/..., minimax/..., mistralai/..., moonshotai/..., openai/..., qwen/..., tencent/..., x-ai/..., z-ai/... |
all, at the cost OpenRouter reports |
| Ollama, on this machine | none | gemma4..., gpt-oss..., qwen3... |
all, at $0 |
What mini can't know is a new model's price. An unlisted Claude model is priced like Opus. An unlisted model from the other providers runs unpriced: --json reports "cost": null, and --budget refuses to start, since a limit it can't measure would never stop anything. Give the prices to fix that: --prices 1.25,10 is $1.25 per million input tokens and $10 per million output tokens. OpenRouter's models are priced at what OpenRouter reports it billed for each reply ("prices": "reported"), not at a list price, because what a request costs depends on which provider OpenRouter sends it to: a test call to GLM 5.3 Flash was billed $0.09 and $0.30 per million tokens, against the $0.036 and $0.08 its model list shows. A reply that reports no cost leaves the run unpriced.
OpenRouter names start with the vendor (z-ai/glm-5.3, as on openrouter.ai/models), so they never reach a vendor's own API: deepseek/... goes to OpenRouter, deepseek-... to DeepSeek. The vendors above are the ones at the top of OpenRouter's rankings on 1 December 2026. A bare name like qwen3.6 or gpt-oss:20b goes to Ollama on this machine. Start Ollama with the context the entries assume: OLLAMA_CONTEXT_LENGTH=64000 ollama serve (see below).
Any other model needs three things: where it is (--base-url), which format it speaks (--api), and which environment variable holds its key (--key-env; leave it out for a server that needs none). mini speaks three formats, and nearly every server and provider offers at least one: Anthropic's Messages (messages, the default), OpenAI's Responses (responses) and Chat Completions (chat).
# A model Ollama serves that has no entry (ollama list names them): Anthropic's format, no key
mini --model llama3.1 --base-url http://localhost:11434 --window 64000
# Gemini, at Google's OpenAI-compatible endpoint
mini --model gemini-4-hydrogen --api chat --key-env GEMINI_API_KEY \
--base-url https://generativelanguage.googleapis.com/v1beta/openai --window 1048576 --prices 1.5,7.5,0.075
# An OpenRouter model from a vendor without a family
mini --model meta-llama/llama-3.3-70b-instruct --base-url https://openrouter.ai/api/v1 --api chat --key-env OPENROUTER_API_KEY \
--prices reported
| Where the model runs | --base-url |
--api |
Key |
|---|---|---|---|
| Ollama | http://localhost:11434 |
messages |
none |
llama.cpp (llama-server) |
http://localhost:9931 (Docker images: port 8080) |
messages |
none, unless it was started with --api-key |
| vLLM | http://localhost:8000 |
messages |
none by default |
| LM Studio | http://localhost:1234 |
messages |
none, unless "Require Authentication" is on |
| OpenRouter | https://openrouter.ai/api/v1 (messages: https://openrouter.ai/api) |
chat or messages |
OPENROUTER_API_KEY |
| Gemini | https://generativelanguage.googleapis.com/v1beta/openai |
chat |
GEMINI_API_KEY |
| Kimi | https://api.moonshot.ai/anthropic |
messages |
MOONSHOT_API_KEY |
| GLM | https://api.z.ai/api/anthropic |
messages |
ZAI_API_KEY |
| Qwen (Singapore region) | https://dashscope-intl.aliyuncs.com/apps/anthropic |
messages |
DASHSCOPE_API_KEY |
| Groq | https://api.groq.com/openai/v1 |
chat |
GROQ_API_KEY |
The key variables for providers mini has no family for are only suggestions: set the key under any name and pass that name. The table was checked against each project's docs on 1 December 2026. So far, mini has run OpenRouter in both formats (Gemini 4 Hydrogen and DeepSeek V4.1 Flash passed all five smoke tasks over chat, and the top model of each OpenRouter family above finished a two-step task with tools) and Grok over chat. The other rows, Ollama's included, come from the docs alone.
A local server needs its real context length. Pass it as --window: mini compacts the conversation at three quarters of it and asks for at most a quarter as output, and the 128,000 it assumes otherwise is a guess. Ollama's default context is small: 4,096 tokens, or more on a GPU with more memory (its docs). Start it with OLLAMA_CONTEXT_LENGTH=64000 ollama serve, the 64K its docs recommend for agents. The shipped gemma4, gpt-oss and qwen3 entries assume that; for any other model, pass --window 64000. vLLM calls tools only when started with --enable-auto-tool-choice --tool-call-parser <parser>.
Write down a model you use often in ~/.mini/models.json instead of repeating the flags. Flags apply to one run, so resuming a session started with them (-c, -r) needs them again.
{"models": {
"gemini-*": {"base_url": "https://generativelanguage.googleapis.com/v1beta/openai", "api": "chat",
"key": "GEMINI_API_KEY", "window": 1048576, "efforts": ["low", "high"]},
"gemini-4-hydrogen": {"prices": {"input": 1.5, "output": 7.5, "cache_read": 0.075, "cache_write": 1.5}}
}}
Now mini --model gemini-4-hydrogen is enough, and so is any other gemini- name. An entry named "<prefix>*" is a family: its models take every field they don't set from it. An entry whose base_url differs from its family's stands alone, so a gpt-oss on your own vLLM server takes nothing from OpenAI's entry.
Where the settings come from
Three layers, each overriding the one before it field by field:
src/mini/models.json, as shipped.- Your
~/.mini/models.json. - The flags
--base-url,--api,--key-env,--windowand--prices, for this run's model.
No model name is written in the code. The shipped file starts like this:
{
"main": "claude-opus-5-5",
"subagent": "claude-sonnet-5-5",
"subagent_cheap": "claude-haiku-5-5",
"models": {
"claude-*": {"window": 1000000, "compact_at": 150000, "search": 0.01, "fallbacks": true,
"efforts": ["low", "medium", "high", "xhigh", "max"],
"prices": {"input": 4, "output": 20, "cache_read": 0.20, "cache_write": 5}},
"claude-sonnet-5-5": {"max_output": 128000, "prices": {"input": 2, "output": 10, "cache_read": 0.20, "cache_write": 2.5}},
"gpt-*": {"base_url": "https://api.openai.com/v1", "key": "OPENAI_API_KEY", "api": "responses",
"window": 1050000, "compact_at": 250000, "max_output": 128000, "search": 0.01,
"efforts": ["low", "medium", "high", "xhigh"]},
"gpt-6.2-sol": {"prices": {"input": 2, "output": 10, "cache_read": 0.10, "cache_write": 2.5}}
}
}
The last column says what a model from another provider gets when a field is left out. A Claude model takes the field from "claude-*" instead.
| Field | Meaning | Left out (other providers) |
|---|---|---|
main, subagent, subagent_cheap |
Default model; the model for subagents and the goal reviewer; the cheaper one the main model may pick for plain reading or search | |
base_url |
The provider's endpoint. An entry with one is another provider's model | Claude |
api |
messages, responses or chat |
messages |
key |
The name of the environment variable that holds the key, never the key itself | no key sent |
window |
Context window in tokens (shown by /context) |
128,000, an assumption |
compact_at |
Input tokens at which the conversation is summarized; keep it well below window. MINI_COMPACT_AT overrides it |
¾ of window, at most 200,000 |
max_output |
Most tokens one response may have, thinking included; mini asks for that much | ¼ of window, at most 64,000 (Claude: 64,000) |
efforts |
Effort levels the model accepts | none: no effort is sent |
search |
Dollars per web search the provider bills; 0 when it bills only the tokens a search adds | no web search tool |
prices |
Dollars per million tokens: input, output, cache_read (repeated context, often a tenth of input) and cache_write (first time context is cached). mini multiplies each request's token counts by these and adds them up, for --json and the --budget limit. It isn't shown while you work. Or "reported": the cost the provider reports with each reply, as OpenRouter does in all three formats |
cost unknown: null in --json, and --budget refuses |
prices_over_100k |
Optional higher rates for prompts over 100K tokens (Haiku 5.5 has them) | |
peak_utc, off_peak |
Optional off-peak discount: the weekday UTC hours charged in full, and the share of the price outside them. DeepSeek: 01:00–04:00 and 06:00–10:00 UTC, half price the rest of the time and at weekends. Public holidays are priced as weekdays | |
fallbacks |
Claude only: if the model declines partway, the API continues on another model |
When Claude's names change, edit main, subagent and subagent_cheap. A new Claude model needs one entry with its prices; the rest comes from "claude-*".
Other providers run the same loop, tools and sessions, with three differences. mini sends no thinking-block binding, betas or fallbacks. It summarizes the conversation itself instead of leaving that to the server. Subagents run on the same model. The shipped compact_at for GPT and Grok sits below the prompt size at which OpenAI (272K) and xAI (200K) switch to long-context rates, which mini doesn't price. DeepSeek has billed web searches only as the tokens they add since 18 November 2026 (its pricing page), so its search is 0.
The Responses format goes through src/mini/responses.py, which translates each request and reply and isn't counted in the core. The transcript stays in Anthropic's format, and each block also keeps the item the API returned. That item goes back unchanged on the next request, encrypted reasoning included. So nothing is stored at OpenAI or xAI (store: false), and the history stays append-only. Web search is the provider's own tool; mini counts the searches the provider reports billing (OpenAI doesn't charge for opening a page, xAI does). A refusal is shown as it streams, and the turn stops. GPT and Grok don't hold the model to the tool schemas, so edit refuses a replace_all that isn't true or false.
The Chat Completions format goes through src/mini/chat.py, also outside the core count. A reply streams in pieces. mini puts it back together, keeps the whole message with the reply's first block, and sends it back unchanged on the next request. Whatever the provider added travels with it, such as reasoning or Gemini's thought signatures, which Gemini 3 and 4 require back during tool calls. mini's notes during a session go as user text, because many local models' chat templates refuse a second system message. This format has no web search, since every provider names that tool differently. If the server reports no token counts, mini estimates them at about four characters a token, so compaction still happens. OpenAI's newest models take tools over Chat Completions only in limited cases, so the shipped gpt-* entry uses Responses.
How it works
- The loop. Send the conversation, stream the reply, run the tools the model asked for, send the results back, repeat until it stops asking. A reply that fails partway (overloaded, rate-limited, a server or network error) is tried again up to three times. The rest is bookkeeping around that loop.
- Append-only transcript. The system prompt and tool list are frozen at session start; nothing already sent is ever edited. Current Claude models bind thinking blocks to everything before them, so an edit would break the conversation. Later instructions are appended as system messages.
- Sessions. One JSONL file per conversation under
~/.mini/sessions/<project>/. Resuming means reading it back; a crash mid-tool is repaired on resume, by appending. - Every tool call gets an answer, including failures, denials and interrupts, so the transcript stays valid.
- Tools.
read(text, or a PNG, JPEG, GIF or WebP image the model sees, up to 3000 px a side and 20 MB of images per conversation),write,edit,bash(withbackgroundfor servers and long builds: detached, output in a log under~/.mini/jobs/; on macOS and Linux, a command still running at its timeout goes on the same way until it ends or mini exits; each result lists what earlier calls left running and says when one ends),find, plusweb_search(direct searches only, without Anthropic's code sandbox),task(a subagent with a fresh context that returns only its answer),ask_user(a question, optionally with numbered options; left out of headless runs) andgoal_done. Errors tell the model what to do next. If a reply hits the output limit, mini tells the model and lets it continue, twice in a row; a goal pauses after that. - Permissions. Reads, searches and edits inside the project run freely. Reading outside the project, or any file that may hold secrets (
.env, keys,~/.ssh,~/.aws, credentials files), needs approval, because whatever the model reads goes to the API and into the session file. In judge mode Jev can approve reads outside the project, but secrets and writes to files that run later always ask you. Searches never look inside those files, or inside a link that points outside the project, andcat/headlose their free pass on such paths. Read-only git (status,diff,log,show) runs without asking. Other bash commands, MCP calls, writes outside the project and writes to files that run later (.git/,Makefile,package.json...) ask first, or go to Jev, a small decision model, injudgemode. Background job logs read freely. The system prompt tells the model who approves in this session, and a note tells it when/permissionschanges that. This is a gate, not a sandbox. /goal. The model keeps working until it callsgoal_done. The harness then runs--verify, and a reviewer subagent with an empty context checks the work. The worker never grades itself.- Cost. Every request is priced from its token usage with the rates in
models.jsonand summed. It isn't shown while you work:--jsonreports it, and--budgetuses it to stop a long goal run.
Left out on purpose
A full-screen UI, hooks, plugins, a sandbox, checkpoints (use git), forked or parallel subagents, switching models mid-session, and editor integration.
Tests
uv run pytest -q
239 offline tests (235 run on macOS and Linux) against a scripted fake client, scripted Responses and Chat Completions streams, and a real MCP stdio server. They check the invariants above: append-only requests, an answer for every tool call, resume, compaction, interrupts, goal mode, subagent isolation, and which settings a model gets from its family, the file and the flags. AGENTS.md has the rules for changing the code.