← Open Source

An agent harness built for teaching: ~1,600 lines of Python with goal mode, permissions, skills, MCP, ACP, and Claude's server-side compaction.

Python
Momentum
+4stars in 24 hours+1.7%
236
Stars
26
Forks
1
Contributors
Created 2026-11-02 · Updated 2026-12-06 · #2772 today
Top developers
README

mini

An agent harness built for teaching: a core of about 1,690 lines of Python and three 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, Gemini, 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. It runs in a terminal, or inside an editor such as Zed over the Agent Client Protocol.

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 /goal mode, 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; the ACP row, December 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,690 + ~810 lines (Python: core + Responses, Chat Completions and ACP adapters) ~4,000 lines (Python) ~220 lines (one Python file) ~115K lines (TypeScript; loop alone ~1,800) ~1.4M lines (Rust)
Dependencies 3 (anthropic, mcp, agent-client-protocol) 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
Editors (ACP) yes, built in: mini --acp no no via adapter, community pi-acp via adapter, codex-acp via adapter, claude-agent-acp

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), is in benchmarks/. Bug Hunt Bench's harness comparisons, Mini Harness included, live with that benchmark: phuryn/bug-hunt-bench.

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). MINI_SUB_EFFORT=<level> sets the effort subagents and the reviewer work at, even above the session's.

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)
--acp Let an editor launch mini over the Agent Client Protocol
-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). Subagents and the /goal reviewer work at the same effort or medium, whichever is lower (a model without medium: the same effort); --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 server definitions in mcp.json or .mcp.json that need approval before they start. 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"]}
}}

At session startup, mini checks the project's mcp.json first, then .mcp.json. The terminal REPL shows each server's name, its command with arguments and the names of any environment variables it sets before asking for approval. It asks only when its input is a terminal; piped input is treated like a headless run. (Git Bash's mintty connects Windows programs through pipes: approve from Windows Terminal or VS Code's terminal, or run winpty mini once.) Approvals cover the exact file bytes for that project. An edit prompts again. An approval covers the file, not the code its commands run: if a pull changes a server's own script but not the file, the approval still applies. To clear approvals, remove the saved files under ~/.mini/mcp-trust/ (or $MINI_HOME/mcp-trust/ if set).

Headless runs and ACP skip project servers that lack approval and explain how to approve them. Run mini interactively in the project once, or start with --permissions yes to allow that run without saving an approval. When a project file is absent or declined, mini falls back to the personal ~/.mini/mcp.json, which starts without asking.

Hosted servers with OAuth go through mcp-remote, which runs the login in your browser once and keeps the token. Tested with Linear. MCP tool calls follow the session's permissions. --allow mcp__linear__list_ pre-approves Linear's list tools. Tool names are mcp__server__tool, cut to 64 characters, the most OpenAI accepts.

Use mini in an editor

Run mini --acp as a custom Agent Client Protocol agent. In Zed, add this to your settings.

{
  "agent_servers": {
    "mini": {
      "type": "custom",
      "command": "mini",
      "args": ["--acp"]
    }
  }
}

Use the full path to the mini executable if Zed can't find it on its PATH. Model flags such as --model and --effort go in args. mini uses the same provider configuration and environment variables as it does in the terminal.

  • Stream replies and thinking, inspect tool results and file diffs, and approve or reject gated calls in the editor. The permissions selector offers ask, judge, and yes. --permissions sets the starting mode and --allow still pre-approves matching calls.
  • Cancel from the editor and continue in the same thread. Use /goal, /compact, /effort, /context, and /dream from the composer. If the agent needs an answer, it can ask in its reply. The editor can display context usage and the cumulative USD cost when mini knows it.
  • Reopen a thread by its session ID in the same project. mini replays the conversation from its JSONL log, including turns before compaction. Stdio MCP servers forwarded by the editor start without asking and take precedence over local entries of the same name. Project servers need saved approval or an initial yes permission mode on both new threads and reload. On reload, a tool is available when the current server reports its frozen name and schema. Start a new thread to pick up tools added since the session began.

