Repository navigation
feat(prototype): add enforceable question-first prototype lifecycle - #4
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Implement the safe, useful conclusions from data/video-review-n0vh/report.md as the smallest deep design that makes question-first prototypes a distinct, enforceable lifecycle inside Firstmate existing scout, report, decision-hold, promotion, and delivery paths. Require one explicit uncertainty before start and exactly one ui or logic-state class; default to an isolated copy with synthetic or minimized fixtures, no persistence, and no external side effects; fail closed before live NAS data, production accounts or routes, remote-access policy, DNS/MX/email, billing, credentials, or recovery material without any worker convenience bypass. Preserve durable assumptions, alternatives, observed evidence, chosen and rejected decisions, unresolved risks, and expiry or disposal; keep prototype code as evidence rather than implementation authority; require a clean promotion that carries only the validated decision through normal tests and review, rejects stale scratch state, and turns reproduced logic failures into regression tests. Keep AGENTS.md minimal, put conditional policy in one precise agent-only skill owner, exact mechanics and schemas in script help, stay tool-neutral across all supported harnesses and backends, add focused positive and fail-closed coverage, preserve unrelated work, and do not install Wayfinder or add a second tracker or orchestration vocabulary.
What Changed
bin/fm-prototype.shand the agent-onlyprototype-lifecycleskill, making a question-first prototype an ordinary scout subtype recorded in afm-prototype.v1manifest atdata/<id>/prototype.json: one explicit registered question, exactly oneuiorlogic-stateclass, and an immutable safe envelope (synthetic or minimized fixtures, no persistence, no external side effects, sensitive live access forbidden with no bypass flag). The script owns registration, worktree binding, evidence completion, verification, and promotion preparation.fm-brief.sh --scout --prototype <class> --question <q>registers the manifest and adds the skill trigger plus an evidence-gate definition of done;fm-spawn.shvalidates registration before creating an endpoint and binds the baseline HEAD and ignored-file snapshot after every backend converges on the isolated worktree but before harness launch;fm-teardown.shrequiresverifyfor a marked scout; andfm-promote.shrefuses promotion untilpromotion-verifyconfirms completed evidence, the chosen decision, its regression-test obligation, and a residue-free worktree at the exact baseline, then emits ship instructions that reimplement the decision afresh.tests/fm-prototype-lifecycle.test.sh(positive and fail-closed coverage for evidence, question drift, idempotency, immutable safe defaults, promotion residue, regression obligation, and the tool-neutral spawn/teardown seams), documented the lifecycle inAGENTS.md,docs/architecture.md,docs/configuration.md, anddocs/scripts.md, and added aherdr_lab_environment_readygate so the real-Herdr suites skip with an explicit reason on machines with no running default Herdr session instead of failing.Risk Assessment
✅ Low: A well-bounded, additive lifecycle feature with strong fail-closed gating and thorough tests; only two minor, non-breaking robustness observations, both in the happy-path-safe range.
Testing
Baseline suite plus targeted suites for every changed script pass, and the full 84-suite run is green with the previously failing Herdr e2e suites now skipping cleanly on a machine with no running default Herdr session. Beyond unit coverage I drove the whole lifecycle end-to-end through the real scripts against a throwaway project, throwaway firstmate home, and an isolated tmux server: intake refuses a missing question, an unsupported class, and a non-investigation task; the safe envelope is persisted; a real tmux-backed dispatch binds the clean baseline of the isolated copy and the worker window visibly shows the prototype contract; cleanup is refused before evidence exists and again after a post-completion report edit; hand-loosening the sensitive-access or persistence values is rejected; promotion is refused while scratch commits or new ignored residue survive and accepted only from a clean copy at the registered baseline, with promotion emitting ship instructions that carry the validated decision and the regression-test obligation. The change is CLI and agent-policy only with no rendered UI surface, so reviewer-visible evidence is the terminal transcript and captured worker window rather than screenshots. All testing artifacts were cleaned up afterwards (worktree pool, tmux socket, task temp) and the working tree is unchanged.
Evidence: End-to-end prototype lifecycle CLI transcript (16 steps, all as required)
Evidence: Key lifecycle refusals and acceptances (excerpt)
Evidence: Dispatched worker window capture (worker really receives the prototype contract)
Evidence: Persisted prototype record after the full lifecycle (envelope, binding, evidence, promotion)
Evidence: Generated prototype worker instructions
Evidence: Surviving prototype evidence report accepted by the gate
/var/folders/zh/ms9rwtds3095pjqx4j91rmbm0000gn/T/no-mistakes-evidence/01KY85V1THJ97ZA8HFF8G4F5S6/prototype-lifecycle-e2e.sh) - Outcome: 🔧 1 issue found → auto-fixed ✅ across 2 runs (1h40m29s)Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-prototype.sh:235- evidence_section() (bin/fm-prototype.sh:235) terminates a section only at the next '### ' heading, so the last evidence section — 'Regression-test obligation' — greedily runs to EOF and absorbs any level-2 '## …' sections or content a worker appends after the '## Prototype evidence' block. This pollutes the stored regression_test_reason that verify/regression-obligation echo into promotion ship instructions. It does not break the happy path (report digest is over the whole file; 'Chosen decision' is not the last section), but a report with trailing sections stores a bloated reason. Fix: also exit the awk on a '^## ' heading.bin/fm-prototype.sh:438- complete_command (bin/fm-prototype.sh:438) unconditionally sets '.promotion = null'. Re-running 'complete' after 'prepare-promotion' silently discards the prepared promotion even when the report bytes are identical, a minor deviation from the header's documented 'completion over identical report bytes is idempotent'. Harmless (worker just re-prepares) and likely intentional invalidation, so no action needed.🔧 **Test** - 1 issue found → auto-fixed ✅
command -v tmux >/dev/null || { echo "tmux is required for e2e tests" >&2; exit 1; }; tmux -V; rc=0; for t in tests/*.test.sh; do echo "== $t =="; bash "$t" || rc=1; done; exit "$rc"🔧 Fix: skip Herdr e2e suites without a running default session
✅ Re-checked - no issues remain.
command -v tmux >/dev/null || { echo "tmux is required for e2e tests" >&2; exit 1; }; tmux -V; rc=0; for t in tests/*.test.sh; do echo "== $t =="; bash "$t" || rc=1; done; exit "$rc"bash tests/fm-prototype-lifecycle.test.sh(8 positive + fail-closed cases: evidence, question drift, idempotency, immutable sensitive defaults, promotion residue, regression obligation, tool-neutral spawn/teardown seams)bash tests/fm-brief.test.sh,bash tests/fm-promote.test.sh,bash tests/fm-teardown.test.sh(integration points touched by the change)Re-ran the round-1 failing Herdr suites:tests/fm-backend-autodetect-smoke.test.sh,tests/fm-afk-inject-herdr-e2e.test.sh,tests/fm-backend-herdr-{smoke,eventwait-smoke,prune-safety-e2e,respawn-idem-e2e,workspace-per-home-e2e}.test.sh— all skip cleanly (exit 0) with no running default Herdr sessionFull configured suite:for t in tests/*.test.sh; do bash "$t"; done→ all 84 suites pass (rc=0)Manual end-to-end walkthrough driving the real scripts (fm-brief.sh --scout --prototype,fm-spawn.sh --scout --backend tmuxwith a real treehouse worktree,fm-prototype.sh register/bind/complete/verify/decision/regression-obligation/prepare-promotion,fm-decision-hold.sh complete,fm-teardown.sh,fm-promote.sh) against a throwaway project/home on a private tmux socket:bash /var/folders/zh/ms9rwtds3095pjqx4j91rmbm0000gn/T/no-mistakes-evidence/01KY85V1THJ97ZA8HFF8G4F5S6/prototype-lifecycle-e2e.shCaptured the dispatched worker window withtmux capture-pane -p -S -2000 -t firstmate:fm-widgetsched1to confirm the worker actually receives the prototype contract✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.