@turri-dev/cli 0.4.2-next.a6867e8 → 0.4.3-next.3fc888b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/README.md +1 -0
  2. package/dist/background-skills.d.ts +4 -1
  3. package/dist/background-skills.js +9 -1
  4. package/dist/capture/agents.d.ts +391 -0
  5. package/dist/capture/agents.js +338 -0
  6. package/dist/capture/area.d.ts +58 -0
  7. package/dist/capture/area.js +197 -0
  8. package/dist/capture/assemble.d.ts +122 -0
  9. package/dist/capture/assemble.js +452 -0
  10. package/dist/capture/capture.d.ts +116 -0
  11. package/dist/capture/capture.js +1281 -0
  12. package/dist/capture/chat.d.ts +29 -0
  13. package/dist/capture/chat.js +94 -0
  14. package/dist/capture/checks.d.ts +142 -0
  15. package/dist/capture/checks.js +643 -0
  16. package/dist/capture/config.d.ts +13 -0
  17. package/dist/capture/config.js +60 -0
  18. package/dist/capture/interface.d.ts +71 -0
  19. package/dist/capture/interface.js +199 -0
  20. package/dist/capture/map.d.ts +58 -0
  21. package/dist/capture/map.js +530 -0
  22. package/dist/capture/plan.d.ts +8 -0
  23. package/dist/capture/plan.js +13 -0
  24. package/dist/capture/progress.d.ts +109 -0
  25. package/dist/capture/progress.js +240 -0
  26. package/dist/capture/report.d.ts +75 -0
  27. package/dist/capture/report.js +268 -0
  28. package/dist/capture/scripts.d.ts +26 -0
  29. package/dist/capture/scripts.js +33 -0
  30. package/dist/capture/state.d.ts +299 -0
  31. package/dist/capture/state.js +43 -0
  32. package/dist/capture/trial.d.ts +34 -0
  33. package/dist/capture/trial.js +89 -0
  34. package/dist/capture-cli.d.ts +1 -0
  35. package/dist/capture-cli.js +77 -0
  36. package/dist/chat-commands.d.ts +2 -10
  37. package/dist/chat-commands.js +3 -57
  38. package/dist/chat-tab-header.d.ts +15 -0
  39. package/dist/chat-tab-header.js +78 -0
  40. package/dist/chat-tabs.d.ts +26 -0
  41. package/dist/chat-tabs.js +100 -0
  42. package/dist/chat-terminal.js +57 -8
  43. package/dist/chat-waiting.d.ts +4 -1
  44. package/dist/chat-waiting.js +7 -4
  45. package/dist/chats.d.ts +12 -7
  46. package/dist/chats.js +35 -21
  47. package/dist/cli.js +32 -14
  48. package/dist/config-edit.js +4 -2
  49. package/dist/config.d.ts +15 -2
  50. package/dist/config.js +62 -4
  51. package/dist/extension.d.ts +1 -0
  52. package/dist/extension.js +262 -136
  53. package/dist/identity.js +3 -2
  54. package/dist/init-config.js +2 -0
  55. package/dist/loop-cli.js +5 -1
  56. package/dist/loop-tools.d.ts +2 -3
  57. package/dist/loop-tools.js +12 -13
  58. package/dist/new-project.d.ts +5 -0
  59. package/dist/new-project.js +11 -0
  60. package/dist/pi-launch.js +2 -0
  61. package/dist/pi-themes.d.ts +3 -0
  62. package/dist/pi-themes.js +21 -0
  63. package/dist/pi.js +2 -2
  64. package/dist/plain-code-blocks.d.ts +14 -0
  65. package/dist/plain-code-blocks.js +56 -0
  66. package/dist/pointer-hover.d.ts +12 -0
  67. package/dist/pointer-hover.js +48 -0
  68. package/dist/question-dialog.d.ts +5 -0
  69. package/dist/question-dialog.js +20 -1
  70. package/dist/regenerate/chunk-plan.d.ts +2 -11
  71. package/dist/regenerate/chunk-plan.js +9 -20
  72. package/dist/regenerate/command-check.d.ts +9 -0
  73. package/dist/regenerate/command-check.js +163 -14
  74. package/dist/regenerate/job-panel.d.ts +5 -107
  75. package/dist/regenerate/job-panel.js +4 -289
  76. package/dist/regenerate/jobs-tree.d.ts +1 -0
  77. package/dist/regenerate/jobs-tree.js +5 -1
  78. package/dist/regenerate/loop.d.ts +6 -14
  79. package/dist/regenerate/loop.js +51 -35
  80. package/dist/regenerate/side-panel.d.ts +6 -1
  81. package/dist/regenerate/side-panel.js +158 -22
  82. package/dist/regenerate/spec-map-view.d.ts +11 -3
  83. package/dist/regenerate/spec-map-view.js +22 -2
  84. package/dist/regenerate/test-scripts.d.ts +8 -0
  85. package/dist/regenerate/test-scripts.js +20 -5
  86. package/dist/reopen.d.ts +29 -0
  87. package/dist/reopen.js +47 -0
  88. package/dist/resume-line.d.ts +4 -1
  89. package/dist/resume-line.js +5 -2
  90. package/dist/sentinel-chat.js +7 -2
  91. package/dist/sentinel.d.ts +1 -1
  92. package/dist/sentinel.js +4 -2
  93. package/dist/setup.js +9 -1
  94. package/dist/terminal-notifications.d.ts +31 -0
  95. package/dist/terminal-notifications.js +134 -0
  96. package/docs/README.md +2 -0
  97. package/docs/capture.md +207 -0
  98. package/docs/chats.md +8 -7
  99. package/docs/config.md +18 -3
  100. package/docs/development.md +4 -1
  101. package/docs/hosting.md +2 -2
  102. package/docs/launch.md +2 -2
  103. package/docs/regenerating.md +9 -8
  104. package/docs/sandbox.md +3 -1
  105. package/docs/sentinel.md +11 -11
  106. package/docs/skills-and-gates.md +1 -1
  107. package/docs/theming.md +3 -3
  108. package/docs/using.md +12 -5
  109. package/genome/capture/capture.md +26 -0
  110. package/genome/capture/check-conventions.md +5 -0
  111. package/genome/capture/check-reference.md +11 -0
  112. package/genome/capture/compact.md +7 -0
  113. package/genome/capture/concepts.md +3 -0
  114. package/genome/capture/divide.md +9 -0
  115. package/genome/capture/feature.md +45 -0
  116. package/genome/capture/interface.md +9 -0
  117. package/genome/capture/modules.md +23 -0
  118. package/genome/capture/outline.md +11 -0
  119. package/genome/capture/readability.md +12 -0
  120. package/genome/capture/reference.md +10 -0
  121. package/genome/capture/split.md +9 -0
  122. package/genome/capture/survey.md +37 -0
  123. package/genome/capture/trial.md +18 -0
  124. package/genome/capture/verify.md +7 -0
  125. package/genome/rules/turri-regeneration.md +2 -2
  126. package/package.json +3 -3
  127. package/dist/regenerate/steer.d.ts +0 -34
  128. package/dist/regenerate/steer.js +0 -91
package/docs/sentinel.md CHANGED
@@ -1,33 +1,33 @@
1
1
  # The sentinel
2
2
 
3
- The sentinel is a chat of turri's own, beside the chats you talk to. Every pulse that finishes goes to it: it checks how the pulse went - and, with `launch-after-pulse` on, tests what was launched - and when something needs you, it says so in the chat you are in, with what can be done about it. You go on talking about the software, and building it, while it watches what lands.
3
+ The sentinel is a chat of turri's own, beside the chats you talk to. It checks each finished pulse and, with `launch-after-pulse` on, tests what was launched. You can keep working and read its findings in notifications when you're ready.
4
4
 
5
5
  `sentinel:` in `config.turri.yaml` says whether there is one: `ask`, as it is unset - you are asked before it first opens in a session (below); `true` - it opens without asking; `false` - none. It is there in the terminal and in a host such as turri-desktop - wherever turri holds [chats](chats.md) - and not in pi's print, json or rpc modes, nor on the command line (`turri regenerate`, `turri conform`), which have no chat to tell: there a pulse is told as it is without it.
6
6
 
7
7
  ## Starting it
8
8
 