src/mini/acp.py translates between mini's loop and ACP v1 over stdio, in about 520 lines counted apart from the core.

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
Google GEMINI_API_KEY gemini-... gemini-4-neon, gemini-4-hydrogen
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. To keep a model on one provider, see body below.

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

# 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 provider's own request fields go under body in the model's entry in ~/.mini/models.json, and mini sends them with every request as written. On OpenRouter, one model often runs on several hosts with different prices, cache prices and quantization (Amazon's Ergo 1.0 had 10 endpoints from 8 hosts on 3 December 2026, by OpenRouter's own routing report), and OpenRouter picks one for each request. This entry keeps Ergo on Amazon Bedrock, and fails rather than fall back to another host:

{"models": {"amazon/ergo-1.0": {"base_url": "https://openrouter.ai/api/v1", "api": "chat", "key": "OPENROUTER_API_KEY",
                                "prices": "reported",
                                "body": {"provider": {"order": ["amazon-bedrock"], "allow_fallbacks": false}}}}}

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": {
  "llama*": {"base_url": "http://localhost:11434", "window": 64000,
             "prices": {"input": 0, "output": 0, "cache_read": 0, "cache_write": 0}}
}}

Now mini --model llama3.1 is enough, and so is any other llama name, at $0. 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:

  1. src/mini/models.json, as shipped.
  2. Your ~/.mini/models.json.
  3. The flags --base-url, --api, --key-env, --window and --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, lowest first 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 for input, output, cache_read (repeated context, often a tenth of input), and cache_write (first time context is cached). mini adds up the cost for ACP, --json, and the --budget limit. Use "reported" for the provider's cost per reply, as OpenRouter reports 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
body Fields mini adds to every request for this model, as the provider names them, such as OpenRouter's choice of host (below). Where one names a field mini sets, such as max_tokens, the entry's value wins nothing added

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, so a session started at --effort low is told that one usually costs more than doing the work itself. 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. Google's pricing page shows no such rate for Gemini 4 Neon and Hydrogen (2 December 2026), so they summarize at 800,000, as DeepSeek does, on Google's endpoint and on OpenRouter; any other Gemini model gets the 200,000 default, since some, such as Gemini 3.1 Pro, charge more past 200K. 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. A reply cut off at the output limit, or one with no text and no tool call (some models return only their reasoning mid-task), gets a short note asking the model to go on, up to twice in a row, so a headless run doesn't end there. 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 (with background for 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, plus web_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 in the terminal REPL, optionally with numbered options) and goal_done. edit matches whatever the line endings, even in a file that mixes \r\n and \n. After a compaction, a note lists the exact files read and changed, so the model doesn't guess names the summary shortened. 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, and cat/head lose their free pass on such paths. Read-only git (status, diff, log, show) runs without asking, and so do rm and mv of files the model itself created with write in this session, so a headless run can clean up its scratch files. 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, in judge mode. Background job logs read freely. The system prompt tells the model who approves in this session, and a note tells it when /permissions changes that. This is a gate, not a sandbox.
  • /goal. The model keeps working until it calls goal_done. The harness then runs --verify, and a reviewer subagent with an empty context checks the work. The worker never grades itself.
  • Cost. mini adds up request costs from token usage or provider billing. ACP and --json report the total when known, and --budget uses 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, and switching models mid-session.

Tests

uv run pytest -q

279 offline tests (275 run on macOS and Linux) cover the agent loop, the Responses and Chat Completions translations, and MCP over stdio. The ACP tests drive mini over subprocess pipes with the real ACP SDK client and scripted replies. They include prompts through the installed launcher against loopback endpoints for Messages and Responses. The tests check streaming, edits, permissions, cancellation, replay after restart, and that ACP sessions preserve the same transcript invariants. AGENTS.md has the rules for changing the code.

Nearby in the ranking

AI Rank for iPhone

Follow AI model rankings

Download on the App Store