Artifact b031388f4960aba63dd912c8df314f34899b2951571f29e7dab81d5b5856a6d7:
- File
docs/conf-format.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: 10832) [annotate] [blame] [check-ins using]
# suit.conf format This is the format as phase 1 parses it. `suit check FILE` parses a file and prints the canonical dump, or prints one error and exits 2. A file with any error is rejected whole. `suit check` with no FILE does the same for every wardrobe at once (see "More than one wardrobe" below). ## Lines - A line is at most 4096 bytes, not counting the newline. A file is at most 1 MiB (1048576 bytes). A NUL byte in a line is an error. - Blank lines are ignored. `\r` before the newline is whitespace. - `#` starts a comment when it is the first non-space character of the line or follows a space or tab. `a#b` keeps its `#`. There is no quoting, so a `#` after a space is a comment even inside quotes. - After comments are removed, leading and trailing whitespace is trimmed. ## Sections A section header is `[KIND ARGS...]`. Words are separated by spaces or tabs. A name is 1 to 128 characters of `A-Z a-z 0-9 . _ -`. | Header | Meaning | |---|---| | `[harness NAME]` | A harness. | | `[outfit NAME]` | An outfit. | | `[wear SCOPE [TARGET] [machine=NAME]]` | What a scope wears. | | `[need HARNESS NAME]` | A need. HARNESS must name a `[harness]` section. | | `[upstream NAME]` | An upstream. | For `wear`, SCOPE is `enterprise`, `user`, `shared` or `personal`. - TARGET is a project's remote address such as `github.com/owner/name` (characters `A-Z a-z 0-9 . _ - / : @ ~`). It is required for `shared` and `personal` and forbidden for `enterprise` and `user`. - `machine=NAME` comes last and is allowed only on `user` and `personal`. A `user` or `personal` wear with it applies on the machine whose name is NAME (`suit machine`, docs/store.md) and is ignored on any other, or when the machine has no name. A section is a duplicate when its kind and all its header words match an earlier one. `[wear user]` and `[wear user machine=studio]` are different sections. Limits per file: 64 harnesses, 512 outfits, 256 wears, 256 needs, 128 upstreams, 8192 entries in all. ## Entries An entry is `KEY = VALUE`. The key is everything before the first ` = ` (a space, an equals sign, a space), trimmed, with runs of whitespace inside it reduced to one space. The value is the rest, trimmed. `KEY =` with nothing after it is an empty value, which is an error. Every entry belongs to the nearest section above it. A list value is whitespace-separated words; it is stored and dumped with single spaces. ### harness | Key | Value | Repeatable | |---|---|---| | `KIND.SCOPE` | a path | no | | `record` | a path | yes | | `event NAME` | the harness's own event name, one word | no | | `sessions` | a glob of files holding session records: absolute, or starting with `~/` | yes, at most 8 | | `session time` | a path in a record: where its time is | no | | `session project` | a path in a record: where its working folder is | no | | `use KIND` | a rule saying what makes a record an invocation | yes, at most 16 in all | KIND is `skills`, `agents`, `commands` or `instructions`. SCOPE is `enterprise`, `user`, `shared` or `personal`. NAME in `event NAME` is letters, digits and `. _ - /`. The last four describe a harness's session records, for the usage counts ([usage.md](usage.md)). In `sessions`, `~` is the home folder and `*` matches any run of characters within one path part; nothing else is a wildcard. A path is field names joined by dots, a part ending in `[]` meaning each element of an array, and `.` alone the record itself. In `use KIND`, KIND is `skill`, `agent` or `command` and the value is a rule: ``` use skill = message.content[] where type=tool_use name=Skill name input.skill id id use command = . where type=user name message.content between <command-name>/ </command-name> ``` `IN [where FIELD=VALUE ...] name PATH [between A B] [id PATH]`, in that order, words separated by spaces or tabs; usage.md gives each part. A rule is one value, so a `#` after a space in it starts a comment as anywhere else: a rule cannot hold one, and has no quoting to get round it. A malformed rule is an error at its line that names what is wrong (`use skill: 'name PATH' is missing`). A `where` has at most 4 tests; a path at most 8 steps of 32 bytes. `session time` and `session project` take a path with no `[]`. ### outfit | Key | Value | |---|---| | `include` | list of outfit names | | `skills`, `agents`, `commands` | list of names; `*` is allowed | | `instructions` | a path | | `only` | one harness name | | `slot NAME` | a path; NAME is letters, digits and `. _ - /` | | `file DEST` | a path; DEST is one word, `~` allowed | In a harness, a `KIND.personal` path is relative to a project's folder and has no `..` part. An outfit worn at personal scope may have a `file DEST` only with a relative DEST with no `..` part, and no `slot`. The parser accepts them; placing the scope refuses them, naming the outfit ([projects.md](projects.md)). ### wear | Key | Value | |---|---| | `outfits` | list of outfit names | | `publish` | `yes` or `no`; only on `wear shared` | ### need | Key | Value | |---|---| | `prompt` | a path in the wardrobe: relative, with no `..` part, naming a regular file | | `done` | the test, in one of two forms (below) | `done` is one of these and nothing else: - `PATH exists`: true when a file, folder or link is at PATH (a link counts whether or not its target is there). - `PATH contains "TEXT"`: true when PATH is a regular file of at most 4 MiB that holds TEXT as a string of bytes. TEXT is everything between the first `"` after `contains ` and the last `"` on the line, so it may hold spaces and `"`. It may not be empty, and nothing may follow the last `"`. PATH is one word. A leading `~` is the home folder. PATH must then be absolute. Anything else is an error at the line of the `done` entry: `need HARNESS NAME: cannot read the test: ...`. A file that is not there is not done. A file that cannot be read, is not a regular file, or is over 4 MiB is `cannot tell`, and counts as not done. See [needs.md](needs.md). ### upstream | Key | Value | |---|---| | `url` | one word | | `pin` | one word | | `path` | a path | | `trust` | `review` or `auto` | | `into` | a relative path of names | Every key is optional. `trust` defaults to `review`, `path` to the top of the folder an upstream is taken from, and `into` to `skills`. `into` says where the upstream's files land in the wardrobe: each part between slashes is a name (letters, digits, `.`, `_`, `-`) that does not start with a dot, so there is no empty, `.` or `..` part and no leading or trailing slash, and it is at most 256 bytes. `suit upstream NAME take` needs a `pin`, at most 256 bytes, and a `path` with no `..` part; see [upstreams.md](upstreams.md). Only `record`, `sessions` and `use KIND` may appear more than once in a section. Two `slot` keys with the same NAME, or two `file` keys with the same DEST, are duplicates. ## Errors Each error is one line on stderr, `PATH:LINE: message`, and the exit status is 2. Nothing is printed to stdout. Line 0 means the problem is with the whole file (it cannot be opened, or it is over 1 MiB). Errors are found in this order: syntax and limits as the file is read, top to bottom; then references, in file order; then include cycles. - unknown section kind, malformed header, wrong number or form of header words - unknown key, malformed entry, empty value, bad value, entry before any section - duplicate section, duplicate key - a limit exceeded, including more than 8 `sessions` or 16 `use` keys in a harness - `include` of an unknown outfit, `wear` naming an unknown outfit, `only` or `need` naming an unknown harness. These are reported at the line of the entry, or of the header for `need`. Forward references are fine. - an `include` cycle, reported at the `include` line that closes it, as `include cycle: a -> b -> a` ## The dump One fact per line. Sections are ordered by kind (harness, outfit, wear, need, upstream), then by their header words. A section is listed on its own line first, so empty sections show. Entries follow, ordered by key, then value: ``` harness claude harness claude skills.user = ~/.claude/skills wear user machine=studio wear user machine=studio outfits = voice need claude statusline done = ~/.claude/settings.json contains "slots/statusline" ``` The order of sections and entries in the file does not change the dump. ## More than one wardrobe Placing takes the `suit.conf` of every wardrobe you have, merged into one set. 1. Which wardrobes take part. Every folder directly under `$SUIT_HOME/store` whose name is a name (above) and that holds a regular file `suit.conf`, in byte order of name. A folder without `suit.conf` supplies nothing and is not an error. A folder whose name starts with `.` or is not a name is skipped. At most 16 take part; more is an error that says so. With none, suit says `STORE:0: no wardrobe with a suit.conf`, naming `$SUIT_HOME/store`. 2. One namespace. Each file is parsed on its own, then they are combined. Harness, outfit, need and upstream names are shared: `include`, `outfits`, `only` and a need's HARNESS may name something defined in any wardrobe. Unknown names and include cycles are found on the combined set and reported at the `FILE:LINE` of the entry, where FILE is that wardrobe's `suit.conf`. 3. No order between wardrobes. Which asset wins is decided only by scope and limit ([vocabulary.md](vocabulary.md)). The byte order of names only makes output stable. 4. The same section in two wardrobes (the duplicate rule above) is an error, and that includes `[wear user]`: `FILE2:LINE2: duplicate section [wear user]; first at FILE1:LINE1`. A second wardrobe that wears something at User scope uses `[wear user machine=NAME]`. 5. The limits above bound the combined set too: 64 harnesses, 512 outfits, 256 wears, 256 needs, 128 upstreams, 8192 entries and 1 MiB of files in all. Over a limit is an error in the file of the wardrobe that pushed it over. 6. Paths resolve where they are written. Every asset name and path in an outfit (`skills`, `agents`, `commands` including `*`, `instructions`, `slot`, `file`) and a need's `prompt` is in the store of the wardrobe whose config defines that section. `skills = *` in a wardrobe means that wardrobe's skills only. An outfit included from another wardrobe gets its assets from that wardrobe's store. 7. The same destination from two wardrobes at the same scope and limit is a clash, as within one wardrobe: `two assets want DEST: SRC (in wardrobe A) and SRC (in wardrobe B)`. 8. An error in any wardrobe's config rejects the whole set: nothing is placed. `suit check` with no FILE prints the dump of the combined set, or the first error and exit status 2. The dump does not say which wardrobe a line came from.