9
- Under `sentinel: ask`, a tab that starts working on its own is not sprung on you. When the first pulse of a session finishes, turri asks first - a notice of its own in the chat you are in, before the sentinel opens, in one sentence: `app · regenerate pulse 3 finished - start the sentinel, a background tab that reviews each finished pulse and tries to use what was launched?` - the launch left out with `launch-after-pulse` off. In the terminal it is a dialog once that chat is not mid-turn, with how to switch to the sentinel once it is open - `Use "/chat 2" to open the sentinel.`, the number the one it will have in the strip; in a host, a notice with `kind: "sentinel-start"` (see [in a host](#in-a-host)). You answer:
9
+ Under `sentinel: ask`, the first finished pulse adds a question to notifications: start the sentinel for this session? Open `***plain ›` and choose **notifications**, beside **pulses**, or use `/notifications`. A host receives this question as a `sentinel-start` notice. You can choose:
10
10
 
11
11
  - **Start the sentinel** - it opens, and checks this pulse and each after it this session;
12
12
  - **Start it, and don't ask again** - the same, and `sentinel: true` is written to `config.turri.yaml`;
13
- - **Not this session**, or `esc` - no sentinel until turri starts again: each pulse is told to the chat that asked for it, as without one;
13
+ - **Not this session**, or **Dismiss** - no sentinel until turri starts again;
14
14
  - **Turn it off for this project** - `sentinel: false` is written.
15
15
 
16
- Nothing goes to the sentinel, or to your chat, until you answer: the pulses that finish meanwhile are held, and go to it - or to their chats - as you say. You are asked once a session: a sentinel closed and opened again by the next pulse is not asked for again, nor one `turri --continue` reopened. Close the chat it was asked in, and it is asked again in the one you look at.
16
+ Finished pulses appear in notifications immediately. Their reviews wait until you answer. Leaving the tab or pressing `esc` keeps the question open. Once you answer, turri does not ask again in the same session.
17
17
 
18
18
  `/sentinel` sets it from the chat - `/sentinel ask`, `/sentinel on`, `/sentinel off`, or `/sentinel` alone to pick - written to `config.turri.yaml` as `/settings sentinel` does.
19
19
 
20
20
  ## What you see
21
21
 
22
- - **In the chat you are in**, a pulse that finishes shows as it always has - `✓ app · regenerate pulse 3 finished after 4m 10s`, and for one that went wrong, where to see why. A pulse that landed is told to the chat's agent, which tells you in a line or two what landed and what the sentinel is doing with it - and again, in a line, when the sentinel is done with it - checking it, testing what was launched - and does nothing else about it: it does not test, launch or open it, nor do what the project's guidance says to do once a pulse finishes. The pulse is the sentinel's. A pulse that went wrong is not told to it: the sentinel looks into it, and you hear of it as a notice.
22
+ - **Notifications** is shared by all chats in the terminal session. Each finished pulse has a completion entry, even with the sentinel off. Each sentinel review has one entry: its conclusion is added to the finding or fix, alongside the evidence and actions. A conclusion does not reopen a dismissed notice or mark it unread again. The count beside `***plain` and on the notifications tab includes unread items and notices waiting for an answer. Open an item for its details; `r` in the list marks everything read without answering anything.
23
23
  - **The sentinel** opens with the first pulse that finishes - once you said to start it, under `sentinel: ask` - in the background: it never takes the screen, and you stay in your chat. It is a tab in the strip like any other chat - `sentinel` - marked while it works and when it has something new. Switch to it to read what it checked: it shows the pulse it is on, or the last one it checked - each pulse has a conversation of its own (below).
24
- - **A notice**, when something needs you: a card in the chat you are in - what is wrong, what shows it, and what can be done, numbered - and, in the terminal, once that chat is not mid-turn, a dialog on it:
24
+ - **A notice**, when something needs you: open its `?` entry in notifications to read what is wrong, the evidence and the choices:
25
25
  - `enter` on an action accepts it: the chat's agent is started on it - a change to the \*\*\*plain, a pulse regenerated again, a credential to provide, a setting to change;
26
26
  - **Ignore - leave it as the build has it**, on a notice the sentinel marked ignorable: nothing is done, and it is not raised again - in this session or the next (below);
27
27
  - **Say what to do instead…** - your own words, and the agent does that;
28
- - **Dismiss**, or `esc`: nothing is done, this once - the next pulse may raise it again.
28
+ - **Dismiss**: nothing is done, this once - the next pulse may raise it again. `esc` goes back without dismissing.
29
29
 
30
- Nothing is done without your answer. A notice goes to the chat you are in; while you are in the sentinel's, to the chat that asked for the pulse. There is one open notice a module: a newer one about the same module supersedes the older one, whose call to action would be stale, and the card says so.
30
+ Accepted work goes to the chat the notice was addressed to. A newer finding about the same module supersedes the old one; the old entry stays in the list but can no longer be acted on.
31
31
 
32
32
  ## What it does
33
33
 
@@ -37,7 +37,7 @@ Each pulse it checks from scratch, in a conversation of its own: its prompt, you
37
37
  2. **tests what was launched**, with `launch-after-pulse` on: what runs is where it is told, and it tries it - in the terminal with its shell (`curl`, the program itself, the logs), in a host also with what the host gives it, a browser say. How far it tests is its own judgement, from what the pulse changed and what the \*\*\*plain says it now does - but not what a later pulse in the same launch changed again: that is the later pulse's check. Where the \*\*\*plain picks one way among several - which of a tie comes first, how a default is chosen - it tries an input on which the ways give different answers, so a pass shows the \*\*\*plain's way and no other. With `launch-after-pulse` off nothing is running, and it checks the pulse alone;
38
38
  3. **finds out why**, when something is wrong - the pulse failed or stopped, it did not pass, the launch did not come up, the software does not do what its \*\*\*plain says. A testing script, or where the config says the scripts are, it fixes itself, resumes the module, and tells you what it changed (below). Anything else it puts to you as a notice, each action a task your chat's agent can carry out once you accept it - and what the machine lacks, the exact command for you to run;
39
39
  4. **notifies no one** when all is well;
40
- 5. **concludes**, last, whether all is well or not: what it checked and what it found, in a line or two. The chat you are in shows it - `✓ sentinel · app · pulse 3 · checked, it holds` - and its agent tells you so in a line, and does nothing more; when something was wrong, that its notice says what.
40
+ 5. **concludes**, last, whether all is well or not: what it checked and what it found, in a line or two. Read the conclusion in notifications, or ask your chat about it.
41
41
 
42
42
  A host can ask it to check too: functional specs the person picks in a module - its own, or those of any module its requires chain builds on (`depths:gene-fragments` in predators') - in turri-desktop, on the preview's list of a module's built ones. It tests those, on its own judgement, in what is launched of the module - its own codebase's code - once the codebase's launches are settled, and reports as for a pulse: a notice when something is wrong, and its conclusion. The sentinel launches nothing: with nothing of the module launched - never, or you halted it - the check ends unchecked, its conclusion saying so - "ask the chat to try it first, which launches it" - and nothing else: it is an answer, not an error; when its last launch did not come up, that is what the sentinel finds out about, as for a pulse. It is refused with the sentinel off, and for a module that does not parse, a functional spec it does not have, or one not built; see [in a host](hosting.md#the-sentinel).
43
43
 
@@ -51,7 +51,7 @@ With `launch-after-pulse` on, a pulse is launched in the background on the [laun
51
51
  - **The launch did not come up**: it is told why, and that is what it finds out about - a finding like any other. It tests nothing in its place: never the code in `plain_modules`, where a pulse may be writing, nor a server of its own.
52
52
  - **You stopped the launch** (`/halt launched <module>`, or every server it started): nothing runs, and it checks the pulse alone.
53
53
  - **Whichever it is**, it is told never to run the code in `plain_modules`, where a pulse may be writing, nor to start a server of its own - not in its shell, not with a host's terminal: what would pass there is not what you try. A server that should run and does not is its finding. A host's terminal command that starts or runs the code there - `cd plain_modules/shorty/code && .venv/bin/uvicorn …`, a program or a path there, an environment variable pointing there - is refused it, saying why; reading there is not.
54
- - **What runs cannot hold it** - turri got it wrong: it is not told of the pulse. The error is shown in the chat you are in, recorded in the ledger (`sentinel.refused`), and the pulse is concluded unchecked; the next is taken.
54
+ - **What runs cannot hold it** - turri got it wrong: it is not told of the pulse. The reason appears in notifications with the unchecked conclusion and in the ledger (`sentinel.refused`); the next pulse is taken.
55
55
 
56
56
  When its codebase is launched again while it checks a pulse - a newer pulse landed, of it or of a module built on it - or what runs of it is stopped for another module's launch that needed what it held, its turn is stopped where it is, its conversation kept: what it was testing is being replaced. It takes nothing else meanwhile. Once the codebase's launches have settled - one, or several in a row - turri checks again that what runs holds the pulse's commit, and tells it, in the same conversation, to carry on: what runs now, and to do again what it was doing as the servers restarted. What runs no longer holding it, it is refused as above - for one stopped for another module's launch, saying which. A launch of another codebase that stops nothing of its own leaves it alone.
57
57
 
@@ -63,7 +63,7 @@ Two functional specs that contradict each other stop a pulse in a way only you c
63
63
 
64
64
  It fixes the project's tooling itself, and nothing else:
65
65
 
66
- - **It fixes** the testing scripts - `test_scripts/`, a `run_*.sh` or `prepare_environment*.sh` at the project's root, each script `config.turri.yaml` names - and, in `config.turri*.yaml`, where the scripts are (`unittests-script`, `conformance-tests-script`, `prepare-environment-script`) and `toolchains:`. A script that runs `python3` where this machine has `python` of the version the \*\*\*plain names, a path that moved, a flag this machine's version of a tool does not take: it checks what it relies on in its shell (`command -v python`, `python --version`), edits the script, and calls `resume` - the module is brought up again, as when you ask for it, and the scripts run for real. Then it tells you, as a note in your chat (`kind: "fixed"`) with nothing to answer: what it changed and why, the lines before and after. Any other key of the config it changes is put back, and its edit refused.
66
+ - **It fixes** the testing scripts - `test_scripts/`, a `run_*.sh` or `prepare_environment*.sh` at the project's root, each script `config.turri.yaml` names - and, in `config.turri*.yaml`, where the scripts are (`unittests-script`, `conformance-tests-script`, `prepare-environment-script`) and `toolchains:`. For example, if a script calls `python3` but this machine has the required version as `python`, it verifies the version, edits the script and calls `resume` to run the module again. A `fixed` notification shows what changed and why, with nothing to answer. Any other config key it changes is put back and its edit refused.
67
67
  - **It never changes \*\*\*plain.** The \*\*\*plain is your intent: what needs it changed is a notice, its action a task for your chat's agent once you accept it.
68
68
  - **It installs nothing, and changes no setting of the machine's or your shell's** - not a toolchain, not a package, not a PATH line in your profile - under no circumstances: its shell refuses it, as every shell turri runs does. What the machine lacks is a notice with the exact command for you to run, and resuming as its action once you have.
69
69
 
@@ -39,7 +39,7 @@ A skill declares its steps with a `## Steps` section whose `###` headings are th
39
39
 
40
40
  `command-only: true` under `metadata:` keeps a skill from the model: it is started only by the person, with its slash command. None of turri's own is; turri registers the command for every such skill, the project's own too. Typed, the command puts what was typed in the chat as the person's message, and lets `cultivate` start the skill once - and so does an option starting with the command - a project's `/release-notes - for this release` - picked in the conversation's `ask_user` (`chosenCommand` in `src/skills.ts`). The answer tells the model to call `cultivate` for it at once, with the person's request word for word as its context (`startPicked`), so they never type the command after picking it; the run starting uses that up, so the model cannot start it again later on its own. Without either, `cultivate` refuses it and the model is told how the person starts it; the skill's line in `cultivate`'s list says so too.
41
41
 
42
- `background: true` under `metadata:` runs a skill in the background, in the chat and a host: `cultivate` starts it and returns at once, and the chat's turn goes on. Nothing shows while it runs - no progress, no spinner - and nobody is asked anything: it has no `ask_user`, a gate it cannot pass stands, and its agent is told to decide what is left open and say what it decided. Its end comes back to the chat it was started from once that chat is idle - its agent done, nothing typed - batched (`src/background-skills.ts`): a line drawn by turri when it did its work, naming the files it changed; a message that starts a turn when it stopped at a gate, failed, or changed no file, for the chat to tell the person and decide what next. One runs at a time a skill and project, whichever chat started it; quitting turri stops it. In pi's print, json and rpc modes, and from `turri cultivate`, it runs as any skill does, to its end. `model: coding` runs a skill on the coding model of the module it is for - `cultivate`'s `plainFile`: that module's own file's `coding-model` over the project's, and `--coding-model` over both - the model a code pulse of that module runs on; without it, a skill runs on the chat's model (`harness-model` from the command line). turri's two that write the testing scripts, `implement-unit-testing-script` and `implement-conformance-testing-script`, are its only ones that set either, and they set both.
42
+ `background: true` under `metadata:` runs a skill in the background, in the chat and a host: `cultivate` starts it and returns at once, and the chat's turn goes on. Nothing shows while it runs - no progress, no spinner - and nobody is asked anything: it has no `ask_user`, a gate it cannot pass stands, and its agent is told to decide what is left open and say what it decided. Its end comes back to the chat it was started from once that chat is idle - its agent done, nothing typed - batched (`src/background-skills.ts`): a line drawn by turri when it did its work, naming the files it changed; a message that starts a turn when it stopped at a gate, failed, or changed no file, for the chat to tell the person and decide what next. One runs at a time a skill and project, whichever chat started it: asked for again for the same module, nothing new starts; asked for another module - a frontend's testing script while the backend's is written - it waits its turn and starts once the run before it ends, and a testing script it is to write counts as being written from the moment it is asked for, so the modules that need it wait for it. Quitting turri stops it, and drops what waits. In pi's print, json and rpc modes, and from `turri cultivate`, it runs as any skill does, to its end. `model: coding` runs a skill on the coding model of the module it is for - `cultivate`'s `plainFile`: that module's own file's `coding-model` over the project's, and `--coding-model` over both - the model a code pulse of that module runs on; without it, a skill runs on the chat's model (`harness-model` from the command line). turri's two that write the testing scripts, `implement-unit-testing-script` and `implement-conformance-testing-script`, are its only ones that set either, and they set both.
43
43
 
44
44
  `questioning:` under `metadata:` names the steps the questioning level caps (`src/questioning.ts`) - `[stack, product]`, say. When there are any and someone to ask, the harness itself asks the first question of the first step: how many questions those steps may ask - light (3), medium (5), thorough (10) or best judgement - and tells the agent the answer beside each step's instructions, with how broad each question is to be: broad at light, a whole area at once, narrow at thorough, an edge case at a time. Every level covers the same ground, in less or more depth. In a capped step `ask_user` refuses a question past the cap; the step's closing confirmation, asked with `confirms_phase: true`, is never counted. `end_questions` ends the step's questions sooner - best judgement's only end. What the questions leave open, the agent decides itself and says what it chose. The level, and how many questions each step has asked, are kept in the run's `run.json`, so a resumed run keeps them. A step it does not name, or a run with nobody to ask, is not capped.
45
45
 
package/docs/theming.md CHANGED
@@ -10,7 +10,7 @@ turri --use-theme dark # pi's own
10
10
 
11
11
  The second form follows your terminal's light/dark appearance. The default is for `turri` only: [pi](https://pi.dev)'s settings are left alone, so a plain `pi` keeps its theme. With the themes copied to `~/.pi/agent/themes/` (`cp .pi/themes/*.json ~/.pi/agent/themes/`), `{"theme": "turri-dark"}` in `~/.pi/agent/settings.json` gives a plain `pi` the same one.
12
12
 
13
- Bad input fails quietly - an unknown `--use-theme` name and a malformed theme file both run without complaint - so if the colours do not change, suspect a typo rather than the mechanism.
13
+ If the same turri theme is installed in both places, the project's `.pi/themes/` copy takes precedence over the one in `~/.pi/agent/themes/`. turri does not warn about these expected copies. Theme files that fail to load and name clashes with other themes still appear in pi's startup diagnostics.
14
14
 
15
15
  ## The palette
16
16
 
@@ -36,7 +36,7 @@ Both themes, the command line's colours, the \*\*\*plain diff's, the banner's je
36
36
  | indigo | `#5b57d9` | the jellyfish's bell, at its rim - nowhere else |
37
37
  | orange | `#ff7a3d` | the jellyfish's gut, the `$` of bash mode, and everything that asks for you - what failed (`✗`), what works with limits, what needs you (the \*\*\*plain map's `!`): `error`, `warning` |
38
38
 
39
- The design system keeps pink for the one thing to press and orange for the `$` prompt alone. A terminal has no buttons, but it needs status colours, so pink carries what is done and orange everything that asks for you - what failed, what works with limits, what waits on you - the mark (`✗`, `!`, `■`) telling them apart. The palette has no red.
39
+ In the chat header the `+` button uses the theme's success colour. The `***plain` toggle takes a brand-pink fill and a spinner while regeneration is active; its arrow points left when the panel is open and right when closed. Tabs use the theme's `selectedBg` for their padded surfaces and `accent` for the active tab. Hover underlines the target; `×` takes the warning colour on hover to distinguish closing from switching. The side panel uses the same treatment. In the transcript, pink carries what is done and orange everything that asks for you - what failed, what works with limits, what waits on you - the mark (`✗`, `!`, `■`) telling them apart. The palette has no red.
40
40
 
41
41
  ## Why there are two
42
42
 
@@ -70,7 +70,7 @@ With tool rows carrying no background, their state is signalled by the title and
70
70
 
71
71
  ## \*\*\*plain diffs
72
72
 
73
- A \*\*\*plain diff in the panels is not painted with the theme's colours for code: those are made for code, and the turri themes' backgrounds are all the surface colour, so a diff drawn with them would have no fills and hardly any highlighting. It has a palette of its own (`src/regenerate/plain-palette.ts`), one for a dark theme and one for a light, picked by the theme's appearance: a hue for each piece of \*\*\*plain - a section's header, the `# <id>` heading of a functional spec or a scenario (neon, bold; eggplant, bold, on a light theme), a concept, a link, text in quotes or backticks, a front matter key, a module, a comment - at least 7:1 on the surface, and a fill behind each added and removed line: on a dark theme blue whale and eggplant, on a light one neon hover and siesta tan. Every colour reads at least 4.8:1 on blue whale and 5:1 on the light fills; eggplant, the design system's only warm dark fill, takes the pinks and grauzone down to 3.7:1.
73
+ A \*\*\*plain diff in the panels - and \*\*\*plain fenced as ` ```plain ` in the chat - is not painted with the theme's colours for code: those are made for code, and the turri themes' backgrounds are all the surface colour, so a diff drawn with them would have no fills and hardly any highlighting. It has a palette of its own (`src/regenerate/plain-palette.ts`), one for a dark theme and one for a light, picked by the theme's appearance: a hue for each piece of \*\*\*plain - a section's header, the `# <id>` heading of a functional spec or a scenario (neon, bold; eggplant, bold, on a light theme), a concept, a link, text in quotes or backticks, a front matter key, a module, a comment - at least 7:1 on the surface, and a fill behind each added and removed line: on a dark theme blue whale and eggplant, on a light one neon hover and siesta tan. Every colour reads at least 4.8:1 on blue whale and 5:1 on the light fills; eggplant, the design system's only warm dark fill, takes the pinks and grauzone down to 3.7:1.
74
74
 
75
75
  ## The font
76
76
 
package/docs/using.md CHANGED
@@ -15,6 +15,8 @@ Peeking is safe while a question is open - a skill's or the chat's: `ctrl+h` ope
15
15
 
16
16
  While a skill runs, a line above the input shows its phases, every one by name - those done ticked, the one it is in marked, the rest to come - and where it is: the skill's name at the left edge, `phase 2 of 4` at the right, and its phases centred between them, `✓ intent ━━━━ ⠋ stack ──── ○ testing ──── ○ product`. Under it, dimmed, the phase it is in and what it does: `stack - the language, frameworks, storage and architecture`. The phases are the skill's own steps, read from its `SKILL.md`. A skill of one phase, or none, has nothing to be partway through: its line is the spinner and its name alone, `⠹ analyze-func-specs`.
17
17
 
18
+ To bring an existing codebase under \*\*\*plain instead, `/capture` captures it into `plain/`, in the background - nothing is asked, its progress shows above the input, and once it ends turri offers to open again in `plain/`, where its report is told and `/regenerate` builds it; only you start it (see [capture](capture.md)).
19
+
18
20
  `genome/skills/` holds the rest: adding a feature, a concept, a requirement, a resource; splitting a functional spec that is too big; resolving conflicts; checking the environment - see [authoring \*\*\*plain](authoring-plain.md#the-skills). A skill run that is interrupted can be resumed where it stopped. A project can have skills of its own, in `.turri/skills/` or `.agents/skills/` - see [skills and gates](skills-and-gates.md#a-projects-own-skills).
19
21
 
20
22
  ## The tools
@@ -23,11 +25,10 @@ While a skill runs, a line above the input shows its phases, every one by name -
23
25
  | --- | --- |
24
26
  | `regenerate` | regenerate a module and its chain from \*\*\*plain as it is now - after any change to it, by any means: what is left to regenerate is planned into pulses of one to three functional specs, each with the definitions and reqs it uses, and a pulse regenerating what \*\*\*plain no longer wants is stopped. With functionalities named, those are regenerated though their \*\*\*plain did not change - their code taken out and built anew, planned into pulses as any change is; with `from_scratch`, the whole module, its code deleted first - `"chain"` for every module of its requires chain too, built again from the bottom - only when you ask, or agree |
25
27
  | `drift` | what is left to regenerate: how far the code and its conformance tests have drifted from \*\*\*plain, starting nothing |
26
- | `steer` | say how the work is planned - which functional specs go together, what first - for the project or one module, for the session; the next plan follows it, beside what AGENTS.md says under a heading naming the queue |
27
28
  | `conform` | write and run conformance tests for functional specs - now, or ahead of their code: every one tested in one conformance pulse, as far as a size guardrail lets (or one a functional spec, or a pulse each of groups you name - 1-3 and 4-6 - when you ask for that), started once every one named is regenerated. Refused while conformance tests are off: turning them on is yours, with `/conform`, and the chat tells you why it wants them |
28
29
  | `parse` | parse \*\*\*plain - its syntax and structure, never its code or tests - regenerating nothing - a module whose functional specs have scenarios but which has no test reqs, or no conformance testing script, passes with a warning naming the next step (see [the steps of adding tests](regenerating.md#the-steps-of-adding-tests)) |
29
30
  | `settings` | read the project's settings, or change one when you ask - "regenerate with gpt 5.5 from now on" sets `coding-model` - see [below](#choosing-a-model) and [changing it from the chat](config.md#changing-it-from-the-chat) |
30
- | `pulses` | pulses in every tense: this session's - finished, running and planned - and the last runs of earlier sessions (`runs` for more), or one of them - a finished one with what the [ledger](#the-ledger) recorded of it: its rounds, test runs, verdicts, healers and commits; one that did not land says why besides, from its transcript: its diagnosis, the stages that went wrong, the last failing test run, the last review, the tool calls that failed. With a module's `plain_file`, a look ahead: its work planned as `regenerate` plans it - the steering with it - and kept, nothing started, its pulses waiting for `regenerate`, `conform` or `/regenerate`, which runs that plan as it is unless the \*\*\*plain or the steering changed since. A planned row's id (`planned-<module>-1`) then gives its cases and - the next pulse of its codebase - the whole prompt its coding agent will get |
31
+ | `pulses` | pulses in every tense: this session's - finished, running and planned - and the last runs of earlier sessions (`runs` for more), or one of them - a finished one with what the [ledger](#the-ledger) recorded of it: its rounds, test runs, verdicts, healers and commits; one that did not land says why besides, from its transcript: its diagnosis, the stages that went wrong, the last failing test run, the last review, the tool calls that failed. With a module's `plain_file`, a look ahead: its work planned as `regenerate` plans it and kept, nothing started, its pulses waiting for `regenerate`, `conform` or `/regenerate`, which runs that plan as it is unless the \*\*\*plain changed since. A planned row's id (`planned-<module>-1`) then gives its cases and - the next pulse of its codebase - the whole prompt its coding agent will get |
31
32
  | `halt` | halt a pulse, a module's planned pulses, a launch, or what a launch started |
32
33
  | `doctor` | turri's self check, as `turri doctor` runs it: Node, bash, git, the OS sandbox, a model provider, and the project's toolchains and testing scripts - against the PATH turri's pulses run with, not the agent's shell's. The project's models are asked for a word only when you ask (a request a model); it changes nothing |
33
34
  | `cultivate` | run a gated skill, its steps and review gates enforced |
@@ -43,12 +44,17 @@ The agent does this work with these tools, never by running turri's command line
43
44
 
44
45
  ## Pulses
45
46
 
47
+ In the fullscreen TUI, click `***plain ›` at the right end of the chat tabs to open the spec map on the right. The button then points back into the chat (`***plain ‹`); click it again to close the panel, from any of its tabs. Choose `***plain` for the spec, `pulses` for the work regenerating it or `notifications` for results and notices. The selected tab is highlighted; its label stays in place. Below 104 terminal columns the panel fills the screen; `× close` returns to the chat.
48
+
49
+ Click a spec's heading or summary, or an imported file's name, to select it and toggle its details. A wrapped summary is clickable on any of its lines. Click a module tab to switch modules. In `pulses`, click a section, a pulse or a file in its diff to expand or collapse it. The arrow keys and Enter continue from the row you clicked.
50
+
46
51
  A pulse is one unit of work regenerating the code. It was called a job, and still is where a name is kept - `job_id`, `parallel-jobs`, `allow-to-stop-jobs`, `.turri/jobs/` - and in a project's own files written before: the chat is told the two are the same, so an `AGENTS.md` or a skill that says "job" needs no change.
47
52
 
48
53
  A regeneration takes minutes, so in the TUI every tool that regenerates starts the work as a pulse and returns straight away. The conversation carries on, and you need not wait for a pulse to finish: go on shaping the \*\*\*plain and writing its next change, ask questions, try what has landed - turri says so as each pulse starts, and never waits for one itself. A \*\*\*plain change made meanwhile steers the running pulse or is planned again around it (see below); pulses on the same module - or on modules of one `requires` chain - queue behind each other, in the order they were asked for, from the first pulse on: one queued while the module's \*\*\*plain is only a scaffold, with no functional specs yet, or while it does not parse, still holds its module, so nothing on the module runs beside it. Pulses on modules that share nothing run side by side, each with its own progress panel - two modules or ten. How many run at once is capped by what the machine has room for: past `parallel-jobs` (see [the project config](config.md#how-many-jobs-at-once)), a pulse whose turn has come waits for a free slot, and says so.
49
54
 
50
- - **The panel** above the input, while something runs, shows on top what finished - a line a module, the module that finished last on top, its pulses newest first, each with its mark (green, red or amber, as in the side panel), number and kind - what it regenerated is in the side panel - `cognio ✓ 4 conformance · ✓ 3 regenerate · … 2 earlier`, the newest that fit the width - then a rule, and under it each running pulse, the newest first - `cognio · regenerate pulse 5`, `cognio · conformance pulse 6` - its time and cost, and what its agents are doing. A module whose work is being planned into pulses shows at once, before any pulse runs - `shorty · planning the pulses · 12s` - from the moment it is asked for: while its code is deleted for a start from scratch and what is left to regenerate is worked out, as well as while the planner, an agent, cuts it into pulses; a `/regenerate` says it began the moment it is sent. A \*\*\*plain change is looked at quietly, and shows only once the planner runs. Pulses are numbered within their module, as regen numbers them. `ctrl+o` expands the agents' trace alone; what finished stays a line a module. The line of keys under it - `ctrl+o to expand the trace · ctrl+h to peek at regen` - has each key breathing, fully there to a little faint and back, until it is first pressed: once `ctrl+o` has opened the trace, or the side panel has been opened, that key is still for the rest of the session and the other breathes on. What waits is not in it, and it shows no \*\*\*plain diff - the side panel has both. With nothing running it is gone.
55
+ - **The `***plain` button** turns pink and shows a spinner while turri is preparing or planning pulses, regenerating code, or running conformance. It returns to its idle colour when that work stops. Open `pulses` for progress and `notifications` for finished work; neither takes space above the editor.
51
56
  - **A pulse's change** is what its agent works from, not a text diff of the module's file: the items `<spec change>` gives the agent - only what the pulse's functional specs use, an import's items as well as the module's own, a code pulse's without the test reqs - each in the file it is written in, under its section, in the file's order (`change-view.ts`).
57
+ - **\*\*\*plain in the chat** - a block an agent fences as ` ```plain `, or with no language around a section's header - is highlighted as a \*\*\*plain diff is, by turri's own grammar in the same colours (`src/plain-code-blocks.ts`).
52
58
  - **A \*\*\*plain diff**, in the side panel, reads as an editor shows a diff: its [\*\*\*plain](https://plainlang.org/docs/) highlighted by turri's own grammar, which started from [plyn](https://github.com/plainlang/plyn)'s - section headers, the `# <id>` heading of a functional spec or a scenario, concepts, names in backticks, text in quotes, links, the front matter - each added line filled green and each removed one red, the text on top, the fill the width of the panel ([colours](theming.md#plain-diffs)). It is shown file by file, each file's lines together under its name, with what it adds and takes out - the module being regenerated first, the rest by name, and none the diff does not change. Each line has its number in that file: a \*\*\*plain diff is of \*\*\*plain as read, with what it imports laid in, so a line is placed in the file it is written in - its links read as the parser renders them - and a removed line, in no file now, goes with the change it is part of and has no number. A line is never put in a file on a guess: one that cannot be placed is listed last, under "not found in the spec's files". Where lines of a file are not in the diff, `↕ 28 lines` says how many, as GitHub does - `↑` above the first - and names the section the lines under it are in when it is another than the one above, `↕ 28 lines · ***functional specs***`, as GitHub names a hunk's function: each section is named once.
53
59
  - **The side panel** (`ctrl+h`, as it was left - but on the pulse that last failed, stopped or did not pass, when one has since it was last opened: the live panel that showed it is gone with the last pulse, and its announcement in the chat says `ctrl+h shows this pulse`; **`/pulses`** on the pulses; not `ctrl+j`, which a terminal without the Kitty keyboard protocol sends as a line feed, the same as `shift+enter`, and which a dialog takes for `enter`; both stay [pi](https://pi.dev)'s new-line keys. `ctrl+h` is the byte old terminals sent for backspace; a terminal set to send `^H` for its Backspace key would open the panel on it) takes the whole screen - the panel or the chat, one at a time - or, `s`, sits beside the chat: the chat on the left, the panel in the right half of the screen, and `s` again over the whole screen. It opens as it was last left, for the conversation; a terminal under 104 columns - 100 inside the screen's padding, a blank row above and below everything and two columns either side - has no room for both and shows the panel over the whole screen. It opens on **regen**: the module's \*\*\*plain itself, in full, with how much of it the code has been regenerated from drawn onto it.
54
60
 
@@ -78,7 +84,7 @@ A regeneration takes minutes, so in the TUI every tool that regenerates starts t
78
84
  - `turri` runs [pi](https://pi.dev) in fullscreen mode, so the conversation stays where you scroll it while the pulses redraw (PgUp/PgDn, the wheel); `--tui-mode regular` goes back to the terminal's own scrollback.
79
85
  - **`/settings`** changes a setting of the project's `config.turri.yaml` - the models, review, conformance tests, any key - and says when it takes effect: now, at your next message, or at the next pulse; never only after a restart. It takes [pi](https://pi.dev)'s own `/settings` over, pi's menu the last entry of its list. See [changing it from the chat](config.md#changing-it-from-the-chat).
80
86
  - **`/sentinel`** says whether the [sentinel](sentinel.md) checks every pulse that finishes: `ask` - you are asked before it first opens in a session - `on`, or `off`; written to `config.turri.yaml`.
81
- - **`/regenerate [module | file.plain] [module:func-id ...] [from scratch [whole chain]] [how to cut the work]`** regenerates a module from its \*\*\*plain as it is now, as the `regenerate` tool does: what is left to regenerate is planned into pulses - one functional spec at a time, a few together or the whole module in one, as the planner judges - and the first starts. Words after the module are guidance for that plan (`/regenerate app models first`). A module's name typed with spaces for its underscores is that module - `/regenerate d365_function executor` is `d365_function_executor`. With no module named: the one `module:` in `config.turri.yaml` names, else the folder's top modules, to pick from. Asked for from scratch - `from scratch`, `start over`, `delete the module` - it starts at once, with nothing to confirm: it deletes the module's code and conformance tests in every codebase where they live, committed so `/lineage` keeps them, and regenerates the whole module from its \*\*\*plain, built though nothing in it changed: `/regenerate shorty from scratch`. The modules below it keep their code, and the module starts again from a copy of the code below it. Asked for its chain too - `/regenerate shorty from scratch, the whole chain` - the code of every module of its requires chain is deleted, the base's included, and the whole chain is regenerated from the bottom: what to do after modules were split, merged or moved, when the code below was laid out for modules that are no more. The chat's `regenerate` does the same with `from_scratch: "module"` or `"chain"`, when you ask for it; `turri regenerate --from-scratch` or `--from-scratch-chain` on the command line, not with `--dry-run`. Functional specs named after the module, each as `<module>:<func-id>` - `/regenerate shorty shorty:shorten shorty:expand` - are regenerated though their \*\*\*plain did not change, on the coding model: as `turri regenerate shorty.plain shorty:shorten shorty:expand` does, and the chat's `regenerate` with `funcIds`. A bare func-id is refused: the module is always named. Code built before functional specs had func-ids - its record numbers them - is never built on: the module's whole chain has to be regenerated from scratch, and the chat asks you first, as for a start over.
87
+ - **`/regenerate [module | file.plain] [module:func-id ...] [from scratch [whole chain]]`** regenerates a module from its \*\*\*plain as it is now, as the `regenerate` tool does: what is left to regenerate is planned into pulses - one functional spec at a time, a few together or the whole module in one, as the planner judges - and the first starts. No other words are taken: how the work is cut is the planner's. A module's name typed with spaces for its underscores is that module - `/regenerate d365_function executor` is `d365_function_executor`. With no module named: the one `module:` in `config.turri.yaml` names, else the folder's top modules, to pick from. Asked for from scratch - `from scratch`, `start over`, `delete the module` - it starts at once, with nothing to confirm: it deletes the module's code and conformance tests in every codebase where they live, committed so `/lineage` keeps them, and regenerates the whole module from its \*\*\*plain, built though nothing in it changed: `/regenerate shorty from scratch`. The modules below it keep their code, and the module starts again from a copy of the code below it. Asked for its chain too - `/regenerate shorty from scratch, the whole chain` - the code of every module of its requires chain is deleted, the base's included, and the whole chain is regenerated from the bottom: what to do after modules were split, merged or moved, when the code below was laid out for modules that are no more. The chat's `regenerate` does the same with `from_scratch: "module"` or `"chain"`, when you ask for it; `turri regenerate --from-scratch` or `--from-scratch-chain` on the command line, not with `--dry-run`. Functional specs named after the module, each as `<module>:<func-id>` - `/regenerate shorty shorty:shorten shorty:expand` - are regenerated though their \*\*\*plain did not change, on the coding model: as `turri regenerate shorty.plain shorty:shorten shorty:expand` does, and the chat's `regenerate` with `funcIds`. A bare func-id is refused: the module is always named. Code built before functional specs had func-ids - its record numbers them - is never built on: the module's whole chain has to be regenerated from scratch, and the chat asks you first, as for a start over.
82
88
  - **`/conform [module | file.plain] [module:func-id ...] [from scratch [whole chain]] [one by one]`** writes and runs a module's conformance tests now, as the `conform` tool does: those of the functional specs named, each as `<module>:<func-id>` - `/conform shorty shorty:shorten shorty:expand` - or, with none named, of every functional spec with scenarios. A functional spec named whose tests are written has them written again, deleted and written anew from its scenarios; `from scratch` takes out the tests folder where the module's code lives - the tip of its chain, never a module in the middle - its lineage keeping it, and writes the tests again from a copy of the tests of the module the tip requires; `from scratch, whole chain`, from nothing. None of it touches the code ([written again](regenerating.md#conformance-tests-in-the-work-loop)). They go in one pulse, as far as a size guardrail lets; `one by one` (or `separately`, `one at a time`) has a pulse a functional spec. No other words are taken: there is no plan to guide. The module is found as `/regenerate` finds it. Asking for them is asking for them on: with conformance tests off, `/conform` turns them on first - `conformance-tests: true`, written where the module's value comes from - and says so: the one way the chat's work has them turned on, as the `conform` tool is refused while they are off. What would start nothing is found from the \*\*\*plain before anything is said. A step of adding tests still to take - no test reqs, no conformance testing script, no scenarios - is not an error: it is what `/conform` needs first, told to turri alone, not shown to you, and turri takes it at once - the test reqs, the conformance testing script, the scenarios of the functional specs named, or of each one that needs them - without asking again: your `/conform` was the yes. Then it regenerates the module, and says what it is writing and why. What is yours to settle - a functional spec named that is not there - is shown to you, and turri tells you what would let it start, starting nothing. Its tests come before anything is built on it: a codebase built on the module is stopped and deleted, and regenerated from it once they pass. Tests written already for the scenarios as built are said to be, and nothing starts.
83
89
  - **`/halt <id>`** halts a pulse - a queued one never starts - **`/halt <module>`** (or a planned row's id) halts a module's planned pulses until you ask for it again, a \*\*\*plain change not starting it, and **`/halt launched <name>`** halts a server a launch started - **`/halt launched <module>`** the module's launch under way, the one waiting, and what it started; it lists them all when no id is given.
84
90
  - **What these commands show you, the chat knows.** What `/regenerate`, `/conform` and `/halt launched` tell you - \*\*\*plain that does not parse, the pulses planned, a server halted - stays in the chat under the command, and since a slash command runs outside the conversation, it is put in the conversation as well: say "fix it" next and turri knows what you are looking at. When `/conform` starts nothing, turri answers it at once - taking the steps of adding tests still to take, which you are not shown, and saying why for the rest. Once `/regenerate` or `/conform` has started pulses, turri says so in the chat too - what runs and what is planned, and that you need not wait for it - without starting anything more for it; a module already up to date gets the plan's answer alone. A halted pulse reaches it as every pulse's end does.
@@ -128,7 +134,7 @@ To change [pi](https://pi.dev)'s own default, in `~/.pi/agent/settings.json`:
128
134
  { "defaultProvider": "google", "defaultModel": "gemini-3.1-pro-preview" }
129
135
  ```
130
136
 
131
- A provider failure - no credits, bad key, rate limit - is raised with the provider's own message, rather than surfacing as an agent that said nothing. One that passes - overloaded, rate limited, unreachable, timed out - is waited out first, after [pi](https://pi.dev)'s own retries: six more tries, the wait doubled each time from 15 seconds up to five minutes (15s, 30s, 1m, 2m, 4m, 5m, a tenth either way so parallel jobs do not all come back at once), the agent carrying on where it was. Each wait - [pi](https://pi.dev)'s own retries too - is shown as it happens - a notification in the chat and the job panel's status, an orange line in a headless run - and listed in the run report's `turn_incidents`. So is a provider stalling: a request to the model that nothing has come back on for two minutes (`TURRI_PROVIDER_STALL`, in seconds; 0 never), said once for each silence while the turn goes on waiting. A turn turri stops itself - its time up, the agent going round in a circle - is the work's normal course and is not said, only listed.
137
+ A provider failure - no credits, bad key, rate limit - is raised with the provider's own message, rather than surfacing as an agent that said nothing. One that passes - overloaded, rate limited, unreachable, timed out, its stream cut off part-way - is waited out first, after [pi](https://pi.dev)'s own retries: six more tries, the wait doubled each time from 15 seconds up to five minutes (15s, 30s, 1m, 2m, 4m, 5m, a tenth either way so parallel jobs do not all come back at once), the agent carrying on where it was. Each wait - [pi](https://pi.dev)'s own retries too - is shown as it happens - a notification in the chat and the job panel's status, an orange line in a headless run - and listed in the run report's `turn_incidents`. So is a provider stalling: a request to the model that nothing has come back on for two minutes (`TURRI_PROVIDER_STALL`, in seconds; 0 never), said once for each silence while the turn goes on waiting. A turn turri stops itself - its time up, the agent going round in a circle - is the work's normal course and is not said, only listed.
132
138
 
133
139
  ### Models from a pi extension
134
140
 
@@ -201,6 +207,7 @@ turri conform <file.plain> --from-scratch # its tests folder taken out and wri
201
207
  turri lineage <module> # what each regeneration changed in a module, and when
202
208
  turri cultivate debug-specs # run a skill directly - by name, the project's too, or by its folder
203
209
  turri launch <file.plain> # launch what is regenerated from dist/<module>, here
210
+ turri capture [path] # capture an existing codebase into ***plain, in <path>/plain - offline
204
211
  ```
205
212
 
206
213
  `turri cultivate` runs a skill on the project's harness model, as the chat does, unless `--model` names another. The ones that build take `--model provider/model-id`; `regenerate` also takes `--build-dir` and `--dry-run`, which looks ahead as `pulses` does in the chat - plans the work as `regenerate` would, prints the prompt of each codebase's next pulse from that plan, and starts and writes nothing - so not with `--from-scratch` or functional specs named, which change the code or its record before anything is planned. Template directories come from `PLAIN_TEMPLATE_DIRS`. `--help` on any of them lists the rest.
@@ -0,0 +1,26 @@
1
+ # Capture
2
+
3
+ You are one of the agents of a capture: an existing codebase is captured into ***plain, and from then on the ***plain is the source of truth - the code is regenerated from it, and the original codebase is abandoned. The harness gives a small program to one writer and splits larger ones among writers. It assembles what each hands over into ***plain files and checks it.
4
+
5
+ ## You run offline
6
+
7
+ Nobody can be asked anything, and nobody watches. Where the code leaves something open, decide it yourself - the reading most consistent with the code, its tests and its docs - and say what you decided where your tool asks for assumptions. Never stop to ask.
8
+
9
+ ## What you look at
10
+
11
+ The codebase is read only to you: read, grep, find and ls, no shell - but where your task gives you a shell on a copy of it. You are shown a map of your part of it - folders, files, their sizes and the surfaces the harness found in them: routes, commands, options, screens, environment variables, tables, test names, exports. The map is how you find your way; the code is what you read to answer a question, never what you read through. Follow a surface: a route into its handler, a command into what it runs, grep where the trail leads. Read the parts of a file you need with an offset and a limit, not the whole of a long one. You have a budget of tool calls: spend it on what decides the ***plain, then hand over.
12
+
13
+ ## What the ***plain says
14
+
15
+ ***plain a person has to review is ***plain a person can read. A capture that writes down everything the code does is as unreadable as the code, and nobody reviews it. So - but never at the cost of the interface:
16
+
17
+ - **The interface, whole and exact - never guessed, never obvious.** What a user, a client or a script calls is the contract the regenerated software must keep, call for call: every command and subcommand; every option and argument with each name it has, the value it takes, its choices and its default; every route with its method, path, parameters, the fields it takes and answers, and its status codes; every environment variable and configuration key read; every output format, message and exit code a user or a script sees. Read each from the code that defines it, and follow it to what it does - never infer it from a name, the help text or the docs, never fill it in from a convention, never leave it out as obvious or as the stack's: a stack says how errors are shaped, never which options exist or what they accept. Each part's interface is taken from the code as data, before any feature is written, into its interface reference - a linked resource every functional spec about it carries through the part's interface concept: there the details are exact, and the prose names them. Where the code leaves one open, read on until it does not; what you still cannot settle is said where your tool asks what is uncertain, never settled by guess. The rest of what follows is how short to be about everything else.
18
+ - **What someone sees, not what the code does.** Of each fact ask: *would a user or a client notice if it were different, and would they care?* Function names, file layout, helpers, internal data shapes, retries, logging and utility libraries are the code's business - left out. What a user can do, what they see, the boundary cases and the errors they meet are captured.
19
+ - **Only where the code departs from the default.** The default is what a competent developer builds with no instruction: the stack's conventions, the domain's ("a login rejects a wrong password"), and every functional spec before this one. Cookie-cutter behaviour is one line or none; an odd rule - deleting a list archives its items, an unusual sort order, a 30-day limit - is written down exactly.
20
+ - **Exact where exactness is the contract.** A response's fields, a file format, a command's flags, an error code a client checks: these are captured exactly, in the fewest words that keep them exact - terse, never cut. A literal - a URL, a path, a message - is code in backticks, never a link: ***plain refuses a link to anything but a file of the project.
21
+ - **Edge cases go in scenarios.** A functional spec states the rule; its scenarios pin its edge cases with concrete values - the examples, and what each wrong input answers. Neither is said again in the functional spec. Detail moved to a scenario is still captured, and still readable.
22
+ - **Terse is right.** Clipped bullets, no lead-ins, no rationale, no history, no "the system". Every rule of concise ***plain you are given applies.
23
+
24
+ ## What is left out
25
+
26
+ Behaviour nothing relies on - an incidental order, a leftover endpoint, debug output, dead code - is left out, and said so where your tool asks what you dropped. What you could not make out is captured as best you can, and said so where your tool asks what is uncertain. Both reach the person in the capture's report: a judgement said is one they can check.
@@ -0,0 +1,5 @@
1
+ # Check the conventions against the code
2
+
3
+ The survey settled the conventions below: what every feature of the part does the same way - how an error, a warning and a message are written, the exit code or status of each kind of failure, what changes when there is no terminal, what quiet and debug modes hide or add, and what reaches the other side of every call it makes or answers. Every feature is captured following them, so one that is wrong is wrong everywhere. Check each against the code: start at the files it names, follow the entry point to where it catches errors, writes to its streams and exits, and read the conditions exactly - which flag, which level, which stream, when a terminal matters, which name the program goes by. For what reaches the other side, follow a call to where it leaves - the request built and sent, the response written - and read what is added there: the headers set of its own, how a body is serialised and encoded, how header values are encoded, when a body is read or streamed. A declaration is no evidence, a help text or a docstring neither when the code does otherwise; two conventions that disagree cannot both hold.
4
+
5
+ Call `submit_capture_conventions` once, with every convention as the code has it: each that holds, word for word; each corrected; any the code shows that every feature follows and the survey missed. Each with `where`, the files whose code decides it. In `changes`, what you changed, a line each, with why - the file and what its code does. Never change one that holds.
@@ -0,0 +1,11 @@
1
+ # Check the interface reference against the code
2
+
3
+ Below is part of the software's interface reference as an agent took it from the code, each entry with where it is defined. The reference is given whole to every agent that regenerates or tests the code, and it is the one place its details are written: what it lacks or gets wrong, the regenerated software lacks or gets wrong. Every literal in it was checked to be in the code - so nothing in it is invented; what is left to check is that it is whole and right. Read each entry where it is defined, and follow the code to where each detail is worked out:
4
+
5
+ - **Its help, whole:** the text the program prints for it with `--help` - every paragraph, word for word. Where the code keeps a short help and a long one, the one `--help` prints.
6
+ - **Its choices:** every value it accepts, from wherever the code lists them - a constant elsewhere, the letters of a format. Choices worked out when it runs - filtered by what the machine has, taken from what is installed - go in its details, saying how, never as a fixed list that is not always the list.
7
+ - **Its default, what it takes, whether it repeats, is required or is hidden** - as the code has them; a default worked out when it runs, in its details, saying how.
8
+ - **Before you say what a set, a list or a mapping holds,** grep every line that builds it or adds to it - a set defined in one place is often added to in another, a mapping filtered further down - and read each. Correct an entry only where the code shows it wrong, and say the file and the line that show it.
9
+ - **What was missed:** grep the part for interface no entry holds - environment variables read through a constant or a helper, subcommands, arguments, routes a router adds - and add each.
10
+
11
+ Call `submit_capture_reference_checked` once, with every entry as the code has it - each that holds, word for word; each corrected; each missed - and every exclusion; and in `changes` what you changed, a line each, with why: the file and the line, and what its code does there. Never change one that holds.
@@ -0,0 +1,7 @@
1
+ # Capture a small program as one module
2
+
3
+ You are the only feature writer for this program. Read its source and the tests that show what someone relies on. Use the surveyed stack, concepts and conventions and the interface reference you were given. Capture the whole program as one feature with its functional specs in build order. Name its interface exactly, using the interface concept when there is one; let the reference carry the literal details. Write for the person who will read this module. Keep the rule in the functional spec and the examples in its scenarios.
4
+
5
+ Use a short kebab-case `func_id` per functional spec. Give its black-box conformance and acceptance scenarios concrete inputs and observable outcomes, especially where the original has tests. Define the concepts they need beyond the part's, and say what was assumed, unclear or left out.
6
+
7
+ Call `submit_capture_compact` with `feature` when all its behaviour fits in one readable module, at most eight functional specs and the scenario budget given. If it has independent concerns that need separate modules, or its behaviour or tests do not fit, call it with `expand` instead, saying why. The harness will give the concerns writers of their own. Never leave behaviour or tests out to make it fit.
@@ -0,0 +1,3 @@
1
+ # Reconcile concepts
2
+
3
+ Agents capturing different features of the same codebase each defined some of the same concepts, in different words. Each concept below has every definition it was given, and the functional specs that use it. Give each concept one definition that serves every one of those uses: one plain sentence that starts with the concept and says what it is, with the attributes the specs rely on. Use only the concepts listed with it. Call `submit_capture_concepts` once, with a definition for every concept.
@@ -0,0 +1,9 @@
1
+ # Divide the features
2
+
3
+ The part was outlined area by area, each area by an agent that saw only its own files - so one behaviour can be in two features: an option parsed in one area and acted on in another, a message built in a third, a command's help beside the command. Each feature is then written by an agent of its own, side by side; a behaviour in two features is written twice, in different words, and the two copies contradict each other. Below is every feature of the part, area by area, in build order, with what it is about and where it is built. Give each behaviour to one feature. Call `submit_capture_owners` once.
4
+
5
+ - `features`: every feature that stays, by its key as listed, with `owns`: one line naming what it alone captures - its commands, options, messages and behaviour - so its writer knows its edges and leaves the rest to the others. A behaviour two features would both capture is in the `owns` of one: the feature that is about it - where a user would look for it - never one that only parses it, passes it on or prints it.
6
+ - `merged`: a feature that is a slice of another's behaviour - the options of what another feature does, the printing of what another sends - is merged `into` the features that take it, with `why`: it is not written, and its files go to them. Merge for that, never because two features are small.
7
+ - Every option, command and route of the part is in the `owns` of one feature: the interface is captured whole, so name in `owns` the options and commands each feature takes.
8
+ - A feature builds only on the features before it: give a behaviour to one that comes after what it needs.
9
+ - You see the outline, not the code: decide from what each feature is about and where it is built. Most features stay as they are, owning what they were outlined for.
@@ -0,0 +1,45 @@
1
+ # Capture a feature
2
+
3
+ Capture one feature of the codebase into ***plain: its functional specs, the concepts they need, and their scenarios. Agents capture the other features side by side; the features before yours in the outline are built before it. Call `submit_capture_feature` once.
4
+
5
+ ## What is yours
6
+
7
+ Every feature of the part is listed with what it owns: each behaviour is one feature's. Capture all that yours owns - also where its code is in files you were not pointed to. Never capture what another feature owns, even where your code or your tests touch it: it is captured there, and your functional specs build on it, naming it at most. When your tests check another feature's behaviour along with yours, your scenarios check yours.
8
+
9
+ The part's conventions are settled: how errors are written, the exit code or status of each kind of failure, what changes without a terminal, what reaches the other side of a call. Every functional spec and scenario follows them; none decides them again. Where your feature departs from one, capture the departure.
10
+
11
+ ## First, find out what it does
12
+
13
+ Start at the feature's paths and its surfaces. Follow each route, command or screen to what it does and what the user sees: the inputs it takes, what it answers or shows, what it refuses and how, what it keeps. Read the original's tests of the feature: what they assert is what someone cared about. Then stop reading and write from what you found out - never while reading code, never line by line.
14
+
15
+ ## Then write the functional specs
16
+
17
+ - At most eight functional specs, in build order - each only builds on those before it, here and in the features before yours.
18
+ - `func_id`: short kebab-case from what it does (`add-task`), unique in your feature.
19
+ - `text`: what the software does once built, as a statement of fact with a concrete subject - `A :User: can archive a :List:.` - its first line the behaviour, then the detail that matters: inputs, outputs, boundaries, and the errors the stack does not settle. No line starts with `# ` or `***`.
20
+ - Each implies about two hundred lines of code at most: a larger one is two functional specs.
21
+ - The interface your feature owns, whole and exact. The interface in your files is listed - from the part's interface reference when it has one: taken from the code, every literal checked against it, and carried by every functional spec that uses the part's interface concept (`:<Part>Interface:`). Capture what each piece your feature owns does, by its exact name, using the concept; what it takes, its choices, its default and its help are the reference's - say them only where a behaviour turns on them, and never otherwise than it does. With no reference, capture each exactly yourself: every name it has, what it takes, its choices and default, what it does and what it answers - an endpoint's method, path, fields and status codes; a command's arguments and output; a message's exact text; a file's format. A client of the original must work against the code regenerated from your ***plain, call for call. Read each where it is defined - never from its name, its help text or what the stack would do.
22
+ - Everything else: as short as its facts allow. Leave out what a competent developer would build anyway on this stack, and anything only the code knows - never the interface.
23
+ - Nothing the stack says: what its templates and implementation reqs settle - settings, logging, request ids, error bodies, how it starts - is built already. Capture only where the original departs from them. A stack settles how; which options, routes and commands exist, and what each takes and answers, is always yours to capture.
24
+ - The rule, never its cases. A functional spec says what is refused - `The url is an absolute http or https URL with a host.` - and the stack says how: what invalid input, a missing record or no access answers, its status and its error code. So neither an example (`nope`, `ftp://example.com`) nor what one wrong input answers is a line of the functional spec: each is a scenario of it. Only a refusal the stack does not settle - a status or an error code of the original's own - is written in the functional spec, once, with its rule.
25
+
26
+ ## Scenarios
27
+
28
+ A functional spec gets scenarios - `conformance` for its expected use, `acceptance` for use that is not expected: wrong input, a missing record, no access.
29
+
30
+ - **Where the original tests it.** The original's black-box tests are your evidence and your model: a test that runs the software through its interface - an HTTP call, the command run (in a process of its own or the test's), a page driven - is captured as a scenario that does what it does, with its values. A test that calls a function or a class directly is not. Spend your scenarios where the original's tests are densest: a functional spec it tests twenty ways gets several, one it tests once gets one, and error cases get no larger share than the original gives them. A functional spec the original tests through its interface never goes without a scenario.
31
+ - **Where it does not,** a functional spec gets scenarios only when a wrong implementation would give output that looks right, when two readings of it give different outputs, or when a bug in it costs money, security, data or users' trust.
32
+
33
+ Each scenario: a `scenario_id` in kebab-case, unique for its functional spec; one concrete, checkable outcome with concrete values (`named "Buy milk"`, `answers 404`); acting only through the interface; never more than its functional spec says. No more scenarios in all than your budget says - it grows with the original's tests of your feature.
34
+
35
+ A scenario runs as the part's test reqs say, so it expects what the original does then: its output is not a terminal unless they give it one - a scenario about colours passes the option that forces them; it talks to a local server, never a site on the internet; its width, its configuration and its home are the test's. A unit test of the original that mocks a library or calls a function is not a scenario recast: check its behaviour through the interface, or leave it out. What only your scenario needs set up - a file it sends, a session it starts from, a server that answers one exact body - it says itself: the test reqs are what every test of the part sets up.
36
+
37
+ Each feature's scenarios are tried on the original before the ***plain is written, and one the original fails is corrected - but write each to hold the first time.
38
+
39
+ ## Concepts
40
+
41
+ Use the concepts you are given - the part's core ones - and the predefined ones. Define a new one in `definitions` only when your specs need a name the given ones do not have: one plain sentence that starts with the concept. Never define a given or predefined one again. Every concept in your specs, scenarios and definitions must be given, predefined or yours, and no definition names a concept whose definition names it back.
42
+
43
+ ## Say what you decided
44
+
45
+ `assumptions`: what you decided where the code left it open. `uncertain`: what you captured without being sure of it. `dropped`: behaviour you judged incidental and left out. One line each; empty when there is nothing.
@@ -0,0 +1,9 @@
1
+ # Capture the interface no feature captured
2
+
3
+ Every feature of the part is written, and the surfaces listed in `<the interface to capture>` are named in none of their ***plain: options, commands, routes, screens or environment variables the code defines, each with the file that defines it. A capture leaves no interface out - whoever calls one in the original must find it, the same, in what is regenerated - so they are yours, as a feature of their own in the module.
4
+
5
+ - Capture each exactly: what it does and what a user sees of it, by every name it has. One the part's interface reference holds is listed with its entry - what it takes, its choices, its default and its help are there, exact: use the part's interface concept, and say them only where a behaviour turns on them. One it does not hold, capture whole yourself: what it takes, its choices and its default too. Read each where it is defined and follow it to what it does - never from its name or its help text alone.
6
+ - Group them into functional specs by what they do, as any feature's: several options in one functional spec when they are one behaviour.
7
+ - Where one belongs with another feature's behaviour - an option of what another feature does - capture this part of the interface exactly, build on that feature, and name it; never write its behaviour again.
8
+ - One that is not the software's interface - an option of a development script, a variable only its tests or its build read - goes in `dropped`, by its name, with why. Nothing else is dropped: an option users rarely pass is still the interface.
9
+ - `title`: a few words for what they are, as a feature of the module - `Proxies and network options`.
@@ -0,0 +1,23 @@
1
+ # Gather the features into modules
2
+
3
+ The part's ***plain is a chain of modules. Below is every feature of the part, area by area in the order of the code, with what it owns, the first line of each functional spec and its scenarios - and the modules as the code's areas make them, gathered by size alone. Gather the features into modules by concern, and put the modules in the order they are built. Call `submit_capture_modules` once.
4
+
5
+ ## A module is a concern
6
+
7
+ A module is what a person looks for in one file: a command-line tool's request sending, its output formatting, its sessions, its downloads, its plugin manager; a backend's accounts, its orders, its payments. One module that holds everything is as hard to read as the code, and every change to it regenerates all of it; a concern split across modules is read in pieces.
8
+
9
+ - `modules`, each with a `name` - short kebab-case, the concern - an `about` line, and its `features` by key, in the order its functional specs are written. Every feature is in one module.
10
+ - A module of one feature is right when that feature is a concern of its own. Put a feature with another only when it is part of that concern - never to make a module larger.
11
+ - A concern too large to read in one file - past about 40 functional specs - is two modules, each a part of it.
12
+ - The areas are folders of the code - often a concern each, never binding: a module may take features of several areas, and an area's features may go to several modules. Where the code's areas are concerns already, keep them.
13
+
14
+ ## The order they are built in
15
+
16
+ Each module is built on the code of the modules before it, and its conformance tests - its scenarios - run as soon as it is built, with nothing after it there. A module whose scenarios send a request, print a response or save a session needs the module that does that before it: built earlier, its scenarios cannot pass, and its coding agent invents what a later module captures.
17
+
18
+ The areas are in the order of the code's imports, which is not that order: the code that runs everything imports everything, yet everything else needs it built first - a command-line tool's request sending before the output formatting that prints what it answers, a backend's routes before the middleware that wraps them. List the modules in the order they are built: the core flow first, what extends it after.
19
+
20
+ - `needs`: for each module, the modules before it whose behaviour its functional specs build on and its scenarios run - the module where the command, the route or the screen its scenarios use does what they rely on. A scenario that runs a command needs the module that makes the command do it, not only the one that names its options.
21
+ - `rewrites`: a scenario that needs a module after its own whatever the order - two modules whose scenarios each need the other - is rewritten so it checks what it checks with only the modules before it: a scenario of output formatting that follows a redirect checks the formatting of a plain response instead. Its feature's key, its functional spec's func-id, its scenario's id, its whole new text, and `why`: the later module it needed. None when none: most orders need no rewrite. Never merge two modules to spare a rewrite.
22
+
23
+ You see the ***plain, not the code: decide from what each feature does and what its scenarios run.
@@ -0,0 +1,11 @@
1
+ # Outline an area's features
2
+
3
+ Your area of the codebase becomes one module of ***plain. Outline it into features - each a thing a user or a client can do, or a part of what they see - which agents then capture side by side, one feature each. Call `submit_capture_features` once.
4
+
5
+ - A feature gets a short kebab-case `name`, a `title` of a few words, a line `about` what it lets someone do, and its `paths`: the folders and files where it is built, relative to the codebase - where its agent starts looking.
6
+ - A feature is about what a user sees: `sign-up`, `password-reset`, `invoice-export` - never a layer or a file (`models`, `utils`).
7
+ - Size: a feature is captured in up to eight functional specs, each about two hundred lines of code. A larger one is two features.
8
+ - List them in build order: each feature only builds on those before it - the first is the simplest thing the area does that can be seen working, and what everything else needs (the data it keeps) comes early. In a codebase that starts here, the first feature also brings up the project - its entry point, its first screen or endpoint.
9
+ - What the stack below already settles is not a feature: settings, logging, request ids, error bodies, middleware, how the app starts. Put such a file in `left_out` with why - settled by the stack - unless the original does something there that a user or a client would notice is different from what the stack says; then that difference alone is a feature.
10
+ - Every route, command, option, screen, environment variable and table of your area belongs to a feature, or the file it is in is in `left_out` with why: the interface is captured whole, so no option is too small to be a feature's. Shared helpers belong to no feature: what they do shows in the features that use them.
11
+ - The area's tests are where its features show: a test file belongs with the feature it tests.
@@ -0,0 +1,12 @@
1
+ # Make the module readable
2
+
3
+ Below is a module's ***plain as a capture wrote it - feature by feature, by agents that each saw only their own feature - each functional spec with its scenarios. You read the ***plain alone, never the code: what you judge is whether a person can review it. Rewrite a functional spec only where it reads as code rather than as what the software does:
4
+
5
+ - a function, class, file, variable or internal data shape named, where the behaviour is what matters
6
+ - a default stated - that invalid input is rejected, that data is saved, that errors are reported - with nothing particular about it, or anything the stack below says already - never an option's default, choices or value, which are the interface
7
+ - a restatement of a functional spec before it, or of a concept's definition
8
+ - a case where the rule is stated - an example, what one wrong input or a missing record answers - that a scenario of it pins, or that the stack settles: the scenario and the stack keep it
9
+ - rationale, narration, history, hedges and adjectives no test can check
10
+ - one fact spread over several sentences, or several facts in one long sentence
11
+
12
+ A functional spec that says nothing the stack and the specs before it do not say already is cut down to what is left, or, when nothing is, to its first line. Keep every fact that is its own: every interface detail - a command, an option and each of its names, its choices and default, a method, path, field, status code, message, exit code, environment variable, format - however obvious it reads, every boundary, and every error the stack does not settle and no scenario pins. Scenarios are not yours to change. Keep its concepts, or use others its module has. A functional spec that reads well is left as it is: most are. Call `submit_capture_edits` once, with the new text of each functional spec you rewrote, by its func-id - none at all when none needs it.
@@ -0,0 +1,10 @@
1
+ # Take the interface from the code
2
+
3
+ You take the software's interface from its code, as data: every command, argument, option, route and environment variable a user, a client or a script calls by name - in the files you are given, and any of their interface the map missed. It becomes the part's interface reference: kept beside the ***plain as a linked resource, given whole to every agent that regenerates the code or tests it, and the one place its details are written. So it is exact, whole, and taken from the code alone - never from a name, the docs, or what a framework would do. Call `submit_capture_reference` once.
4
+
5
+ - **Read each file you are given whole,** and follow what defines the interface to where it is worked out: a list of choices built elsewhere, a computed default, a group of options a helper adds. Then grep the part for interface the map missed: subcommands, positional arguments, routes a router adds, variables read through a helper.
6
+ - **One entry each,** of its kind: `command`, `argument` (positional), `option`, `route`, `env`, or `other` - a configuration key, a file it reads: what a user or a script names. Its `name` exactly as the code has it - a route as `METHOD /path` in the code's own parameter syntax - and every other name it has in `aliases`. For an argument or an option, `command`: the command it belongs to, as its users type it.
7
+ - **Exactly as the code has it:** `takes` (its metavar or type), `choices` (each value, from wherever the code lists them), `default`, `repeatable`, `required`, `hidden` when it is left out of its help, and `help` word for word, placeholders and all - the whole text `--help` prints, every paragraph: where the code keeps a short help and a long one, the one `--help` prints. Choices or a default the code works out when it runs - filtered by what the machine has, taken from what is installed - go in `details`, saying how, never as a fixed list that is not always the list. A route's parameters, the fields it takes and answers, and its statuses, a line each in `details`. Leave a field out rather than guess it: what the code does not say, the entry does not.
8
+ - **Before you say what a set, a list or a mapping holds,** grep every line that builds it or adds to it - a set defined in one place is often added to in another - and read each.
9
+ - **`where`: the file and the line it is defined on.** Every literal you give - each name, alias, choice, default, and the help - is checked against that file and the files you name in `also` (where a default or the choices are worked out): one the code does not have sends the entry back.
10
+ - **Whole:** every surface the map found in your files is an entry, or is in `excluded` with why - only what is not the software's interface: an option of a development script, a variable only its tests read. An option users rarely pass is the interface still.
@@ -0,0 +1,9 @@
1
+ # Split an area
2
+
3
+ Your area of the codebase is too large for one agent to outline: split it into smaller areas, each a cohesive part of what the software does - authentication, billing, the editor, the admin screens - so each can be captured on its own. Call `submit_capture_areas` once.
4
+
5
+ - Each area gets a short kebab-case `name` from what it does, a line `about` what it does, and its `paths`: folders or files of your area, relative to the codebase.
6
+ - Divide by what the software does, not by technical layer, where the code allows it: an area's routes, its data and its screens together. Where the code is layered - a `models/` folder for everything - follow the folders, and name an area by what it does.
7
+ - Every file of your area belongs to one area, or is in `left_out` with why: vendored, generated, tooling. A path in one area is in no other.
8
+ - At least two areas, each smaller than yours. Fewer, larger areas are better than many small ones: an area is worth an agent when it holds a few thousand lines.
9
+ - List them in build order: the foundations first - the data model, shared services - then what is built on them. The harness also orders them by what imports what.
@@ -0,0 +1,37 @@
1
+ # Survey the codebase
2
+
3
+ You start the capture: from the map of the whole codebase, its manifests and its docs, you say what the software is built on and how it divides into parts, you settle the conventions every feature follows, and you write what every part's ***plain shares. Call `submit_capture_survey` once, with all of it.
4
+
5
+ ## Parts
6
+
7
+ A part is software on one stack: a backend, a frontend, a command-line tool, a library. Most codebases are one part. A codebase with a Python backend and a React frontend is two - each captured as a chain of modules of its own, built and tested with its own toolchain. Two parts never share a folder.
8
+
9
+ - `name`: short kebab-case, what the part is - `api`, `web`, `cli`, or the product's name when there is one part.
10
+ - `paths`: the folders and files that are the part, relative to the codebase - `.` for the whole of it when there is one part.
11
+ - Leave out what is not the software: vendored code, generated code, build and deployment tooling, editor settings, the docs themselves - each in `left_out`, with why. A part's own tests are part of it, never left out: they are the evidence of what it does.
12
+
13
+ ## The stack
14
+
15
+ The parts are captured on the stack they are on now - the same language, framework, storage and main libraries, with their versions from the manifests.
16
+
17
+ - `stdlib_stack`: turri's standard library has templates that settle a stack (the catalogue is below). Read the one that matches. Name it only when the original agrees with it - its framework, its layout, its libraries - since everything in it becomes a requirement. When it contradicts the original anywhere that matters, name none, and write the stack in `implementation_reqs` instead.
18
+ - `stdlib_conformance`: true to import the stack's conformance template too - when you named a stack that has one and the original's black-box tests, if it has any, run the way it says.
19
+ - `implementation_reqs`: how the part is built, one fact a line, without the `- `: the language and its version, the framework, storage, the libraries that shape behaviour or architecture - an ORM, an outside service such as a payment provider - and how it starts. Write :Implementation: as the subject. Not what a named `stdlib_stack` says already; not utility libraries. When the original has unit tests, how they run - their framework - with :UnitTests: as the subject.
20
+ - `test_reqs`: how the black-box conformance tests run, with :ConformanceTests: as the subject - the framework, how they reach the software (start the server and call it over HTTP, run the command, drive the page). Take it from the original's own black-box tests when it has them, and from how they run the software: read their harness - fixtures, helpers, `conftest` - for what standard input is (a terminal, empty, piped), the environment and the servers they start, and say it. A conformance test run any other way tests another program: a command that reads piped standard input as its body acts differently when its tests give it none.
21
+ - Then what every test sets up so the software acts the same on every run and every machine - read the code for what would otherwise vary: whatever it fetches or checks on its own - an update check, telemetry, a remote configuration - turned off, or pointed at a local stand-in; a home and a configuration folder of the test's own, empty unless the test fills them; the terminal width fixed (`COLUMNS`) where its output wraps or cuts to it; a pseudo-terminal where it prompts on one - a password - or acts otherwise on one; the servers it talks to started locally, never the internet. Each as one fact, with how: the variable and its value, the file and what it holds. Leave `test_reqs` empty only when the conformance template you named says it all.
22
+
23
+ ## Conventions
24
+
25
+ `conventions`: what every feature of a part does the same way and a user or a script relies on, settled here once - the agents that capture each feature follow them, and never decide them again. Four agents each deciding a command's exit code on a usage error decide it differently. For a command-line tool: how an error is written - the stream, its exact form - the exit code of each kind of failure (a usage error, a failed request, a timeout, Ctrl-C), and what changes when standard input or output is not a terminal. For a backend: the error body, the status of each kind of failure, what every request needs. For a frontend: how errors and loading show.
26
+
27
+ For software that talks to other software - a client that sends requests, a server that answers them, a tool that writes files another program reads - also what reaches the other side, exactly, whichever feature makes the call: the headers it adds of its own and when (`User-Agent`, `Accept`, `Content-Type`, `Content-Length`); how a body is encoded - JSON's separators and whether non-ASCII is escaped, the charset, a form's encoding; how a header's value is encoded and trimmed; when a body is sent or read whole, streamed, or not read at all. No feature's writer looks at the wire; the other side sees it on every call.
28
+
29
+ - Settle each from the code that does it: follow the entry point to where it catches errors and exits, and read what it does there. A declaration is no evidence - an enum lists codes the code may never use - and neither is a framework's default the entry point changes: argparse exits 2 on a usage error unless the program catches it and exits otherwise.
30
+ - One fact a line, without the `- `, exact: the stream, the text, the code. In `where`, the files whose code decides it.
31
+ - Only what the stack you named does not say the same way: where the original departs from it, or what it leaves open.
32
+
33
+ ## Concepts
34
+
35
+ `definitions`: the core concepts of each part's domain - what its data model, its tables and its screens are about: `:User:`, `:Order:`, `:Invoice:`. Each is one plain sentence that starts with the concept and says what it is, with its attributes when they matter to what users see. Only those used across the software; the agents that capture each feature define their own. Concept names are CamelCase between colons, and never one of the predefined ones (:Implementation:, :UnitTests:, :ConformanceTests:, :AcceptanceTests: and the rest).
36
+
37
+ Every concept your bullets use must be one of yours or a predefined one. Two definitions never name each other - `:Link:` naming `:LinkCode:` and `:LinkCode:` naming `:Link:` is a circle ***plain refuses: the one built on the other names it, and that one names nothing back.
@@ -0,0 +1,18 @@
1
+ # Try the scenarios on the original
2
+
3
+ The scenarios below are what the conformance tests of the regenerated code will check. Agents wrote them from the original's code and tests, and never ran it - so one can expect a terminal its test will not give, a site on the internet, output wrapped at a width nobody set, a message the original never prints. A scenario the original itself fails is wrong: a coding agent builds to it and breaks what users rely on, or its module's conformance tests fail for good.
4
+
5
+ You have a shell. Your folder is a copy of the original codebase - its files, none of its dependencies installed. Install it there, as its manifests and README say, then run each scenario against it the way its conformance test will: from outside, through its interface - the command run, the request sent, the page driven - under the test reqs below: what standard input and output are, the environment, the servers it talks to. Never change the original's files to make a scenario hold.
6
+
7
+ Call `submit_capture_trial` once, with every scenario you were given, each with its `outcome`:
8
+
9
+ - `held`: the original does what it says. In `ran`, what you ran and what it answered, in a line.
10
+ - `corrected`: it does otherwise. Its whole new text in `text`, saying what the original does; `why`; and in `ran`, what you ran and what it answered. Keep what it checks - change its values, what it expects, or how it gets there: a local server for a site on the internet, the option that forces colour when its test's output is not a terminal. Never check less. Where its functional spec says the same wrong thing, correct the functional spec too, in `functional_specs`, its whole new text and why.
11
+ - `removed`: nothing outside the software can check it - it calls a function, mocks a library, needs a real terminal no test can give - with `why`. Rare: first look for a way to check it from outside.
12
+ - `untried`: you could not run it - the original would not install or start here, it needs a service this machine lacks - with `why`. It stays as written. Never `held` or `removed` for a scenario you did not run.
13
+
14
+ What every conformance test of the part must set up for the original to act as the scenarios say goes in `test_reqs`, one fact a line, with :ConformanceTests: as the subject, when the test reqs below do not say it already: an environment variable such as `COLUMNS`, a configuration folder of the test's own, an update check or telemetry turned off, how bodies are compared, a local server in place of the internet.
15
+
16
+ The test reqs are read by whoever writes any conformance test of the part, for every scenario of every module. So what only some scenarios need - a file one sends, a session file one starts from, a server that answers one exact body, a pseudo-terminal for the one password prompt, a variable unset for one case - is never a test req: it goes in those scenarios' own text. Return each `corrected`, its text saying the setup it needs as part of what it does, and `why`: the setup it did not say. A test req names no scenario and no functional spec.
17
+
18
+ You have a budget of tool calls: install once, then a command or two a scenario. Run several scenarios in one command where you can.
@@ -0,0 +1,7 @@
1
+ # Check the interface against the code
2
+
3
+ Below is a module's ***plain - each functional spec with its scenarios - and the interface the code of its features defines. From now on the ***plain is the source of truth and the code is regenerated from it: what it says of the interface must be what the original does, exactly. Check every interface fact it states against the code that decides it - each option's names, the value it takes, its choices and default; each command; each route's method, path, parameters, fields and status codes; each message, output format and exit code a user or a script sees; each environment variable. Read the definition and follow it: never take the ***plain's word, a name, a help text or a docstring when the code does otherwise. The agents that wrote it were offline and read in a hurry; expect mistakes.
4
+
5
+ When the part has an interface reference, its entries are listed: taken from the code, every literal checked against it. The ***plain must agree with it - an option, a choice, a default it gives otherwise is wrong, unless the code shows the reference is - and an option the ***plain names that the reference does not have is listed for you to settle against the code.
6
+
7
+ Correct what is wrong, and add what is missing of the interface it already describes: a choice left out, a default unsaid, an alias, a message's exact text, a field. A scenario that would fail against the original is corrected too. Call `submit_capture_corrections` once, with each correction: the functional spec's func-id - and the scenario's id when the correction is to the scenario - its whole new text, and why, citing the code. Change nothing else: a functional spec that holds keeps its words, behaviour that is not interface is not yours, and no fact is cut. None at all when everything holds.