@turri-dev/cli 0.1.3-next.f74e98a → 0.1.3
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/dist/extension.js +42 -12
- package/dist/pi-launch.js +5 -0
- package/dist/question-dialog.js +8 -3
- package/dist/questioning.js +1 -1
- package/dist/regenerate/activity.js +2 -0
- package/dist/regenerate/conform.js +5 -5
- package/dist/regenerate/conformance-agents.js +28 -8
- package/dist/regenerate/conformance.js +24 -10
- package/dist/regenerate/loop.js +22 -4
- package/dist/regenerate/notes.js +66 -17
- package/dist/regenerate/prompt.js +3 -1
- package/dist/regenerate/regenerate.js +12 -8
- package/dist/regenerate/regression.js +2 -1
- package/dist/regenerate/requires.js +55 -2
- package/dist/regenerate/unit-review.js +11 -0
- package/dist/resume-line.js +4 -0
- package/dist/spec-tools.js +8 -44
- package/docs/authoring-plain.md +9 -6
- package/docs/regenerating.md +27 -13
- package/docs/skills-and-gates.md +2 -2
- package/genome/skills/bud/SKILL.md +67 -36
- package/genome/skills/bud/references/intent.md +4 -0
- package/package.json +3 -3
- package/genome/skills/bud/references/checklist.md +0 -44
|
@@ -14,7 +14,7 @@ import { buildSpecDiffPrompt, describeSpecChange, reviewedSpec, sectionModules }
|
|
|
14
14
|
import { abandonWork, recordHistory, startWork } from "./lineage.js";
|
|
15
15
|
import { createWorkLedger, SUBMIT_WORK_NOTE } from "./submit-work.js";
|
|
16
16
|
import { CODER_COMPACTION } from "./compaction.js";
|
|
17
|
-
import {
|
|
17
|
+
import { gapMark, gapsSince, NOTES_TURN, notesForSession, passedOutcome, recordNote, withNotes } from "./notes.js";
|
|
18
18
|
import { createLoopWatch, createScriptTool, failureSignature, findTestScripts, projectRootFor, requireTestScripts, runUnitScript, STUCK_ROUNDS, withoutConformance, withTestingScripts, } from "./test-scripts.js";
|
|
19
19
|
import { createWebTools, WEB_TOOLS } from "./web.js";
|
|
20
20
|
import { createCanItFailTool, createMyDiffTool, selfCheckNote } from "./self-check.js";
|
|
@@ -268,8 +268,8 @@ export async function renderSpecDiff(options) {
|
|
|
268
268
|
...(options.cases !== undefined ? { cases: options.cases } : {}),
|
|
269
269
|
});
|
|
270
270
|
const digestsBefore = digestFiles(buildDir);
|
|
271
|
-
// The
|
|
272
|
-
const
|
|
271
|
+
// The spec gaps its agents report from here on are told with the result.
|
|
272
|
+
const gapsFrom = gapMark();
|
|
273
273
|
/** What the debugger found, each time it was asked: the pulse's line in the notes says it. */
|
|
274
274
|
const diagnosed = [];
|
|
275
275
|
const runs = [];
|
|
@@ -305,6 +305,7 @@ export async function renderSpecDiff(options) {
|
|
|
305
305
|
cwd: buildDir,
|
|
306
306
|
customTools: [
|
|
307
307
|
notes.tool,
|
|
308
|
+
notes.gapTool,
|
|
308
309
|
work.tool,
|
|
309
310
|
...createWebTools(),
|
|
310
311
|
createScriptTool({ kind: "unit", script: scripts.unit, run: () => runUnitScript(buildDir, scripts.unit), runs, watch: loop }),
|
|
@@ -313,7 +314,7 @@ export async function renderSpecDiff(options) {
|
|
|
313
314
|
...fence.tools,
|
|
314
315
|
createCopyResourceTool({ resources: linkedResources, dir: buildDir }),
|
|
315
316
|
],
|
|
316
|
-
tools: [...fence.names, "run_unit_tests", ...selfChecks.map((tool) => tool.name), ...services.names, "update_notes", "submit_work", "copy_resource", ...WEB_TOOLS],
|
|
317
|
+
tools: [...fence.names, "run_unit_tests", ...selfChecks.map((tool) => tool.name), ...services.names, "update_notes", "report_spec_gap", "submit_work", "copy_resource", ...WEB_TOOLS],
|
|
317
318
|
model: options.model,
|
|
318
319
|
label: `${moduleName} spec change coding agent`,
|
|
319
320
|
role: "coding",
|
|
@@ -499,6 +500,7 @@ export async function renderSpecDiff(options) {
|
|
|
499
500
|
...(options.cases !== undefined ? { cases: options.cases } : {}),
|
|
500
501
|
label: `${moduleName} spec change`,
|
|
501
502
|
...(scripts.runOn === "copy" ? { unitScript: scripts.unit } : {}),
|
|
503
|
+
testingScript: { path: relative(root, scripts.unit), content: readFileSync(scripts.unit, "utf8") },
|
|
502
504
|
model: options.judgeModel ?? modelSpec(inheritModel(configForSpec(tip.plainFile).judgeModel, modelOnly(options.model))),
|
|
503
505
|
send: async (next) => {
|
|
504
506
|
response = await ask(executor, next, options.onDelta);
|
|
@@ -541,8 +543,8 @@ export async function renderSpecDiff(options) {
|
|
|
541
543
|
testRemovals,
|
|
542
544
|
files,
|
|
543
545
|
...(steering !== undefined && steering.steers > 0 ? { steered: [...steering.notes] } : {}),
|
|
544
|
-
//
|
|
545
|
-
specGaps:
|
|
546
|
+
// A gap the agent met is the person's to decide, whether it landed or not.
|
|
547
|
+
specGaps: gapsSince(gapsFrom, [buildDir]),
|
|
546
548
|
diagnosed,
|
|
547
549
|
};
|
|
548
550
|
/** The change landed: what the code is built from is now the spec with the change in, committed with it. */
|
|
@@ -579,8 +581,10 @@ export function specGapsText(gaps) {
|
|
|
579
581
|
return [];
|
|
580
582
|
return [
|
|
581
583
|
"",
|
|
582
|
-
"Spec gaps its agents met - the spec does not say, so they decided
|
|
583
|
-
|
|
584
|
+
"Spec gaps its agents met - the spec does not say, so they decided, each as an assumption in the codebase's notes. Put " +
|
|
585
|
+
"each to the user, and write the ones they decide into the spec - the pulse that builds it is told the assumption " +
|
|
586
|
+
"it replaces:",
|
|
587
|
+
...gaps.map((gap) => `- ${gap.question} Meanwhile: ${gap.assumption}`),
|
|
584
588
|
];
|
|
585
589
|
}
|
|
586
590
|
/** What a rendered spec change did, for the agent and the person. */
|
|
@@ -21,7 +21,7 @@ import { keepingTestsUnchanged, listFiles } from "./testing.js";
|
|
|
21
21
|
* job ends on it: tests that pass on their own are not done until the whole suite passes with them.
|
|
22
22
|
*/
|
|
23
23
|
/** On top of the file tools, which are fenced to the build directory by `confine.ts`. */
|
|
24
|
-
const FIX_TOOLS = ["run_unit_tests", "run_conformance_tests", "update_notes"];
|
|
24
|
+
const FIX_TOOLS = ["run_unit_tests", "run_conformance_tests", "update_notes", "report_spec_gap"];
|
|
25
25
|
const DEFAULT_MAX_REGRESSION_ROUNDS = ATTEMPTS.regression;
|
|
26
26
|
/** The module's conformance tests, when there are any: the chain's, copied up, and its own. */
|
|
27
27
|
function conformanceDirs(conformanceRoot, moduleName) {
|
|
@@ -39,6 +39,7 @@ async function repairRegression(input) {
|
|
|
39
39
|
cwd: input.buildDir,
|
|
40
40
|
customTools: [
|
|
41
41
|
notes.tool,
|
|
42
|
+
notes.gapTool,
|
|
42
43
|
...createWebTools(),
|
|
43
44
|
...fence.tools,
|
|
44
45
|
createScriptTool({ kind: "unit", script: input.scripts.unit, run: () => runUnitScript(input.buildDir, input.scripts.unit), runs }),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { copyFileSync, existsSync, mkdirSync, readdirSync, rmSync } from "node:fs";
|
|
1
|
+
import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync } from "node:fs";
|
|
2
2
|
import { basename, dirname, join, resolve } from "node:path";
|
|
3
|
-
import { PLAIN_SOURCE_FILE_EXTENSION, plainFileParser, withParseCache } from "../plain/parser.js";
|
|
3
|
+
import { IMPORT_DIRECTIVE, PLAIN_SOURCE_FILE_EXTENSION, plainFileParser, readPlainSourceMetadata, withParseCache } from "../plain/parser.js";
|
|
4
4
|
import { getFrids, getInheritedFunctionalSpecs } from "../plain/spec.js";
|
|
5
5
|
import { buildDirUnder, modulesRoot, projectDirOf } from "./paths.js";
|
|
6
6
|
import { notesPath } from "./notes.js";
|
|
@@ -54,6 +54,59 @@ options = {}) {
|
|
|
54
54
|
visit(resolve(plainFile), []);
|
|
55
55
|
return chain;
|
|
56
56
|
}
|
|
57
|
+
/** The .plain files that import `plainFile` - read from beside it, and, kept in a `template/` folder, from the folder it is in. */
|
|
58
|
+
function importersOf(plainFile) {
|
|
59
|
+
const file = resolve(plainFile);
|
|
60
|
+
const dir = dirname(file);
|
|
61
|
+
const name = basename(file, PLAIN_SOURCE_FILE_EXTENSION);
|
|
62
|
+
const dirs = [dir, ...(basename(dir) === "template" ? [dirname(dir)] : [])];
|
|
63
|
+
return dirs.flatMap((at) => {
|
|
64
|
+
let names;
|
|
65
|
+
try {
|
|
66
|
+
names = readdirSync(at).filter((entry) => entry.endsWith(PLAIN_SOURCE_FILE_EXTENSION));
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return [];
|
|
70
|
+
}
|
|
71
|
+
return names
|
|
72
|
+
.map((entry) => join(at, entry))
|
|
73
|
+
.filter((path) => {
|
|
74
|
+
if (path === file || !resolveTemplateDirs(path).includes(dir))
|
|
75
|
+
return false;
|
|
76
|
+
try {
|
|
77
|
+
return (readPlainSourceMetadata(readFileSync(path, "utf8")).metadata[IMPORT_DIRECTIVE] ?? []).includes(name);
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Whether a .plain file is an import module - one a .plain file imports, or one kept in a `template/` folder - rather than
|
|
87
|
+
* a module of its own. It is no codebase: its reqs and definitions are built in the modules that import it.
|
|
88
|
+
*/
|
|
89
|
+
export function isImportModule(plainFile) {
|
|
90
|
+
return basename(dirname(resolve(plainFile))) === "template" || importersOf(plainFile).length > 0;
|
|
91
|
+
}
|
|
92
|
+
/** The modules of their own that import an import module, through any import modules between. */
|
|
93
|
+
export function importingModules(plainFile) {
|
|
94
|
+
const found = new Set();
|
|
95
|
+
const seen = new Set();
|
|
96
|
+
const walk = (file) => {
|
|
97
|
+
if (seen.has(file))
|
|
98
|
+
return;
|
|
99
|
+
seen.add(file);
|
|
100
|
+
for (const importer of importersOf(file)) {
|
|
101
|
+
if (isImportModule(importer))
|
|
102
|
+
walk(importer);
|
|
103
|
+
else
|
|
104
|
+
found.add(importer);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
walk(resolve(plainFile));
|
|
108
|
+
return [...found];
|
|
109
|
+
}
|
|
57
110
|
/**
|
|
58
111
|
* The codebase a change to `plainFile`'s module lands in: the furthest-built module whose
|
|
59
112
|
* requires chain includes it, with that chain.
|
|
@@ -63,6 +63,17 @@ export function unitReviewTask(options) {
|
|
|
63
63
|
options.spec.trim(),
|
|
64
64
|
"</specification>",
|
|
65
65
|
"",
|
|
66
|
+
...(options.testingScript !== undefined
|
|
67
|
+
? [
|
|
68
|
+
"The harness runs the unit tests with this script, and it decides whether they pass. Read it for which tests it",
|
|
69
|
+
"runs and how: a test it never reaches - a file it does not pick up, a folder it does not look in - is not run, and",
|
|
70
|
+
"checks nothing.",
|
|
71
|
+
`<unit testing script path="${options.testingScript.path}">`,
|
|
72
|
+
options.testingScript.content.trimEnd(),
|
|
73
|
+
"</unit testing script>",
|
|
74
|
+
"",
|
|
75
|
+
]
|
|
76
|
+
: []),
|
|
66
77
|
...(options.cases !== undefined ? [...codeReviewCasesBlock(options.cases), ""] : []),
|
|
67
78
|
// A job that touches no functional spec is held only to that: the checks of behaviour are not its.
|
|
68
79
|
...(mechanical ? [] : ["Check that the code does what the specification states for this work:"]),
|
package/dist/spec-tools.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { basename, dirname, join, relative, resolve } from "node:path";
|
|
1
|
+
import { basename, relative, resolve } from "node:path";
|
|
3
2
|
import { defineTool } from "@earendil-works/pi-coding-agent";
|
|
4
3
|
import { Type } from "typebox";
|
|
5
|
-
import {
|
|
4
|
+
import { plainFileParser } from "./plain/parser.js";
|
|
5
|
+
import { importingModules, isImportModule } from "./regenerate/requires.js";
|
|
6
6
|
import { resolveTemplateDirs } from "./regenerate/paths.js";
|
|
7
7
|
import { applySpecDiff, plainFilesOf, revertSpecDiff } from "./regenerate/regenerate.js";
|
|
8
8
|
import { MissingFunctionalitiesError } from "./plain/errors.js";
|
|
@@ -62,24 +62,12 @@ export function createSpecDiffTools(options) {
|
|
|
62
62
|
// file that cannot be parsed. A module with no functional specs yet is not broken. An import
|
|
63
63
|
// module - definitions only, say - is not a module of its own: it is parsed as the modules
|
|
64
64
|
// that import it read it, the one the change is built for among them.
|
|
65
|
-
const importers = (file) => {
|
|
66
|
-
const name = basename(file, ".plain");
|
|
67
|
-
const dir = dirname(resolve(cwd, file));
|
|
68
|
-
return readdirSync(dir)
|
|
69
|
-
.filter((entry) => entry.endsWith(".plain"))
|
|
70
|
-
.map((entry) => join(dir, entry))
|
|
71
|
-
.filter((path) => {
|
|
72
|
-
try {
|
|
73
|
-
return (readPlainSourceMetadata(readFileSync(path, "utf8")).metadata[IMPORT_DIRECTIVE] ?? []).includes(name);
|
|
74
|
-
}
|
|
75
|
-
catch {
|
|
76
|
-
return false;
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
const imported = importedNames(resolveTemplateDirs(resolve(cwd, params.plain_file)));
|
|
81
65
|
const toParse = [
|
|
82
|
-
...new Set([params.plain_file, ...touched].flatMap((file) =>
|
|
66
|
+
...new Set([params.plain_file, ...touched].flatMap((file) => {
|
|
67
|
+
const path = resolve(cwd, file);
|
|
68
|
+
const importing = isImportModule(path) ? importingModules(path) : [];
|
|
69
|
+
return importing.length > 0 ? importing : [path];
|
|
70
|
+
})),
|
|
83
71
|
];
|
|
84
72
|
for (const path of toParse) {
|
|
85
73
|
const file = relative(cwd, path);
|
|
@@ -129,27 +117,3 @@ export function createSpecDiffTools(options) {
|
|
|
129
117
|
},
|
|
130
118
|
};
|
|
131
119
|
}
|
|
132
|
-
/** The module names some .plain file in these folders imports: import modules, not codebases. */
|
|
133
|
-
export function importedNames(dirs) {
|
|
134
|
-
const names = new Set();
|
|
135
|
-
for (const dir of dirs) {
|
|
136
|
-
let entries;
|
|
137
|
-
try {
|
|
138
|
-
entries = readdirSync(dir).filter((name) => name.endsWith(PLAIN_SOURCE_FILE_EXTENSION));
|
|
139
|
-
}
|
|
140
|
-
catch {
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
for (const entry of entries) {
|
|
144
|
-
try {
|
|
145
|
-
const imports = readPlainSourceMetadata(readFileSync(join(dir, entry), "utf8")).metadata[IMPORT_DIRECTIVE];
|
|
146
|
-
for (const name of imports ?? [])
|
|
147
|
-
names.add(name);
|
|
148
|
-
}
|
|
149
|
-
catch {
|
|
150
|
-
// A file that does not read imports nothing.
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
return names;
|
|
155
|
-
}
|
package/docs/authoring-plain.md
CHANGED
|
@@ -196,18 +196,21 @@ the reading that fits the rest of the spec, and marks each such decision in its
|
|
|
196
196
|
code, environment and turri problems to the builds, and stops when a functionality keeps
|
|
197
197
|
struggling after the spec was clarified, when two cycles change nothing, or after twenty.
|
|
198
198
|
|
|
199
|
-
For an existing project, `bud` works the same way, scoped to one feature: intent → scope →
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
199
|
+
For an existing project, `bud` works the same way, scoped to one feature: intent → scope → product.
|
|
200
|
+
It first asks how many questions the product phase may ask - light, medium, thorough or best
|
|
201
|
+
judgement, as `brood` does - then a short feature-intent interview, then product questions - a
|
|
202
|
+
trigger and its outcome, an edge case, a rule - and every answer is a spec change, a git diff
|
|
203
|
+
written with `write_spec_diff` and built the moment it is written, before the next question. What
|
|
204
|
+
the questions leave open it decides itself, a spec change each. A change to something already
|
|
203
205
|
specified, built or still to build, is put to the user first and is a spec diff too: what is left to
|
|
204
|
-
build is worked out again from the spec.
|
|
206
|
+
build is worked out again from the spec. It ends on the person's confirmation of a short summary of
|
|
207
|
+
the feature's changes.
|
|
205
208
|
|
|
206
209
|
What keeps the interview honest is the harness, not the interviewer:
|
|
207
210
|
|
|
208
211
|
- **Every question offers choices** (`ask_user` refuses a question without them), and each
|
|
209
212
|
answer maps to one spec change.
|
|
210
|
-
- **Every answer is written before the next question.** In `brood`
|
|
213
|
+
- **Every answer is written before the next question.** In the product phase of `brood` and `bud`, `ask_user` refuses
|
|
211
214
|
a new question until the last answer is a spec change - see [skills and gates](skills-and-gates.md).
|
|
212
215
|
- **Each phase ends on the person's confirmation** of a short summary, not on the interviewer's word.
|
|
213
216
|
|
package/docs/regenerating.md
CHANGED
|
@@ -112,6 +112,10 @@ the planner's, the spec-steps agent's, the conformance agents' - is laid out in
|
|
|
112
112
|
A module that `requires` another inherits its functional specs; one that `import`s another
|
|
113
113
|
inherits its definitions, implementation reqs and test reqs.
|
|
114
114
|
|
|
115
|
+
An import module - one a `.plain` file imports, or one kept in a `template/` folder - is no codebase of its own. A
|
|
116
|
+
change to it is built in the modules that import it, through any import modules between, whose code is started; when
|
|
117
|
+
none is, nothing is built, and the change goes in with the first of them built.
|
|
118
|
+
|
|
115
119
|
Template search order: the plain file's own directory, then a sibling `template/`, then
|
|
116
120
|
`--template-dir`, then `PLAIN_TEMPLATE_DIRS`.
|
|
117
121
|
|
|
@@ -266,7 +270,8 @@ Passing unit tests prove only what they check, and a coding agent is quick to wr
|
|
|
266
270
|
next to nothing - that a function exists, that a result is not empty, that a status is 200 - or code
|
|
267
271
|
that no test reaches. So, with `review: true` in the [config](config.md), once the unit testing script
|
|
268
272
|
passes a reviewer on the judge model reads what the work wrote, beside the spec, and changes nothing. It
|
|
269
|
-
reviews both halves
|
|
273
|
+
reviews both halves, with the unit testing script word for word in its prompt: a test the script never reaches is
|
|
274
|
+
not run, and checks nothing. The review is off by default - `review: false`, or the key left out - and so is the
|
|
270
275
|
conformance tests' review: the work goes on once its tests pass.
|
|
271
276
|
|
|
272
277
|
- **The code.** Every behaviour, edge case, validation rule and error the spec states for this work
|
|
@@ -503,8 +508,9 @@ testing script, stops before it starts and says which skill adds it.
|
|
|
503
508
|
`prepare-environment-script:` in the config, else the one `prepare_environment*.sh` at the root, else in
|
|
504
509
|
`test_scripts/` - on the build, before every run of the conformance testing script: the harness's own, and the agents'
|
|
505
510
|
`run_conformance_tests`. Both get the same build folder - the code in place, or the same fresh copy - so what it sets up
|
|
506
|
-
for that build, the conformance testing script finds. With conformance off it is not run.
|
|
507
|
-
|
|
511
|
+
for that build, the conformance testing script finds. With conformance off it is not run. Every agent shown the
|
|
512
|
+
conformance testing script - the explorer, the conformance agent, the judge, the code fixer and the repair agent - is
|
|
513
|
+
shown it too, before the conformance testing script.
|
|
508
514
|
|
|
509
515
|
**Where they run.** On this machine, as you would run them: unfenced - no sandbox, no command check, no audit - in
|
|
510
516
|
your own environment with this machine's toolchains, turri's model providers' API keys alone left out. They are yours,
|
|
@@ -836,7 +842,8 @@ coding agent that fixes the code is told the same of the tests: it can read them
|
|
|
836
842
|
Before the test author starts, an explorer - an agent in
|
|
837
843
|
the code's folder with the file tools alone: it reads the code, runs nothing and changes nothing - hands over everything
|
|
838
844
|
the author needs, in parts: how to build and run it; how the conformance tests reach it as the project's
|
|
839
|
-
conformance testing script runs them - the explorer is given the script, and
|
|
845
|
+
conformance testing script runs them - the explorer is given the script, and the prepare script before it where there
|
|
846
|
+
is one, and says what they build or
|
|
840
847
|
installs and what the tests depend on or start (a package, a module, an entry point, by its exact name);
|
|
841
848
|
how each functionality is reached from outside
|
|
842
849
|
(the command, or the route, method and the request and response fields); what it needs around it; and
|
|
@@ -919,7 +926,8 @@ culprit: what it does with the tests, the tests fit; what it needs of the build,
|
|
|
919
926
|
- **the code:** the coding agent - in the code's folder, reading the tests but never changing them - fixes it,
|
|
920
927
|
and keeps its unit tests passing. The judge quotes the spec's own words the code does not meet, or the testing
|
|
921
928
|
script's for what it needs of the build (`script_needs`: a build output, an entry point, a module) - each checked
|
|
922
|
-
by the harness against the text it quotes
|
|
929
|
+
by the harness against the text it quotes. The acceptance tests are in that text, labelled as their tests are:
|
|
930
|
+
for a spec change, those of every functional spec it touches, not only the last one's;
|
|
923
931
|
- **the tests:** the conformance agent corrects them to what the spec says;
|
|
924
932
|
- **the spec:** two functional specs cannot both hold, whatever the code does;
|
|
925
933
|
- **the environment:** neither the code nor the tests can fix it - only the person can, in what the run is given:
|
|
@@ -961,7 +969,9 @@ spending the rest of its 20 attempts on it. Two failures are the same once what
|
|
|
961
969
|
taken out of their lines - numbers, times, paths, colour codes, and the ids a service makes up for each
|
|
962
970
|
response, a UUID or a correlation id. Nothing changes either when the agent sent to fix the code or the tests
|
|
963
971
|
changes no file: two such fixes in a row, and the run stops. The conformance agent has the testing script in its prompt,
|
|
964
|
-
and is told to fit the tests' own build to it.
|
|
972
|
+
and is told to fit the tests' own build to it. The code fixer has the testing scripts its fixes are run by - the
|
|
973
|
+
conformance testing script, the prepare script before it, and the unit testing script - word for word in its task:
|
|
974
|
+
what the conformance testing script needs of the build, it reads there, not only in the judge's quote of it.
|
|
965
975
|
|
|
966
976
|
**Escalation.** A failure judged the tests' goes to the conformance agent first: it owns the tests. When the run then
|
|
967
977
|
fails the same way - the fix changed nothing, or nothing that mattered - the judge is asked again, now whether the
|
|
@@ -1067,8 +1077,7 @@ both. Each set goes where its folder goes - copied up the chain, committed, roll
|
|
|
1067
1077
|
| --- | --- |
|
|
1068
1078
|
| Where things are | entry points, layout, where each functionality lives |
|
|
1069
1079
|
| How to build, run and test | the commands that work, what had to be installed |
|
|
1070
|
-
| Assumptions | what an agent assumed where the spec is silent - a format, a default, a choice it leaves open |
|
|
1071
|
-
| Spec gaps | what the spec should say and does not - a behaviour the person would want to decide, as the question it leaves |
|
|
1080
|
+
| Assumptions | what an agent assumed where the spec is silent - a format, a default, a choice it leaves open - and the tests that assert it, when any do; one no test asserts is written down all the same |
|
|
1072
1081
|
| Pitfalls | what went wrong and what fixed it - and what the debugger found, filed by turri itself |
|
|
1073
1082
|
| Pulses | written by turri alone, as each pulse ends: the last ten, a line each |
|
|
1074
1083
|
|
|
@@ -1085,9 +1094,14 @@ it landed, a commit of its own (`pulse 3 rolled back: …`) when it did not - so
|
|
|
1085
1094
|
commit, keeps it. `update_notes` refuses the section. What the debugger finds is filed in the pitfalls the moment it
|
|
1086
1095
|
finds it, not left to the coding agent to write down.
|
|
1087
1096
|
|
|
1088
|
-
|
|
1089
|
-
the
|
|
1090
|
-
|
|
1097
|
+
A spec gap - what the spec should say and does not, a behaviour you would want to decide - is not a note: the notes
|
|
1098
|
+
are the next agent's, and a gap is yours. An agent reports one with `report_spec_gap`, giving the question it leaves
|
|
1099
|
+
and the assumption it made meanwhile; turri writes that assumption into the notes' assumptions, so the code built on
|
|
1100
|
+
it is known for what it is. The gaps a pulse's agents report are said in its report - "Spec gaps its agents met ... Put
|
|
1101
|
+
each to the user", each with its assumption - so the conversation asks you, and writes the ones you decide into the
|
|
1102
|
+
spec; the pulse that builds the answer finds the assumption it replaces in the notes, and the tests it names. However many gaps a pulse's agents report, they
|
|
1103
|
+
are put to you - never a reason to stop the pulse; the tool is guarded like any other. A notes
|
|
1104
|
+
file from before keeps no spec gaps section: its lines are dropped as it is read.
|
|
1091
1105
|
|
|
1092
1106
|
Stubborn on the specs, flexible on the assumptions: the spec is never an assumption and never
|
|
1093
1107
|
copied into the notes, and where the two disagree the spec wins. An agent builds on the assumptions
|
|
@@ -1110,8 +1124,8 @@ Leaving notes is required, and only through the `update_notes` tool. The file to
|
|
|
1110
1124
|
notes file, and a change made to it any other way - from the shell, by a script - is undone. An agent
|
|
1111
1125
|
that finishes without calling `update_notes` is asked again, up to three times; if it still has not,
|
|
1112
1126
|
the activity log says so. The turn that asks is for the notes alone: the work is done - its testing script's run
|
|
1113
|
-
passed, and the agent is told so first, so its notes speak of work that succeeded - so every tool but `update_notes`
|
|
1114
|
-
refused, and an agent that keeps calling
|
|
1127
|
+
passed, and the agent is told so first, so its notes speak of work that succeeded - so every tool but `update_notes` and
|
|
1128
|
+
`report_spec_gap` is refused, and an agent that keeps calling the refused ones has its turn stopped. What
|
|
1115
1129
|
landed is what the harness checked; nothing changes after it. Only work that lands is asked: a job whose code or tests do not pass - or whose
|
|
1116
1130
|
testing script cannot run - is rolled back, notes and all, so its agent is not asked to leave any.
|
|
1117
1131
|
|
package/docs/skills-and-gates.md
CHANGED
|
@@ -52,7 +52,7 @@ last one - one answer, one change, as an interview writes them. `spawn` is unpac
|
|
|
52
52
|
each change to write the next at once, not to carry on with an interview it does not have.
|
|
53
53
|
|
|
54
54
|
`questioning:` under `metadata:` names the steps the questioning level caps (`src/questioning.ts`) - `brood`'s
|
|
55
|
-
`[stack, product]`. When there are any and someone to ask, the harness itself asks the first question of the first
|
|
55
|
+
`[stack, product]`, `bud`'s `[product]`. When there are any and someone to ask, the harness itself asks the first question of the first
|
|
56
56
|
step: how many questions those steps may ask - light (3), medium (5), thorough (10) or best judgement - and tells the
|
|
57
57
|
agent the answer beside each step's instructions, with how broad each question is to be: broad at light, a whole area
|
|
58
58
|
at once, narrow at thorough, an edge case at a time. Every level covers the same ground, in less or more depth. In a
|
|
@@ -63,7 +63,7 @@ questions each step has asked, are kept in the run's `run.json`, so a resumed ru
|
|
|
63
63
|
or a run with nobody to ask, is not capped.
|
|
64
64
|
|
|
65
65
|
`spec-diff-per-answer:` under `metadata:` names the steps where every answer is a spec change - `brood`'s
|
|
66
|
-
`[product]`, at every questioning level. There `ask_user` refuses the next question until the last answer is written
|
|
66
|
+
and `bud`'s `[product]`, at every questioning level. There `ask_user` refuses the next question until the last answer is written
|
|
67
67
|
with `write_spec_diff` (a confirmation, or a question dismissed, owes nothing), and `write_spec_diff` no longer waits
|
|
68
68
|
for an answer before a change: the agent writes as many as the step needs, those it decides itself included. The
|
|
69
69
|
level limits the questions, never the spec changes.
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: bud
|
|
3
3
|
description: >-
|
|
4
|
-
Add a feature to an existing ***plain project the way `brood` builds one:
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
Add a feature to an existing ***plain project the way `brood` builds one: it first asks how many
|
|
5
|
+
questions the product phase may ask - light, medium, thorough or best judgement, broader with
|
|
6
|
+
fewer - then a short feature-intent interview, then product questions - a trigger and its outcome,
|
|
7
|
+
an edge case, a rule - where every answer becomes a spec change, written as a git diff of the
|
|
7
8
|
.plain files and built the moment it is written, so the feature appears while the interview is
|
|
8
|
-
still going.
|
|
9
|
+
still going. What the questions leave open it decides itself, each decision a spec change of its
|
|
10
|
+
own. A change that touches what is already specified or being built is a spec diff too: what
|
|
9
11
|
is left to build is worked out again from the spec. Use when the user wants to add a
|
|
10
12
|
feature to an existing project. Not for starting a new project (use `brood`, or `spawn`
|
|
11
13
|
to start fast) or for editing generated code (the .plain specs are the source of truth).
|
|
@@ -16,7 +18,12 @@ metadata:
|
|
|
16
18
|
intent: "what the feature is for, who it serves, and what it leaves out"
|
|
17
19
|
scope: "finds where the feature goes in the spec, and what is built already"
|
|
18
20
|
product: "the feature, question by question - each answer starts a regenerate pulse"
|
|
19
|
-
|
|
21
|
+
# The phase the questioning level caps, asked by the harness as the first question: light 3,
|
|
22
|
+
# medium 5, thorough 10, best judgement as many as turri judges the phase needs.
|
|
23
|
+
questioning: [product]
|
|
24
|
+
# Every answer in the product phase is a spec change: the next question waits until it is
|
|
25
|
+
# written with write_spec_diff. Changes turri decides itself need no answer before them.
|
|
26
|
+
spec-diff-per-answer: [product]
|
|
20
27
|
---
|
|
21
28
|
|
|
22
29
|
# Bud
|
|
@@ -37,10 +44,36 @@ the spec."
|
|
|
37
44
|
This is `brood`'s product phase, scoped to one feature, on top of what is there: the stack,
|
|
38
45
|
the testing setup and every earlier feature are settled - read them, build on them, restart none.
|
|
39
46
|
|
|
47
|
+
## How many questions
|
|
48
|
+
|
|
49
|
+
The first question of the intent phase is the harness's own, not yours: how many questions the
|
|
50
|
+
**product** phase may ask. The level sets how many questions there are and so how broad each is -
|
|
51
|
+
never what they cover:
|
|
52
|
+
|
|
53
|
+
| level | product questions | each question |
|
|
54
|
+
| --- | --- | --- |
|
|
55
|
+
| light | at most 3 | broad: the whole feature at once - what it does end to end, its main rules - with what fits the brief proposed, for the person to confirm or correct |
|
|
56
|
+
| medium | at most 5 | one part of the feature, with its main rules |
|
|
57
|
+
| thorough | at most 10 | narrow: one trigger, rule or edge case, with follow-ups on the ones that matter |
|
|
58
|
+
| best judgement | as many as you judge the feature needs | as broad or as narrow as each part needs |
|
|
59
|
+
|
|
60
|
+
The intent phase is not capped. Follow-ups count; the closing confirmation - asked with
|
|
61
|
+
`confirms_phase: true` - does not. Past the cap `ask_user` refuses the question. To stop sooner, or
|
|
62
|
+
under best judgement once the feature is settled enough to build, call `end_questions`.
|
|
63
|
+
|
|
64
|
+
The level limits the questions, never the spec changes. **Every answer is a spec change**, whatever
|
|
65
|
+
the level: written with `write_spec_diff` and built at once, before the next question - `ask_user`
|
|
66
|
+
refuses the next one until it is. A broad answer that covers several behaviours is several changes,
|
|
67
|
+
and you write them all. What the questions leave open - the details of a light answer, what is left
|
|
68
|
+
once they are over - is yours to decide, as a careful engineer would, in the light of the brief: each
|
|
69
|
+
decision a spec change of its own, written with `write_spec_diff` with no answer needed before it,
|
|
70
|
+
and said in one line. The closing summary names every decision you made yourself, so the
|
|
71
|
+
confirmation is where the person can change it.
|
|
72
|
+
|
|
40
73
|
## Question style
|
|
41
74
|
|
|
42
|
-
- Ask with `ask_user`, one question per call, and pass `options` so
|
|
43
|
-
types - concrete choices, plus the free-form catch-all the tool adds. Reserve `free_form: true`
|
|
75
|
+
- Ask with `ask_user`, one question per call, as broad as the level says, and pass `options` so
|
|
76
|
+
the user picks rather than types - concrete choices, plus the free-form catch-all the tool adds. Reserve `free_form: true`
|
|
44
77
|
for a genuinely open question.
|
|
45
78
|
- Ask about the product - a trigger and its outcome, an edge case, a rule, a permission, a step of
|
|
46
79
|
a flow - never about a spec section ("which concepts?", "what reqs?"). Let the answer decide which
|
|
@@ -55,6 +88,9 @@ the testing setup and every earlier feature are settled - read them, build on th
|
|
|
55
88
|
|
|
56
89
|
### intent
|
|
57
90
|
|
|
91
|
+
The harness has asked how many questions the product phase may ask before this phase starts; its
|
|
92
|
+
note beside these instructions gives the answer. Do not ask it again.
|
|
93
|
+
|
|
58
94
|
Read `references/intent.md` and ask its five core questions one at a time with `ask_user`. Ask at
|
|
59
95
|
most one focused follow-up when an answer is too vague to summarize. If what the user has already
|
|
60
96
|
said answers a question, confirm it in one line instead of asking.
|
|
@@ -81,8 +117,8 @@ Say in one line where the feature goes, and move on. Write nothing to disk.
|
|
|
81
117
|
|
|
82
118
|
### product
|
|
83
119
|
|
|
84
|
-
The feature, walked question by question. Run this loop
|
|
85
|
-
|
|
120
|
+
The feature, walked question by question. Run this loop while the questioning level allows (see
|
|
121
|
+
"How many questions"):
|
|
86
122
|
|
|
87
123
|
1. **Ask** one product question with `ask_user`.
|
|
88
124
|
2. The user **answers**.
|
|
@@ -106,14 +142,17 @@ covered:
|
|
|
106
142
|
Write it as a git diff: `diff --git a/<file> b/<file>`, `--- a/<file>`, `+++ b/<file>`, then the
|
|
107
143
|
hunks with a few lines of unchanged context, paths from the project root. A new functional spec
|
|
108
144
|
goes where it belongs in build order - after what it builds on, usually at the end.
|
|
109
|
-
4. **Write it with `write_spec_diff
|
|
110
|
-
it; with conformance on, its conformance tests follow it.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
145
|
+
4. **Write it with `write_spec_diff` at once**, before anything else. It applies the diff and starts
|
|
146
|
+
a render spec diff job for it; with conformance on, its conformance tests follow it. An answer
|
|
147
|
+
that covers several behaviours is a change for each: write them all. Then the changes for what
|
|
148
|
+
you decide yourself around it, if any. Say in one line what went into the spec - "added `:Note:`
|
|
149
|
+
and functional spec 7" - and what became of the build, as the tool says, then ask the next
|
|
150
|
+
question. Never wait for a build, and never ask the user to approve a change.
|
|
151
|
+
|
|
152
|
+
**One answer, at least one change.** A follow-up about the same behaviour - an edge case, a
|
|
153
|
+
validation rule - is its own answer and its own change. An answer that describes two behaviours is
|
|
154
|
+
two changes, both written before the next question. A change never carries both an answer and
|
|
155
|
+
something you decided: what you decide is a change of its own.
|
|
117
156
|
|
|
118
157
|
**What already exists.** When an answer - or the conflict check - means changing something already
|
|
119
158
|
specified: a definition, a req, a functional spec, built or still queued, the next question is
|
|
@@ -127,22 +166,14 @@ is taken out, one it touches renders the spec as it now is.
|
|
|
127
166
|
**Fix your own mistakes in place.** When a later answer refines or contradicts a change you wrote in
|
|
128
167
|
this feature, write the correction as its own diff with `fixes_earlier`, before the next question.
|
|
129
168
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
2. Run `validate` on every module the feature touched.
|
|
142
|
-
3. Fix what either finds with a spec diff and `fixes_earlier` - never by editing the file. Ask the
|
|
143
|
-
user only when a fix is a decision the brief and the answers do not settle.
|
|
144
|
-
|
|
145
|
-
Walk `references/checklist.md` once, as a self-audit. Then hand over in a few lines: the feature's
|
|
146
|
-
spec changes in order, the builds they queued and how they stand (`drift`), and that any
|
|
147
|
-
further change is asked for in the conversation - each one a spec diff, and what is left to build is
|
|
148
|
-
worked out again from the spec. The next feature starts again from the intent.
|
|
169
|
+
Once the questions are over - the cap reached, or `end_questions` called - write what is left of
|
|
170
|
+
the feature the same way: one decision of yours, one spec change, with no answer between. Then run
|
|
171
|
+
`validate` on every module the feature touched, and fix what it finds with a spec diff and
|
|
172
|
+
`fixes_earlier`.
|
|
173
|
+
|
|
174
|
+
Finish by summarizing the feature's spec changes in build order, marking what you decided without
|
|
175
|
+
asking, saying what is built and what is still queued (`drift`), and getting explicit confirmation
|
|
176
|
+
with `confirms_phase: true`. The summary is for the person to take in at a glance - a line a change,
|
|
177
|
+
each decision you made yourself in a few words, about fifteen lines at most, never the specs'
|
|
178
|
+
wording. Any further change is asked for in the conversation, each one a spec diff; the next
|
|
179
|
+
feature starts again from the intent.
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
Extract the intent of this feature before choosing files or authoring specifications. Ask exactly
|
|
4
4
|
five core questions, one at a time, and do not write to disk.
|
|
5
5
|
|
|
6
|
+
The harness has already asked the first question of this phase: how many questions the product
|
|
7
|
+
phase may ask - light (3), medium (5), thorough (10) or best judgement. Do not ask it again; this
|
|
8
|
+
phase's own questions are not capped by it.
|
|
9
|
+
|
|
6
10
|
## Questions
|
|
7
11
|
|
|
8
12
|
1. **Motivation** — What problem or limitation should this feature address?
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turri-dev/cli",
|
|
3
|
-
"version": "0.1.3
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"grammar:sync": "node scripts/sync-plyn-grammar.mjs"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@earendil-works/pi-coding-agent": "^1.
|
|
37
|
-
"@earendil-works/pi-tui": "^1.
|
|
36
|
+
"@earendil-works/pi-coding-agent": "^1.2.0",
|
|
37
|
+
"@earendil-works/pi-tui": "^1.2.0",
|
|
38
38
|
"@langchain/langgraph": "1.4.15",
|
|
39
39
|
"gray-matter": "^4.0.3",
|
|
40
40
|
"js-yaml": "^5.4.2",
|