Skip to content

Use Garry Tan's exact Claude Code setup: 23 opinionated tools that serve as CEO, Designer, Eng Manager, Release Manager, Doc Engineer, and QA

TypeScript

First versions open with the owner's own words, and the try-it check follows his exact steps (GST-3608) (#4759)

Garry Tane78a1bfe326d
diff --git a/README.md b/README.md
index 4c8a3f23a..860172d31 100644
--- a/README.md
+++ b/README.md
@@ -275,7 +275,7 @@ On Windows without Developer Mode (MSYS2 / Git Bash), `setup` falls back to file
| [First Production Deploy](docs/howto-bring-up-a-first-deploy.md) | What to do when `/setup-deploy` says nothing is deployed yet: hosting, env and secrets, DNS, checking it works, then back to `/setup-deploy` |
| [Land a fix in someone else's repo](docs/howto-land-a-fix-in-someone-elses-repo.md) | Read their rules, search for the same fix, run every guard their CI runs before opening, keep it small, answer each review point in a new commit |
| [Run a human playtest](docs/howto-run-human-playtests.md) | Ask about moments and where people would stop, and why a back-to-back pick between two builds measures the order, not the build |
-| [Check a build before its owner tries it](docs/first-use-check.md) | `gstack-first-use`: an agent from another model family plays the exact build cold, does the first five day-one actions with evidence, checks every link, and only then prints the "try this build" message |
+| [Check a first version before its owner tries it](docs/first-use-check.md) | `gstack-first-use`: the try-it message opens with the owner's own words, and an agent from another model family follows its exact steps on the real target, records a verdict per step, checks every link, and only then prints the message |
| [Builder Ethos](ETHOS.md) | Builder philosophy: Boil the Ocean, Search Before Building, three layers of knowledge |
| [GBrain quick tour](docs/gbrain-quick-tour.md) | The four setup paths, MCP registration, the per-repo trust policy, memory sync, Conductor env vars |
| [Using GBrain with GStack](USING_GBRAIN_WITH_GSTACK.md) | Every path, flag, bin helper, and troubleshooting step for `/setup-gbrain` |
diff --git a/autoplan/DRIVER.md b/autoplan/DRIVER.md
index 2a42ab5ad..ca47a067e 100644
--- a/autoplan/DRIVER.md
+++ b/autoplan/DRIVER.md
@@ -14,13 +14,13 @@ ends with `(<CODE>)`.
## Phases and scope
Order: ceo → design → dx → eng. Design runs only with UI scope, DX only with DX scope, Eng always and last.
-Scope flags on the first `next`: `--ui`, `--no-ui`, `--no-dx`, `--developer-tool`, `--agent-primary`, `--docs-only`. `--developer-tool` and `--agent-primary` only enable DX.
+Scope flags on the first `next`: `--ui`, `--no-ui`, `--no-dx`, `--developer-tool`, `--agent-primary`, `--docs-only`, `--first-version`. `--developer-tool` and `--agent-primary` only enable DX.
The first `next` prints `SCOPE: ui=… (terms; visual; files) dx=… (detected) docs_only=yes|no (<s>) source=ui:<s>,dx:<s>`
(each is `flag`, `marker` or `detected`). Docs-only (`--docs-only`, or every Implementation-plan path is README*, CHANGELOG*,
TODOS*, docs/** but not docs/*-policy.md, or other markdown outside a skill dir) runs CEO on the native voice only, then Eng. UI needs a rendered file path (including a named non-test `.ts`/`.js` file that holds a tagged `html`, `css` or `svg` template, such as Lit or htm) or a UI term next
to a visual noun in the Implementation plan. To keep flags for later runs on the same plan, add
the `SCOPE_PIN:` marker it prints (`<!-- gstack-autoplan-scope: … -->`) as the plan's first
-line yourself; gstack never writes the plan. **Kinds (R65), first `next` only.** `--kind fix` reviews nothing: it prints `AUTOPLAN: not needed (bug fix; R65)`, a `PROOF:` line and `GSTACK_RESULT: skill=autoplan status=skipped run=-`, writes nothing and needs no `--out` or `--plan`; the PR still carries the bug's proof, a repro on current main or a failing test written first. `--kind feature`, the default for an unattended run on Capy (`GSTACK_CAPY=1`) that names no kind, is the lean run. Its `phase_order` is `eng` alone with one native reviewer, whose prompt merges the CEO and Eng lenses (Design or DX only when scope detects them), each a short role or brief plus that review skill's checklist, never the skill's own method, always asks "Any outside terms, licences or rights involved?" and shows the draft code. The draft is `git diff` from the merge base with `--base <ref>` (default: `gstack-diff-scope`'s base, never an `origin/HEAD` naming the checked-out branch), untracked files included and the run directory left out, written to the snapshot as `draft.diff` and hashed; with no code yet it says `DRAFT: none (<why>)`. The first `next` prints `LEAN:` and each opened phase `DRAFT:`; the reviewer's line after INPUT must be `DRAFT: <sha256>` or `DRAFT: none`, or submit refuses it (`RESULT_RECEIPT_MISSING`). No outside voice, `--max-rounds 1`, no carry check and one gate revision: `revise --incorporates` applies the accepted changes without re-review and approves. `--full` brings back every phase and both voices: each native reviewer gets a five-question brief and its phase's checklist, each outside reviewer a one-paragraph role, and neither the skill's own method. Off Capy, and in an interactive session, the default stays full.
+line yourself; gstack never writes the plan. **First versions** (a `### Day one` section or `--first-version`): the plan quotes the owner under `### Owner's words`, one bullet each, `- <who>, <when>: "<words>" → does it | choice[; size: <n>][; leave out: <reason>]`; the gate letters each quote this version doesn't fully do and every cut, the five day-one rows cite `owner words <n>`, and the build clears `gstack-first-use` before the owner is asked to try it ([docs/first-use-check.md](../docs/first-use-check.md)). **Kinds (R65), first `next` only.** `--kind fix` reviews nothing: it prints `AUTOPLAN: not needed (bug fix; R65)`, a `PROOF:` line and `GSTACK_RESULT: skill=autoplan status=skipped run=-`, writes nothing and needs no `--out` or `--plan`; the PR still carries the bug's proof, a repro on current main or a failing test written first. `--kind feature`, the default for an unattended run on Capy (`GSTACK_CAPY=1`) that names no kind, is the lean run. Its `phase_order` is `eng` alone with one native reviewer, whose prompt merges the CEO and Eng lenses (Design or DX only when scope detects them), each a short role or brief plus that review skill's checklist, never the skill's own method, always asks "Any outside terms, licences or rights involved?" and shows the draft code. The draft is `git diff` from the merge base with `--base <ref>` (default: `gstack-diff-scope`'s base, never an `origin/HEAD` naming the checked-out branch), untracked files included and the run directory left out, written to the snapshot as `draft.diff` and hashed; with no code yet it says `DRAFT: none (<why>)`. The first `next` prints `LEAN:` and each opened phase `DRAFT:`; the reviewer's line after INPUT must be `DRAFT: <sha256>` or `DRAFT: none`, or submit refuses it (`RESULT_RECEIPT_MISSING`). No outside voice, `--max-rounds 1`, no carry check and one gate revision: `revise --incorporates` applies the accepted changes without re-review and approves. `--full` brings back every phase and both voices: each native reviewer gets a five-question brief and its phase's checklist, each outside reviewer a one-paragraph role, and neither the skill's own method. Off Capy, and in an interactive session, the default stays full.
## The loop
@@ -102,7 +102,7 @@ RESULT FORMAT (required by gstack-autoplan; the parent binds your file by this c
```gstack-findings
{"id":"F1","severity":"High","title":"<one line>","file":"<path or omit>","line":12,"fix":"<the fix>"}
```
- severity is Critical | High | Medium | Low | Informational. Any finding that recommends changing the plan's scope, cost or direction adds "changes": "scope" | "cost" | "direction", or "packaging" | "ordering" when only its delivery packaging or build order changes, with no Implementation-plan edit; that holds at any severity. Only the owner's own words are the plan's direction: add "user_challenge": true and "owner_quote": <n> only when the change goes against bullet n (from 1) of the plan's "Owner's words" section. Scope, order or features the planning agent wrote are proposals, so a change to them is an ordinary finding with "changes" and no user_challenge. A plan with no "Owner's words" section: add "user_challenge": true (no owner_quote) when you recommend changing its stated direction. Naming and other reversible choices are ordinary findings with no "changes". Add "urgent": true and "suggested_owner": "<who>" for a security or data-loss finding this plan does not own. An empty fence means no findings; a missing fence is refused.
+ severity is Critical | High | Medium | Low | Informational. Any finding that recommends changing the plan's scope, cost or direction adds "changes": "scope" | "cost" | "direction", or "packaging" | "ordering" when only its delivery packaging or build order changes, with no Implementation-plan edit; that holds at any severity. Only the owner's own words are the plan's direction: add "user_challenge": true and "owner_quote": <n> only when the change goes against bullet n (from 1) of the plan's "Owner's words" section. Scope, order or features the planning agent wrote are proposals, so a change to them is an ordinary finding with "changes" and no user_challenge. Check every "What it won't do yet" cut and every "does it" line against each quoted owner bullet and any owner answer under DECIDED AT THE GATE: a cut or line that does less than bullet n asked is a finding with "narrows_quote": <n> and "changes": "scope" (no user_challenge), even when the two share no words. A plan with no "Owner's words" section: add "user_challenge": true (no owner_quote) when you recommend changing its stated direction. Naming and other reversible choices are ordinary findings with no "changes". Add "urgent": true and "suggested_owner": "<who>" for a security or data-loss finding this plan does not own. An empty fence means no findings; a missing fence is refused.
3. Write the whole result to this file: <result file>
## Gate replies
diff --git a/autoplan/DRIVER.md.tmpl b/autoplan/DRIVER.md.tmpl
index b8c3aa855..220a1a9d5 100644
--- a/autoplan/DRIVER.md.tmpl
+++ b/autoplan/DRIVER.md.tmpl
@@ -17,7 +17,7 @@ The first `next` prints `SCOPE: ui=… (terms; visual; files) dx=… (detected)
TODOS*, docs/** but not docs/*-policy.md, or other markdown outside a skill dir) runs CEO on the native voice only, then Eng. UI needs a rendered file path (including a named non-test `.ts`/`.js` file that holds a tagged `html`, `css` or `svg` template, such as Lit or htm) or a UI term next
to a visual noun in the Implementation plan. To keep flags for later runs on the same plan, add
the `SCOPE_PIN:` marker it prints (`<!-- gstack-autoplan-scope: … -->`) as the plan's first
-line yourself; gstack never writes the plan. **Kinds (R65), first `next` only.** `--kind fix` reviews nothing: it prints `AUTOPLAN: not needed (bug fix; R65)`, a `PROOF:` line and `GSTACK_RESULT: skill=autoplan status=skipped run=-`, writes nothing and needs no `--out` or `--plan`; the PR still carries the bug's proof, a repro on current main or a failing test written first. `--kind feature`, the default for an unattended run on Capy (`GSTACK_CAPY=1`) that names no kind, is the lean run. Its `phase_order` is `eng` alone with one native reviewer, whose prompt merges the CEO and Eng lenses (Design or DX only when scope detects them), each a short role or brief plus that review skill's checklist, never the skill's own method, always asks "Any outside terms, licences or rights involved?" and shows the draft code. The draft is `git diff` from the merge base with `--base <ref>` (default: `gstack-diff-scope`'s base, never an `origin/HEAD` naming the checked-out branch), untracked files included and the run directory left out, written to the snapshot as `draft.diff` and hashed; with no code yet it says `DRAFT: none (<why>)`. The first `next` prints `LEAN:` and each opened phase `DRAFT:`; the reviewer's line after INPUT must be `DRAFT: <sha256>` or `DRAFT: none`, or submit refuses it (`RESULT_RECEIPT_MISSING`). No outside voice, `--max-rounds 1`, no carry check and one gate revision: `revise --incorporates` applies the accepted changes without re-review and approves. `--full` brings back every phase and both voices: each native reviewer gets a five-question brief and its phase's checklist, each outside reviewer a one-paragraph role, and neither the skill's own method. Off Capy, and in an interactive session, the default stays full.
+line yourself; gstack never writes the plan. **First versions** (a `### Day one` section or `--first-version`): the plan quotes the owner under `### Owner's words`, one bullet each, `- <who>, <when>: "<words>" → does it | choice[; size: <n>][; leave out: <reason>]`; the gate letters each quote this version doesn't fully do and every cut, the five day-one rows cite `owner words <n>`, and the build clears `gstack-first-use` before the owner is asked to try it ([docs/first-use-check.md](../docs/first-use-check.md)). **Kinds (R65), first `next` only.** `--kind fix` reviews nothing: it prints `AUTOPLAN: not needed (bug fix; R65)`, a `PROOF:` line and `GSTACK_RESULT: skill=autoplan status=skipped run=-`, writes nothing and needs no `--out` or `--plan`; the PR still carries the bug's proof, a repro on current main or a failing test written first. `--kind feature`, the default for an unattended run on Capy (`GSTACK_CAPY=1`) that names no kind, is the lean run. Its `phase_order` is `eng` alone with one native reviewer, whose prompt merges the CEO and Eng lenses (Design or DX only when scope detects them), each a short role or brief plus that review skill's checklist, never the skill's own method, always asks "Any outside terms, licences or rights involved?" and shows the draft code. The draft is `git diff` from the merge base with `--base <ref>` (default: `gstack-diff-scope`'s base, never an `origin/HEAD` naming the checked-out branch), untracked files included and the run directory left out, written to the snapshot as `draft.diff` and hashed; with no code yet it says `DRAFT: none (<why>)`. The first `next` prints `LEAN:` and each opened phase `DRAFT:`; the reviewer's line after INPUT must be `DRAFT: <sha256>` or `DRAFT: none`, or submit refuses it (`RESULT_RECEIPT_MISSING`). No outside voice, `--max-rounds 1`, no carry check and one gate revision: `revise --incorporates` applies the accepted changes without re-review and approves. `--full` brings back every phase and both voices: each native reviewer gets a five-question brief and its phase's checklist, each outside reviewer a one-paragraph role, and neither the skill's own method. Off Capy, and in an interactive session, the default stays full.
## The loop
diff --git a/bin/gstack-autoplan b/bin/gstack-autoplan
index a9f3d7830..51312da2b 100755
--- a/bin/gstack-autoplan
+++ b/bin/gstack-autoplan
@@ -3,7 +3,7 @@
* gstack-autoplan — the unattended /autoplan runner as an explicit, durable state machine (plan B2).
*
* gstack-autoplan next --kind fix a bug fix: no plan review (R65), status=skipped, nothing written (run --kind fix too)
- * gstack-autoplan next --out <dir> [--plan <file>] [--kind feature|--full] [--base <ref>] [--plan-heading <text>] [--ui|--no-ui] [--developer-tool] [--agent-primary] [--docs-only] [--ceo-only]
+ * gstack-autoplan next --out <dir> [--plan <file>] [--kind feature|--full] [--base <ref>] [--plan-heading <text>] [--ui|--no-ui] [--developer-tool] [--agent-primary] [--docs-only] [--first-version] [--ceo-only]
* [--no-outside] [--light] [--spend-cap <usd>] [--estimate-usd <n>] [--deadline <min>] [--redispatch <attempt>] [--json]
* gstack-autoplan submit --out <dir> --phase <p> --voice native|outside --result <file> | --record <file> [--attest <reason>]
* --model <id> [--attempt <id>] [--runner <r>] [--usage-usd <n>] [--reconcile <jsonl>] [--json]
@@ -65,7 +65,7 @@ DRIVER: ${driverFile()}
next --kind fix a bug fix needs no plan review (R65): prints AUTOPLAN: not needed and status=skipped, writes nothing (no --out or --plan);
the PR still needs the bug's proof (a repro on current main or a failing test written first)
- next --out <dir> [--plan <file>] [--kind feature|--full] [--base <ref>] [--plan-heading <text>] [--scaffold] [--ui|--no-ui] [--developer-tool] [--agent-primary] [--no-dx] [--docs-only] [--ceo-only]
+ next --out <dir> [--plan <file>] [--kind feature|--full] [--base <ref>] [--plan-heading <text>] [--scaffold] [--ui|--no-ui] [--developer-tool] [--agent-primary] [--no-dx] [--docs-only] [--first-version] [--ceo-only]
[--no-outside] [--light] [--spend-cap <usd>] [--max-rounds <n>] [--estimate-usd <n>] [--deadline <min>] [--redispatch <attempt>] [--json]
--kind feature (first next; the default for an unattended Capy run, GSTACK_CAPY=1): the lean run (R65): the eng phase alone with one
native reviewer whose brief merges the CEO and Eng lenses (Design/DX when scope detects them), reads the draft code (git diff of
@@ -74,6 +74,7 @@ DRIVER: ${driverFile()}
--full (first next): every phase and both voices, as before R65; off Capy, or in an interactive session, the default stays full
--max-rounds (first next): review rounds per phase (default 2 unattended, 1 lean); at the cap a phase closes accepted-with-findings
--docs-only (first next; also detected when every Implementation-plan path is docs-class): CEO (native voice only) + Eng
+ --first-version (first next, or the scope marker): the plan is a first version even without a ### Day one section, so the gate asks for the owner's quoted words, a line per quote and a letter per cut
--ceo-only (first next, command line only): the CEO phase alone, no gate; ends status=reviewed with <out>/ceo-review.md, never approved
--estimate-usd: reserved per new attempt, kept for the rest of the run; with --spend-cap any run (or an unattended run on Capy) reserves a default so the cap binds
--scaffold (first next): a plan missing one of its two sections is reviewed from <out>/plan-source.md with the heading added
@@ -261,7 +262,7 @@ function doNext(out: string, rest: string[], price?: NextOptions['price']): Repo
if (shadow.line) initLines.push(shadow.line);
initRun({ plan, out, cwd, kind: flag(rest, '--kind') as AutoplanKind | undefined, full: rest.includes('--full'), base: flag(rest, '--base'), planHeading: flag(rest, '--plan-heading'), outsideEnabled: !rest.includes('--no-outside'), spendCap: num(rest, '--spend-cap') ?? null, maxRounds,
carryForward: !rest.includes('--no-carry-forward'), carryCheckCapUsd, ceoOnly, shadow: shadow.shadow,
- deadlineMin: num(rest, '--deadline'), light: rest.includes('--light'), scaffold: rest.includes('--scaffold'), scope: { ui, developerTool: rest.includes('--developer-tool'), agentPrimary: rest.includes('--agent-primary'), dx: rest.includes('--no-dx') ? false : undefined, ...(rest.includes('--docs-only') ? { docsOnly: true } : {}) } }, initLines);
+ deadlineMin: num(rest, '--deadline'), light: rest.includes('--light'), scaffold: rest.includes('--scaffold'), scope: { ui, developerTool: rest.includes('--developer-tool'), agentPrimary: rest.includes('--agent-primary'), dx: rest.includes('--no-dx') ? false : undefined, ...(rest.includes('--docs-only') ? { docsOnly: true } : {}), ...(rest.includes('--first-version') ? { firstVersion: true } : {}) } }, initLines);
}
const redispatch = rest.flatMap((a, i) => (a === '--redispatch' && rest[i + 1] ? [rest[i + 1]!] : []));
const r = nextStep({ out, cwd, estimateUsd: num(rest, '--estimate-usd'), redispatch, price });
diff --git a/bin/gstack-first-use b/bin/gstack-first-use
index 55285ada7..0ad90a4ab 100755
--- a/bin/gstack-first-use
+++ b/bin/gstack-first-use
@@ -1,11 +1,13 @@
#!/usr/bin/env -S bun --no-env-file --config=/dev/null
/**
- * gstack-first-use — the cold first-use check for an app build (docs/first-use-check.md).
+ * gstack-first-use — the cold first-use check for a first version or app build (docs/first-use-check.md).
*
- * gstack-first-use start --app <slug> --plan <plan.md> --play <play.json> --platform ios|android|web --commit <sha>
- * (--testflight <build> | --deploy <version>) --builder <model> --checker <model> [--json]
+ * gstack-first-use start --app <slug> --plan <plan.md> --play <play.json> --platform ios|android|web|macos|server --commit <sha>
+ * (--testflight <build> | --deploy <version>) --holding <build label|none> --holding-defects <list|none>
+ * --builder <model> --checker <model> [--json]
* gstack-first-use brief --run <dir>
- * gstack-first-use record --run <dir> --action <n> --verdict pass|fail --evidence <file> --device <text> --account <text> --by <model> [--note <text>] [--json]
+ * gstack-first-use record --run <dir> --step <n> --verdict useful|thin|wrong|broken --line <text> --evidence <file> --device <text>
+ * --account <text> --target <text> --by <model> [--needs-lookup <text>] [--notice <text>] [--json]
* gstack-first-use predict --run <dir> --score <1-10> --why <text> --by <model> [--json]
* gstack-first-use links --run <dir> --account <owner-equivalent account> --device-class ios|android|web [--json]
* gstack-first-use check --run <dir> --platform … --commit … (--testflight … | --deploy …) [--json]
@@ -14,10 +16,12 @@
* gstack-first-use show --run <dir> [--json]
* gstack-first-use root
*
- * start freezes the first five rows of the plan's ### Day one table and the build fingerprint into a
- * write-once manifest; brief prints what the checker from the other model family gets; record, predict
- * and links write its evidence, predicted score and dated link receipts; check prints FIRST_USE: pass
- * or refuses (FIRST_USE_REFUSED); message prints the "try this build" text only when check passes;
+ * start freezes the owner's quoted words, the play spec's numbered try-it steps, the first five rows of
+ * the plan's ### Day one table (each citing a quote), the try-it text, the build fingerprint and the build
+ * the owner holds now into a write-once manifest; brief prints what the checker from the other model
+ * family gets; record, predict and links write its per-step verdicts with evidence, predicted score and
+ * dated link receipts; check prints FIRST_USE: pass or refuses (FIRST_USE_REFUSED); message prints the
+ * try-it text with what the check found only when check passes;
* score keeps the owner's score and words beside the prediction. Records live in the owner's private
* user-level Capy Drive folder (GSTACK_FIRST_USE_DIR overrides). Logic: lib/first-use.ts.
*/
@@ -28,16 +32,18 @@ import { buildLabel, checkLinks, decide, ownerScore, predict, readManifest, reco
import { renderBrief, renderPlayMessage } from '../lib/first-use-message';
import { resultLine } from '../lib/result-codes';
-const HELP = `gstack-first-use — a cold first-use check on an app build before its owner tries it (docs/first-use-check.md)
+const HELP = `gstack-first-use — a cold first-use check: the owner's exact try-it steps, run on the real target before the owner is asked (docs/first-use-check.md)
- start --app <slug> --plan <plan.md> --play <play.json> --platform ios|android|web --commit <sha>
- (--testflight <build> | --deploy <version>) --builder <model> --checker <model> [--json]
+ start --app <slug> --plan <plan.md> --play <play.json> --platform ios|android|web|macos|server --commit <sha>
+ (--testflight <build> | --deploy <version>) --holding <build label|none> --holding-defects <list|none>
+ --builder <model> --checker <model> [--json]
brief --run <dir> what the checker from the other model family is given
- record --run <dir> --action <n> --verdict pass|fail --evidence <file> --device <text> --account <text> --by <model> [--note <text>]
+ record --run <dir> --step <n> --verdict useful|thin|wrong|broken --line <text> --evidence <file> --device <text> --account <text>
+ --target <text> --by <model> [--needs-lookup <text>] [--notice <text>]
predict --run <dir> --score <1-10> --why <text> --by <model>
- links --run <dir> --account <text> --device-class ios|android|web check every play link now, as the owner-equivalent audience
+ links --run <dir> --account <text> --device-class ios|android|web|macos|server check every play link now, as the owner-equivalent audience
check --run <dir> --platform … --commit … (--testflight … | --deploy …) FIRST_USE: pass, or refused
- message --run <dir> --platform … --commit … (--testflight … | --deploy …) the "try this build" text, only after a pass
+ message --run <dir> --platform … --commit … (--testflight … | --deploy …) the try-it message, only after a pass
score --run <dir> --score <1-10> --words "<owner's exact words>" --by <who relayed them>
show --run <dir> [--json]
root where records live
@@ -62,19 +68,20 @@ function runDir(cmd: string, a: string[]): string | number {
}
function cmdStart(a: string[], json: boolean): number {
- const need = ['--app', '--plan', '--play', '--platform', '--commit', '--builder', '--checker'].filter(f => !flag(a, f));
+ const need = ['--app', '--plan', '--play', '--platform', '--commit', '--holding', '--holding-defects', '--builder', '--checker'].filter(f => !flag(a, f));
if (need.length) { process.stderr.write(`gstack-first-use: start needs ${need.join(', ')}\n`); return EXIT.usage; }
const root = recordRoot();
if ('error' in root) return refuse('start', root.error);
let play: unknown;
try { play = JSON.parse(fs.readFileSync(flag(a, '--play')!, 'utf8')); } catch { return refuse('start', { code: 'FIRST_USE_PLAY_SPEC_INCOMPLETE', detail: `${flag(a, '--play')} is not a readable JSON play spec` }); }
- const r = startRun({ root: root.root, app: flag(a, '--app')!, planPath: flag(a, '--plan')!, build: buildArgs(a), play, builder: flag(a, '--builder')!, checker: flag(a, '--checker')! });
+ const r = startRun({ root: root.root, app: flag(a, '--app')!, planPath: flag(a, '--plan')!, build: buildArgs(a), play, holding: { build: flag(a, '--holding'), defects: flag(a, '--holding-defects') }, builder: flag(a, '--builder')!, checker: flag(a, '--checker')! });
if ('error' in r) return refuse('start', r.error);
- if (json) { say(JSON.stringify({ run: r.dir, actions: r.manifest.actions.length, rows_sha256: r.manifest.source.rows_sha256, build: r.manifest.build })); return EXIT.ok; }
+ const m = r.manifest;
+ if (json) { say(JSON.stringify({ run: r.dir, steps: m.steps.length, actions: m.actions.length, quotes: m.quotes.length, rows_sha256: m.source.rows_sha256, try_sha256: m.try_sha256, target: m.play.target, build: m.build })); return EXIT.ok; }
say(`FIRST_USE_RUN: ${r.dir}`);
- say(`FIRST_USE_FROZEN: ${r.manifest.actions.length} actions rows=${r.manifest.source.rows_sha256.slice(0, 12)} build=${buildLabel(r.manifest.build)} checker=${r.manifest.checker.model}`);
- r.manifest.actions.forEach(x => say(` ${x.n}. ${x.action}`));
- say(`NEXT: gstack-first-use brief --run "${r.dir}" (give it to one fresh agent on ${r.manifest.checker.model}, never a ${r.manifest.builder.family} model)`);
+ say(`FIRST_USE_FROZEN: ${m.steps.length} steps (${m.actions.length} day-one actions) quotes=${m.quotes.length} rows=${m.source.rows_sha256.slice(0, 12)} try=${m.try_sha256.slice(0, 12)} target=${m.play.target.kind}:${m.play.target.name} build=${buildLabel(m.build)} checker=${m.checker.model}`);
+ m.steps.forEach(x => say(` ${x.n}. ${x.text}${x.writes === 'none' ? '' : ` (writes: ${x.writes})`}`));
+ say(`NEXT: gstack-first-use brief --run "${r.dir}" (give it to one fresh agent on ${m.checker.model}, never a ${m.builder.family} model)`);
return EXIT.ok;
}
@@ -83,11 +90,12 @@ function cmdShow(dir: string, json: boolean): number {
if ('error' in read) return refuse('show', read.error);
const m = read.manifest;
const d = decide(dir, m.build);
- const summary = { app: m.app, build: buildLabel(m.build), checker: m.checker.model, actions: m.actions.length, passed: d.passed, reasons: d.reasons,
+ const summary = { app: m.app, build: buildLabel(m.build), checker: m.checker.model, steps: m.steps.length, passed: d.passed, verdicts: d.verdicts, reasons: d.reasons,
predicted: d.prediction?.score ?? null, owner: d.owner ? { score: d.owner.score, words: d.owner.words, at: d.owner.at } : null,
gap: d.prediction && d.owner ? d.owner.score - d.prediction.score : null };
if (json) { say(JSON.stringify(summary)); return EXIT.ok; }
- say(`FIRST_USE_SHOW: app=${m.app} build=${summary.build} passed=${d.passed}/${m.actions.length} predicted=${summary.predicted ?? 'none'} owner=${summary.owner?.score ?? 'none'}${summary.gap === null ? '' : ` gap=${summary.gap > 0 ? '+' : ''}${summary.gap}`}`);
+ say(`FIRST_USE_SHOW: app=${m.app} build=${summary.build} passed=${d.passed}/${m.steps.length} predicted=${summary.predicted ?? 'none'} owner=${summary.owner?.score ?? 'none'}${summary.gap === null ? '' : ` gap=${summary.gap > 0 ? '+' : ''}${summary.gap}`}`);
+ for (const v of d.verdicts) say(`STEP: ${v.n} ${v.verdict} ${v.line}`);
if (summary.owner) say(`OWNER_WORDS: ${summary.owner.words}`);
for (const r of d.reasons) say(`OPEN: ${r}`);
return EXIT.ok;
@@ -111,10 +119,11 @@ async function main(argv: string[]): Promise<number> {
return EXIT.ok;
}
if (cmd === 'record') {
- const n = Number(flag(a, '--action'));
- const r = recordResult({ dir, action: Number.isInteger(n) ? n : -1, verdict: flag(a, '--verdict') ?? '', evidence: flag(a, '--evidence') ?? '', device: flag(a, '--device') ?? '', account: flag(a, '--account') ?? '', by: flag(a, '--by') ?? '', note: flag(a, '--note') });
+ const n = Number(flag(a, '--step'));
+ const r = recordResult({ dir, step: Number.isInteger(n) ? n : -1, verdict: flag(a, '--verdict') ?? '', line: flag(a, '--line') ?? '', evidence: flag(a, '--evidence') ?? '', device: flag(a, '--device') ?? '',
+ account: flag(a, '--account') ?? '', target: flag(a, '--target') ?? '', by: flag(a, '--by') ?? '', needsLookup: flag(a, '--needs-lookup'), notice: flag(a, '--notice') });
if ('error' in r) return refuse(cmd, r.error);
- say(json ? JSON.stringify(r.result) : `FIRST_USE_RESULT: action=${r.result.action} verdict=${r.result.verdict} evidence=${r.result.evidence.file} sha256=${r.result.evidence.sha256.slice(0, 12)}`);
+ say(json ? JSON.stringify(r.result) : `FIRST_USE_RESULT: step=${r.result.step} verdict=${r.result.verdict} evidence=${r.result.evidence.file} sha256=${r.result.evidence.sha256.slice(0, 12)}`);
return EXIT.ok;
}
if (cmd === 'predict') {
@@ -140,8 +149,8 @@ async function main(argv: string[]): Promise<number> {
if (!d.ok) return refuse(cmd, { code: 'FIRST_USE_REFUSED', detail: d.reasons.join('; ') });
if (cmd === 'message') { process.stdout.write(renderPlayMessage(d)); return EXIT.ok; }
const m = d.manifest!;
- say(json ? JSON.stringify({ ok: true, app: m.app, build: m.build, passed: d.passed, links: d.links.length, predicted: d.prediction?.score })
- : `FIRST_USE: pass app=${m.app} build=${buildLabel(m.build)} actions=${d.passed}/${m.actions.length} links=${d.links.length}/${m.play.links.length} checker=${m.checker.model} predicted=${d.prediction?.score}`);
+ say(json ? JSON.stringify({ ok: true, app: m.app, build: m.build, passed: d.passed, verdicts: d.verdicts, links: d.links.length, predicted: d.prediction?.score })
+ : `FIRST_USE: pass app=${m.app} build=${buildLabel(m.build)} steps=${d.passed}/${m.steps.length} thin=${d.verdicts.filter(v => v.verdict === 'thin').length} notices=${d.verdicts.filter(v => v.notice).length} links=${d.links.length}/${m.play.links.length} checker=${m.checker.model} predicted=${d.prediction?.score}`);
return EXIT.ok;
}
diff --git a/capy/skill/gstack/captain.md b/capy/skill/gstack/captain.md
index de9046a2a..4c0ad5948 100644
--- a/capy/skill/gstack/captain.md
+++ b/capy/skill/gstack/captain.md
@@ -177,8 +177,12 @@ owner; it never raises the cap itself. The owner's answer runs the RECOVER line
## 5. Asks to try a build
-An ask for the owner to try an app build, and any "v1 is ready" report, goes out only after the build clears
-`gstack-first-use` (`docs/first-use-check.md` in the checkout): an agent from another model family plays that exact
-build cold on the same kind of device and does the plan's first five day-one actions, with a screenshot or video of
-each. Send the text `gstack-first-use message` prints, unchanged; when it refuses, fix the build and replay instead of
-asking. Record the owner's score and words with `gstack-first-use score`, never in a PR or the repository.
+An ask for the owner to try a first version or an app build, and any "v1 is ready" report, goes out only after the
+build clears `gstack-first-use` (`docs/first-use-check.md` in the checkout): an agent from another model family follows
+the exact try-it message, step by step, on the real target (the owner's setup, or a copy loaded with realistic data when
+a step writes; his own Mac through Aside for anything installed there) and records useful, thin, wrong or broken and one
+line per step. The message opens with the owner's quoted words and what this version does with each, names every thin
+step and every notice he'll see, and names the known defects in the build he holds now. Send the text
+`gstack-first-use message` prints, unchanged; when it refuses, fix the build or the step and replay instead of asking.
+Any report of a passing test on a build he doesn't hold yet names the build he does hold and its known defects. Record
+the owner's score and words with `gstack-first-use score`, never in a PR or the repository.
diff --git a/capy/skill/gstack/factory.md b/capy/skill/gstack/factory.md
index 8e7c536bd..e19e5d985 100644
--- a/capy/skill/gstack/factory.md
+++ b/capy/skill/gstack/factory.md
@@ -19,3 +19,4 @@ Your crew's CREW.md and recorded approvals decide who may merge, update a base,
15. **Subagents earn their context.** Start one only for parallel work you can throw away, a fresh-eyes review or another model family, never for a step of your own procedure; name the compact result it returns. [crew/docs/captain.md: Lane context]
16. **Drain the queue.** Captains run `gstack-ship-queue count` every sweep and standing wake; a `DRAIN:` line means drain that turn: low-risk PRs land alone, risky ones in bundles of 3 to 6, idle owners get their next step. [crew/docs/captain.md: Drain the queue]
17. **Write it up before you shelve it.** Before an attempt closes as failed, shelved, cut, null or not now, a short write-up of what worked, what didn't and what would reopen it exists, and the close links it. [docs/shelved-attempt.md]
+18. **First versions start from the owner's words.** The plan quotes his messages that state the job, each with a line (does it, or a lettered choice), and before he is asked to try it an agent from another model family runs the exact try-it steps on his real setup [docs/first-use-check.md].
diff --git a/capy/skill/gstack/lane-card.md b/capy/skill/gstack/lane-card.md
index d6413c376..0145ef76c 100644
--- a/capy/skill/gstack/lane-card.md
+++ b/capy/skill/gstack/lane-card.md
@@ -19,6 +19,7 @@ For a crew lane (a thread working for a Captain). Read this once `gstack: ok <re
- /ship runs at the final pushed head before any READY; `SHIP_RECEIPT: pr=<n> head=<head>` names that head, and a later push needs a new /ship.
- Run /ship in this thread (`ship/DRIVER.md`), with its reviewers as your subagents, never in a subagent of its own. After the receipt, read the PR's checks and comments once and run `gstack-ship-queue ready`.
- Never merge. The controller merges on a recorded standing approval.
+- A first version (an app, a Mac helper, a new route on the owner's box): the plan quotes the owner's messages under `### Owner's words` with a line each, and the build clears `gstack-first-use` (`docs/first-use-check.md`) before any ask to try it or "v1 is ready" report.
- UI work (recommended, never a READY prerequisite): once the change renders, run `install.sh --check --for design-review` and `gstack-browser-ensure`, launch with the printed `GSTACK_LAUNCH` line, then `/design-review --build <preview url>`, and paste its one `DESIGN_BUILD:` line in READY. A start that prints `GSTACK_RESULT: skill=design-review status=refused` is `DESIGN_BUILD: unrendered code=INSTALL` (`gstack-design-build admit <saved start output>` prints it). `incomplete` does not count as having run it.
## Under a Captain
diff --git a/changelog.d/first-versions-quote-owner-and-run-real-try-steps.md b/changelog.d/first-versions-quote-owner-and-run-real-try-steps.md
new file mode 100644
index 000000000..5a4137b4c
--- /dev/null
+++ b/changelog.d/first-versions-quote-owner-and-run-real-try-steps.md
@@ -0,0 +1 @@
+**A first version's plan and try-it message now open with the owner's own words, and the build is tried the same way he will try it before he is asked.** A plan with a `### Day one` section (or `/autoplan --first-version`) quotes each of the owner's messages that state the job, with a line saying whether this version does it, or leaves it as a choice with its size. Reviewers check every cut against those quotes, and the approval page gives every cut its own letter. `gstack-first-use` now freezes the quotes and the exact try-it text, runs those steps on the real device or service (iOS, Android, web, macOS or a server), records a verdict and a plain line for each step, and refuses to send the message while any step the owner asked for is thin, wrong or broken. On the owner's real setup the check only reads, unless he approved a write by letter. The factory page, the lane card, the Captain guide, the /autoplan driver and /ship's TestFlight step now point at it (docs/first-use-check.md).
diff --git a/crew/docs/captain.md b/crew/docs/captain.md
index c347d5f2b..ca4180865 100644
--- a/crew/docs/captain.md
+++ b/crew/docs/captain.md
@@ -444,6 +444,18 @@ machine starts without it, put `GSTACK_PLAN_RECORD` in the project env. On a pub
render writes `Plan: approved (record r-<id>)` in place of the brief's run id, and ready
resolves that id to the same approval row.
+**First versions.** A first version of anything a person uses (an app, a Mac helper, a new
+route on the owner's box) is a plan with a `### Day one` section, or `--first-version`. Its
+plan quotes the owner's own messages that state the job under `### Owner's words`, each with
+its time and a line: `does it`, `choice` (a lettered choice recommending the build unless the
+line gives a reason to leave it out). Nothing his words
+asked for sits under "What it won't do yet"; the gate letters it, and every cut on a first
+version gets its own letter. The five day-one rows cite those quotes. Before the owner is asked
+to try it, the build clears `gstack-first-use` ([docs/first-use-check.md](../../docs/first-use-check.md)):
+an agent from another model family follows the exact try-it message on the real target and
+records a verdict per step. A one-page day-one plan written without `/autoplan` (an app build
+under the owner's standing rule) carries the same two sections, so the same check reads it.
+
The copy-paste brief is [`captain/templates/brief.md`](../../captain/templates/brief.md): the
plan and the ask as step 1, the build after the word as step 2, /ship to READY as step 3,
and a done line that names the approval row or the exemption.
diff --git a/docs/first-use-check.md b/docs/first-use-check.md
index 467bf40b5..0428a15a7 100644
--- a/docs/first-use-check.md
+++ b/docs/first-use-check.md
@@ -1,63 +1,88 @@
-# Check an app build before its owner tries it
+# Check a first version before its owner tries it
-When an agent builds an app for someone, every review can pass and the first thing the owner taps can still be broken. `gstack-first-use` closes that gap. Before a build reaches its owner as "ready to try", a fresh agent from a **different model family** than the one that built it plays that exact build cold, on the same kind of device and account the owner uses. It does the first five things the plan says the owner will do on day one, saves a screenshot or short video of each, checks that every link in the message is live, and predicts the owner's score from 1 to 10. Only when all of that passes does the tool print the "try this build" message.
+When an agent builds the first version of something for a person, every review can pass and the first thing the owner tries can still be broken, or do less than he asked. Six first versions in November 2026 all drew a complaint first: in at least four the gap was written down before he touched it, and in none did anyone run the exact steps we then asked him to do on his real setup. Two things close that gap.
-It gates two things: the message that asks the owner to try a build, and any "v1 is ready" report. It does not gate `/ship`: code review and the first-use check answer different questions.
+1. **The plan and the try-it message start from the owner's own words.** A first version's plan quotes each message of the owner's that states the job, with its time, and gives each one a line: it does it, or it leaves it as a lettered choice. Nothing his words asked for sits under "What it won't do yet". The five things he'll do on day one cite those quotes.
+2. **An agent runs his exact try-it steps on the real target first.** Before a build reaches its owner as "ready to try", a fresh agent from a **different model family** than the one that built it follows the exact message we're about to send, step by step, on the real target, and records a verdict and one line per step. Only when nothing is broken, wrong or asks him for something an agent could look up does `gstack-first-use` print the message.
+
+It gates two things: the message that asks the owner to try a build, and any "v1 is ready" report. It does not gate `/ship`: code review and the first-use check answer different questions. Any report of a passing test on a build the owner doesn't hold yet also names the build he does hold and its known defects.
+
+## The owner's words and the day-one table
+
+A plan is a first version when it has a `Day one` section or the run passes `--first-version` (on `gstack-autoplan next` or in the plan's scope marker). Both kinds of plan use the same two sections: the plan `/autoplan` puts on its approval page, and the one-page list of the first five things the owner does on day one.
+
+```markdown
+### Owner's words
+
+- Ada Example, 2026-11-18 09:12Z: "I keep forgetting which plant needs water" → does it
+- Ada Example, 2026-11-18 09:14Z: "and tell my partner when I'm away" → choice; size: two days; leave out: needs a second account
+```
+
+Each bullet is who, when, the words in quotes, then an arrow (`→` or `->`) and the line:
+
+| Line | Meaning | At the gate |
+|---|---|---|
+| `does it` | this version does what the words ask | a reviewer who finds it does less files a `narrows_quote` finding, and the gate asks |
+| `choice` | this version doesn't fully do it yet | one lettered choice quoting the words: a) build it in this version, b) leave it out. It recommends a, unless the line says `leave out: <reason>`, shown on the choice. `size: <n>` is shown as the cost |
+
+A cut under `### What it won't do yet` that drops a quoted line becomes that quote's choice and leaves the list. On a first version every other cut gets its own letter. The owner brief shows the quotes and their lines first, then the day-one table, then the remaining cuts.
+
+The day-one table needs a heading named `Day one` (any level; `Day-one page` also works) followed by a table with these seven columns, in any order:
+
+| action | frequency | source | feature | route | first build | check |
+|---|---|---|---|---|---|---|
+| sees which plant needs water today | daily | owner words 1 | Today list | root screen | build 1 | the plant due today is at the top, marked due |
+
+The table needs at least five rows, and every cell of the first five needs a value; the check freezes those five in table order. Each of the five cites a quote with `owner words <n>`. A row whose source starts with `assumed` must be confirmed with the owner first; once he confirms it, add his answer to Owner's words and cite it. `test/first-use.test.ts` pins this format, so a change to the parser fails that test instead of quietly changing what gets checked.
## The steps
-Run these from the thread that owns the build (on Capy, a Captain or the agent building the app).
+Run these from the thread that owns the build (on Capy, a Captain or the agent building it).
-1. **Freeze the five actions and the build.**
+1. **Freeze the steps, the build and what the owner holds now.**
```bash
gstack-first-use start --app plantpal --plan plan.md --play play.json \
--platform ios --commit <full commit sha> --testflight 17 \
+ --holding "TestFlight build 16" --holding-defects "the care card shows yesterday's date" \
--builder anthropic/claude-opus-5-5 --checker openai/gpt-6.2-sol
```
- It reads the first five rows of the plan's day-one table, records their hash, the play spec and the build fingerprint (the commit plus the TestFlight build number, or `--deploy <version>` for a web or Android build) in a write-once `manifest.json`, and prints `FIRST_USE_RUN: <dir>`. It refuses when the table is missing or malformed, has fewer than five rows, has an empty cell in its first five rows or still has a row marked `assumed` among them, when the play spec misses a part, or when the checker's model family is the builder's.
+ Platforms are `ios`, `android`, `web`, `macos` (a Mac app or helper) and `server` (software on the owner's box); give `--deploy <version>` for anything not on TestFlight. `--holding none --holding-defects none` marks a first build. `start` freezes the owner's quotes, the play spec's numbered steps followed by the five day-one actions, and the try-it text into a write-once `manifest.json`, with a hash over the rows and the text of every quote, and prints `FIRST_USE_RUN: <dir>`. It refuses a plan whose table or quotes are missing or malformed, a play spec that misses a part, and a checker from the builder's model family.
-2. **Hand the checker its brief.** `gstack-first-use brief --run <dir>` prints everything the checker gets: the device and account, the play text, and the five frozen actions with the commands to record each. Give it to one fresh agent on the `--checker` model and nothing else about the build: no plan, no code, no notes. Every value the brief puts into a command is shell-quoted, so the checker can paste the lines as they are. On Capy, start a subagent with that model on `machine: "fresh"`; it attaches a cloud phone with `tools.capy.phone` (`attach`, then `install` with the build from `tools.mobile.build`) and drives the screen with `tools.capy.computer`, or opens a web build in the browser. It runs its own gstack install check first.
+2. **Hand the checker its brief.** `gstack-first-use brief --run <dir>` prints everything the checker gets: the target and its rules, the exact try-it message, and each step with what it writes and the commands to record it. Give it to one fresh agent on the `--checker` model and nothing else about the build: no plan, no code, no notes. On Capy, start a subagent with that model on `machine: "fresh"`. For a phone build it attaches a cloud phone (`tools.capy.phone`) pointed at the target; for a Mac build on the owner's own Mac it drives Aside over Tailscale; for a server build it works over the box's shell. It runs its own gstack install check first.
-3. **The checker records each action and predicts the score.**
+3. **The checker records each step and predicts the score.**
```bash
- gstack-first-use record --run <dir> --action 1 --verdict pass --evidence today.png \
- --device "iPhone 17 Pro (cloud)" --account "fresh Apple ID" --by openai/gpt-6.2-sol
+ gstack-first-use record --run <dir> --step 3 --verdict useful --line "three plants show with their names" \
+ --evidence today.png --device "iPhone 17 Pro (cloud)" --account "a fresh Apple ID" \
+ --target "the Plantpal test account" --by openai/gpt-6.2-sol
gstack-first-use predict --run <dir> --score 6 --why "reminders work, adding plants is slow" --by openai/gpt-6.2-sol
```
- The evidence file (PNG, JPEG, GIF, WebP, HEIC, MP4, MOV or WebM, up to 100 MB) is copied into the run and recorded with its hash and size. A fail needs `--note` saying what happened. Only the checker's family may record, and `--account` must be the play spec's owner-equivalent account exactly (the brief prints it), so a pass on a developer or admin account doesn't count. Replaying an action adds a new result; the newest one counts.
+ A verdict is `useful` (does what he asked, well), `thin` (works but does little), `wrong` (does something other than what he asked) or `broken` (fails). `--needs-lookup <what>` marks a step that asks the owner for something an agent could look up or do; `--notice <text>` marks a system notice or prompt the message doesn't warn about. Evidence is a screenshot, short video or terminal capture (PNG, JPEG, GIF, WebP, HEIC, MP4, MOV, WebM, TXT or LOG, up to 100 MB), copied into the run with its hash. Only the checker's family may record, and `--account` and `--target` must match the play spec exactly. The checker's text is kept to one plain line. Replaying a step adds a new result; the newest one counts.
-4. **Check the links right before sending.** `gstack-first-use links --run <dir> --account "<the play spec's account>" --device-class ios` opens every link in the play spec and writes a dated receipt for each, bound to that audience: the owner-equivalent account and the build's device class. It refuses any other audience, and the gate counts only receipts for this one. A link passes on a 2xx or 3xx answer. A 401 or 403 passes only when the play spec marks the link `"login_gated": true`. The request itself carries no sign-in, so for a login-gated link the receipt proves the link is up and gated; the checker's played results on that account prove the sign-in works.
+4. **Check the links right before sending.** `gstack-first-use links --run <dir> --account "<the play spec's account>" --device-class ios` opens every link and writes a dated receipt bound to that audience. A link passes on a 2xx or 3xx answer; a 401 or 403 passes only when the play spec marks it `"login_gated": true`.
-5. **Print the message.** `gstack-first-use message --run <dir> --platform ios --commit <sha> --testflight 17` prints the "try this build" text only when every check below passes, and refuses otherwise, printing nothing on stdout. Send that text as it is. For a "v1 is ready" report, run `gstack-first-use check` with the same flags and paste its `FIRST_USE: pass …` line.
+5. **Print the message.** `gstack-first-use message --run <dir> --platform ios --commit <sha> --testflight 17` prints the try-it message only when every check below passes, and refuses otherwise, printing nothing on stdout. It opens with the owner's quotes and what this version does with each, then the ten play parts with the numbered steps, then "What you'll notice" (every thin step and notice), "The build on your device now" (its known defects, or that this is his first build) and one verdict line per step. Send it as it is. For a "v1 is ready" report, run `gstack-first-use check` with the same flags and paste its `FIRST_USE: pass …` line.
-6. **Save the owner's reaction.** When the owner replies, `gstack-first-use score --run <dir> --score 4 --words "4, Talk is slow" --by "<who relayed it>"`. `gstack-first-use show --run <dir>` prints the predicted score, the owner's score and words, and the gap between them.
+6. **Save the owner's reaction.** When the owner replies, `gstack-first-use score --run <dir> --score 4 --words "4, Talk is slow" --by "<who relayed it>"`. `gstack-first-use show --run <dir>` prints each step's verdict, the predicted score, the owner's score and words, and the gap between them.
## What the gate refuses
`check` and `message` pass only when all of these hold. Each failure is listed in the `FIRST_USE_REFUSED` line ([troubleshooting](troubleshooting.md#first-use-refused)).
- The build you're about to send is the one that was checked (`build_mismatch`).
-- The plan's first five day-one rows haven't changed since `start` (`source_changed`, `source_missing`). An edit elsewhere in the plan doesn't count.
-- Every frozen action's newest result, from the checker's family on the owner-equivalent account, is a pass, and its evidence file still matches its hash (`action_<n>_not_played`, `action_<n>_failed`, `action_<n>_evidence_stale`).
-- Every link has a live receipt from the last 15 minutes, checked as the owner-equivalent account and device class (`link_unchecked`, `link_down`, `link_stale`).
+- The first five day-one rows and the owner's quotes haven't changed since `start` (`source_changed`, `source_missing`), and neither has the frozen try-it text (`try_text_changed`). An edit elsewhere in the plan doesn't count.
+- Every step's newest result, from the checker's family on the owner-equivalent account and the play spec's target, has intact evidence (`step_<n>_not_played`, `step_<n>_evidence_stale`) and is not `wrong` or `broken` (`step_<n>_wrong`, `step_<n>_broken`).
+- No step asks the owner for something an agent could look up or do (`step_<n>_needs_lookup`).
+- No day-one action is `thin` (`step_<n>_thin`): each one comes from his words. A thin play step passes and is named in the message.
+- Every link has a live receipt from the last 15 minutes (`link_unchecked`, `link_down`, `link_stale`).
- The checker predicted a score (`no_predicted_score`).
The message never shows the predicted score, so it can't anchor the owner's own.
-## The day-one table
-
-Both kinds of plan feed the check in one format: the day-one table that `/autoplan` puts on the plan-approval page, and the one-page list of the first five things the owner does on day one. Either one needs a heading named `Day one` (any level; `Day-one page` also works) followed by a table with these seven columns, in any order:
-
-| action | frequency | source | feature | route | first build | check |
-|---|---|---|---|---|---|---|
-| sees which plant needs water today | daily | owner words 1 | Today list | root screen | build 1 | the plant due today is at the top, marked due |
-
-The table needs at least five rows, and every cell of the first five needs a value; the check freezes those five in table order. A row whose source starts with `assumed` must be confirmed with the owner before `start` will freeze it. `test/first-use.test.ts` pins this format with one fixture of each kind, so a change to the table parser fails that test instead of quietly changing what gets checked.
-
<a id="play-spec"></a>
## Play-message requirements
@@ -66,9 +91,9 @@ Every ask to play or try a build carries full play instructions in the same mess
| Part | Field | Notes |
|---|---|---|
| 1. The links | `links`: `[{ "label", "url", "login_gated"? }]` | http or https; each checked live within 15 minutes of sending |
-| 2. Device and setup | `device`, `setup`, `account` | the owner's device kind and account kind; the checker plays on the same kind, and results and link receipts are bound to `account` and the build's platform |
+| 2. Device and setup | `device`, `setup`, `account`, `target` | `target` is `{ "kind": "realistic-copy", "name", "data" }` (the default kind: a copy loaded with realistic data, named) or `{ "kind": "real", "name" }` for the owner's own setup |
| 3. What it is, in a sentence | `what` | |
-| 4. How to start | `start` | |
+| 4. How to start | `start`, `steps` | `steps` is `[{ "text", "writes", "approved_write"? }]`: what the owner does, and what it writes (`"none"` or what). A step that writes on a `real` target needs `approved_write` naming the owner's lettered approval for that write. On a `real` target `action_writes` is also required: five `{ "writes", "approved_write"? }` entries, one per day-one row in table order, under the same rule; on a copy an action without one is briefed as `unknown, so treat it as a write` |
| 5. Controls | `controls` | |
| 6. How long to play | `minutes` | a whole number from 1 to 240 |
| 7. What we want to learn | `learn` | |
@@ -76,18 +101,20 @@ Every ask to play or try a build carries full play instructions in the same mess
| 9. Known quirks | `quirks` | "none" is fine; empty isn't |
| 10. Reply word | `reply_word` | one word |
+On the owner's real setup the checker only reads: the brief forbids sending anything as the owner, writing to his setup except an approved write, and raising a prompt on his machine while he is using it. It also tells the checker that what it reads goes to its model provider.
+
## Where the record lives
The record holds the owner's own scores and words, so it stays private. On Capy it lives in the owner's user-level Capy Drive folder (`~/.capy/drive/user-*/first-use/<app>/<run>/`), which every thread the owner has opened can read and nobody else's can. If none or several such folders are mounted, the tool refuses rather than fall back to the machine's throwaway folder. Off Capy it lives under the gstack state root (`first-use/`). `GSTACK_FIRST_USE_DIR` overrides both. Nothing from a run belongs in a public repository or a PR body.
-A run directory holds `manifest.json`, `results/`, `evidence/`, `links/`, `prediction.json` and `owner/`. Every file is written once; to check again (a new build, changed day-one rows, a new prediction), start a new run.
+A run directory holds `manifest.json`, `results/`, `evidence/`, `links/`, `prediction.json` and `owner/`. Every file is written once; to check again (a new build, changed day-one rows or quotes, a new prediction), start a new run. Runs started before the try-it steps were checked (schema 1) refuse with a line saying to start a new one.
## How we'll know it helps
-With a handful of builds, this is a case series, not an eval. For each build, keep the pass count, the owner's score and words, the predicted score, and any escape: a day-one action that failed on the owner's device after the check passed it. The targets are zero escapes and a median owner score of 7 or more across the next three app builds. `gstack-first-use show --json` prints each run's numbers.
+With a handful of builds, this is a case series, not an eval. For each first version, keep the step verdicts, the owner's score and his first words, the predicted score, and any escape: a step that failed or disappointed him after the check passed it, or a first reply that names something his quoted words asked for. The targets are zero escapes and a median owner score of 7 or more across the next three first versions; the factory's weekly first-use table tracks them. If two of the next three still draw a complaint about something the check passed or the quotes covered, the check goes back for a "Why null?" review.
## What it doesn't do yet
-- It doesn't drive the owner's own phone; it plays on a cloud device of the same kind.
+- It doesn't prove the target is real: the checker declares it, as it declares the account, and the record names it.
- It doesn't dispatch the checker by itself; the thread that owns the build starts it with the brief.
- It doesn't check the wording of other messages sent to the owner.
diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md
index 9254acc86..5682c631f 100644
--- a/docs/troubleshooting.md
+++ b/docs/troubleshooting.md
@@ -2500,12 +2500,12 @@ whose Plan line differs from the PR body's current line.
<a id="first-use-plan-unready"></a>
### `gstack-first-use start: ... (FIRST_USE_PLAN_UNREADY)`
-**Meaning.** `start` could not freeze the day-one actions: the plan has no `### Day one` table, the table is missing a column or has fewer than five rows, one of its first five rows has an empty cell, or one of them is still marked `assumed`. Exit 3; nothing is written. **Fix.** Give the plan the pinned table ([first-use-check.md](first-use-check.md#the-day-one-table)) and confirm every assumed row with the owner, then rerun `start`.
+**Meaning.** `start` could not freeze the steps: the plan has no `### Day one` table, the table is missing a column or has fewer than five rows, one of its first five rows has an empty cell, is still marked `assumed` or cites none of the owner's quotes (`owner words <n>`), or the plan has no `### Owner's words` section, or a quote there has no time or no line (`does it` or `choice`). Exit 3; nothing is written. **Fix.** Quote the owner's messages that state the job and cite them from the table ([first-use-check.md](first-use-check.md#the-owners-words-and-the-day-one-table)); a row the owner confirmed at the gate cites his answer, added to Owner's words. Then rerun `start`.
<a id="first-use-play-spec-incomplete"></a>
### `gstack-first-use start: ... (FIRST_USE_PLAY_SPEC_INCOMPLETE)`
-**Meaning.** The play spec JSON misses one of the ten parts every ask to play or try a build carries (links, device and setup, what it is, how to start, controls, how long, what we want to learn, how to report back, known quirks, reply word). The line names each missing part and field. Exit 3. **Fix.** Fill them in ([first-use-check.md](first-use-check.md#play-spec)); "none" is a fine value for known quirks.
+**Meaning.** The play spec JSON misses one of the ten parts every ask to play or try a build carries (links, device and setup with its `target`, what it is, how to start with its numbered `steps`, controls, how long, what we want to learn, how to report back, known quirks, reply word), or a step writes on the owner's real setup with no `approved_write` naming his approval. The line names each missing part and field. Exit 3. **Fix.** Fill them in ([first-use-check.md](first-use-check.md#play-spec)); "none" is a fine value for known quirks and for a step's writes. Run a step that writes on a realistic copy, or get the owner's lettered approval for that write first.
<a id="first-use-same-family"></a>
### `gstack-first-use start|record|predict: ... (FIRST_USE_SAME_FAMILY)`
@@ -2520,12 +2520,12 @@ whose Plan line differs from the PR body's current line.
<a id="first-use-record-invalid"></a>
### `gstack-first-use: ... (FIRST_USE_RECORD_INVALID)`
-**Meaning.** A value or file is invalid: a bad `--commit`, `--action`, `--verdict` or score, an `--account` or `--device-class` that isn't the run's owner-equivalent audience, a run directory outside the record root, evidence that is not a screenshot or short video (or is empty, a link, or over 100 MB), an unreadable manifest, or a second prediction on a run. Exit 1. **Fix.** Correct the value. Run files are written once; to redo a check, start a new run.
+**Meaning.** A value or file is invalid: a bad `--commit`, `--platform`, `--step`, `--verdict`, `--line` or score, missing `--holding` or `--holding-defects`, an `--account`, `--target` or `--device-class` that isn't the run's owner-equivalent audience and target, a run directory outside the record root, evidence that is not a screenshot, short video or terminal capture (or is empty, a link, or over 100 MB), an unreadable manifest or a schema-1 run from before the try-it steps were checked, or a second prediction on a run. Exit 1. **Fix.** Correct the value. Run files are written once; to redo a check, or to continue from a schema-1 run, start a new run.
<a id="first-use-refused"></a>
### `gstack-first-use check|message: ... (FIRST_USE_REFUSED)`
-**Meaning.** The build has not cleared its first-use check, so `message` prints no "try this build" text and `check` prints no `FIRST_USE: pass` line. The detail lists every reason: `build_mismatch`, `source_changed`, `source_missing`, `action_<n>_not_played`, `action_<n>_failed`, `action_<n>_evidence_stale`, `link_unchecked`, `link_down`, `link_stale` (over 15 minutes old), `no_predicted_score`, `record_unreadable`. Exit 3. **Fix.** Fix the build and replay failed actions, rerun `links` right before sending, or start a new run for a new build or changed day-one rows.
+**Meaning.** The build has not cleared its first-use check, so `message` prints no try-it message and `check` prints no `FIRST_USE: pass` line. The detail lists every reason: `build_mismatch`, `source_changed` (the day-one rows or the owner's quotes changed), `source_missing`, `try_text_changed`, `step_<n>_not_played`, `step_<n>_broken`, `step_<n>_wrong`, `step_<n>_needs_lookup` (the step asks the owner for something an agent could look up or do), `step_<n>_thin` (only for a day-one action, which comes from the owner's words), `step_<n>_evidence_stale`, `link_unchecked`, `link_down`, `link_stale` (over 15 minutes old), `no_predicted_score`, `record_unreadable`. Exit 3. **Fix.** Fix the build or the step and replay it, rerun `links` right before sending, or start a new run for a new build, changed day-one rows or changed quotes.
## /ship token budget and fresh-context handoffs (gstack-ship-budget)
diff --git a/docs/unattended.md b/docs/unattended.md
index 6134194b7..029c46990 100644
--- a/docs/unattended.md
+++ b/docs/unattended.md
@@ -610,8 +610,14 @@ The example above is the full run. The first `next` also takes `--kind`:
one-voice challenge keeps it. An earlier round's open challenge stays until
answered or marked fixed (`resolves`). `### Day one` and `### What it won't
do yet` add `day_one` and `cut` approval items (a missing day-one page on a
- UI plan, each `assumed` row, each cut that drops a day-one row or quoted
- owner line) and one `cuts` auto item for the rest.
+ UI plan, each `assumed` row, each cut that drops a day-one row) and one
+ `cuts` auto item for the rest. A first version (a `### Day one` section or
+ `--first-version`) letters every cut instead, and adds `owner_words` items
+ for a missing Owner's words section or a quote with no time or line. Each
+ quote this version doesn't fully do (its line says `choice`, a cut drops it,
+ or a reviewer's `narrows_quote` finding says the plan narrows it) is one
+ `owner_choice` approval item: a) build it, recommended unless the line says
+ `leave out: <reason>`, b) leave it out ([first-use-check.md](first-use-check.md#the-owners-words-and-the-day-one-table)).
4. **Answer the gate** with the reply grammar and the revision you read:
```bash
$AP answer --out <dir> --gate-rev 1 --reply "rec" --by human # every recommendation, plan changes included (APPLY: ...; amend_pending)
@@ -957,7 +963,7 @@ predictions with his answers.
- **The record.** `shadow/ceo-only.r<rev>.jsonl`, one row per gate item: the
frozen item, `item_class` (`challenge2`, `challenge1`, `disagree`, `agent`,
`cap_deferred`, `cap_blocker`, `cap_delta`, `finding`, `proposal`,
- `confirm_direction`, `day_one`, `cut`, `cuts`, `p1`), `ceo_eligible`
+ `confirm_direction`, `day_one`, `cut`, `cuts`, `owner_words`, `owner_choice`, `p1`), `ceo_eligible`
(false for a `finding` item, which a CEO-only run leaves to the owner), the
prediction, `rule_pick` (the driver's keep-direction pick, the free
baseline), `rec_hash`, the plan and prompt hashes, the model, the gstack
@@ -988,8 +994,9 @@ predictions with his answers.
gate, interactive or unattended: one page built from `gate.json`,
`decisions.jsonl` and `findings.jsonl` (`BRIEF_INPUT_MISSING` when one is
absent). It opens with the `URGENT, outside this plan` block, then the
-plan's `### Day one` table, its `### What it won't do yet` cuts and the
-owner's words it follows (each only when the plan has it), then a
+owner's words it follows with each quote's line, the plan's `### Day one`
+table and its remaining `### What it won't do yet` cuts (each only when the
+plan has it; a cut that drops a quote is asked beside that quote), then a
plain-language summary (phases closed, findings accepted, how many decisions
take their default, the cycle time; `--summary <file>` or `<dir>/summary.md`
replaces the generated sentence with the run's own), then the numbered
diff --git a/lib/autoplan-gate-items.ts b/lib/autoplan-gate-items.ts
index 66c038575..b6c6d502e 100644
--- a/lib/autoplan-gate-items.ts
+++ b/lib/autoplan-gate-items.ts
@@ -9,24 +9,28 @@
* Owner's words section keeps today's defaults and gets one item asking the
* owner to confirm its direction. The day-one items ask about every assumed
* day-one row, a missing day-one page on an app plan, and each cut that drops
- * a day-one row or a quoted owner line (the other cuts are one grouped item).
+ * a day-one row (the other cuts are one grouped item, or one item each on a
+ * first version). A quote the plan leaves for later (its line says `choice`),
+ * a cut that drops a quote, and a reviewer's `narrows_quote` finding each become
+ * one choice to build what the owner asked for, recommended unless the plan
+ * gives a reason to leave it out (GST-3608).
*/
import * as fs from 'node:fs';
import * as path from 'node:path';
import { spawnSync } from 'node:child_process';
import { branchKey, captainApprovalsDir } from './approval-record';
import { readVersionedSlugCache, sanitizeSlug } from './bin-context';
-import { cutDrops, parseCuts, parseDayOne, parseOwnerWords, wordKey, type DayOneTable, type OwnerQuote, type OwnerWordsSection } from './autoplan-owner-text';
+import { cutDrops, cutQuote, isFirstVersion, parseCuts, parseDayOne, parseOwnerWords, quoteGaps, quoteWhen, wordKey, type DayOneTable, type OwnerQuote, type OwnerWordsSection } from './autoplan-owner-text';
import { SETTLEABLE_CHANGES } from './autoplan-reconcile';
import { readDecisions, readJournal, type RunState } from './autoplan-state';
import { resolveStateRoot } from './state-root';
import type { GateItem } from './gate-list';
import type { FindingRow } from './headless-artifacts';
-export type ChallengeRow = FindingRow & { user_challenge?: boolean; changes?: string; settled_by?: string; owner_quote?: number; resolves?: string };
+export type ChallengeRow = FindingRow & { user_challenge?: boolean; changes?: string; settled_by?: string; owner_quote?: number; narrows_quote?: number; resolves?: string };
export type NewItem = Omit<GateItem, 'id'> & { idKind: 'd' | 'uc'; key: string };
export interface GateOwnerWords { status: OwnerWordsSection['status']; quotes: Array<OwnerQuote & { verified: boolean }>; reason?: string; fix?: string }
-export interface OwnerContext { words: OwnerWordsSection; verified: Set<number>; dayOne: DayOneTable; cuts: string[]; app: boolean; lean: boolean }
+export interface OwnerContext { words: OwnerWordsSection; verified: Set<number>; dayOne: DayOneTable; cuts: string[]; app: boolean; lean: boolean; firstVersion: boolean }
/**
* The owner's words in this repository's approvals record for the branch checked out at `cwd` (lib/approval-record.ts
@@ -72,7 +76,8 @@ export function ownerContext(state: RunState, recorded: string[] = recordedOwner
const words = parseOwnerWords(text);
const keys = recorded.map(wordKey);
const verified = new Set(words.quotes.filter(q => keys.some(k => k.includes(wordKey(q.text)))).map(q => q.n));
- return { words, verified, dayOne: parseDayOne(text), cuts: parseCuts(text), app: !!state.scope?.ui, lean: !!state.lean };
+ return { words, verified, dayOne: parseDayOne(text), cuts: parseCuts(text), app: !!state.scope?.ui, lean: !!state.lean,
+ firstVersion: isFirstVersion(text, !!state.scope?.first_version) };
}
export function gateOwnerWords(ctx: OwnerContext): GateOwnerWords {
@@ -80,6 +85,10 @@ export function gateOwnerWords(ctx: OwnerContext): GateOwnerWords {
...(ctx.words.reason ? { reason: ctx.words.reason, fix: ctx.words.fix } : {}) };
}
+/** The quote a reviewer says the plan narrows (a cut or a "does it" line that does less than the owner asked), when the plan quotes it. */
+export const narrowedQuoteOf = (ctx: OwnerContext, f: ChallengeRow | undefined): OwnerQuote | undefined =>
+ f?.narrows_quote ? ctx.words.quotes.find(q => q.n === f.narrows_quote) : undefined;
+
/** The owner line a challenge names, when the plan quotes one there. */
export const ownerQuoteOf = (ctx: OwnerContext, f: ChallengeRow | undefined): OwnerQuote | undefined =>
f?.owner_quote ? ctx.words.quotes.find(q => q.n === f.owner_quote) : undefined;
@@ -135,10 +144,28 @@ export function confirmDirectionItem(challenges: string[]): NewItem {
{ key: 'b', text: "no, it is a draft: quote what I said in an Owner's words section and revise, so the challenges are judged against it", changes_plan: true }] };
}
-/** The day-one questions: each assumed row, a missing page on an app plan, and the plan's cuts. */
-export function dayOneItems(ctx: OwnerContext): NewItem[] {
+/**
+ * The owner-page questions: on a first version, missing quotes or lines; each assumed day-one row; a missing page on an
+ * app plan; one build-it choice per quote the plan leaves out (its `choice` line, a cut that drops it, or a reviewer's
+ * narrows_quote finding); and the cuts, one item each on a first version, else those matching a day-one row alone.
+ */
+export function dayOneItems(ctx: OwnerContext, narrowed: ChallengeRow[] = []): NewItem[] {
const items: NewItem[] = [];
const reopen = ctx.lean ? 'applies without re-review (lean run)' : 'reopens ceo and eng once the plan is revised';
+ if (ctx.firstVersion && ctx.words.status === 'none') {
+ items.push({ idKind: 'uc', key: 'owner-words', kind: 'approval', recommended: 'a', item_class: 'owner_words', changes: 'scope', cost: `a ${reopen}`,
+ title: 'This is a first version, but the plan quotes none of your messages that ask for it',
+ why: 'a first version is checked against your own words for the job, not against the plan: each quoted message, with its time, gets a line saying what this version does with it',
+ options: [{ key: 'a', text: "add it: an ### Owner's words section quoting each message that states the job, with its time and a line each (does it or choice), then revise", changes_plan: true },
+ { key: 'b', text: 'approve without it', changes_plan: false }] });
+ }
+ const gaps = ctx.firstVersion ? ctx.words.quotes.filter(q => quoteGaps(q).length) : [];
+ if (gaps.length) {
+ items.push({ idKind: 'uc', key: `owner-lines:${gaps.map(q => q.n).join(',')}`, kind: 'approval', recommended: 'a', item_class: 'owner_words', changes: 'scope', cost: `a ${reopen}`,
+ title: `${gaps.length} of your quoted messages ${gaps.length === 1 ? 'has' : 'have'} no time or no line saying what this version does with ${gaps.length === 1 ? 'it' : 'them'}: ${gaps.map(q => `“${q.text}” (missing ${quoteGaps(q).join(' and ')})`).join('; ')}`,
+ why: 'on a first version every quote says when it was said and whether this version does it or leaves it as a lettered choice',
+ options: [{ key: 'a', text: 'add the time and the line to each, then revise', changes_plan: true }, { key: 'b', text: 'approve without them', changes_plan: false }] });
+ }
if (ctx.app && ctx.dayOne.status !== 'ok') {
items.push({ idKind: 'uc', key: 'day-one-page', kind: 'approval', recommended: 'a', item_class: 'day_one', changes: 'scope', cost: `a ${reopen}`,
title: `The plan has no day-one page${ctx.dayOne.reason ? ` (${ctx.dayOne.reason})` : ''}: the first things you will do with it, how often, and which build puts each on your device`,
@@ -151,17 +178,37 @@ export function dayOneItems(ctx: OwnerContext): NewItem[] {
why: `no owner words or owner evidence back this row; feature: ${row.feature || 'none named'}; first build: ${row.first_build || 'none named'}`,
options: [{ key: 'a', text: 'yes, I do that: keep the row', changes_plan: false }, { key: 'b', text: 'no, or not like that: say what you do instead, then revise', changes_plan: true }] });
}
- const targets = [...ctx.dayOne.rows.flatMap(r => [r.action, r.feature]), ...ctx.words.quotes.map(q => q.text)].filter(Boolean);
- const named = ctx.cuts.filter(c => targets.some(t => cutDrops(c, t)));
+ const left = new Map<number, string[]>();
+ const note = (q: OwnerQuote, why: string) => left.set(q.n, [...(left.get(q.n) ?? []), why]);
+ for (const q of ctx.words.quotes) if (q.line?.kind === 'choice') note(q, "the plan's line for it says this version doesn't do it yet");
+ const quoteCuts = ctx.cuts.filter(c => cutQuote(c, ctx.words.quotes));
+ for (const cut of quoteCuts) note(cutQuote(cut, ctx.words.quotes)!, `the plan cuts it: "${cut}"`);
+ for (const f of narrowed) { const q = ctx.words.quotes.find(x => x.n === f.narrows_quote); if (q) note(q, `a reviewer (${f.voice}) says the plan narrows it: ${f.title}`); }
+ for (const q of ctx.words.quotes.filter(x => left.has(x.n))) {
+ const choice = q.line?.kind === 'choice' ? q.line : undefined;
+ const blocking = narrowed.find(f => f.narrows_quote === q.n && (f.severity === 'Critical' || f.severity === 'High'));
+ const leave = blocking ? undefined : choice?.leave_out;
+ const size = choice?.size ? `about ${choice.size}` : 'size not stated';
+ items.push({ idKind: 'uc', key: `quote:${q.n}`, kind: 'approval', recommended: leave ? 'b' : 'a', item_class: 'owner_choice', changes: 'scope',
+ recommended_basis: blocking ? `your own words asked for it, and a ${blocking.severity} finding says the plan falls short of them` : leave ? `the plan's reason to leave it out: ${leave}` : 'your own words asked for it, and only your words are direction',
+ cost: `a adds ${size} to this version and ${reopen}`,
+ title: `Your words${quoteWhen(q) ? ` (${quoteWhen(q)})` : ''}: “${q.text}”, which this version doesn't fully do`,
+ why: left.get(q.n)!.join('; '),
+ options: [{ key: 'a', text: `build it in this version (${size})`, changes_plan: true }, { key: 'b', text: `leave it out for now${leave ? `: ${leave}` : ''}`, changes_plan: false }] });
+ }
+ const rest = ctx.cuts.filter(c => !quoteCuts.includes(c));
+ const rowTargets = ctx.dayOne.rows.flatMap(r => [r.action, r.feature]).filter(Boolean);
+ const named = ctx.firstVersion ? rest : rest.filter(c => rowTargets.some(t => cutDrops(c, t)));
for (const cut of named) {
+ const drops = rowTargets.some(t => cutDrops(cut, t));
items.push({ idKind: 'uc', key: `cut:${wordKey(cut).trim()}`, kind: 'approval', recommended: 'a', item_class: 'cut', changes: 'scope', cost: `b ${reopen}`,
- title: `Cut: ${cut}`, why: 'this cut drops something on the day-one page or in your own words',
+ title: `Cut: ${cut}`, why: drops ? 'this cut drops something on the day-one page' : 'on a first version every cut is your decision, one letter each',
options: [{ key: 'a', text: 'keep the cut: not in the first build', changes_plan: false }, { key: 'b', text: 'put it back in the first build', changes_plan: true }] });
}
- const rest = ctx.cuts.filter(c => !named.includes(c));
- if (rest.length) {
+ const grouped = rest.filter(c => !named.includes(c));
+ if (grouped.length) {
items.push({ idKind: 'd', key: 'cuts', kind: 'auto', recommended: 'a', item_class: 'cuts', changes: 'scope', cost: `b ${reopen}`,
- title: `${rest.length} other cut${rest.length === 1 ? '' : 's'}: ${rest.join('; ')}`, why: 'none of these drops a day-one row or a quoted owner line',
+ title: `${grouped.length} other cut${grouped.length === 1 ? '' : 's'}: ${grouped.join('; ')}`, why: 'none of these drops a day-one row or a quoted owner line',
options: [{ key: 'a', text: 'keep these cuts', changes_plan: false }, { key: 'b', text: 'put some back: name them, then revise', changes_plan: true }] });
}
return items;
diff --git a/lib/autoplan-gate.ts b/lib/autoplan-gate.ts
index ebb42a4b3..5104f238a 100644
--- a/lib/autoplan-gate.ts
+++ b/lib/autoplan-gate.ts
@@ -27,7 +27,7 @@ import { applyCapChoices, pendingDeltas, releaseUndispatched, roundCap, roundOf
import { evaluateCarry, gateEvidence, voidPendingCheck } from './autoplan-carry';
import { buildEli5, capyRelayLine } from './captain-brief';
import { FINDING_ORIGIN, openEarlier, previousReview, reviewRows, settledIds } from './autoplan-confirm';
-import { blockingProposal, confirmDirectionItem, dayOneItems, directionIsOwners, gateOwnerWords, heaviestChanges, ownerContext, ownerQuoteOf, proposalItem, type ChallengeRow, type NewItem } from './autoplan-gate-items';
+import { blockingProposal, confirmDirectionItem, dayOneItems, directionIsOwners, gateOwnerWords, heaviestChanges, narrowedQuoteOf, ownerContext, ownerQuoteOf, proposalItem, type ChallengeRow, type NewItem } from './autoplan-gate-items';
import { phaseClose } from './autoplan-timing';
import { agentWords, ANSWERED_BY_RE, applyReply, autoDefault, decisionId, decisionRows, keepDirection, legacyRecHash, parseReply, pendingHint, recHash, replyShape, validateGateList, type GateChoice, type GateItem, type GateList, type GateOption, type ParsedReply } from './gate-list';
import type { DecisionRow, FindingRow } from './headless-artifacts';
@@ -201,6 +201,7 @@ export function buildGate(state: RunState, gateRev: number): GateList {
const quoted = owner.words.status !== 'none';
const kept: string[] = [];
const keptIds: string[] = [];
+ const narrowed: ChallengeRow[] = [];
const add = ({ idKind, key, ...item }: NewItem, origin: (options: GateOption[]) => string): string => {
const id = idKind === 'uc' ? `uc${++uc}` : `d${++d}`;
items.push({ id, ...item, origin: origin(item.options) });
@@ -251,9 +252,10 @@ export function buildGate(state: RunState, gateRev: number): GateList {
const twinOf = (id: string) => twins.get(id) ?? [...twins].find(([, out]) => out === id)?.[0];
for (const f of [...native, ...outside, ...carried] as ChallengeRow[]) {
if (challenged.has(f.id) || f.settled_by) continue;
+ if (narrowedQuoteOf(owner, f)) { challenged.add(f.id); narrowed.push(f); continue; }
if (quoted && (f.changes || f.user_challenge) && !ownerQuoteOf(owner, f)) {
const twin = twinOf(f.id) ? byId.get(twinOf(f.id)!) as ChallengeRow | undefined : undefined;
- propose(twin && !twin.settled_by && !ownerQuoteOf(owner, twin) ? [f, twin] : [f], carried.includes(f));
+ propose(twin && !twin.settled_by && !ownerQuoteOf(owner, twin) && !narrowedQuoteOf(owner, twin) ? [f, twin] : [f], carried.includes(f));
continue;
}
if (!f.user_challenge || !directionIsOwners(owner, [f])) continue;
@@ -280,10 +282,14 @@ export function buildGate(state: RunState, gateRev: number): GateList {
}
items.push(...capItems(state, { d: () => `d${++d}`, uc: () => `uc${++uc}` }));
if (!quoted && kept.length) add(confirmDirectionItem(kept), options => ['owner', 'confirm-direction', optionHash(options), keptIds.join('+')].join('|'));
- for (const item of dayOneItems(owner)) add(item, options => ['owner', item.key, optionHash(options), createHash('sha256').update(item.title).digest('hex').slice(0, 16)].join('|'));
+ const settles = (key: string) => narrowed.filter(f => key === `quote:${narrowedQuoteOf(owner, f)!.n}`);
+ for (const item of dayOneItems(owner, narrowed)) {
+ const found = settles(item.key);
+ add(item, options => ['owner', [item.key, ...found.map(f => f.id)].join('+'), optionHash(options), createHash('sha256').update(item.title).digest('hex').slice(0, 16), ...(blockingProposal(found) ? [FINDING_ORIGIN] : [])].join('|'));
+ }
items.push(planApproval(state, items));
const list: GateList = { schema_version: 1, run: state.run, gate_rev: gateRev, items, title: '/autoplan final approval gate', rec_rev: 0, rec_hash_v: 2,
- ...(quoted ? { owner_words: gateOwnerWords(owner) } : {}),
+ ...(quoted ? { owner_words: gateOwnerWords(owner) } : {}), ...(owner.firstVersion ? { first_version: true } : {}),
...(fs.existsSync(state.active_plan) ? { eli5: buildEli5(fs.readFileSync(state.active_plan, 'utf8'), state.active_plan) } : {}) };
const problems = validateGateList(list);
if (problems.length) throw new Error(`gate list invalid: ${problems.join('; ')}`);
diff --git a/lib/autoplan-owner-text.ts b/lib/autoplan-owner-text.ts
index 05adcce48..4d5375ad6 100644
--- a/lib/autoplan-owner-text.ts
+++ b/lib/autoplan-owner-text.ts
@@ -7,7 +7,10 @@
* table of the owner's first actions (action, frequency, source, feature,
* route, first build, check); a row whose source is `assumed` becomes an
* owner question at the gate. `### What it won't do yet` lists the plan's
- * cuts. Read by the gate builder and the owner and captain briefs.
+ * cuts. Read by the gate builder and the owner and captain briefs. On a first
+ * version each Owner's words bullet also carries a line after an arrow saying
+ * what this version does with those words: `does it`, `choice` (a lettered
+ * gate choice, optionally `; size: …` and `; leave out: <reason>`) (GST-3608).
*/
import { findSection } from './markdown-sections';
@@ -16,7 +19,8 @@ export const DAY_ONE_TITLES = ['Day one', 'Day-one page', 'Day one page'];
export const CUTS_TITLES = ["What it won't do yet", 'What it will not do yet', "Won't do yet"];
export const DAY_ONE_COLUMNS = ['action', 'frequency', 'source', 'feature', 'route', 'first build', 'check'] as const;
-export interface OwnerQuote { n: number; who: string; text: string }
+export type OwnerLine = { kind: 'does' } | { kind: 'choice'; size?: string; leave_out?: string };
+export interface OwnerQuote { n: number; who: string; text: string; line?: OwnerLine }
export interface OwnerWordsSection { status: 'none' | 'ok' | 'malformed'; quotes: OwnerQuote[]; reason?: string; fix?: string }
export interface DayOneRow { action: string; frequency: string; source: string; feature: string; route: string; first_build: string; check: string; assumed: boolean }
export interface DayOneTable { status: 'none' | 'ok' | 'malformed'; rows: DayOneRow[]; reason?: string }
@@ -24,7 +28,47 @@ export interface DayOneTable { status: 'none' | 'ok' | 'malformed'; rows: DayOne
const BULLET = /^\s*[-*+]\s+(.*)$/;
const QUOTED = /[“"](.+)[”"]/;
-/** The quotes under `### Owner's words`; a bullet with no quoted words makes the section malformed (its other quotes still count). */
+const count = (s: string, c: string) => s.split(c).length - 1;
+const paired = (s: string) => count(s, '"') % 2 === 0 && count(s, '“') === count(s, '”');
+
+/**
+ * The bullet split into its quote (left) and its line (right). It splits at the first `→` or `->` that follows quoted
+ * words and is followed by a line parseLine reads, with its quote marks paired, so an arrow in the attribution or inside
+ * the quote never splits it. Otherwise the bullet reads as it did before lines existed, with no line, except that an arrow
+ * after its last closing quote mark still returns what follows as a line, for parseOwnerWords to name as malformed.
+ */
+export function splitLine(bullet: string): { left: string; line?: string } {
+ for (const a of bullet.matchAll(/→|->/g)) {
+ const left = bullet.slice(0, a.index).trimEnd(), line = bullet.slice(a.index + a[0].length).trim();
+ if (QUOTED.exec(left)?.[1]?.trim() && paired(line) && parseLine(line)) return { left, line };
+ }
+ const quote = QUOTED.exec(bullet);
+ const close = quote ? quote.index + quote[0].length : 0;
+ const arrow = quote ? [...bullet.slice(close).matchAll(/→|->/g)].pop() : undefined;
+ return arrow ? { left: bullet.slice(0, close + arrow.index).trimEnd(), line: bullet.slice(close + arrow.index + arrow[0].length).trim() } : { left: bullet };
+}
+
+/** A bullet's line: `does it` or `choice[; size: …][; leave out: …]`; undefined when it reads as neither. */
+export function parseLine(line: string): OwnerLine | undefined {
+ if (/^does it\W*$/i.test(line)) return { kind: 'does' };
+ if (!/^choice\b/i.test(line)) return undefined;
+ const out: { kind: 'choice'; size?: string; leave_out?: string } = { kind: 'choice' };
+ for (const part of line.replace(/^choice\b[^;]*/i, '').split(';').map(p => p.trim()).filter(Boolean)) {
+ const m = /^(size|(?:recommend )?leave out)\s*:\s*(.+)$/i.exec(part);
+ if (!m) return undefined;
+ if (/^size$/i.test(m[1]!)) out.size = m[2]!.trim(); else out.leave_out = m[2]!.trim();
+ }
+ return out;
+}
+
+/** The time a quote names: the part of its attribution after the first comma (`The owner, 2026-11-23 10:04Z`), or ''. */
+export const quoteWhen = (q: Pick<OwnerQuote, 'who'>): string => (q.who.includes(',') ? q.who.slice(q.who.indexOf(',') + 1).trim() : '');
+
+/**
+ * The quotes under `### Owner's words`; a bullet with no quoted words, or a line that reads as none of the three, makes
+ * the section malformed (its other quotes still count). A bullet with no line still parses: only a first version's gate
+ * item and gstack-first-use ask for one.
+ */
export function parseOwnerWords(planText: string): OwnerWordsSection {
const section = findSection(planText, OWNER_WORDS_TITLES);
if (!section) return { status: 'none', quotes: [] };
@@ -32,13 +76,31 @@ export function parseOwnerWords(planText: string): OwnerWordsSection {
const fix = 'one bullet per quote: - <who>, <when>: "<their exact words>"';
if (!bullets.length) return { status: 'malformed', quotes: [], reason: 'the section has no bullet list', fix };
const quotes: OwnerQuote[] = [];
- const bad: number[] = [];
+ const bad: number[] = [], badLine: number[] = [];
bullets.forEach((b, i) => {
- const m = QUOTED.exec(b);
+ const { left, line } = splitLine(b);
+ const m = QUOTED.exec(left);
if (!m || !m[1]!.trim()) { bad.push(i + 1); return; }
- quotes.push({ n: i + 1, who: b.slice(0, m.index).replace(/[\s:,-]+$/, '').trim() || 'unattributed', text: m[1]!.trim() });
+ const parsed = line ? parseLine(line) : undefined;
+ if (line && !parsed) badLine.push(i + 1);
+ quotes.push({ n: i + 1, who: left.slice(0, m.index).replace(/[\s:,-]+$/, '').trim() || 'unattributed', text: m[1]!.trim(), ...(parsed ? { line: parsed } : {}) });
});
- return bad.length ? { status: 'malformed', quotes, reason: `bullet ${bad.join(', ')} quotes no words`, fix } : { status: 'ok', quotes };
+ const reasons = [...(bad.length ? [`bullet ${bad.join(', ')} quotes no words`] : []),
+ ...(badLine.length ? [`bullet ${badLine.join(', ')} has a line that is not does it or choice`] : [])];
+ return reasons.length ? { status: 'malformed', quotes, reason: reasons.join('; '), fix: badLine.length ? fix + ' → does it | choice' : fix } : { status: 'ok', quotes };
+}
+
+/** What a first version still owes on a quote: when it was said, and a line. Empty when both are there. */
+export const quoteGaps = (q: OwnerQuote): string[] => [...(quoteWhen(q) ? [] : ['when it was said']), ...(q.line ? [] : ['a line (does it or choice)'])];
+
+/** The quote a cut drops, by its words (cutDrops), or undefined. */
+export const cutQuote = (cut: string, quotes: OwnerQuote[]): OwnerQuote | undefined => quotes.find(q => cutDrops(cut, q.text));
+
+/** A quote's line in the owner's words. */
+export function lineText(q: OwnerQuote): string {
+ if (!q.line) return 'no line yet: asked below';
+ if (q.line.kind === 'does') return 'does it';
+ return 'not in this version yet: a lettered choice below';
}
/** The OWNER_WORDS line `next` and the gate print. */
@@ -73,21 +135,28 @@ export function parseDayOne(planText: string): DayOneTable {
return rows.length ? { status: 'ok', rows } : { status: 'malformed', rows: [], reason: 'the table has no rows' };
}
+/** A first version: the plan has a Day one section, or the run's `--first-version` scope flag says so. */
+export const isFirstVersion = (planText: string, flag = false): boolean => flag || parseDayOne(planText).status !== 'none';
+
+export const FIRST_USE_LINE = "Before you're asked to try it, an agent from another model family follows the exact try-it steps on your setup and records a verdict for each; a step that is broken, wrong or would make you look something up is fixed before you get it (gstack-first-use).";
+
/**
- * What the owner reads first at the gate (lib/captain-brief.ts, lib/owner-brief.ts): the day-one table, what the first
- * build won't do yet, and the quoted owner words a reviewer needs the owner's answer to change. Empty when the plan has none.
+ * What the owner reads first at the gate (lib/captain-brief.ts, lib/owner-brief.ts): the quoted owner words, each with what
+ * this version does with them, then the day-one table, then what it won't do yet. A cut that drops a quoted line is asked
+ * beside that quote as a lettered choice, never listed under "What it won't do yet". Empty when the plan has none of them.
*/
-export function renderDayOne(planText: string, quotes: Array<OwnerQuote & { verified?: boolean }> = []): string[] {
+export function renderOwnerPage(planText: string, quotes: Array<OwnerQuote & { verified?: boolean }> = [], o: { firstVersion?: boolean } = {}): string[] {
const day = parseDayOne(planText);
- const cuts = parseCuts(planText);
+ const cuts = parseCuts(planText).filter(c => !cutQuote(c, quotes));
const out: string[] = [];
+ if (quotes.length) out.push('### Your words this plan follows', '', ...quotes.map(q => `- ${q.who}: “${q.text}”${q.verified === false ? ' (not found in your recorded replies)' : ''} → ${lineText(q)}`), '',
+ 'A reviewer who wants to change one of these needs your answer. Anything else in the plan was written by the planning agent, so a reviewer\'s change to it is recommended below.', '');
if (day.status === 'ok') {
out.push('### Day one', '', 'What you can do with it on day one:', '', '| What you do | How often | Feature | How you get there | First build with it | How we check it works |', '|---|---|---|---|---|---|',
...day.rows.map(r => `| ${r.action}${r.assumed ? ' (our guess: asked below)' : ''} | ${r.frequency} | ${r.feature} | ${r.route} | ${r.first_build} | ${r.check} |`), '');
}
if (cuts.length) out.push("### What it won't do yet", '', ...cuts.map(c => `- ${c}`), '');
- if (quotes.length) out.push('### Your words this plan follows', '', ...quotes.map(q => `- ${q.who}: “${q.text}”${q.verified === false ? ' (not found in your recorded replies)' : ''}`), '',
- 'A reviewer who wants to change one of these needs your answer. Anything else in the plan was written by the planning agent, so a reviewer\'s change to it is recommended below.', '');
+ if (o.firstVersion) out.push(FIRST_USE_LINE, '');
return out;
}
diff --git a/lib/autoplan-owner-words.ts b/lib/autoplan-owner-words.ts
index 17614be11..675f71b82 100644
--- a/lib/autoplan-owner-words.ts
+++ b/lib/autoplan-owner-words.ts
@@ -133,11 +133,15 @@ const SUFFIXES: Array<[string, string]> = [["n't", 'not'], ["'re", 'are'], ["'ve
const IS_BASES = new Set(['it', 'that', 'there', 'here', 'what', 'who', 'where', 'he', 'she']);
interface Token { key: string; start: number; end: number }
+/** A word: one character of a script written without spaces (Han, kana, Thai), or a run of other letters and digits. */
+const UNSPACED = String.raw`\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Thai}`;
+const LETTER = String.raw`(?:(?![${UNSPACED}])[\p{L}\p{M}\p{N}])`;
+const WORD = new RegExp(String.raw`[${UNSPACED}]|${LETTER}+(?:['\u2019\u02bc]${LETTER}+)*`, 'gu');
/** Words of `text` in the rendered (default) or raw view, with their original [start, end) offsets. */
export function tokens(text: string, rendered = true): Token[] {
const m = normalize(text, rendered);
const out: Token[] = [];
- for (const w of m.s.matchAll(/[\p{L}\p{M}\p{N}]+(?:['\u2019\u02bc][\p{L}\p{M}\p{N}]+)*/gu)) {
+ for (const w of m.s.matchAll(WORD)) {
const start = m.from[w.index!]!, end = m.to[w.index! + w[0].length - 1]!;
const key = w[0].normalize('NFKC').replace(/[\u2019\u02bc]/g, "'").toLowerCase();
const suffix = SUFFIXES.find(([s]) => key.endsWith(s) && key.length > s.length);
diff --git a/lib/autoplan-prompts.ts b/lib/autoplan-prompts.ts
index 1abd7e09e..9522bfd53 100644
--- a/lib/autoplan-prompts.ts
+++ b/lib/autoplan-prompts.ts
@@ -42,6 +42,8 @@ export interface Scope {
source?: 'detected' | 'flags';
/** A docs-only plan runs CEO (native voice only) and Eng; `--docs-only`, the marker, or every Implementation-plan path docs-class. */
docs_only?: boolean; docs_only_source?: ScopeSource;
+ /** `--first-version` (flag or marker): the plan is a first version even without a Day one section (lib/autoplan-owner-text.ts isFirstVersion). */
+ first_version?: boolean;
}
export function snapshotTool(args: string[], cwd: string): any {
@@ -64,7 +66,7 @@ export function detectScope(activePlan: string, cwd: string, flags: ScopeFlags,
const dxSource: ScopeSource = flags.dx !== undefined ? 'flag' : m.dx !== undefined ? 'marker'
: flags.developerTool || flags.agentPrimary ? 'flag' : m.developerTool || m.agentPrimary ? 'marker' : 'detected';
const cli = scopeTokens(flags);
- const merged = scopeTokens({ ui: flags.ui ?? m.ui, dx: flags.dx ?? m.dx, developerTool, agentPrimary, docsOnly: !!(flags.docsOnly || m.docsOnly) });
+ const merged = scopeTokens({ ui: flags.ui ?? m.ui, dx: flags.dx ?? m.dx, developerTool, agentPrimary, docsOnly: !!(flags.docsOnly || m.docsOnly), firstVersion: !!(flags.firstVersion || m.firstVersion) });
const pinned = !cli.length || (marker !== null && [...merged].sort().join(' ') === [...marker.tokens].sort().join(' '));
// A flag or marker that turns a phase on outranks docs-only detection; --docs-only itself outranks everything.
const enables = flags.ui === true || m.ui === true || developerTool || agentPrimary;
@@ -77,6 +79,7 @@ export function detectScope(activePlan: string, cwd: string, flags: ScopeFlags,
sources: { ui: flags.ui !== undefined ? 'flag' : m.ui !== undefined ? 'marker' : 'detected', dx: dxSource }, ui_evidence: detected.uiEvidence, dx_terms: detected.matches,
cli_flags: cli, marker: marker?.tokens ?? null, pin: pinned ? null : { marker: scopeMarker(merged), file: sourcePlan },
docs_only: docsOnly, docs_only_source: docsOnlySource,
+ ...(flags.firstVersion || m.firstVersion ? { first_version: true } : {}),
};
}
@@ -124,7 +127,7 @@ ${RESULT_FORMAT_HEADER}
\`\`\`gstack-findings
{"id":"F1","severity":"High","title":"<one line>","file":"<path or omit>","line":12,"fix":"<the fix>"}
\`\`\`
- severity is Critical | High | Medium | Low | Informational. Any finding that recommends changing the plan's scope, cost or direction adds "changes": "scope" | "cost" | "direction", or "packaging" | "ordering" when only its delivery packaging or build order changes, with no Implementation-plan edit; that holds at any severity. Only the owner's own words are the plan's direction: add "user_challenge": true and "owner_quote": <n> only when the change goes against bullet n (from 1) of the plan's "Owner's words" section. Scope, order or features the planning agent wrote are proposals, so a change to them is an ordinary finding with "changes" and no user_challenge. A plan with no "Owner's words" section: add "user_challenge": true (no owner_quote) when you recommend changing its stated direction. Naming and other reversible choices are ordinary findings with no "changes". Add "urgent": true and "suggested_owner": "<who>" for a security or data-loss finding this plan does not own. An empty fence means no findings; a missing fence is refused.
+ severity is Critical | High | Medium | Low | Informational. Any finding that recommends changing the plan's scope, cost or direction adds "changes": "scope" | "cost" | "direction", or "packaging" | "ordering" when only its delivery packaging or build order changes, with no Implementation-plan edit; that holds at any severity. Only the owner's own words are the plan's direction: add "user_challenge": true and "owner_quote": <n> only when the change goes against bullet n (from 1) of the plan's "Owner's words" section. Scope, order or features the planning agent wrote are proposals, so a change to them is an ordinary finding with "changes" and no user_challenge. Check every "What it won't do yet" cut and every "does it" line against each quoted owner bullet and any owner answer under DECIDED AT THE GATE: a cut or line that does less than bullet n asked is a finding with "narrows_quote": <n> and "changes": "scope" (no user_challenge), even when the two share no words. A plan with no "Owner's words" section: add "user_challenge": true (no owner_quote) when you recommend changing its stated direction. Naming and other reversible choices are ordinary findings with no "changes". Add "urgent": true and "suggested_owner": "<who>" for a security or data-loss finding this plan does not own. An empty fence means no findings; a missing fence is refused.
3. Write the whole result to this file: ${resultPath}
`;
diff --git a/lib/autoplan-reconcile.ts b/lib/autoplan-reconcile.ts
index 45044e7d3..974bcf5fa 100644
--- a/lib/autoplan-reconcile.ts
+++ b/lib/autoplan-reconcile.ts
@@ -32,6 +32,8 @@ export interface CanonicalFinding {
changes?: Changes;
/** A challenge to the owner's own words: the 1-based bullet of the plan's `### Owner's words` it would change. */
owner_quote?: number;
+ /** A cut or a "does it" line that does less than the plan's `### Owner's words` bullet n asked: the gate asks the owner to build it (lib/autoplan-gate-items.ts). */
+ narrows_quote?: number;
/** A confirm round's row naming the earlier challenge id the revised plan now fixes. */
resolves?: string;
}
@@ -98,6 +100,7 @@ function parseFences(text: string, errors: string[]): { findings: CanonicalFindi
if (Array.isArray(row.plan_items)) finding.plan_items = row.plan_items.filter((p: unknown): p is string => typeof p === 'string');
if (typeof row.dimension === 'string') finding.dimension = row.dimension;
if (Number.isInteger(row.owner_quote) && row.owner_quote > 0) finding.owner_quote = row.owner_quote;
+ if (Number.isInteger(row.narrows_quote) && row.narrows_quote > 0) finding.narrows_quote = row.narrows_quote;
if (typeof row.resolves === 'string' && row.resolves.trim()) finding.resolves = row.resolves.trim();
if (row.changes !== undefined) {
if (!(CHANGES as readonly unknown[]).includes(row.changes)) { errors.push(`findings row ${i + 1}: changes ${JSON.stringify(row.changes)} is not one of ${CHANGES.join('|')}`); return; }
@@ -195,7 +198,7 @@ export function canonicalRows(findings: CanonicalFinding[], ctx: { run: string;
...(f.local_id ? { source: f.local_id } : {}),
...(f.user_challenge ? { user_challenge: true } : {}), ...(f.urgent ? { urgent: true } : {}),
...(f.suggested_owner ? { suggested_owner: f.suggested_owner } : {}), ...(f.dimension ? { dimension: f.dimension } : {}),
- ...(f.changes ? { changes: f.changes } : {}), ...(f.owner_quote ? { owner_quote: f.owner_quote } : {}), ...(f.resolves ? { resolves: f.resolves } : {}),
+ ...(f.changes ? { changes: f.changes } : {}), ...(f.owner_quote ? { owner_quote: f.owner_quote } : {}), ...(f.narrows_quote ? { narrows_quote: f.narrows_quote } : {}), ...(f.resolves ? { resolves: f.resolves } : {}),
} as FindingRow));
}
diff --git a/lib/autoplan-scope.ts b/lib/autoplan-scope.ts
index ee58bd889..e6311d1c1 100644
--- a/lib/autoplan-scope.ts
+++ b/lib/autoplan-scope.ts
@@ -84,13 +84,13 @@ export function detectDocsOnly(implementationPlan: string, root: string): DocsOn
return { docsOnly: paths.length > 0 && code.length === 0, paths, code };
}
-export interface ScopeFlags { ui?: boolean; developerTool?: boolean; agentPrimary?: boolean; dx?: boolean; docsOnly?: boolean }
-export const SCOPE_FLAG_TOKENS = ['--ui', '--no-ui', '--no-dx', '--developer-tool', '--agent-primary', '--docs-only'] as const;
+export interface ScopeFlags { ui?: boolean; developerTool?: boolean; agentPrimary?: boolean; dx?: boolean; docsOnly?: boolean; firstVersion?: boolean }
+export const SCOPE_FLAG_TOKENS = ['--ui', '--no-ui', '--no-dx', '--developer-tool', '--agent-primary', '--docs-only', '--first-version'] as const;
export const MARKER_RE = /^<!--\s*gstack-autoplan-scope:(.*?)-->\s*$/;
export function scopeTokens(f: ScopeFlags): string[] {
return [...(f.ui === true ? ['--ui'] : f.ui === false ? ['--no-ui'] : []), ...(f.dx === false ? ['--no-dx'] : []),
- ...(f.developerTool ? ['--developer-tool'] : []), ...(f.agentPrimary ? ['--agent-primary'] : []), ...(f.docsOnly ? ['--docs-only'] : [])];
+ ...(f.developerTool ? ['--developer-tool'] : []), ...(f.agentPrimary ? ['--agent-primary'] : []), ...(f.docsOnly ? ['--docs-only'] : []), ...(f.firstVersion ? ['--first-version'] : [])];
}
export function parseScopeTokens(tokens: readonly string[], where: string): ScopeFlags {
@@ -103,6 +103,7 @@ export function parseScopeTokens(tokens: readonly string[], where: string): Scop
...(tokens.includes('--developer-tool') ? { developerTool: true } : {}),
...(tokens.includes('--agent-primary') ? { agentPrimary: true } : {}),
...(tokens.includes('--docs-only') ? { docsOnly: true } : {}),
+ ...(tokens.includes('--first-version') ? { firstVersion: true } : {}),
};
}
diff --git a/lib/captain-brief.ts b/lib/captain-brief.ts
index fbeac4057..f030ec223 100644
--- a/lib/captain-brief.ts
+++ b/lib/captain-brief.ts
@@ -20,7 +20,7 @@ import * as path from 'node:path';
import { gateCost, gateCostSentence, priorChoices } from './autoplan-gate-cost';
import { parseReply, recHash, type GateEli5, type GateItem } from './gate-list';
import { renderUrgentBlock } from './headless-artifacts';
-import { renderDayOne } from './autoplan-owner-text';
+import { renderOwnerPage } from './autoplan-owner-text';
import { findSection, firstTitle } from './markdown-sections';
import type { BriefInputs } from './owner-brief';
@@ -142,7 +142,7 @@ export function renderCaptainBrief(inputs: BriefInputs, o: { outDir: string; cap
`\`gstack-autoplan answer --out ${o.outDir} --gate-rev ${list.gate_rev} --reply rec --rec-hash ${hash} --by agent:<id> --owner-reply "<their exact words>"\`, then \`gstack-approvals import --autoplan ${o.outDir} --by <name>\`.`;
// The price sits above the trailer: the relaying agent sends everything above that line, so the person approving sees it.
const cost = inputs.run ? ['### Cost', '', gateCostSentence(gateCost(o.outDir, list, { phase_order: inputs.run.phase_order ?? [], outside_enabled: inputs.run.outside_enabled !== false, spend_cap_usd: inputs.run.spend_cap_usd ?? null, scope_flags: inputs.run.scope_flags, lean: inputs.run.lean })), ''] : [];
- const dayOne = renderDayOne(plan.text, list.owner_words?.quotes);
+ const dayOne = renderOwnerPage(plan.text, list.owner_words?.quotes, { firstVersion: list.first_version });
const text = [...urgent, ...header, '', ...dayOne, ...body, ...need, ...cost, '---', '', trailer, ''].join('\n');
return { text, missing, pending, recHash: hash };
}
diff --git a/lib/first-use-message.ts b/lib/first-use-message.ts
index 151d7b4c0..c7023aa91 100644
--- a/lib/first-use-message.ts
+++ b/lib/first-use-message.ts
@@ -1,25 +1,32 @@
/**
- * first-use-message — the play spec and the two texts the first-use check prints
- * (docs/first-use-check.md). The play spec holds the ten parts every ask to play
- * or try a build carries (the factory's R47): the links, the device and setup,
- * what it is, how to start, the controls, how long, what we want to learn, how
- * to report back, known quirks and the reply word. renderPlayMessage() is the
- * only "try this build" text, printed after decide() passes; renderBrief() is
- * what the cold checker from the other model family is given, and nothing more.
+ * first-use-message — the play spec and the texts the first-use check prints (docs/first-use-check.md).
+ * The play spec holds the ten parts every ask to play or try a build carries (the factory's R47):
+ * the links, the device and setup (with the target the steps run on), what it is, how to start
+ * (with the numbered try-it steps, each declaring what it writes), the controls, how long, what we
+ * want to learn, how to report back, known quirks and the reply word. renderTryText() is the one
+ * try-it text, frozen at start, opened by the owner's own quoted words: the checker follows it and
+ * the owner gets it. renderPlayMessage() adds what the check found, printed after decide() passes;
+ * renderBrief() is what the cold checker from the other model family is given, and nothing more.
*/
import { buildLabel, type Decision, type FirstUseError, type Manifest } from './first-use';
export interface PlayLink { url: string; label: string; login_gated?: boolean }
+/** A numbered try-it step: what the owner does, and what it writes (`none` or what); a write on his real setup names his approval. */
+export interface PlayStep { text: string; writes: string; approved_write?: string }
+/** What one of the five day-one actions writes, in table order; on the owner's real setup each is required. */
+export type ActionWrites = Omit<PlayStep, 'text'>;
+/** Where the steps run: the owner's real setup, or a copy loaded with realistic data (the default), named exactly. */
+export interface PlayTarget { kind: 'real' | 'realistic-copy'; name: string; data?: string }
export interface PlaySpec {
- links: PlayLink[]; device: string; setup: string; account: string; what: string; start: string;
+ links: PlayLink[]; device: string; setup: string; account: string; target: PlayTarget; what: string; start: string; steps: PlayStep[]; action_writes?: ActionWrites[];
controls: string; minutes: number; learn: string; report: string; quirks: string; reply_word: string;
}
/** R47's ten parts in order, with the play-spec fields each one reads. */
export const PLAY_PARTS: Array<{ part: string; fields: Array<keyof PlaySpec> }> = [
{ part: 'The links, each checked live minutes before sending', fields: ['links'] },
- { part: 'Device and setup', fields: ['device', 'setup', 'account'] },
+ { part: 'Device and setup', fields: ['device', 'setup', 'account', 'target', 'action_writes'] },
{ part: 'What it is, in a sentence', fields: ['what'] },
- { part: 'How to start', fields: ['start'] },
+ { part: 'How to start', fields: ['start', 'steps'] },
{ part: 'Controls', fields: ['controls'] },
{ part: 'How long to play', fields: ['minutes'] },
{ part: 'What we want to learn', fields: ['learn'] },
@@ -28,46 +35,66 @@ export const PLAY_PARTS: Array<{ part: string; fields: Array<keyof PlaySpec> }>
{ part: 'Reply word', fields: ['reply_word'] },
];
const TEXT_FIELDS = ['device', 'setup', 'account', 'what', 'start', 'controls', 'learn', 'report', 'quirks', 'reply_word'] as const;
+const str = (v: unknown) => (typeof v === 'string' ? v.trim() : '');
-/** A complete play spec, or the R47 parts it is missing. "none" is a fine answer for quirks; an empty field is not. */
+/**
+ * A complete play spec, or the R47 parts it is missing. "none" is a fine answer for quirks and for a step's writes; an
+ * empty field is not. A step that writes on the owner's real setup needs `approved_write` naming his approval, and on that
+ * setup `action_writes` says what each of the five day-one actions writes, under the same rule.
+ */
export function checkPlaySpec(raw: unknown): { spec: PlaySpec } | { error: FirstUseError } {
const o = (raw && typeof raw === 'object' ? raw : {}) as Record<string, unknown>;
const bad = new Set<keyof PlaySpec>();
- for (const f of TEXT_FIELDS) if (typeof o[f] !== 'string' || !(o[f] as string).trim()) bad.add(f);
+ for (const f of TEXT_FIELDS) if (!str(o[f])) bad.add(f);
if (typeof o.reply_word === 'string' && !/^[A-Za-z][A-Za-z0-9-]{0,23}$/.test(o.reply_word.trim())) bad.add('reply_word');
if (!Number.isInteger(o.minutes) || (o.minutes as number) < 1 || (o.minutes as number) > 240) bad.add('minutes');
const links = Array.isArray(o.links) ? o.links as Array<Record<string, unknown>> : [];
const linkOk = (l: Record<string, unknown>) => typeof l?.label === 'string' && !!l.label.trim() && typeof l.url === 'string' && /^https?:\/\/[^\s]+$/.test(l.url)
&& (l.login_gated === undefined || typeof l.login_gated === 'boolean');
if (!links.length || !links.every(linkOk)) bad.add('links');
+ const t = (o.target && typeof o.target === 'object' ? o.target : {}) as Record<string, unknown>;
+ const kind = t.kind === undefined ? 'realistic-copy' : t.kind;
+ if ((kind !== 'real' && kind !== 'realistic-copy') || !str(t.name) || (kind === 'realistic-copy' && !str(t.data))) bad.add('target');
+ const steps = Array.isArray(o.steps) ? o.steps as Array<Record<string, unknown>> : [];
+ if (!steps.length || !steps.every(s => !!str(s?.text) && !!str(s?.writes))) bad.add('steps');
+ const acts = o.action_writes === undefined ? undefined : Array.isArray(o.action_writes) ? o.action_writes as Array<Record<string, unknown>> : [];
+ if (acts ? acts.length !== 5 || !acts.every(a => !!str(a?.writes)) : kind === 'real') bad.add('action_writes');
if (bad.size) {
const parts = PLAY_PARTS.filter(p => p.fields.some(f => bad.has(f))).map(p => `${p.part} (${p.fields.filter(f => bad.has(f)).join(', ')})`);
return { error: { code: 'FIRST_USE_PLAY_SPEC_INCOMPLETE', detail: `missing or invalid: ${parts.join('; ')}` } };
}
+ const writesUnapproved = (s: Record<string, unknown>) => !/^none$/i.test(str(s.writes)) && !str(s.approved_write);
+ const unapproved = kind === 'real' ? [...steps.map((s, i) => (writesUnapproved(s) ? `step ${i + 1}` : '')), ...(acts ?? []).map((a, i) => (writesUnapproved(a) ? `day-one action ${i + 1}` : ''))].filter(Boolean) : [];
+ if (unapproved.length) return { error: { code: 'FIRST_USE_PLAY_SPEC_INCOMPLETE', detail: `${unapproved.join(', ')} ${unapproved.length === 1 ? 'writes' : 'write'} on the owner's real setup with no approved_write naming his lettered approval; run it on a realistic copy, or get his approval for that write first` } };
+ const writesOf = (s: Record<string, unknown>) => ({ writes: str(s.writes), ...(str(s.approved_write) ? { approved_write: str(s.approved_write) } : {}) });
const spec: PlaySpec = {
links: links.map(l => ({ url: l.url as string, label: (l.label as string).trim(), ...(l.login_gated ? { login_gated: true } : {}) })),
minutes: o.minutes as number,
- ...Object.fromEntries(TEXT_FIELDS.map(f => [f, (o[f] as string).trim()])) as Omit<PlaySpec, 'links' | 'minutes'>,
+ target: { kind: kind as PlayTarget['kind'], name: str(t.name), ...(str(t.data) ? { data: str(t.data) } : {}) },
+ steps: steps.map(s => ({ text: str(s.text), ...writesOf(s) })),
+ ...(acts ? { action_writes: acts.map(writesOf) } : {}),
+ ...Object.fromEntries(TEXT_FIELDS.map(f => [f, str(o[f])])) as Omit<PlaySpec, 'links' | 'minutes' | 'target' | 'steps' | 'action_writes'>,
};
return { spec };
}
-const hhmm = (iso: string) => iso.slice(11, 16);
-const platformName = { ios: 'iOS', android: 'Android', web: 'web' } as const;
+const platformName = { ios: 'iOS', android: 'Android', web: 'web', macos: 'Mac', server: 'server' } as const;
+export const targetLabel = (t: PlayTarget) => (t.kind === 'real' ? `${t.name} (your real setup)` : `${t.name} (a copy loaded with ${t.data})`);
-/** The "try this build" message: R47's ten parts, then what the cold check covered. Call only after decide() passed. */
-export function renderPlayMessage(d: Decision, now: Date = new Date()): string {
- const m = d.manifest!, p = m.play;
- const checked = d.links.map(l => Date.parse(l.checked_at));
- const oldest = Math.min(...checked);
- const ago = Math.max(0, Math.round((now.getTime() - oldest) / 60_000));
+type TryInput = Pick<Manifest, 'app' | 'build' | 'play' | 'quotes' | 'steps'>;
+/** The try-it text, frozen at start: the owner's quoted words with what this version does with each, then R47's ten parts with the numbered steps. */
+export function renderTryText(m: TryInput): string {
+ const p = m.play;
return [
`**Try ${m.app}: ${buildLabel(m.build)}**`, '',
- `1. **Links** (each checked live at ${new Date(oldest).toISOString().slice(11, 16)} UTC, ${ago} min before this message):`,
+ '**What you asked for, and what this version does with it:**',
+ ...m.quotes.map(q => `- ${q.who}: “${q.text}” → ${q.line}`), '',
+ '1. **Links:**',
...p.links.map(l => ` - [${l.label}](${l.url})${l.login_gated ? ' (asks you to sign in)' : ''}`),
- `2. **Device and setup:** ${p.device}. ${p.setup} Account: ${p.account}.`,
+ `2. **Device and setup:** ${p.device}. ${p.setup} Account: ${p.account}. It runs on ${targetLabel(p.target)}.`,
`3. **What it is:** ${p.what}`,
- `4. **How to start:** ${p.start}`,
+ `4. **How to start:** ${p.start} Then:`,
+ ...m.steps.map(s => ` ${s.n}. ${s.kind === 'action' ? `Try: ${s.text}` : s.text}`),
`5. **Controls:** ${p.controls}`,
`6. **How long:** about ${p.minutes} minutes.`,
`7. **What we want to learn:** ${p.learn}`,
@@ -75,8 +102,25 @@ export function renderPlayMessage(d: Decision, now: Date = new Date()): string {
`9. **Known quirks:** ${p.quirks}`,
`10. **Reply word:** ${p.reply_word}, then your score and your line, for example "${p.reply_word} 7, the first screen was slow".`,
'',
- `Checked before it reached you: an agent from another model family (${m.checker.model}) played this exact build cold on a ${platformName[m.build.platform]} cloud device and did the first ${m.actions.length} things you'll do on day one. All ${d.passed} worked, with a screenshot or video of each:`,
- ...m.actions.map(a => `- ${a.action}`),
+ ].join('\n');
+}
+
+/** The try-it message: the frozen try-it text, then what the check found and the build the owner holds now. Call only after decide() passed. */
+export function renderPlayMessage(d: Decision, now: Date = new Date()): string {
+ const m = d.manifest!;
+ const oldest = Math.min(...d.links.map(l => Date.parse(l.checked_at)));
+ const ago = Math.max(0, Math.round((now.getTime() - oldest) / 60_000));
+ const notice = [...d.verdicts.filter(v => v.verdict === 'thin').map(v => `- Step ${v.n} is thin: ${v.line}`),
+ ...d.verdicts.filter(v => v.notice).map(v => `- At step ${v.n} you'll see: ${v.notice}`)];
+ const held = /^none$/i.test(m.holding.build) ? 'none yet: this is your first build of it.'
+ : `${m.holding.build}. Known defects in it: ${m.holding.defects}.`;
+ return [
+ m.try_text,
+ `Every link was checked live at ${new Date(oldest).toISOString().slice(11, 16)} UTC, ${ago} min before this message.`, '',
+ `**What you'll notice:**`, ...(notice.length ? notice : ['- nothing beyond the known quirks above']), '',
+ `**The build on your device now:** ${held}`, '',
+ `**Checked before it reached you:** an agent from another model family (${m.checker.model}) followed these exact steps on ${targetLabel(m.play.target)}, on a ${platformName[m.build.platform]} ${m.build.platform === 'ios' || m.build.platform === 'android' ? 'device' : 'setup'} like yours. One line per step:`,
+ ...d.verdicts.map(v => `- ${v.n} (${v.verdict}): ${v.line}`),
'',
].join('\n');
}
@@ -84,32 +128,43 @@ export function renderPlayMessage(d: Decision, now: Date = new Date()): string {
/** One POSIX shell word: single quotes, with each embedded single quote closed, escaped and reopened. */
export const shellQuote = (v: string) => `'${v.replace(/'/g, `'\\''`)}'`;
-/** What the cold checker is given: the build, the device and account, the play message parts and the frozen actions, with the commands that record each. */
+const DRIVE: Record<Manifest['build']['platform'], (m: Manifest) => string> = {
+ ios: m => phone(m), android: m => phone(m),
+ web: () => 'open the first link in a browser on that kind of device',
+ macos: m => (m.play.target.kind === 'real'
+ ? "drive the owner's own Mac through the Aside CLI, preferably over Tailscale; use computer use only where the browser can't reach, and never while he is using the Mac"
+ : `use the Mac named as the target (${m.play.target.name}); install this exact build (deploy ${m.build.deploy ?? m.build.testflight}) the way the steps say`),
+ server: m => `work on ${m.play.target.name} over its shell or CLI as the steps say, with this exact build (deploy ${m.build.deploy ?? m.build.testflight}); save a terminal capture (.txt or .log) as evidence where a screenshot shows nothing`,
+};
+function phone(m: Manifest): string {
+ const b = m.build;
+ return `attach a ${platformName[b.platform]} phone (\`tools.capy.phone\` with action "attach", platform "${b.platform}" and the model closest to the device above), install this exact build on it (action "install"; ${b.testflight ? `TestFlight build ${b.testflight}` : `version ${b.deploy}`}), point it at ${m.play.target.name}, and drive its screen with \`tools.capy.computer.on({ machine_id })\``;
+}
+
+/** What the cold checker is given: the exact try-it text, the target and its rules, and the commands that record each step. */
export function renderBrief(m: Manifest, dir: string): string {
- const p = m.play, b = m.build;
- const install = b.platform === 'web'
- ? 'open the first link in a browser on that device'
- : `attach a ${platformName[b.platform]} phone (\`tools.capy.phone\` with action "attach", platform "${b.platform}" and the model closest to the device above), install this exact build on it (action "install"; ${b.testflight ? `TestFlight build ${b.testflight}` : `version ${b.deploy}`}), and drive its screen with \`tools.capy.computer.on({ machine_id })\``;
- const by = `--by ${shellQuote(m.checker.model)}`, run = `--run ${shellQuote(dir)}`;
+ const p = m.play;
+ const by = `--by ${shellQuote(m.checker.model)}`, run = `--run ${shellQuote(dir)}`, fixed = `--account ${shellQuote(p.account)} --target ${shellQuote(p.target.name)} ${by}`;
return [
- `# Cold first-use check: ${m.app}, ${buildLabel(b)}`, '',
- `You are playing this build for the first time, as its owner will. You run on ${m.checker.model}; the team that built it runs on ${m.builder.family} models, and you have not seen its plan, code, notes or messages. Do not read them: you get only what the owner gets, below.`, '',
- '## Device and account', '',
- `Use the same kind of device and account as the owner: ${p.device}. ${p.setup} Account: ${p.account} (play only on this kind of account; \`record\` takes it exactly). On Capy, ${install}.`, '',
- '## What the owner is told', '',
- `- What it is: ${p.what}`, `- Links: ${p.links.map(l => `${l.label} ${l.url}`).join('; ')}`, `- How to start: ${p.start}`, `- Controls: ${p.controls}`,
- `- How long: about ${p.minutes} minutes`, `- Known quirks: ${p.quirks}`, '',
- `## The ${m.actions.length} things the owner will do on day one (frozen ${m.created_at.slice(0, 10)})`, '',
- ...m.actions.map(a => `${a.n}. ${a.action} (${a.frequency || 'how often unstated'}). Way in: ${a.route || 'not stated'}. It works when: ${a.check}`), '',
+ `# Cold first-use check: ${m.app}, ${buildLabel(m.build)}`, '',
+ `You are trying this build for the first time, as its owner will. You run on ${m.checker.model}; the team that built it runs on ${m.builder.family} models, and you have not seen its plan, code, notes or messages. Do not read them: you get only what the owner gets, below.`, '',
+ '## Where you run it, and the rules', '',
+ `Run every step on ${targetLabel(p.target)}, with the owner's kind of device and account: ${p.device}. Account: ${p.account} (\`record\` takes the account and the target exactly). On Capy, ${DRIVE[m.build.platform](m)}.`, '',
+ "- Never send anything as the owner (no messages, mail or posts), and never write to the owner's real setup: a step that writes runs on the copy, except one whose approved_write below names his approval.",
+ "- Never raise a prompt, a permission dialog or a sign-in on the owner's own machine while he is at it.",
+ `- What you read is sent to your model provider (${m.checker.family}); stay inside the steps.`, '',
+ '## The exact message the owner will get', '',
+ '~~~markdown', m.try_text.trimEnd(), '~~~', '',
+ `## The ${m.steps.length} steps you check (frozen ${m.created_at.slice(0, 10)})`, '',
+ ...m.steps.map(s => `${s.n}. ${s.kind === 'action' ? `Day-one action, from the owner's words (quote ${s.quote}): ${s.text}. It works when: ${s.check}` : s.text}. Writes: ${s.writes === 'unknown' ? 'unknown, so treat it as a write' : s.writes}${s.approved_write ? ` (approved: ${s.approved_write})` : ''}`), '',
'## What to do', '',
- '1. Do each action as the owner would, from a cold start, with no help beyond the text above.',
- '2. Capture a screenshot or a short video that shows the result, then record it. A pass means the owner would see it work on the first try; anything else is a fail, and the note says what happened:',
- '', '```bash', `gstack-first-use record ${run} --action N --verdict pass --evidence FILE --device 'DEVICE YOU USED' --account ${shellQuote(p.account)} ${by}`,
- `gstack-first-use record ${run} --action N --verdict fail --evidence FILE --device 'DEVICE YOU USED' --account ${shellQuote(p.account)} ${by} --note 'WHAT HAPPENED'`, '```', '',
+ '1. Follow the message above word for word, from a cold start, with no help beyond it.',
+ "2. For each step, capture a screenshot, a short video or a terminal capture that shows the result, then record a verdict and one line on what the owner would see. useful: it does what he asked, well. thin: it works but does little. wrong: it does something other than what he asked. broken: it fails. Add --needs-lookup when the step asks the owner for something an agent could look up or do, and --notice when a system notice or prompt appears that the message doesn't warn about:",
+ '', '~~~bash', `gstack-first-use record ${run} --step N --verdict useful --line 'WHAT THE OWNER SEES' --evidence FILE --device 'DEVICE YOU USED' ${fixed}`,
+ `gstack-first-use record ${run} --step N --verdict thin --line 'WHAT THE OWNER SEES' --evidence FILE --device 'DEVICE YOU USED' ${fixed} --notice 'THE NOTICE' --needs-lookup 'WHAT IT ASKED FOR'`, '~~~', '',
'3. Predict the owner\'s score from 1 to 10 for this build, with one line on why:', '',
- '```bash', `gstack-first-use predict ${run} --score N --why 'ONE LINE' ${by}`, '```', '',
- '4. Report back: one line per action (pass or fail and why), your predicted score, and the one thing most likely to disappoint the owner.',
+ '~~~bash', `gstack-first-use predict ${run} --score N --why 'ONE LINE' ${by}`, '~~~', '',
+ '4. Report back: one line per step (its verdict and why), your predicted score, and the one thing most likely to disappoint the owner.',
'',
].join('\n');
}
-
diff --git a/lib/first-use.ts b/lib/first-use.ts
index 24d4811be..f21abf907 100644
--- a/lib/first-use.ts
+++ b/lib/first-use.ts
@@ -1,50 +1,62 @@
/**
- * first-use — the cold first-use check for an app build (docs/first-use-check.md).
- * Before a build reaches its owner as "ready to try", an agent from another model
- * family plays that exact build on the same kind of device and account and does
- * the first five things the plan's day-one table says the owner will do. This
- * module keeps the record: an immutable start manifest (the frozen day-one rows
- * with their hash, the play spec, the build fingerprint, the builder's and the
- * checker's model families), one write-once file per action result with its
- * evidence copied in and hashed, dated link receipts, the checker's predicted
- * score and the owner's scores and words. decide() reads it back and refuses the
- * "try it" message unless every frozen action passed on this build, every link
- * was live within 15 minutes, the day-one rows are unchanged and a prediction
- * exists. The record lives in the owner's private user-level Capy Drive folder
- * on Capy (never the public repository), else under the gstack state root.
+ * first-use — the cold first-use check for a first version or app build (docs/first-use-check.md).
+ * Before a build reaches its owner as "ready to try", an agent from another model family follows
+ * the exact try-it message the owner will get, step by step, on the real target (the owner's own
+ * setup, or a copy loaded with realistic data that the play spec names), and writes a verdict and
+ * one line per step: useful, thin, wrong or broken. The steps are the play spec's numbered steps,
+ * then the first five things the plan's day-one table says the owner will do, each citing the
+ * owner's own quoted words (GST-3608). This module keeps the record: an immutable start manifest
+ * (the owner's quotes, the frozen steps and their hash, the try-it text, the play spec, the build
+ * fingerprint, the build the owner holds now with its known defects, the builder's and the
+ * checker's model families), one write-once file per step result with its evidence copied in and
+ * hashed, dated link receipts, the checker's predicted score and the owner's scores and words.
+ * decide() reads it back and refuses the try-it message unless every step was played on this
+ * build and target, none is wrong, broken or asks the owner for something an agent could look up,
+ * no day-one action is thin, every link was live within 15 minutes, the frozen rows and quotes
+ * are unchanged and a prediction exists. The record lives in the owner's private user-level Capy
+ * Drive folder on Capy (never the public repository), else under the gstack state root.
*/
import * as crypto from 'node:crypto';
import * as fs from 'node:fs';
import * as os from 'node:os';
import * as path from 'node:path';
-import { parseDayOne } from './autoplan-owner-text';
+import { lineText, parseDayOne, parseOwnerWords, quoteGaps, quoteWhen } from './autoplan-owner-text';
import { resolveStateRoot } from './state-root';
-import { checkPlaySpec, type PlaySpec } from './first-use-message';
+import { checkPlaySpec, renderTryText, type PlaySpec } from './first-use-message';
export const FIRST_USE_ACTIONS = 5;
export const LINK_FRESH_MS = 15 * 60 * 1000;
export const EVIDENCE_MAX_BYTES = 100 * 1024 * 1024;
-export const EVIDENCE_KINDS: Record<string, 'screenshot' | 'video'> = {
+export const NOTE_MAX = 240;
+export const EVIDENCE_KINDS: Record<string, 'screenshot' | 'video' | 'text'> = {
'.png': 'screenshot', '.jpg': 'screenshot', '.jpeg': 'screenshot', '.gif': 'screenshot', '.webp': 'screenshot', '.heic': 'screenshot',
- '.mp4': 'video', '.mov': 'video', '.webm': 'video',
+ '.mp4': 'video', '.mov': 'video', '.webm': 'video', '.txt': 'text', '.log': 'text',
};
+export const VERDICTS = ['useful', 'thin', 'wrong', 'broken'] as const;
+export type Verdict = typeof VERDICTS[number];
+export const PLATFORMS = ['ios', 'android', 'web', 'macos', 'server'] as const;
export type FirstUseCode = 'FIRST_USE_PLAN_UNREADY' | 'FIRST_USE_PLAY_SPEC_INCOMPLETE' | 'FIRST_USE_SAME_FAMILY' | 'FIRST_USE_NO_PRIVATE_DRIVE' | 'FIRST_USE_RECORD_INVALID' | 'FIRST_USE_REFUSED';
export interface FirstUseError { code: FirstUseCode; detail: string }
type Result<T> = T | { error: FirstUseError };
const fail = (code: FirstUseCode, detail: string) => ({ error: { code, detail } });
-export interface FrozenAction { n: number; action: string; frequency: string; feature: string; route: string; first_build: string; check: string; source: string }
-export interface BuildId { platform: 'ios' | 'android' | 'web'; commit: string; testflight?: string; deploy?: string }
+export interface FrozenQuote { n: number; who: string; when: string; text: string; line: string }
+export interface FrozenAction { n: number; action: string; frequency: string; feature: string; route: string; first_build: string; check: string; source: string; quote: number }
+/** One step of the try-it message: a play-spec step, or one of the five day-one actions (which cite a quote). */
+export interface FrozenStep { n: number; kind: 'step' | 'action'; text: string; writes: string; approved_write?: string; check?: string; quote?: number }
+export interface BuildId { platform: typeof PLATFORMS[number]; commit: string; testflight?: string; deploy?: string }
+export interface Holding { build: string; defects: string }
export interface Manifest {
- schema_version: 1; kind: 'first-use-manifest'; app: string; created_at: string;
- source: { path: string; rows_sha256: string }; actions: FrozenAction[];
- build: BuildId & { fingerprint: string }; play: PlaySpec;
+ schema_version: 2; kind: 'first-use-manifest'; app: string; created_at: string;
+ source: { path: string; rows_sha256: string }; quotes: FrozenQuote[]; actions: FrozenAction[]; steps: FrozenStep[];
+ try_text: string; try_sha256: string; build: BuildId & { fingerprint: string }; play: PlaySpec; holding: Holding;
builder: { model: string; family: string }; checker: { model: string; family: string };
}
-export interface ActionResult {
- schema_version: 1; kind: 'first-use-result'; action: number; action_text: string; build_fingerprint: string; at: string;
- verdict: 'pass' | 'fail'; evidence: { file: string; sha256: string; bytes: number; kind: 'screenshot' | 'video' };
- device: string; account: string; by: { model: string; family: string }; note: string;
+export interface StepResult {
+ schema_version: 2; kind: 'first-use-result'; step: number; step_text: string; step_kind: FrozenStep['kind']; build_fingerprint: string; at: string;
+ verdict: Verdict; line: string; needs_lookup?: string; notice?: string;
+ evidence: { file: string; sha256: string; bytes: number; kind: 'screenshot' | 'video' | 'text' };
+ device: string; account: string; target: string; by: { model: string; family: string };
}
/** Who a check speaks for: the owner-equivalent account from the play spec and the build's device class. */
export interface Audience { account: string; device_class: BuildId['platform'] }
@@ -78,28 +90,45 @@ export function modelFamily(model: string): string | undefined {
return FAMILY_WORDS.find(([, re]) => re.test(s))?.[0] ?? (slash > 0 ? prefix : undefined);
}
-/** The first five rows of the plan's `### Day one` table (lib/autoplan-owner-text.ts parses it; the format is pinned by test/first-use.test.ts). */
-export function freezeActions(planText: string): Result<{ actions: FrozenAction[]; rows_sha256: string }> {
+/** Checker free text as one plain line: Markdown links keep their text, HTML tags and line breaks go, at most NOTE_MAX characters. */
+export const plainLine = (t: string | undefined): string => (t ?? '').replace(/!?\[([^\]]*)\]\([^)]*\)/g, '$1').replace(/<[^>]*>/g, '')
+ .replace(/\s+/g, ' ').trim().slice(0, NOTE_MAX);
+
+/**
+ * What the check freezes from the plan: every quote under `### Owner's words` (each with its time and line) and the first
+ * five rows of the `### Day one` table, each citing `owner words <n>` for a real quote. The hash covers the rows and the
+ * text of every quote, so editing or renumbering a cited quote changes it. The format is pinned by test/first-use.test.ts.
+ */
+export function freezeActions(planText: string): Result<{ actions: FrozenAction[]; quotes: FrozenQuote[]; rows_sha256: string }> {
const day = parseDayOne(planText);
if (day.status === 'none') return fail('FIRST_USE_PLAN_UNREADY', 'the plan has no ### Day one table');
if (day.status === 'malformed') return fail('FIRST_USE_PLAN_UNREADY', day.reason ?? 'the day-one table is malformed');
if (day.rows.length < FIRST_USE_ACTIONS) return fail('FIRST_USE_PLAN_UNREADY', `the day-one table has ${day.rows.length} row${day.rows.length === 1 ? '' : 's'}; the check needs ${FIRST_USE_ACTIONS}`);
+ const words = parseOwnerWords(planText);
+ if (words.status === 'none' || !words.quotes.length) return fail('FIRST_USE_PLAN_UNREADY', "the plan has no ### Owner's words section: quote each message of the owner's that states the job, with its time and a line each");
+ if (words.status === 'malformed') return fail('FIRST_USE_PLAN_UNREADY', `### Owner's words is malformed: ${words.reason}`);
+ const gaps = words.quotes.filter(q => quoteGaps(q).length);
+ if (gaps.length) return fail('FIRST_USE_PLAN_UNREADY', `owner quote ${gaps.map(q => `${q.n} needs ${quoteGaps(q).join(' and ')}`).join('; ')}`);
const rows = day.rows.slice(0, FIRST_USE_ACTIONS);
const blank = rows.map((r, i) => [r.frequency, r.source, r.feature, r.route, r.first_build, r.check].some(c => !c.trim()) ? i + 1 : 0).filter(Boolean);
if (blank.length) return fail('FIRST_USE_PLAN_UNREADY', `day-one row ${blank.join(', ')} has an empty cell; every column of the first ${FIRST_USE_ACTIONS} rows needs a value`);
const assumed = rows.map((r, i) => r.assumed ? i + 1 : 0).filter(Boolean);
if (assumed.length) return fail('FIRST_USE_PLAN_UNREADY', `day-one row ${assumed.join(', ')} is still marked assumed`);
- const actions = rows.map((r, i) => ({ n: i + 1, action: r.action, frequency: r.frequency, feature: r.feature, route: r.route, first_build: r.first_build, check: r.check, source: r.source }));
- return { actions, rows_sha256: sha256(JSON.stringify(actions)) };
+ const cited = rows.map(r => Number(/^\W*owner words\s+(\d+)\b/i.exec(r.source)?.[1] ?? 0));
+ const uncited = cited.map((n, i) => (words.quotes.some(q => q.n === n) ? 0 : i + 1)).filter(Boolean);
+ if (uncited.length) return fail('FIRST_USE_PLAN_UNREADY', `day-one row ${uncited.join(', ')} cites none of the owner's quotes: its source must read "owner words <n>" (a row the owner confirmed at the gate cites his answer, added to Owner's words)`);
+ const quotes = words.quotes.map(q => ({ n: q.n, who: q.who, when: quoteWhen(q), text: q.text, line: lineText(q) }));
+ const actions = rows.map((r, i) => ({ n: i + 1, action: r.action, frequency: r.frequency, feature: r.feature, route: r.route, first_build: r.first_build, check: r.check, source: r.source, quote: cited[i]! }));
+ return { actions, quotes, rows_sha256: sha256(JSON.stringify({ actions, quotes })) };
}
/** Validates a build id; the fingerprint is the hash of platform, commit and the TestFlight build or deploy version. */
export function buildFingerprint(b: Partial<BuildId>): Result<BuildId & { fingerprint: string }> {
- if (b.platform !== 'ios' && b.platform !== 'android' && b.platform !== 'web') return fail('FIRST_USE_RECORD_INVALID', '--platform must be ios, android or web');
+ if (!(PLATFORMS as readonly string[]).includes(b.platform ?? '')) return fail('FIRST_USE_RECORD_INVALID', `--platform must be ${PLATFORMS.join(', ')}`);
if (!/^[0-9a-f]{40}$/.test(b.commit ?? '')) return fail('FIRST_USE_RECORD_INVALID', '--commit must be the full 40-character commit the build was made from');
const tf = b.testflight?.trim(), dep = b.deploy?.trim();
if (!!tf === !!dep) return fail('FIRST_USE_RECORD_INVALID', 'give exactly one of --testflight <build number> or --deploy <version>');
- const id: BuildId = { platform: b.platform, commit: b.commit!, ...(tf ? { testflight: tf } : { deploy: dep }) };
+ const id: BuildId = { platform: b.platform!, commit: b.commit!, ...(tf ? { testflight: tf } : { deploy: dep }) };
return { ...id, fingerprint: sha256(JSON.stringify([id.platform, id.commit, id.testflight ?? '', id.deploy ?? ''])).slice(0, 16) };
}
export const buildLabel = (b: BuildId) => `${b.commit.slice(0, 12)}, ${b.testflight ? `TestFlight build ${b.testflight}` : `deploy ${b.deploy}`}`;
@@ -126,8 +155,15 @@ const writeOnce = (file: string, value: unknown) => {
};
const readJson = <T>(file: string): T | undefined => { try { return JSON.parse(fs.readFileSync(file, 'utf8')) as T; } catch { return undefined; } };
-export interface StartInput { root: string; app: string; planPath: string; build: Partial<BuildId>; play: unknown; builder: string; checker: string; now?: Date }
-/** Freezes the day-one rows and writes the run's manifest once; returns the run directory. */
+/** The build the owner holds now and its known defects: `none` for a first build, else a label and a list or `none`. */
+function checkHolding(h: Partial<Holding> | undefined): Result<{ holding: Holding }> {
+ const build = plainLine(h?.build), defects = plainLine(h?.defects);
+ if (!build || !defects) return fail('FIRST_USE_RECORD_INVALID', 'name the build the owner holds now and its known defects: --holding "<build label>|none" --holding-defects "<each known defect>|none"');
+ return { holding: { build, defects } };
+}
+
+export interface StartInput { root: string; app: string; planPath: string; build: Partial<BuildId>; play: unknown; holding: Partial<Holding>; builder: string; checker: string; now?: Date }
+/** Freezes the owner's quotes, the steps and the try-it text, and writes the run's manifest once; returns the run directory. */
export function startRun(o: StartInput): Result<{ dir: string; manifest: Manifest }> {
if (!/^[a-z0-9][a-z0-9-]{0,63}$/.test(o.app)) return fail('FIRST_USE_RECORD_INVALID', '--app must be a lowercase slug like ghome');
let planText: string;
@@ -138,24 +174,31 @@ export function startRun(o: StartInput): Result<{ dir: string; manifest: Manifes
if ('error' in play) return play;
const build = buildFingerprint(o.build);
if ('error' in build) return build;
+ const holding = checkHolding(o.holding);
+ if ('error' in holding) return holding;
const builder = modelFamily(o.builder), checker = modelFamily(o.checker);
if (!builder || !checker) return fail('FIRST_USE_SAME_FAMILY', `unknown model family for ${!builder ? `--builder ${o.builder}` : `--checker ${o.checker}`}`);
if (builder === checker) return fail('FIRST_USE_SAME_FAMILY', `builder and checker are both ${builder}`);
const now = o.now ?? new Date();
- const manifest: Manifest = {
- schema_version: 1, kind: 'first-use-manifest', app: o.app, created_at: now.toISOString(),
- source: { path: path.resolve(o.planPath), rows_sha256: frozen.rows_sha256 }, actions: frozen.actions,
- build, play: play.spec, builder: { model: o.builder, family: builder }, checker: { model: o.checker, family: checker },
- };
+ const steps: FrozenStep[] = [
+ ...play.spec.steps.map((s, i) => ({ n: i + 1, kind: 'step' as const, text: s.text, writes: s.writes, ...(s.approved_write ? { approved_write: s.approved_write } : {}) })),
+ ...frozen.actions.map((a, i) => ({ n: play.spec.steps.length + i + 1, kind: 'action' as const, text: a.action, ...(play.spec.action_writes?.[i] ?? { writes: 'unknown' }), check: a.check, quote: a.quote })),
+ ];
+ const base = { schema_version: 2 as const, kind: 'first-use-manifest' as const, app: o.app, created_at: now.toISOString(),
+ source: { path: path.resolve(o.planPath), rows_sha256: frozen.rows_sha256 }, quotes: frozen.quotes, actions: frozen.actions, steps,
+ build, play: play.spec, holding: holding.holding, builder: { model: o.builder, family: builder }, checker: { model: o.checker, family: checker } };
+ const try_text = renderTryText(base);
+ const manifest: Manifest = { ...base, try_text, try_sha256: sha256(try_text) };
const dir = path.join(o.root, o.app, `${stamp(now)}-${build.fingerprint.slice(0, 8)}`);
try { writeOnce(path.join(dir, 'manifest.json'), manifest); } catch (e) { return fail('FIRST_USE_RECORD_INVALID', `cannot write ${dir}/manifest.json: ${(e as Error).message}`); }
return { dir, manifest };
}
export function readManifest(dir: string): Result<{ manifest: Manifest }> {
- const m = readJson<Manifest>(path.join(dir, 'manifest.json'));
- if (!m || m.schema_version !== 1 || m.kind !== 'first-use-manifest' || !Array.isArray(m.actions) || !m.build?.fingerprint) return fail('FIRST_USE_RECORD_INVALID', `no readable manifest.json in ${dir}`);
- return { manifest: m };
+ const m = readJson<Omit<Manifest, 'schema_version'> & { schema_version: number }>(path.join(dir, 'manifest.json'));
+ if (m?.kind === 'first-use-manifest' && m.schema_version === 1) return fail('FIRST_USE_RECORD_INVALID', `${dir} is a schema-1 run from before the try-it steps and the owner's quotes were checked; start a new run`);
+ if (!m || m.schema_version !== 2 || m.kind !== 'first-use-manifest' || !Array.isArray(m.steps) || !m.build?.fingerprint) return fail('FIRST_USE_RECORD_INVALID', `no readable manifest.json in ${dir}`);
+ return { manifest: m as Manifest };
}
/** The checker's own model, from its own family: the builder never grades its own build. */
@@ -165,35 +208,39 @@ function checkerOf(m: Manifest, by: string): Result<{ by: { model: string; famil
return { by: { model: by, family } };
}
-export interface RecordInput { dir: string; action: number; verdict: string; evidence: string; device: string; account: string; by: string; note?: string; now?: Date }
-/** One write-once result for one frozen action; the evidence file is copied into the run and hashed. */
-export function recordResult(o: RecordInput): Result<{ file: string; result: ActionResult }> {
+export interface RecordInput { dir: string; step: number; verdict: string; line: string; evidence: string; device: string; account: string; target: string; by: string; needsLookup?: string; notice?: string; now?: Date }
+/** One write-once result for one frozen step; the evidence file is copied into the run and hashed. */
+export function recordResult(o: RecordInput): Result<{ file: string; result: StepResult }> {
const read = readManifest(o.dir);
if ('error' in read) return read;
const m = read.manifest;
- const action = m.actions.find(a => a.n === o.action);
- if (!action) return fail('FIRST_USE_RECORD_INVALID', `--action must be 1 to ${m.actions.length}`);
- if (o.verdict !== 'pass' && o.verdict !== 'fail') return fail('FIRST_USE_RECORD_INVALID', '--verdict must be pass or fail');
+ const step = m.steps.find(s => s.n === o.step);
+ if (!step) return fail('FIRST_USE_RECORD_INVALID', `--step must be 1 to ${m.steps.length}`);
+ if (!(VERDICTS as readonly string[]).includes(o.verdict)) return fail('FIRST_USE_RECORD_INVALID', `--verdict must be ${VERDICTS.join(', ')}`);
+ const line = plainLine(o.line);
+ if (!line) return fail('FIRST_USE_RECORD_INVALID', '--line needs one line on what the owner would see at this step');
if (!o.device.trim()) return fail('FIRST_USE_RECORD_INVALID', 'name the --device you played on');
if (o.account.trim() !== m.play.account) return fail('FIRST_USE_RECORD_INVALID', `play on the owner-equivalent account and pass it exactly: --account "${m.play.account}"`);
- if (o.verdict === 'fail' && !o.note?.trim()) return fail('FIRST_USE_RECORD_INVALID', 'a fail needs --note saying what happened');
+ if (o.target.trim() !== m.play.target.name) return fail('FIRST_USE_RECORD_INVALID', `play on the play spec's target and pass it exactly: --target "${m.play.target.name}"`);
const who = checkerOf(m, o.by);
if ('error' in who) return who;
- const ev = copyEvidence(o.dir, o.action, o.evidence);
+ const ev = copyEvidence(o.dir, o.step, o.evidence);
if ('error' in ev) return ev;
const now = o.now ?? new Date();
- const result: ActionResult = {
- schema_version: 1, kind: 'first-use-result', action: o.action, action_text: action.action, build_fingerprint: m.build.fingerprint, at: now.toISOString(),
- verdict: o.verdict, evidence: ev.evidence, device: o.device.trim(), account: o.account.trim(), by: who.by, note: o.note?.trim() ?? '',
+ const lookup = plainLine(o.needsLookup), notice = plainLine(o.notice);
+ const result: StepResult = {
+ schema_version: 2, kind: 'first-use-result', step: o.step, step_text: step.text, step_kind: step.kind, build_fingerprint: m.build.fingerprint, at: now.toISOString(),
+ verdict: o.verdict as Verdict, line, ...(lookup ? { needs_lookup: lookup } : {}), ...(notice ? { notice } : {}),
+ evidence: ev.evidence, device: o.device.trim(), account: o.account.trim(), target: o.target.trim(), by: who.by,
};
- const file = path.join(o.dir, 'results', `${o.action}-${stamp(now)}-${crypto.randomBytes(3).toString('hex')}.json`);
+ const file = path.join(o.dir, 'results', `${o.step}-${stamp(now)}-${crypto.randomBytes(3).toString('hex')}.json`);
try { writeOnce(file, result); } catch (e) { return fail('FIRST_USE_RECORD_INVALID', `cannot write ${file}: ${(e as Error).message}`); }
return { file, result };
}
-function copyEvidence(dir: string, n: number, src: string): Result<{ evidence: ActionResult['evidence'] }> {
+function copyEvidence(dir: string, n: number, src: string): Result<{ evidence: StepResult['evidence'] }> {
const kind = EVIDENCE_KINDS[path.extname(src).toLowerCase()];
- if (!kind) return fail('FIRST_USE_RECORD_INVALID', `evidence must be a screenshot or short video (${Object.keys(EVIDENCE_KINDS).join(' ')})`);
+ if (!kind) return fail('FIRST_USE_RECORD_INVALID', `evidence must be a screenshot, a short video or a terminal capture (${Object.keys(EVIDENCE_KINDS).join(' ')})`);
let st: fs.Stats;
try { st = fs.lstatSync(src); } catch { return fail('FIRST_USE_RECORD_INVALID', `no evidence file at ${src}`); }
if (!st.isFile()) return fail('FIRST_USE_RECORD_INVALID', 'the evidence must be a regular file, not a link or directory');
@@ -249,7 +296,7 @@ export function predict(o: { dir: string; score: string; why: string; by: string
if (n === undefined || !o.why.trim()) return fail('FIRST_USE_RECORD_INVALID', 'predict needs --score 1-10 and --why <one line>');
const who = checkerOf(read.manifest, o.by);
if ('error' in who) return who;
- const prediction: Prediction = { schema_version: 1, kind: 'first-use-prediction', score: n, why: o.why.trim(), by: who.by, at: (o.now ?? new Date()).toISOString(), build_fingerprint: read.manifest.build.fingerprint };
+ const prediction: Prediction = { schema_version: 1, kind: 'first-use-prediction', score: n, why: plainLine(o.why), by: who.by, at: (o.now ?? new Date()).toISOString(), build_fingerprint: read.manifest.build.fingerprint };
try { writeOnce(path.join(o.dir, 'prediction.json'), prediction); } catch { return fail('FIRST_USE_RECORD_INVALID', 'this run already has a predicted score; start a new run to predict again'); }
return { prediction };
}
@@ -276,14 +323,17 @@ function readDir<T>(dir: string): { rows: T[]; unreadable: string[] } {
}
const newest = <T extends { at?: string; checked_at?: string }>(rows: T[]) => [...rows].sort((a, b) => (a.at ?? a.checked_at ?? '').localeCompare(b.at ?? b.checked_at ?? '')).at(-1);
-export interface Decision { ok: boolean; reasons: string[]; manifest?: Manifest; passed: number; links: LinkReceipt[]; prediction?: Prediction; owner?: OwnerScore }
+export interface StepVerdict { n: number; kind: FrozenStep['kind']; text: string; verdict: Verdict; line: string; notice?: string }
+export interface Decision { ok: boolean; reasons: string[]; manifest?: Manifest; passed: number; verdicts: StepVerdict[]; links: LinkReceipt[]; prediction?: Prediction; owner?: OwnerScore }
/**
- * Whether this run clears the build about to be sent: the same build, unchanged day-one rows, a pass with intact
- * evidence for every frozen action, a live receipt under 15 minutes old for every play link, and a predicted score.
+ * Whether this run clears the build about to be sent: the same build, unchanged day-one rows and quotes, a newest result
+ * with intact evidence for every step on the play spec's target, none wrong, broken or needing something an agent could
+ * look up, no thin day-one action (each comes from the owner's words), a live receipt under 15 minutes old for every play
+ * link, and a predicted score. A thin play step or a notice the owner would see passes and is named in the message.
*/
export function decide(dir: string, build: Partial<BuildId>, now: Date = new Date()): Decision {
const read = readManifest(dir);
- if ('error' in read) return { ok: false, reasons: [read.error.detail], passed: 0, links: [] };
+ if ('error' in read) return { ok: false, reasons: [read.error.detail], passed: 0, verdicts: [], links: [] };
const m = read.manifest, reasons: string[] = [];
const current = buildFingerprint(build);
if ('error' in current) reasons.push(current.error.detail);
@@ -293,19 +343,26 @@ export function decide(dir: string, build: Partial<BuildId>, now: Date = new Dat
if (planText !== undefined) {
const again = freezeActions(planText);
if ('error' in again) reasons.push(`source_changed: ${again.error.detail}`);
- else if (again.rows_sha256 !== m.source.rows_sha256) reasons.push('source_changed: the day-one rows changed since the check started; start a new run');
+ else if (again.rows_sha256 !== m.source.rows_sha256) reasons.push('source_changed: the day-one rows or the owner\'s quotes changed since the check started; start a new run');
}
if (m.builder.family === m.checker.family) reasons.push('same_family');
- const results = readDir<ActionResult>(path.join(dir, 'results'));
+ if (sha256(m.try_text) !== m.try_sha256) reasons.push('try_text_changed: the frozen try-it text no longer matches its hash; start a new run');
+ const results = readDir<StepResult>(path.join(dir, 'results'));
if (results.unreadable.length) reasons.push(`record_unreadable: results/${results.unreadable.join(', results/')}`);
let passed = 0;
- for (const a of m.actions) {
- const r = newest(results.rows.filter(x => x.action === a.n && x.build_fingerprint === m.build.fingerprint && x.by?.family === m.checker.family && x.account === m.play.account));
- if (!r) { reasons.push(`action_${a.n}_not_played`); continue; }
- if (r.verdict !== 'pass') { reasons.push(`action_${a.n}_failed: ${r.note}`); continue; }
+ const verdicts: StepVerdict[] = [];
+ for (const s of m.steps) {
+ const r = newest(results.rows.filter(x => x.step === s.n && x.build_fingerprint === m.build.fingerprint && x.by?.family === m.checker.family
+ && x.account === m.play.account && x.target === m.play.target.name));
+ if (!r) { reasons.push(`step_${s.n}_not_played`); continue; }
let bytes: Buffer | undefined;
try { bytes = fs.readFileSync(path.join(dir, r.evidence.file)); } catch { /* missing */ }
- if (!bytes || bytes.length !== r.evidence.bytes || sha256(bytes) !== r.evidence.sha256) { reasons.push(`action_${a.n}_evidence_stale`); continue; }
+ if (!bytes || bytes.length !== r.evidence.bytes || sha256(bytes) !== r.evidence.sha256) { reasons.push(`step_${s.n}_evidence_stale`); continue; }
+ verdicts.push({ n: s.n, kind: s.kind, text: s.text, verdict: r.verdict, line: r.line, ...(r.notice ? { notice: r.notice } : {}) });
+ if (r.verdict === 'wrong' || r.verdict === 'broken') { reasons.push(`step_${s.n}_${r.verdict}: ${r.line}`); continue; }
+ if (r.verdict !== 'useful' && r.verdict !== 'thin') { reasons.push(`step_${s.n}_verdict_unknown: ${String(r.verdict)}`); continue; }
+ if (r.needs_lookup) { reasons.push(`step_${s.n}_needs_lookup: ${r.needs_lookup} (an agent looks it up or does it; the owner is never asked)`); continue; }
+ if (r.verdict === 'thin' && s.kind === 'action') { reasons.push(`step_${s.n}_thin: ${r.line} (a day-one action comes from the owner's own words)`); continue; }
passed++;
}
const receipts = readDir<LinkReceipt>(path.join(dir, 'links'));
@@ -320,5 +377,5 @@ export function decide(dir: string, build: Partial<BuildId>, now: Date = new Dat
const prediction = readJson<Prediction>(path.join(dir, 'prediction.json'));
if (!prediction) reasons.push('no_predicted_score');
const owner = newest(readDir<OwnerScore>(path.join(dir, 'owner')).rows);
- return { ok: reasons.length === 0, reasons, manifest: m, passed, links, prediction, owner };
+ return { ok: reasons.length === 0, reasons, manifest: m, passed, verdicts, links, prediction, owner };
}
diff --git a/lib/gate-list.ts b/lib/gate-list.ts
index 12759f22f..a871643e8 100644
--- a/lib/gate-list.ts
+++ b/lib/gate-list.ts
@@ -21,7 +21,7 @@
* Rendered by bin/gstack-gate; rows land in decisions.jsonl (lib/headless-artifacts.ts).
*/
import { createHash } from 'node:crypto';
-import { ownerWordsLine } from './autoplan-owner-text';
+import { ownerWordsLine, type OwnerLine } from './autoplan-owner-text';
import type { DecisionRow } from './headless-artifacts';
/** `changes_plan`: choosing this option is an accepted plan change (reopens its phase plus Eng, prints APPLY:). */
@@ -49,7 +49,7 @@ export interface GateItem {
finding?: string[];
}
export type ItemClass = 'challenge2' | 'challenge1' | 'disagree' | 'agent' | 'cap_deferred' | 'cap_blocker' | 'cap_delta' | 'finding' | 'p1'
- | 'proposal' | 'confirm_direction' | 'day_one' | 'cut' | 'cuts';
+ | 'proposal' | 'confirm_direction' | 'day_one' | 'cut' | 'cuts' | 'owner_words' | 'owner_choice';
export interface GateList { schema_version: 1; run: string; gate_rev: number; items: GateItem[]; title?: string;
/** Bumped by every `recommend`, so a `rec` relayed before it no longer matches `recHash`. */
rec_rev?: number;
@@ -58,7 +58,9 @@ export interface GateList { schema_version: 1; run: string; gate_rev: number; it
/** The plan's plain-language ask, read from the reviewed plan (lib/captain-brief.ts `buildEli5`); printed first. */
eli5?: GateEli5;
/** The plan's `### Owner's words` (lib/autoplan-owner-text.ts): the quotes a challenge must name to keep the plan's direction; `verified` when a recorded owner reply holds it. */
- owner_words?: { status: 'ok' | 'malformed' | 'none'; quotes: Array<{ n: number; who: string; text: string; verified: boolean }>; reason?: string; fix?: string };
+ owner_words?: { status: 'ok' | 'malformed' | 'none'; quotes: Array<{ n: number; who: string; text: string; verified: boolean; line?: OwnerLine }>; reason?: string; fix?: string };
+ /** A first version (a Day one section or `--first-version`): the owner brief adds the gstack-first-use line. */
+ first_version?: boolean;
/** The one-reviewer check of an unreviewed post-cap delta before a carry (lib/autoplan-carry.ts). */
carry_check?: { attempt: string; model: string; verdict: 'passed' | 'failed' | 'unavailable'; max_severity: string; findings: number; at: string } }
/** The captain approvals shape (crew/docs/captain.md § Approvals), section text taken from the reviewed plan; '' when absent. */
diff --git a/lib/owner-brief.ts b/lib/owner-brief.ts
index 3573527b8..ba69d452e 100644
--- a/lib/owner-brief.ts
+++ b/lib/owner-brief.ts
@@ -13,7 +13,7 @@
import * as fs from 'node:fs';
import * as path from 'node:path';
import { gateCost, gateCostSentence } from './autoplan-gate-cost';
-import { renderDayOne } from './autoplan-owner-text';
+import { renderOwnerPage } from './autoplan-owner-text';
import { decisionId, PAGE_SIZE, renderGate, type GateList } from './gate-list';
import { readJsonl, renderUrgentBlock, type DecisionRow } from './headless-artifacts';
import type { ResultCodeName } from './result-codes';
@@ -90,7 +90,7 @@ export function renderBrief(inputs: BriefInputs, o: { page?: number; summary?: s
'',
renderUrgentBlock(inputs.findings).trimEnd(),
'',
- ...renderDayOne(planText(o.outDir, inputs.run), inputs.gate.owner_words?.quotes),
+ ...renderOwnerPage(planText(o.outDir, inputs.run), inputs.gate.owner_words?.quotes, { firstVersion: inputs.gate.first_version }),
'### Summary',
'',
plainSummary(inputs, o.summary),
diff --git a/lib/result-codes-capy.ts b/lib/result-codes-capy.ts
index 6f2e2eb18..3a414ca01 100644
--- a/lib/result-codes-capy.ts
+++ b/lib/result-codes-capy.ts
@@ -207,8 +207,8 @@ export const CAPY_RESULT_CODES = {
},
FIRST_USE_PLAN_UNREADY: {
anchor: 'first-use-plan-unready',
- summary: 'the plan has no usable ### Day one table to freeze (missing, malformed, fewer than five complete rows, or a row still marked assumed)',
- fix: 'add or fix the ### Day one table (action, frequency, source, feature, route, first build, check) and confirm every assumed row with the owner, then run start again',
+ summary: 'the plan has no usable ### Day one table or ### Owner\'s words to freeze (missing, malformed, fewer than five complete rows, a row still marked assumed or citing no quote, or a quote with no time or line)',
+ fix: 'quote the owner\'s messages that state the job under ### Owner\'s words (who, when, "words" → does it | choice), cite them from the five ### Day one rows as owner words <n>, then run start again',
},
FIRST_USE_PLAY_SPEC_INCOMPLETE: {
anchor: 'first-use-play-spec-incomplete',
@@ -232,7 +232,7 @@ export const CAPY_RESULT_CODES = {
},
FIRST_USE_REFUSED: {
anchor: 'first-use-refused',
- summary: 'the build has not cleared its first-use check, so no "try this build" message or "v1 is ready" report may go out',
- fix: 'act on each reason the line lists: replay the failed or unplayed actions, rerun links within 15 minutes of sending, add the predicted score, or start a new run for a new build or changed day-one rows',
+ summary: 'the build has not cleared its first-use check, so no try-it message or "v1 is ready" report may go out',
+ fix: 'act on each reason the line lists: fix and replay each unplayed, broken, wrong, thin day-one or needs-lookup step, rerun links within 15 minutes of sending, add the predicted score, or start a new run for a new build or changed rows or quotes',
},
} satisfies Record<string, ResultCode>;
diff --git a/ship/sections/apple-release.md b/ship/sections/apple-release.md
index 71767d758..d655dd7a9 100644
--- a/ship/sections/apple-release.md
+++ b/ship/sections/apple-release.md
@@ -96,3 +96,5 @@ Build this question's options from a LIVE check of installed skills at ask time
`produce` already created the app record and bundle ID during the run — never call the app record a manual gate. Apply the pricing settled in the authorization moment through the App Store Connect price-schedule endpoint (`POST /v1/appPriceSchedules` via the session or the minted key): fastlane's `price_tier` option is broken against the current API ("'prices' is not a relationship on 'apps'"), so never route pricing through it or call its failure an account problem. `deliver` owns everything else the store listing needs: description, keywords, localizations, screenshot upload per device size, attaching the uploaded build, and Submit for Review; `pilot` manages TestFlight groups and testers as an intermediate round when the user asked for one. Submission follows the same durable-effect contract with key `appstore.submit.<bundle-id>.<version>` — on ambiguity, inspect App Store Connect before re-running. Monitor review status from the CLI afterward.
What remains web-only, ever: the paid Apple Developer Program membership purchase itself (a precondition, not a release step) and, for PAID apps only, the one-time Paid Apps agreement with banking and tax — offer the agentic-browser drive per the Third-Party Web Actions contract (earlier in this skill) before any manual checklist for those. A free app needs no browser at any point. After submission, report that App Review typically answers within a day or two and close the run; review outcome is not a gate this workflow can hold open. In that SAME closing report, disclose the durable credential the release created — one line, once per run: "This created an App Store Connect API key (`gstack-upload`, scoped to this app) that persists for future releases; revoke it anytime at App Store Connect → Users and Access → Integrations, or delete `~/.gstack/apple/api-key.json` locally." This is the deliberate exception to the mid-run no-credential-talk rule in this adapter's opening section: the user is otherwise never told a standing credential now exists on their account and on disk, so it never reaches their revocation checklist. Disclosure at exit, not a mid-run question, so the one-authorization-moment contract holds.
+
+TestFlight builds for someone else: when the build goes to an owner trying a first version (not to the person running this release), send the try-it ask only after the build clears `gstack-first-use` (`docs/first-use-check.md`), whose message names the build he holds now and its known defects.
diff --git a/ship/sections/apple-release.md.tmpl b/ship/sections/apple-release.md.tmpl
index fab789fe6..7d602f835 100644
--- a/ship/sections/apple-release.md.tmpl
+++ b/ship/sections/apple-release.md.tmpl
@@ -94,3 +94,5 @@ Build this question's options from a LIVE check of installed skills at ask time
`produce` already created the app record and bundle ID during the run — never call the app record a manual gate. Apply the pricing settled in the authorization moment through the App Store Connect price-schedule endpoint (`POST /v1/appPriceSchedules` via the session or the minted key): fastlane's `price_tier` option is broken against the current API ("'prices' is not a relationship on 'apps'"), so never route pricing through it or call its failure an account problem. `deliver` owns everything else the store listing needs: description, keywords, localizations, screenshot upload per device size, attaching the uploaded build, and Submit for Review; `pilot` manages TestFlight groups and testers as an intermediate round when the user asked for one. Submission follows the same durable-effect contract with key `appstore.submit.<bundle-id>.<version>` — on ambiguity, inspect App Store Connect before re-running. Monitor review status from the CLI afterward.
What remains web-only, ever: the paid Apple Developer Program membership purchase itself (a precondition, not a release step) and, for PAID apps only, the one-time Paid Apps agreement with banking and tax — offer the agentic-browser drive per the Third-Party Web Actions contract (earlier in this skill) before any manual checklist for those. A free app needs no browser at any point. After submission, report that App Review typically answers within a day or two and close the run; review outcome is not a gate this workflow can hold open. In that SAME closing report, disclose the durable credential the release created — one line, once per run: "This created an App Store Connect API key (`gstack-upload`, scoped to this app) that persists for future releases; revoke it anytime at App Store Connect → Users and Access → Integrations, or delete `~/.gstack/apple/api-key.json` locally." This is the deliberate exception to the mid-run no-credential-talk rule in this adapter's opening section: the user is otherwise never told a standing credential now exists on their account and on disk, so it never reaches their revocation checklist. Disclosure at exit, not a mid-run question, so the one-authorization-moment contract holds.
+
+TestFlight builds for someone else: when the build goes to an owner trying a first version (not to the person running this release), send the try-it ask only after the build clears `gstack-first-use` (`docs/first-use-check.md`), whose message names the build he holds now and its known defects.
diff --git a/test/autoplan-day-one-gate.test.ts b/test/autoplan-day-one-gate.test.ts
index a14165fbf..9f9227a7e 100644
--- a/test/autoplan-day-one-gate.test.ts
+++ b/test/autoplan-day-one-gate.test.ts
@@ -26,7 +26,8 @@ import { confirmBlock, openEarlier, settledIds } from '../lib/autoplan-confirm';
import { buildTasks } from '../lib/autoplan-export';
import { exportPublic } from '../lib/autoplan-public';
import * as crypto from 'node:crypto';
-import { cutDrops, parseCuts, parseDayOne, parseOwnerWords, ownerWordsLine } from '../lib/autoplan-owner-text';
+import { cutDrops, parseCuts, parseDayOne, parseOwnerWords, ownerWordsLine, renderOwnerPage } from '../lib/autoplan-owner-text';
+import { detectScope, RESULT_FORMAT } from '../lib/autoplan-prompts';
import { ownerWords, redactOwnerWords } from '../lib/autoplan-owner-words';
import { consensusRecord, parseReviewResult, reconcile } from '../lib/autoplan-reconcile';
import { decisionSeverity } from '../lib/autoplan-revise';
@@ -62,7 +63,7 @@ const planText = (o: { owner?: string | null; dayOne?: boolean } = {}) => [
'### Units', '', 'U1 the live lane. U2 the transcript. U3 the before-meeting card. U4 the promise review screen.', '',
'## Review record', ''].join('\n');
-type Row = Partial<FindingRow> & { id: string; severity: FindingRow['severity']; title: string; user_challenge?: boolean; changes?: string; owner_quote?: number; resolves?: string };
+type Row = Partial<FindingRow> & { id: string; severity: FindingRow['severity']; title: string; user_challenge?: boolean; changes?: string; owner_quote?: number; narrows_quote?: number; resolves?: string };
const row = (phase: string, voice: 'native' | 'outside', r: Row): FindingRow => ({ schema_version: 1, run: RUN, phase, voice, disposition: 'open', ...r } as FindingRow);
/** Round 1 of the CEO phase: the build-order and promise-scope challenges that round 2 never repeated. */
@@ -137,17 +138,22 @@ describe('replay: a reviewed app plan whose product challenges were hidden', ()
expect(list.items.find(i => i.id === 'p1')!.recommended).toBe('b');
});
- test('day one: the assumed row is an owner question, the cut that drops the Today screen is lettered, the rest are one item', () => {
+ test('day one: the assumed row is an owner question; on a first version every cut is lettered and a quote with no line is asked about', () => {
expect(byClass(list, 'day_one').map(i => i.title)).toEqual(['Day one: the plan assumes you will do "reviews the promises made in a meeting" (daily); is that right?']);
- expect(byClass(list, 'cut').map(i => i.title)).toEqual(['Cut: No Today screen in the first build: notifications only']);
- expect(byClass(list, 'cuts').map(i => i.title)).toEqual(['2 other cuts: No Android build; No shared team calendars']);
+ expect(byClass(list, 'cut').map(i => [i.title, i.why])).toEqual([
+ ['Cut: No Today screen in the first build: notifications only', 'this cut drops something on the day-one page'],
+ ['Cut: No Android build', 'on a first version every cut is your decision, one letter each'],
+ ['Cut: No shared team calendars', 'on a first version every cut is your decision, one letter each']]);
+ expect(byClass(list, 'cuts')).toEqual([]);
+ expect(byClass(list, 'owner_words').map(i => [i.title, i.recommended])).toEqual([['1 of your quoted messages has no time or no line saying what this version does with it: “I want to remember what I promised people after every meeting” (missing a line (does it or choice))', 'a']]);
+ expect(list.first_version).toBe(true);
expect(list.owner_words).toMatchObject({ status: 'ok', quotes: [{ n: 1, verified: false }] });
});
- test('lettered-item counts (recorded for the PR): 3 proposals, 3 day-one items, 1 High finding', () => {
+ test('lettered-item counts (recorded for the PR): 3 proposals, 1 day-one question, 3 cuts, 1 owner-words line, 1 High finding', () => {
expect(byClass(list, 'proposal').length).toBe(3);
expect(byClass(list, 'finding').length).toBe(1);
- expect(lettered(list)).toBe(7);
+ expect(lettered(list)).toBe(9);
});
});
@@ -161,7 +167,7 @@ describe('negative controls', () => {
expect(d1.options[0]!.text).toBe('keep your direction');
expect(byClass(list, 'confirm_direction')).toEqual([]);
expect(byClass(list, 'proposal').length).toBe(2);
- expect(lettered(list)).toBe(7);
+ expect(lettered(list)).toBe(9);
});
test("(b) no Owner's words section: today's keep-direction default stays, plus one confirm-direction item", () => {
@@ -174,7 +180,8 @@ describe('negative controls', () => {
expect(confirm.length).toBe(1);
expect(confirm[0]!.title).toContain(kept.map(i => i.id).join(', '));
expect(list.owner_words).toBeUndefined();
- expect(lettered(list)).toBe(8);
+ expect(byClass(list, 'owner_words').map(i => i.title)).toEqual(['This is a first version, but the plan quotes none of your messages that ask for it']);
+ expect(lettered(list)).toBe(10);
});
test('(c) a round-1 challenge the revision fixed (resolves) or the owner answered does not resurface', () => {
@@ -184,7 +191,7 @@ describe('negative controls', () => {
expect(covering(list, `${RUN}-ceo-native-18`)).toBeUndefined();
expect(openEarlier(state, 'ceo', [...round2({ resolved: true }).native])).toEqual([]);
expect(byClass(list, 'proposal').length).toBe(1);
- expect(lettered(list)).toBe(5);
+ expect(lettered(list)).toBe(7);
});
test('a later round staying silent never closes a challenge, and a lean run carries nothing', () => {
@@ -267,7 +274,7 @@ describe('owner_quote downgrade, the day-one page requirement and the cost line'
test('a changed cut list or challenge list gets a new origin, so an earlier answer is asked again instead of carried', () => {
const origin = (list: GateList, cls: string) => byClass(list, cls)[0]!.origin;
- const cuts = (extra: string) => planText().replace('- No shared team calendars\n', `- No shared team calendars\n${extra}`);
+ const cuts = (extra: string) => planText({ dayOne: false }).replace('### Units', "### What it won't do yet\n\n- No Android build\n- No shared team calendars\n\n### Units").replace('- No shared team calendars\n', `- No shared team calendars\n${extra}`);
const before = buildGate(makeRun('cuts-before', { plan: cuts(''), round2: round2(), round1: false }), 1);
const after = buildGate(makeRun('cuts-after', { plan: cuts('- No web dashboard\n'), round2: round2(), round1: false }), 1);
expect(origin(after, 'cuts')).not.toBe(origin(before, 'cuts'));
@@ -433,3 +440,137 @@ describe('parsers, render and redaction', () => {
expect(out.text).not.toContain('promised people');
});
});
+
+describe('first versions: the owner page quotes the owner and letters what it leaves out (GST-3608)', () => {
+ const CASE4 = [
+ "### Owner's words", '',
+ '- The owner, 2026-11-19 10:04Z: "making it really good two-way is awesome also. being able to send and receive." → does it',
+ '- The owner, 2026-11-19 10:06Z: "contacts are awesome. notes are awesome too." → choice; size: one day; leave out: notes need a second helper permission',
+ ].join('\n');
+ const plan = (owner: string, cuts = '- It never writes to your Contacts: writes keep going through the iCloud route\n- No Android build\n') => [
+ '# Contacts for the agent (synthetic, the shape of a real first version)', '', '## Implementation plan', '', owner, '',
+ '### Day one', '', '| action | frequency | source | feature | route | first build | check |', '|---|---|---|---|---|---|---|',
+ '| asks the agent who someone is | daily | owner words 1 | Contact lookup | chat | build 1 | the agent answers from the address book |', '',
+ "### What it won't do yet", '', cuts, '## Review record', ''].join('\n');
+ const narrowing = (o: { quote?: number } = {}) => ({
+ native: [row('ceo', 'native', { id: `${RUN}-ceo-r2-native-1`, severity: 'High', title: 'Read-only contacts does less than the two-way the owner asked for', changes: 'scope', resolution: 'make contacts read and write', ...(o.quote ? { narrows_quote: o.quote } : {}) } as Row)],
+ outside: [] as FindingRow[],
+ });
+
+ test('the parser reads each line and keeps an arrow inside the quote', () => {
+ const w = parseOwnerWords(CASE4 + '\n- The owner, 2026-11-20 08:00Z: "a -> b → c in the quote" -> does it');
+ expect(w.status).toBe('ok');
+ expect(w.quotes.map(q => [q.text, q.line])).toEqual([
+ ['making it really good two-way is awesome also. being able to send and receive.', { kind: 'does' }],
+ ['contacts are awesome. notes are awesome too.', { kind: 'choice', size: 'one day', leave_out: 'notes need a second helper permission' }],
+ ['a -> b → c in the quote', { kind: 'does' }],
+ ]);
+ expect(parseOwnerWords('### Owner\'s words\n\n- The owner, day 0: "x"').quotes[0]!.line).toBeUndefined();
+ });
+
+ test('case 4: a read-only cut that shares no words with "two-way", flagged by a reviewer, becomes one choice recommending build', () => {
+ const list = buildGate(makeRun('case4', { plan: plan(CASE4), round2: narrowing({ quote: 1 }), round1: false, ui: false }), 1);
+ const choices = byClass(list, 'owner_choice');
+ expect(choices.map(i => [i.title, i.recommended])).toEqual([
+ ['Your words (2026-11-19 10:04Z): “making it really good two-way is awesome also. being able to send and receive.”, which this version doesn\'t fully do', 'a'],
+ ['Your words (2026-11-19 10:06Z): “contacts are awesome. notes are awesome too.”, which this version doesn\'t fully do', 'b'],
+ ]);
+ expect(choices[0]!.why).toBe('a reviewer (native) says the plan narrows it: Read-only contacts does less than the two-way the owner asked for');
+ expect(choices[0]!.options.map(o => o.text)).toEqual(['build it in this version (size not stated)', 'leave it out for now']);
+ expect(choices[1]!.recommended_basis).toBe("the plan's reason to leave it out: notes need a second helper permission");
+ expect(choices[1]!.cost).toBe('a adds about one day to this version and reopens ceo and eng once the plan is revised');
+ expect(covering(list, `${RUN}-ceo-r2-native-1`)).toBeUndefined();
+ expect(byClass(list, 'cut').map(i => i.title)).toEqual(['Cut: It never writes to your Contacts: writes keep going through the iCloud route', 'Cut: No Android build']);
+ expect(rec(list)[choices[0]!.id]).toBe('a');
+ });
+
+ test('without the reviewer finding, the same read-only cut is still its own letter on a first version, never a grouped "other cuts" line', () => {
+ const list = buildGate(makeRun('case4-quiet', { plan: plan(CASE4), round2: narrowing(), round1: false, ui: false }), 1);
+ expect(byClass(list, 'cuts')).toEqual([]);
+ expect(byClass(list, 'cut').length).toBe(2);
+ });
+
+ test('a cut that names a quoted line is that quote\'s build-it choice, exactly one item, and leaves the "won\'t do yet" list', () => {
+ const cuts = '- No notes: contacts awesome, notes awesome too later\n- No Android build\n';
+ const state = makeRun('cut-quote', { plan: plan(CASE4, cuts), round2: narrowing(), round1: false, ui: false });
+ const list = buildGate(state, 1);
+ const notes = byClass(list, 'owner_choice').filter(i => i.title.includes('notes are awesome'));
+ expect(notes).toHaveLength(1);
+ expect(notes[0]!.why).toBe('the plan\'s line for it says this version doesn\'t do it yet; the plan cuts it: "No notes: contacts awesome, notes awesome too later"');
+ expect(byClass(list, 'cut').map(i => i.title)).toEqual(['Cut: No Android build']);
+ const page = renderOwnerPage(fs.readFileSync(state.active_plan, 'utf8'), list.owner_words?.quotes, { firstVersion: true }).join('\n');
+ expect(page).toContain('### Your words this plan follows');
+ expect(page.indexOf('### Your words this plan follows')).toBeLessThan(page.indexOf('### Day one'));
+ expect(page).toContain('“contacts are awesome. notes are awesome too.” (not found in your recorded replies) → not in this version yet: a lettered choice below');
+ expect(page).toContain("### What it won't do yet\n\n- No Android build\n");
+ expect(page).not.toContain('- No notes');
+ expect(page).toContain('(gstack-first-use)');
+ expect(renderOwnerPage(fs.readFileSync(state.active_plan, 'utf8'), list.owner_words?.quotes, { firstVersion: false }).join('\n')).not.toContain('(gstack-first-use)');
+ });
+
+ test('a High finding that narrows a quote recommends build over the plan\'s leave-out reason, and only build settles it', () => {
+ const list = buildGate(makeRun('high-narrow', { plan: plan(CASE4), round2: narrowing({ quote: 2 }), round1: false, ui: false }), 1);
+ const notes = byClass(list, 'owner_choice').find(i => i.title.includes('notes are awesome'))!;
+ expect(notes.recommended).toBe('a');
+ expect(notes.recommended_basis).toBe('your own words asked for it, and a High finding says the plan falls short of them');
+ expect(notes.origin!.split('|')[1]!.split('+')).toContain(`${RUN}-ceo-r2-native-1`);
+ expect(notes.origin!.endsWith('|finding')).toBe(true);
+ });
+
+ describe("the default reply never changes or overrides an owner line, whatever kind of finding touches it", () => {
+ type Kind = { name: string; native: Row[]; outside?: Row[] };
+ const finding = (voice: 'native' | 'outside', quote: number, severity: FindingRow['severity'] = 'High') =>
+ ({ id: `${RUN}-ceo-r2-${voice}-1`, severity, title: 'Read-only contacts does less than what the owner asked for', changes: 'scope', resolution: 'make contacts read and write', narrows_quote: quote } as Row);
+ const KINDS: Kind[] = [
+ { name: 'narrows a does-it quote', native: [finding('native', 1)] },
+ { name: 'narrows an open choice quote (High)', native: [finding('native', 2)] },
+ { name: 'narrows an open choice quote (Medium)', native: [finding('native', 2, 'Medium')] },
+ { name: 'a paired finding: both on a does-it quote', native: [finding('native', 1)], outside: [finding('outside', 1)] },
+ ];
+ test.each(KINDS.map(k => [k.name, k] as const))('%s', (_, kind) => {
+ const state = makeRun(`rec-${kind.name.replace(/\W+/g, '-')}`, { plan: plan(CASE4), round2: { native: kind.native.map(r => row('ceo', 'native', r)), outside: (kind.outside ?? []).map(r => row('ceo', 'outside', r)) }, round1: false, ui: false });
+ const list = buildGate(state, 1);
+ const chosen = rec(list);
+ const quotes = parseOwnerWords(CASE4).quotes;
+ for (const r of [...kind.native, ...(kind.outside ?? [])]) {
+ const q = quotes.find(x => x.n === r.narrows_quote)!;
+ const items = list.items.filter(i => i.title.includes(r.id) || (i.item_class === 'owner_choice' && i.title.includes(q.text)));
+ expect(items.length, `${r.id} reaches the gate`).toBeGreaterThan(0);
+ for (const item of items) {
+ expect(item.item_class, `${r.id}: never a plain proposal`).not.toBe('proposal');
+ expect(item.why ?? '').not.toContain('no quoted owner line says otherwise');
+ const option = item.options.find(o => o.key === (chosen[item.id] ?? item.recommended))!;
+ if (item.item_class === 'owner_choice' && (r.severity === 'High' || r.severity === 'Critical' || q.line?.kind === 'does')) expect([item.id, option.text.startsWith('build it')], `${r.id}: the default builds what was asked`).toEqual([item.id, true]);
+ }
+ }
+ });
+ });
+
+ test('--first-version makes a plan with no Day one section a first version; a plain backend plan stays as it was', () => {
+ const noDay = plan(CASE4).replace(/### Day one[\s\S]*?\n\n### What/, '### What');
+ const flagged = makeRun('fv-flag', { plan: noDay, round2: narrowing(), round1: false, ui: false });
+ (flagged.scope as any).first_version = true;
+ expect(buildGate(flagged, 1).first_version).toBe(true);
+ const plain = buildGate(makeRun('fv-none', { plan: noDay.replace(/ → [^\n]*/g, ''), round2: narrowing(), round1: false, ui: false }), 1);
+ expect(plain.first_version).toBeUndefined();
+ expect(byClass(plain, 'owner_words')).toEqual([]);
+ expect(byClass(plain, 'cuts').map(i => i.title)).toEqual(['2 other cuts: It never writes to your Contacts: writes keep going through the iCloud route; No Android build']);
+ });
+
+ test('--first-version reaches the run scope from the CLI flag and from the plan\'s scope marker', () => {
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'fv-scope-'));
+ const bare = path.join(dir, 'bare.md'), marked = path.join(dir, 'marked.md');
+ fs.writeFileSync(bare, '# A plan\n\n## Implementation plan\n\n- Edit lib/x.ts\n\n## Review record\n');
+ fs.writeFileSync(marked, '<!-- gstack-autoplan-scope: --first-version -->\n' + fs.readFileSync(bare, 'utf8'));
+ expect(detectScope(bare, dir, { firstVersion: true }).first_version).toBe(true);
+ expect(detectScope(marked, dir, {}).first_version).toBe(true);
+ expect(detectScope(bare, dir, {}).first_version).toBeUndefined();
+ fs.rmSync(dir, { recursive: true, force: true });
+ });
+
+ test('the reviewer prompt asks for narrows_quote and the reconciler keeps it', () => {
+ expect(RESULT_FORMAT('eng', SHA, '/x')).toContain('"narrows_quote": <n>');
+ const parsed = parseReviewResult('INPUT: eng ' + SHA + '\n\n```gstack-findings\n{"id":"F1","severity":"High","title":"t","changes":"scope","narrows_quote":2}\n```\n');
+ expect(JSON.stringify(parsed)).toContain('"narrows_quote":2');
+ });
+});
diff --git a/test/autoplan-owner-words.test.ts b/test/autoplan-owner-words.test.ts
index 6a529c04e..22bcab333 100644
--- a/test/autoplan-owner-words.test.ts
+++ b/test/autoplan-owner-words.test.ts
@@ -8,7 +8,8 @@
import { describe, expect, test } from 'bun:test';
import * as fs from 'node:fs';
import * as path from 'node:path';
-import { MIN_TOKENS, OWNER_WORDS_MARK as MARK, WINDOW, dropOwnerFields, ownerIndex, ownerSpans, redactOwnerWords } from '../lib/autoplan-owner-words';
+import * as os from 'node:os';
+import { MIN_TOKENS, OWNER_WORDS_MARK as MARK, WINDOW, dropOwnerFields, ownerIndex, ownerSpans, ownerWords, redactOwnerWords } from '../lib/autoplan-owner-words';
const LONG = 'Keep the backoff cap at thirty seconds and log every retry attempt so we can see it.';
const quoted = (text: string, ...replies: string[]) => { const o = ownerIndex(replies.map(r => ({ text: r }))); return ownerSpans(text, o).map(([s, e]) => text.slice(s, e)); };
@@ -161,6 +162,20 @@ describe('redactOwnerWords', () => {
});
});
+describe('ownerWords over a run directory', () => {
+ test("a leftover ruled-out line is read as part of the quote, as before lines existed, so export and validate still redact the owner's ruling", () => {
+ const out = fs.mkdtempSync(path.join(os.tmpdir(), 'owner-ruling-'));
+ const ruling = 'leave my calendar alone, I mean it, no exceptions';
+ fs.writeFileSync(path.join(out, 'plan-source.md'), `# Plan\n\n## Implementation plan\n\n### Owner's words\n\n- The owner, 2026-11-12 09:00Z: "never touch my calendar or my reminders" → ruled out 2026-11-12: "${ruling}"\n\n## Review record\n`);
+ const owner = ownerWords({ out, phases: {}, gate: undefined, carry: undefined } as Parameters<typeof ownerWords>[0]);
+ const r = redactOwnerWords(`The reviewer repeats it: "${ruling}".`, owner);
+ expect(r.text).toContain(MARK);
+ expect(r.text).not.toContain('no exceptions');
+ expect(redactOwnerWords(`He said: "never touch my calendar or my reminders" → ruled out 2026-11-12: "${ruling}"`, owner).text).not.toContain('calendar');
+ fs.rmSync(out, { recursive: true, force: true });
+ });
+});
+
describe('dropOwnerFields', () => {
test("drops owner_reply and a carry record's words, marks a human's deferral reason, keeps an agent's", () => {
const run = {
diff --git a/test/autoplan-public-owner-words.test.ts b/test/autoplan-public-owner-words.test.ts
index 831ad746a..a683b65da 100644
--- a/test/autoplan-public-owner-words.test.ts
+++ b/test/autoplan-public-owner-words.test.ts
@@ -16,6 +16,7 @@ import { readState } from '../lib/autoplan-state';
import { recHash } from '../lib/gate-list';
import { ROOT, SMALL_PLAN, resultOf } from './helpers/autoplan-run-fixture';
import { capyRunner, phaseVia, readJsonl, readRunJson, writePlan } from './helpers/autoplan-capy';
+import { parseOwnerWords, wordKey, type OwnerLine } from '../lib/autoplan-owner-text';
setDefaultTimeout(60_000);
const r = capyRunner();
@@ -332,3 +333,128 @@ describe("export --public drops the owner's own words (GST-1243)", () => {
expect(fs.readFileSync(path.join(pub, 'plan.md'))).toEqual(fs.readFileSync(path.join(out, 'plan.md')));
});
});
+
+describe('a first-version export keeps no fragment of any owner quote (GST-3608)', () => {
+ const QUOTES = [
+ 'blorptastic zanquiver mellowfrond grumbletide',
+ 'zoëlqvist brûxelkorp façadrinth naïvequor',
+ '毎朝の予定をスヌーピー通知で教えてください',
+ '🚀 launchpadzz 🎉 fizzwickery 🌮 tacoloopz',
+ ];
+ const plan = [
+ '# Morning helper (synthetic first version)', '', '## Implementation plan', '',
+ 'Add a morning summary job in lib/morning.ts that reads the calendar and sends one notification.', '',
+ "### Owner's words", '',
+ `- The owner, 2026-11-20 08:00Z: "${QUOTES[0]}" → does it`,
+ `- The owner, 2026-11-20 08:01Z: "${QUOTES[1]}" → choice; size: one day`,
+ `- The owner, 2026-11-20 08:02Z: "${QUOTES[2]}" → choice; size: two days; leave out: needs a second permission`,
+ `- The owner, 2026-11-20 08:03Z: "${QUOTES[3]}" → ruled out 2026-11-20: "${QUOTES[3]} never"`, '',
+ '### Day one', '', '| action | frequency | source | feature | route | first build | check |', '|---|---|---|---|---|---|---|',
+ '| reads the morning summary | daily | owner words 1 | Summary | notification | build 1 | the summary lists today |', '',
+ "### What it won't do yet", '', '- No weekly digest', '', '## Review record', ''].join('\n');
+ const fragments = (q: string) => [...new Set([...q.split(/\s+/), ...wordKey(q).trim().split(' ')].filter(w => [...w].length >= 3))];
+
+ test('accented, CJK and emoji quotes leave no 3+ character fragment, raw or normalized, anywhere in the public bytes', () => {
+ const dir = path.join(r.host.base, `owner${++n}`);
+ const out = path.join(dir, 'run');
+ expect(r.ap(['next', '--out', out, '--plan', writePlan(dir, plan), '--no-ui', '--no-dx', '--first-version']).status).toBe(0);
+ const narrowing = [{ id: 'F1', severity: 'Medium', title: 'The summary does less than the owner asked', changes: 'scope', narrows_quote: 2 }];
+ phaseVia(r, out, 'ceo', { native: narrowing, outside: [] });
+ expect(phaseVia(r, out, 'eng', { native: [], outside: [] }).outside.stdout).toContain('status=gate_pending');
+ expect(gateOf(out).items.filter((i: { item_class?: string }) => i.item_class === 'owner_choice').length).toBeGreaterThan(0);
+ const pub = path.join(dir, 'public');
+ const e = r.ap(['export', '--out', out, '--public', pub]);
+ expect(e.status, e.stderr).toBe(0);
+ const bytes = allText(pub);
+ const leaks = QUOTES.flatMap(q => fragments(q).filter(w => bytes.includes(w)));
+ expect(leaks).toEqual([]);
+ });
+});
+
+describe('every attribution, line and quote shape reads as the merge base read it, and export keeps none of it (GST-3608)', () => {
+ /** The merge base's whole Owner's words rule (0d6cc1be): the first opening quote mark to the last closing one, who before it. */
+ const mergeBase = (bullet: string) => {
+ const m = /[“"](.+)[”"]/.exec(bullet);
+ return m && m[1]!.trim() ? { who: bullet.slice(0, m.index).replace(/[\s:,-]+$/, '').trim() || 'unattributed', text: m[1]!.trim() } : undefined;
+ };
+ const ATTRIBUTIONS: Array<[string, string]> = [
+ ['plain', 'Garry, 2026-11-23 09:00Z'],
+ ['an ascii arrow', 'Garry (Slack DM -> relayed), 2026-11-23'],
+ ['an arrow', 'Garry (Slack DM → relayed), 2026-11-23'],
+ ['a colon', 'Garry (re: importer), 2026-11-23'],
+ ['straight quote marks', 'Garry ("G"), 2026-11-23'],
+ ['curly quote marks', 'Garry (“G”), 2026-11-23'],
+ ['an em dash', 'Garry — via Slack, 2026-11-23'],
+ ['quote marks and an arrow', 'Garry ("G" -> relayed), 2026-11-23'],
+ ];
+ const TEXTS: Array<[string, (u: string) => string]> = [
+ ['plain', u => `blorptastic zanquiver ${u}`],
+ ['nested straight quotes', u => `snarfle "grumbletide" vexwort ${u}`],
+ ['nested curly quotes', u => `wibbleton “quorkle” ${u}`],
+ ['an arrow between nested quotes', u => `frobnitz "plinky" -> "zorbly" ${u}`],
+ ['an em dash', u => `drevnik—slorpine ${u}`],
+ ['CJK', u => `毎朝の予定をスヌーピー通知で ${u}`],
+ ['accented', u => `zoëlqvist brûxelkorp ${u}`],
+ ['emoji', u => `🚀 launchpadzz 🎉 fizzwickery ${u}`],
+ ];
+ const LINES: Array<[string, (u: string) => string, (u: string) => OwnerLine | undefined]> = [
+ ['no line', () => '', () => undefined],
+ ['does it', () => ' → does it', () => ({ kind: 'does' })],
+ ['does it after an ascii arrow', () => ' -> does it', () => ({ kind: 'does' })],
+ ['a choice with a size', () => ' -> choice; size: one day', () => ({ kind: 'choice', size: 'one day' })],
+ ['a choice left out', () => ' → choice; size: two days; leave out: needs a second permission', () => ({ kind: 'choice', size: 'two days', leave_out: 'needs a second permission' })],
+ ['a leftover ruled-out line', u => ` → ruled out 2026-11-20: "skrimblor dorvelin ${u}"`, () => undefined],
+ ['a leftover ruled-out line with nested quotes and an arrow', u => ` → ruled out 2026-11-20: "grobble "nevermore" -> ${u}"`, () => undefined],
+ ];
+ const tag = (prefix: string, i: number) => `${prefix}${String.fromCharCode(97 + Math.floor(i / 26))}${String.fromCharCode(97 + (i % 26))}vel`;
+ /** Every attribution with every text, each line shape rotating through both, so every pair of shapes meets. */
+ const ROWS = ATTRIBUTIONS.flatMap(([attrName, attr], a) => TEXTS.map(([textName, text], t) => {
+ const i = a * TEXTS.length + t;
+ const [lineName, line, parsed] = LINES[(a + t) % LINES.length]!;
+ const words = text(tag('qx', i)), ruling = tag('rz', i);
+ const bare = `- ${attr}: "${words}"`;
+ return { name: `${attrName} / ${textName} / ${lineName}`, bullet: bare + line(ruling), bare, words, line: parsed(ruling), ruling: line(ruling).includes('ruled out') ? line(ruling).replace(/^ → ruled out [\d-]+: "|"$/g, '') : undefined };
+ }));
+ const section = (bullets: string[]) => ["### Owner's words", '', ...bullets, '', '## Review record', ''].join('\n');
+
+ test.each(ROWS.map(r => [r.name, r] as const))('%s', (_, row) => {
+ const base = mergeBase((row.line ? row.bare : row.bullet).replace(/^- /, ''));
+ expect(base).toBeDefined();
+ const w = parseOwnerWords(section([row.bullet]));
+ expect(w.status, w.reason).toBe('ok');
+ expect(w.quotes).toEqual([{ n: 1, who: base!.who, text: base!.text, ...(row.line ? { line: row.line } : {}) }]);
+ });
+
+ test('an arrow in the attribution keeps the quote, and a line that is none of the three is still named after it', () => {
+ const slack = parseOwnerWords(section(['- Garry (Slack DM -> relayed), 2026-11-23: "ship the importer tonight"']));
+ expect(slack).toEqual({ status: 'ok', quotes: [{ n: 1, who: 'Garry (Slack DM -> relayed), 2026-11-23', text: 'ship the importer tonight' }] });
+ const bad = parseOwnerWords(section(['- Garry (Slack DM -> relayed), 2026-11-23: "ship the importer tonight" → maybe later']));
+ expect(bad.status).toBe('malformed');
+ expect(bad.reason).toBe('bullet 1 has a line that is not does it or choice');
+ expect(bad.quotes.map(q => q.text)).toEqual(['ship the importer tonight']);
+ });
+
+ test('a first-version export of every row leaves no 3+ character fragment of any quote or ruling in the public bytes', () => {
+ const plan = [
+ '# Morning helper (synthetic first version)', '', '## Implementation plan', '',
+ 'Add a morning summary job in lib/morning.ts that reads the calendar and sends one notification.', '',
+ "### Owner's words", '', ...ROWS.map(r => r.bullet), '',
+ '### Day one', '', '| action | frequency | source | feature | route | first build | check |', '|---|---|---|---|---|---|---|',
+ '| reads the morning summary | daily | owner words 1 | Summary | notification | build 1 | the summary lists today |', '',
+ "### What it won't do yet", '', '- No weekly digest', '', '## Review record', ''].join('\n');
+ expect(parseOwnerWords(plan).quotes).toHaveLength(ROWS.length);
+ const dir = path.join(r.host.base, `owner${++n}`);
+ const out = path.join(dir, 'run');
+ expect(r.ap(['next', '--out', out, '--plan', writePlan(dir, plan), '--no-ui', '--no-dx', '--first-version']).status).toBe(0);
+ phaseVia(r, out, 'ceo', { native: [{ id: 'F1', severity: 'Medium', title: 'The summary does less than the owner asked', changes: 'scope', narrows_quote: 2 }], outside: [] });
+ expect(phaseVia(r, out, 'eng', { native: [], outside: [] }).outside.stdout).toContain('status=gate_pending');
+ const pub = path.join(dir, 'public');
+ const e = r.ap(['export', '--out', out, '--public', pub]);
+ expect(e.status, e.stderr).toBe(0);
+ const bytes = allText(pub);
+ const fragments = (q: string) => [...new Set([...q.split(/\s+/), ...wordKey(q).trim().split(' ')].filter(w => [...w].length >= 3))];
+ const leaks = ROWS.flatMap(row => [row.words, ...(row.ruling ? [row.ruling] : [])].flatMap(q => fragments(q).filter(w => bytes.includes(w)).map(w => `${row.name}: ${w}`)));
+ expect(leaks).toEqual([]);
+ });
+});
+
diff --git a/test/captain-skill.test.ts b/test/captain-skill.test.ts
index fd8aa089d..926c1945a 100644
--- a/test/captain-skill.test.ts
+++ b/test/captain-skill.test.ts
@@ -146,7 +146,9 @@ describe('/captain skill', () => {
expect(capySkill).toMatch(/## Session start[^#]*?read \[lane-card\.md\]\(lane-card\.md\), not the rest of this file/);
// 7,000 for the drive-write line (confirm a copy in the drive's version history before deleting its source), reached by two
// crews on their own (crew habit H5).
- expect(Buffer.byteLength(card)).toBeLessThanOrEqual(7000);
+ // 7,300 for the first-version line (Garry's "do it" of 2026-11-23 on GST-3608: no crew ran gstack-first-use because nothing a
+ // lane reads pointed at it).
+ expect(Buffer.byteLength(card)).toBeLessThanOrEqual(7300);
const doc = read('crew/docs/captain.md').replace(/\s+/g, ' ');
for (const s of ['`duration_seconds: 240`', 'stops re-issuing the timer', 'The controller never warm-waits', '4k characters or less', 'twice the crew\'s median lane spend', '`handoffs/<code>/next.md`']) expect(doc, s).toContain(s);
expect(read('captain/templates/brief.md')).toMatch(/^Read: <[^>]+>$/m);
diff --git a/test/capy-skill-wrapper.test.ts b/test/capy-skill-wrapper.test.ts
index 4d8786ce9..c0094bd98 100644
--- a/test/capy-skill-wrapper.test.ts
+++ b/test/capy-skill-wrapper.test.ts
@@ -698,7 +698,9 @@ describe('capy skill: factory.md, the auto-loaded "how we work" page', () => {
// that stops finished PRs piling up; the procedure is crew/docs/captain.md's Drain the queue).
// 5,550 for point 17's write-up before a shelve (Garry's "do it" of 2026-11-23: an attempt that fails or is shelved is
// documented first, as gstack's default; the template is docs/shelved-attempt.md).
- expect(Buffer.byteLength(text)).toBeLessThanOrEqual(5550);
+ // 5,875 for point 18's first versions (Garry's "do it" of 2026-11-23 on GST-3608: a first version's plan quotes the owner's
+ // words with a line each, and gstack-first-use runs his exact try-it steps on the real target first; docs/first-use-check.md).
+ expect(Buffer.byteLength(text)).toBeLessThanOrEqual(5875);
expect(text).toMatch(/^# How we work/);
expect(citationProblems(text)).toEqual([]);
});
diff --git a/test/first-use.test.ts b/test/first-use.test.ts
index f8f6dce02..404d5cc4d 100644
--- a/test/first-use.test.ts
+++ b/test/first-use.test.ts
@@ -2,9 +2,10 @@
* The first-use check (lib/first-use.ts, lib/first-use-message.ts, bin/gstack-first-use;
* docs/first-use-check.md). Every owner, app, plan and build here is made up. Pins the
* day-one table format both plan sources share (autoplan's ### Day one table and the
- * one-page day-one list), so a change to lib/autoplan-owner-text.ts fails here rather
- * than silently changing what the check freezes. Runs under a temporary HOME, drive and
- * record root, serves its links from a local server, and proves the real drive is untouched.
+ * one-page day-one list), and the owner's quoted words each frozen row must cite, so a
+ * change to lib/autoplan-owner-text.ts fails here rather than silently changing what the
+ * check freezes. Runs under a temporary HOME, drive and record root, serves its links from
+ * a local server, and proves the real drive is untouched.
*/
import { afterAll, beforeAll, describe, expect, spyOn, test } from 'bun:test';
import { spawnSync } from 'node:child_process';
@@ -12,7 +13,7 @@ import * as fs from 'node:fs';
import * as os from 'node:os';
import * as path from 'node:path';
import { DAY_ONE_COLUMNS, DAY_ONE_TITLES } from '../lib/autoplan-owner-text';
-import { buildFingerprint, checkLinks, decide, freezeActions, modelFamily, ownerScore, predict, readManifest, recordResult, recordRoot, startRun, type Fetcher } from '../lib/first-use';
+import { buildFingerprint, checkLinks, decide, freezeActions, modelFamily, ownerScore, plainLine, predict, readManifest, recordResult, recordRoot, startRun, type Fetcher } from '../lib/first-use';
import { checkPlaySpec, PLAY_PARTS, renderBrief, renderPlayMessage } from '../lib/first-use-message';
const ROOT = path.resolve(import.meta.dir, '..');
@@ -25,53 +26,89 @@ const ONE_PAGE = fs.readFileSync(path.join(FIX, 'one-page-plan.md'), 'utf8');
const PLAY = JSON.parse(fs.readFileSync(path.join(FIX, 'play.json'), 'utf8'));
const COMMIT = 'c0ffee'.padEnd(40, '0');
const BUILD = { platform: 'ios' as const, commit: COMMIT, testflight: '17' };
+const HOLDING = { build: 'TestFlight build 16', defects: 'the care card shows yesterday as the last watered date' };
const T0 = new Date('2026-11-18T10:00:00Z');
const ACTIONS = [
'adds her first three plants by photo', 'sees which plant needs water today', 'marks a plant as watered', 'gets a reminder at 8am', "opens a plant's care card",
];
+const STEPS = 7;
+const CHECKER = 'openai/gpt-6.2-sol';
+const TARGET = PLAY.target.name;
let n = 0;
const fresh = (name: string) => { const d = path.join(TMP, `${name}-${++n}`); fs.mkdirSync(d, { recursive: true }); return d; };
const shot = (dir: string, name = 'shot.png', body = 'png bytes') => { const f = path.join(dir, name); fs.writeFileSync(f, body); return f; };
-const playWith = (port: number) => ({ ...PLAY, links: PLAY.links.map((l: { url: string }) => ({ ...l, url: l.url.replace('PORT', String(port)) })) });
+const playWith = (port: number, o: Record<string, unknown> = {}) => ({ ...PLAY, ...o, links: PLAY.links.map((l: { url: string }) => ({ ...l, url: l.url.replace('PORT', String(port)) })) });
const AS = { account: PLAY.account, device_class: 'ios' as const };
const okFetch: Fetcher = async url => ({ status: url.endsWith('/account') ? 401 : 200 });
-
-/** A run on its own plan copy and record root, with every action passed, the links checked and a prediction. */
-function passedRun(o: { plan?: string } = {}) {
- const root = fresh('root'), work = fresh('work');
+const start = (o: { plan?: string; play?: unknown; root?: string; checker?: string } = {}) => {
+ const root = o.root ?? fresh('root'), work = fresh('work');
const planPath = path.join(work, 'plan.md');
fs.writeFileSync(planPath, o.plan ?? AUTOPLAN);
- const r = startRun({ root, app: 'plantpal', planPath, build: BUILD, play: playWith(1), builder: 'anthropic/claude-opus-5-5', checker: 'openai/gpt-6.2-sol', now: T0 });
+ const r = startRun({ root, app: 'plantpal', planPath, build: BUILD, play: o.play ?? playWith(1), holding: HOLDING, builder: 'anthropic/claude-opus-5-5', checker: o.checker ?? CHECKER, now: T0 });
if ('error' in r) throw new Error(r.error.detail);
- for (let a = 1; a <= 5; a++) {
- const rec = recordResult({ dir: r.dir, action: a, verdict: 'pass', evidence: shot(work, `a${a}.png`, `screen ${a}`), device: 'iPhone 17 Pro (cloud)', account: PLAY.account, by: 'openai/gpt-6.2-sol', now: T0 });
- if ('error' in rec) throw new Error(rec.error.detail);
- }
- const p = predict({ dir: r.dir, score: '6', why: 'the reminder works but adding plants is slow', by: 'openai/gpt-6.2-sol', now: T0 });
- if ('error' in p) throw new Error(p.error.detail);
return { ...r, planPath, work, root };
+};
+type Rec = { verdict?: string; line?: string; at?: Date; by?: string; account?: string; target?: string; evidence?: string; needsLookup?: string; notice?: string };
+const rec = (r: { dir: string; work: string }, step: number, o: Rec = {}) => recordResult({ dir: r.dir, step, verdict: o.verdict ?? 'useful', line: o.line ?? `step ${step} does what she asked`,
+ evidence: o.evidence ?? shot(r.work, `s${step}-${o.verdict ?? 'useful'}-${++n}.png`, `screen ${step}-${n}`), device: 'iPhone 17 Pro (cloud)', account: o.account ?? PLAY.account, target: o.target ?? TARGET,
+ by: o.by ?? CHECKER, needsLookup: o.needsLookup, notice: o.notice, now: o.at ?? T0 });
+
+/** A run on its own plan copy and record root, with every step useful and a prediction. */
+function passedRun(o: { plan?: string } = {}) {
+ const r = start(o);
+ for (let s = 1; s <= STEPS; s++) { const x = rec(r, s); if ('error' in x) throw new Error(x.error.detail); }
+ const p = predict({ dir: r.dir, score: '6', why: 'the reminder works but adding plants is slow', by: CHECKER, now: T0 });
+ if ('error' in p) throw new Error(p.error.detail);
+ return r;
}
-describe('the day-one table format (pinned)', () => {
+describe('the day-one table and the owner quotes it cites (pinned)', () => {
test('the parser this check reads keeps its titles and columns', () => {
expect(DAY_ONE_TITLES).toEqual(['Day one', 'Day-one page', 'Day one page']);
expect([...DAY_ONE_COLUMNS]).toEqual(['action', 'frequency', 'source', 'feature', 'route', 'first build', 'check']);
});
- test('an autoplan plan and a one-page day-one list freeze the same five actions', () => {
+ test('an autoplan plan and a one-page day-one list freeze the same five actions and quotes', () => {
const a = freezeActions(AUTOPLAN), b = freezeActions(ONE_PAGE);
- if ('error' in a || 'error' in b) throw new Error('fixture did not freeze');
+ if ('error' in a) throw new Error(a.error.detail);
+ if ('error' in b) throw new Error(b.error.detail);
expect(a.actions.map(x => x.action)).toEqual(ACTIONS);
expect(b.actions).toEqual(a.actions);
+ expect(b.quotes).toEqual(a.quotes);
expect(b.rows_sha256).toBe(a.rows_sha256);
- expect(a.actions[3]).toEqual({ n: 4, action: 'gets a reminder at 8am', frequency: 'daily', feature: 'Morning reminder', route: 'notification', first_build: 'build 1', check: 'a notification arrives at 8:00 on the device', source: 'calendar habit' });
+ expect(a.actions[3]).toEqual({ n: 4, action: 'gets a reminder at 8am', frequency: 'daily', feature: 'Morning reminder', route: 'notification', first_build: 'build 1', check: 'a notification arrives at 8:00 on the device', source: 'owner words 2', quote: 2 });
+ expect(a.quotes[1]).toEqual({ n: 2, who: 'Ada Example, day 0', when: 'day 0', text: 'remind me every morning before work', line: 'does it' });
});
test('a sixth row marked assumed is not frozen; an assumed row in the first five refuses', () => {
- expect('error' in freezeActions(AUTOPLAN)).toBe(false);
- const assumed = AUTOPLAN.replace('| gets a reminder at 8am | daily | calendar habit |', '| gets a reminder at 8am | daily | assumed |');
- const r = freezeActions(assumed);
- expect('error' in r && r.error).toEqual({ code: 'FIRST_USE_PLAN_UNREADY', detail: 'day-one row 4 is still marked assumed' });
+ const assumed = AUTOPLAN.replace('| gets a reminder at 8am | daily | owner words 2 |', '| gets a reminder at 8am | daily | assumed |');
+ expect(freezeActions(assumed)).toMatchObject({ error: { code: 'FIRST_USE_PLAN_UNREADY', detail: 'day-one row 4 is still marked assumed' } });
+ });
+
+ test('a row that cites no real quote refuses, so the five actions come from the owner\'s words', () => {
+ const habit = AUTOPLAN.replace('| owner words 2 |', '| calendar habit |');
+ expect(freezeActions(habit)).toMatchObject({ error: { code: 'FIRST_USE_PLAN_UNREADY', detail: expect.stringMatching(/^day-one row 4 cites none of the owner's quotes/) } });
+ const ghost = AUTOPLAN.replace('| owner words 2 |', '| owner words 9 |');
+ expect(freezeActions(ghost)).toMatchObject({ error: { detail: expect.stringMatching(/^day-one row 4 cites none/) } });
+ });
+
+ test('no Owner\'s words, a quote with no time or no line, or a bad line refuses', () => {
+ const none = AUTOPLAN.replace(/### Owner's words[\s\S]*?### Day one/, '### Day one');
+ expect(freezeActions(none)).toMatchObject({ error: { detail: expect.stringMatching(/^the plan has no ### Owner's words section/) } });
+ const noLine = AUTOPLAN.replace('before work" → does it', 'before work"');
+ expect(freezeActions(noLine)).toEqual({ error: { code: 'FIRST_USE_PLAN_UNREADY', detail: 'owner quote 2 needs a line (does it or choice)' } });
+ const noTime = AUTOPLAN.replace('- Ada Example, day 0: "remind', '- Ada Example: "remind');
+ expect(freezeActions(noTime)).toEqual({ error: { code: 'FIRST_USE_PLAN_UNREADY', detail: 'owner quote 2 needs when it was said' } });
+ const bad = AUTOPLAN.replace('before work" → does it', 'before work" → maybe later');
+ expect(freezeActions(bad)).toMatchObject({ error: { detail: expect.stringContaining('bullet 2 has a line that is not does it or choice') } });
+ });
+
+ test('editing or inserting a quote changes the frozen hash, even when the rows stay the same', () => {
+ const a = freezeActions(AUTOPLAN), edited = freezeActions(AUTOPLAN.replace('before work', 'after breakfast'));
+ const inserted = freezeActions(AUTOPLAN.replace('- Ada Example, day 0: "I keep', '- Ada Example, day 0: "I travel a lot" → does it\n- Ada Example, day 0: "I keep'));
+ if ('error' in a || 'error' in edited) throw new Error('fixture did not freeze');
+ expect(edited.rows_sha256).not.toBe(a.rows_sha256);
+ expect('error' in inserted || inserted.rows_sha256 !== a.rows_sha256).toBe(true);
});
test('fewer than five rows, or an empty cell in the first five, refuses', () => {
@@ -84,7 +121,7 @@ describe('the day-one table format (pinned)', () => {
test('no table, a missing column or an empty table refuses', () => {
expect(freezeActions('# A plan\n\nNo day one here.\n')).toEqual({ error: { code: 'FIRST_USE_PLAN_UNREADY', detail: 'the plan has no ### Day one table' } });
const noCheck = ONE_PAGE.replace('| Check |', '| Notes |');
- expect('error' in freezeActions(noCheck) && freezeActions(noCheck)).toMatchObject({ error: { detail: 'the table has no check column' } });
+ expect(freezeActions(noCheck)).toMatchObject({ error: { detail: 'the table has no check column' } });
const empty = '## Day one\n\n| action | frequency | source | feature | route | first build | check |\n|---|---|---|---|---|---|---|\n';
expect(freezeActions(empty)).toMatchObject({ error: { code: 'FIRST_USE_PLAN_UNREADY' } });
});
@@ -107,15 +144,26 @@ describe('model families and build fingerprints', () => {
test('a same-family or unknown checker refuses at start', () => {
const work = fresh('fam'), planPath = path.join(work, 'plan.md');
fs.writeFileSync(planPath, AUTOPLAN);
- const base = { root: fresh('root'), app: 'plantpal', planPath, build: BUILD, play: PLAY };
+ const base = { root: fresh('root'), app: 'plantpal', planPath, build: BUILD, play: PLAY, holding: HOLDING };
expect(startRun({ ...base, builder: 'anthropic/claude-opus-5-5', checker: 'claude-fable-5-2' })).toMatchObject({ error: { code: 'FIRST_USE_SAME_FAMILY', detail: 'builder and checker are both anthropic' } });
expect(startRun({ ...base, builder: 'anthropic/claude-opus-5-5', checker: 'mystery-model' })).toMatchObject({ error: { code: 'FIRST_USE_SAME_FAMILY' } });
});
- test('a build needs a full commit and exactly one of TestFlight build or deploy version', () => {
+ test('the build the owner holds now is named at start: a label and its known defects, or none', () => {
+ const work = fresh('hold'), planPath = path.join(work, 'plan.md');
+ fs.writeFileSync(planPath, AUTOPLAN);
+ const base = { root: fresh('root'), app: 'plantpal', planPath, build: BUILD, play: PLAY, builder: 'anthropic/claude-opus-5-5', checker: CHECKER };
+ expect(startRun({ ...base, holding: { build: 'TestFlight build 16' } })).toMatchObject({ error: { code: 'FIRST_USE_RECORD_INVALID', detail: expect.stringContaining('--holding-defects') } });
+ expect('dir' in startRun({ ...base, holding: { build: 'none', defects: 'none' } })).toBe(true);
+ });
+
+ test('a build needs a full commit and exactly one of TestFlight build or deploy version; Mac and server builds count', () => {
expect(buildFingerprint({ ...BUILD, commit: 'abc123' })).toMatchObject({ error: { code: 'FIRST_USE_RECORD_INVALID' } });
expect(buildFingerprint({ ...BUILD, deploy: 'v1' })).toMatchObject({ error: { code: 'FIRST_USE_RECORD_INVALID' } });
expect(buildFingerprint({ platform: 'web', commit: COMMIT })).toMatchObject({ error: { code: 'FIRST_USE_RECORD_INVALID' } });
+ expect(buildFingerprint({ platform: 'watch' as any, commit: COMMIT, deploy: 'v1' })).toMatchObject({ error: { detail: '--platform must be ios, android, web, macos, server' } });
+ expect('fingerprint' in buildFingerprint({ platform: 'macos', commit: COMMIT, deploy: '0.3.1' })).toBe(true);
+ expect('fingerprint' in buildFingerprint({ platform: 'server', commit: COMMIT, deploy: 'gateway 2026.11.23' })).toBe(true);
const a = buildFingerprint(BUILD), b = buildFingerprint({ ...BUILD, testflight: '18' });
if ('error' in a || 'error' in b) throw new Error('valid builds refused');
expect(a.fingerprint).not.toBe(b.fingerprint);
@@ -123,9 +171,9 @@ describe('model families and build fingerprints', () => {
});
});
-describe('the play spec carries the ten parts of every play ask', () => {
+describe('the play spec carries the ten parts, the target and the numbered try-it steps', () => {
test('the fixture is complete and the parts are in order', () => {
- expect('spec' in checkPlaySpec(PLAY)).toBe(true);
+ expect(checkPlaySpec(PLAY)).toMatchObject({ spec: { target: { kind: 'realistic-copy', name: TARGET }, steps: [{ writes: 'none' }, { writes: 'a Plantpal account' }] } });
expect(PLAY_PARTS.map(p => p.part)).toEqual([
'The links, each checked live minutes before sending', 'Device and setup', 'What it is, in a sentence', 'How to start', 'Controls',
'How long to play', 'What we want to learn', 'How to report back', 'Known quirks', 'Reply word',
@@ -137,6 +185,29 @@ describe('the play spec carries the ten parts of every play ask', () => {
const r = checkPlaySpec({ ...rest, links: [{ label: 'x', url: 'ftp://nope' }], minutes: 0 });
expect(r).toEqual({ error: { code: 'FIRST_USE_PLAY_SPEC_INCOMPLETE', detail: 'missing or invalid: The links, each checked live minutes before sending (links); Controls (controls); How long to play (minutes); Known quirks (quirks)' } });
expect(checkPlaySpec({ ...PLAY, reply_word: 'two words' })).toMatchObject({ error: { detail: 'missing or invalid: Reply word (reply_word)' } });
+ expect(checkPlaySpec({ ...PLAY, steps: [{ text: 'Open it' }] })).toMatchObject({ error: { detail: 'missing or invalid: How to start (steps)' } });
+ expect(checkPlaySpec({ ...PLAY, target: { name: 'a copy' } })).toMatchObject({ error: { detail: 'missing or invalid: Device and setup (target)' } });
+ });
+
+ test('a copy is the default target; a step that writes on the owner\'s real setup needs his approval named', () => {
+ const { target: _t, ...noTarget } = PLAY;
+ expect(checkPlaySpec({ ...noTarget, target: { name: 'a copy', data: 'sample rows' } })).toMatchObject({ spec: { target: { kind: 'realistic-copy' } } });
+ const reads = Array.from({ length: 5 }, () => ({ writes: 'none' }));
+ const real = { ...PLAY, target: { kind: 'real', name: "Ada's own phone" }, action_writes: reads };
+ expect(checkPlaySpec(real)).toEqual({ error: { code: 'FIRST_USE_PLAY_SPEC_INCOMPLETE', detail: "step 2 writes on the owner's real setup with no approved_write naming his lettered approval; run it on a realistic copy, or get his approval for that write first" } });
+ const approved = { ...real, steps: [PLAY.steps[0], { ...PLAY.steps[1], approved_write: 'Ada, 2026-11-18: "B1"' }] };
+ expect(checkPlaySpec(approved)).toMatchObject({ spec: { target: { kind: 'real' }, steps: [{}, { approved_write: 'Ada, 2026-11-18: "B1"' }], action_writes: reads } });
+ });
+
+ test('on the owner\'s real setup each day-one action says what it writes, and a write needs his approval', () => {
+ const steps = [PLAY.steps[0]];
+ const real = { ...PLAY, steps, target: { kind: 'real', name: "Ada's own phone" } };
+ expect(checkPlaySpec(real)).toMatchObject({ error: { detail: 'missing or invalid: Device and setup (action_writes)' } });
+ expect(checkPlaySpec({ ...real, action_writes: [{ writes: 'none' }] })).toMatchObject({ error: { detail: 'missing or invalid: Device and setup (action_writes)' } });
+ const acts = [{ writes: 'none' }, { writes: 'none' }, { writes: 'archives a plant' }, { writes: 'none' }, { writes: 'none' }];
+ expect(checkPlaySpec({ ...real, action_writes: acts })).toEqual({ error: { code: 'FIRST_USE_PLAY_SPEC_INCOMPLETE', detail: "day-one action 3 writes on the owner's real setup with no approved_write naming his lettered approval; run it on a realistic copy, or get his approval for that write first" } });
+ acts[2] = { writes: 'archives a plant', approved_write: 'Ada, 2026-11-18: "C1"' } as typeof acts[number];
+ expect(checkPlaySpec({ ...real, action_writes: acts })).toMatchObject({ spec: { action_writes: [{}, {}, { approved_write: 'Ada, 2026-11-18: "C1"' }, {}, {}] } });
});
});
@@ -167,26 +238,32 @@ describe('where records live', () => {
});
describe('the gate', () => {
- test('five passes, live links and a prediction clear the exact build, and the message carries every part', async () => {
+ test('every step played, live links and a prediction clear the exact build; the message opens with her words and names the build she holds', async () => {
const r = passedRun();
expect(decide(r.dir, BUILD, T0).reasons).toEqual(['link_unchecked: http://127.0.0.1:1/testflight (as a fresh Apple ID with notifications allowed on ios)', 'link_unchecked: http://127.0.0.1:1/account (as a fresh Apple ID with notifications allowed on ios)']);
const links = await checkLinks(r.dir, AS, okFetch, () => T0);
expect('receipts' in links && links.receipts.map(x => x.verdict)).toEqual(['live', 'live']);
const d = decide(r.dir, BUILD, new Date(T0.getTime() + 5 * 60_000));
- expect(d).toMatchObject({ ok: true, reasons: [], passed: 5 });
+ expect(d).toMatchObject({ ok: true, reasons: [], passed: STEPS });
const msg = renderPlayMessage(d, new Date(T0.getTime() + 5 * 60_000));
+ expect(msg.startsWith('**Try plantpal: c0ffee000000, TestFlight build 17**\n\n**What you asked for, and what this version does with it:**\n- Ada Example, day 0: “I keep forgetting which plant needs water” → does it\n')).toBe(true);
for (const [i, label] of ['Links', 'Device and setup', 'What it is', 'How to start', 'Controls', 'How long', 'What we want to learn', 'How to report back', 'Known quirks', 'Reply word'].entries()) {
expect(msg).toContain(`${i + 1}. **${label}`);
}
+ expect(msg).toContain('It runs on the Plantpal test account (a copy loaded with three sample plants with a watering history).');
+ expect(msg).toContain(' 1. Open the TestFlight invite and install Plantpal');
+ expect(msg).toContain(' 4. Try: sees which plant needs water today');
expect(msg).toContain('checked live at 10:00 UTC, 5 min before this message');
expect(msg).toContain('[TestFlight invite](http://127.0.0.1:1/testflight)');
expect(msg).toContain('(asks you to sign in)');
- expect(msg).toContain('Try plantpal: c0ffee000000, TestFlight build 17');
- for (const a of ACTIONS) expect(msg).toContain(`- ${a}`);
+ expect(msg).toContain("**What you'll notice:**\n- nothing beyond the known quirks above");
+ expect(msg).toContain('**The build on your device now:** TestFlight build 16. Known defects in it: the care card shows yesterday as the last watered date.');
+ expect(msg).toContain('- 7 (useful): step 7 does what she asked');
expect(msg).not.toContain('predict');
+ expect(msg.startsWith(d.manifest!.try_text)).toBe(true);
});
- test('another build, a stale link, a changed day-one row and tampered evidence each refuse', async () => {
+ test('another build, a stale link, a changed day-one row or quote and tampered evidence each refuse', async () => {
const r = passedRun();
await checkLinks(r.dir, AS, okFetch, () => T0);
expect(decide(r.dir, { ...BUILD, testflight: '18' }, T0).reasons).toEqual(['build_mismatch: this run checked c0ffee000000, TestFlight build 17, not c0ffee000000, TestFlight build 18']);
@@ -194,36 +271,87 @@ describe('the gate', () => {
'link_stale: http://127.0.0.1:1/testflight was checked at 2026-11-18T10:00:00.000Z, over 15 minutes ago',
'link_stale: http://127.0.0.1:1/account was checked at 2026-11-18T10:00:00.000Z, over 15 minutes ago',
]);
+ const changed = "source_changed: the day-one rows or the owner's quotes changed since the check started; start a new run";
fs.writeFileSync(r.planPath, AUTOPLAN.replace('gets a reminder at 8am', 'gets a reminder at 9am'));
- expect(decide(r.dir, BUILD, T0).reasons).toEqual(['source_changed: the day-one rows changed since the check started; start a new run']);
+ expect(decide(r.dir, BUILD, T0).reasons).toEqual([changed]);
+ fs.writeFileSync(r.planPath, AUTOPLAN.replace('before work', 'after breakfast'));
+ expect(decide(r.dir, BUILD, T0).reasons).toEqual([changed]);
fs.writeFileSync(r.planPath, AUTOPLAN + '\nAn edit outside the table does not count.\n');
expect(decide(r.dir, BUILD, T0).ok).toBe(true);
const ev = fs.readdirSync(path.join(r.dir, 'evidence')).find(f => f.startsWith('2-'))!;
fs.writeFileSync(path.join(r.dir, 'evidence', ev), 'edited');
- expect(decide(r.dir, BUILD, T0).reasons).toEqual(['action_2_evidence_stale']);
- });
-
- test('a failed action, a down link and a missing prediction refuse; the newest result for an action counts', async () => {
- const root = fresh('root'), work = fresh('work'), planPath = path.join(work, 'plan.md');
- fs.writeFileSync(planPath, ONE_PAGE);
- const r = startRun({ root, app: 'plantpal', planPath, build: BUILD, play: playWith(1), builder: 'anthropic/claude-opus-5-5', checker: 'gemini-4-carbon', now: T0 });
- if ('error' in r) throw new Error(r.error.detail);
- const rec = (a: number, verdict: string, at: Date, note?: string) => recordResult({ dir: r.dir, action: a, verdict, evidence: shot(work, `a${a}-${verdict}.mp4`, `${a}${verdict}`), device: 'iPhone 17 Pro (cloud)', account: PLAY.account, by: 'google/gemini-4-carbon', note, now: at });
- for (let a = 1; a <= 4; a++) rec(a, 'pass', T0);
- expect(rec(5, 'fail', T0)).toMatchObject({ error: { detail: 'a fail needs --note saying what happened' } });
- rec(5, 'fail', T0, 'the care card is blank');
+ expect(decide(r.dir, BUILD, T0).reasons).toEqual(['step_2_evidence_stale']);
+ });
+
+ test('a stored result whose verdict is not useful or thin refuses, whatever it says (fail closed, as the merge base required pass)', async () => {
+ for (const verdict of ['pass', 'great', undefined]) {
+ const r = passedRun();
+ await checkLinks(r.dir, AS, okFetch, () => T0);
+ expect(decide(r.dir, BUILD, T0).ok).toBe(true);
+ const file = path.join(r.dir, 'results', fs.readdirSync(path.join(r.dir, 'results')).find(f => JSON.parse(fs.readFileSync(path.join(r.dir, 'results', f), 'utf8')).step === 3)!);
+ const row = JSON.parse(fs.readFileSync(file, 'utf8'));
+ fs.chmodSync(file, 0o600);
+ fs.writeFileSync(file, JSON.stringify({ ...row, verdict }));
+ expect(decide(r.dir, BUILD, T0).reasons).toEqual([`step_3_verdict_unknown: ${String(verdict)}`]);
+ }
+ });
+
+ test('a try-it text edited after the check refuses', async () => {
+ const r = passedRun();
+ await checkLinks(r.dir, AS, okFetch, () => T0);
+ const file = path.join(r.dir, 'manifest.json'), m = JSON.parse(fs.readFileSync(file, 'utf8'));
+ fs.chmodSync(file, 0o600);
+ fs.writeFileSync(file, JSON.stringify({ ...m, try_text: m.try_text + '\nOne more line.\n' }));
+ expect(decide(r.dir, BUILD, T0).reasons.some(x => x.startsWith('try_text_changed'))).toBe(true);
+ });
+
+ test('broken, wrong, a lookup the owner would be asked for and a thin day-one action refuse; the newest result counts', async () => {
+ const r = start({ checker: 'gemini-4-carbon' });
+ const by = 'google/gemini-4-carbon';
+ for (let s = 1; s <= STEPS; s++) rec(r, s, { by });
+ rec(r, 2, { by, verdict: 'useful', line: 'asks for her iCloud address', needsLookup: 'her iCloud address, which the Mac already knows', at: new Date(T0.getTime() + 1000) });
+ rec(r, 4, { by, verdict: 'thin', line: 'shows one plant, not which needs water', at: new Date(T0.getTime() + 1000) });
+ rec(r, 5, { by, verdict: 'broken', line: 'the Watered button does nothing', at: new Date(T0.getTime() + 1000) });
+ rec(r, 6, { by, verdict: 'wrong', line: 'the reminder arrives at 8pm', at: new Date(T0.getTime() + 1000) });
await checkLinks(r.dir, AS, async () => ({ status: 401 }), () => T0);
expect(decide(r.dir, BUILD, T0).reasons).toEqual([
- 'action_5_failed: the care card is blank', 'link_down: http://127.0.0.1:1/testflight (status 401)', 'no_predicted_score',
+ 'step_2_needs_lookup: her iCloud address, which the Mac already knows (an agent looks it up or does it; the owner is never asked)',
+ "step_4_thin: shows one plant, not which needs water (a day-one action comes from the owner's own words)",
+ 'step_5_broken: the Watered button does nothing', 'step_6_wrong: the reminder arrives at 8pm',
+ 'link_down: http://127.0.0.1:1/testflight (status 401)', 'no_predicted_score',
]);
- rec(5, 'pass', new Date(T0.getTime() + 60_000));
- await checkLinks(r.dir, AS, okFetch, () => new Date(T0.getTime() + 60_000));
+ const later = new Date(T0.getTime() + 60_000);
+ for (const s of [2, 4, 5, 6]) rec(r, s, { by, at: later });
+ await checkLinks(r.dir, AS, okFetch, () => later);
expect(predict({ dir: r.dir, score: '7', why: 'clean', by: 'gemini-4-carbon' })).toMatchObject({ prediction: { score: 7 } });
expect(predict({ dir: r.dir, score: '8', why: 'again', by: 'gemini-4-carbon' })).toMatchObject({ error: { code: 'FIRST_USE_RECORD_INVALID' } });
- expect(decide(r.dir, BUILD, T0)).toMatchObject({ ok: true, passed: 5 });
+ expect(decide(r.dir, BUILD, later)).toMatchObject({ ok: true, passed: STEPS });
+ });
+
+ test('a thin play step and a notice pass, and the message names both', async () => {
+ const r = passedRun();
+ const later = new Date(T0.getTime() + 1000);
+ rec(r, 2, { verdict: 'thin', line: 'sign-in works but asks for a password twice', notice: 'iOS asks to allow notifications', at: later });
+ await checkLinks(r.dir, AS, okFetch, () => later);
+ const d = decide(r.dir, BUILD, later);
+ expect(d).toMatchObject({ ok: true, passed: STEPS });
+ const msg = renderPlayMessage(d, later);
+ expect(msg).toContain("**What you'll notice:**\n- Step 2 is thin: sign-in works but asks for a password twice\n- At step 2 you'll see: iOS asks to allow notifications\n");
+ expect(msg).toContain('- 2 (thin): sign-in works but asks for a password twice');
});
- test('link receipts and results bind the owner-equivalent account and device class', async () => {
+ test('a first build says so; checker text is one plain line', () => {
+ const r = start();
+ const read = readManifest(r.dir);
+ if ('error' in read) throw new Error(read.error.detail);
+ const first = { ...read.manifest, holding: { build: 'none', defects: 'none' } };
+ expect(renderPlayMessage({ ok: true, reasons: [], manifest: first, passed: 0, verdicts: [], links: [{ checked_at: T0.toISOString() } as any] }, T0)).toContain('**The build on your device now:** none yet: this is your first build of it.');
+ expect(plainLine('see [the docs](https://evil.example) <b>now</b>\nplease')).toBe('see the docs now please');
+ expect(plainLine('x'.repeat(500))).toHaveLength(240);
+ expect(rec(r, 1, { line: ' \n ' })).toMatchObject({ error: { detail: '--line needs one line on what the owner would see at this step' } });
+ });
+
+ test('link receipts and results bind the owner-equivalent account, device class and target', async () => {
const r = passedRun();
expect(await checkLinks(r.dir, { account: 'any session', device_class: 'ios' }, okFetch, () => T0)).toMatchObject({ error: { code: 'FIRST_USE_RECORD_INVALID' } });
expect(await checkLinks(r.dir, { account: PLAY.account, device_class: 'web' }, okFetch, () => T0)).toMatchObject({ error: { code: 'FIRST_USE_RECORD_INVALID' } });
@@ -232,17 +360,28 @@ describe('the gate', () => {
fs.mkdirSync(path.join(r.dir, 'links'));
fs.writeFileSync(path.join(r.dir, 'links', 'other.json'), JSON.stringify(other));
expect(decide(r.dir, BUILD, T0).reasons[0]).toBe('link_unchecked: http://127.0.0.1:1/testflight (as a fresh Apple ID with notifications allowed on ios)');
- expect(recordResult({ dir: r.dir, action: 1, verdict: 'pass', evidence: shot(r.work, 'dev.png'), device: 'd', account: 'a developer account', by: 'openai/gpt-6.2-sol' })).toMatchObject({ error: { detail: 'play on the owner-equivalent account and pass it exactly: --account "a fresh Apple ID with notifications allowed"' } });
+ expect(rec(r, 1, { account: 'a developer account' })).toMatchObject({ error: { detail: 'play on the owner-equivalent account and pass it exactly: --account "a fresh Apple ID with notifications allowed"' } });
+ expect(rec(r, 1, { target: 'a scratch config' })).toMatchObject({ error: { detail: 'play on the play spec\'s target and pass it exactly: --target "the Plantpal test account"' } });
});
- test('the builder cannot record a result or a prediction, and evidence must be a screenshot or video', () => {
+ test('the builder cannot record a result or a prediction, and evidence must be a screenshot, video or terminal capture', () => {
const r = passedRun();
- expect(recordResult({ dir: r.dir, action: 1, verdict: 'pass', evidence: shot(r.work, 'self.png'), device: 'd', account: PLAY.account, by: 'anthropic/claude-opus-5-5' })).toMatchObject({ error: { code: 'FIRST_USE_SAME_FAMILY' } });
- expect(recordResult({ dir: r.dir, action: 1, verdict: 'pass', evidence: shot(r.work, 'notes.txt'), device: 'd', account: PLAY.account, by: 'openai/gpt-6.2-sol' })).toMatchObject({ error: { code: 'FIRST_USE_RECORD_INVALID' } });
- expect(recordResult({ dir: r.dir, action: 6, verdict: 'pass', evidence: shot(r.work, 'six.png'), device: 'd', account: PLAY.account, by: 'openai/gpt-6.2-sol' })).toMatchObject({ error: { detail: '--action must be 1 to 5' } });
+ expect(rec(r, 1, { by: 'anthropic/claude-opus-5-5' })).toMatchObject({ error: { code: 'FIRST_USE_SAME_FAMILY' } });
+ expect(rec(r, 1, { evidence: shot(r.work, 'notes.pdf') })).toMatchObject({ error: { code: 'FIRST_USE_RECORD_INVALID' } });
+ expect(rec(r, 1, { evidence: shot(r.work, 'terminal.log', 'gateway: ok') })).toMatchObject({ result: { evidence: { kind: 'text' } } });
+ expect(rec(r, 1, { verdict: 'pass' })).toMatchObject({ error: { detail: '--verdict must be useful, thin, wrong, broken' } });
+ expect(rec(r, 8)).toMatchObject({ error: { detail: '--step must be 1 to 7' } });
const link = path.join(r.work, 'link.png');
fs.symlinkSync(shot(r.work, 'real.png'), link);
- expect(recordResult({ dir: r.dir, action: 1, verdict: 'pass', evidence: link, device: 'd', account: PLAY.account, by: 'openai/gpt-6.2-sol' })).toMatchObject({ error: { detail: 'the evidence must be a regular file, not a link or directory' } });
+ expect(rec(r, 1, { evidence: link })).toMatchObject({ error: { detail: 'the evidence must be a regular file, not a link or directory' } });
+ });
+
+ test('a schema-1 run from before this change refuses with a clear line', () => {
+ const r = passedRun();
+ const m = JSON.parse(fs.readFileSync(path.join(r.dir, 'manifest.json'), 'utf8'));
+ const old = fresh('old');
+ fs.writeFileSync(path.join(old, 'manifest.json'), JSON.stringify({ ...m, schema_version: 1 }));
+ expect(readManifest(old)).toMatchObject({ error: { detail: `${old} is a schema-1 run from before the try-it steps and the owner's quotes were checked; start a new run` } });
});
test('the owner score and words sit beside the prediction; the manifest is written once', () => {
@@ -254,7 +393,7 @@ describe('the gate', () => {
expect(d.prediction?.score).toBe(6);
expect(d.owner).toMatchObject({ score: 5, words: '5, better after the fix' });
expect(fs.readdirSync(path.join(r.dir, 'owner'))).toHaveLength(2);
- const again = startRun({ root: r.root, app: 'plantpal', planPath: r.planPath, build: BUILD, play: PLAY, builder: 'anthropic/claude-opus-5-5', checker: 'openai/gpt-6.2-sol', now: T0 });
+ const again = startRun({ root: r.root, app: 'plantpal', planPath: r.planPath, build: BUILD, play: PLAY, holding: HOLDING, builder: 'anthropic/claude-opus-5-5', checker: CHECKER, now: T0 });
expect(again).toMatchObject({ error: { code: 'FIRST_USE_RECORD_INVALID' } });
});
@@ -264,29 +403,28 @@ describe('the gate', () => {
fs.rmSync(path.join(r.dir, d), { recursive: true, force: true });
fs.writeFileSync(path.join(r.dir, d), 'not a directory');
}
- expect(recordResult({ dir: r.dir, action: 1, verdict: 'pass', evidence: shot(r.work, 'again.png', 'again'), device: 'd', account: PLAY.account, by: 'openai/gpt-6.2-sol' })).toMatchObject({ error: { code: 'FIRST_USE_RECORD_INVALID' } });
+ expect(rec(r, 1)).toMatchObject({ error: { code: 'FIRST_USE_RECORD_INVALID' } });
expect(await checkLinks(r.dir, AS, okFetch)).toMatchObject({ error: { code: 'FIRST_USE_RECORD_INVALID' } });
expect(ownerScore({ dir: r.dir, score: '4', words: '4, fine', by: 'GStack Minder' })).toMatchObject({ error: { code: 'FIRST_USE_RECORD_INVALID' } });
});
test('the brief shell-quotes every value it puts into the record and predict lines', () => {
- const work = fresh('quote'), planPath = path.join(work, 'plan.md'), marker = path.join(work, 'ran');
- fs.writeFileSync(planPath, AUTOPLAN);
+ const marker = path.join(fresh('quote'), 'ran');
const account = `Ada's "test" $HOME \`touch ${marker}\` $(touch ${marker}) account`;
- const r = startRun({ root: path.join(fresh('root'), 'it\'s "$x"'), app: 'plantpal', planPath, build: BUILD, play: { ...PLAY, account }, builder: 'anthropic/claude-opus-5-5', checker: 'openai/gpt-6.2-sol', now: T0 });
- if ('error' in r) throw new Error(r.error.detail);
+ const target = `it's $(touch ${marker}) copy`;
+ const r = start({ root: path.join(fresh('root'), 'it\'s "$x"'), play: { ...PLAY, account, target: { ...PLAY.target, name: target } } });
const lines = renderBrief(r.manifest, r.dir).split('\n').filter(l => l.startsWith('gstack-first-use '));
expect(lines).toHaveLength(3);
for (const line of lines) {
const argv = spawnSync('bash', ['-c', line.replace(/^gstack-first-use /, "printf '%s\\n' ")], { encoding: 'utf8', timeout: 10_000 }).stdout.split('\n');
expect(argv[argv.indexOf('--run') + 1]).toBe(r.dir);
- expect(argv[argv.indexOf('--by') + 1]).toBe('openai/gpt-6.2-sol');
- if (line.includes(' record ')) expect(argv[argv.indexOf('--account') + 1]).toBe(account);
+ expect(argv[argv.indexOf('--by') + 1]).toBe(CHECKER);
+ if (line.includes(' record ')) { expect(argv[argv.indexOf('--account') + 1]).toBe(account); expect(argv[argv.indexOf('--target') + 1]).toBe(target); }
}
expect(fs.existsSync(marker)).toBe(false);
});
- test('the brief gives the checker only the play text and the frozen actions', () => {
+ test('the brief gives the checker the exact try-it message, the target and its rules, and nothing about the build', () => {
const r = passedRun();
const read = readManifest(r.dir);
if ('error' in read) throw new Error('no manifest');
@@ -294,10 +432,27 @@ describe('the gate', () => {
expect(brief).toContain('You run on openai/gpt-6.2-sol; the team that built it runs on anthropic models');
expect(brief).toContain('tools.capy.phone');
expect(brief).toContain('TestFlight build 17');
- for (const a of ACTIONS) expect(brief).toContain(a);
- expect(brief).toContain(`gstack-first-use record --run '${r.dir}' --action N --verdict pass --evidence FILE --device 'DEVICE YOU USED' --account 'a fresh Apple ID with notifications allowed' --by 'openai/gpt-6.2-sol'`);
- expect(brief).not.toContain('Ada Example');
+ expect(brief).toContain(read.manifest.try_text.trimEnd());
+ expect(brief).toContain('Never send anything as the owner');
+ expect(brief).toContain('Run every step on the Plantpal test account (a copy loaded with three sample plants with a watering history)');
+ expect(brief).toContain('2. Sign in with the account above. Writes: a Plantpal account');
+ expect(brief).toContain("3. Day-one action, from the owner's words (quote 1): adds her first three plants by photo. It works when: three plants show on the home screen with names. Writes: unknown, so treat it as a write");
+ expect(brief).toContain(`gstack-first-use record --run '${r.dir}' --step N --verdict useful --line 'WHAT THE OWNER SEES' --evidence FILE --device 'DEVICE YOU USED' --account 'a fresh Apple ID with notifications allowed' --target 'the Plantpal test account' --by 'openai/gpt-6.2-sol'`);
expect(brief).not.toContain(r.planPath);
+ expect(brief).not.toContain('TestFlight build 16');
+ });
+
+ test('the brief drives a Mac through Aside and a server over its shell', () => {
+ const work = fresh('mac'), planPath = path.join(work, 'plan.md');
+ fs.writeFileSync(planPath, AUTOPLAN);
+ const base = { root: fresh('root'), app: 'helper', planPath, holding: HOLDING, builder: 'anthropic/claude-opus-5-5', checker: CHECKER, now: T0 };
+ const mac = startRun({ ...base, build: { platform: 'macos', commit: COMMIT, deploy: '0.3.1' }, play: { ...PLAY, target: { kind: 'real', name: "Ada's Mac" }, steps: [{ text: 'Run helper setup', writes: 'none' }], action_writes: Array.from({ length: 5 }, () => ({ writes: 'none' })) } });
+ if (!('error' in mac)) expect(mac.manifest.steps.filter(s => s.kind === 'action').map(s => s.writes)).toEqual(['none', 'none', 'none', 'none', 'none']);
+ if ('error' in mac) throw new Error(mac.error.detail);
+ expect(renderBrief(mac.manifest, mac.dir)).toContain('through the Aside CLI, preferably over Tailscale');
+ const srv = startRun({ ...base, root: fresh('root'), build: { platform: 'server', commit: COMMIT, deploy: 'gw-7' }, play: PLAY });
+ if ('error' in srv) throw new Error(srv.error.detail);
+ expect(renderBrief(srv.manifest, srv.dir)).toContain('over its shell or CLI');
});
});
@@ -328,42 +483,46 @@ describe('gstack-first-use (CLI, temporary HOME and drive)', () => {
fs.writeFileSync(plan, AUTOPLAN);
fs.writeFileSync(play, JSON.stringify(playWith(server.port!)));
const build = ['--platform', 'ios', '--commit', COMMIT, '--testflight', '17'];
- const start = await cli('start', '--app', 'plantpal', '--plan', plan, '--play', play, ...build, '--builder', 'anthropic/claude-opus-5-5', '--checker', 'openai/gpt-6.2-sol');
- expect(start.code).toBe(0);
- const dir = /^FIRST_USE_RUN: (.+)$/m.exec(start.stdout)![1]!;
+ const holding = ['--holding', 'TestFlight build 16', '--holding-defects', 'none'];
+ expect((await cli('start', '--app', 'plantpal', '--plan', plan, '--play', play, ...build, '--builder', 'anthropic/claude-opus-5-5', '--checker', CHECKER)).stderr).toContain('--holding, --holding-defects');
+ const begun = await cli('start', '--app', 'plantpal', '--plan', plan, '--play', play, ...build, ...holding, '--builder', 'anthropic/claude-opus-5-5', '--checker', CHECKER);
+ expect(begun.code).toBe(0);
+ const dir = /^FIRST_USE_RUN: (.+)$/m.exec(begun.stdout)![1]!;
expect(dir.startsWith(path.join(home, '.capy', 'drive', 'user-ada-example', 'first-use', 'plantpal') + path.sep)).toBe(true);
- expect(start.stdout).toContain('FIRST_USE_FROZEN: 5 actions');
+ expect(begun.stdout).toContain('FIRST_USE_FROZEN: 7 steps (5 day-one actions) quotes=2');
+ expect(begun.stdout).toContain(' 2. Sign in with the account above (writes: a Plantpal account)');
const early = await cli('message', '--run', dir, ...build);
expect(early.code).toBe(3);
expect(early.stdout).toBe('');
expect(early.stderr).toContain('(FIRST_USE_REFUSED)');
- expect(early.stderr).toContain('action_1_not_played');
+ expect(early.stderr).toContain('step_1_not_played');
const brief = await cli('brief', '--run', dir);
expect(brief.stdout).toContain('# Cold first-use check: plantpal');
expect(brief.stderr).toContain('DISPATCH: give this brief');
- for (let a = 1; a <= 5; a++) {
- const rec = await cli('record', '--run', dir, '--action', String(a), '--verdict', 'pass', '--evidence', shot(work, `a${a}.png`, `s${a}`), '--device', 'iPhone 17 Pro (cloud)', '--account', PLAY.account, '--by', 'openai/gpt-6.2-sol');
- expect(rec.code).toBe(0);
+ for (let s = 1; s <= STEPS; s++) {
+ const one = await cli('record', '--run', dir, '--step', String(s), '--verdict', 'useful', '--line', 'works', '--evidence', shot(work, `s${s}.png`, `s${s}`), '--device', 'iPhone 17 Pro (cloud)', '--account', PLAY.account, '--target', TARGET, '--by', CHECKER);
+ expect(one.code).toBe(0);
}
- expect((await cli('predict', '--run', dir, '--score', '6', '--why', 'reminder works, adding is slow', '--by', 'openai/gpt-6.2-sol')).stdout).toContain('FIRST_USE_PREDICTED: 6');
+ expect((await cli('predict', '--run', dir, '--score', '6', '--why', 'reminder works, adding is slow', '--by', CHECKER)).stdout).toContain('FIRST_USE_PREDICTED: 6');
expect((await cli('links', '--run', dir)).code).toBe(1);
const links = await cli('links', '--run', dir, '--account', PLAY.account, '--device-class', 'ios');
expect(links.code).toBe(0);
expect(links.stdout).toContain('LINK: live status=403 as=ios');
const check = await cli('check', '--run', dir, ...build);
- expect(check.stdout).toMatch(/^FIRST_USE: pass app=plantpal build=c0ffee000000, TestFlight build 17 actions=5\/5 links=2\/2 checker=openai\/gpt-6.2-sol predicted=6$/m);
+ expect(check.stdout).toMatch(/^FIRST_USE: pass app=plantpal build=c0ffee000000, TestFlight build 17 steps=7\/7 thin=0 notices=0 links=2\/2 checker=openai\/gpt-6.2-sol predicted=6$/m);
const msg = await cli('message', '--run', dir, ...build);
expect(msg.code).toBe(0);
expect(msg.stdout).toContain('10. **Reply word:** played');
+ expect(msg.stdout).toContain('**The build on your device now:** TestFlight build 16. Known defects in it: none.');
expect((await cli('check', '--run', dir, '--platform', 'ios', '--commit', COMMIT, '--testflight', '18')).code).toBe(3);
expect((await cli('score', '--run', dir, '--score', '4', '--words', '4, Talk is slow', '--by', 'Example Captain')).code).toBe(0);
const show = await cli('show', '--run', dir, '--json');
- expect(JSON.parse(show.stdout)).toMatchObject({ passed: 5, predicted: 6, owner: { score: 4, words: '4, Talk is slow' }, gap: -2 });
+ expect(JSON.parse(show.stdout)).toMatchObject({ passed: 7, steps: 7, predicted: 6, owner: { score: 4, words: '4, Talk is slow' }, gap: -2 });
expect(realRecords()).toEqual(before);
});
diff --git a/test/fixtures/first-use/autoplan-plan.md b/test/fixtures/first-use/autoplan-plan.md
index 1479e515d..a2b4d43a0 100644
--- a/test/fixtures/first-use/autoplan-plan.md
+++ b/test/fixtures/first-use/autoplan-plan.md
@@ -6,7 +6,8 @@ Made-up plan for test/first-use.test.ts. The owner, the app and every row are in
### Owner's words
-- Ada Example, day 0: "I keep forgetting which plant needs water"
+- Ada Example, day 0: "I keep forgetting which plant needs water" → does it
+- Ada Example, day 0: "remind me every morning before work" → does it
### Day one
@@ -15,7 +16,7 @@ Made-up plan for test/first-use.test.ts. The owner, the app and every row are in
| adds her first three plants by photo | once | owner words 1 | Add plant | home screen, plus button | build 1 | three plants show on the home screen with names |
| sees which plant needs water today | daily | owner words 1 | Today list | root screen | build 1 | the plant due today is at the top, marked due |
| marks a plant as watered | daily | owner words 1 | Watered button | Today list, tap a plant | build 1 | the plant drops off today's list |
-| gets a reminder at 8am | daily | calendar habit | Morning reminder | notification | build 1 | a notification arrives at 8:00 on the device |
+| gets a reminder at 8am | daily | owner words 2 | Morning reminder | notification | build 1 | a notification arrives at 8:00 on the device |
| opens a plant's care card | weekly | owner words 1 | Care card | home screen, tap a plant | build 1 | the card shows light, water and the last watered date |
| shares a plant with her partner | assumed | assumed | Sharing | plant card, share | build 2 | the partner's phone shows the plant |
diff --git a/test/fixtures/first-use/one-page-plan.md b/test/fixtures/first-use/one-page-plan.md
index 1bb418ecd..b8e969845 100644
--- a/test/fixtures/first-use/one-page-plan.md
+++ b/test/fixtures/first-use/one-page-plan.md
@@ -2,6 +2,11 @@
The first five things the owner does on day one, each with a check that it works. Invented for tests.
+## Owner's words
+
+- Ada Example, day 0: "I keep forgetting which plant needs water" → does it
+- Ada Example, day 0: "remind me every morning before work" → does it
+
## Day one
| Action | Feature | Route | First build | Check | Frequency | Source |
@@ -9,7 +14,7 @@ The first five things the owner does on day one, each with a check that it works
| adds her first three plants by photo | Add plant | home screen, plus button | build 1 | three plants show on the home screen with names | once | owner words 1 |
| sees which plant needs water today | Today list | root screen | build 1 | the plant due today is at the top, marked due | daily | owner words 1 |
| marks a plant as watered | Watered button | Today list, tap a plant | build 1 | the plant drops off today's list | daily | owner words 1 |
-| gets a reminder at 8am | Morning reminder | notification | build 1 | a notification arrives at 8:00 on the device | daily | calendar habit |
+| gets a reminder at 8am | Morning reminder | notification | build 1 | a notification arrives at 8:00 on the device | daily | owner words 2 |
| opens a plant's care card | Care card | home screen, tap a plant | build 1 | the card shows light, water and the last watered date | weekly | owner words 1 |
## Install
diff --git a/test/fixtures/first-use/play.json b/test/fixtures/first-use/play.json
index d4bcba83d..d67d80595 100644
--- a/test/fixtures/first-use/play.json
+++ b/test/fixtures/first-use/play.json
@@ -13,8 +13,23 @@
"device": "iPhone 17 Pro on iOS 26",
"setup": "Install TestFlight from the App Store first.",
"account": "a fresh Apple ID with notifications allowed",
+ "target": {
+ "kind": "realistic-copy",
+ "name": "the Plantpal test account",
+ "data": "three sample plants with a watering history"
+ },
"what": "Plantpal tells you which houseplant needs water today.",
"start": "Open the TestFlight invite, tap Install, then open Plantpal.",
+ "steps": [
+ {
+ "text": "Open the TestFlight invite and install Plantpal",
+ "writes": "none"
+ },
+ {
+ "text": "Sign in with the account above",
+ "writes": "a Plantpal account"
+ }
+ ],
"controls": "Tap to open, swipe left on a plant to mark it watered.",
"minutes": 10,
"learn": "Whether the Today list is the first thing you want every morning.",
diff --git a/test/size-ledger/ship/first-versions-quote-owner-and-run-real-try-steps.json b/test/size-ledger/ship/first-versions-quote-owner-and-run-real-try-steps.json
new file mode 100644
index 000000000..4e30b5425
--- /dev/null
+++ b/test/size-ledger/ship/first-versions-quote-owner-and-run-real-try-steps.json
@@ -0,0 +1,4 @@
+{
+ "bytes": 296,
+ "why": "apple-release: one paragraph sending a TestFlight build for an owner trying a first version through gstack-first-use (GST-3608, Garry do it 2026-11-23)"
+}