This guide is for changing what the capdag command shows: its live view,
pickers, plain lines, --json records, errors and full-screen graph. The
command’s terminal interface is the capdag-tuikit crate, and its
capdag-tuikit binary runs the command on a world — a fabric snapshot, a set
of cartridges, files, and a script for each run — with no engine, cartridge or
network behind it. What each piece is, field by field, is in the
reference.
Everything below is run from capdag-rs/. The binary is built like the rest of
the workspace, with the build inputs the README
describes; capdag-tuikit below stands for the built binary. Building it
compiles the terminal interface and not the engine’s host, so a change to a
screen is rebuilt in seconds.
Run a command on a world
Write a world’s files into an empty directory, and run the command line after
-- there:
mkdir /tmp/day && cd /tmp/day
capdag-tuikit world files ordinary .
capdag-tuikit --world ordinary -- plan report.pdf --to txt
capdag-tuikit --world ordinary -- run summaries.machine report.pdf -o out
Anything the capdag command takes works: every command, flag, --json,
--no-input, -v. On a terminal the live view and pickers are drawn as they
are for a person; with CI=1 or a pipe, plain lines are printed. Runs go as
fast as their scripts say; --speed 10 plays them ten times as fast.
capdag-tuikit list names the worlds and the journeys.
Play a journey
A journey is one thing a person does in a world, in each mode it is done in. To watch it on this terminal:
capdag-tuikit journey CJRN-012 --mode inline
capdag-tuikit journey CJRN-019 --mode full_screen --step
--step waits for Space before each key the journey presses. At the end the
command says whether the journey came to what it should, and where its files
are.
To play a journey unwatched, in every mode it declares, as the tests do:
capdag-tuikit journey CJRN-012 --check
A mode that did not come to what it should is reported with its exit status, its stdout and what it showed.
Run the journey tests
The journey tests are the journeys test target of capdag-tuikit:
cargo test -p capdag-tuikit --test journeys
They play every journey in every mode it declares, check every world
(capdag-tuikit check does the same on its own), and refuse a world or a
script that says what the engine could not.
Add a journey
- Run the command on the world in each mode it should be seen in, and read what it prints.
- Copy the newest file in
tuikit/scenarios/journeys/to the next number,CJRN-058.json, and set itstitle,worldandargs. - For each mode, write what it comes to: its
exitstatus, textsstdoutholds, textsshown(stderr on pipes, the screen at the end on a terminal), and texts that must beabsent. On a terminal, give the wholescreenit ends on when where things are drawn matters: a blank row left behind, or a line starting in the wrong place, fails it. - On a terminal, give the keys:
waitfor a text before pressing anything that depends on it, thenpressa key ortypea text. - Run
capdag-tuikit journey CJRN-058 --check.
{
"title": "Choose a model from a search, and print its spec",
"world": "ordinary",
"args": ["model", "search", "qwen", "--pick"],
"modes": {
"inline": {
"keys": [{ "wait": "Qwen3-8B-GGUF" }, { "press": "Down" }, { "press": "Enter" }],
"expect": { "exit": 0, "stdout": ["hf:Qwen/Qwen3-8B-GGUF"] }
},
"plain": { "expect": { "exit": 2, "shown": ["3 models match, and --pick has no terminal to choose on"] } }
}
}
Hold a journey to what the world decides, never to what changes from build to build: not the command’s own version, a temporary path, a run’s duration or a token.
Add a world
Copy the world in tuikit/scenarios/worlds/ that is nearest to what you need,
and change what differs: the cartridges bundled, installed, refused and in the
registry; the working directory’s files; the dev projects; what
capdag self update finds; and the runs. The world’s name is its file name.
A world’s cartridges provide caps of its fabric snapshot, by alias. Its files
with an extension are of file types the snapshot holds, and its machine files
plan against the snapshot; a machine file there to be refused (a syntax error,
a cap no fabric has) is listed in refused_machines. capdag-tuikit check
says what a world gets wrong, and where.
Script a run
A run of a machine in a world plays the world’s script for the caps its strand
runs, keyed by their aliases in the order they run: disbind-pdf >
summarize-en, or one alias for a cap run on its own. Run the command: a run
with no script fails, naming the key it looked for.
error: the run failed
Host error: the world 'ordinary' has no script for a run of disbind-pdf > summarize-en
Write the script under that key in runs: the signals the engine gives while
the strand runs, in the order the engine gives them, with waits between, and
how it ends. A map’s run says its items as they are dispatched, its progress
under the map’s name, and its outcomes as each item ends, every outcome so far
each time:
"disbind-pdf > summarize-en": {
"signals": [
{ "step": { "step": "disbind-pdf", "progress": 1.0 } },
{ "items": { "map": "summarize-en", "items": ["Quarterly report. Revenue rose by a tenth."] } },
{ "items": { "map": "summarize-en", "items": ["Costs held level."] } },
{ "wait": 800 },
{ "step": { "step": "summarize-en", "progress": 1.0 } },
{ "outcomes": { "map": "summarize-en", "ended": [{ "item": 0, "ok": true }] } },
{ "outcomes": { "map": "summarize-en", "ended": [{ "item": 0, "ok": true }, { "item": 1, "ok": true }] } }
],
"end": { "completed": { "outputs": { "txt": ["Revenue up ten percent.\n", "Costs flat.\n"] } } }
}
Steps are named by their cap’s alias, a map by its body’s aliases, and outputs
by the media type each holds, as capdag check names it (page-text, txt).
on_stop gives what happens instead of the rest once the run is asked to stop.
capdag-tuikit check plays every script against the plan of the machine it is
a run of, through the run view’s model of a run: a signal for a step the plan
does not have, a report a step cannot have, or an end a run cannot come to is
refused, saying which.
Take a new fabric snapshot
A world’s fabric is a snapshot of a published fabric in
tuikit/scenarios/fabric/. When the fabric publishes a new manifest, take a
new one:
capdag-tuikit world fabric --out tuikit/scenarios/fabric/capdag.json --anchor https://fabric.capdag.com
capdag-tuikit check
The snapshot keeps every cap and alias of the manifest and only the media types the command reads: every file type, every live source, every type a cap’s input or output can end on in a plan, and every type a cap’s arguments and outputs or an alias name. Of manifest 15 that is 197 caps, 406 aliases and 381 of its 32,890 media types, about 1 MB; the whole fabric would be more than 100 MB. A snapshot’s manifest names only what it holds, so a world is a smaller fabric that is whole in itself. Then run the journey tests: a journey whose output the new fabric changes says what it shows now.