Artifact 4ecc0aed0d0cb8ce5b89242d1cc4e4d4f73be51323e6e97b16e5ada01748c505:
- File
docs/curate.md
— part of check-in
[1ed63201f4]
at
2026-11-18 03:02:04
on branch trunk
— suit curate apply turns the page's choices into config changes
suit curate apply FILE reads the choices file the curation page makes and prints a plan: which outfits and wears it edits, which wardrobes it checks in and in what order, and the links that will appear and disappear at each scope. Without --yes nothing changes. With --yes it edits each wardrobe's suit.conf and checks it in, with a comment such as "Curate: 3 kept, 1 limited, 12 retired". It does not place anything; the next run sees the config changed and applies.
- keep leaves a worn asset as it is. A loose asset, or one coming back from the attic, goes to the outfit kept.WARDROBE, worn at user scope. - limit moves the asset from its user outfits to personal.WARDROBE.SLUG, worn by [wear personal PROJECT], created or reused wherever it is. - retire removes the asset from every outfit of its wardrobe and adds it to attic.WARDROBE, which nothing wears. Apply refuses if a wear reaches an attic. - Removing one name from an outfit that lists `*` turns the `*` into an explicit list of the names it reached, minus that one, and the plan says so: names added to the store later are then not included by that outfit. No exclusion syntax was added.
Outfit names carry the wardrobe because outfit names are one set across wardrobes; a name too long for that is refused for its line. A wardrobe that defines a new outfit is checked in before any wardrobe whose wear names it, so a failure part-way leaves only an outfit nothing wears; a run that would need the opposite order is refused before anything changes.
Configs are edited as text: only the lines that must change are rewritten, and comments, blank lines, alignment, line endings and the order of everything else are kept. Every edited config must parse and the combined set must pass the merge check before anything is written. A wardrobe with local changes is refused, so the check-in holds the curation only. A failed check-in puts that wardrobe's file back.
A malformed line, a duplicate, a bad header or a path given as a project refuses the whole file, listing every problem. An unknown asset is warned about and skipped; a choice already true is silent.
A new suite, test/curate_apply.sh, with 376 cases, is part of the gate, and a new fuzz target covers the choices parser and the line editor.
3669 unit checks (was 2993), 625 shell cases, 1153 store cases, 985 placement cases, 378 project cases, 236 usage cases, 288 curate cases and 376 curate-apply cases, under clang, under gcc 16, with no user name set, and under a strict umask, in one run of make gate (44 minutes). 100% coverage in all 32 source files. No existing case was changed. (user: dmestas, size: 24724) [annotate] [blame] [check-ins using]
Curating the wardrobes
suit curate writes one HTML page that shows every skill, agent and command of
your wardrobes beside how often it is used, with a choice for each: keep it,
limit it to one project, or retire it. The choices come out as a short text file.
This is part two of three of the usage work: part one counts
(usage.md); part three, suit curate apply, reads the choices file and
changes the wardrobes ("Applying the choices", below). suit curate itself applies
nothing.
suit curate [--since DAYS] [--out FILE]
It runs a usage scan as suit usage does, gathers what follows, writes the page
and prints the path of the file written. DAYS is 1 to 400 (default 30), the
window the uses are counted in. The default FILE is $SUIT_HOME/curate.html;
a FILE with no / in it is in the working folder. Open the page in a browser
as a local file. It needs no network and no server.
suit curate changes nothing else: no wardrobe file, no config, no stamp, no
ledger. The scan writes the usage files, as it always does.
Exit statuses
| 0 | the page was written; its path is on standard output |
| 1 | a file could not be read or written, the tally is not in its form, or a bound below was passed; no page is written |
| 2 | arguments wrong, or the config cannot be used (no wardrobe, a config error) |
| 20 | another suit holds the lock |
The page
The design was settled with a working mock-up and is kept: a headline that states the finding, an outcome panel (the keep, limit and retire split, and the bytes of description loaded into every session, today against after your choices), a sticky filter bar with counted filters and bulk buttons, one row for each asset and a sticky bar at the foot with the result.
- The headline is computed: "20 skills are in your wardrobes. 6 of them were used in the last 30 days." for the kind shown. With nothing in the tally at all it says that no usage has been recorded and every worn or loose asset is suggested as keep. When the tally's oldest event is younger than the window, a note says how many days of history there really are.
- A kind switch (Skills, Agents, Commands, each with its count) sets what the headline, the panel, the counts and the list show. The choices file always covers all three, and so does the sum in the foot.
- A row has the name (a button that opens the details), four weekly bars and the number of uses in the window, the date last used, where it is used, the suggestion with its reason, and the three-way choice. Limit is disabled when it does not apply, and its tooltip says why. A row that was changed from the suggestion has a dot, and the filter "Changed by me" lists those. A row in the attic has a small tag.
- The details under a row: the description, uses by project, uses in 90 days, state, wardrobe, origin, what it costs (the bytes of its description, which every session loads, and its size on disk) and when its files last changed.
- Keys: J and K or the arrows move, 1 keep, 2 limit, 3 retire, Enter opens the
details,
/goes to the filter. Light and dark follow the system. The page works on a phone. - Save choices saves the text as
suit-choices.txt, Copy choices puts it on the clipboard. If either is refused the text box opens with the text selected, to copy by hand.
Where each number comes from
For each asset of kind skill, agent or command found in the store of any
wardrobe that takes part in placing (conf-format.md, "More than
one wardrobe"), the same listing suit plan uses:
| Shown | From |
|---|---|
| name, kind, wardrobe | The store: a skill's folder name, or an agent's or command's file name without .md. Two wardrobes may hold the same kind and name: there is a row for each, and each row has a small tag with its wardrobe's name (rows with a unique name have none); the details always show the wardrobe. A name that is not a name (conf-format.md: letters, digits and . _ -) cannot be written in an outfit or in the choices file, so it is left out and counted in the page's "How to read this". |
| description | The description of the front matter of a skill's SKILL.md, or of an agent's or command's file, if it has one. Plain, quoted, folded (>) and literal (\|) values are read, with or without - or +; white space is collapsed. Only the first 16 KiB of the file is read, so a front matter that ends after that has no description. The page keeps the length in bytes and the first 300 bytes of text, cut on a character boundary. No front matter, or none with a description, is not an error. A # is not read as a comment. |
| size on disk | The bytes of the regular files of a skill's folder (not through symlinks), or of the one file. Counted to 4096 files and 16 folders deep; beyond that the size is marked "over". |
| files changed | The newest modification time among those files, as a date (UTC). |
| state | See below. |
| origin | upstream NAME when the asset is one of the top-level entries under the upstream's into in the check-in that the record upstreams/NAME names (upstreams.md, "The record"): what its last accept brought into trunk. Your own skills in the same folder are yours. An upstream with no record, a record that is not whole, or one that names no check-in of its branch (never accepted) supplies nothing. Only an into that is skills, agents or commands can supply assets. The repository is read through the same libfossil calls suit upstreams uses and no file is changed; if it cannot be read, suit curate stops with a message that names the wardrobe (exit 1) and writes no page, and never shows everything as yours. |
| uses | The tally's events of that kind in the window. A usage name matches an asset when it is equal to its name or ends with a colon and its name (plugin:name is an invocation of name). The kinds must match. |
| uses in 90 days, last used | From the same events. Last used is the newest of any time the tally holds (up to 400 days). |
| four bars | The uses in each of the last four 7-day periods before now, oldest first, whatever the window. A use at the instant a period begins is in that period. |
| used in | Every project of the window's uses with its count, most used first, then in byte order. The key is the one the tally has: the project's remote key, or its folder with the home folder written ~, or -. At most 64 are listed; the rest are summed as "other". |
State: worn, attic, loose
- worn: some
[wear ...]reaches the asset through an outfit it names, an outfit that outfit includes, and so on, or through*or a pattern in an outfit (the rulessuit planuses, insrc/resolve.c). The page lists the wears that reach it as written in the header:user,personal github.com/o/r,user machine=studio. A wear limited to another machine counts: the wardrobe is shared between machines. - attic: no wear reaches it except through an attic outfit (
attic, or a name that starts withattic.), and some outfit lists it. That is an asset only in an attic outfit, or only in outfits no wear names. - loose: no outfit lists it.
attic is a name of outfits, as voice or extras would be, not a new word
of the vocabulary (which is frozen). An outfit named attic or
starting with attic. is never counted as wearing anything, even if a wear names it.
The suggestion
Each row starts with a suggestion and its reason, as one rule:
- In the attic already: retire, "already in the attic".
- No usage at all in the tally: keep, "no usage recorded yet". Nothing is suggested for retirement on no evidence.
- No uses in the window: retire, "no uses in D days", unless its newest file is younger than the window: keep, "no uses yet · files changed recently".
- Every use in one project: if the asset is worn only at personal scope for that
project, keep, "already limited to PROJECT"; else with three or more uses,
limit, "N uses · all in PROJECT". But a personal wear needs a project's
remote key (conf-format.md), and the tally gives a folder
(starting with
~or/, or-for a session with no folder) for a working folder that is not in a project suit knows. Limit is then disabled, its tooltip says the folder is not a project suit knows and to add it withsuit project set(projects.md), and the suggestion is keep, "N uses · all in FOLDER (not a known project)". - Otherwise keep, "N uses · M projects".
A suggestion is not proof: the history is short. A harness keeps its records for a limited time, suit's tally starts at its first scan, and a skill used twice a year may have no use in the window.
What the choices mean
- Keep: the asset is worn at user scope. One already worn (at user scope, or
only at personal scope for a project) stays as it is. One that is loose or in the
attic goes in the outfit
kept.WARDROBE, which a[wear user]wears. - Limit to a project: the asset is worn at personal scope for that project
(projects.md) and no longer at user scope, so it loads there and
nowhere else. It goes in the outfit
personal.WARDROBE.SLUG. - Retire: the asset moves to the outfit
attic.WARDROBE, which nothing wears. It is not deleted: the file stays in the wardrobe, and moving one line back brings it back.
The choices file
The text the page makes, and the file suit-choices.txt. This format is stable.
# suit choices 1
# made 2026-11-20 from a page of 2026-11-18, window 30 days
keep agent main reviewer
retire command main bar
personal skill main alpha github.com/o/solo
retire skill main stored
keep skill side twin
- The first line is
# suit choices 1. The second is# made DATE from a page of DATE2, window D days: DATE is the day the choices were made (in the browser's time), DATE2 the day the page was written. - Then one line for each asset, all kinds, in byte order of kind (
agent,command,skill), then of name, then of wardrobe:keep KIND WARDROBE NAME,retire KIND WARDROBE NAMEorpersonal KIND WARDROBE NAME PROJECT. WARDROBE is always there, so a name that two wardrobes hold has two lines that differ. - Fields are separated by one space. KIND, WARDROBE and NAME never contain a space (see "name" above). PROJECT is a project's remote key as the tally gave it; it is never a folder, and never contains a space.
- A line that starts with
#is a comment.
Applying the choices
suit curate apply FILE [--yes]
Reads the choices file the page made, works out what each line changes in the
wardrobes' suit.conf files, and prints that as a plan. Without --yes that is
all: nothing on disk changes (and no lock is taken). With --yes it prints the
plan, edits the configs, checks each changed wardrobe in and prints one line for
each. It does not apply: the stamp watches suit.conf, so the next suit run
notices the change and places it, and a last line says so. --yes may come before
or after FILE. --yes takes the lock that apply takes.
The file
The first line must be # suit choices 1; anything else is refused, naming line 1.
Other # lines are comments and blank lines are ignored. Every other line is one of
the three forms above, fields separated by one space (a final CR is allowed). A
malformed line is an error naming its line; the same asset (kind, wardrobe, name)
on two lines is an error naming both; more than 4096 choices, or a file over 4 MiB,
is refused. Every error is listed, and with any error nothing is applied (exit 2).
A warning, on standard error with the line's number, skips the line: an asset or a
wardrobe that is not there, and a personal line whose PROJECT is a folder (starts
with ~ or /) or -, which a config cannot name as a target (give the folder a
key with suit project set first).
A choice that is already true prints nothing and changes nothing; the first line of the plan counts them.
What each choice does, by where the asset is now
"Worn at user scope" is a [wear user ...] reaching an outfit that lists the asset,
with or without machine=. The outfits that list an asset are those of its own
wardrobe (an outfit lists only the assets of its own wardrobe).
| Choice | Worn at user scope | Worn only at personal scope | Loose (no outfit lists it) | In the attic (nothing worn lists it) |
|---|---|---|---|---|
| keep | nothing | nothing | added to its kept outfit |
taken out of the attic outfit it is in, added to its kept outfit |
| personal PROJECT | taken out of every outfit a user wear reaches that lists it; added to its personal outfit | nothing if only worn for PROJECT; else added to its personal outfit | added to its personal outfit | added to its personal outfit (it stays in its outfits) |
| retire | taken out of every outfit that lists it, added to its attic outfit | the same | added to its attic outfit | nothing (it is already retired) |
For retire, an asset that is in the attic state (some outfit lists it and no wear
reaches it) is already retired, whether the outfit is attic or another that no
wear names. Otherwise it is taken out of every outfit of its wardrobe that lists it,
whatever the scope or limit, and added to its attic outfit (not again if an attic outfit lists it).
If a wear reaches any attic outfit, directly or through an include, the whole apply is
refused before anything changes (exit 2), naming the wear; it only matters when a
retire has something to do.
The outfits and wears it uses:
- Each wardrobe has its own outfits, because outfit names are one set for all
wardrobes and an outfit lists only its own wardrobe's assets. The new ones are
always
kept.WARDROBE,attic.WARDROBEandpersonal.WARDROBE.SLUG, made in WARDROBE (a dot is a character a name may hold). An outfit named plainatticorkeptthat you made by hand is used as it is for the assets of its own wardrobe, when there is no dotted one; for another wardrobe's assets a dotted one is made. kept.WARDROBEmust be worn by a[wear user](one with nomachine=): if no such wear reaches it, it is added to theoutfitsof the one[wear user], in whichever wardrobe that is, or the section is made in the asset's wardrobe if there is none. One wardrobe says what a scope wears.personal.WARDROBE.SLUG: SLUG is PROJECT with every character outsideA-Z a-z 0-9 . _ -replaced by-, the whole name cut to 128 bytes. If an outfit of that name exists and is not the one this project's own[wear personal PROJECT]names,...SLUG-2is tried, then-3, and so on, in the order the projects are met in the file (github.com/o/a-bandgithub.com/o/a/bmake the same SLUG). The outfit is added to theoutfitsof[wear personal PROJECT]in whichever wardrobe holds it, or that section is made in the wardrobe that holds[wear user](the asset's wardrobe if there is none).- An outfit of one of these names that you made by hand in another wardrobe (say
kept.sidedefined inmain) cannot list the assets ofside: the line is refused, naming both wardrobes, exit 2, nothing applied.
A * or a pattern
A name cannot be taken out of skills = *, and there is no way to write an
exclusion. So the word that reaches the asset (*, gamma-*) is replaced in that
line by the explicit list of the names it reaches in that wardrobe's store today,
in byte order, minus the asset. Names listed in the line already are not repeated.
The plan says so in a line of its own:
outfit extras: `skills = gamma-*` becomes an explicit list of 1 names
This means a skill added to the store later is no longer worn by that outfit automatically; add its name to the outfit. A name that cannot be written in a list (a folder with a space in it) is refused, exit 2. A list that would pass 4096 bytes cannot be written either: nothing is split, the apply is refused naming the outfit (exit 2) and you split the outfit by hand.
An asset reached only through an include is taken out of the outfit that lists it,
which changes every outfit that includes that one. The plan names every outfit it
edits and, for each wear, how many of the chosen assets it stops or starts reaching.
How the files are edited
Each suit.conf is edited as text and only the lines that must change change:
comments, blank lines, key alignment, line endings (CR LF too), a missing final
newline and the order of everything else stay. A list loses a name by rewriting
that one KEY = VALUE line (single spaces between the names, the key as written, a
trailing comment kept); a list that becomes empty loses its whole line (the outfit
stays). A name is added to a list in byte order when the list is in byte order, and
at the end when it is not (the order of outfits = voice extras is the owner's);
an outfit or a wear with no such key gets a line after its last entry. A new section
is appended at the end of the file after one blank line. After every step the
whole set of configs is parsed and checked again, with all the limits of
conf-format.md; if any does not hold, nothing is written and the
error is printed (exit 1).
The plan
For the fixture of test/curate_apply.sh:
plan: 3 choices, 3 change something, 0 already true, 0 skipped
keep skill main loose-one
outfit kept.main: create in main
outfit kept.main: add loose-one
wear user: add outfit kept.main
personal skill main gamma-one github.com/o/other
outfit personal.main.github.com-o-other: create in main
outfit personal.main.github.com-o-other: add gamma-one
wear personal github.com/o/other: add outfit personal.main.github.com-o-other
retire skill main soloskill
outfit attic.main: create in main
outfit solo: remove soloskill
outfit attic.main: add soloskill
placements:
user
+ link HOME/.claude/skills/loose-one -> STORE/main/skills/loose-one
personal HOME/work/other
+ link HOME/work/other/.claude/skills/gamma-one -> STORE/main/skills/gamma-one
personal HOME/work/solo
- link HOME/work/solo/.claude/skills/soloskill
wears:
wear user: 0 leave, 1 arrive
wear personal github.com/o/solo: 1 leave, 0 arrive
wear personal github.com/o/other: 0 leave, 1 arrive
check-ins, in this order:
main: Curate: 1 kept, 1 limited, 1 retired
side: Curate: 1 limited
nothing was changed; run again with --yes to make these changes
The placements are the difference between what the configs place before and after
(the User and Project personal scopes, in the form suit plan uses), computed with
the same code apply uses on the edited text in memory; they do not look at the
disk. If the config does not place now (an outfit names something that is not in the
store), they are not shown and the plan says so. wears: counts, for each wear, the
chosen assets it stops reaching and starts reaching. With nothing to change the plan
is its first line and nothing to change.
What is checked in, and what stops it
With --yes, before anything is written, every wardrobe that will change must have
no local changes in its working copy and no unfinished update: otherwise it refuses,
naming the wardrobe (suit commit or suit tend first, exit 12; suit store
repair, exit 15). Then, wardrobe by wardrobe, the new
suit.conf is written beside the old one and renamed over it, and the wardrobe is
checked in as a normal check-in (the lint runs) with the comment
Curate: N kept, M limited, K retired, counting the choices that changed that
wardrobe's text and leaving out the zeros. The order is: a wardrobe that makes an outfit
before any wardrobe whose wear sections now name it, and byte order of name otherwise.
The plan prints the order. If each of some wardrobes names an outfit another makes (it
can happen: a kept for an asset of side is worn by a wear in main, while a project
outfit for an asset of main is worn by a wear in side), no order is safe: the run is
refused before anything changes (exit 2) and you apply the choices of one wardrobe, then
the other's. A wardrobe that only gained a wear line
for another wardrobe's outfit counts that choice too.
If a check-in fails, the file of that wardrobe is put back as it was, the ones
already checked in stay (they are history; suit back does not undo a check-in), and
the message says which wardrobes were changed and which were not (exit 1). A
wardrobe that is checked in later can never refer to an outfit that a failed one was to
define, so a failure leaves at most an outfit that nothing wears yet: the set of configs
still loads and places.
It never runs apply, never changes a file outside the wardrobes' suit.conf
files, never deletes an asset, and never pushes.
Exit statuses
| 0 | done, or nothing to do, or the plan was shown |
| 1 | an operation failed: a file cannot be read or written, a check-in failed, the edited config does not check |
| 2 | arguments wrong, a refused file (header, malformed line, duplicate, too many), an attic outfit is worn, two wardrobes that need each other's new outfit first, an outfit would be too long, an outfit is in another wardrobe, or a config that cannot be used |
| 12 | a wardrobe that would change has local changes |
| 15 | a wardrobe that would change has an unfinished update |
| 20 | another suit holds the lock |
Bounds
| assets on a page | 4096 (CURATE_ASSETS_MAX). Over it is an error that says so, and no page is written. |
| projects listed for an asset | 64 (CURATE_PROJECTS_MAX), the rest summed as "other" |
| names used that match no asset, listed | the ten most used |
| a file read for its description | 16 KiB, of which 300 bytes of text are kept |
| files counted for a size | 4096, and 16 folders deep |
| uses held to count | 600000 (CURATE_RECS_MAX), error beyond; try a shorter --since |
| the page | 16 MiB, error beyond. 500 assets make a page of about 250 KB (evidence.md). |
The test build can lower three of them: SUIT_CURATE_LIMITS=assets=N,recs=N,page=N.
The release binary has no such variable.
How the page is made
The page is a template, src/curate.html, compiled into the binary as a C array
by a step of the Makefile that uses only od and awk (the release build needs
nothing but a C compiler and POSIX tools). suit curate writes the template with
the data, as JSON, where the marker @@DATA@@ is. Every <, >, &, U+2028 and
U+2029 in the data is written as a \u escape, so no value can end the script or
open a tag, and every string is valid UTF-8: a byte that is not becomes U+FFFD.
The page builds each row from escaped text, and loads nothing from anywhere: no
script, font, image or address, no storage, no inline handler. The test greps for
that.
The file is written atomically (a temporary file beside it, synced, renamed) with mode 0600 whatever the umask. A write that fails leaves an older page whole.
Privacy
The page names your projects and the folders you work in, so it is written with mode 0600. It is a local file: nothing is sent anywhere, by suit or by the page. Descriptions are shown as text, so a description that holds an address is text and is not followed.
Tests
test/unit.c: the front matter reader (every form), the cut, the JSON writer (every escape and every kind of bad UTF-8), the name matching and the four-week periods at their edges.test/curate.sh: the command on a fixture of two wardrobes (an upstream, an attic, a loose asset, a personal wear, a machine-limited wear, namespaced usage names, each description form, markup, a U+2028, bad UTF-8 and a 2000-byte value), mode and atomicity, that nothing else on disk changes, the bounds, the arguments, and a sweep that fails each system call in turn.test/curate_apply.sh,test/unit.candtest/fuzz_choices.c: see quality.md.test/curate_page.js: the script of the generated page, run under node against a stub of the document: rows, suggestions, the kind switch, filters, bulk actions, the keys, the refused Limit, the outcome numbers and the exact choices text. The suite runs it whennodeis on PATH and otherwise prints a line that starts withskip; the gate shows those lines. Node is not needed to build.test/fuzz_curate.c, seeds intest/corpus/curate: any bytes as a file's head must give a bounded, collapsed description and a JSON string with none of the characters above.