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,153 @@
1
+ ---
2
+ name: coordinator-running-review-cycles
3
+ description: "Use when an implementer reports DONE, when consolidating review findings, when handling implementer pushback on a finding, or when arriving at a review gate. Loads coordinator-specific discipline for running review cycles cleanly."
4
+ ---
5
+
6
+ # Coordinator: Running Review Cycles
7
+
8
+ ## Run code-quality + spec-compliance review in parallel
9
+
10
+ **Why:** Reviewers serve different purposes. `feature-dev:code-reviewer` catches
11
+ security, error-handling, idiom, and dead-code issues. `verify-against-plan`
12
+ catches missing scope, unmet acceptance criteria, and silent deviations from the
13
+ plan. Running them sequentially doubles review-cycle latency for no reason —
14
+ they're independent reads of the same diff.
15
+
16
+ **How to apply:** When an implementer reports DONE on a branch, dispatch both
17
+ reviewers as parallel sub-agents in the same message. Pass each a clear scope
18
+ ("review the diff at <BASE>...<HEAD> for <criteria>").
19
+
20
+ > **Model tiers:** pass an explicit `model:` on every dispatch — `sonnet`
21
+ > (low effort) mechanical, `sonnet` (medium effort) judgment, Opus only on
22
+ > operator-ask or a skill step that names it. See the
23
+ > `choosing-subagent-models` skill for the full policy.
24
+
25
+ ## Wait for both reviewers before sending anything to the implementer
26
+
27
+ **Why:** Sending findings from reviewer A while reviewer B is still running
28
+ causes the implementer to fix batch 1 and miss batch 2 entirely, extending the
29
+ review cycle by a full extra round.
30
+
31
+ **How to apply:** Block until both review sub-agents return their full output.
32
+ Do not send partial findings, even if the user is asking for an update. If one
33
+ reviewer takes substantially longer, the right move is a status update to the
34
+ implementer ("review running, hold"), not a partial batch.
35
+
36
+ ## Consolidate findings into ONE numbered list across all severities
37
+
38
+ **Why:** A single numbered list with mixed severities lets the implementer work
39
+ top-to-bottom without context-switching across "minor batch" and "critical
40
+ batch" calls. Severity labels live next to each finding; ordering is by
41
+ severity, then by file path. Two separate lists invite the implementer to skip
42
+ one.
43
+
44
+ **How to apply:** Merge both reviewers' output. Number sequentially from
45
+
46
+ 1. Each item: `<severity> · <file:line> · <one-line summary>` followed by the
47
+ detail and suggested fix. Keep the numbering stable across review rounds —
48
+ when re-reviewing fixes, refer to "finding #4" and the implementer can locate
49
+ it instantly.
50
+
51
+ ## Verify reviewer claims against actual code before forwarding
52
+
53
+ **Why:** Reviewers reading a large diff sometimes cite wrong line numbers or
54
+ describe behavior that doesn't match the current code. Forwarding a misread
55
+ finding causes the implementer to waste time investigating a non-issue and
56
+ erodes trust in the review process.
57
+
58
+ **How to apply:** For any finding citing a specific file and line, read that
59
+ file at that range before forwarding. For API-shape claims, grep for the symbol
60
+ and read the signature. For behavior claims, trace the call path. Drop or
61
+ correct findings that don't survive verification — silently forwarding wrong
62
+ findings poisons the cycle.
63
+
64
+ ## Treat implementer pushback as a signal to verify, not dismiss
65
+
66
+ **Why:** When an implementer disputes a finding ("you said X, but the actual
67
+ shape is Y — here's the trace"), that is the correct behavior, not
68
+ insubordination. The coordinator may have stated expectations that drift from
69
+ runtime reality. Treating pushback as a challenge breaks the feedback loop and
70
+ trains implementers to swallow corrections.
71
+
72
+ **How to apply:** When an implementer pushes back: read the cited file at the
73
+ cited lines, run the cited command, or `bd show <id>` for beads state. If
74
+ they're right, acknowledge the correction explicitly and update session context.
75
+ If the finding was based on a misread, drop it from the batch and tell them so.
76
+ If you're still right after verification, restate with the new evidence — but
77
+ never just reassert without verification.
78
+
79
+ ## Re-review after fixes land — repeat until both pass
80
+
81
+ **Why:** A single review pass rarely catches everything, and fix commits can
82
+ introduce new regressions. Skipping the re-review accepts an unknown risk that
83
+ scales with diff size.
84
+
85
+ **How to apply:** When the implementer reports fixes complete, re-dispatch both
86
+ reviewers (in parallel) on the new diff. Most of the time, round 2 returns clean
87
+ or with one minor finding. If round 3 still has Critical or Important findings,
88
+ escalate to the user — repeated failure to land fixes signals a deeper scope or
89
+ design issue, not just sloppy review.
90
+
91
+ ## Use structural evidence when a green test is blocked upstream
92
+
93
+ **Why:** A test that cannot run (blocked upstream build, unrelated flake, CI
94
+ environment issue) cannot validate behavior. Saying "no errors seen" is weaker
95
+ than enumerating what a regression would produce and showing none of those
96
+ signatures occurred.
97
+
98
+ **How to apply:** When a green-test check is blocked, prove absence of
99
+ regression by: (1) listing specific failure modes a regression would produce
100
+ (error types, wrong status codes, missing state changes); (2) showing none of
101
+ those modes occurred (wire-level status codes, specific log assertions, expected
102
+ state present); (3) documenting the upstream blocker in a tracking issue so the
103
+ green-test check can be re-run when it clears.
104
+
105
+ ## Run the philosophy merge gate before the actual merge
106
+
107
+ **Why:** Dual review (code-quality + spec-compliance) is general-purpose and
108
+ does not carry the project-specific structural lenses that
109
+ `.thrum/philosophy.md` requires — folding them in as dual-review findings would
110
+ dilute both the general review and the specialized gate.
111
+
112
+ **How to apply:** After dual review passes clean, before running `git merge`,
113
+ invoke `coordinator-philosophy-merge-gate` for any branch that introduces or
114
+ materially changes a service, handler, background job, adapter, or RPC boundary.
115
+ Skip it for small/mechanical fixes. The gate walks all anti-patterns and red
116
+ flags in `.thrum/philosophy.md`, with single-responsibility (SRP) as one lens
117
+ (Lens 10) among the full set — not a separate pass.
118
+
119
+ ## Prose-pre vs code-post: what this review cycle covers
120
+
121
+ **Why:** Once the planning-skill review loop ships, there are two distinct
122
+ review surfaces and conflating them double-reviews one artifact. The planning
123
+ loop reviews PROSE artifacts (brainstorm, plan, impl-prompt) BEFORE
124
+ implementation; the review cycle in THIS skill reviews the implementer's CODE
125
+ AFTER they report DONE. They target different artifacts and both are needed.
126
+
127
+ **How to apply:**
128
+
129
+ - The planning loop's prompt gate already reviewed the impl-prompt; its
130
+ `THRUM-REVIEW: stage=prompt verdict=Ready:Yes` stamp satisfies the
131
+ pre-dispatch review (see `coordinator-dispatching-work`). Do not re-review the
132
+ prompt here.
133
+ - This skill's dual review (code-quality + spec-compliance, in parallel) runs on
134
+ the CODE the implementer produced — the diff on their branch. That always runs
135
+ at DONE regardless of any planning-loop stamps, because the code is a new
136
+ artifact the planning loop never saw.
137
+ - Net: the prompt is reviewed once (in the planning loop, pre-dispatch); the
138
+ code is reviewed once (here, post-DONE). No artifact is reviewed twice.
139
+
140
+ ## See also
141
+
142
+ - `coordinator-branch-split-on-block` — when a Pass-3 gate or this skill's
143
+ dual review BLOCKS on one concern of a branch that bundles multiple
144
+ independent concerns, while the other concern(s) are clean.
145
+
146
+ ## Project-specific rules (already loaded)
147
+
148
+ Read the shared partial at the absolute path:
149
+ `claude-plugin/commands/_project-rules-protocol.md`
150
+
151
+ If you accumulate a new rule mid-session (the user corrects you), capture it via
152
+ the `coordinator-maintaining-memory` skill — it references the
153
+ `memory-write-discipline` common for the canonical `thrum memory create` shape.
@@ -0,0 +1,14 @@
1
+ ---
2
+ name: coordinator-single-responsibility-merge-gate
3
+ description: "DEPRECATED — superseded by `coordinator-philosophy-merge-gate`. Invoke that skill instead. (This stub is retained for backward discoverability; it redirects immediately.)"
4
+ ---
5
+
6
+ # Coordinator: Single-Responsibility Merge Gate (Deprecated)
7
+
8
+ This skill has been superseded by `coordinator-philosophy-merge-gate`, which
9
+ subsumes single-responsibility as one lens (Lens 10, with sub-probes
10
+ 10a/10b/10d) among the full `.thrum/philosophy.md` anti-pattern set.
11
+
12
+ Invoke `coordinator-philosophy-merge-gate` instead. All content from this skill
13
+ — the naming test (10b), the cost gate (10d), and the structural backstop (10a)
14
+ — lives in that skill's Lens 10 section.
@@ -0,0 +1,255 @@
1
+ ---
2
+ name: diagnosing-fleet-and-daemon
3
+ description: "Use when the daemon or fleet looks broken and you need to find something FAST — daemon down, daemon not running, connection refused, dial unix, thrum.sock, socket refused, daemon crashed, daemon wedged, daemon hangs, fleet dark, fleet outage, agents unreachable, can't send, send failed, messages not delivering, no agents responding, daemon status wrong, daemon won't start, restart the daemon, is the daemon alive, where is the daemon log, which log file, searching logs, hooklog query, command log, jq returned nothing, empty log search, agent looks dead, agent stale, last_seen stale, is this agent alive, schema mismatch, cannot downgrade, migration on restart, SIGBUS, WAL poison, 522, database locked. Also use BEFORE restarting any daemon — the pre-restart migration check lives here."
4
+ ---
5
+
6
+ # Diagnosing the Fleet and the Daemon
7
+
8
+ **This is a LOOKUP TABLE, not a procedure.** You are here because something is
9
+ broken and you need an answer in one command. Read the row you need and go.
10
+
11
+ **If you are about to restart a daemon, read § Pre-restart check FIRST.** It is
12
+ the only step here that can cause harm rather than merely waste time.
13
+
14
+ ---
15
+
16
+ ## § Canonical paths — get these wrong and you will report a false zero
17
+
18
+ | What | Where | NOT |
19
+ |---|---|---|
20
+ | **Daemon log** | `.thrum/var/log/daemon.log` | ❌ `.thrum/var/daemon.log` |
21
+ | Hook log | `.thrum/var/log/hooklog.jsonl` | |
22
+ | Command log | `.thrum/var/log/command.jsonl` | |
23
+ | Monitor log | `.thrum/var/log/monitor_log.jsonl` | |
24
+ | Pane-inject log | `.thrum/var/log/inject.jsonl` | |
25
+ | Database | `.thrum/var/messages.db` | |
26
+ | Socket | `.thrum/var/thrum.sock` | |
27
+
28
+ ✅ **`daemon.log` now lives in the `log/` subdirectory, like every other log.**
29
+ This was not always true — an older layout kept it at `.thrum/var/daemon.log`
30
+ directly. **A missing-file error is not a finding — it is a wrong path until
31
+ you have proven the file's absence.** If you are on an old checkout or an
32
+ unmigrated install, check both locations before concluding the file doesn't
33
+ exist.
34
+
35
+ Worktrees redirect `.thrum/` to the main repo via `.thrum/redirect` — read that
36
+ file to find the real path before concluding anything is missing.
37
+
38
+ ---
39
+
40
+ ## § Searching logs — use the primitive, never raw jq
41
+
42
+ ```bash
43
+ thrum log search <logname> <query> [-i] [-n N]
44
+ # logname: command | monitor_log | hooklog | ...
45
+ thrum log search hooklog "thrum daemon start" -n 5
46
+ ```
47
+
48
+ Brute-force line scan of **today's file only**. Older history is in `.gz`
49
+ rotations under `.thrum/var/log/` — unzip and search those directly.
50
+
51
+ 🔴 **DO NOT hand-roll jq against the JSONL.** In `hooklog.jsonl`, `tool_input` is
52
+ a **double-encoded JSON string**, not an object. Every one of these returns a
53
+ clean, well-formed, WRONG empty:
54
+
55
+ ```bash
56
+ jq '.tool_input.command' # empty — tool_input is a string
57
+ jq '.raw_payload | .tool_input.command' # empty — raw_payload is null
58
+ jq 'select(.tool_name=="Bash") | .tool_input.command' # empty — same
59
+ ```
60
+
61
+ The decode that works is `.tool_input | fromjson | .command` — but prefer
62
+ `thrum log search`, which needs no knowledge of the encoding and also matches
63
+ record shapes a `tool_name=="Bash"` filter silently excludes (`PreToolUse` /
64
+ `PostToolUse`).
65
+
66
+ **Whatever you search: if you get zero, run a control** (see § Controls).
67
+
68
+ ---
69
+
70
+ ## § Is the daemon actually down?
71
+
72
+ Ask in this order. **Do not stop at the first answer.**
73
+
74
+ ```bash
75
+ thrum daemon status # may be WRONG during boot — see below
76
+ pgrep -fl "thrum daemon run" # process table
77
+ thrum team | head -3 # BY EFFECT — the real test
78
+ ```
79
+
80
+ 🔴 **`thrum daemon status` reports "not running" during background boot stages.**
81
+ Boot takes roughly **25 seconds**. Checking at 3s and 15s and concluding
82
+ "the status command is lying" is wrong twice over — it is accurate about a
83
+ daemon that is not yet ready. **Wait, then re-ask.** Reach for
84
+ instrument-failure only after the process table and a by-effect test disagree
85
+ with it *at the same moment*.
86
+
87
+ **By-effect beats status.** A successful `thrum team` / `thrum inbox` proves
88
+ service; a status line proves only what status believes.
89
+
90
+ ---
91
+
92
+ ## § Pre-restart check — THE ONE THAT CAN CAUSE HARM
93
+
94
+ **A restart can be a MIGRATING restart. Establish that before you type it.**
95
+
96
+ ```bash
97
+ # What the DB is at now:
98
+ sqlite3 "file:$PWD/.thrum/var/messages.db?mode=ro" \
99
+ "SELECT version FROM schema_version ORDER BY version DESC LIMIT 1;"
100
+ # What binary is installed:
101
+ thrum --version
102
+ ```
103
+
104
+ **Have you CHANGED the binary since the daemon last ran?**
105
+
106
+ - **NO (same binary, e.g. it crashed or was stopped)** → **restart is
107
+ non-migrating. Safe.** The inference: a daemon migrates on start, so if the
108
+ installed binary had wanted a higher schema it would already have taken it.
109
+ A daemon that ran at binary X with the DB at version N proves X wants N.
110
+ - **YES (you upgraded, or ran an install)** → **the restart MAY MIGRATE,
111
+ one-way.** Take a backup first and treat it as its own decision.
112
+
113
+ 🔴 **A migrating restart can trigger a known crash class** — the migration
114
+ rewrites the SQLite `-shm` sidecar, and the same process's next reader can fault
115
+ on the now-stale shared mapping (SIGBUS, or a `SQLITE_IOERR_522` poison storm).
116
+ Before a migrating restart: **take a backup, do it deliberately, and do not let
117
+ it ride along on a decision about something else.**
118
+
119
+ **Migration size is NOT a waiver.** A migration consisting of one `ADD COLUMN`
120
+ plus one `UPDATE` has been observed to trigger this. Do not reason "this upgrade
121
+ is small, so it is safe."
122
+
123
+ > *Dev-fleet note (ignore if you are running a release build): the fix is a
124
+ > boot-seam pool recycle.*
125
+
126
+ ⚠️ Read the DB with `mode=ro`. **Never `immutable=1`** — it reads the stale base
127
+ file past a live `-wal` and answers confidently wrong.
128
+
129
+ ---
130
+
131
+ ## § Did it crash, or was it stopped?
132
+
133
+ ```bash
134
+ grep -icE "SIGBUS|panic:|fatal error|walIndexRecover" .thrum/var/log/daemon.log
135
+ tail -40 .thrum/var/log/daemon.log
136
+ ```
137
+
138
+ - **Hits** → a crash. Capture the trace before restarting.
139
+ - **Zero, and the log simply stops** → it was *stopped*, not crashed. Look for
140
+ who stopped it (§ Who did that) rather than hunting a nonexistent crash.
141
+
142
+ **"No crash evidence" and "I looked in the wrong place" are indistinguishable
143
+ without a control.** Confirm the file exists and is non-empty first.
144
+
145
+ ---
146
+
147
+ ## § Who did that?
148
+
149
+ ```bash
150
+ thrum log search hooklog "daemon stop" -n 10
151
+ thrum log search hooklog "daemon restart" -n 10
152
+ thrum log search hooklog "<the command you're hunting>" -n 10
153
+ ```
154
+
155
+ Read `cwd` on each hit — it identifies the worktree, and therefore the agent.
156
+ **Beware two traps:**
157
+
158
+ 1. **Message bodies match too.** The hooklog stores full `thrum send` payloads,
159
+ so prose *about* a command matches a search *for* that command. Check whether
160
+ the hit is a command or someone talking about one.
161
+ 2. **`thrum daemon start` spawns `thrum daemon run --repo <path>`.** Seeing that
162
+ argv in the process table does **not** mean someone invoked it raw.
163
+
164
+ ---
165
+
166
+ ## § Is this AGENT alive? (different question from the daemon)
167
+
168
+ | Signal | Legitimately supports | NEVER supports |
169
+ |---|---|---|
170
+ | Live tmux pane / ppid chain | **liveness** | |
171
+ | `pid` + `start_time` | age, staleness | ❌ liveness verdict — wrong-DEAD on in-process restart |
172
+ | `last_seen` | age of last **RPC contact** | ❌ liveness — it advances only when the agent calls the daemon |
173
+ | DB row / tombstone / state file | nothing | ❌ liveness — the DB is often the thing that is wrong |
174
+
175
+ 🔴 **`last_seen` is an RPC-activity proxy.** An agent in a long tool run,
176
+ thinking, or sitting at a permission prompt looks identically "stale" to a
177
+ dead one.
178
+
179
+ **Definitive-dead is by DIRECT OBSERVATION only.** Peek the pane.
180
+
181
+ ---
182
+
183
+ ## § Controls — the discipline that makes all of the above trustworthy
184
+
185
+ **Every zero gets a control before you report it.** A control is a second
186
+ instrument, aimed at something you KNOW is present, run the same way.
187
+
188
+ If a must-exist control ALSO returns zero, **your instrument is broken, not your
189
+ hypothesis confirmed.**
190
+
191
+ ---
192
+
193
+ ## § Known-noisy log lines — recognise, don't chase
194
+
195
+ | Line | Meaning |
196
+ |---|---|
197
+ | `sync.apply: M1 relay loop detected … dropped` | Working as designed — loop suppression. |
198
+ | `storagegw: gossip: peer … not connected` | Peer offline. Routine. |
199
+ | `storagegw: gossip: peer call failed … caller-peer lacks required capability` | **NOT routine** — a live capability gap. Worth a bead if sustained. |
200
+ | `dead_agent_sweeper: marked dead agent offline` | Routine sweeper work. |
201
+
202
+ ---
203
+
204
+ ## § Filing a bug report
205
+
206
+ When the answer is "this is a defect in thrum, not in my setup", a report with
207
+ the right artifacts is worth many times one without. **Collect these before you
208
+ write the report** — several are lost or overwritten on the next restart.
209
+
210
+ ```bash
211
+ thrum --version # binary build
212
+ thrum daemon status # or the exact failure text
213
+ sqlite3 "file:$PWD/.thrum/var/messages.db?mode=ro" \
214
+ "SELECT version FROM schema_version ORDER BY version DESC LIMIT 1;"
215
+ tail -200 .thrum/var/log/daemon.log
216
+ grep -icE "SIGBUS|panic:|fatal error" .thrum/var/log/daemon.log
217
+ uname -a # OS + arch
218
+ ```
219
+
220
+ A good report states, in this order:
221
+
222
+ 1. **What you expected and what happened** — the observable symptom, not your
223
+ theory of it.
224
+ 2. **Whether it reproduces**, and the smallest sequence that does it.
225
+ 3. **What changed just before** — an upgrade, an install, a restart, a config
226
+ edit, a migration. Most fleet faults are downstream of a change.
227
+ 4. **Which of your conclusions are MEASURED vs INFERRED.** A report that marks
228
+ its own guesses is far more useful than one that presents them as findings.
229
+ 5. The artifacts above.
230
+
231
+ ⚠️ **Redact before sending.** `daemon.log` and the JSONL logs can contain message
232
+ bodies, file paths, hostnames, agent names, and anything an agent pasted —
233
+ including secrets. Skim what you are attaching. If you cannot skim it all, send
234
+ the version/status/schema lines and the specific error, and offer the full log
235
+ separately.
236
+
237
+ **Do not send the database.** It contains your full message history. If a
238
+ maintainer needs schema state, the `schema_version` query above is what they
239
+ want.
240
+
241
+ ---
242
+
243
+ ## § Contributing back
244
+
245
+ **This skill is shared diagnostic memory. When you find a faster or more correct
246
+ way — or get burned by a path, an encoding, or a command that lies — EDIT THIS
247
+ FILE.** A lookup you had to rediscover is a defect in this page.
248
+
249
+ Rules for edits: add the *command that works*, not a description of the problem;
250
+ name the wrong path or wrong query explicitly, so the next reader recognises
251
+ their own mistake rather than just reading the right answer; and if a claim is
252
+ about runtime behaviour, say how it was measured.
253
+
254
+ > *Dev-fleet only: after editing, run `scripts/sync-skills.sh` so every runtime
255
+ > plugin picks it up.*
@@ -0,0 +1,177 @@
1
+ ---
2
+ name: efficient-multi-agent-research
3
+ description: "Use when investigating, auditing, or reviewing more than 6 items across a codebase - function call sites, pattern usage, file reviews, or any research task with partitionable items that would pollute the main agent's context if read directly"
4
+ ---
5
+
6
+ # Efficient Multi-Agent Research
7
+
8
+ ## Overview
9
+
10
+ When investigating N items (N > 6), reading everything into the main agent's
11
+ context pollutes it and degrades decision-making. Instead, partition the work
12
+ across parallel sub-agents that write findings to disk, then consolidate into a
13
+ single report.
14
+
15
+ **Core principle:** The coordinator decides, sub-agents investigate. Keep
16
+ investigation results out of the main context until consolidated.
17
+
18
+ **REQUIRED BACKGROUND:** Read superpowers:dispatching-parallel-agents before
19
+ using this skill. That skill
20
+ covers general parallel dispatch. This skill extends it with a specific research
21
+ workflow: partition, investigate to disk, consolidate, then decide.
22
+
23
+ ## When to Use
24
+
25
+ **Use when:**
26
+
27
+ - Investigating many call sites of a function (N > 6)
28
+ - Auditing usage of a pattern across a codebase
29
+ - Reviewing multiple files for a common issue
30
+ - Any research task with partitionable items
31
+
32
+ **Don't use when:**
33
+
34
+ - Simple searches (just use Grep/Glob)
35
+ - Tasks with 6 or fewer items (single agent is fine)
36
+ - Deeply interdependent items that can't be partitioned cleanly
37
+
38
+ ## Core Pattern
39
+
40
+ ### Partition > Parallel Investigate > Consolidate > Decide
41
+
42
+ 1. **Create output directory:** `mkdir -p dev-docs/<topic>/` — if re-running,
43
+ archive previous `findings_*.md` to a subdirectory (e.g., `run-01/`) before
44
+ starting so the consolidation glob only picks up current results.
45
+
46
+ 2. **Launch investigation agents** — all in one message, all
47
+ `run_in_background=true`:
48
+
49
+ ```text
50
+ Agent(run_in_background=true,
51
+ prompt="Investigate items A-D. Write to dev-docs/<topic>/findings_1.md
52
+ using table schema: [columns]. Flag uncertainties.")
53
+
54
+ Agent(run_in_background=true,
55
+ prompt="Investigate items E-H. Write to dev-docs/<topic>/findings_2.md ...")
56
+ ```
57
+
58
+ Specify exact table columns and consistent formatting in every prompt.
59
+
60
+ **Every prompt MUST scope the read-only restriction around its own output
61
+ file, in the same breath:** `READ-ONLY EVERYWHERE EXCEPT YOUR OUTPUT FILE —
62
+ do not modify source, tests, config, git state, or the issue tracker; you
63
+ MUST write exactly dev-docs/<topic>/findings_N.md, and that write is
64
+ expected and authorized.` Omitting the exception is the most common cause of
65
+ a fan-out that returns nothing — see Common Mistakes.
66
+
67
+ 3. **Wait** for all background agents to complete.
68
+
69
+ 4. **Launch consolidation agent** — always request these four elements:
70
+
71
+ ```text
72
+ Agent(prompt="Read all dev-docs/<topic>/findings_*.md.
73
+ Create consolidated_report.md with:
74
+ 1. Unified table merging all agent tables
75
+ 2. Cross-cutting patterns across findings
76
+ 3. Summary statistics (e.g., '12/17 need fixes')
77
+ 4. Prioritized recommendations")
78
+ ```
79
+
80
+ 5. **Review only `consolidated_report.md`** — never read individual findings
81
+ files into the main context.
82
+
83
+ ## Quick Reference
84
+
85
+ | Aspect | Guidance |
86
+ | ------------- | --------------------------------------------------------- |
87
+ | Group size | 4-5 items per agent |
88
+ | Agent count | Typically 3-5 |
89
+ | Agent mode | Always `run_in_background=true` |
90
+ | Output | `dev-docs/<topic>/findings_N.md` per agent |
91
+ | Consolidation | Always a dedicated agent writing `consolidated_report.md` |
92
+
93
+ ## Model tiers for this skill
94
+
95
+ See the `choosing-subagent-models` skill for the full policy. Applied to this
96
+ skill's fan-out:
97
+
98
+ - **Level 1 — researchers / gatherers:** scope each one DOWN to a narrow slice
99
+ so you can run MANY in parallel. Use `model: "sonnet"` (low effort) —
100
+ bounded gather-and-report. Smaller scope = cheaper, concurrent (faster),
101
+ tighter per-agent context.
102
+ - **Level 2 / Level 3 — summarizers / synthesizers:** use `model: "sonnet"` —
103
+ aggregating and reconciling Level-1 outputs is judgment work.
104
+
105
+ Prefer many narrow sonnet-low gatherers over one broad subagent. This is the cheap,
106
+ fast default — equivalent parallelism at a fraction of the token cost.
107
+
108
+ ## Common Mistakes
109
+
110
+ **Skipping consolidation** - Reading 4 separate findings files into main context
111
+ defeats the entire purpose. Always launch a consolidation agent.
112
+
113
+ **Groups too large** - More than 5 items per agent gives diminishing returns.
114
+ Partition further.
115
+
116
+ **Using foreground agents** - Blocks the main agent and loses parallelism.
117
+ Always use `run_in_background=true`.
118
+
119
+ **Reading intermediate files** - The main agent should only read the
120
+ consolidated report, never individual findings files.
121
+
122
+ **Not specifying output format** - Agents produce inconsistent formats that are
123
+ hard to consolidate. Specify table columns in every prompt.
124
+
125
+ **Not specifying output file paths** - Agents may write to the working directory
126
+ or not at all. Always include the exact output path in every prompt.
127
+
128
+ **Have sub-agents write their findings file with a Bash heredoc, not the Write
129
+ tool.** The Write tool refuses subagent report files ("Subagents should return
130
+ findings as text, not write report files") regardless of how the brief is worded.
131
+ The filesystem is writable; the tool is what refuses.
132
+
133
+ **Put this in every prompt:**
134
+
135
+ ```text
136
+ READ-ONLY EVERYWHERE EXCEPT YOUR OUTPUT FILE.
137
+ Do not modify source, tests, config, git state, or the issue tracker.
138
+ You MUST write your findings to exactly: dev-docs/<topic>/findings_N.md
139
+ Write it with a Bash heredoc (cat > <path> <<'EOF' ... EOF), NOT the Write tool —
140
+ Write refuses report files. That single write is expected and authorized.
141
+ ```
142
+
143
+ If an agent still returns text instead of a file, persist it yourself verbatim
144
+ and mark the provenance in the file — do not paraphrase.
145
+
146
+ Put the exception in the SAME breath as the restriction, not in a later
147
+ paragraph. An agent that reads "read-only" first and the write instruction
148
+ forty lines later has already formed its posture.
149
+
150
+ ## Example: Auditing 17 Call Sites
151
+
152
+ **Task:** Investigate 17 call sites of `resolveLocalAgentID()`
153
+
154
+ **Partition:** 4 agents (4-5 call sites each, grouped by source file)
155
+
156
+ **Table schema specified in every prompt:**
157
+
158
+ | Line | Command | How ID Is Used | Behavior for 0/1/multiple | Needs Fix? |
159
+ | ---- | ------- | -------------- | ------------------------- | ---------- |
160
+
161
+ **Result:** Main context stayed clean. Consolidation agent identified
162
+ cross-cutting pattern: "8/17 calls use identity for message filtering." Final
163
+ report provided prioritized recommendations.
164
+
165
+ ## Variations
166
+
167
+ | Variant | When | How |
168
+ | ------------- | -------------------------------------- | ------------------------------------------------------------------------- |
169
+ | **Quick** | Items are independent, output is small | Lightweight consolidation: brief merged summary instead of full synthesis |
170
+ | **Deep** | Very large N (50+) | Multi-level: 8 agents > 2 meta-agents > 1 final report |
171
+ | **Iterative** | Need to refine criteria | Run first pass, update prompts based on patterns, re-run |
172
+
173
+ ## See Also
174
+
175
+ - `adversarial-critique` — decision-shaped sister pattern. Use this skill when
176
+ investigating _what's there_ across N>6 items; use `adversarial-critique` when
177
+ deciding _which option wins_ among 2-3 design forks.