Harness spec 1.1.0: one plan, prototypes and the library shared; the CLI implements it

The spec: plan_write and plan_update (new, shared, offered in every mode) and
plan_submit (now shared) keep one structured plan — findings, objectives,
phases of tasks — in place of the todo list, which lives on as a former name
of plan_write. The shared system text is one text for both projects, with
variables for what differs; the mode texts, a prototypes block and a library
block are shared. acp.md: the client hands the device what only it knows
(context, library, prototypes), the plan travels as a structure (plan_state),
library calls carry the chat's scope, and a client may rewind a session.
loop.json says its numbers as numbers. Four conformance areas: plan,
prototype, library_scope, toolcall_index.

The CLI: the plan is kept per session in the store and drawn above the prompt
and on the approval card; the prompt is assembled from the spec's texts with
their variables filled; the link reads the instance's instructions,
personalization, knowledge scope and prototype offer, sends the plan as a
structure and answers rewind; library calls to the instance carry the session
as scope; a prototype written in the terminal is saved as a file and named in
the transcript; a tool-call fragment without an index continues the last call;
the default theme is Moria; dead exports and Hermes leftovers removed.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
HomerandClaude Fable 5.1 committed 2026-10-18 04:02:12 +02:00
1 parent 6e70ff46d0
commit 837f38c744
96 files changed
+3259 -527

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
// A prompt text's `{{variables}}` filled in (harness spec, prompts/index.json): a fact the two
// projects differ in — the opening line, where the output is shown, the plan — written into the
// shared text before it is sent. Two rules beyond a plain replace: a line that is nothing but a
// bullet and a variable (`- {{name}}`) disappears when the variable is empty, so one text serves a
// project that has the fact and one that does not; and a variable with no value is an error, since
// it would reach the model as a literal `{{name}}`.
const BULLET_ONLY = /^[ \t]*[-*][ \t]+\{\{(\w+)\}\}[ \t]*$/
export function fillPrompt(text: string, vars: Record<string, string>): string {
const missing = new Set<string>()
const value = (k: string): string | undefined => {
if (!Object.hasOwn(vars, k)) {
missing.add(k)
return undefined
}
return vars[k]!
}
const lines = text.split("\n")
const out: string[] = []
for (const line of lines) {
const bullet = BULLET_ONLY.exec(line)
if (bullet) {
const v = value(bullet[1]!)
if (v === undefined || v.trim() === "") continue
}
out.push(line.replace(/\{\{(\w+)\}\}/g, (m, k: string) => value(k) ?? m))
}
if (missing.size) throw new Error(`prompt: no value for {{${[...missing].join("}}, {{")}}}`)
return out.join("\n")
}