feat(end-state): a gate that counts the distance to "Voyage is finished" - red

Voyage now has a destination that can fail: finish the phase-2 pipeline, close the open
experiments, freeze. This adds the gate that measures the distance to it. Nothing is
fixed or removed here; every defect and every removal is its own change.

scripts/end-state-gate.mjs counts four tallies; finished = all four at 0.
  defects         listed in scripts/end-state-registry.json, each with a runnable check
  experiments     listed in the registry, each with a runnable check
  dormant-agents  spawnable agents no commands/*.md references (structural, word-bounded;
                  files carrying the reference-document marker are excluded)
  decisions       open operator decisions in the local STATE.md, by a fixed marker
Exit 0 green, 1 red, 2 usage/registry error. `--json` for machines.

Fail-closed by construction: an entry with no check, or whose check cannot run (missing
file, empty glob, missing section), is NOT FELLABLE and counts as open; a missing STATE.md,
a missing section, or an unmarked list item in it makes the decisions tally n/a, which
keeps the gate red. The decisions row is therefore n/a in any clean clone.

Result today (clean export of the index): RED, 0 of 4 tallies at 0 -
defects 7 of 7, experiments 3 of 3, dormant agents 1 of 20, decisions n/a.
With the local STATE present: decisions 11 of 12.

Verified in both directions: 18 fixture tests pin each tally at 0 and above 0. Each of the
10 registry checks was measured open on this tree and closed after a simulated fix on a
throwaway copy (10 of 10). That run caught a too-broad D-03 check - Phase 4's legitimate
entry-condition skip also matched - which is now scoped to the Phase 7 section.
Suite 1041 -> 1059 (1057/0/2), also run on the clean export.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-09-17 15:27:21 +02:00
commit 553c288925
3 changed files with 717 additions and 0 deletions

View file

@ -0,0 +1,100 @@
{
"defects": [
{
"id": "D-01",
"summary": "commands/trekplan.md still references TeamCreate/TeamDelete (allowed-tools and the execute-with-team path); both tools were removed in Claude Code 2.1.178, so that path always falls back to sequential",
"closesWhen": "trekplan.md no longer names TeamCreate or TeamDelete",
"check": [
{ "path": "commands/trekplan.md", "pattern": "\\bTeam(Create|Delete)\\b", "expect": "match" }
]
},
{
"id": "D-02",
"summary": "commands/trekresearch.md tells the swarm engine to run the `### Bridge agent` block, but that heading was removed together with gemini-bridge",
"closesWhen": "the dangling reference is gone (or the heading exists again)",
"check": [
{ "path": "commands/trekresearch.md", "pattern": "`### Bridge agent`", "expect": "match" },
{ "path": "commands/trekresearch.md", "pattern": "^### Bridge agent", "flags": "m", "expect": "no-match" }
]
},
{
"id": "D-03",
"summary": "commands/trekexecute.md never runs a trekplan's `## Verification` (where the brief's success criteria land) on the single-session path: Phase 7 says 'Skip for trekplans', and only the multi-session wave path runs master verification",
"closesWhen": "Phase 7 no longer skips trekplans (proxy: the fix must also make that path run the plan's Verification; Phase 4's entry-condition skip is legitimate and out of scope)",
"check": [
{ "path": "commands/trekexecute.md", "section": "## Phase 7 —", "pattern": "^\\*\\*Skip for trekplans\\.\\*\\*", "flags": "m", "expect": "match" }
]
},
{
"id": "D-04",
"summary": "agents/brief-conformance-reviewer.md must judge whether a success criterion's verification command 'exists and passes', but its tools are Read/Glob/Grep, so it cannot run anything",
"closesWhen": "the rubric no longer asks it to judge 'passes', or the reviewer can execute the command",
"check": [
{ "path": "agents/brief-conformance-reviewer.md", "pattern": "exists and passes", "expect": "match" },
{ "path": "agents/brief-conformance-reviewer.md", "pattern": "^tools:.*\"Bash\"", "flags": "m", "expect": "no-match" }
]
},
{
"id": "D-05",
"summary": "commands/trekplan.md allowed-tools lists TaskCreate/TaskUpdate, which Claude Code 2.1.233 no longer offers on Opus 4.8 / Sonnet 5 / Fable 5 and newer by default (runtime effect not measured)",
"closesWhen": "trekplan.md allowed-tools no longer lists TaskCreate or TaskUpdate",
"check": [
{ "path": "commands/trekplan.md", "pattern": "^allowed-tools:.*\\bTask(Create|Update)\\b", "flags": "m", "expect": "match" }
]
},
{
"id": "D-06",
"summary": "lib/review/gold-scorer.mjs contains a literal NUL byte, so git treats the file as binary and hides it from diffs and --numstat",
"closesWhen": "the file contains no NUL byte (write the separator as an escape sequence)",
"check": [
{ "path": "lib/review/gold-scorer.mjs", "pattern": "\\u0000", "expect": "match" }
]
},
{
"id": "D-07",
"summary": "CLAUDE.md's command table says every /trek* command runs on opus, but since v5.9.0 no command pins model: and the orchestrator follows the session model",
"closesWhen": "the table stops claiming opus per command, or the commands pin it again",
"check": [
{ "path": "CLAUDE.md", "pattern": "^\\| `/trek[a-z]+` \\|.*\\| opus \\|\\s*$", "flags": "m", "expect": "match" },
{ "path": "commands/*.md", "pattern": "^model:", "flags": "m", "expect": "no-match" }
]
}
],
"experiments": [
{
"id": "E-01",
"summary": "STORM dimension discovery + bounded research loop ships default-off behind VOYAGE_STORM_ENABLED; adoption is gated on a pre-registered measurement that has not run",
"closesWhen": "the env gate is gone from the pipeline surface: adopted as default, or the loop is removed",
"check": [
{ "path": ["commands/*.md", "agents/*.md", "lib/**/*.mjs", "hooks/**/*.mjs"], "pattern": "VOYAGE_STORM_ENABLED", "expect": "match" }
]
},
{
"id": "E-02",
"summary": "`/trekresearch --engine deep-research` delegates to Claude Code's /deep-research, which is manual-only since 2.1.218, so the opt-in always falls back to the swarm",
"closesWhen": "the --engine opt-in is removed from trekresearch.md",
"check": [
{ "path": "commands/trekresearch.md", "pattern": "--engine\\b", "expect": "match" }
]
},
{
"id": "E-03",
"summary": "the delegated-orchestration head-to-head (T1 §5) is designed but has no recorded decision",
"closesWhen": "T1 §5 carries a STATUS block (run, or declined)",
"check": [
{ "path": "docs/T1-cc26-delegated-orchestration.md", "section": "## 5.", "pattern": "^> \\*\\*STATUS:", "flags": "m", "expect": "no-match" }
]
}
],
"agents": {
"dir": "agents",
"spawnSites": "commands/*.md",
"referenceMarker": "Reference document, not a spawnable capability"
},
"decisions": {
"file": "STATE.md",
"section": "## Åpne operatørbeslutninger",
"open": "^- \\[ \\] ",
"closed": "^- \\[x\\] "
}
}