opencode-thrum-pro 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/assets/commands/thrum-_deviations-protocol.md +87 -0
  2. package/assets/commands/thrum-_generator-idempotency-protocol.md +15 -0
  3. package/assets/commands/thrum-_project-rules-protocol.md +18 -0
  4. package/assets/commands/thrum-_snapshot-protocol.md +265 -0
  5. package/assets/commands/thrum-_stamp-protocol.md +112 -0
  6. package/assets/commands/thrum-_verify-before-write-protocol.md +27 -0
  7. package/assets/commands/thrum-inbox.md +22 -0
  8. package/assets/commands/thrum-load-context.md +17 -0
  9. package/assets/commands/thrum-overview.md +17 -0
  10. package/assets/commands/thrum-prime.md +30 -0
  11. package/assets/commands/thrum-quickstart.md +14 -0
  12. package/assets/commands/thrum-reply.md +28 -0
  13. package/assets/commands/thrum-restart-extended.md +195 -0
  14. package/assets/commands/thrum-restart.md +293 -0
  15. package/assets/commands/thrum-send.md +31 -0
  16. package/assets/commands/thrum-sleep-extended.md +186 -0
  17. package/assets/commands/thrum-sleep.md +212 -0
  18. package/assets/commands/thrum-team.md +12 -0
  19. package/assets/commands/thrum-update-project.md +259 -0
  20. package/assets/commands/thrum-wait.md +14 -0
  21. package/assets/skills/adversarial-critique/SKILL.md +242 -0
  22. package/assets/skills/brainstorm-queue-aware/SKILL.md +167 -0
  23. package/assets/skills/brainstorm-steward/SKILL.md +181 -0
  24. package/assets/skills/choosing-subagent-models/SKILL.md +244 -0
  25. package/assets/skills/closing-findings-while-warm/SKILL.md +104 -0
  26. package/assets/skills/configure-roles/SKILL.md +229 -0
  27. package/assets/skills/coordinator-assessing-agent-completion/SKILL.md +205 -0
  28. package/assets/skills/coordinator-assessing-agent-completion/scan.py +117 -0
  29. package/assets/skills/coordinator-branch-split-on-block/SKILL.md +168 -0
  30. package/assets/skills/coordinator-context-monitoring/SKILL.md +674 -0
  31. package/assets/skills/coordinator-dispatching-work/SKILL.md +288 -0
  32. package/assets/skills/coordinator-hotpath-merge-gate/SKILL.md +522 -0
  33. package/assets/skills/coordinator-interacting-with-the-owner/SKILL.md +171 -0
  34. package/assets/skills/coordinator-maintaining-memory/SKILL.md +89 -0
  35. package/assets/skills/coordinator-managing-state-and-lifecycle/SKILL.md +192 -0
  36. package/assets/skills/coordinator-merging-code/SKILL.md +331 -0
  37. package/assets/skills/coordinator-philosophy-merge-gate/SKILL.md +442 -0
  38. package/assets/skills/coordinator-plan-reconcile-gate/SKILL.md +198 -0
  39. package/assets/skills/coordinator-post-restart-sweep/SKILL.md +135 -0
  40. package/assets/skills/coordinator-running-autonomous-feature-development/SKILL.md +199 -0
  41. package/assets/skills/coordinator-running-brainstorm-cycles/SKILL.md +654 -0
  42. package/assets/skills/coordinator-running-review-cycles/SKILL.md +153 -0
  43. package/assets/skills/coordinator-single-responsibility-merge-gate/SKILL.md +14 -0
  44. package/assets/skills/diagnosing-fleet-and-daemon/SKILL.md +255 -0
  45. package/assets/skills/efficient-multi-agent-research/SKILL.md +177 -0
  46. package/assets/skills/fixing-documentation-errors/SKILL.md +258 -0
  47. package/assets/skills/implementer-maintaining-memory/SKILL.md +84 -0
  48. package/assets/skills/implementer-orchestrating-execution/SKILL.md +125 -0
  49. package/assets/skills/implementer-receiving-dispatch/SKILL.md +127 -0
  50. package/assets/skills/implementer-receiving-review-feedback/SKILL.md +125 -0
  51. package/assets/skills/implementer-status-and-handoff/SKILL.md +150 -0
  52. package/assets/skills/implementer-tdd-and-quality/SKILL.md +99 -0
  53. package/assets/skills/memory-audit-recover/SKILL.md +153 -0
  54. package/assets/skills/memory-curate/SKILL.md +139 -0
  55. package/assets/skills/memory-maintenance/SKILL.md +87 -0
  56. package/assets/skills/memory-read-discipline/SKILL.md +164 -0
  57. package/assets/skills/memory-search-advanced/SKILL.md +217 -0
  58. package/assets/skills/memory-write-discipline/SKILL.md +135 -0
  59. package/assets/skills/orchestrate/SKILL.md +795 -0
  60. package/assets/skills/persistent-watcher-archetype/SKILL.md +225 -0
  61. package/assets/skills/prime-agent/SKILL.md +92 -0
  62. package/assets/skills/project-hotpath-gate/SKILL.md +255 -0
  63. package/assets/skills/project-philosophy/SKILL.md +418 -0
  64. package/assets/skills/project-philosophy/resources/philosophy-template.md +155 -0
  65. package/assets/skills/project-philosophy/resources/reliability-class-library.md +653 -0
  66. package/assets/skills/project-setup/SKILL.md +1007 -0
  67. package/assets/skills/project-setup/resources/implementation-agent.md +826 -0
  68. package/assets/skills/researcher-answering-queries/SKILL.md +100 -0
  69. package/assets/skills/researcher-investigating/SKILL.md +152 -0
  70. package/assets/skills/researcher-maintaining-memory/SKILL.md +176 -0
  71. package/assets/skills/state-migration/SKILL.md +54 -0
  72. package/assets/skills/thrum/SKILL.md +161 -0
  73. package/assets/skills/thrum/resources/ANTI_PATTERNS.md +132 -0
  74. package/assets/skills/thrum/resources/BOUNDARIES.md +56 -0
  75. package/assets/skills/thrum/resources/CLI_REFERENCE.md +1066 -0
  76. package/assets/skills/thrum/resources/IDENTITY.md +49 -0
  77. package/assets/skills/thrum/resources/LISTENER_PATTERN.md +64 -0
  78. package/assets/skills/thrum/resources/MESSAGING.md +163 -0
  79. package/assets/skills/thrum/resources/TMUX_SESSIONS.md +118 -0
  80. package/assets/skills/thrum/resources/WORKTREES.md +117 -0
  81. package/assets/skills/thrum-memory/SKILL.md +138 -0
  82. package/assets/skills/trace-spec-to-plan/SKILL.md +104 -0
  83. package/assets/skills/trace-spec-to-plan/resources/sweep-agent-prompt.md +57 -0
  84. package/assets/skills/update-queue/SKILL.md +149 -0
  85. package/assets/skills/using-the-queue/SKILL.md +172 -0
  86. package/assets/skills/using-thrum-state/SKILL.md +104 -0
  87. package/assets/skills/verify-against-plan/SKILL.md +323 -0
  88. package/assets/skills/verify-against-source/SKILL.md +237 -0
  89. package/assets/skills/watcher-archetype/SKILL.md +84 -0
  90. package/assets/skills/writing-durable-markdown/SKILL.md +66 -0
  91. package/dist/hooks/block-sync-cd.d.ts +9 -0
  92. package/dist/hooks/block-sync-cd.js +71 -0
  93. package/dist/hooks/block-sync-cd.test.d.ts +1 -0
  94. package/dist/hooks/block-sync-cd.test.js +61 -0
  95. package/dist/hooks/shell-env.d.ts +8 -0
  96. package/dist/hooks/shell-env.js +22 -0
  97. package/dist/index.d.ts +6 -0
  98. package/dist/index.js +25 -0
  99. package/dist/installer.d.ts +2 -0
  100. package/dist/installer.js +86 -0
  101. package/package.json +49 -0
