@turri-dev/cli 0.4.3-next.fd01774 → 0.5.1-next.4bafdf3
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.
- package/README.md +3 -1
- package/dist/banner.js +12 -1
- package/dist/capture-cli.js +50 -68
- package/dist/capture-progress.js +124 -0
- package/dist/cli-root.js +44 -4
- package/dist/cli.js +16 -2
- package/dist/entry-renderers.js +9 -2
- package/dist/init-config-cli.js +10 -1
- package/dist/pi-launch.js +7 -1
- package/dist/reopen.js +5 -17
- package/dist/skill-progress.js +2 -0
- package/dist/terminal-view.js +23 -32
- package/docs/README.md +1 -1
- package/docs/capture.md +106 -180
- package/docs/chats.md +1 -1
- package/docs/config.md +2 -5
- package/docs/development.md +3 -3
- package/docs/using.md +3 -3
- package/package.json +2 -2
- package/dist/capture-view.js +0 -99
package/dist/terminal-view.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { truncateToWidth } from "@earendil-works/pi-tui";
|
|
2
2
|
import { didNotPass } from "@turri-dev/core";
|
|
3
3
|
import { registerBanner } from "./banner.js";
|
|
4
|
-
import { captureProgress } from "./capture-view.js";
|
|
5
4
|
import { registerChats } from "./chat-commands.js";
|
|
6
5
|
import { createChatUi } from "./chat-ui.js";
|
|
7
6
|
import { registerEntries } from "./entry-renderers.js";
|
|
8
7
|
import { makePanel, registerNotifications, registerPanelKey, terminalAsk } from "./panel-view.js";
|
|
9
8
|
import { openPiSettings } from "./pi-settings.js";
|
|
10
|
-
import { canReopen,
|
|
9
|
+
import { canReopen, CAPTURE_OPEN_QUESTION, capturedEnv, reopenIn } from "./reopen.js";
|
|
11
10
|
import { skillProgress } from "./skill-progress.js";
|
|
11
|
+
import { captureProgress, registerCaptureProgressCalls } from "./capture-progress.js";
|
|
12
12
|
import { TerminalNotifications } from "./terminal-notifications.js";
|
|
13
13
|
/**
|
|
14
14
|
* The terminal: turri's session as pi's screen shows it - one chat at a time, the others working behind it, regen in a
|
|
@@ -68,7 +68,6 @@ export function createTerminal() {
|
|
|
68
68
|
// The session's work and spec map, as last read - read again once an event says they changed.
|
|
69
69
|
let work;
|
|
70
70
|
let pages;
|
|
71
|
-
const captures = new Map();
|
|
72
71
|
const focused = () => session?.chats.focused();
|
|
73
72
|
const uiOf = (chat) => {
|
|
74
73
|
let ui = uis.get(chat);
|
|
@@ -92,6 +91,19 @@ export function createTerminal() {
|
|
|
92
91
|
const text = outOfReachLine(outOfReach);
|
|
93
92
|
ui.setWidget(OUT_OF_REACH_WIDGET, (_tui, theme) => ({ render: (width) => [truncateToWidth(theme.fg("warning", text), width, "…")], invalidate() { } }));
|
|
94
93
|
};
|
|
94
|
+
/**
|
|
95
|
+
* A capture in `chat` wrote a project of its own and is done (`captureDone`): turri closes here and opens again there -
|
|
96
|
+
* `turri` started this chat, and the person says yes - where the capture's report is shown.
|
|
97
|
+
*/
|
|
98
|
+
const openCaptured = async (chat, dir, summary) => {
|
|
99
|
+
const ui = drawOn(chat);
|
|
100
|
+
if (!canReopen() || terminal.leave === undefined || ui === undefined)
|
|
101
|
+
return;
|
|
102
|
+
if ((await ui.select(CAPTURE_OPEN_QUESTION, ["Yes", "No"])) !== "Yes")
|
|
103
|
+
return;
|
|
104
|
+
if (reopenIn(dir, { env: capturedEnv(summary) }))
|
|
105
|
+
terminal.leave();
|
|
106
|
+
};
|
|
95
107
|
const terminal = {
|
|
96
108
|
get turri() {
|
|
97
109
|
return turri();
|
|
@@ -109,7 +121,6 @@ export function createTerminal() {
|
|
|
109
121
|
continue;
|
|
110
122
|
ui.close();
|
|
111
123
|
uis.delete(id);
|
|
112
|
-
captures.delete(id);
|
|
113
124
|
}
|
|
114
125
|
changed();
|
|
115
126
|
break;
|
|
@@ -132,21 +143,13 @@ export function createTerminal() {
|
|
|
132
143
|
break;
|
|
133
144
|
}
|
|
134
145
|
case "captureProgress": {
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const ui = drawOn(event.chat);
|
|
139
|
-
if (ui === undefined)
|
|
140
|
-
break;
|
|
141
|
-
view = captureProgress(ui);
|
|
142
|
-
captures.set(key, view);
|
|
143
|
-
}
|
|
144
|
-
view.update(event.status);
|
|
146
|
+
const ui = drawOn(event.chat);
|
|
147
|
+
if (ui !== undefined)
|
|
148
|
+
captureProgress(ui, event.progress);
|
|
145
149
|
break;
|
|
146
150
|
}
|
|
147
|
-
case "
|
|
148
|
-
|
|
149
|
-
captures.delete(event.chat ?? "");
|
|
151
|
+
case "captureDone":
|
|
152
|
+
void openCaptured(event.chat, event.plainDir, event.summary);
|
|
150
153
|
break;
|
|
151
154
|
case "outOfReach":
|
|
152
155
|
showOutOfReach(event.chat, event.outOfReach);
|
|
@@ -226,7 +229,8 @@ export function createTerminal() {
|
|
|
226
229
|
});
|
|
227
230
|
terminal.frontend = {
|
|
228
231
|
surface: TERMINAL_SURFACE,
|
|
229
|
-
// In every chat, after turri's own: the entries drawn, the banner, the side panel's key, /notifications
|
|
232
|
+
// In every chat, after turri's own: the entries drawn, the banner, the side panel's key, /notifications, /chat and
|
|
233
|
+
// capture_progress's calls, drawn as a line where they say something new.
|
|
230
234
|
extensions: [
|
|
231
235
|
(pi) => {
|
|
232
236
|
registerEntries(pi);
|
|
@@ -234,6 +238,7 @@ export function createTerminal() {
|
|
|
234
238
|
registerPanelKey(pi, terminal.panel);
|
|
235
239
|
registerNotifications(pi, terminal.panel);
|
|
236
240
|
registerChats(pi, terminal);
|
|
241
|
+
registerCaptureProgressCalls(pi);
|
|
237
242
|
},
|
|
238
243
|
],
|
|
239
244
|
// A question of no chat's - a skill run's, a start over - is put in the chat shown.
|
|
@@ -252,20 +257,6 @@ export function createTerminal() {
|
|
|
252
257
|
terminal.panel.open(ui, target.kind === "map" ? "map" : "pulses");
|
|
253
258
|
return true;
|
|
254
259
|
},
|
|
255
|
-
// A capture wrote a project of its own: turri closes here and opens again there - `turri` started this chat, and the
|
|
256
|
-
// person agrees - where the capture's report is told.
|
|
257
|
-
async openProject(dir, { summary }) {
|
|
258
|
-
const ui = drawOn(undefined);
|
|
259
|
-
if (!canReopen() || terminal.leave === undefined || ui === undefined)
|
|
260
|
-
return false;
|
|
261
|
-
const question = captureOpenQuestion(process.cwd(), dir, summary);
|
|
262
|
-
if (!(await ui.confirm(question.title, question.message)))
|
|
263
|
-
return false;
|
|
264
|
-
if (!reopenIn(dir, { env: capturedEnv(summary) }))
|
|
265
|
-
return false;
|
|
266
|
-
terminal.leave();
|
|
267
|
-
return true;
|
|
268
|
-
},
|
|
269
260
|
openPiSettings,
|
|
270
261
|
// The terminal shows these itself: a pulse's end in the chat and the inbox, notices in the inbox - answered there -
|
|
271
262
|
// and the spec map in regen.
|
package/docs/README.md
CHANGED
|
@@ -49,7 +49,7 @@ turri is the first coding agent with the power of regenerative software: [\*\*\*
|
|
|
49
49
|
| [A Claude subscription](claude-subscription.md) | running every agent on a Claude Pro, Max or Team subscription through Claude Code: setting it up, its models, checking it yourself, in turri-desktop, its limits, when it does not work |
|
|
50
50
|
| [The project config](config.md) | `config.turri.yaml` and a module's own `config.turri.<module>.yaml`: where they are read from, every key, models and their inheritance, conformance, the testing scripts, which file builds a module, the old `config.yaml` |
|
|
51
51
|
| [Launch](launch.md) | trying what is built: the launch track, a commit in dist/<module>, starting it on your machine, after every pulse, `turri launch` |
|
|
52
|
-
| [Capture](capture.md) | an existing codebase captured into \*\*\*plain
|
|
52
|
+
| [Capture](capture.md) | an existing codebase, whole, captured into \*\*\*plain by the chat's agent with sub-agents: the steps, explore, how it scales, what it writes, going on |
|
|
53
53
|
| [Running unattended](headless.md) | regenerating overnight or in CI: before you leave it, the command, the results, resuming, rebuilding one functionality |
|
|
54
54
|
| [Authoring \*\*\*plain](authoring-plain.md) | a \*\*\*plain project, what \*\*\*plain is made of, the rules, writing \*\*\*plain with the agent, the skills, checking \*\*\*plain |
|
|
55
55
|
| [Regenerating](regenerating.md) | where things go, one job, a whole module and how its work is cut into jobs, each job's cases, \*\*\*plain changes, conformance tests, the two records of what is built |
|
package/docs/capture.md
CHANGED
|
@@ -1,227 +1,153 @@
|
|
|
1
1
|
# Capture
|
|
2
2
|
|
|
3
|
-
Capture takes an existing codebase and
|
|
3
|
+
Capture takes an existing codebase - the whole of it - and writes down what it does as \*\*\*plain, in a project of its own. From then on you work on the \*\*\*plain: the code is regenerated from it, and the original codebase is abandoned.
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
cd ~/my-app
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
cd ~/my-app && turri
|
|
7
|
+
/capture # in the chat: this folder, into ./plain
|
|
8
|
+
/capture ../other-app --into ../other-plain
|
|
9
|
+
|
|
10
|
+
turri capture [path] [--into <folder>] # unattended: nobody is asked, and turri exits as the capture ends
|
|
9
11
|
```
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
The chat's own agent does the capture, there in the chat, from a map of the code that turri makes with no model. turri tells it what must hold and when it is done; how it gets there is its own - a small codebase it reads and writes itself, a large one it may plan from the map and hand to writers, sub-agents side by side. Only you start it - the chat can tell you about it, but cannot run it - since a capture turns conformance tests on in the project it writes. `turri capture` is the same command run unattended: turri in pi's print mode, `turri -p "/capture [path]"`, which asks nobody and waits for the agent to end.
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
## How it works
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
capture · 0s · compact capture: 10/64 source, test and contract files, 305/4000 lines, 0/24 mapped interface entries - within all three limits
|
|
17
|
-
capture · 1s · survey · plan: I’ll trace the calculator’s commands and check how its tests exercise them.
|
|
18
|
-
capture · 14s · $0.08 · survey: Both arithmetic commands reject invalid arguments before computing a result.
|
|
19
|
-
capture · 14s · $0.08 · surveyed: calc-cli
|
|
20
|
-
capture · 1m 12s · $0.42 · captured calc-cli in one pass: 3 functional specs
|
|
21
|
-
```
|
|
17
|
+
The harness does what needs no model, then hands the work to the agent (`src/capture/`):
|
|
22
18
|
|
|
23
|
-
|
|
19
|
+
1. **The checks.** The path must be a folder, and the folder the \*\*\*plain goes into - `<path>/plain`, or `--into` - must be new, empty, or a capture started before. A config in use that does not parse stops it, since the captured project starts as that config.
|
|
20
|
+
2. **The project.** `config.turri.yaml` is written once: the config in use where the capture was started - your models, thinking, reviews, limits - without what was that project's own (its `module`, testing scripts, `base-folder` and `test-dir`) and without what turri does not read - a key it no longer has dropped, an old name of a renamed key written under its new one - with `conformance-tests: true` and the models the session was opened with. With no config in use, `init-config`'s. A `.gitignore` keeps the regenerated code's histories out.
|
|
21
|
+
3. **The map** (`map.ts`), in a second or two even for a hundred thousand lines. Every file of the codebase - what git sees, in a repo; every file but dependencies, caches and turri's own elsewhere - is sorted into code, tests and the rest. Each code file is parsed with [Tree-sitter](#the-map): its definitions, each with its header and lines; the code files it uses, from its imports resolved as its language would; and the tests that use it. Then the code in the order it is built - each file after the files it uses - cut into slices of about 1,000 lines for writers. How many modules and functional specs capture it, the map does not say: that is the agent's to judge. It is written to `plain/.turri/capture/map.md`, and as data to `map.json`.
|
|
22
|
+
4. **The brief.** The chat's agent is told what to capture into where, what must hold, the level the \*\*\*plain is written at, the map's summary, what it has, ways that work, and when it is done (`genome/prompts/capture/capture.md`). It is told hints, never steps: what it reads, in what order, what it plans and keeps on disk, and whether it has help are its own.
|
|
24
23
|
|
|
25
|
-
|
|
26
|
-
capture shorty ✓ survey ━ ✓ outline ━ ⠋ features ─ ○ concepts ─ ○ readability ─ ○ interface ─ ○ trial ─ ○ scripts phase 3 of 8
|
|
27
|
-
██████████▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 1 of 3 features captured, 2 at work · 2m 10s · $0.84
|
|
28
|
-
feature shorty#shorten-link 40s ○ read app/api/links.py · thinking
|
|
29
|
-
feature shorty#follow-link 15s ○ read app/repositories/sqlite.py · waiting for the model
|
|
30
|
-
captured shorty#service-info: 1 functional spec
|
|
31
|
-
```
|
|
24
|
+
What must hold:
|
|
32
25
|
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
26
|
+
- The codebase is read, never written: the agent writes only in the captured project.
|
|
27
|
+
- The \*\*\*plain says what the code does now - not what it should, nor what its docs claim. Every fact comes from the code, its tests or running it; behaviour that looks wrong is captured as it is, and said in the report.
|
|
28
|
+
- Every \*\*\*plain rule holds: the chat and every sub-agent have them all in their system prompts.
|
|
29
|
+
- The testing scripts are written in the background while the agent captures, never waited for: as soon as the first module parses - it writes that one first - it starts both skills with `cultivate`, `implement-unit-testing-script` and `implement-conformance-testing-script` side by side, for that module - `cultivate` runs a skill for a module of another project in that project, so each writes its script there and names it in that project's config - and goes on. A part on a stack of its own has its own `config.turri.<module>.yaml` and its own scripts, started as its first module parses. They are no phase of its plan.
|
|
37
30
|
|
|
38
|
-
|
|
31
|
+
**The level**, where captures most often go wrong: the \*\*\*plain is the software as its users see it - what goes in and comes out, the interface, outputs, messages, errors, the state it keeps. It never names a private function, an internal class or its fields, or the algorithm or library the code happens to use, unless the interface shows it - what callers call or import, what the original's tests use, what an output depends on: a functional spec another implementation with the same interface would fail says too much. It is far shorter than the code - what an operation achieves, not each step it takes - and exact where the interface is.
|
|
39
32
|
|
|
40
|
-
|
|
33
|
+
What it has: the map, `map.md`, to plan from without reading every file and to check the \*\*\*plain against; the working folder, `plain/.turri/capture/`, for whatever it keeps - the chat's conversation is summed up as it grows, and what is on disk is what is kept; `subagent`, for helpers and writers side by side ([sub-agents](#sub-agents)); `capture_coverage` ([coverage](#coverage)); `parse`; `cultivate`, for the testing scripts; and `submit_capture`, to end it ([how it ends](#how-it-ends)).
|
|
41
34
|
|
|
42
|
-
|
|
35
|
+
**Ways that work** - hints, not steps, like a skill's: the agent takes what helps the codebase and leaves the rest.
|
|
43
36
|
|
|
44
|
-
|
|
37
|
+
- Define the modules first, from the map's build order: each module's code, what it builds on and the concepts it introduces, the whole interface with the module that captures each entry point, and what is left out.
|
|
38
|
+
- Keep helper notes in the working folder: the plan, decisions, the original's tests each with what covers it, what it was unsure of.
|
|
39
|
+
- Read a small codebase whole, several files a call; a large one module by module, from the map.
|
|
40
|
+
- Pin the interface early - a linked resource listing it exactly - and the import modules; then the modules, in build order.
|
|
41
|
+
- Hand a sub-agent a subtask that would cost time or context: studying the original's tests, an edge case of the code, code the map could not parse, checking a module's scenarios against the original - several side by side while the chat goes on.
|
|
42
|
+
- Writers, for a codebase too large to read and hold whole - most past some ten thousand lines of code: a sub-agent for each slice of the map, about 1,000 lines of code - small, so its conversation stays small, since every call reads it all again - all started in one turn, each writing in a folder of the working folder and returning what it wrote. The chat tells each the level, the modules its code goes into, the interface they cover and what the modules before them define, reads what each returns against the whole before it lands - a concept defined once, behaviour specified once - and copies it in, editing what does not fit, never typing it out again. Below that size, writers cost more time than they save: each spends minutes getting to know its part, and sees only that part.
|
|
43
|
+
- Check scenarios in batches, never one at a time - past a few modules, by sub-agents side by side, each a few modules' scenarios on its copy - and each check written once, as the scenario, never again in a harness.
|
|
44
|
+
- Review the work with sub-agents only when the capture is too large to hold; a small one is checked as it is written.
|
|
45
|
+
- Send the tool calls that do not wait on each other in one turn: they run side by side, and every turn waits for the model to start answering.
|
|
45
46
|
|
|
46
|
-
|
|
47
|
+
It is done when:
|
|
47
48
|
|
|
48
|
-
**
|
|
49
|
+
1. **The modules**, each one concern, require each other in a chain - each builds only on what is before it, the code that runs everything last - and the stack, the conventions and the shared concepts are import modules in `plain/template`, each defined once.
|
|
50
|
+
2. **What the software needs that is not code** - prompts, templates, assets, data, anything it reads as it runs - is copied, at the paths it has, into `plain/base`, named `base-folder: base`, so the regenerated code starts from it ([the base folder](regenerating.md#the-base-folder)); what is not the software - vendored, generated, tooling, docs - is left out.
|
|
51
|
+
3. **All the code is accounted for**: captured, or left out with why.
|
|
52
|
+
4. **Every scenario holds**: each functional spec that needs scenarios by the rules has its test plain file, and every scenario has been run on the original, as its conformance test will be, from outside through the interface.
|
|
53
|
+
5. **The interface is exact**: regenerated, the software must have the same interface - a library's every public function, class and method with its parameters, defaults, results and errors; a server's every route, method, parameter, body, header and status code; a command line's every command, argument and option, each of its names, with its default, output and exit code; a user interface's every screen and control; and for all of them environment variables, configuration files and keys, files read and written, and formats - checked against the definitions the map shows the entry points, the callers and the original's tests reach. A long exact list may be a linked resource.
|
|
54
|
+
6. **The testing scripts** are written - `submit_capture` waits for any still being written.
|
|
55
|
+
7. **Every module parses, and every config file does** - a setting changed in a line of its own, every comment line kept whole - and the report is written.
|
|
49
56
|
|
|
50
|
-
|
|
51
|
-
- **Only where the code departs from the default.** The default is the stack's conventions, the domain's conventions, and the functional specs before this one. An odd rule is written exactly; cookie-cutter behaviour takes a line or none.
|
|
52
|
-
- **Exact where exactness is the contract.** Endpoints, fields, status codes, flags and formats are captured exactly.
|
|
53
|
-
- **Edge cases go in scenarios.** A functional spec states the rule - `the url is an absolute http or https URL` - and its scenarios pin the edges with concrete values. An example, or what one wrong input answers (`nope` answers 422 `validation_error`), is a scenario's, never said again in the functional spec. How a wrong input is answered is the stack's, unless the original answers otherwise.
|
|
57
|
+
Then it calls `submit_capture`, before it tells you anything ([how it ends](#how-it-ends)).
|
|
54
58
|
|
|
55
|
-
**
|
|
59
|
+
**Attended or not.** In a chat, the agent asks you only what the code cannot tell it and what changes the capture, deciding the rest and saying it in the report. Unattended, it never asks.
|
|
56
60
|
|
|
57
|
-
|
|
61
|
+
## How far it has got
|
|
58
62
|
|
|
59
|
-
|
|
63
|
+
The agent shows you how far the capture has got with `capture_progress` (`src/capture/progress.ts`). First, from the map and before any other work of the capture, it gives its plan: the phases it will go through - planning the modules, writing them, checking the scenarios, the report - each with its share of the work, the longest the largest. Then it moves it as it goes: each phase as it starts it, how many of that phase's items are done - modules written, scenarios checked - and what it is on now. turri works out the fraction of the whole from that - the shares of the phases behind it and the done part of the one it is in - so every front end draws the same bar.
|
|
60
64
|
|
|
61
|
-
|
|
65
|
+
- **In the terminal**, above the input: the plan's phases on one line, as a skill's are drawn - the ones done ticked, the one it is in turning, the rest to come - and under it the bar, the percentage, what it is on, the count and how long it has run. The spinner stops, and the line says it waits, while the agent's turn is over - asking you something, or stopped. A call that gives a plan or starts a phase leaves a line in the transcript; the rest only move the bar.
|
|
66
|
+
- **Unattended**, `turri capture` writes a line to stderr as the plan is given, a phase starts or what it is on changes.
|
|
67
|
+
- **A host** hears it as `captureProgress` events for the chat, and draws it as it draws ([the core](core.md)); `null` once the turn that ended the capture is over.
|
|
62
68
|
|
|
63
|
-
|
|
69
|
+
The plan and the place are kept in `plain/.turri/capture/progress.json`: a capture that goes on shows where it was, and its agent says the phase it is in, giving the plan again only if it changed. A plan whose every phase was done is a finished run's and is not shown again: a capture gone on with after one starts with no plan, and its agent gives one for what is left.
|
|
64
70
|
|
|
65
|
-
|
|
71
|
+
## How it ends
|
|
66
72
|
|
|
67
|
-
|
|
68
|
-
- **Staged:** the code is outlined by area, written by feature and checked by module. `TURRI_CAPTURE_LEAF_LINES` controls splitting within this pipeline. Division runs only across multiple leaves, reconciliation only for conflicting definitions. Reference and trial work is batched and independent writers run up to `--parallel` at a time.
|
|
73
|
+
The agent ends the capture with `submit_capture`, giving the report in a few lines - before it tells you anything, so nothing it says is the end of a capture that is not done:
|
|
69
74
|
|
|
70
|
-
|
|
75
|
+
1. **It waits for the testing scripts.** The testing-script skills run in the background; while either is writing its script for the captured project, `submit_capture` waits for it to land.
|
|
76
|
+
2. **It checks what it can without a model** (`captureUnfinished` in `src/capture/capture.ts`): the report is written, and in this run - a capture gone on with after one that finished has the earlier run's there, which is not this one's; every config file of the captured project parses - read as empty otherwise, it would regenerate nothing; every module parses in its project, with no step of adding tests skipped; and the unit and conformance testing scripts are there for every module. What is not done goes back to the agent, each with what puts it right, and it calls `submit_capture` again once it has.
|
|
77
|
+
3. **Done, the agent tells you** its summary, the report's path, and that turri opened in `plain/` regenerates it.
|
|
78
|
+
4. **Every front end is told.** As that turn ends, turri sends `captureDone` - the chat, the codebase, the project, the agent's summary and this run's report - once a run, and never for a turn that ended part-way or was stopped. The terminal asks *Open turri in the newly captured \*\*\*plain project?*, yes or no; on a yes, turri closes here and opens again in `plain/`, where the first chat shows the report - its agent reading it too, so it can be asked about - and `/regenerate` builds it. On a no, `cd plain && turri` opens it later. Unattended, nothing is offered: the summary is the run's last words.
|
|
71
79
|
|
|
72
|
-
|
|
80
|
+
An agent's `write` and `edit` - the chat's, the testing-script skills' - never leave a config file that parses not parsing: such an edit is refused and the file put back ([a config that does not parse](config.md#a-config-that-does-not-parse)).
|
|
73
81
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
1. **The map** (`src/capture/map.ts`), with no model. Every file the codebase holds, read through git when it is a repo, so what git ignores is left out. Also left out: dependencies, caches, capture's own output folder, and any turri project inside the codebase (a folder with a `config.turri.yaml`, an earlier capture's among them), since its \*\*\*plain is not the code. Each file gets:
|
|
77
|
-
- its kind: source, test, doc, asset, contract, manifest
|
|
78
|
-
- its lines
|
|
79
|
-
- the surfaces patterns find in it: routes, commands, options with every name each has (`-v, --verbose`), screens, the environment variables it reads, tables and models, test names, exports. A file keeps its whole interface - seventy options are seventy - and a sample of the rest.
|
|
80
|
-
- the codebase's own files it imports
|
|
81
|
-
|
|
82
|
-
The patterns cover common frameworks:
|
|
83
|
-
- **Python:** Flask, FastAPI, Django, click, typer, argparse
|
|
84
|
-
- **JavaScript and TypeScript:** Express, Fastify, NestJS, React Router, Vue Router, file-routed Next.js and SvelteKit, commander
|
|
85
|
-
- **Go:** net/http, gin, echo, chi, cobra
|
|
86
|
-
- **Java:** Spring, picocli
|
|
87
|
-
- **Rust:** axum, actix, clap
|
|
88
|
-
- **Ruby:** Rails
|
|
89
|
-
- **SQL:** tables in schema and migration files
|
|
90
|
-
|
|
91
|
-
A file no pattern fits is still on the map, by its size.
|
|
92
|
-
2. **The survey.** One agent is shown the map of the whole codebase, folded to its budget, with the manifests, the README and the standard library's catalogue. It names the parts: software on one stack each, like a backend and a frontend. For each part it gives:
|
|
93
|
-
- the stack - a `stdlib/` template only when the original agrees with it, otherwise written out as implementation reqs
|
|
94
|
-
- its conventions: what every feature does the same way and a user or a script relies on - how an error is written, the exit code or status of each kind of failure, what changes without a terminal. For software that talks to other software, also what reaches the other side on every call, whichever feature makes it: the headers it adds of its own, how bodies and header values are encoded - JSON's separators, non-ASCII escaped or not, the charset - and when a body is sent or read whole, streamed, or not read at all. No feature's writer looks at the wire. Each is settled from the code that does it, never from a declaration or a framework's default, and names the files that decide it. They go into the part's import module as implementation reqs, and every feature's agent is handed them as settled, so no two features decide an exit code differently.
|
|
95
|
-
- how its black-box tests run, from the original's own tests and the harness they run under: what standard input is, the environment, the servers they start - a conformance test run otherwise tests another program. Then what every test sets up so the software acts the same on every run and machine: what it fetches or checks on its own (an update check, telemetry) off or pointed at a local stand-in; a home and a configuration folder of the test's own; the terminal width fixed (`COLUMNS`) where its output wraps; a pseudo-terminal where it prompts on one; local servers, never the internet
|
|
96
|
-
- its core concepts
|
|
97
|
-
|
|
98
|
-
It also names what is not the software (vendored, generated, tooling). It may never leave out the original's tests, which are the evidence of what the software does.
|
|
99
|
-
3. **The conventions checked.** Before any writer is given them, an agent per part checks each convention against the code it names - the entry point, where errors are caught, written and exited, where a request is built and sent or a response written - and corrects what does not hold, saying why. Every feature follows them, so one that is wrong is wrong everywhere. A check that never holds leaves them as surveyed, and the report says so.
|
|
100
|
-
4. **The interface reference.** The interface is taken from the code as data, before any feature is outlined (`src/capture/interface.ts`, `genome/capture/reference.md`). The files where the map found it are given to agents, up to 4000 lines and 12 files each, and each agent lists every command, argument, option, route and environment variable they define - and any the map missed - as entries: the name exactly as the code has it, every other name, the command it belongs to, what it takes, its choices, its default, whether it repeats, is required or is hidden, its help word for word, a route's parameters, fields and statuses, and where it is defined. The harness checks each entry against the code with no model (`referenceProblems`): its `where` is a line of a file of the map, and every literal it gives - each name, alias, choice, default and the start of its help - is in that file or in the files it names as where one is worked out. A literal the code does not have sends the entry back, and so does any surface the map found in the files that is neither listed nor excluded with why. Then a fresh agent checks it against the code, as the conventions are - what checking literals cannot see: a help text cut to its first line, choices left out or worked out when the program runs, an environment variable read through a constant - and corrects or adds each, citing the line that shows it, its answer checked again as the first was; what it changed is in the report, to read first: a checker can be wrong too. The entries become the part's interface reference, `resources/interface/<part>.md`, linked from the part's interface concept, defined in what every module of the part imports: every functional spec that uses it carries the reference, whole, to its coding and conformance agents. A part none of whose entries held has no reference, and its writers work from the map, as do those of files whose agent never held.
|
|
101
|
-
5. **The split.** An area of more than 6000 lines (`TURRI_CAPTURE_LEAF_LINES`) goes to an agent that splits it into smaller areas by what they do. Each smaller area that is still too large is split again, so depth grows only slowly with size. The harness puts the areas in the order of their code: an area whose files import another's comes after it. The modules are gathered by concern and put in the order their behaviour is built in once the features are written (step 10).
|
|
102
|
-
6. **The outline.** An area that fits is outlined by one agent into features, in build order. Each feature is something a user can do, with the files where it is built. The agent sees the stack's templates too: infrastructure they settle - settings, logging, error bodies, middleware - is no feature, and is left out as settled by the stack, unless a user would notice the original does it differently.
|
|
103
|
-
7. **The features divided.** Once every area of a part is outlined, one agent sees all its features, area by area, with what each is about and where it is built, and gives each behaviour to one feature. The outlines are made area by area from each area's own files, so the same behaviour can be outlined twice - an option parsed in one area and acted on in another, a message printed in a third - and written twice it reads twice, in different words, and contradicts itself. Each feature that stays gets a line of what it alone owns; a feature that is a slice of another's behaviour is merged into it, its files the other's, and not written. A part outlined as one area is not divided: one agent saw all of it. A division that never holds leaves each feature owning what it was outlined for.
|
|
104
|
-
8. **The features, side by side.** One agent per feature, up to `--parallel` (8 by default) at once. Each is given the full text of the `stdlib/` templates its part is built on - the stack, its kind's `common`, its language's - as the default it never restates, the part's conventions, every feature of the part with what it owns, and the reference's entries in its feature's files, with what the map found there that the reference does not list: it captures what each piece its feature owns does, by its exact name, using the part's interface concept - what one takes, its choices, its default and its help left to the reference, said only where a behaviour turns on them and never otherwise - and never another feature's behaviour, even where its code or tests touch it. Each follows the feature's surfaces through the code, reads the original's tests of it, then writes:
|
|
105
|
-
- at most 8 functional specs
|
|
106
|
-
- the concepts they need beyond the part's
|
|
107
|
-
- its scenarios, mimicking the original's black-box tests - a test that runs the software through its interface, in its own process or the test's - and spent where those are densest: a functional spec the original tests twenty ways gets several, error cases no larger share than the original gives them. Where the original has no test of a spec, it gets scenarios only when it can fail silently, can be read two ways, or is costly when wrong. A feature may have 8 scenarios, and one more for every 50 lines of the original's tests in its files, up to 30; its agent is shown those test files, their lines and their tests' names. Each scenario expects what the original does under the test reqs: output that is not a terminal unless they give one, a local server rather than the internet - never a unit test that mocks a library, recast.
|
|
108
|
-
9. **The interface no feature captured.** Once every feature is written, the harness matches the interface - the reference's entries, and what the map found in the parts' files that the reference neither lists nor excludes - against the \*\*\*plain: an option, command or variable as a word of its own, a route by its path under any prefix, its parameters written any way. What no feature names goes to a writer of its own, as a feature added to the area whose files define it, up to 30 surfaces a writer. It captures each exactly - or, for one that is not the software's interface, such as a development script's option, names it in `dropped` with why - and is sent back until every one is settled. A capture leaves no interface out by accident.
|
|
109
|
-
10. **The modules, by concern and in build order** (`genome/capture/modules.md`). A module is a concern of its own - what a person looks for in one file: request sending, output formatting, sessions, downloads. One module that holds everything is as hard to read as the code, and every change to it regenerates all of it. The code's areas are gathered into modules by size alone (see [modules](#what-it-writes)), so a small codebase's every concern can land in one. And a module is built on the code of the modules before it, its scenarios run as soon as it is built, with nothing after it there - yet the areas are in the order of their code's imports, which is not the order behaviour is built in: the code that runs everything imports everything - httpie's request sending imports its output formatting and its sessions - so output formatting's scenarios, which send a request and print the answer, could not pass before it. So for each part of more than one feature, an agent is shown every feature, area by area, with what it owns, its functional specs and scenarios, and the modules as the areas make them, and gathers the features into modules by concern - a feature with another only when it is part of that concern, a concern past about 40 functional specs two modules - and puts them in the order they are built, naming for each the modules before it that its functional specs build on and its scenarios run. A scenario that needs a module after its own whatever the order - two modules each needing the other - is rewritten to check the same with only those before it, never merged away. The harness checks that every feature is in one module, that one module never holds a part larger than a module, that none holds more than twice that, and that each module needs only those before it. It runs once, before anything is done module by module; an answer that never holds leaves the modules as the areas make them, in the order of their code, and the report says so.
|
|
110
|
-
11. **Concepts reconciled.** A concept two features defined in different words is given one definition by an agent that sees the definitions and the specs that use it.
|
|
111
|
-
12. **The readability pass.** For each module, an agent reads its \*\*\*plain - each functional spec with its scenarios - and the stack's templates, never the code. It rewrites the functional specs that read as code, or restate the stack, an earlier spec, or a case one of their scenarios pins. It must keep every fact the stack and the scenarios do not keep - every interface fact, however obvious - and may never make a spec longer. Like the unit review, it improves; it is not a gate.
|
|
112
|
-
13. **The interface checked against the code.** For each module, an agent is given its \*\*\*plain - functional specs with their scenarios - the reference's entries in its features' files, and the options the \*\*\*plain names that the reference does not have, found mechanically, and checks every interface fact against the reference and the code that decides it: each option's names, value, choices and default; each route's method, path, fields and status codes; each message, format and exit code. It corrects what is wrong or left out, a functional spec's text or a scenario's, citing the code - over the readability pass, which never sees the code. A correction that never holds is not made.
|
|
113
|
-
14. **The scenarios tried on the original** (`src/capture/trial.ts`, `genome/capture/trial.md`). Every agent before this one read the original and never ran it, so a scenario can expect a terminal its test will not give, a site on the internet, output wrapped at a width nobody set, or a message the original never prints. For each module, a copy of the original - the files the map has, so none of its installed dependencies, nor turri's own config files, and the lock files beside its manifests, so it installs what the original pins - is made under `.turri/capture/trial/<module>/`, and agents with a shell on it, 20 scenarios each, one after another, install the original there and run each scenario as its conformance test will: from outside, through its interface, under the part's test reqs and its stack's conformance template. Their shell is a coding agent's - the command check, a home, temporary folder and package caches of its own, the OS sandbox and the audit - fenced to the copy. Each scenario comes back `held`, with what was run and what the original answered; `corrected` to what the original does, keeping what it checks - a local server for a site on the internet, the option that forces colour where the test's output is no terminal; `removed`, when nothing outside can check it; or `untried`, with why, when the original would not run here - kept as written. A functional spec the original contradicts is corrected with its scenario, and what every test must set up for the original to act as the scenarios say - `COLUMNS`, a configuration folder of its own, an update check off - joins the part's test reqs. What only some scenarios need - a file one sends, a server answering one exact body, a pseudo-terminal for one prompt - is never a test req, which every conformance test of every module is written under: those scenarios are corrected to say it themselves, and a test req that names a scenario or a functional spec is sent back. The harness checks that every scenario has one result and that each held or corrected one says what was run. The copy is removed once the module's agents are done. An agent that never holds leaves its scenarios as written, and the report says so.
|
|
114
|
-
15. **The files.** The modules, their scenarios, the interface references and the config are written, once.
|
|
115
|
-
16. **The testing scripts.** Capture first checks whether a reusable runner fits the surveyed setup. A single Python part with `requirements.txt` and ordinary pytest discovery can use the stock unit runner. Its external suite can use pytest or Bats, including a helper's build-folder and interpreter variables. For a standard installable `pyproject.toml` package, the pytest runner installs the staged package in its own venv so imports and console entry points work. It recognises the manifest's Black/isort/flake8/mypy toolset and `dev` extra. A custom invocation, installation or service setup still needs a writer. Reused scripts are copied into the project and named in its config without a model call. For each unmatched kind, `implement-unit-testing-script` or `implement-conformance-testing-script` writes the runner on the writing tier. The report says which runner was used, or why one could not be written.
|
|
116
|
-
17. **The check and the report.** The parser checks every module.
|
|
117
|
-
|
|
118
|
-
The harness checks every answer before keeping it, and sends it back with what is wrong, twice at most (`src/capture/checks.ts`). It checks:
|
|
119
|
-
- paths that are not in the codebase
|
|
120
|
-
- a convention that names no file deciding it
|
|
121
|
-
- ids that are not kebab-case
|
|
122
|
-
- concepts used and never defined
|
|
123
|
-
- a feature over its budget: functional specs, and scenarios past what the original's tests give it
|
|
124
|
-
- a line the parser would read as a heading
|
|
125
|
-
- a link, such as `<https://...>`: the parser refuses any link but one to a file of the project, so a URL is written as code
|
|
126
|
-
- a split that leaves files nowhere
|
|
127
|
-
- a division that leaves a feature with no owner, or merges one into itself, into nothing or into one merged too
|
|
128
|
-
- an entry of the interface reference with a literal the code it cites does not have, or a surface of the map neither listed nor excluded
|
|
129
|
-
- a writer of the interface no feature captured that leaves a surface neither captured nor dropped with why
|
|
130
|
-
- modules that leave a feature out or hold it twice, one module holding a part too large for one, or a module before one it needs
|
|
131
|
-
- a correction to a functional spec or scenario that is not there, or with no why
|
|
132
|
-
- a trial that leaves a scenario it was given with no result, says a scenario held or is corrected without saying what it ran against the original, or adds a test req that names a scenario or a functional spec - one scenario's setup, which its own text says
|
|
133
|
-
|
|
134
|
-
An answer that never holds does not stop the capture:
|
|
135
|
-
- **A split** falls back to an outline of the whole area.
|
|
136
|
-
- **A division** leaves each feature owning what it was outlined for.
|
|
137
|
-
- **An outline or a feature** is left uncaptured, and the report says so - a writer of the interface too, its surfaces then counted in the summary.
|
|
138
|
-
- **The modules by concern** stay as the code's areas make them, in the order of their code.
|
|
139
|
-
- **The conventions check, an interface correction or a trial** leaves what was there.
|
|
140
|
-
|
|
141
|
-
Only a survey that never holds stops the capture, before anything is written.
|
|
82
|
+
## The map
|
|
142
83
|
|
|
143
|
-
|
|
84
|
+
`mapCodebase` (`src/capture/map.ts`) parses with [Tree-sitter](https://tree-sitter.github.io), through `@vscode/tree-sitter-wasm`: its runtime and grammars are WebAssembly, the same on Linux, macOS and Windows, and loaded only when a map is made. It reads Python, JavaScript, TypeScript and TSX, Go, Java, C#, Rust, Ruby, PHP, C and C++, Bash and PowerShell.
|
|
85
|
+
|
|
86
|
+
- **Code, tests, the rest.** A file under a test folder, or named like a test and holding one, is a test; a file named like a test with none in it is code (`test_plain_file.py` may parse test plain files). Code is what a grammar reads, or what is in a language known as code; the rest is listed by folder for the agent to sort.
|
|
87
|
+
- **Definitions**: functions, classes, methods, interfaces, types - each with its lines and its header, the text up to its body. Members are named after their container, `Greeter.hello`; what is defined inside a function is its own.
|
|
88
|
+
- **What uses what.** An import is resolved as its language does: a relative path from the importing file, a Python module - `from pkg import loaders` naming the module before the package - a Rust or PHP path, a Go package's folder; an import of a library links nothing. In Python, JavaScript and TypeScript, whose files import everything they use from the codebase, only imports link files; elsewhere - a Go or Java package, Ruby, C - so do the names a file calls, makes and extends, when no more than three files define them and they are not too common to tell apart.
|
|
89
|
+
- **The build order.** Files that use each other in a loop are kept together, ordered by how few of the others each uses, and said; then each file after the files it uses, reached from what nothing uses. A loop of more than half the code in ten files or more is a knot: the brief has the agent order those by the software's entry points instead.
|
|
90
|
+
- **Slices.** The order is cut into slices of about 1,000 lines of code, at file boundaries - small, so writers, eight at a time, finish together soon - for when the agent has writers. The map gives no number of modules or functional specs: how the code is cut into those is the agent's.
|
|
91
|
+
|
|
92
|
+
It is a hint, never a gate: a call made by name at runtime or through a framework is not in it. A file no grammar reads, one too large or minified, or one that will not read is listed as not parsed, for the agent to read itself or have a sub-agent read; one with syntax errors is read around them, the lines it could not parse listed. Line counts and the coverage check need no parsing, so a codebase in bad shape is planned all the same - from reading where the map is thin.
|
|
93
|
+
|
|
94
|
+
## Coverage
|
|
95
|
+
|
|
96
|
+
`capture_coverage` is the chat's check, by code, that nothing of the codebase is silently dropped. From `map.json` it says what code no working file names yet: every `path` and `path:start-end` in a Markdown file of the working folder - a plan, the code beside the functional specs that capture it, what is left out, a writer's copy's paths too - counts; by default every such file but the map, or the files and folders `files` names - the writers' folders, to see what they captured rather than what was planned. What is not yet named is listed by definition, `src/greet.py: bye (5-6)`, or - in a file with none - by its stretches of lines.
|
|
144
97
|
|
|
145
|
-
|
|
98
|
+
## Sub-agents
|
|
99
|
+
|
|
100
|
+
`subagent` is the chat's tool for its writers and helpers (`src/capture/subagent.ts`). It starts a sub-agent - on the chat's own model and thinking, with every \*\*\*plain rule in its system prompt - on a part of a codebase. It knows nothing but the task the chat writes for it, and returns what that task asks for through `submit_subagent_result`: facts about the code, with the file and line behind each, or \*\*\*plain it wrote. The result comes back as the tool's result, and is saved to `result_file` when one is given.
|
|
101
|
+
|
|
102
|
+
- **It reads its folders, and writes only in `writes`** - a folder the chat names, where it writes \*\*\*plain or other files its task asks for; without one it writes nothing. Its file tools are fenced to those folders, with no shell.
|
|
103
|
+
- **With `shell`**, it works in a copy of the first folder instead - the files the map lists, lock files among them, no turri project - made in the temporary folder - outside every project, so a tool that looks up the folders for a manifest finds the copy's, never the original's - and removed when it ends. It installs and runs the code and its tests there, behind every wall a coding agent's shell has ([the sandbox](sandbox.md)); the original is never written.
|
|
104
|
+
- **Side by side.** pi runs the calls of one turn at once: several sub-agents work together, eight at most at a time, the rest waiting for one to end.
|
|
105
|
+
- **Its turns** have at least ten minutes, and it is compacted between them; one that ends a turn without its result is told to go on, a few times.
|
|
106
|
+
|
|
107
|
+
`subagent` is the chat's in any project, not only in a capture: to study a codebase before writing \*\*\*plain for it, to write it, or to check what was written against the code.
|
|
108
|
+
|
|
109
|
+
## How it scales
|
|
110
|
+
|
|
111
|
+
Linearly in the lines of code. The map is code, and takes seconds; past what the chat holds whole, it plans from the map rather than reading the code, the writing - what grows with the code - is writers', a slice of about 1,000 lines each, eight at a time, and the chat reads what they return, editing what does not fit, never typing it out again. What it knows is in its working files, not its conversation: a capture of a hundred thousand lines is more slices and more modules, not a longer context. Below that, writers would only cost time, and the chat does it alone.
|
|
112
|
+
|
|
113
|
+
## What it writes
|
|
146
114
|
|
|
147
115
|
```
|
|
148
116
|
my-app/
|
|
149
117
|
... the original - read only, never written
|
|
150
118
|
plain/
|
|
151
|
-
config.turri.yaml the config in use where the capture was started, conformance-tests: true
|
|
152
|
-
config.turri.<m>.yaml
|
|
153
|
-
|
|
154
|
-
|
|
119
|
+
config.turri.yaml the config in use where the capture was started, conformance-tests: true
|
|
120
|
+
config.turri.<m>.yaml a part's own settings, when parts are on different stacks
|
|
121
|
+
<module>.plain ... the modules, a concern each, in the order they are built
|
|
122
|
+
template/ the import modules the modules share
|
|
155
123
|
tests/<module>/<func-id>.plain the scenarios of each functional spec that has them
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
.gitignore
|
|
160
|
-
.turri/capture/
|
|
124
|
+
resources/ linked resources: long exact lists of the interface, and the like
|
|
125
|
+
base/ what the software needs that is not code - the base folder
|
|
126
|
+
test_scripts/ the unit and conformance testing scripts
|
|
127
|
+
.gitignore
|
|
128
|
+
.turri/capture/ the working files:
|
|
129
|
+
map.md, map.json the map of the code
|
|
130
|
+
report.md the report
|
|
131
|
+
progress.json the plan and how far it has got
|
|
132
|
+
... whatever else the agent keeps: a plan, writers' folders, notes
|
|
133
|
+
.turri/ledger/ what the capture's chat did, as facts - the ledger
|
|
161
134
|
```
|
|
162
135
|
|
|
163
|
-
|
|
164
|
-
- **Feature groups.** Each module's functional specs are grouped by feature, one feature's after another's, with no comment line between them.
|
|
165
|
-
- **Concepts.** A concept stays in the module that defines it when only that module uses it. A concept used across modules goes to the part's import module, along with every concept its definition uses.
|
|
166
|
-
- **The codebase is never written to.** Capture's agents only read it - read, grep, find, ls, and no shell - but for those that try the scenarios, which run the original in a copy of it, removed once they are done.
|
|
167
|
-
- **Assets.** The assets are copied rather than linked, so the original can be deleted without breaking anything. `base-folder: assets` puts them in the first module's code before its first pulse, at the paths they had.
|
|
168
|
-
- **The config.** Capture inherits `config.turri.yaml` from the project in which the chat or `turri capture` was started. That keeps the person's models, thinking, reviews and limits. With no config to inherit, capture writes the full `turri init-config` template. A named harness model selects its vendor's pair: for example, a global Bedrock Claude harness gets Haiku low for coding. `--coding-model` overrides that choice. A custom provider with no preset keeps its named model. The capture agents use their [own three tiers](#models).
|
|
169
|
-
- **Capture-specific settings.** Capture turns on `conformance-tests` and wires up the captured project's own unit and conformance runners. The original project's script paths, `module`, `base-folder` and `test-dir` do not carry over. In the chat, the current chat model and thinking and any coding model given at startup take precedence; on the command line, `--harness-model` and `--coding-model` do. A config that does not parse stops capture before anything is written ([details](config.md#a-config-that-does-not-parse)).
|
|
170
|
-
|
|
171
|
-
## The report
|
|
172
|
-
|
|
173
|
-
`plain/.turri/capture/report.md` replaces the questions a capture never asks. It lists:
|
|
174
|
-
|
|
175
|
-
- what was written
|
|
176
|
-
- the conventions every feature follows, with the files that decide each: wrong there, wrong everywhere - and what the check against the code changed
|
|
177
|
-
- what the check of each module's interface against the code corrected, and why
|
|
178
|
-
- the scenarios tried on the original: each one corrected to what the original does, removed or not tried, with why; the functional specs corrected with them; what was added to the test reqs. The summary says how many held as written.
|
|
179
|
-
- each part's modules by concern, in the order they are built, what each needs of those before it, and the scenarios rewritten to need only those before their own
|
|
180
|
-
- the features merged into others, and why
|
|
181
|
-
- the testing scripts: where each is, or why it was not written and which skill to ask for
|
|
182
|
-
- the parser's check
|
|
183
|
-
- what could not be captured
|
|
184
|
-
- features the original's tests cover that were captured with no scenario
|
|
185
|
-
- each part's interface reference: where it is, what it holds, what was left out of it and why, and what could not be taken
|
|
186
|
-
- the interface its \*\*\*plain still names nowhere - options, commands, routes, screens, environment variables - each with why its writer dropped it, or with none when no writer settled it. Those with no why are counted in the summary: a user could call them in the original and will not find them in what is regenerated.
|
|
187
|
-
- what was left out and why
|
|
188
|
-
- every assumption
|
|
189
|
-
- what the agents were unsure of
|
|
190
|
-
- what they dropped as incidental
|
|
191
|
-
- what to do next
|
|
192
|
-
|
|
193
|
-
Its first lines are the summary the command line and the chat show. In the chat, the report comes back once the capture ends, and the chat's agent passes it on.
|
|
194
|
-
|
|
195
|
-
## Stopped, finished, run again
|
|
196
|
-
|
|
197
|
-
- **Stopped part-way.** Every answer is saved in `state.json` as it comes. Running the capture again goes on from where it was and asks no agent twice. This covers a quit, a crash, or a provider down for good.
|
|
198
|
-
- **Finished.** A finished capture is never run over. To capture again, move `plain/` out of the way.
|
|
199
|
-
- **A folder that is not a capture.** Capture refuses a `plain/` that holds anything but its own state, and `--into <folder>` names another folder.
|
|
136
|
+
**The original is left as it was.** turri keeps nothing of its own in the folder a session is opened in unless that folder is a turri project - a config file, or `plain_modules/`: no [ledger](using.md#the-ledger), no record of its chats. A chat capturing a codebase records what it does in the project it writes, from `/capture` on. Opened on a codebase that is a turri project, the session keeps its ledger there as it always does - but the capture's chat records into `plain/`.
|
|
200
137
|
|
|
201
|
-
|
|
138
|
+
**The report** says what was captured, the modules in order, their functional specs, what was left out and why, every decision, what the agent was unsure of, and what to do next.
|
|
202
139
|
|
|
203
|
-
|
|
204
|
-
| --- | --- | --- |
|
|
205
|
-
| `capture-exploration` | Gather facts from source for the public interface reference. | **Haiku, low** |
|
|
206
|
-
| `capture-analysis` | Check conventions, reference entries and the module's interface against the code, split and outline areas, divide features, and try draft scenarios against the original. | **Sonnet, low** |
|
|
207
|
-
| `capture` | Reason about the stack and requirements, write the specs, organise modules, reconcile concepts, revise the text and write custom testing scripts. | **Opus, medium** |
|
|
140
|
+
## Stopped, run again
|
|
208
141
|
|
|
209
|
-
|
|
142
|
+
A capture stopped part-way - the chat closed, turri quit, the agent ended its turn - goes on: `/capture` again on the same folder maps the code again and briefs the agent to read what is in `plain/` and its working files and go on from them, never redoing what is done. In a chat, saying "go on" does the same. To start over, move `plain/` out of the way. A `plain/` that holds anything but a capture is refused: `--into` names another folder.
|
|
210
143
|
|
|
211
|
-
|
|
212
|
-
models:
|
|
213
|
-
capture-exploration: anthropic/claude-haiku-5-5:low
|
|
214
|
-
capture-analysis: anthropic/claude-sonnet-5-5:low
|
|
215
|
-
capture: anthropic/claude-opus-5-5:medium
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
The three entries are independent, each overriding its tier's default. Headless capture resolves the same defaults without needing `init-config`; a Bedrock Claude harness uses its inference geography. A non-Claude harness keeps its configured provider models: coding for exploration and analysis, harness for writing. Capture prints the resolved models at startup, and each agent's elapsed time and cost at completion. Capture turns have ten minutes unless a role, `models.default` or `turn-limit` sets a limit; scenario trials get at least thirty minutes unless the limit is off.
|
|
144
|
+
## Models
|
|
219
145
|
|
|
220
|
-
|
|
146
|
+
The chat's agent writes the \*\*\*plain on `harness-model`, as the chat always runs, and so do its writers: a sub-agent runs on the chat's model, thinking as it does. The three capture tiers of earlier turris - `models.capture`, `capture-analysis`, `capture-exploration` - are ignored.
|
|
221
147
|
|
|
222
148
|
## After a capture
|
|
223
149
|
|
|
224
|
-
1. **Read the \*\*\*plain and the report,** in turri opened in `plain
|
|
225
|
-
2. **Regenerate,** first module first: `/regenerate`.
|
|
226
|
-
3. **Compare with the original
|
|
150
|
+
1. **Read the \*\*\*plain and the report,** in turri opened in `plain/` - the terminal asks whether to open it there as the capture ends, and its first chat shows the report. From now on the \*\*\*plain is the source of truth.
|
|
151
|
+
2. **Regenerate,** first module first: `/regenerate`. Any testing script the report says was not written, ask turri for (`implement-unit-testing-script`, `implement-conformance-testing-script`).
|
|
152
|
+
3. **Compare with the original**: its own tests, the scenarios' conformance tests, a look at what is launched. Each difference becomes a \*\*\*plain change.
|
|
227
153
|
4. **Abandon the original** once you are satisfied.
|
package/docs/chats.md
CHANGED
|
@@ -56,7 +56,7 @@ On macOS, `alt` is Option (⌥), and reaches turri only when the terminal sends
|
|
|
56
56
|
|
|
57
57
|
`turri --continue` (`-c`) opens every chat of the last session here again, in their order - the first of yours shown, the others beside it, the sentinel among them. A plain `turri` starts with one fresh chat and deletes nothing: the chats of the sessions before stay on disk, and `--continue` opens the most recent one's - the last session that recorded a chat.
|
|
58
58
|
|
|
59
|
-
turri records which chats are open in `.turri/chats.json` - a run a session, each chat with its title and [pi](https://pi.dev)'s saved conversation - and keeps
|
|
59
|
+
turri records which chats are open in `.turri/chats.json` - a run a session, each chat with its title and [pi](https://pi.dev)'s saved conversation - in a turri project only: a folder that is not one, such as a codebase turri was opened on to capture it, is left as it was, and `turri --continue` there reopens nothing. It keeps the record from piling up:
|
|
60
60
|
|
|
61
61
|
- **a chat closed** is gone: out of the record, its conversation deleted - it cannot be resumed;
|
|
62
62
|
- **a chat nothing was said in** is never recorded;
|