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,244 @@
1
+ ---
2
+ name: choosing-subagent-models
3
+ description: "Use when about to launch, spawn, or dispatch a subagent, sub-agent, or parallel agent - including the Agent/Task tool, an Explore agent, fanning out research, or any time you choose a model for a subagent. ALSO fires on every REVIEW dispatch - dispatching a reviewer, a code review, a code-quality review, a spec-compliance review, a dual review, a verify-against-plan or verify-against-source pass, or a merge-gate sub-agent. Reviewer dispatch is the HIGHEST-STAKES judgment-tier spawn and is the one most often done from memory. Enforces the role-based model tiering (opus-low orchestrators, sonnet-medium implementers and reviewers, sonnet-low sub-agents) and cheap parallel fan-out."
4
+ ---
5
+
6
+ # Choosing Subagent Models
7
+
8
+ ## Audit, review, or question? Require a file.
9
+
10
+ **Every subagent you dispatch for an answer must WRITE ITS RESULT TO A FILE
11
+ (e.g. `/tmp/<task>.md`); its reply to you is only a summary. Put this
12
+ in the prompt.**
13
+
14
+ ## Pin every spawn. The floor depends on the agent's ROLE.
15
+
16
+ Every subagent you spawn MUST pass an explicit `model:` (plus effort where the
17
+ runtime supports it). Omitting it runs the subagent on YOUR model (Opus) — the
18
+ single biggest avoidable cost leak in agent work.
19
+
20
+ **Haiku is banned entirely.** There is no
21
+ mechanical-task carve-out anymore — lint runs, grep-and-collect, file maps,
22
+ config edits, and all other "simple" work now dispatch at sonnet-low, not Haiku.
23
+ Never select Haiku on own judgment — use sonnet-low instead.
24
+
25
+ ### Agent tiers
26
+
27
+ Effort tier governs whether an agent does the hard thing or the expedient thing.
28
+ These are the tiers now:
29
+
30
+ | Role | Model / Effort |
31
+ | ---------------------------- | ------------------- |
32
+ | **Orchestrator** | **`opus` / low** |
33
+ | **Implementer** | **`sonnet` / medium** |
34
+ | **Verifier / reviewer** | **`sonnet` / medium** |
35
+ | **Sub-agent** (investigation, grep, mechanical) | **`sonnet` / low** |
36
+
37
+ - **`model: "sonnet"` @ low effort — sub-agents ONLY.** Investigation,
38
+ grep-and-collect, file maps, lint runs, mechanical tasks. This is the floor for
39
+ a *sub-agent*, NOT for an implementer or a reviewer.
40
+ - **`model: "sonnet"` @ MEDIUM effort — implementers, verifiers, reviewers.**
41
+ Not low. A reviewer on low effort is a rubber stamp with extra steps, and
42
+ rubber-stamped reviews are how a merge gate that ran zero tests survived six
43
+ sessions.
44
+ - **`model: "opus"` @ low — orchestrators.** Not selectable for sub-agents —
45
+ set by the operator on the agent's runtime-config.
46
+ - **`model: "opus"` — NOT your call.** Allowed only when (a) the operator
47
+ explicitly asked for a deep review or prose review in this task, or (b) a
48
+ skill you are running prescribes Opus for the specific step you are currently
49
+ executing — NOT for every spawn under that skill. "This research is hard /
50
+ important" is NOT a justification — hard investigation is exactly what Sonnet
51
+ is for.
52
+
53
+ ## Worked examples — LITERAL ARGUMENTS, AND EFFORT IS TOOL-DEPENDENT
54
+
55
+ **Pass `model` AND `effort` on every spawn, whichever mechanism you use.** Syntax
56
+ per mechanism — re-check the schema in front of you rather than restating from
57
+ memory, because it can change:
58
+
59
+ | Mechanism | `model` | `effort` |
60
+ |---|---|---|
61
+ | **Agent tool** | ✅ settable | ✅ **settable — pass it** |
62
+ | **Workflow `agent()`** (opts: label, phase, schema, model, effort, isolation, agentType) | ✅ settable | ✅ settable |
63
+ | **Agent DEFINITION** (`.claude/agents/*.md` / plugin `agents/*.md` frontmatter) | ✅ | ✅ — sets the default for that agent type |
64
+
65
+ **Agent tool — pass `effort` as a literal argument, alongside `model`.**
66
+
67
+ ```python
68
+ Agent(subagent_type="general-purpose", model="sonnet", effort="low",
69
+ description="Code-quality review of <branch>",
70
+ prompt="...")
71
+ ```
72
+
73
+ An agent definition can also carry a default:
74
+
75
+ ```yaml
76
+ # claude-plugin/agents/message-listener.md
77
+ name: message-listener
78
+ model: sonnet
79
+ effort: low
80
+ ```
81
+
82
+ **Workflow `agent()` — effort IS a literal argument. Pass it.**
83
+
84
+ ```javascript
85
+ agent(prompt, { model: "sonnet", effort: "medium" }) // reviewer / implementer
86
+ agent(prompt, { model: "sonnet", effort: "low" }) // mechanical sub-agent
87
+ ```
88
+
89
+ **THE DIRECTIVE, imperative and not a comment: REVIEWERS RUN SONNET AT MEDIUM
90
+ EFFORT.** Pass `effort: "medium"` literally — under Workflow AND under the Agent
91
+ tool. Never dispatch a reviewer "from memory".
92
+
93
+ **AND VERIFY, DO NOT ASSERT:** any claim about what a tool does or does not expose
94
+ must be checked against the schema in front of you.
95
+
96
+ Never select Opus or Haiku on own judgment — use Sonnet, at the floor of
97
+ sonnet-low.
98
+
99
+ ## Fleet model-tiering by runtime/role
100
+
101
+ Different runtimes and roles pin different tiers. Claude tiers are canonical —
102
+ see the Agent tiers table above (orchestrator/implementer/reviewer/sub-agent),
103
+ plus brainstormer → opus-medium and brainstormer's own subagents → sonnet-low
104
+ (except reviewers → sonnet-medium). Other runtimes:
105
+
106
+ | Runtime | Role | Model / effort |
107
+ | ------------ | ---------------------------- | --------------------------------------------------- |
108
+ | OpenCode | default | GLM-5.2 (fine as-is) |
109
+ | Codex | orchestrator / reviewer | gpt-5.5-medium |
110
+ | Codex | implementer | gpt-5.5-low |
111
+ | Cursor-agent | default | composer-2.5 (fine as-is) |
112
+
113
+ ## Pin every spawn explicitly — the floor depends on the ROLE, not the depth
114
+
115
+ Every orchestrator MUST pass an explicit `model:` and `effort:` on EVERY subagent
116
+ it spawns. An unspecified subagent SILENTLY INHERITS THE PARENT'S MODEL — so an
117
+ Opus orchestrator that forgets the pin just spent Opus tokens on a grep.
118
+
119
+ **The floor is set by what the agent DOES, not by how deep it sits** — see the
120
+ Agent tiers table above. This applies recursively: an implementer spawning its
121
+ own helpers pins them by THEIR role, not by copying its own tier down.
122
+
123
+ The check before every spawn: what is this agent's ROLE? Reviewer or implementer?
124
+ sonnet-medium. Pure investigation or mechanical work? sonnet-low. Never leave it
125
+ unspecified.
126
+
127
+ ## Paste the constraint block into the child prompt — the pin is not enough
128
+
129
+ **A model pin is an ARGUMENT and travels by itself. A behavioural constraint is
130
+ PROSE and reaches the child only if you paste it.** Constrain every level: a rule
131
+ that stops at depth 1 is absent where the work happens.
132
+
133
+ **Paste verbatim, including the last line:**
134
+
135
+ ```text
136
+ === CONSTRAINTS — apply to you and anything YOU dispatch (including this line) ===
137
+ - Work SYNCHRONOUSLY. Tests in the FOREGROUND with a bounded `-timeout`.
138
+ - NO POLL LOOPS. Never `until <check>; do sleep N; done`, never
139
+ `while kill -0 $(cat pid)`, never `$( )` in a loop condition — even when a
140
+ tool's own guidance suggests it. It trips a permission modal, and A FROZEN
141
+ PANE EMITS NOTHING, so nobody can tell you are blocked. If you must background
142
+ work, wait for the completion notification.
143
+ - Every sub-agent YOU spawn gets an explicit `model:` — sonnet (low mechanical,
144
+ medium judgment). HAIKU IS BANNED. Opus is never yours.
145
+ - READ-ONLY git outside your own worktree. NEVER `checkout`/`reset`/`restore`/
146
+ `stash`/`clean` in ANY directory — `stash` is one shared stack across all
147
+ worktrees and the shared tree holds live agents' uncommitted state.
148
+ - Pair every zero/empty result with a control that MUST return non-zero.
149
+ ```
150
+
151
+ ⚠️ Never let a child take **"don't ask again"** on a modal — it removes the only
152
+ signal this condition produces.
153
+
154
+ ### Cheap subagents → fan out, don't pile up
155
+
156
+ Because sonnet-low subagents are cheap, prefer MANY small parallel subagents
157
+ over one subagent handed a pile of tasks. When a research or investigation task
158
+ has independent parts, partition it and dispatch the parts in parallel (use the
159
+ `efficient-multi-agent-research` skill) — smaller scopes are cheaper, run
160
+ concurrently (faster), and keep each subagent's context tight. One subagent
161
+ given ten tasks is the anti-pattern.
162
+
163
+ ## ⚠️ The pin-verification command LIES — do not trust it
164
+
165
+ `thrum agent runtime-config get <agent>` reports the **configured** value, not the
166
+ **resolved** one.
167
+
168
+ An implementer ran Opus 4.8 while both the launch flag (`--model sonnet`) and
169
+ `runtime-config get` confirmed sonnet — the check that exists to catch a bad pin
170
+ is itself a false green.
171
+
172
+ This is the same defect class as every other surface that reports a value it never
173
+ observed (`go test -count=0` reporting PASS while running zero tests; a health RPC
174
+ reporting green off a path that cannot fail; `make ci` swallowing a critical CVE with
175
+ a warning).
176
+
177
+ **So: after launching an agent, verify with `thrum tmux capture --format=annotated`
178
+ (or `--format=json` for scripting).** It parses the footer server-side into
179
+ NBSP-free fields — no positional-window guessing, no NBSP grep trap, and the
180
+ header states `ok`/`FAILED` explicitly instead of leaving you to infer a failure
181
+ from empty stdout:
182
+
183
+ ```bash
184
+ thrum tmux capture <agent-name> --format=annotated --lines 12
185
+ # ━━━ CAPTURE ok · agent=<name> · runtime=claude · lines=35 ━━━
186
+ # <pane content, verbatim>
187
+ # ─── FOOTER (parsed, NBSP-normalized) ───
188
+ # Model: Sonnet 5 | Ctx: 478.3k | Ctx Used: 48.0%
189
+ # ━━━ END CAPTURE ━━━
190
+ ```
191
+
192
+ The FOOTER block is simply omitted when no footer resolved — never an empty or
193
+ garbage line to misread. For scripting, `--format=json` gives the same data as a
194
+ typed document: `{"agent","runtime","ok","line_count","footer":{"model","ctx","ctx_used_pct"}|null,"lines":[...]["error"]}`
195
+ (`footer` is `null` when none resolved).
196
+
197
+ ```bash
198
+ thrum tmux capture <agent-name> --format=json | python3 -c \
199
+ 'import json,sys; b=json.load(sys.stdin); print(b["footer"]["model"] if b["footer"] else "NO FOOTER")'
200
+ ```
201
+
202
+ Still check the exit status before trusting either form — a FAILED capture exits
203
+ nonzero and the annotated header says `FAILED`, but don't discard that signal by
204
+ piping straight into something that only inspects stdout.
205
+
206
+ That is the runtime reporting its RESOLVED config, and it is the only check that has
207
+ ever produced a true negative on this defect. If it disagrees with the pin, report it —
208
+ those instances are a real bug and we want them counted.
209
+
210
+ 🔴 **DO NOT substitute "ask the agent what model it is running."** That is a model
211
+ introspecting on its own identity — a categorically weaker instrument.
212
+ **A check built on self-report would be a THIRD instrument that cannot fail in
213
+ the direction we need**, replacing a false green with a confident one. **SETTLED — and the reason is
214
+ categorical, not a reliability judgement: self-report is the WRONG SHAPE for the
215
+ question.** The agent sees exactly ONE value (its resolved model, injected into its own
216
+ system prompt); "does the pin disagree with the resolution?" is a question about a
217
+ RELATION between TWO values. **It cannot report a mismatch however honest it is — the
218
+ disagreement is not representable in what it can observe.** No prompting rescues that.
219
+ Only an outside comparator holding BOTH the pin AND the resolved status line answers it.
220
+ ⚠️ A self-report can look right while reading back an injected assertion, so it
221
+ inherits whatever the injection got right or wrong. **A correct answer there is
222
+ survivorship, not validation.**
223
+
224
+ **Fallback — only if `--format` is unavailable (older binary):** read the bare
225
+ exit status before stdout, then grep the raw pane by position, never by content
226
+ (the raw footer's separators are U+00A0 non-breaking spaces, so `grep "Model: "`
227
+ with a trailing space returns ZERO on a pane that plainly displays a model):
228
+
229
+ ```bash
230
+ out=$(thrum tmux capture <agent-name> --lines 12); rc=$? # bare, NOT through a pipe
231
+ [ $rc -ne 0 ] && echo "CAPTURE FAILED — this is NOT an empty pane" && exit 1
232
+ printf '%s\n' "$out" | grep -v 'tmux capture' | grep 'Model:' | tail -1
233
+ ```
234
+
235
+ 🔴 **PASS `--model` / `--effort` TO BOTH `tmux create` AND `tmux launch`.** They are
236
+ separate cobra commands with separate flags, and **`launch` is what resolves the model**
237
+ (`resolveLaunchSpec` runs in `HandleLaunch`, never in create). `create` persists the pin
238
+ asynchronously, so a create-only pin can lose the race and leave the CLI value empty at
239
+ launch **by construction**.
240
+
241
+ ⚠️ **And any FIX here must be verified with a pin the role default would NOT produce.**
242
+ An implementer pinned to sonnet, with an implementer role-default of sonnet, comes up
243
+ correct whether or not the pin landed — so "pin sonnet, confirm sonnet" passes whether
244
+ or not the fix works.
@@ -0,0 +1,104 @@
1
+ ---
2
+ name: closing-findings-while-warm
3
+ description: "Use whenever you are about to defer a finding, fix, or cleanup instead of doing it now - proposing a follow-up bead/issue/ticket, catching a sibling defect while wrapping up, feeling something is 'out of scope', or wanting to reach DONE faster. Also use on the manager side, when reviewing a completion report that proposes a deferral. Illustrative (non-exhaustive) phrasing that should trigger this - 'I'll file a follow-up', 'filing this as a P2', 'out of scope for now', 'tracked in a new bead', 'we can pick this up later', 'fast-follow', 'separate PR' - but the trigger is the ACT of deferring, not matching one of these exact phrases."
4
+ ---
5
+
6
+ # Closing Findings While Warm
7
+
8
+ ## The defect this skill fixes
9
+
10
+ An implementer mid-fix notices a sibling defect, or a reviewer flags a finding
11
+ during a review cycle. The cheap move is to write it down and move on: file a
12
+ bead, note "P2 fast-follow" in the report, close out DONE. That paper trail
13
+ looks like closure but frequently isn't — the bead never gets created, the
14
+ context that made the fix cheap (the file open, the failure mode fresh in
15
+ mind) is gone by the time anyone looks at it again, and "tracked" quietly
16
+ becomes "dropped."
17
+
18
+ **"A deferral's paper trail is not self-verifying."**
19
+
20
+ ## Role-differentiated resolution
21
+
22
+ The trigger is the same for every role — a finding just surfaced and someone
23
+ is about to defer it. The correct response differs by who is speaking.
24
+
25
+ ### Implementer: surface, don't self-authorize
26
+
27
+ An implementer who notices a finding should **surface it to whoever
28
+ dispatched them, while still warm, with the shape of the fix** — what's
29
+ broken, why, and roughly what the fix looks like. Do NOT go fix it
30
+ unilaterally, and do NOT unilaterally decide it's out of scope and drop it.
31
+
32
+ This is not a failure mode to train out. An implementer proposing a
33
+ follow-up is **correct subordinate behavior** — implementers do not own
34
+ scope, the dispatcher does. The defect this skill targets is never "the
35
+ implementer proposed a deferral instead of just fixing it." Surfacing with
36
+ the fix's shape and stopping there is the right move.
37
+
38
+ ### Manager tier: you make the call, default is fix-now
39
+
40
+ Whoever dispatched the implementer — orchestrator or coordinator, whichever
41
+ tier is currently managing that thread — owns the fix-now-vs-defer decision.
42
+ The default is: **direct the fix now, while the expert is still warm.**
43
+ Re-dispatching later means re-loading context that's about to evaporate, plus
44
+ a second review cycle, plus a live bead to track in the meantime.
45
+
46
+ If you're a manager-tier reader of this skill reaching for "just tell the
47
+ implementer to go fix it themselves" as the resolution here — stop. That
48
+ phrasing is the exact defect this skill was written to close out. An
49
+ implementer does not self-authorize scope expansion; only the dispatcher
50
+ directs it. Writing "just go fix it" without you actually making and owning
51
+ that call is exactly the anti-pattern this design pass amended. It will fail
52
+ review.
53
+
54
+ Only defer when the legitimate-deferral bar below is fully met — and even
55
+ then, the deferral isn't done until its bead is verified to exist.
56
+
57
+ **Recipient duty, not just reporter duty:** before accepting any deferral,
58
+ independently run `bd show <id>` yourself — do not trust the reporter's
59
+ self-attestation that a bead was filed and confirmed. A cited bead ID is not
60
+ evidence until the RECIPIENT, not the reporter, has confirmed it resolves.
61
+
62
+ ## Legitimate-deferral bar (narrow — do not let this become a rubber stamp)
63
+
64
+ A deferral is legitimate only when **all three** hold:
65
+
66
+ **(a) Genuine independence.** The finding touches a genuinely different
67
+ subsystem with no intersection with the current branch's diff, OR the fix is
68
+ blocked on an external dependency (another team's merge, an upstream release,
69
+ a design decision not yet made). "I'd rather not right now" is not
70
+ independence.
71
+
72
+ **(b) Named assignee and a dispatch date.** Not "someone will pick this up" —
73
+ a specific agent or person, and when it will be dispatched. An unowned
74
+ deferral is a deferral to nobody.
75
+
76
+ **(c) The bead exists, verified.** Create the bead, then run `bd show <id>`
77
+ and echo the ID back in your report. A deferral is not closed by the
78
+ intention to file a bead — it is closed by the bead existing and being
79
+ confirmed to exist. "I'll file a follow-up" is a promise; `bd show thrum-xyz`
80
+ returning the issue is evidence.
81
+
82
+ If any of (a)/(b)/(c) is missing, it is not a legitimate deferral — direct
83
+ the fix now instead.
84
+
85
+ ## Worked example: the bead that wasn't there
86
+
87
+ A fix once split off a sibling defect as a "P2 fast-follow"; the report
88
+ claimed a bead was filed and a later snapshot carried that as settled fact,
89
+ but the bead was never created and nobody ran `bd show` to confirm it. The
90
+ paper trail read as closure; it wasn't.
91
+
92
+ This is the failure mode part (c) exists to close: verify existence with the
93
+ tool that can prove it, not by trusting the sentence that claims it.
94
+
95
+ ## Project-specific rules (already loaded)
96
+
97
+ Read the shared partial at the absolute path:
98
+ `claude-plugin/commands/_project-rules-protocol.md`
99
+
100
+ If you accumulate a new rule mid-session (the user corrects you), capture it
101
+ via the `implementer-maintaining-memory` skill (or `coordinator-maintaining-
102
+ memory` if you're operating in a manager tier) — it references the
103
+ `memory-write-discipline` common for the canonical `thrum memory create`
104
+ shape.
@@ -0,0 +1,229 @@
1
+ ---
2
+ name: configure-roles
3
+ description: "Detect environment and generate customized role-based preamble templates for your Thrum agents. Creates .thrum/role_templates/ files that auto-apply on agent registration."
4
+ allowed-tools:
5
+ "Bash(thrum:*), Bash(bd:*), Bash(git:worktree*), Read, Write, Glob,
6
+ AskUserQuestion"
7
+ ---
8
+
9
+ # Configure Roles
10
+
11
+ Generate role-based preamble templates customized to your project environment.
12
+ Templates auto-apply when agents register via `thrum quickstart`.
13
+
14
+ **Announce:** "Using configure-roles to set up preamble templates for your
15
+ team."
16
+
17
+ ## CLI path (AI-free)
18
+
19
+ A plain-CLI alternative now exists for quick, scriptable role setup without
20
+ requiring an AI agent:
21
+
22
+ ```bash
23
+ thrum roles configure --detect # configures all roles from registered identities
24
+ thrum roles deploy # re-renders preambles
25
+ ```
26
+
27
+ This writes **verbatim shipped templates** (faithful ~90% solution, correct for
28
+ the upgrade use case). Use this skill (`/thrum:configure-roles`) for
29
+ environment-tailored templates — injecting project-specific context such as
30
+ `bd` block syntax, MCP guidance, or custom scope wording. The CLI and the skill
31
+ coexist; the skill's output is a superset of the CLI's.
32
+
33
+ ## Interaction Style — MANDATORY
34
+
35
+ Use **`AskUserQuestion` for ALL interactive prompts.** Do not ask "reply with 1,
36
+ 2, or 3" style questions in plain prose. Every choice the user makes goes
37
+ through the structured `AskUserQuestion` UI so answers are unambiguous and
38
+ machine-readable.
39
+
40
+ ## Step 1: Detect Environment
41
+
42
+ Run these commands and collect the output (suppress errors):
43
+
44
+ ```bash
45
+ thrum runtime list 2>/dev/null # Installed runtimes
46
+ git worktree list 2>/dev/null # Worktrees and branches
47
+ bd stats 2>/dev/null # Beads task tracker state
48
+ thrum agent list --context 2>/dev/null # Registered agents
49
+ ls .claude/skills/ 2>/dev/null # Installed Claude skills
50
+ thrum config show 2>/dev/null # Thrum configuration
51
+ ```
52
+
53
+ Also check:
54
+
55
+ - `.claude/settings.json` for MCP servers (context7, etc.)
56
+ - Existing rendered templates in `.thrum/role_templates/`
57
+ - Current saved answers in `.thrum/config.json` under `role_config` (if any)
58
+
59
+ To inspect a shipped reference template, use the CLI shim — never read directly
60
+ from a filesystem path, since the binary may run from any directory:
61
+
62
+ ```bash
63
+ thrum roles templates print coordinator-autonomous
64
+ thrum roles templates print orchestrator # single-variant role
65
+ ```
66
+
67
+ ## Step 2: Report Findings
68
+
69
+ Summarize what you detected:
70
+
71
+ - Runtimes installed
72
+ - Worktrees and branches in use
73
+ - Whether beads is configured
74
+ - Current team composition (agents, roles, modules)
75
+ - Available MCP servers and skills
76
+ - Existing role templates (if re-running)
77
+ - Existing `role_config` in `.thrum/config.json` (if re-running)
78
+
79
+ ## Step 3: Check for Existing Configuration
80
+
81
+ ```bash
82
+ ls .thrum/role_templates/ 2>/dev/null
83
+ thrum config show 2>/dev/null | jq '.role_config' 2>/dev/null
84
+ ```
85
+
86
+ If `role_config` exists, prefill each AskUserQuestion with the saved value (see
87
+ "Re-run Behavior" below) so the user only has to confirm rather than re-enter
88
+ every choice.
89
+
90
+ ## Step 4: Ask Questions
91
+
92
+ Ask these in sequence using `AskUserQuestion`. Each call should accept exactly
93
+ one answer and surface the available choices structurally.
94
+
95
+ ### 4a: Team Structure
96
+
97
+ Question: "What roles does your team need?"
98
+
99
+ Options based on detected agents, plus common defaults:
100
+
101
+ - coordinator, implementer (most common)
102
+ - coordinator, implementer, planner, researcher
103
+ - coordinator, implementer, reviewer, tester
104
+ - Custom set
105
+
106
+ Available roles (all have strict and autonomous variants except `orchestrator`,
107
+ which is single-variant):
108
+
109
+ | Role | Purpose |
110
+ | ------------ | ---------------------------------------------------- |
111
+ | coordinator | Orchestrates team, dispatches tasks, reviews/merges |
112
+ | implementer | Writes code in assigned worktree |
113
+ | planner | Creates plans, designs architecture, writes specs |
114
+ | researcher | Investigates codebases, produces research reports |
115
+ | reviewer | Reviews code for quality, security, correctness |
116
+ | tester | Writes and runs tests, verifies acceptance criteria |
117
+ | deployer | Handles builds, releases, deployment operations |
118
+ | documenter | Creates and maintains documentation |
119
+ | monitor | Watches system health, reports anomalies |
120
+ | orchestrator | Drives plan execution across agents (single-variant) |
121
+
122
+ ### 4b: Autonomy Level Per Role
123
+
124
+ For each role selected (except `orchestrator`), call `AskUserQuestion`: "What
125
+ autonomy level for the {role} role?"
126
+
127
+ - **Strict** — waits for coordinator instruction, limited scope
128
+ - **Autonomous** — can self-assign tasks, broader scope
129
+
130
+ ### 4c: Scope Rules
131
+
132
+ If multiple worktrees detected, ask via `AskUserQuestion`: "Should agents be
133
+ restricted to their own worktree?"
134
+
135
+ - **single_worktree** — strict scope boundaries
136
+ - **cross_worktree** — can read across worktrees
137
+
138
+ ## Step 5: Generate Templates
139
+
140
+ For each role:
141
+
142
+ 1. Read the shipped reference via the CLI shim:
143
+
144
+ ```bash
145
+ thrum roles templates print {role}-{autonomy}
146
+ ```
147
+
148
+ For `orchestrator`, omit the autonomy suffix (single-variant):
149
+
150
+ ```bash
151
+ thrum roles templates print orchestrator
152
+ ```
153
+
154
+ 2. Customize based on environment detection:
155
+ - If beads detected: include `bd` commands in Task Tracking section
156
+ - If MCP servers detected: add to Efficiency section
157
+ - If specific skills detected: reference them
158
+ - If worktree restrictions: adjust Scope Boundaries
159
+
160
+ 3. Write to `.thrum/role_templates/{role}.md`. Keep per-agent template tokens
161
+ (`{{.AgentName}}`, `{{.Module}}`, `{{.WorktreePath}}`,
162
+ `{{.CoordinatorName}}`, `{{.RepoRoot}}`) **literal** — they get substituted
163
+ per-agent at deploy time, not at template-write time.
164
+
165
+ ## Step 5b: Persist Answers
166
+
167
+ After writing the templates, persist the user's answers so other code paths
168
+ respect their choices and drift detection can flag plugin upgrades:
169
+
170
+ ```bash
171
+ cat <<'EOF' | thrum roles save-config
172
+ {
173
+ "schema_version": 1,
174
+ "roles": {
175
+ "coordinator": {"autonomy": "{{coord_autonomy}}", "scope": "{{coord_scope}}"},
176
+ "implementer": {"autonomy": "{{impl_autonomy}}", "scope": "{{impl_scope}}"}
177
+ }
178
+ }
179
+ EOF
180
+ ```
181
+
182
+ `thrum roles save-config` writes `role_config` into `.thrum/config.json`, fills
183
+ `schema_version` / `plugin_version` / `configured_at` with sensible defaults if
184
+ absent, and backfills `rendered_hash` per role from the current shipped body
185
+ hash so `thrum prime` shows no drift hints.
186
+
187
+ The save is atomic and preserves every other top-level config key
188
+ (backup/daemon/identity/telegram) byte-identical.
189
+
190
+ ## Step 6: Offer Deploy
191
+
192
+ If agents are already registered, ask via `AskUserQuestion` whether to deploy
193
+ now:
194
+
195
+ ```bash
196
+ thrum roles deploy --dry-run # Preview
197
+ thrum roles deploy # Apply to all agents
198
+ ```
199
+
200
+ ## Re-run Behavior
201
+
202
+ When `role_config` exists in `.thrum/config.json` (the canonical record), load
203
+ the saved answers and use them as the **prefilled values** for each
204
+ `AskUserQuestion` call so the user only has to re-confirm rather than re-enter
205
+ every choice:
206
+
207
+ 1. Show existing roles with their saved autonomy and scope.
208
+ 2. Ask via `AskUserQuestion` what to change: add a role, modify an existing
209
+ role, or remove one.
210
+ 3. Only regenerate requested templates.
211
+ 4. Always re-run `thrum roles save-config` so `rendered_hash` is refreshed and
212
+ the saved `plugin_version` / `configured_at` reflect the current run.
213
+ 5. Offer deploy for changes.
214
+
215
+ If the user wants to apply only template-content updates after a plugin upgrade
216
+ (no answer changes), point them at `thrum roles refresh` — it regenerates
217
+ rendered files from saved answers without asking any questions.
218
+
219
+ ## Environment-Specific Customizations
220
+
221
+ | Detected | Template Customization |
222
+ | -------------------- | -------------------------------------------------------- |
223
+ | Claude Code runtime | Add Task tool + sub-agent guidance to Efficiency section |
224
+ | Augment runtime | Add Augment-specific tool guidance to Efficiency section |
225
+ | Beads installed | Add `bd` commands to Task Tracking, disable TodoWrite |
226
+ | Thrum MCP server | Add MCP tool references, CLI fallback for sub-agents |
227
+ | Claude plugin skills | List installed skills with usage guidance |
228
+ | Context7 MCP | Add library docs guidance to Efficiency section |
229
+ | Multiple worktrees | Add worktree scope rules to Scope Boundaries |