Artifact aec5d8dc01c980c0ca994a1ccbd6f9f6bfbd9bf88d1fc48f97b2ea707e64bc32:
- File
docs/curate.md
— part of check-in
[cef6a0ad45]
at
2026-11-17 07:37:01
on branch trunk
— suit curate writes a page for deciding what each asset is worth keeping
suit curate [--since DAYS] [--out FILE] runs a usage scan and writes one self-contained HTML page, mode 0600, atomically, to curate.html in suit's home folder or to FILE. It changes no wardrobe file, config, stamp or ledger. The page names projects and stays on this machine; it loads nothing from the network and has no inline handlers.
Each skill, agent and command in the wardrobes is a row: uses in the window and in each of the last four weeks, last used, the projects it was used in, its description and what that costs every session, where it is worn, whether it is in the attic, and whether it is the owner's or an upstream's. Origin comes from the entries of the check-in the upstream's record names, so an upstream's skills beside the owner's own in skills/ are told apart. A name in two wardrobes is tagged with its wardrobe.
Each row starts from a suggestion with its reason: retire when unused in the window, unless its files changed within it; limit when three or more uses all came from one known project; otherwise keep. A folder that is not a known project cannot be limited to, and the page says how to make it one. The owner picks keep, limit or retire per row, with keys or in bulk on what is shown, and copies or saves the choices as a short text file. Applying it is a separate step, not in this check-in. The format is in docs/curate.md: one line per asset, `keep KIND WARDROBE NAME`, `retire KIND WARDROBE NAME`, or `personal KIND WARDROBE NAME PROJECT`.
The page is src/curate.html, turned into a C array at build time with od and awk, so the release build needs no other tool. Values are written as JSON with markup characters, U+2028 and U+2029 escaped and invalid UTF-8 replaced. The page script has its own test, run under node where node is installed and reported as skipped elsewhere. A new fuzz target covers the front-matter reader and the JSON writer.
Page sizes: 37 KB for the test fixture, 252 KB for 500 assets, 805 KB at the 4096-asset bound.
A new suite, test/curate.sh, with 288 cases, is part of the gate.
2993 unit checks (was 2855), 620 shell cases, 1153 store cases, 846 placement cases, 378 project cases, 236 usage cases and 288 curate cases, under clang, under gcc 16, with no user name set, and under a strict umask, in one run of make gate (66 minutes, on a loaded machine; one earlier run failed only the loaded speed measurement, at 1.06 to 1.11 ms, and this run passed it at 0.99 ms). 100% coverage in all 31 source files. No existing case was changed. (user: dmestas, size: 13409) [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 will read the choices file and change the
wardrobes. This part 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 outfit named
attic, and some outfit lists it. That is an asset only in the outfitattic, or only in outfits no wear names. - loose: no outfit lists it.
attic is the name of an outfit, as voice or extras would be, not a new word
of the vocabulary (which is frozen). An outfit named 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 will mean
Part three will read the choices file; none of this happens yet.
- Keep: the asset stays as it is.
- 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.
- Retire: the asset moves to the outfit named
attic, 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.
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_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.