@@ -0,0 +1,442 @@
1
+ ---
2
+ name: coordinator-philosophy-merge-gate
3
+ description: "Use when ABOUT TO START a philosophy Pass-3 gate - a gate has been dispatched to you, you are picking up a queued gate, you are the Gate Runner beginning a gate - and when a coordinator is about to run git merge on any new feature or large bug fix after dual review came back clean. Loads the gate-runner restart rule (restart at ~50 percent, at a seam BETWEEN gates) plus the FULL .thrum/philosophy.md anti-pattern list and red-flags checklist, walked as a distinct pass rather than folded into the dual review. NEVER skipped except for a one-line config change, a typo, or a test-only diff."
4
+ ---
5
+
6
+ # Coordinator: Philosophy Merge Gate
7
+
8
+ ## Before you start this gate — restart if you cannot finish it
9
+
10
+ **Finish the gate you are in. Never restart mid-gate.** A finding that exists only
11
+ in your context is one restart from gone.
12
+
13
+ **Then restart at the seam — after the report is delivered, before taking anything
14
+ else.** Do not carry context across a gate boundary.
15
+
16
+ **Do not START a new gate above ~50% context.** A full dual gate costs roughly 14%.
17
+ Starting one you cannot finish is how a gate ends thin on its own verdict.
18
+
19
+ **Why the boundary is the gate and not a number - a gate runner is static.** Each gate
20
+ is scoped, evidenced, and delivered self-contained; State.md carries what must persist.
21
+ Nothing accumulates across gates, so context held past a gate boundary buys nothing and
22
+ costs money.
23
+
24
+ **This is NOT the orchestrator rule.** An orchestrator is building something and its
25
+ context is the work - it pushes through until its current plan is implemented and
26
+ restarts then, at 30% or at 60%. Interrupting an implementation to hit a number is the
27
+ wrong move. A gate is short and self-contained, so its boundary comes often and costs
28
+ nothing to take.
29
+
30
+ **The coordinator may overrule either rule for a sustained campaign** - a push to get trunk
31
+ green, an incident, a release cutover - where continuity across many units is worth more than
32
+ a clean seam. That is an explicit decision, stated at the time. It is never drift.
33
+
34
+ **Measure by pane, in the same command block that reports the number.** A figure carried
35
+ forward from earlier in the session is a memory, not a measurement.
36
+
37
+
38
+
39
+ ## Why this is a separate pass, not a dual-review finding class
40
+
41
+ `code-review` and `verify-against-plan` are general-purpose passes — correctness
42
+ and spec-compliance. The anti-patterns in `.thrum/philosophy.md` are
43
+ project-specific structural rules that require a different lens: not "is this
44
+ code correct?" but "does this diff introduce a pattern the project has
45
+ explicitly ruled out?" Folding these into dual review dilutes both the general
46
+ review and the specialized lenses. This gate is the third, sequential pass — run
47
+ it after dual review is clean, before `git merge`.
48
+
49
+ **How to apply: DISPATCH THIS GATE TO THE GATE RUNNER. Do not walk the lenses in
50
+ your own context.**
51
+
52
+ The gate runner is a standing agent whose entire purpose is to hold gate work
53
+ OUTSIDE the coordinator's context — resolve the current one from `thrum team` by
54
+ its `gate` ROLE, never by a remembered name. It runs the lenses in an ephemeral worktree, produces
55
+ a verdict, and tears the worktree down. **You write the dispatch, consolidate the
56
+ verdict, and decide. You do not run the lenses.**
57
+
58
+ **This is the default for EVERY diff size.** Diff size changes what you ask for;
59
+ it never changes who runs it. A coordinator that walks the lenses inline burns
60
+ the one resource it cannot replace and leaves no durable verdict artifact.
61
+
62
+ **Only run it yourself when there is NO gate-role agent available**, and say so
63
+ explicitly in the merge record so the gap is visible rather than invisible.
64
+
65
+ **Verdicts are artifacts:** the runner saves them to
66
+ `dev-docs/gate-reports/<ISO-week>/<date>/<gate-slug>/` and commits them BEFORE
67
+ removing any worktree. A verdict that exists only in a message cannot be audited
68
+ later.
69
+
70
+ ## Gate dispatch preamble
71
+
72
+ Mandatory checklist handed to the GATE RUNNER (and any sub-agent it spawns) at
73
+ dispatch time — hand this list verbatim:
74
+
75
+ 1. Read code via `git show <target-sha>:<path>`, NEVER the working tree —
76
+ tree state != the SHA under review. A plain `Read`/`grep` against the
77
+ working tree can silently return pre-merge code that looks entirely
78
+ normal if the repo is checked out on a different branch than the one
79
+ under review.
80
+ 2. Build/test ONLY in a throwaway detached worktree
81
+ (`git worktree add <tmp> <sha> --detach`), never the shared checkout.
82
+ 3. RUN any test you make a claim about — never judge from reading it; a
83
+ test that looks like a genuine regression guard can be failing.
84
+ 4. Diff against `merge-base`, never two-dot against tip — a two-dot diff
85
+ against tip pulls in unrelated lines from sibling branches and
86
+ manufactures a false regression signal.
87
+ 5. Run `git merge-base --is-ancestor` as an explicit gate condition (the
88
+ fast-forward check) — git silently deduplicates content-identical commits
89
+ on both sides of a rebase, so a tree that "builds clean" can still be
90
+ carrying dupes instead of the real content.
91
+ 6. Run full-package `-race`, not targeted `-run` — a targeted race run
92
+ misses cross-test races that only a full-package run surfaces.
93
+ 7. Build+test the MERGED-tree result as a SEPARATE condition — neither gate
94
+ currently runs a build of the actual post-merge tree; a clean pre-merge
95
+ build/test does not prove the merged result compiles or passes.
96
+ 7b. **GATE ON OUTPUT, NOT ON EXIT STATUS — and NEVER take `$?` after a pipe**
97
+ (`cmd | tail; echo $?` reports *tail's* status, not cmd's).
98
+ **Do NOT "fix" this with `${PIPESTATUS[0]}` — that is BASH-ONLY and this fleet
99
+ runs zsh 5.9, where it expands to an EMPTY STRING.** Verified empirically:
100
+ `zsh -c 'false | true; echo "${PIPESTATUS[0]}"'` → `` (empty), because zsh
101
+ names the array `pipestatus` (lowercase) AND indexes from 1, so the bash form
102
+ is wrong twice over. The failure direction is what makes it dangerous: an
103
+ empty rc in a typical `[ -z "$rc" ] || [ "$rc" = 0 ]` guard reports SUCCESS,
104
+ so **the remedy for the silent-false-green class is itself a silent false
105
+ green.** In priority order:
106
+ (a) gate on OUTPUT — shell-agnostic, and the thing that actually catches
107
+ real failures (e.g. read the "OK — copies match source" line, not the rc);
108
+ (b) if a status is genuinely needed, run it with NO PIPE:
109
+ `cmd >/dev/null 2>&1; echo $?`;
110
+ (c) only if a pipeline is unavoidable, use `${pipestatus[1]}` on zsh /
111
+ `${PIPESTATUS[0]}` on bash — and STATE WHICH SHELL, because the same
112
+ string means different things in each.
113
+ 8. Use `rm -r`, NEVER `rm -rf`, and use `git worktree remove --force` to drop
114
+ a worktree. A broad `ask` rule on `rm -rf *` outranks any narrow `/tmp`
115
+ allow, so `rm -rf` raises a human permission prompt EVERY time regardless
116
+ of path and stalls gate sub-agents mid-run waiting on a keystroke. `rm -r`
117
+ runs free. Do NOT widen the ask rule to work around this; that entry is
118
+ the only deletion protection on the box.
119
+ 9. Check the discriminator before picking a scratch path, don't assume from
120
+ the platform: `[ -L /tmp ]`. macOS (symlink) — create throwaway worktrees
121
+ under `/private/tmp`; a worktree under `/tmp` false-FAILs worktree-ancestor
122
+ tests via the symlink, producing a confident wrong gate result. Linux (real
123
+ dir) — `/tmp` is correct; `/private/tmp` may not exist there and must not
124
+ be created.
125
+ 10. Your report reaches the coordinator ONLY as your final returned text.
126
+ Side-channel output is discarded. Put the whole verdict in the return value.
127
+ 11. **NEVER run `git stash`, `git checkout`, `git reset`, or any working-tree
128
+ mutation in the SHARED repo.** Do read-only inspection there (`git show
129
+ <sha>:<path>`, `git log`, `git diff`) and do every build/test in a throwaway
130
+ detached worktree. Two reasons, both proven in production:
131
+ (a) **`git stash` is a SINGLE SHARED STACK across every worktree of a repo.**
132
+ A stash taken in one worktree is visible and poppable from all of them, so
133
+ "cleaning up after myself" can strand or clobber another agent's live work.
134
+ (b) The shared repo is POPULATED — live agents hold UNCOMMITTED working-tree
135
+ state there (State.md files they are actively re-authoring). A checkout or
136
+ stash silently reverts EVERY agent's uncommitted work, not just the file you
137
+ were looking at.
138
+ If you believe you must mutate the shared tree, STOP and report instead —
139
+ that is always a finding, never a step.
140
+ 12. **TEAR DOWN YOUR THROWAWAY WORKTREE WHEN THE GATE ENDS — after two checks,
141
+ in this order.** A required final step, not cleanup etiquette. Each
142
+ abandoned worktree pins its HEAD commit against `gc` and adds a
143
+ `.git/worktrees` admin entry, so the object store grows monotonically.
144
+ Before removing:
145
+ (a) `git -C <wt> status --porcelain` — if NON-EMPTY, **STOP and report it
146
+ instead of removing.** Uncommitted work in a throwaway worktree exists
147
+ NOWHERE else; this is the category that actually loses work.
148
+ (b) `git branch -a --contains $(git -C <wt> rev-parse HEAD)` — if EMPTY,
149
+ HEAD is a gate-produced merge reachable from no ref and removal orphans
150
+ it. Usually fine (a gate merge is reproducible by redoing it) but say so
151
+ in your report rather than doing it silently.
152
+ Then `git worktree remove --force <wt>` (see rule 8 on `rm -r`). Rule 11's
153
+ hazard notice on its own — teardown can destroy uncommitted state — reads
154
+ as a reason NOT to tear down. A warning without a procedure does not
155
+ produce caution; it produces paralysis plus litter.
156
+
157
+ ## Walk 1 — The project's ruled-out anti-patterns
158
+
159
+ **Walk the anti-patterns in `.thrum/philosophy.md` at gate time, in file order,
160
+ however many there are.** That file is the source of truth; this skill reprints
161
+ none of it, so an anti-pattern added or retired there needs no edit here.
162
+
163
+ Read § Anti-Patterns via `git show <target-sha>:.thrum/philosophy.md` (preamble
164
+ rule 1 — never the working tree). For each `### N. <title>` entry, in order:
165
+
166
+ 1. Read its BAD / GOOD shape and **Why** — the BAD block is the pattern to
167
+ check for.
168
+ 2. Check the surface the entry names — usually the diff (against merge-base,
169
+ preamble rule 4), on content the branch INTRODUCES or MATERIALLY CHANGES,
170
+ not content it touches incidentally (see § Scope discipline). A few
171
+ anti-patterns name a different surface: AP#7 is checked against the
172
+ preceding dual-review reports, not the diff.
173
+ 3. Apply the severity the entry states. A BLOCKING condition hit on new work
174
+ fails the gate; a judgment call gets judgment and a recorded reason.
175
+ 4. Record an inapplicable entry as walked-and-N/A with a one-line reason —
176
+ never a silent skip.
177
+
178
+ Cite an anti-pattern finding as `ph<N>` (matching the efficacy-log `lens=`
179
+ token); cite a meta-check finding (below) as `ph-metaA` / `ph-metaB` /
180
+ `ph-metaC`.
181
+
182
+ **AP#1 and AP#8 overlap the hot-path gate** (`subprocess_hot_path` +
183
+ `shared_resource_poisoning`; `pattern_divergence` "typed RPC handler"). Walk
184
+ them here regardless — the hot-path gate's subprocess/SQL and typed-handler
185
+ checks are hot-path-file-scoped, while AP#1 governs all daemon-path code plus
186
+ the fallible-call-outside-a-seam generalization. Do not re-file a finding the
187
+ hot-path gate already raised; do cover what its scope misses.
188
+
189
+ **AP#10 keeps its dedicated detection procedure (Lens 10 below)** — its
190
+ detection is the 10a/10b/10d probe set, not a single grep.
191
+
192
+ ## Lens 10 — Conflated multi-responsibility service (Anti-Pattern #10)
193
+
194
+ This lens uses three sub-procedures from the single-responsibility standing rule
195
+ (`dev-docs/decisions/2026-07-09-single-responsibility-standing-rule.md`).
196
+
197
+ ### 10a — Structural backstop (grep before you trust prose review)
198
+
199
+ For any new/changed function in the diff that looks decision-shaped, grep its
200
+ signature for a plural parameter of its own subject type:
201
+
202
+ ```bash
203
+ # Heuristic — look for a decision-shaped func taking []T or map[K]T of the
204
+ # same type it's named after (adjust the pattern to the touched package).
205
+ grep -nE 'func \([a-zA-Z]+ \*?[A-Za-z]+\) [a-z][A-Za-z]*\(ctx[^)]*\[\][A-Za-z]|func \([a-zA-Z]+ \*?[A-Za-z]+\) [a-z][A-Za-z]*\(ctx[^)]*map\[' <changed-file>.go
206
+ ```
207
+
208
+ A hit on something named like a decision (`reconcile*`, `resolve*`, `verdict*`,
209
+ `evaluate*`) is the signature this rule is built to catch. A hit on a legitimate
210
+ scheduler/fanout layer is not a fail — use judgment. **This backstop is scoped
211
+ honestly: it only catches the plural-subject conflation shape (facet 1). It is
212
+ blind to the per-call cost problem, which only 10d catches.**
213
+
214
+ ### 10b — Naming test (can you name it with one verb?)
215
+
216
+ For every new or materially-changed exported function/method that **decides**
217
+ something (computes a verdict, mutates core state, resolves an identity), try to
218
+ name it with a single verb over a single subject. If the honest name needs an
219
+ "And" — `reconcileAndSchedule`, `listAndScan`, `snapshotOrFallBack`,
220
+ `launchAndCommit` — it is conflated by construction. Split the decision core
221
+ from the scheduling/batching/fallback wrapper; the core keeps the verb name, the
222
+ wrapper (or the existing scheduler) does the looping.
223
+
224
+ ### 10d — Cost gate (bounded per call, or off the lock?)
225
+
226
+ For every touched unit on a hot path (RPC handler, list/fanout endpoint,
227
+ anything called per-request or per-agent): does it do work proportional to N
228
+ (worktrees, agents, rows), spawn a subprocess, or block on I/O — per call? Does
229
+ it hold a shared lock (`state.mu`) across any of that, or across a drain/loop?
230
+ If yes to either, the cost must move off the hot path (cache + background
231
+ refresh — the `peercred.CachingAgentLister` pattern is the canonical fix) or out
232
+ from under the lock. A bounded-per-call answer is required before merge.
233
+
234
+ **Note:** 10b and 10d are orthogonal probes. A unit can pass 10b (single verb,
235
+ singular signature) and still fail 10d (hidden O(N) or lock-across-I/O cost). Do
236
+ not merge them into one question.
237
+
238
+ ### 10 Scope discipline
239
+
240
+ Apply lenses 10a/10b/10d to code the merging branch **introduces or materially
241
+ changes** (edits the decision logic or scheduling logic of an existing unit). Do
242
+ NOT flag existing conflated units the branch merely calls or touches
243
+ incidentally. Note incidental finds in the merge report as "touch-soon"
244
+ candidates if they are actively wedging something; otherwise leave them.
245
+
246
+ Do not apply Lens 10 to shared-substrate issues (lock scope, pool sizing,
247
+ checkpoint timing, driver behavior) — a flawless single-responsibility unit can
248
+ still wedge on those, and splitting units makes it worse. If a finding looks
249
+ like write-pool serialization, checkpoint races, or pooled-conn poisoning, route
250
+ it as its own bug.
251
+
252
+ ## Meta-check A — A new return value / sentinel is only as safe as its WORST consumer
253
+
254
+ **When a diff introduces a new return value, sentinel, error value, or enum
255
+ member, ENUMERATE EVERY PRODUCTION CONSUMER and CLASSIFY EACH BY ITS
256
+ COMPARISON. Safety is a property of the comparison at each call site, NOT of the
257
+ value itself — so it CANNOT be certified at one call site, and a test at one
258
+ consumer proves nothing about the others.**
259
+
260
+ The comparison shape determines the fail direction:
261
+
262
+ - `x != ""` — a new non-empty sentinel makes this TRUE → treated as "something
263
+ detected" → typically **fail-CLOSED** (safe).
264
+ - `x != "some-specific-string"` — a new sentinel ALSO makes this true → treated
265
+ as "not the thing I was waiting for" → typically **fail-OPEN** (dangerous:
266
+ cancels, deletes, clears, or proceeds).
267
+ - `x` passed through verbatim into a message, reason field, or log — check
268
+ whether ANY downstream parses it as structured data before ruling it cosmetic.
269
+
270
+ Procedure, and do not shortcut it: grep the bare identifier of the producing
271
+ function (NOT `func Name` — that is blind to methods, the receiver sits between),
272
+ list every production call site, and for each one write down the comparison and
273
+ its resulting action. A consumer you did not enumerate is a consumer you did not
274
+ clear.
275
+
276
+ **Worked example:** a new sentinel with 4 consumers — 1 fixed, 1
277
+ fail-opened+cancelled a nudge, 1 mislog, 1 leak — from one constant. A point
278
+ fix leaves a sibling SURFACE, not merely a sibling case; enumeration is what
279
+ converts "the consumer I noticed" into "the consumers that exist."
280
+
281
+ ## Meta-check B — Shipped executable instructions were never executed
282
+
283
+ **If the diff ships a command, a field lookup, or a lookup-key construction that
284
+ an agent or script will execute, that invocation MUST have been run against a
285
+ REAL target before merge. Prose review does not satisfy this lens.**
286
+
287
+ This applies to commands embedded in skills, runbooks, restart/sleep snapshots,
288
+ generated scripts, templates, role preambles, and prompts — anywhere the artifact
289
+ tells someone (human or agent) to run something. It applies whether the command
290
+ is in a fenced block, inline, or assembled from variables at runtime.
291
+
292
+ Check, per shipped invocation:
293
+
294
+ 1. **Does every field lookup return what the surrounding code assumes?** Run it.
295
+ `thrum whoami --field <x>` and friends return real values with real shapes —
296
+ read the actual output, not the flag's documentation.
297
+ 2. **Does the constructed key actually resolve at the target?** Values get
298
+ transformed in transit (sanitized, normalized, truncated, case-folded). A key
299
+ built from a lookup that is *correct* can still miss because the consumer
300
+ rewrites it.
301
+ 3. **Is an unresolvable target a HOLD, or does it proceed at a wrong target?**
302
+ Failing to resolve must stop the action, not fall through to a default.
303
+
304
+ **Worked example:** a self-restart feature shipped non-functional because a
305
+ field lookup returned a pane-qualified target while the consumer expected a
306
+ sanitized session name — both gates had returned zero findings, because
307
+ neither gate's question was "does this command, executed by a real agent,
308
+ hit its own session?" A spec defect is invisible to spec-compliance review
309
+ by construction: a faithful implementation of an incomplete spec passes the
310
+ review that exists to catch wrongness. Only executing the thing closes that
311
+ hole.
312
+
313
+ **Corollary — A DOUBLE-ZERO IS A PROMPT, NOT A CLEARANCE.** Two clean gates on a
314
+ lifecycle or guidance change is *too little friction*, and is exactly when to ask
315
+ what neither gate could see by construction. The question that found it was
316
+ cheap and mechanical: **when shipped guidance contains a command, run the
317
+ command.**
318
+
319
+ Probe safely: exercise the derivation against a **nonexistent** target first so
320
+ nothing live is disturbed, and read the error text — it distinguishes "not found"
321
+ (you passed the wrong argument) from a mangled key (the consumer rewrote it).
322
+
323
+ ## Meta-check C — Test the branch's own unmeasured claim
324
+
325
+ **Find the claim in the branch that its own author did not verify, then test it
326
+ directly.** Every branch asserts something — in a commit message, the bead
327
+ body, or a code comment — that reads as established fact but was never
328
+ independently checked. Locate that sentence. It almost always has one of four
329
+ shapes:
330
+
331
+ - a **TOTALITY** ("these are the only paths that do X")
332
+ - a **COMPLETENESS** ("all call sites now route through Y")
333
+ - a **SAFETY** ("the guard prevents Z")
334
+ - a **SCOPE** ("this cannot reach W")
335
+
336
+ **How to apply:** Find the claim (grep commit messages and the bead
337
+ description for absolute language — "only", "all", "never", "cannot", "the
338
+ sole"). Then independently verify it with an enumeration or trace whose **zero
339
+ is controlled** — a control that MUST return non-zero on the same command
340
+ shape, so a silent empty result cannot be mistaken for a clean one. Report the
341
+ verdict explicitly as **COMPLETE** or **INCOMPLETE** — do not fold it into a
342
+ vaguer note.
343
+
344
+ **This lens is not an accusation, and must not be written as one.** It
345
+ applies equally when the claim holds. **Worked example:** an "ONLY
346
+ mechanism" claim in this codebase was independently enumerated and turned
347
+ out to be FOUR defective paths, not one; a later re-verification of a
348
+ related claim, aimed the same way, returned COMPLETE — a real, repeated
349
+ verification, not an assumption carried over from the last check.
350
+ **"Claim verified, here is the enumeration and its control" is a full,
351
+ successful result** — a lens that only ever produces findings is one
352
+ reviewers learn to discount.
353
+
354
+ ## Red-flags checklist pass
355
+
356
+ After the anti-pattern walk, scan the diff against `.thrum/philosophy.md`
357
+ § Red Flags via `git show <target-sha>:.thrum/philosophy.md` — not a copy here.
358
+ Any hit on new code the branch introduces is a gate fail. Red flags marked
359
+ **MANDATORY on every merge, no scope exemption** are checked on every diff
360
+ whatever it appears to touch.
361
+
362
+ Two red-flag-grade checks are not in `.thrum/philosophy.md` — they are above as
363
+ **Meta-check B** (a shipped command / lookup-key never executed against a real
364
+ target) and **Meta-check C** (a totality / completeness / safety / scope claim
365
+ never enumerated with a controlled-zero check). Include both.
366
+
367
+ ## Scope discipline (gate-wide)
368
+
369
+ This gate governs NEW work unconditionally and EXISTING code only on a
370
+ fix-on-contact basis — don't carve out an unrelated existing violation because
371
+ you noticed it while reviewing an adjacent change. "No manufactured urgency"
372
+ applies here the same as anywhere else.
373
+
374
+ ## At merge time — COMMIT ACCUMULATED AGENT STATE
375
+
376
+ **Every coordinator, on every merge: stage and commit accumulated agent state
377
+ under `.thrum/agents/` along with the merge.** Session snapshots, `State.md`
378
+ files, salvage directories. This is a standing rule for ALL coordinators on ALL
379
+ boxes, not a <primary-box>-only habit.
380
+
381
+ **Why this is a rule and not housekeeping:** uncommitted agent state exists in
382
+ exactly ONE place — a working tree. Anything that touches that tree destroys it,
383
+ and several things routinely do:
384
+
385
+ - A `git checkout` / `stash` / `reset` in the shared repo reverts every agent's
386
+ uncommitted state at once.
387
+ - `git stash` is a SINGLE SHARED STACK across every worktree of a repo, so a
388
+ stash taken anywhere can strand or clobber state everywhere.
389
+ - A worktree teardown takes its uncommitted state with it, permanently.
390
+
391
+ Committed state survives all three. **The state IS the agent's memory across
392
+ restarts** — losing it is not losing a file, it is losing an agent's ability to
393
+ wake up knowing what it was doing.
394
+
395
+ Check before you merge (expect a non-trivial count on an active box; if it is
396
+ zero, confirm that is real rather than a wrong path):
397
+
398
+ ```bash
399
+ git status --porcelain -- .thrum/agents/ | wc -l
400
+ git add .thrum/agents/
401
+ ```
402
+
403
+ Two cautions, so this rule does not cause its own incident:
404
+
405
+ 1. **Never `git add -f`.** If something under `.thrum/` is gitignored it stays
406
+ out of git — that is deliberate, not an obstacle to route around.
407
+ 2. **Do not commit another agent's state mid-write** as a substitute for asking
408
+ it to save. Committing what is on disk is protective; it is not a snapshot
409
+ command, and a half-written `State.md` committed is still half-written.
410
+
411
+ ## If it fails
412
+
413
+ Send it back as a normal review finding — same channel as dual-review output,
414
+ folded into the same numbered list if dual review is still open, or as its own
415
+ short reply if dual review already passed. Cite the offending function/file and
416
+ which anti-pattern (`ph<N>`), meta-check, or Lens 10 sub-probe it failed. Do
417
+ NOT block on Lens 10d findings that are
418
+ genuinely disclaimed substrate issues (see Lens 10 scope discipline above); DO
419
+ block on any Lens 10b or 10d finding on NEW work.
420
+
421
+ ## See also
422
+
423
+ - `coordinator-branch-split-on-block` — when this gate BLOCKs on one concern
424
+ of a branch that bundles multiple independent concerns, while the other
425
+ concern(s) are clean.
426
+
427
+ ## Reference
428
+
429
+ - `.thrum/philosophy.md` — canonical source for all anti-patterns and red flags
430
+ checked by this gate
431
+ - `dev-docs/decisions/2026-07-09-single-responsibility-standing-rule.md` — full
432
+ standing rule with the three-class scope model, enforcement architecture
433
+ (3a/3b/3c/3d), and worked examples of previously-traced conflated services
434
+
435
+ ## Project-specific rules (already loaded)
436
+
437
+ Read the shared partial at the absolute path:
438
+ `claude-plugin/commands/_project-rules-protocol.md`
439
+
440
+ If you accumulate a new rule mid-session (the user corrects you), capture it via
441
+ the `coordinator-maintaining-memory` skill — it references the
442
+ `memory-write-discipline` common for the canonical `thrum memory create` shape.
@@ -0,0 +1,198 @@
1
+ ---
2
+ name: coordinator-plan-reconcile-gate
3
+ description: "Use when N parallel plans (one researcher per program of a shared idea) are all LOCKED and about to feed project-setup, and the plans cross-talk at shared seams — an anchor contract produced by one plan and consumed by another, a shared struct field, a shared predicate. Verifies the plans COMPOSE (consistent seams, no double-build, no gap) before any bead or worktree exists. This is the multi-plan reconcile gate — the step that makes parallel plan-writing pay off instead of producing N colliding plans. It uses Fable, the single standing exception to the never-select-Fable rule — see Step 2 for the cited scope of that exception."
4
+ ---
5
+
6
+ # Coordinator: Plan Reconcile Gate
7
+
8
+ ## When to use
9
+
10
+ Run this gate when:
11
+
12
+ - ≥2 plans were authored **in parallel**, each for one program of a shared
13
+ idea, and each plan touches at least one **shared seam** with a sibling
14
+ plan (a contract, a struct, a predicate, a schema that more than one plan
15
+ reads or writes).
16
+ - All N plans have individually passed their own dual-review
17
+ (`coordinator-running-brainstorm-cycles` Phase 6: `verify-against-source` +
18
+ prose-quality) and are stamped `THRUM-REVIEW: stage=plan verdict=Ready:Yes`.
19
+ - The plans are about to feed `project-setup` — beads, tasks, and worktrees
20
+ are about to be minted from them.
21
+
22
+ **Don't use when:**
23
+
24
+ - Only one plan exists for the idea (nothing to reconcile against).
25
+ - Multiple plans exist but share no seam — genuinely disjoint programs. Verify
26
+ disjointness explicitly (see "List the seams before writing" below) before
27
+ skipping; "looks disjoint" is not the same as "verified disjoint."
28
+ - This is the sibling-brainstorm **coherence pass** (`coordinator-running-
29
+ brainstorm-cycles` Phase 5) — that pass runs earlier, over brainstorms, for
30
+ contradiction/vocabulary drift. This gate runs later, over LOCKED plans,
31
+ specifically for seam composition. Run both when both apply; they are not
32
+ substitutes for each other.
33
+
34
+ ## Why this is a separate gate, not folded into the plan dual-review
35
+
36
+ Each plan's own dual-review (`verify-against-source`) checks that plan against
37
+ **its own** brainstorm/spec — a single-plan lens. It cannot see whether plan
38
+ ①'s seam contract matches plan ②'s, because the reviewer only ever reads one
39
+ plan. Composition defects are invisible to a lens that only ever looks at one
40
+ artifact at a time — the same shape as the philosophy gate's rationale for
41
+ being a separate pass from dual review. The remedy is a **reconciler that
42
+ reads all N plans together**, plus the per-plan verify running alongside it.
43
+
44
+ ## Step 1 — List the seams before writing (belongs in the plans, verify it's there)
45
+
46
+ Before this gate even runs, each plan should already carry an explicit
47
+ **owns-vs-consumes** section naming every shared seam it touches — this is a
48
+ Stage-3 (`writing-plans`) discipline this gate audits, not one it originates.
49
+ If a plan is missing this section, that is itself a BLOCKING finding: return
50
+ it to the researcher rather than attempting to infer ownership from prose.
51
+
52
+ For each seam, collect across the N plans:
53
+
54
+ - **The seam name** (e.g. "the A2 anchor contract", "the `Evidence` struct",
55
+ "the identity-file schema", "the `PhaseOf` predicate").
56
+ - **Which plan OWNS it** — writes/defines the contract, is the single source
57
+ of truth.
58
+ - **Which plan(s) CONSUME it** — read or call into the owner's contract
59
+ without redefining it.
60
+
61
+ Build this as a small table before dispatching the reconciler; it is the
62
+ reconciler's primary input alongside the plans themselves.
63
+
64
+ ## Step 2 — The reconcile pass (one top-level Fable agent, plans read together)
65
+
66
+ Spawn **one** top-level agent, `model: "fable"`.
67
+
68
+ This is not a self-granted exception; it is the single deliberate use of
69
+ Fable anywhere in the system, kept as an independent check-and-balance
70
+ against everything else, which runs on the sonnet ceiling.
71
+ Fable — a distinct, more-capable model — is the right instrument specifically
72
+ because a holistic cross-plan reconcile (does seam X mean the same thing in
73
+ plan ① as in plan ②?) benefits from a different model than the sonnet-run
74
+ per-plan reviews, a form of cross-document judgment a sonnet-tier pass has
75
+ been shown to miss.
76
+
77
+ This is the **one named, cited exception** to the standing "never SELECT
78
+ Fable" rule, which otherwise forbids ad-hoc Fable selection anywhere. The
79
+ exception is scoped to this gate's reconcile pass ONLY — do not select Fable
80
+ elsewhere in the pipeline, or for any other step, on the strength of this
81
+ skill. Any new use of Fable outside this gate needs its own explicit
82
+ approval, not an extension of this one.
83
+
84
+ Give the fable agent:
85
+
86
+ - All N plans, in full, in one dispatch (not summarized, not excerpted).
87
+ - The seam table from Step 1.
88
+ - The parent decisions / convergence map from Stage 1, so it has the shared
89
+ intent the plans were decomposed from.
90
+
91
+ Ask it to verify three things and return a verdict per seam plus an overall
92
+ verdict:
93
+
94
+ 1. **Shared seams are consistent** — does plan ①'s description of what it
95
+ consumes from plan ② match what plan ② actually says it owns and produces
96
+ (types, semantics, timing)? Prose agreement is not enough — check field
97
+ names, ordering guarantees, and error/absence semantics too.
98
+ 2. **No double-build** — do two plans both intend to implement the same
99
+ thing, unaware of each other? This is the failure a cross-critique
100
+ discipline exists to catch: a solo researcher cannot see a sibling's plan,
101
+ so a duplicate build looks like sound scoping from inside either plan
102
+ alone.
103
+ 3. **No gap** — is there a seam that appears in one plan's "consumes" list
104
+ but in NO plan's "owns" list? An unowned seam means the code that's
105
+ supposed to produce it will not exist.
106
+
107
+ Overall verdict is one of: **YES** (compose cleanly, no fixes needed),
108
+ **YES-WITH-FIXES** (compose after named fixes — the common case), or **NO**
109
+ (fundamental seam conflict, needs re-brainstorm). Run this in parallel with
110
+ Step 3, not sequentially.
111
+
112
+ ## Step 3 — Per-plan verify-against-source, run alongside the reconcile pass
113
+
114
+ Independently of the fable reconcile, run `verify-against-source` per plan
115
+ against its own brainstorm/spec (this may already exist from Stage 3 — re-run
116
+ it now if the plan changed since, so the reconcile gate is judging current
117
+ text). This catches single-plan drift the reconciler isn't chartered to catch
118
+ (the reconciler's job is composition, not per-plan fidelity). Both together
119
+ form the writing-plans gate for this stage.
120
+
121
+ ## Step 4 — Fold fixes, then delta re-gate — and the delta re-gate is a REAL TEST, not a re-read
122
+
123
+ When the verdict is YES-WITH-FIXES, each named researcher folds their fix
124
+ into their plan. Once all fixes report landed, run a **delta re-gate**. This
125
+ is the single most important discipline in this skill, and it is easy to
126
+ skip because it looks redundant:
127
+
128
+ **A delta re-gate that just re-reads the revised prose only catches
129
+ transcription error** — did the researcher type the agreed sentence
130
+ correctly. It does NOT catch whether the fix actually holds structurally.
131
+ Run **different-axis checks**, not a second reading of the same axis:
132
+
133
+ - **Does the FINAL plan still carry the extension it was supposed to?** A fix
134
+ folded into v2 can get silently dropped in a later edit pass — check the
135
+ literal text is still present, not that it once was.
136
+ - **Struct-collision** — if two plans both mutate the same struct/schema, do
137
+ their final field additions/changes actually coexist (no name collision, no
138
+ contradictory type), or does only one plan's version of the struct survive
139
+ in each plan's own text?
140
+ - **Platform-availability of a primitive** — if a plan's fix relies on some
141
+ runtime primitive (a syscall, a PID-based read, a filesystem watch), is
142
+ that primitive actually available on every platform the code will run on?
143
+ A prose fix can read as complete while quietly assuming one platform.
144
+
145
+ **Each of these can return NO while all prose still reads correctly and
146
+ consistently** — that is exactly why "one artifact, two readers" is not two
147
+ instruments. Only a check that asks a *different question* of the revised
148
+ plans is a real second instrument.
149
+
150
+ ## The meta-finding — why parallel-with-cross-talk beats serial
151
+
152
+ Cross-critique among the plan authors caught false positive-controls that the
153
+ per-plan review gate had already **passed**. Both the ① and ③ authors
154
+ self-caught issues in their own central deliverables that their individual
155
+ reviewers had cleared. **Any one researcher working alone would have written
156
+ an N+1th competing plan and never known it was redundant** — the cross-talk
157
+ also surfaced that the axis was NOT greenfield (four stale stamped plans
158
+ already covered part of it), collapsing what would have been fresh builds
159
+ into amend/supersede sets.
160
+
161
+ This is the entire reason to run plan authorship in parallel with cross-talk
162
+ rather than serially, and it is the reason this gate exists as a distinct
163
+ step rather than trusting each plan's own review to be sufficient. Caveat
164
+ (load-bearing, n=1 so far): the effect was observed in **coupled** pairings
165
+ (researchers who exchanged seam interpretations directly); whether it
166
+ transfers to an uncoupled solo reviewer reading all plans cold is untested —
167
+ treat the fable reconciler as necessary, not merely a formality confirming
168
+ what cross-talk already caught.
169
+
170
+ ## Gate that closes it
171
+
172
+ Reconcile verdict is **YES** (after any fixes and their delta re-gate, not
173
+ before). A **NO** verdict routes back to Stage 2/3 (brainstorm or plan
174
+ rewrite) for the conflicting programs — do not attempt to patch a fundamental
175
+ seam conflict forward into project-setup.
176
+
177
+ ## Handoff
178
+
179
+ Reconcile PASS → `project-setup` (Stage 5). Carry the seam table and the
180
+ fable verdict forward as context for whoever authors the impl prompts — the
181
+ seam ownership decisions are exactly what a prompt needs to state
182
+ unambiguously so an implementer doesn't re-litigate them.
183
+
184
+ ## See also
185
+
186
+ - `coordinator-running-brainstorm-cycles` — Phase 5 (sibling coherence pass,
187
+ runs earlier over brainstorms) and Phase 6 (per-plan dual-review, this
188
+ gate's Step 3 input).
189
+
190
+ ## Project-specific rules (already loaded)
191
+
192
+ Read the shared partial at the absolute path:
193
+ `claude-plugin/commands/_project-rules-protocol.md`
194
+
195
+ If you accumulate a new rule mid-session about multi-plan reconciliation,
196
+ capture it via the `coordinator-maintaining-memory` skill — it references the
197
+ `memory-write-discipline` common for the canonical `thrum memory create`
198
+ shape.