@turri-dev/cli 0.1.7-next.f0d55df → 0.1.8-next.bcca62a
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 +5 -5
- package/dist/btw.d.ts +2 -0
- package/dist/btw.js +2 -2
- package/dist/extension.d.ts +11 -0
- package/dist/extension.js +43 -5
- package/dist/identity.d.ts +6 -1
- package/dist/identity.js +33 -7
- package/dist/loop-tools.js +3 -1
- package/dist/regenerate/cases.js +3 -0
- package/dist/regenerate/conformance-agents.js +2 -2
- package/dist/regenerate/conformance.js +3 -3
- package/dist/regenerate/environment-error.d.ts +6 -0
- package/dist/regenerate/environment-error.js +19 -1
- package/dist/regenerate/jobs.d.ts +9 -0
- package/dist/regenerate/jobs.js +11 -0
- package/dist/regenerate/lineage.d.ts +9 -1
- package/dist/regenerate/lineage.js +47 -12
- package/dist/regenerate/loop.d.ts +6 -0
- package/dist/regenerate/loop.js +26 -5
- package/dist/regenerate/records.d.ts +5 -3
- package/dist/regenerate/records.js +6 -4
- package/dist/regenerate/regenerate.js +3 -3
- package/dist/regenerate/regression.js +2 -2
- package/dist/regenerate/spec-map.js +8 -5
- package/dist/run-report.d.ts +1 -1
- package/dist/run-report.js +6 -0
- package/dist/self-invocation.d.ts +1 -1
- package/dist/self-invocation.js +3 -2
- package/dist/skill-progress.d.ts +1 -1
- package/dist/skill.d.ts +5 -0
- package/dist/skill.js +1 -0
- package/dist/skills.d.ts +14 -0
- package/dist/skills.js +19 -1
- package/dist/surface.d.ts +5 -0
- package/dist/surface.js +18 -0
- package/docs/authoring-plain.md +2 -2
- package/docs/config.md +1 -1
- package/docs/headless.md +4 -0
- package/docs/hosting.md +17 -0
- package/docs/regenerating.md +4 -4
- package/docs/skills-and-gates.md +3 -1
- package/docs/using.md +6 -4
- package/genome/rules/func-specs.md +1 -0
- package/genome/rules/turri-regeneration.md +3 -0
- package/genome/skills/add-functional-spec/SKILL.md +12 -3
- package/genome/skills/add-functional-specs/SKILL.md +12 -2
- package/genome/skills/brood/SKILL.md +2 -0
- package/genome/skills/bud/SKILL.md +2 -0
- package/genome/skills/spawn/SKILL.md +47 -35
- package/package.json +1 -1
package/dist/regenerate/loop.js
CHANGED
|
@@ -5,11 +5,11 @@ import { STDLIB_ROOT } from "../plain/stdlib.js";
|
|
|
5
5
|
import { ACCEPTANCE_TESTS, FUNCTIONAL_REQUIREMENTS, REQUIRED_FUNCTIONAL_SPECS, TEST_REQUIREMENTS } from "../plain/spec.js";
|
|
6
6
|
import { reportActivity, reportStage } from "./activity.js";
|
|
7
7
|
import { llmChunkAgents, MAX_LINES_PER_JOB, MAX_SPECS_PER_JOB, planChunks, stepsOf } from "./chunk-plan.js";
|
|
8
|
-
import { commitNotes, recordHistory, resetToLastCommit } from "./lineage.js";
|
|
8
|
+
import { commitNotes, landWork, recordHistory, resetToLastCommit } from "./lineage.js";
|
|
9
9
|
import { NOTES_FILE, recordPulse } from "./notes.js";
|
|
10
10
|
import { createJobRegistry, formatDuration } from "./jobs.js";
|
|
11
11
|
import { moduleLanes } from "./lanes.js";
|
|
12
|
-
import { adoptDigests, chainTree, codeTree, conformanceTarget, REGENERATE_AGAIN, inheritedRecord, notBuilt, readRecord, RECORD_FILE, withResourceDigests, writeCodeRecord, writeTestsRecord, } from "./records.js";
|
|
12
|
+
import { adoptDigests, chainTree, codeTree, conformanceTarget, marksRegenerateAgain, REGENERATE_AGAIN, inheritedRecord, notBuilt, readRecord, RECORD_FILE, withResourceDigests, writeCodeRecord, writeTestsRecord, } from "./records.js";
|
|
13
13
|
import { describeSpecDiffConformance, renderSpecDiffConformance } from "./conform.js";
|
|
14
14
|
import { conformanceDirFor } from "./conformance.js";
|
|
15
15
|
import { modulesRoot } from "./paths.js";
|
|
@@ -153,7 +153,8 @@ export function functionalityCompletion(plainFile) {
|
|
|
153
153
|
codebase.forEach((entry, index) => {
|
|
154
154
|
const count = counts[index];
|
|
155
155
|
const completed = entry.frids.filter((frid) => !touched.has(`${entry.moduleName}:${frid}`));
|
|
156
|
-
|
|
156
|
+
// Tests marked to regenerate again were written against code since replaced: not conformance tested until rewritten.
|
|
157
|
+
const tested = (readRecord(conformanceDirFor(entry.moduleName, modulesRoot(projectDirOf(entry.plainFile))))?.[FUNCTIONAL_REQUIREMENTS] ?? []).filter((item) => item.frid !== undefined && !marksRegenerateAgain(item) && item.markdown.trim() === specText(entry.moduleName, item.frid));
|
|
157
158
|
count.completed = completed.length;
|
|
158
159
|
count.tested = completed.filter((frid) => tested.some((item) => item.frid === frid));
|
|
159
160
|
count.conformanceTested = count.tested.length;
|
|
@@ -521,7 +522,7 @@ export function createWorkLoop(options) {
|
|
|
521
522
|
run: async (onDelta) => {
|
|
522
523
|
// The guardrail: a conformance job tests only code that is built - the code record, read as the job starts, has every functional spec it tests as it tests it.
|
|
523
524
|
if (conformance) {
|
|
524
|
-
const testing = [...planned.cases.add, ...planned.cases.patch].map((touched) => touched.frid);
|
|
525
|
+
const testing = [...planned.cases.add, ...planned.cases.patch, ...planned.cases.again].map((touched) => touched.frid);
|
|
525
526
|
const missing = notBuilt(readRecord(tip.buildDir), planned.step.tree, testing);
|
|
526
527
|
if (missing.length > 0) {
|
|
527
528
|
const record = relative(options.cwd, join(tip.buildDir, RECORD_FILE));
|
|
@@ -1109,6 +1110,17 @@ export function createWorkLoop(options) {
|
|
|
1109
1110
|
found.add(frid);
|
|
1110
1111
|
const marked = items.map((item, index) => (frids.includes(named(item, index)) ? { ...item, [REGENERATE_AGAIN]: true } : item));
|
|
1111
1112
|
writeCodeRecord(tip.buildDir, { ...record, [section]: marked });
|
|
1113
|
+
// Its conformance tests were written against the code being replaced: marked with it, they are written again -
|
|
1114
|
+
// checked against the new code, and rewritten where they relied on what the old code chose - once it lands.
|
|
1115
|
+
if (section === FUNCTIONAL_REQUIREMENTS) {
|
|
1116
|
+
const testsDir = conformanceDirFor(tip.moduleName, modulesRoot(projectDirOf(tip.plainFile)));
|
|
1117
|
+
const tests = readRecord(testsDir);
|
|
1118
|
+
const tested = tests?.[FUNCTIONAL_REQUIREMENTS] ?? [];
|
|
1119
|
+
if (tested.some((item) => item.frid !== undefined && taken.includes(item.frid))) {
|
|
1120
|
+
const again = tested.map((item) => (item.frid !== undefined && taken.includes(item.frid) ? { ...item, [REGENERATE_AGAIN]: true } : item));
|
|
1121
|
+
writeTestsRecord(testsDir, { ...tests, [FUNCTIONAL_REQUIREMENTS]: again });
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1112
1124
|
recordHistory(tip.buildDir, `${module} functional spec${taken.length === 1 ? "" : "s"} ${taken.join(", ")} to regenerate again`);
|
|
1113
1125
|
}
|
|
1114
1126
|
const missing = frids.filter((frid) => !found.has(frid));
|
|
@@ -1596,10 +1608,18 @@ const defaultConformanceRunner = async (job, onDelta) => {
|
|
|
1596
1608
|
});
|
|
1597
1609
|
if (result.passed) {
|
|
1598
1610
|
writeTestsRecord(result.conformanceDir, job.planned.step.tree);
|
|
1599
|
-
|
|
1611
|
+
landWork(job.buildDir, `conformance tests: ${job.planned.title}`);
|
|
1600
1612
|
}
|
|
1601
1613
|
return { landed: result.passed, report: describeSpecDiffConformance(result), ...(result.specGaps !== undefined ? { specGaps: result.specGaps } : {}) };
|
|
1602
1614
|
};
|
|
1615
|
+
/**
|
|
1616
|
+
* A module's first pulse when it builds one functional spec - the project set up and the smallest thing that runs: it lands on its
|
|
1617
|
+
* unit tests alone, with no review. A reviewer, and an arbiter after it, on a scaffold is time spent before anything can
|
|
1618
|
+
* be tried.
|
|
1619
|
+
*/
|
|
1620
|
+
export function skipsReview(cases) {
|
|
1621
|
+
return cases.fresh && cases.add.length <= 1 && cases.patch.length === 0 && cases.again.length === 0 && cases.delete.length === 0;
|
|
1622
|
+
}
|
|
1603
1623
|
/** A job as a spec diff render, landed on its unit tests: conformance is a track of its own. */
|
|
1604
1624
|
const defaultRunner = async (job, onDelta) => {
|
|
1605
1625
|
const result = await renderSpecDiff({
|
|
@@ -1609,6 +1629,7 @@ const defaultRunner = async (job, onDelta) => {
|
|
|
1609
1629
|
applied: "already applied",
|
|
1610
1630
|
spec: job.spec,
|
|
1611
1631
|
cases: job.planned.cases,
|
|
1632
|
+
...(skipsReview(job.planned.cases) ? { unitReview: false } : {}),
|
|
1612
1633
|
...(job.model !== undefined ? { model: job.model } : {}),
|
|
1613
1634
|
...(job.steering !== undefined ? { steering: job.steering } : {}),
|
|
1614
1635
|
onDelta,
|
|
@@ -63,9 +63,11 @@ export type Chosen = (frid: string) => boolean;
|
|
|
63
63
|
* definitions and implementation reqs, with the test reqs as the spec has them now.
|
|
64
64
|
*
|
|
65
65
|
* Conformance follows the code, never goes ahead of it: a functional spec whose code is not caught up
|
|
66
|
-
* with the spec - its text in the code record is not the spec's,
|
|
67
|
-
* all,
|
|
68
|
-
* taken out only once the spec and the code have both dropped it.
|
|
66
|
+
* with the spec - its text in the code record is not the spec's, the code record does not have it at
|
|
67
|
+
* all, or has it marked to regenerate again - stays as the tests record has it, until the code lands. Its tests are
|
|
68
|
+
* taken out only once the spec and the code have both dropped it. Tests marked to regenerate again with their code
|
|
69
|
+
* (`regenerateAgain`) differ from the target once the code lands: written against the code it replaced, they are
|
|
70
|
+
* conformance work again, though the spec's text never changed.
|
|
69
71
|
*/
|
|
70
72
|
export declare function conformanceTarget(code: MarshalledPlainSource | null, tests: MarshalledPlainSource | null, spec: MarshalledPlainSource, chosen?: Chosen): MarshalledPlainSource;
|
|
71
73
|
/**
|
|
@@ -155,9 +155,11 @@ export function inheritedRecord(source, sourceModule) {
|
|
|
155
155
|
* definitions and implementation reqs, with the test reqs as the spec has them now.
|
|
156
156
|
*
|
|
157
157
|
* Conformance follows the code, never goes ahead of it: a functional spec whose code is not caught up
|
|
158
|
-
* with the spec - its text in the code record is not the spec's,
|
|
159
|
-
* all,
|
|
160
|
-
* taken out only once the spec and the code have both dropped it.
|
|
158
|
+
* with the spec - its text in the code record is not the spec's, the code record does not have it at
|
|
159
|
+
* all, or has it marked to regenerate again - stays as the tests record has it, until the code lands. Its tests are
|
|
160
|
+
* taken out only once the spec and the code have both dropped it. Tests marked to regenerate again with their code
|
|
161
|
+
* (`regenerateAgain`) differ from the target once the code lands: written against the code it replaced, they are
|
|
162
|
+
* conformance work again, though the spec's text never changed.
|
|
161
163
|
*/
|
|
162
164
|
export function conformanceTarget(code, tests, spec, chosen = () => true) {
|
|
163
165
|
const built = itemsOf(code, FUNCTIONAL_REQUIREMENTS);
|
|
@@ -168,7 +170,7 @@ export function conformanceTarget(code, tests, spec, chosen = () => true) {
|
|
|
168
170
|
for (let index = 0; index < Math.max(built.length, now.length); index += 1) {
|
|
169
171
|
const frid = String(index + 1);
|
|
170
172
|
const current = now[index];
|
|
171
|
-
if (current !== undefined && built[index]?.markdown.trim() === current.markdown.trim()) {
|
|
173
|
+
if (current !== undefined && built[index]?.markdown.trim() === current.markdown.trim() && !marksRegenerateAgain(built[index])) {
|
|
172
174
|
if (chosen(frid))
|
|
173
175
|
specs.push({ ...current, frid });
|
|
174
176
|
continue;
|
|
@@ -11,7 +11,7 @@ import { debugFailure, diagnosisText } from "./debugger.js";
|
|
|
11
11
|
import { codebaseMap, diffFiles, digestFiles, wroteNothing } from "./codebase.js";
|
|
12
12
|
import { confinedTools } from "./confine.js";
|
|
13
13
|
import { buildSpecDiffPrompt, describeSpecChange, reviewedSpec, sectionModules } from "./prompt.js";
|
|
14
|
-
import { abandonWork,
|
|
14
|
+
import { abandonWork, landWork, startWork } from "./lineage.js";
|
|
15
15
|
import { createWorkLedger, SUBMIT_WORK_NOTE } from "./submit-work.js";
|
|
16
16
|
import { CODER_COMPACTION } from "./compaction.js";
|
|
17
17
|
import { gapMark, gapsSince, NOTES_TURN, notesForSession, passedOutcome, recordNote, withNotes } from "./notes.js";
|
|
@@ -193,7 +193,7 @@ export async function renderSpecDiff(options) {
|
|
|
193
193
|
if (builtBefore !== null && sameSpec(builtBefore, tree) && !dryRun) {
|
|
194
194
|
stage("the specs were only restructured - nothing to render; recording the spec as it is now laid out");
|
|
195
195
|
writeCodeRecord(tip.buildDir, tree);
|
|
196
|
-
|
|
196
|
+
landWork(tip.buildDir, `spec restructured: ${summarizeDiff(options.diff)}`, options.diff);
|
|
197
197
|
return {
|
|
198
198
|
moduleName,
|
|
199
199
|
buildDir: tip.buildDir,
|
|
@@ -554,7 +554,7 @@ export async function renderSpecDiff(options) {
|
|
|
554
554
|
stage("recording what the code is built from, and committing it");
|
|
555
555
|
// Steered, it is built from the spec as it was steered to - the record the loop moved with it.
|
|
556
556
|
writeCodeRecord(buildDir, steering?.target ?? tree);
|
|
557
|
-
|
|
557
|
+
landWork(buildDir, `spec diff: ${summarizeDiff(options.diff)}`, options.diff);
|
|
558
558
|
};
|
|
559
559
|
if (!unitPassed) {
|
|
560
560
|
stage(unitReviewStopped ? "the unit tests pass but still leave the change untested - undoing the change" : "unit tests NOT passing - undoing the change");
|
|
@@ -6,7 +6,7 @@ import { reportActivity, reportStage, unitOf } from "./activity.js";
|
|
|
6
6
|
import { confinedTools } from "./confine.js";
|
|
7
7
|
import { projectRootOf } from "./paths.js";
|
|
8
8
|
import { buildRegressionFixPrompt, sectionModules } from "./prompt.js";
|
|
9
|
-
import { abandonWork,
|
|
9
|
+
import { abandonWork, landWork, markWork } from "./lineage.js";
|
|
10
10
|
import { missingToolchainError } from "./environment-error.js";
|
|
11
11
|
import { workspaceBlock } from "./workspace.js";
|
|
12
12
|
import { CODER_COMPACTION } from "./compaction.js";
|
|
@@ -154,7 +154,7 @@ export async function ensureRegressionPasses(input) {
|
|
|
154
154
|
if (passing) {
|
|
155
155
|
reportStage(`${unitOf(input.moduleName)}: the whole conformance suite passes, and the unit tests with it${repairs.length > 0 ? ` after ${repairs.length} repair${repairs.length === 1 ? "" : "s"}` : ""}`);
|
|
156
156
|
if (repairs.length > 0) {
|
|
157
|
-
|
|
157
|
+
landWork(input.buildDir, `regression ${input.moduleName} (pass after ${repairs.length} repair(s))`);
|
|
158
158
|
}
|
|
159
159
|
return { passed: true, runs, repairs, command };
|
|
160
160
|
}
|
|
@@ -8,7 +8,7 @@ import { conformanceDirFor } from "./conformance.js";
|
|
|
8
8
|
import { chainSpec } from "./loop.js";
|
|
9
9
|
import { modulesRoot, projectDirOf } from "./paths.js";
|
|
10
10
|
import { HISTORY_DIR } from "./lineage.js";
|
|
11
|
-
import { codeTree, readRecord, RECORD_FILE } from "./records.js";
|
|
11
|
+
import { codeTree, marksRegenerateAgain, readRecord, RECORD_FILE } from "./records.js";
|
|
12
12
|
import { specFilesOf } from "./regenerate.js";
|
|
13
13
|
import { builtTips, resolveRequiresChain } from "./requires.js";
|
|
14
14
|
import { changesBetween, layoutOf, serializeTree } from "./spec-steps.js";
|
|
@@ -115,17 +115,20 @@ export function pageItems(input) {
|
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
// Conformance tests: of the functional specs, those the tests record has as they read now, as they read before, or taken out.
|
|
118
|
-
|
|
118
|
+
// Tests marked to regenerate again were written against code since replaced: written for an earlier build, not now.
|
|
119
|
+
const testedItems = itemsOf(input.tested ?? null, FUNCTIONAL_REQUIREMENTS);
|
|
120
|
+
const tested = new Set(testedItems.filter((item) => !marksRegenerateAgain(item)).map((item) => item.markdown.trim()));
|
|
121
|
+
const replaced = new Set(testedItems.filter((item) => marksRegenerateAgain(item)).map((item) => item.markdown.trim()));
|
|
119
122
|
for (const item of items) {
|
|
120
|
-
if (item.section !== FUNCTIONAL_REQUIREMENTS ||
|
|
123
|
+
if (item.section !== FUNCTIONAL_REQUIREMENTS || testedItems.length === 0)
|
|
121
124
|
continue;
|
|
122
125
|
if (item.state === "removed") {
|
|
123
|
-
if (tested.has(item.text.trim()))
|
|
126
|
+
if (tested.has(item.text.trim()) || replaced.has(item.text.trim()))
|
|
124
127
|
item.tests = "removed";
|
|
125
128
|
}
|
|
126
129
|
else if (tested.has(item.text.trim()))
|
|
127
130
|
item.tests = "now";
|
|
128
|
-
else if (item.was !== undefined && tested.has(item.was.trim()))
|
|
131
|
+
else if (replaced.has(item.text.trim()) || (item.was !== undefined && (tested.has(item.was.trim()) || replaced.has(item.was.trim()))))
|
|
129
132
|
item.tests = "older";
|
|
130
133
|
}
|
|
131
134
|
return keyed(items);
|
package/dist/run-report.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Job } from "./regenerate/jobs.ts";
|
|
2
2
|
/**
|
|
3
3
|
* A headless run's report: one JSON file, `turri regenerate --report <file>`, saying what the run did - how it ended,
|
|
4
4
|
* what it spent, which pulses landed, how many functional specs are completed - for a benchmark or CI to read rather
|
package/dist/run-report.js
CHANGED
|
@@ -2,6 +2,7 @@ import { mkdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
|
2
2
|
import { basename, dirname, join, relative, resolve } from "node:path";
|
|
3
3
|
import { turriIdentity } from "./environment.js";
|
|
4
4
|
import { onModelEvent } from "./regenerate/activity.js";
|
|
5
|
+
import { firstRegeneration } from "./regenerate/jobs.js";
|
|
5
6
|
/**
|
|
6
7
|
* A headless run's report: one JSON file, `turri regenerate --report <file>`, saying what the run did - how it ended,
|
|
7
8
|
* what it spent, which pulses landed, how many functional specs are completed - for a benchmark or CI to read rather
|
|
@@ -177,7 +178,12 @@ export function startRunReport(options) {
|
|
|
177
178
|
};
|
|
178
179
|
});
|
|
179
180
|
const ran = list.filter((pulse) => pulse.status !== "queued");
|
|
181
|
+
const first = firstRegeneration(jobs, startedAt);
|
|
182
|
+
const seconds = (ms) => (ms !== undefined ? Math.round(ms / 100) / 10 : null);
|
|
180
183
|
return {
|
|
184
|
+
// The time to first regeneration - the first code pulse started - and to the first one landed, from the run's start.
|
|
185
|
+
first_started_seconds: seconds(first.started),
|
|
186
|
+
first_landed_seconds: seconds(first.landed),
|
|
181
187
|
counts: {
|
|
182
188
|
total: ran.length,
|
|
183
189
|
landed: ran.filter((pulse) => pulse.landed).length,
|
|
@@ -20,6 +20,6 @@ export declare function selfInvocation(command: string): string | undefined;
|
|
|
20
20
|
*/
|
|
21
21
|
export declare function askedForCommandLine(message: string): boolean;
|
|
22
22
|
/** What the agent is told when the call is refused. */
|
|
23
|
-
export declare function refusal(what: string): string;
|
|
23
|
+
export declare function refusal(what: string, surface?: string): string;
|
|
24
24
|
/** The instruction that goes into the conversation's system prompt. */
|
|
25
25
|
export declare const TOOLS_NOT_CLI: string;
|
package/dist/self-invocation.js
CHANGED
|
@@ -88,12 +88,13 @@ export function askedForCommandLine(message) {
|
|
|
88
88
|
/(^|\s)pi\s+-p\b/.test(text));
|
|
89
89
|
}
|
|
90
90
|
/** What the agent is told when the call is refused. */
|
|
91
|
-
export function refusal(what) {
|
|
91
|
+
export function refusal(what, surface) {
|
|
92
92
|
const instead = what === "pi"
|
|
93
93
|
? "Do not start another agent: do the work here, with this conversation's tools."
|
|
94
94
|
: `Use ${TOOL_FOR[what] ?? "the matching turri tool"} instead.`;
|
|
95
95
|
return (`Not run: that starts turri${what === "pi" ? "'s agent" : ` ${what}`} again from the shell - a separate, headless ` +
|
|
96
|
-
|
|
96
|
+
// In a host there is no panel: the person watches the pulses where its surface says.
|
|
97
|
+
(surface !== undefined ? "run outside this conversation and its pulses, where the person can neither watch it nor halt it. " : "run outside this conversation, its jobs, the panel and /halt. ") +
|
|
97
98
|
`${instead} Run turri from the command line only when the user asks for that.`);
|
|
98
99
|
}
|
|
99
100
|
/** The instruction that goes into the conversation's system prompt. */
|
package/dist/skill-progress.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* brood ✓ intent ━━━━ ⠋ stack ──── ○ testing ──── ○ product phase 2 of 4
|
|
7
7
|
* stack - the language, frameworks, storage and architecture
|
|
8
8
|
*
|
|
9
|
-
* The second line says what the phase it is in does: a phase's name alone - `
|
|
9
|
+
* The second line says what the phase it is in does: a phase's name alone - `skeleton` - says little to someone
|
|
10
10
|
* who has not read the skill.
|
|
11
11
|
*
|
|
12
12
|
* A skill of one phase, or none, has nothing to be partway through: its line is the spinner and its name alone.
|
package/dist/skill.d.ts
CHANGED
|
@@ -85,6 +85,11 @@ export interface Skill {
|
|
|
85
85
|
* last answer is written with `write_spec_diff`, and changes the agent decides itself need no answer before them.
|
|
86
86
|
*/
|
|
87
87
|
diffPerAnswer: string[];
|
|
88
|
+
/**
|
|
89
|
+
* Started only by the person, with its slash command - `/brood` - never by the model on its own
|
|
90
|
+
* (`metadata.command-only: true`): cultivate runs it only when the person has just typed its command.
|
|
91
|
+
*/
|
|
92
|
+
commandOnly: boolean;
|
|
88
93
|
}
|
|
89
94
|
export declare function loadSkill(skillDir: string): Skill;
|
|
90
95
|
export declare function readRubric(skill: Skill, review: {
|
package/dist/skill.js
CHANGED
package/dist/skills.d.ts
CHANGED
|
@@ -28,3 +28,17 @@ export declare function discoverSkills(packageRoot: string, projectDir: string |
|
|
|
28
28
|
export declare function catalogueLine(skill: FoundSkill): string;
|
|
29
29
|
/** What is said under the list about the skills it leaves out. */
|
|
30
30
|
export declare function leftOutNote(catalogue: SkillCatalogue): string;
|
|
31
|
+
/**
|
|
32
|
+
* Which skills cultivate may start now. A skill marked command-only (`/brood`) waits for the person to type its command:
|
|
33
|
+
* the command lets it start once, and the run starting uses that up - the model cannot start it again later on its own.
|
|
34
|
+
*/
|
|
35
|
+
export declare function createCommandGate(): {
|
|
36
|
+
/** The person typed the skill's command. */
|
|
37
|
+
typed(name: string): void;
|
|
38
|
+
/** Whether cultivate may start it now. */
|
|
39
|
+
mayStart(skill: Pick<FoundSkill, "name" | "commandOnly">): boolean;
|
|
40
|
+
/** Its run started: the command is used up. */
|
|
41
|
+
started(name: string): void;
|
|
42
|
+
};
|
|
43
|
+
/** What cultivate says of a command-only skill the person did not start. */
|
|
44
|
+
export declare function startedByCommandOnly(name: string): string;
|
package/dist/skills.js
CHANGED
|
@@ -61,7 +61,9 @@ export function discoverSkills(packageRoot, projectDir) {
|
|
|
61
61
|
/** A skill's line in cultivate's list: a project's says so, and where it is. */
|
|
62
62
|
export function catalogueLine(skill) {
|
|
63
63
|
const whose = skill.origin === "turri" ? "" : ` (this project's, ${skill.origin.project})`;
|
|
64
|
-
|
|
64
|
+
// One the person starts themselves: the model points them to its command rather than running it.
|
|
65
|
+
const byCommand = skill.commandOnly ? ` Started only by the person, with /${skill.name}: never run it unasked - when it fits, tell them to type /${skill.name}.` : "";
|
|
66
|
+
return `- ${skill.name}${whose}: ${skill.description}${byCommand}`;
|
|
65
67
|
}
|
|
66
68
|
/** What is said under the list about the skills it leaves out. */
|
|
67
69
|
export function leftOutNote(catalogue) {
|
|
@@ -72,3 +74,19 @@ export function leftOutNote(catalogue) {
|
|
|
72
74
|
.map((line) => `\n\n${line}`)
|
|
73
75
|
.join("");
|
|
74
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Which skills cultivate may start now. A skill marked command-only (`/brood`) waits for the person to type its command:
|
|
79
|
+
* the command lets it start once, and the run starting uses that up - the model cannot start it again later on its own.
|
|
80
|
+
*/
|
|
81
|
+
export function createCommandGate() {
|
|
82
|
+
const typed = new Set();
|
|
83
|
+
return {
|
|
84
|
+
typed: (name) => void typed.add(name),
|
|
85
|
+
mayStart: (skill) => !skill.commandOnly || typed.has(skill.name),
|
|
86
|
+
started: (name) => void typed.delete(name),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/** What cultivate says of a command-only skill the person did not start. */
|
|
90
|
+
export function startedByCommandOnly(name) {
|
|
91
|
+
return `Not started: ${name} is started only by the person, with /${name}. If it fits what they want, tell them to type /${name} - with what they want after it, if they like.`;
|
|
92
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { JobRegistry } from "./regenerate/jobs.ts";
|
|
2
|
+
/** The host's surface for the conversation these jobs are: blank or undefined is the terminal. */
|
|
3
|
+
export declare function setSurface(jobs: JobRegistry, surface: string | undefined): void;
|
|
4
|
+
/** The host's surface, in its own words - undefined in the terminal. */
|
|
5
|
+
export declare function surfaceOf(jobs: JobRegistry | undefined): string | undefined;
|
package/dist/surface.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the person sees turri's work: the terminal - regen, its keys, /pulses - unless a host that runs the conversation
|
|
3
|
+
* itself describes its own (TurriHost.surface). Kept with the conversation's job registry, so what is told the model
|
|
4
|
+
* deep in a tool - a pulse not found - says the host's words and not the terminal's.
|
|
5
|
+
*/
|
|
6
|
+
const surfaces = new WeakMap();
|
|
7
|
+
/** The host's surface for the conversation these jobs are: blank or undefined is the terminal. */
|
|
8
|
+
export function setSurface(jobs, surface) {
|
|
9
|
+
const text = surface?.trim() ?? "";
|
|
10
|
+
if (text !== "")
|
|
11
|
+
surfaces.set(jobs, text);
|
|
12
|
+
else
|
|
13
|
+
surfaces.delete(jobs);
|
|
14
|
+
}
|
|
15
|
+
/** The host's surface, in its own words - undefined in the terminal. */
|
|
16
|
+
export function surfaceOf(jobs) {
|
|
17
|
+
return jobs !== undefined ? surfaces.get(jobs) : undefined;
|
|
18
|
+
}
|
package/docs/authoring-plain.md
CHANGED
|
@@ -122,12 +122,12 @@ The ones that shape a spec most:
|
|
|
122
122
|
|
|
123
123
|
## Writing specs with turri
|
|
124
124
|
|
|
125
|
-
In a conversation (`turri`), say what you want and the matching skill runs. Two build a project from scratch, and write each spec change as a git diff that is built in the background the moment it is written. `brood` interviews you one question at a time and writes the specs as you answer; `spawn`, its quick twin,
|
|
125
|
+
In a conversation (`turri`), say what you want and the matching skill runs - but the three that start a project or a feature you start yourself, by their commands: `/brood`, `/spawn` or `/bud`, with what you want after it. Two build a project from scratch, and write each spec change as a git diff that is built in the background the moment it is written. `brood` interviews you one question at a time and writes the specs as you answer; `spawn`, its quick twin, gets something running as soon as it can - the smallest thing that runs first, then the product a slice at a time - asking only what your message leaves open:
|
|
126
126
|
|
|
127
127
|
| skill | phases | how a spec change is written |
|
|
128
128
|
| --- | --- | --- |
|
|
129
129
|
| `brood` | intent → stack → testing → product, feature by feature | first, how many questions the stack and product phases may ask - light 3, medium 5, thorough 10 or best judgement, broader with fewer, covering the same ground - and what they leave open turri decides itself, each decision a spec change of its own; every product answer is still a spec change, built before the next question; in testing, whether there are conformance tests, their `***test reqs***` and script - written as files, building nothing; then one spec change per answer, across whatever sections it needs, as a git diff with `write_spec_diff`, rendered as a render spec diff job and conformance tested as it is built |
|
|
130
|
-
| `spawn` |
|
|
130
|
+
| `spawn` | start → skeleton → regenerate | built for the time to first regeneration: what to build is asked only when the message does not say, and the stack only when the user named one this machine cannot build - otherwise turri chooses one; the stack and the unit tests are written as files, with conformance tests off unless the user asks for them; then a spec change for the smallest thing that runs starts the first build - a module's first pulse of one functional spec is not reviewed - and the main slice of what the user described and at most one more follow - none when they described no feature, and never one of turri's own - each a functional spec on its happy path, as git diffs with `write_spec_diff`, one after another with no answer between them. The rest - the next slices, then validation and edge cases as changes to those specs - is asked for in the conversation once the user has tried what landed: `go on` for the next slice it proposed |
|
|
131
131
|
|
|
132
132
|
`mature` starts from a spec you already have, rough or hand-written, and runs on its own until it is fully rendered - every functionality built from the spec as it stands, its tests passing. It renders what is not built and watches the agents building it; when one struggles on something the spec leaves open or unclear - sent back again and again, the judge going back and forth, a spec conflict - it writes what the spec should say as a spec diff, stops that build, and renders it again. What the builds had to decide themselves - their assumptions, pitfalls, a failed build's diagnosis - goes into the spec the same way, when a user, a caller or a test can see it. It never asks: it takes the reading that fits the rest of the spec, and marks each such decision in its report. It leaves code, environment and turri problems to the builds, and stops when a functionality keeps struggling after the spec was clarified, when two cycles change nothing, or after twenty.
|
|
133
133
|
|
package/docs/config.md
CHANGED
|
@@ -82,7 +82,7 @@ models: # each agent role's model, thinking and tur
|
|
|
82
82
|
| `judge-model` | the judge and the test review of a conformance run | `coding-model` |
|
|
83
83
|
| `conformance-tests` | `all` (or `true`): conformance tests for every functional spec of every module with test reqs, written once each module's code is built, before anything is built on it. `chosen`: for the functional specs chosen - every one with acceptance tests, and those the chooser picks as each code pulse ends, from what that pulse regenerated. `module`: the same, but the chooser is asked once, when the whole module is regenerated, and plans the conformance pulses too. Under both, the choice is made inside the pulse, before anything is built on the module, and the pulse's report says what was chosen and why; those the person asks for with `conform` are written too; once chosen, a functional spec keeps them, and they are rewritten when it changes - see [who chooses, and when](regenerating.md#conformance-tests-in-the-work-loop). `false`: none written, and none of the existing ones run - until the conversation asks with `conform` | `false` |
|
|
84
84
|
| `conformance-budget` | under `conformance-tests: chosen` or `module`: how many of a module's functional specs may be chosen for conformance tests, beside those with acceptance tests - a count (`2`) or a share of its functional specs (`30%`, rounded up, at least one). Every choice for the module counts, whenever it was made; the chooser is told what is left, and can choose no more. Your own `conform` is not limited. A stack's `config.turri.<stack>.yaml` can set its own | no limit |
|
|
85
|
-
| `review` | `true` or `false`: whether the code and its unit tests - and the conformance tests - are reviewed once they pass: two reviews at most, the second weighed by the arbiter; off, a job lands once its tests pass - see [regenerating the code](regenerating.md#the-code-and-its-unit-tests-are-reviewed) | `false` |
|
|
85
|
+
| `review` | `true` or `false`: whether the code and its unit tests - and the conformance tests - are reviewed once they pass: two reviews at most, the second weighed by the arbiter; off, a job lands once its tests pass. A module's first pulse of one functional spec - the project set up and the smallest thing that runs - lands on its unit tests with no review - see [regenerating the code](regenerating.md#the-code-and-its-unit-tests-are-reviewed) | `false` |
|
|
86
86
|
| `mutation-testing` | `true` or `false`: whether the coding agent and the reviewer have `can_it_fail` - one change put in the code for one run of the unit testing script, to see that a test catches it; on a copy of the code, or in place and put back after the run (see [regenerating the code](regenerating.md#checking-its-own-work)). `turri regenerate --mutation-testing false` for one run | `true` |
|
|
87
87
|
| `rules-off` | a list of rule names - `integrations`, `concise-specs`, the files of `genome/rules/` without `.md` - left out of the conversation's prompt and every spec-writing agent's: a rule this project's own skills or AGENTS.md replace, such as one that says to probe a live API before any spec is written. The project's alone | none |
|
|
88
88
|
| `allow-to-stop-jobs` | `true` or `false`: whether turri stops a running job the spec has moved on from - a functional spec it regenerates changed, or a file one links was edited - rolls it back and regenerates the spec as it now is. `false`: the job runs to its end and lands, and what changed since is regenerated on top of it by the next job - see [regenerating the code](regenerating.md). Your own `halt` stops a job either way | `true` |
|
package/docs/headless.md
CHANGED
|
@@ -134,6 +134,8 @@ A module that `requires` others is built in its own codebase on top of theirs: t
|
|
|
134
134
|
"by_pulse_kind": { "code": { }, "conformance": { } }
|
|
135
135
|
},
|
|
136
136
|
"pulses": {
|
|
137
|
+
"first_started_seconds": 41.2, // the time to first regeneration: the first code pulse started - null before
|
|
138
|
+
"first_landed_seconds": 233.9, // the first code pulse landed: something to try - null before
|
|
137
139
|
"counts": { "total": 7, "landed": 5, "failed": 1, "stopped": 0, "rolled_back": 2, "running": 0, "not_started": 0 },
|
|
138
140
|
"list": [{
|
|
139
141
|
"id": "2a058729", "module": "app", "number": 1, "kind": "code", "title": "…",
|
|
@@ -170,6 +172,8 @@ A module that `requires` others is built in its own codebase on top of theirs: t
|
|
|
170
172
|
|
|
171
173
|
**Pulses.** `landed`: its work is committed. `rolled_back`: it ended without landing - failed, stopped, or did not pass - and everything it wrote was undone. A pulse that failed is tried once more before it counts as failed; both tries are the one pulse.
|
|
172
174
|
|
|
175
|
+
**Time to first regeneration.** `pulses.first_started_seconds` is how long after the run started its first code pulse started - planning the work, and any wait for a free slot, before it - and `first_landed_seconds` how long until the first one landed, when there is first something to try. Both are `null` until it happens. In the chat, `spawn` and the other skills that write spec diffs say the same in their result, counted from when the skill began.
|
|
176
|
+
|
|
173
177
|
**Spec gaps.** A behaviour the spec leaves open that an agent met and decided on its own - reported with `report_spec_gap` (see [regenerating](regenerating.md)). In the chat they are put to you as the pulse ends; a headless run has no one to ask, so they are listed here, in the order the pulses started, and printed under the pulse that met them. `assumption` is what the agent decided meanwhile, also in the codebase's notes' assumptions while its pulse is `landed`; a pulse rolled back takes it out of the notes, but the question still stands. Settle the ones you care about in the spec and run again.
|
|
174
178
|
|
|
175
179
|
**Turn incidents.** Each time the model provider failed for a moment and pi or turri waited it out before trying the request again, each time the provider sent nothing back on a request for two minutes, and each turn turri stopped itself - an agent going round in a circle, its calls failing again and again, its time up - after which the run carried on. The provider failing or stalling is printed as it happens, in orange, under the pulse; a stop is the work's normal course and is only listed. They are counted in the usage as `provider_retries`, `provider_stalls` and `turns_stopped`. Many of any point at the model, not the spec: a provider at its limits, or a model too small for the role it was given.
|
package/docs/hosting.md
CHANGED
|
@@ -35,6 +35,8 @@ const loader = new pi.DefaultResourceLoader({
|
|
|
35
35
|
onJobChange: (job) => {}, // a job started, moved on, did something, or ended
|
|
36
36
|
onPlanChange: () => {}, // what is planned changed with no job
|
|
37
37
|
dialogs: { select, input }, // ask_user's questions, put in the host's own dialogs
|
|
38
|
+
surface: SURFACE, // the host's UI, in its own words, told to the model in place of the terminal's
|
|
39
|
+
systemPrompt: (prompt) => prompt, // the last word on the whole system prompt, each turn
|
|
38
40
|
}),
|
|
39
41
|
],
|
|
40
42
|
});
|
|
@@ -45,8 +47,23 @@ await session.bindExtensions({ uiContext, mode: "tui" });
|
|
|
45
47
|
|
|
46
48
|
- **The jobs.** The pulses the conversation starts - its tools, `/regenerate`, a spec change - run in its own job registry and work loop, the project's one. The host is handed both as they are made, and told of each job as it changes, so it shows the very jobs the conversation runs. Its buttons are best the conversation's commands - `session.prompt("/regenerate app.plain")` - so there is never a second loop on the same project.
|
|
47
49
|
- **The questions.** `dialogs` is `ask_user`'s two dialogs: `select(title, options, context, at)` and `input(title, context)`, each resolving with the answer, or undefined when the person dismissed it. Given, the conversation's questions and a skill's interview are put in them; without it, in the terminal's own dialog.
|
|
50
|
+
- **The surface.** What turri tells the model of where the person watches the work is the terminal's by default: regen, the side panel on `ctrl+h`, `/pulses`. In a host none of that is there, and the model would send the person to keys and panels that do not exist. `surface` is the host's own description of its UI - the views it has in place of the terminal's, what its marks and buttons mean, where questions appear - in its own words. Given, turri leaves every terminal instruction out of what the model is told and puts the surface in turri's identity, as a `<surface>` block, where the identity speaks of regen. It reaches the side questions and the tools' own words too: a pulse not found says the `pulses` tool lists them, not `/pulses`. Text only the person sees in the terminal - the job panel, the side panel - is the terminal's and stays as it is. Without `surface`, the prompt is the terminal's, byte for byte.
|
|
51
|
+
- **The system prompt.** `systemPrompt(prompt)` gets the whole system prompt for the turn - pi's, turri's identity and blocks, the rules - after turri's own `before_agent_start` work, and returns what is sent. It is for what `surface` does not cover; to describe the UI, use `surface`, rather than words appended after turri's that contradict them.
|
|
48
52
|
- **The mode.** `mode: "tui"` runs the work in the background and keeps the conversation free, as the terminal does; `rpc`, `json` and `print` wait for each job. The extension's other UI calls - its notices, its working line, a confirm - come to the host's `uiContext`, as pi's [SDK](https://github.com/earendil-works/pi) describes it.
|
|
49
53
|
|
|
54
|
+
A surface for a desktop app might read:
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
const SURFACE = `The person uses turri's desktop app, not a terminal: there are no keys to press. Slash commands are typed in
|
|
58
|
+
the chat, and the toolbar's buttons send them too.
|
|
59
|
+
- The Specs view shows each .plain file, every functional spec marked: a green dot is built, a pulsing ring regenerating,
|
|
60
|
+
a hollow ring planned, grey waiting.
|
|
61
|
+
- The Pulses view lists every pulse - running, planned and finished. A row opens what its agents did and its log; its
|
|
62
|
+
Halt button stops it.
|
|
63
|
+
- Your questions appear as cards above the message box: the person picks an option or types an answer there.
|
|
64
|
+
- The Run button releases what is built and opens it.`;
|
|
65
|
+
```
|
|
66
|
+
|
|
50
67
|
## Running it
|
|
51
68
|
|
|
52
69
|
The host entry is compiled JavaScript, so any Node from 22.19 runs it - Electron's own included; nothing strips types. It finds turri's own folders - `genome/`, `stdlib/`, `.pi/` - beside `dist/` in the package, wherever npm installed it.
|
package/docs/regenerating.md
CHANGED
|
@@ -123,7 +123,7 @@ The reviewer has `can_it_fail` too, three runs a review session: a test it doubt
|
|
|
123
123
|
|
|
124
124
|
### The code and its unit tests are reviewed
|
|
125
125
|
|
|
126
|
-
Passing unit tests prove only what they check, and a coding agent is quick to write tests that check next to nothing - that a function exists, that a result is not empty, that a status is 200 - or code that no test reaches. So, with `review: true` in the [config](config.md), once the unit testing script passes a reviewer on the judge model reads what the work wrote, beside the spec, and changes nothing. It reviews both halves, with the unit testing script word for word in its prompt: a test the script never reaches is not run, and checks nothing. The review is off by default - `review: false`, or the key left out - and so is the conformance tests' review: the work goes on once its tests pass.
|
|
126
|
+
Passing unit tests prove only what they check, and a coding agent is quick to write tests that check next to nothing - that a function exists, that a result is not empty, that a status is 200 - or code that no test reaches. So, with `review: true` in the [config](config.md), once the unit testing script passes a reviewer on the judge model reads what the work wrote, beside the spec, and changes nothing. It reviews both halves, with the unit testing script word for word in its prompt: a test the script never reaches is not run, and checks nothing. The review is off by default - `review: false`, or the key left out - and so is the conformance tests' review: the work goes on once its tests pass. Even on, a module's first pulse is not reviewed when it builds one functional spec - the project set up and the smallest thing that runs, as `spawn` starts one: a review of a scaffold is time spent before anything can be tried.
|
|
127
127
|
|
|
128
128
|
- **The code.** Every behaviour, edge case, validation rule and error the spec states for this work is implemented as the spec says it, with nothing left as a stub, a placeholder or a hard-coded answer. The code keeps to the implementation reqs and does not break what was already built. A behaviour with no code for it is raised as not implemented. Such a problem is of kind `wrong`.
|
|
129
129
|
- **The unit tests.** Every behaviour, edge case and error the spec states for this work has a test asserting the exact outcome the spec says, that fails when it breaks; that no test only checks something exists, asserts nothing, is skipped or swallows a failure; that the unit under test is never mocked - only what is outside it; and that the tests are deterministic. A test that is not there is `missing`, a weak one is `bad`.
|
|
@@ -281,11 +281,11 @@ It is told, too, what to do with each functional spec the job touches, by its ca
|
|
|
281
281
|
| fresh | the module requires none and nothing is built | set up the project and its unit tests where the unit testing script runs them, then build | set up `tests/` so the conformance testing script, which brings the tests together with `code/`, runs them, then write |
|
|
282
282
|
| add | a functional spec is new | build it and write its unit tests | write its tests |
|
|
283
283
|
| patch | its text changed, or a concept it uses did | change the existing code and tests to match - never build it again from scratch | rewrite its existing tests to match |
|
|
284
|
-
| again | `regenerate` named it: it is built, and marked in the code record to be regenerated again | replace its implementation - rewrite it or start it over, doing what the spec says now; no second implementation beside the old, nothing of it left unused; its unit tests may be rewritten |
|
|
284
|
+
| again | `regenerate` named it: it is built, and marked in the code record to be regenerated again | replace its implementation - rewrite it or start it over, doing what the spec says now; no second implementation beside the old, nothing of it left unused; its unit tests may be rewritten | its tests were written against the code it replaced: run against the new code, what they check that the spec says stays checked, and what they check that the spec leaves open - a path, a field, a message the old code chose - is rewritten to what the new code does, or taken out |
|
|
285
285
|
| delete | a functional spec is gone | take out its code and the tests only it had | take out its tests |
|
|
286
286
|
| mechanical | no functional spec is touched - only reqs, or definitions none uses | adapt the code; write no new test; an existing one may change only mechanically - an import, a fixture, its setup - never what it asserts | the same, for test reqs, definitions or implementation reqs alone |
|
|
287
287
|
|
|
288
|
-
**Regenerating again.** `regenerate` with functionalities named regenerates them again though their spec did not change - made better, on another model, after many patches. Each is marked in the code record of every codebase it is built in (`regenerate_again`, committed), and nothing else changes: the record now differs from the spec at that item, so the work loop plans it as it plans any change. A functional spec of a module below is regenerated again where its code lives - the codebase at the tip of each chain built on it, never the module's own codebase left behind - marked among that codebase's required functional specs. The planner groups the ones regenerated again as it groups new ones - up to three a job, only those next to each other in one module together - and the job is given the definitions and implementation reqs as every job is; `<spec change>` lists each under "To regenerate again", with its text as it is now. The job that regenerates it records it as the spec has it, without the mark. Its conformance tests
|
|
288
|
+
**Regenerating again.** `regenerate` with functionalities named regenerates them again though their spec did not change - made better, on another model, after many patches. Each is marked in the code record of every codebase it is built in (`regenerate_again`, committed), and nothing else changes: the record now differs from the spec at that item, so the work loop plans it as it plans any change. A functional spec of a module below is regenerated again where its code lives - the codebase at the tip of each chain built on it, never the module's own codebase left behind - marked among that codebase's required functional specs. The planner groups the ones regenerated again as it groups new ones - up to three a job, only those next to each other in one module together - and the job is given the definitions and implementation reqs as every job is; `<spec change>` lists each under "To regenerate again", with its text as it is now. The job that regenerates it records it as the spec has it, without the mark. Its conformance tests are marked with it, in the tests record of the codebase whose own functional spec it is: they were written against the code being replaced, and may hold the new code to what only the old code chose - `/healthcheck` where the spec says only that there is a health check, and the new code answers `/health`. While the code regenerates they stay as they are; once it lands, the mark is conformance work like any change, and a conformance job writes them again, in the again case above, and runs the whole suite. Until it lands, regen shows its tests as written for an earlier build, and they are not counted as conformance tested.
|
|
289
289
|
|
|
290
290
|
A functional spec is patched when a concept it uses changed as well as when its own text did: the harness follows each functional spec's concepts through the definitions. Fresh is only where nothing exists: a module that requires another starts from what it inherits, and its first job adds or patches.
|
|
291
291
|
|
|
@@ -469,7 +469,7 @@ What goes into them:
|
|
|
469
469
|
- **A code job landed:** the code record becomes the spec the job ends on.
|
|
470
470
|
- **A conformance job landed:** the tests record becomes what its tests are written for.
|
|
471
471
|
- **A module started from another's code:** that code's record, as a lower module's - see [where things go](#where-things-go) - and an empty tests record: the tests it inherits are the module below's.
|
|
472
|
-
- **A functional spec named to `regenerate`:** it is marked to be regenerated again in the code record, so the next job regenerates it again; that job's record drops the mark.
|
|
472
|
+
- **A functional spec named to `regenerate`:** it is marked to be regenerated again in the code record, so the next job regenerates it again; that job's record drops the mark. Its conformance tests, when it has them, are marked in the tests record too, and the conformance job that writes them again for the new code drops that mark.
|
|
473
473
|
|
|
474
474
|
A unit of work - a code job, a conformance job - lands whole or is undone whole. It starts from the module's last commit, putting back whatever an interrupted run left; a module with no commit yet is given one first. When it does not pass, the module goes back to that commit: its changes, the files it added and any commit it made on the way are gone, with the record they came with. Installed dependencies and caches stay. So the code, its tests and the records of what they were built from never disagree.
|
|
475
475
|
|
package/docs/skills-and-gates.md
CHANGED
|
@@ -37,6 +37,8 @@ metadata:
|
|
|
37
37
|
|
|
38
38
|
A skill declares its steps with a `## Steps` section whose `###` headings are the steps; without it the whole skill is one step, which is what most skills are. Steps are never inferred from `###` headings elsewhere in the body - prose skills are full of those. Each gate becomes a conditional edge after its step; a single-step skill is gated by naming the skill itself. None of the skills turri ships declares a gate today - `brood`'s phases end on the person's confirmation alone - but a project's own skill can.
|
|
39
39
|
|
|
40
|
+
`command-only: true` under `metadata:` keeps a skill from the model: it is started only by the person, with its slash command - `/brood`, `/spawn` and `/bud` are. turri registers the command for every such skill, the project's own too. Typed, the command puts what was typed in the chat as the person's message, and lets `cultivate` start the skill once; the run starting uses that up, so the model cannot start it again later on its own. Without the command, `cultivate` refuses it and the model is told to name the command to the person instead - the skill's line in `cultivate`'s list says so too.
|
|
41
|
+
|
|
40
42
|
`paced: false` under `metadata:` lets a skill write spec changes one after another on its own: `write_spec_diff` otherwise refuses a new change until the user has answered a question since the last one - one answer, one change, as an interview writes them. `spawn` is unpaced: the tool tells it so, and after each change to write the next at once, not to carry on with an interview it does not have.
|
|
41
43
|
|
|
42
44
|
`questioning:` under `metadata:` names the steps the questioning level caps (`src/questioning.ts`) - `brood`'s `[stack, product]`, `bud`'s `[product]`. When there are any and someone to ask, the harness itself asks the first question of the first step: how many questions those steps may ask - light (3), medium (5), thorough (10) or best judgement - and tells the agent the answer beside each step's instructions, with how broad each question is to be: broad at light, a whole area at once, narrow at thorough, an edge case at a time. Every level covers the same ground, in less or more depth. In a capped step `ask_user` refuses a question past the cap; the step's closing confirmation, asked with `confirms_phase: true`, is never counted. `end_questions` ends the step's questions sooner - best judgement's only end. What the questions leave open, the agent decides itself and says what it chose. The level, and how many questions each step has asked, are kept in the run's `run.json`, so a resumed run keeps them. A step it does not name, or a run with nobody to ask, is not capped.
|
|
@@ -45,7 +47,7 @@ A skill declares its steps with a `## Steps` section whose `###` headings are th
|
|
|
45
47
|
|
|
46
48
|
A step ends when its agent's turn does. A turn that ends on a question in the reply would end the step there, half done, on a question no one reads - the person sees only what `ask_user` asks. So such a step is sent back, twice at most: to ask with `ask_user` if the question is truly the person's, or, in an unpaced skill, to decide it itself - then to carry on until the step is done.
|
|
47
49
|
|
|
48
|
-
`phases:` under `metadata:` says what each step does, in a short line a step by its name - for the person, not the agent: while the skill runs, the line above the input shows its phases, and under them the one it is in with its line (`
|
|
50
|
+
`phases:` under `metadata:` says what each step does, in a short line a step by its name - for the person, not the agent: while the skill runs, the line above the input shows its phases, and under them the one it is in with its line (`skeleton - sets up the project and writes the smallest spec that runs, so the first build can start`). A phase's name alone says little to someone who has not read the skill. Every skill with more than one step describes each; a line for a step the skill does not have is an error, as a gate after one is.
|
|
49
51
|
|
|
50
52
|
A skill gets the tools its `allowed-tools` names, and nothing else: one that names none has none. So every skill here names its own - the file tools (`read`, `write`, `edit`, `bash`, `ls`, `grep`, `find`) for the ones that write specs, resources or scripts, only the reading ones for those that analyse and report, and turri's own (`write_spec_diff` and the ones below) where a skill uses them.
|
|
51
53
|
|
package/docs/using.md
CHANGED
|
@@ -7,14 +7,14 @@ cd ~/my-project
|
|
|
7
7
|
turri
|
|
8
8
|
```
|
|
9
9
|
|
|
10
|
-
That is pi, with turri's tools, skills and themes loaded - `turri` alone, or with pi's options (`turri -c`, `turri --harness-model <m>`). It opens with turri's own banner - the jellyfish it is named after, regenerating until the conversation fills the screen: a pixel polyp on the sea floor grows into the jellyfish - a bell from pink down to indigo, an orange gut, neon tentacles - which swims a while, sinks back to the floor, and the polyp grows again, round and round: a picture in a terminal that shows images (Kitty, Ghostty, WezTerm, Warp, iTerm2), and drawn at a third of the size in half blocks in any other, tmux included (`src/jellyfish.ts` draws it, ported from the design system's pixel kit, `scripts/jellyfish-frames.mjs` writes the pictures) - turri's version (and, run from a clone, the commit it is on, and whether the clone has changes) and where its settings are changed - and only when something is wrong, skills that failed to load or agents' commands less fenced than they should be - rather than pi's startup header and resource list; `turri --verbose` shows those too. pi's "Update Available" notice is left out - turri's pi is a pinned dependency `pi update` never touches - and the terminal's tab reads `🪼 turri - <folder>`, not pi's `π`. Talk to it: ask it to
|
|
10
|
+
That is pi, with turri's tools, skills and themes loaded - `turri` alone, or with pi's options (`turri -c`, `turri --harness-model <m>`). It opens with turri's own banner - the jellyfish it is named after, regenerating until the conversation fills the screen: a pixel polyp on the sea floor grows into the jellyfish - a bell from pink down to indigo, an orange gut, neon tentacles - which swims a while, sinks back to the floor, and the polyp grows again, round and round: a picture in a terminal that shows images (Kitty, Ghostty, WezTerm, Warp, iTerm2), and drawn at a third of the size in half blocks in any other, tmux included (`src/jellyfish.ts` draws it, ported from the design system's pixel kit, `scripts/jellyfish-frames.mjs` writes the pictures) - turri's version (and, run from a clone, the commit it is on, and whether the clone has changes) and where its settings are changed - and only when something is wrong, skills that failed to load or agents' commands less fenced than they should be - rather than pi's startup header and resource list; `turri --verbose` shows those too. pi's "Update Available" notice is left out - turri's pi is a pinned dependency `pi update` never touches - and the terminal's tab reads `🪼 turri - <folder>`, not pi's `π`. Talk to it: ask it to add a feature to a spec, render a module, fix a spec. It decides which skill or tool applies - but not *how* a skill runs: `cultivate` hands the work to the gated runner, which owns the steps, the gates and the judges (see [skills and gates](skills-and-gates.md)).
|
|
11
11
|
|
|
12
|
-
The skills that build from scratch:
|
|
12
|
+
Three skills you start yourself, by their commands - turri never starts them on its own, and says which to type when one fits: `/brood`, `/spawn` and `/bud`, each with what you want after it - `/spawn a URL shortener in Go`. The skills that build from scratch:
|
|
13
13
|
|
|
14
14
|
| skill | how it works |
|
|
15
15
|
| --- | --- |
|
|
16
16
|
| `brood` | first, how many questions the stack and product phases may ask - light (3), medium (5), thorough (10) or best judgement, broader with fewer, turri deciding what they leave open; then intent, stack, then testing - conformance tests on or off (into `config.turri.yaml`), their `***test reqs***` and the conformance testing script, which build nothing - then the product feature by feature, where every answer becomes one spec change - a git diff of the `.plain` files, written with `write_spec_diff` and rendered as a render spec diff pulse the moment it is written, with its conformance tests when they are on |
|
|
17
|
-
| `spawn` | its quick twin: asks
|
|
17
|
+
| `spawn` | its quick twin, for something running in minutes: asks what you want to build only when your message does not say, and chooses the stack itself unless you named one - conformance tests off, unless you ask for them - then writes the smallest thing that runs, which starts the first build at once, and the main slice of what you described and one more on their happy path, each a spec diff queued as it is written - nothing you did not describe: named only the kind of software, you get it running, and say what it does. You try each as it lands, and say `go on` for the next slice it proposed, or what to change instead - every change is a spec diff, and what is left to build is worked out again from the spec |
|
|
18
18
|
| `mature` | for a spec you already have, rough or hand-written: on its own until it is fully rendered - renders what is not built, watches the agents building it, and when one struggles on something the spec leaves open, settles it in the spec as a spec diff, stops that build and renders it again; decides open choices itself and marks them in its report |
|
|
19
19
|
|
|
20
20
|
Peeking is safe while a question is open - a skill's or the chat's: `ctrl+h` opens the side panel over the question, which waits under it as it was - the panel says `your question is waiting`, and `ctrl+h` or `esc` takes you back to answer it. (The question has the keys, so turri catches `ctrl+h` itself while one is open.) The dialog holds the question alone - no hint and no invitation; the `ctrl+h` under the job panel breathes until it is first pressed.
|
|
@@ -151,7 +151,9 @@ A provider failure - no credits, bad key, rate limit - is raised with the provid
|
|
|
151
151
|
|
|
152
152
|
Each `plain_modules/<module>` is a git repository whose git directory is `.plaingit` rather than `.git`, so it stays plain files to your own repository. A commit is made after every step that changes the module - a render, a functionality regenerated, a conformance run, a regression repair, a spec change. `/lineage [module]` and `lineage` show it.
|
|
153
153
|
|
|
154
|
-
The last commit is also the last known good state. Every render, functionality regenerated, spec change and conformance run starts by putting the codebase it works in back to it, so if turri was stopped or restarted mid-pulse, whatever that pulse left half-written is undone first - and one that does not pass is undone the same way when it ends, commits and all. Only work that passed is committed. Installed dependencies and caches are not in the history and stay.
|
|
154
|
+
The last commit is also the last known good state. Every render, functionality regenerated, spec change and conformance run starts by putting the codebase it works in back to it, so if turri was stopped or restarted mid-pulse, whatever that pulse left half-written is undone first - and one that does not pass is undone the same way when it ends, commits and all. Only work that passed is committed. Installed dependencies and caches are not in the history and stay.
|
|
155
|
+
|
|
156
|
+
The history is turri's own: the hooks your git config names (`core.hooksPath` - gitleaks, husky) do not run on its commits. When work that passed cannot be committed all the same - a `.plaingit/index.lock` a git stopped mid-commit left, a full disk - the pulse does not land: the next start would undo it while turri took it as built. It is rolled back, and the stop says what git said and how to fix it. Any other step's commit failing leaves only a gap in the history. With git directly:
|
|
155
157
|
|
|
156
158
|
```bash
|
|
157
159
|
git --git-dir=plain_modules/<module>/.plaingit --work-tree=plain_modules/<module> log
|
|
@@ -58,6 +58,7 @@ GOOD — statements of fact with concrete subjects:
|
|
|
58
58
|
- The first spec must still imply a testable outcome; setup alone is not a functional spec
|
|
59
59
|
- Prefer one minimal entry point or public operation with a deterministic result that can be invoked and verified
|
|
60
60
|
- Defer persistence, integrations, multiple interfaces, branching workflows, and cross-cutting behavior until later specs can build on the generated baseline
|
|
61
|
+
- A spec may start on its happy path and be hardened later - validation, edge cases and errors added to it by changing it - once the software has been tried; it must still say exactly what it does for the input it covers
|
|
61
62
|
- This extra bootstrap cost applies when no previous implementation baseline exists; a module that continues from a `requires` module may already inherit the necessary scaffold
|
|
62
63
|
|
|
63
64
|
## Chronological ordering
|