Artifact 60d4ed657e70eea22fd09d47be0695565c2eb0207f4518444a427d7293d151fe:
- File
docs/harnesses.md
— part of check-in
[38c2e6220a]
at
2026-11-16 21:25:35
on branch trunk
— Suit counts how often each skill, agent and command is used
The counts come from the records a harness already keeps of its own work, read afterwards. What those records look like is data in the wardrobe's harness section: where the files are, where a record's time and folder are, and rules that say what an invocation looks like. No harness is named in suit's code. docs/harnesses.md has the rules for the first harness, checked against real records.
A streaming reader walks each JSON line against the rules in 64 KiB chunks, keeps at most the first 512 bytes of any string and stops at 64 levels, so a line of any length cannot grow its memory. It has its own fuzz target.
Suit keeps its own tally per machine under usage/ in its home folder, outside any wardrobe: one line per invocation with time, harness, kind, name, project and call id. A call copied into a resumed or forked record is counted once, by its id. The tally outlives the harness's own clean-up and drops what is older than 400 days.
suit usage scan reads what is new; a first scan reads files changed in the last 45 days and later scans read only new bytes. suit usage prints the table for a window, default 30 days, and --tsv gives the same rows for other tools. suit tend with no name runs the scan after tending; a failed scan is reported and changes nothing else. suit-run is untouched and the speed budget passes as before.
Measured: a generated tree of 200 files and 200 MiB scans in about half a second and a second scan opens no record file. On a real tree of 2547 files, read-only into a scratch home: 3756 invocations in 60 seconds, 10 MiB at peak.
A new suite, test/usage.sh, with 236 cases, is part of the gate.
2855 unit checks (was 1473), 620 shell cases, 1153 store cases, 846 placement cases, 378 project cases and 236 usage cases, under clang, under gcc 16, with no user name set, and under a strict umask, in one run of make gate (41 minutes). 100% coverage in all 28 source files. One existing unit line changed: a table of fault points gained entries. (user: dmestas, size: 9045) [annotate] [blame] [check-ins using]
# Harnesses Facts about the three harnesses suit knows, as written in a `[harness NAME]` stanza (see `conf-format.md`). Checked on 2026-11-12 against Claude Code 2.1.323 and Codex 0.166.0, both installed on this machine. pi is not installed here; its entries come from its published documentation. Each path is marked one of: - **verified**, with how. - **from the first version's adapter**, which means unverified. The first version's adapters (`src/adapters/claude-code.ts`, `codex.ts`, `pi.ts`) write only project-level paths (`.claude/...`, `.pi/skills/...`, `AGENTS.md`), so they never confirmed a User-scope path. No User-scope path below rests on them alone; the mark is kept for any that have no better source. ## Claude Code ``` [harness claude] skills.user = ~/.claude/skills agents.user = ~/.claude/agents commands.user = ~/.claude/commands instructions.user = ~/.claude/CLAUDE.md ``` | Key | Status | |---|---| | `skills.user` | verified: the folder on this machine holds skills Claude Code loads, and `make live` places a skill there under a scratch home and the model lists it | | `agents.user` | verified: the folder holds agent files (`implementer.md`, `reviewer.md` and others) that Claude Code lists as its agent types | | `commands.user` | verified: the folder exists on this machine and holds command files Claude Code offers as slash commands | | `instructions.user` | verified: `make live` places the file under a scratch home and the model repeats a marker from it | ### Session records, for the usage counts ``` sessions = ~/.claude/projects/*/*.jsonl sessions = ~/.claude/projects/*/*/subagents/*.jsonl session time = timestamp session project = cwd use skill = message.content[] where type=tool_use name=Skill name input.skill id id use agent = message.content[] where type=tool_use name=Agent name input.subagent_type id id use agent = message.content[] where type=tool_use name=Task name input.subagent_type id id use command = . where type=user name message.content between <command-name>/ </command-name> ``` Verified against real records on 2026-11-16: the files are the ones named; a skill is an `assistant` record whose `message.content` array has a block `tool_use` named `Skill` with `input.skill`, a subagent the same with `Agent` (older files `Task`) and `input.subagent_type`, and a slash command a `user` record whose `message.content` is a string or a list of text blocks holding `<command-name>/NAME</command-name>`. Every record has `timestamp` and `cwd` at its top. The rules were run on the real records read-only and, for a sample of 120 files, gave the same counts as an independent script (46 invocations added, 11 records skipped). Facts the rules survive: the fields of a block come in any order; lines are up to megabytes; a resumed or forked session copies earlier records into a new file, so the call's `id` is what counts once; a skill's name appears in listings and quoted text, which no rule reaches; a name can be namespaced (`plugin:skill`) or scoped (`apps/web:deploy`). Two things the rules count that are not invocations, handled by how the reader works and not by the rules: `api-request-blob` records hold a copy of earlier blocks at the same path and carry no `timestamp`, so each is skipped (about a fifth of the matches on the real tree) and the call is counted from its own record; and an `Agent` block with no `subagent_type` (the default agent) names nothing and is not counted. ## Codex ``` [harness codex] skills.user = ~/.codex/skills commands.user = ~/.codex/prompts instructions.user = ~/.codex/AGENTS.md ``` Codex reads its home from `CODEX_HOME`, default `~/.codex` (the binary carries that default and the variable name). | Key | Status | |---|---| | `skills.user` | verified: `make live` places a skill there under a scratch home and the model lists it; the folder on this machine holds skills Codex loads | | `instructions.user` | verified: `make live` places the file there and the model repeats a marker from it, and repeats the new marker after an edit with no suit command | | `commands.user` | from the first version's adapter (unverified). The folder exists on this machine and holds a file, but Codex 0.166.0 shows no sign of loading it: its binary names `codex-home-skills`, `.agents/skills`, `.codex/agents` and `AGENTS.override.md`, and no prompts folder. Custom prompts may be retired in this version. Treat as a guess until a Codex slash-command session shows the file loaded. | | agents | no `agents.user` is declared. The binary mentions `.codex/agents`, which is not checked here. | Codex also reads `~/.agents/skills` (the binary calls it `user-agent-skills`). That is a second skills folder; suit does not use it. ## pi ``` [harness pi] skills.user = ~/.pi/agent/skills commands.user = ~/.pi/agent/prompts instructions.user = ~/.pi/agent/AGENTS.md ``` pi's folder is `~/.pi/agent`, changeable with `PI_CODING_AGENT_DIR`. | Key | Status | |---|---| | `skills.user` | verified from the tool's documentation (the readme of the `@mariozechner/pi-coding-agent` package: "Place in `~/.pi/agent/skills/`") | | `commands.user` | verified from the same readme, which calls these prompt templates: `~/.pi/agent/prompts/` | | `instructions.user` | verified from the same readme: pi loads `AGENTS.md` (or `CLAUDE.md`) from `~/.pi/agent/AGENTS.md` | | agents | pi has no folder for agents, so there is no `agents.user` key | Not run live. `pi` is not installed on this machine (the only `pi` on the PATH is a wrapper script from the cmux terminal, and no pi program exists outside it), and `~/.pi` does not exist. To get live proof, install pi, then point it at the proxy through `~/.pi/agent/models.json` (the readme says a provider that speaks the OpenAI or Anthropic API can be added there) and run `pi -p PROMPT --no-session`. Until then pi is at path-level proof only: the paths are documented, not exercised. ## Session records of the others Codex, Cursor, Gemini and pi have no `sessions`, `session time` or `use` rules yet, so their invocations are not counted ([usage.md](usage.md)). Adding one is the same as adding a harness: describe its records in its stanza. ## Adding a harness Add a `[harness NAME]` stanza with the paths it reads. Nothing else changes: no code, no other file. A kind with no key in the stanza has no folder for that harness; suit skips those assets for it and reports each one as skipped, it does not fail and does not guess a path. `record` and `event` keys are there for harnesses that need them (see `conf-format.md`). ## The live test `make live` runs `test/live.sh`. It proves, with real harnesses and not fixtures, that what suit places is what the harness reads: an instruction file's marker comes back, a skill's marker shows in the harness's skill list, an edit made in the store with no suit command changes the answer, and after `suit off` the edit is gone. It does this for Claude Code and for Codex. All of it runs under a scratch `HOME` and a scratch working folder. It is not part of `make all` or `make ci`. It needs the local proxy (cliproxyapi) listening on 127.0.0.1:8317, and it spends model calls: about six per harness, each with a tiny prompt. Every call asks for the model in `SUIT_LIVE_MODEL` (default `deepseek/deepseek-v4.1-flash-1017`). Claude Code reports which model answered and the test fails if it is not the one asked for. Codex does not report it, so the test prints the model asked for. Non-interactive flags: - Claude Code: `-p PROMPT --output-format json --model MODEL --settings FILE --dangerously-skip-permissions`. The settings file is one of the proxy files in `~/.config/cliproxyapi/`, passed by path (it holds the token and base URL). The skip-permissions flag is safe only because home and working folder are scratch. - Codex: `exec --skip-git-repo-check --ephemeral -s read-only -m MODEL --json PROMPT`, with stdin closed (`</dev/null`; without that it prints "Reading additional input from stdin" and waits forever). The proxy is set in `$HOME/.codex/config.toml` as a model provider with `base_url http://127.0.0.1:8317/v1`, `wire_api = "responses"` and `env_key SUIT_PROXY_KEY`; the token is put in that variable from the same settings file and never printed. The shim pitfall: resolve every real program path before changing `HOME`. Under a scratch `HOME`, a version manager's shim for `claude`, `perl` or `python` cannot find its own state and starts installing tools. So the script saves the real `claude` and `codex` paths first and uses `/usr/bin/perl` and `/usr/bin/python3`. The timeout is perl's `alarm`, since macOS has no `timeout`. ## Checked against the fixtures `test/fixtures/wear/suit.conf` and the stanzas in `test/live.sh` match the blocks above. The one entry not verified is Codex's `commands.user`; the fixture keeps it because the wardrobe there has a command to place, and no evidence shows the path is wrong, only that it is unconfirmed. No path was changed.