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,288 @@
1
+ ---
2
+ name: coordinator-dispatching-work
3
+ description: "Use when starting an epic, dispatching to an implementer, creating a worktree for an agent, or spawning a sub-agent. Loads coordinator-specific discipline for kicking off implementation work."
4
+ ---
5
+
6
+ # Coordinator: Dispatching Work
7
+
8
+ ## Use `thrum tmux launch` — not raw send-keys
9
+
10
+ **Why:** Manual `tmux send-keys 'claude'` followed by `/thrum:prime` skips
11
+ identity registration and produces silent CWD drift. The
12
+ `thrum tmux launch <name>` flow registers the agent against the worktree path
13
+ correctly and gives the daemon a real PID to track.
14
+
15
+ **How to apply:** Whenever you need to start a runtime in an existing tmux pane,
16
+ use `thrum tmux launch <session_name>` even if you've already typed the runtime
17
+ command yourself. If you've already started one wrong, kill the pane and
18
+ re-launch via the daemon. If the pane doesn't exist yet, use
19
+ `thrum tmux start <name>` (creates, launches, primes, attaches in one command).
20
+
21
+ ## Recycling an agent: destroy then teardown
22
+
23
+ **Why:** The inverse of dispatch is removal, and it has the same "two-step
24
+ ritual or things break silently" property as dispatch via tmux launch + thrum
25
+ send. See `coordinator-managing-state-and-lifecycle` § "Destroy an agent before
26
+ tearing down its worktree" for the canonical sequence (`thrum tmux kill` BEFORE
27
+ `thrum worktree teardown`). The dispatching skill mentions it here so you find
28
+ the cross-reference when planning a wave recycle, not just when reading the
29
+ lifecycle skill end-to-end.
30
+
31
+ ## Never spawn sub-agents into worktrees where Thrum agents are running
32
+
33
+ **Why:** Sub-agents (Agent tool) and Thrum agents (`thrum send`) are different
34
+ coordination mechanisms. A sub-agent spawned into a worktree where a Thrum agent
35
+ already sits competes for files, identity, and tmux state — the result is
36
+ identity drift, broken nudges, and silent message loss.
37
+
38
+ **How to apply:** Run `thrum team` before spawning any Agent tool call. If a
39
+ worktree shows a registered agent, communicate with it via
40
+ `thrum send --to @<agent_name> --body-file msg.md` instead. Sub-agents are for
41
+ research/explore, code review, and message listeners running in the main repo —
42
+ never for implementation work in another agent's worktree.
43
+
44
+ ## Dispatch via `thrum send` after launch — not via tmux send-keys
45
+
46
+ **Why:** After `thrum tmux launch`, all coordination flows through the inbox +
47
+ daemon nudge: `thrum send` enters the message in the daemon's state, the daemon
48
+ nudges the pane, the agent reads the inbox and starts work. Injecting the prompt
49
+ with `thrum tmux send` or `tmux send-keys` bypasses the inbox entirely, breaks
50
+ the nudge for future messages, and strands the agent without a recorded message.
51
+
52
+ **How to apply:** Correct flow: `thrum tmux launch <name>` → agent auto-primes →
53
+ `thrum send --to @agent_name --body-file prompt.md` (body: work prompt) → daemon
54
+ nudges the pane → agent reads inbox and begins work. Never inject the prompt as
55
+ raw keystrokes.
56
+
57
+ ## Always dispatch sub-agents in the background — never block the coordinator
58
+
59
+ Set `run_in_background: true` on every Agent/Explore call, without exception.
60
+ The coordinator is long-lived and must never block on a result — after
61
+ dispatching, continue with inbox checks, task tracking, or the next dispatch
62
+ draft; slot the result in when notified (even if it's "needed before" the next
63
+ step). Account token cost is irrelevant; preserving coordinator context is the
64
+ optimization.
65
+
66
+ ## Subagent model selection
67
+
68
+ > **Model tiers:** pass an explicit `model:` on every dispatch — `sonnet`
69
+ > (low effort) mechanical, `sonnet` (medium effort) judgment, Opus only on
70
+ > operator-ask or a skill step that names it. See the
71
+ > `choosing-subagent-models` skill for the full policy.
72
+
73
+ ## Check the target's queue before you dispatch (R3)
74
+
75
+ Before dispatching, confirm the agent isn't already loaded: `thrum queue list --agent
76
+ <target>` (message it to confirm if its state is unclear). An empty result does NOT
77
+ mean free — it also shows for an agent that keeps no queue or that you mis-named;
78
+ confirm by message before assigning. `assign` appends to `assigned_to` with no
79
+ duplicate check, so this pre-dispatch read is the only guard against double-loading a
80
+ busy agent. Record the handoff on your own queue with `thrum queue assign <bundle>
81
+ <target>`, then send the real dispatch via `thrum send`.
82
+
83
+ One bundle per epic/branch handed out — keep it reconciled as the work moves
84
+ (`start` → review → merge-gate → torn down), per `using-the-queue`. You RECORD at
85
+ dispatch (here); you CLOSE at a trigger — the moment the branch merges into trunk
86
+ or the last referenced bead closes, `done` + `drop` in that same turn (see
87
+ `coordinator-merging-code` §7 and `using-the-queue`). ADD has a natural trigger and
88
+ gets done; the close has one only if you make the merge/close BE it.
89
+
90
+ ## Bundle adjacent open issues into every dispatch
91
+
92
+ **Why:** Priority order and code locality are INDEPENDENT axes, and sequencing by
93
+ priority alone silently optimizes the wrong one. The expensive part of any task is
94
+ loading the context — the package, the call paths, the invariants. Once an
95
+ implementer has paid that cost, a second bead two files away is nearly free. Ship
96
+ them one at a time to cold implementers and you pay full context load for each,
97
+ while a P0 sits in the queue purely because it sorted into a different row.
98
+
99
+ Most backlogs are far more adjacent than their titles suggest. Bundling collapses
100
+ the queue fast; one-at-a-time dispatch is the wasteful default that feels orderly.
101
+
102
+ **How to apply — the coordinator half:**
103
+
104
+ Before sending ANY dispatch, run an adjacency pass. Delegate it (it is a wide read
105
+ across beads and packages — exactly what should not burn coordinator context):
106
+
107
+ 1. Determine each item's CODE AREA — package, subsystem, files. Derive it from
108
+ `bd show <id>` **plus reading the code**, never from the bead title. Two beads
109
+ with similar titles may live in different packages; two with unrelated titles
110
+ may share a file.
111
+ 2. Find OPEN issues touching those same areas — **including higher-priority ones**.
112
+ A P0 adjacent to a P2 you are dispatching is the whole point of this pass.
113
+ 3. Name the inverse too: which open issues have NO adjacency to this batch. That
114
+ set is what genuinely stays unstaffed, and stating it stops a later reader from
115
+ mistaking an un-surfaced issue for a deliberately parked one.
116
+ 4. **You make the ride-along call.** The sub-agent reports adjacency and evidence;
117
+ it does not rank, prioritize, or decide.
118
+
119
+ Do this at SEQUENCING time, before dispatch messages go out. Afterwards the routing
120
+ is committed and folding an item in costs more than the pass saves.
121
+
122
+ > 🔴 **NEVER run `bd list --all`** while doing this, in any form — `--all --limit N`
123
+ > is STILL unbounded — the limit is discarded. Get ground truth from `bd stats`, bound above that count,
124
+ > and **verify the printed `Total:` is not equal to your limit** — equal means you
125
+ > are at the ceiling and were silently truncated. Put these rules in the sub-agent's
126
+ > brief; it cannot see the damage from where it runs.
127
+
128
+ **How to apply — the orchestrator half (this is where validity gets checked):**
129
+
130
+ Do NOT try to verify the adjacent items are still valid yourself. You are cold, and
131
+ your list goes stale between the pass and the dispatch. **The orchestrator cuts its
132
+ branches from the CURRENT tip and merges forward onto it (never rebases) before
133
+ handoff**, so it is working against today's code — which makes validity checking
134
+ nearly free at exactly the moment it is accurate.
135
+
136
+ So dispatch adjacent items as CANDIDATES and say so explicitly. The orchestrator's
137
+ own skill (`orchestrate`, Phase 1 Step 2b) defines what that word obligates; you do
138
+ not need to restate the procedure in the dispatch, only to mark the items clearly
139
+ and give each one its bead ID.
140
+
141
+ What comes back: still-valid candidates get folded into the warm implementer;
142
+ already-fixed ones return to you as COMPLETED with evidence so **you close the
143
+ bead** — draining the queue with nobody implementing anything; ambiguous ones
144
+ return as questions. Expect a disposition for every candidate, including the
145
+ folded-in ones.
146
+
147
+ **Expect returns, and act on them.** A candidate returned as already-fixed is only
148
+ half-drained until you actually close the bead.
149
+
150
+ ## Prompt construction for implementers
151
+
152
+ **Why:** Implementer agents work better with a structured handoff than a
153
+ free-form request. Inconsistent dispatch produces inconsistent reports and
154
+ re-dispatch overhead.
155
+
156
+ **How to apply:** Every dispatch prompt should include:
157
+
158
+ 1. The epic/task title and bead ID
159
+ 2. One-paragraph scope (what to build, what NOT to build)
160
+ 3. Acceptance criteria as bullets
161
+ 4. The worktree path the work happens in
162
+ 5. An explicit reminder to pass `model:` on any sub-agents the implementer
163
+ spawns (sonnet-low for mechanical, sonnet-medium for judgment)
164
+ 6. Spec/plan paths to read before starting
165
+ 7. **Adjacent candidate beads** from the adjacency pass above, labeled as
166
+ CANDIDATES with their validity explicitly unverified — plus the instruction to
167
+ check them against the merged-forward tip and either fold them in or return
168
+ them as completed
169
+
170
+ ## Execution invariants — carry these in every implementation dispatch
171
+
172
+ **Why:** A plan is a snapshot; trunk moves and reality drifts from it. Sprints
173
+ stall when an implementer treats the plan as ground truth, hits one mismatch, and
174
+ goes quiet.
175
+
176
+ **How to apply:** Put these in every implementation dispatch, and require each
177
+ implementer to propagate them to its own sub-agents:
178
+
179
+ 1. **Branch off current trunk** — cut the work branch from the current tip, never
180
+ the plan's authored-against base.
181
+ 2. **Re-anchor before trusting any line number** — re-run the plan's "verify base"
182
+ diff against the current tip and re-derive every file:line target. A moved
183
+ anchor is expected, not a blocker.
184
+ 3. **Run a spec-intent trace before grinding tasks** — walk every spec requirement
185
+ forward into the plan (PLANNED / NAME-ONLY / ABSENT / PARTIAL) and confirm the
186
+ tasks COMPOSE to the goal. A set of individually-passing tasks that does not
187
+ deliver the intent is a failed sprint that looks green.
188
+ 4. **Step back between increments** — re-check the whole against the intent, not
189
+ task-by-task.
190
+ 5. **Never go quiet on a mismatch** — when the plan diverges from reality, surface
191
+ it up the tree with a proposed adaptation and keep moving. A mismatch is a
192
+ routing event, never a stop.
193
+
194
+ ## Never rename an agent tied to a worktree
195
+
196
+ **Why:** Agent identity is bound to the worktree, not the epic. Re-registering
197
+ `@implementer_api` as `@implementer_billing` mid-flight creates two identity
198
+ files in the same worktree, causing persistent stop-hook misfires and routing
199
+ failures.
200
+
201
+ **How to apply:** Run `thrum team` before assigning new work to confirm the
202
+ existing identity name. Send work to that name. Do not use `thrum quickstart`
203
+ with a new name in a worktree that already has an identity. If you absolutely
204
+ need a fresh identity, kill the existing tmux session and register a new one
205
+ with a different name — do not rename in place.
206
+
207
+ ## Propagate model-selection discipline downward
208
+
209
+ **Why:** Sub-agents inherit the parent model by default. A coordinator on Opus
210
+ that spawns an unspecified sub-agent gets Opus-cost work for tasks that need
211
+ sonnet-low. The same trap repeats inside an implementer's worktree: if the
212
+ implementer doesn't propagate the discipline, their own sub-agents silently
213
+ inherit too. Cost compounds across a session.
214
+
215
+ **How to apply:** Every dispatch prompt should include the model-selection rule
216
+ explicitly: "When you spawn your own sub-agents, pass explicit `model:` —
217
+ `sonnet` (low effort) for mechanical work (lint, tests, find/replace), `sonnet`
218
+ (medium effort) for judgment work (review, complex implementation), `opus`
219
+ only when justified. Default to sonnet over opus." Audit the dispatch prompt before sending.
220
+
221
+ ## The impl-prompt review stamp satisfies pre-dispatch review
222
+
223
+ **Why:** When the planning-skill review loop runs, its final gate reviews the
224
+ implementation prompt against the plan — which IS the pre-dispatch review.
225
+ Re-running a pre-dispatch prose review on a prompt that already passed the loop
226
+ double-reviews the same artifact and wastes a cycle.
227
+
228
+ **How to apply:** At dispatch, grep the impl-prompt for the loop's verdict stamp
229
+ (case-sensitive, literal):
230
+
231
+ ```bash
232
+ # Anchored, NOT -F: `verdict=Ready:Yes-with-residual` satisfies a bare
233
+ # substring match and skips the pre-dispatch review entirely.
234
+ grep -E 'THRUM-REVIEW: stage=prompt verdict=Ready:Yes([[:space:]]|-->|$)' "$PROMPT_FILE" \
235
+ || grep -E 'THRUM-REVIEW: stage=prompt verdict=OVERRIDE([[:space:]]|-->|$)' "$PROMPT_FILE"
236
+ ```
237
+
238
+ - **Stamp present** → the pre-dispatch review is already satisfied; SKIP
239
+ re-running it and dispatch.
240
+ - **Stamp absent** → fall through to the normal pre-dispatch dual review. Do NOT
241
+ block dispatch on the stamp — it is a shortcut that lets you skip a redundant
242
+ review, not a new hard requirement (pre-feature prompts and prompts from other
243
+ flows won't carry it).
244
+
245
+ This is the prose side of the boundary; the post-DONE dual-review (which reviews
246
+ the implementer's CODE, a different artifact) always runs separately. The prompt
247
+ is never reviewed twice. (See `coordinator-running-review-cycles` for the
248
+ post-DONE side.)
249
+
250
+ ## Dispatching to an Orchestrator (Manager-Tier Flow)
251
+
252
+ When the fleet has standing orchestrators and the work is a full plan execution:
253
+
254
+ ### Step 1: Select an orchestrator
255
+
256
+ ```bash
257
+ thrum team # identify free orchestrators
258
+ # Read State.md for each free orchestrator to check affinity:
259
+ cat .thrum/agents/<orchestrator_name>/State.md | head -50
260
+ ```
261
+
262
+ ### Step 2: Send the plan
263
+
264
+ ```bash
265
+ thrum send --to @<orchestrator_name> --stdin <<'EOF'
266
+ Plan assigned: <plan-file-path>
267
+ Summary: <one-line>
268
+ Merge target: <branch>
269
+ Epic count: N
270
+ Invoke /thrum:orchestrate to begin.
271
+ EOF
272
+ ```
273
+
274
+ ### Step 3: Your role during execution
275
+
276
+ - You receive the orchestrator's merge report when all epics complete.
277
+ - Run your merge-approval gate (see Merge Approval Gate in your preamble).
278
+ - Monitor the orchestrator's status updates; escalate to the operator only for
279
+ genuine judgment calls (architectural pivot, scope change, budget concern).
280
+
281
+ ## Project-specific rules (already loaded)
282
+
283
+ Read the shared partial at the absolute path:
284
+ `claude-plugin/commands/_project-rules-protocol.md`
285
+
286
+ If you accumulate a new rule mid-session (the user corrects you), capture it via
287
+ the `coordinator-maintaining-memory` skill — it references the
288
+ `memory-write-discipline` common for the canonical `thrum memory create` shape.