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,100 @@
1
+ ---
2
+ name: researcher-answering-queries
3
+ description: "Use when another agent has asked you a research question, when fielding a research request, or when responding to a query. Loads the lookup-and-respond protocol so cached findings get reused before fresh investigation starts."
4
+ ---
5
+
6
+ # Researcher: Answering Queries
7
+
8
+ ## Reconcile your queue first
9
+
10
+ Lift this query into a bundle (`thrum queue add --from-message <msg-id>`),
11
+ then `thrum queue start <bundle-id>`; drop/close finished bundles. Full
12
+ lifecycle: `using-the-queue`.
13
+
14
+ ## Lookup order: index → thrum memory → staleness check → respond
15
+
16
+ **Why:** A query that's already been answered shouldn't trigger a fresh
17
+ investigation. The cached `research_note` entries (tagged `research-<slug>`)
18
+ exist precisely so repeat questions resolve cheaply. Skipping the cache and
19
+ re-investigating duplicates effort, burns context, and introduces drift between
20
+ the cached entry and the new answer.
21
+
22
+ **How to apply:** When a query lands, work the steps in order:
23
+
24
+ 1. **Index check.** Read `.thrum/context/research.md`. Does any Tracked Topic
25
+ line look relevant? Note the `research-<slug>` tag handles.
26
+ 2. **Content fetch.** For each candidate slug, escalate zoom per the shared
27
+ 3-step read pattern (`memory-read-discipline`): `thrum memory search --tag
28
+ research-<slug>` returns the matching entry IDs; triage with
29
+ `thrum memory show <id> --zoom short` before fetching the full body with
30
+ `thrum memory show <id> --zoom full`.
31
+ 3. **Staleness check.** Use the protocol from `researcher-maintaining-memory`:
32
+ `git diff --name-only <stamp-sha> HEAD` filtered by the entry's cited paths.
33
+ If empty, the entry stands. If any cited path appears, re-verify (re-read the
34
+ cited code, refresh the footer with `Verified: <today> @ <new-sha>`) before
35
+ responding.
36
+ 4. **Respond.** With the certainty level from the section below.
37
+
38
+ If the index has no relevant entry, the query is fresh-investigation territory —
39
+ invoke the `researcher-investigating` skill's discipline instead.
40
+
41
+ ## Structure responses by certainty level
42
+
43
+ **Why:** A response that conflates "I just verified this against HEAD" with "I'm
44
+ pulling this from a stale cached entry" misleads the requester into trusting
45
+ outdated state. Calibrated certainty lets the requester decide whether to act
46
+ now or ask for re-verification.
47
+
48
+ **How to apply:** Three response shapes:
49
+
50
+ - **Verified now.** "<answer>. Verified at HEAD `<sha>`: <evidence>." Use after
51
+ a fresh investigation or a successful staleness re-verify.
52
+ - **Cached + stamp.** "<answer>. Cached entry `research-<slug>`, Verified
53
+ `<date>` @ `<stamp-sha>`. Cited paths unchanged in
54
+ `git diff <stamp-sha>..HEAD`." Use when the staleness check returns empty.
55
+ - **Unknown / partial.** "I don't have a verified answer for X. The closest
56
+ cached entry is `research-<slug>` (last verified <date>) but it doesn't fully
57
+ cover the question. Want me to investigate?" Use when no entry covers the
58
+ question, or the cached entry only partially addresses it.
59
+
60
+ Don't fudge by saying "Yes" without a level qualifier. The qualifier costs five
61
+ words; the cost of silently propagating stale state is real.
62
+
63
+ ## Point at the slug for follow-up — don't dump the whole entry inline
64
+
65
+ **Why:** A long cached entry quoted inline burns tokens and clutters the
66
+ requester's context. The slug is the durable handle; the requester can
67
+ `thrum memory search --tag research-<slug>` + `thrum memory show <id>`
68
+ themselves if they want the full body.
69
+
70
+ **How to apply:** In the response, cite the slug (`research-<slug>`) and a
71
+ one-paragraph summary (or the specific sub-fact the requester asked for). If the
72
+ requester needs more, they fetch via `thrum memory search --tag research-<slug>`
73
+ → `thrum memory show <id>`. Reserve full quotes for short entries (<5 lines)
74
+ where inlining is genuinely cheaper than the round-trip.
75
+
76
+ ## Project-specific rules (already loaded)
77
+
78
+ Read the shared partial at the absolute path:
79
+ `claude-plugin/commands/_project-rules-protocol.md`
80
+
81
+ If you accumulate a new rule mid-session (the user corrects you), capture it via
82
+ the `researcher-maintaining-memory` skill — it references the
83
+ `memory-write-discipline` common for the canonical `thrum memory create` shape.
84
+
85
+ ## Pattern D self-write — set `agent_status=idle` on response/DONE
86
+
87
+ When reporting a research finding back to the requester (or closing a DONE on a
88
+ research task), write `agent_status="idle"` to your local identity file. This
89
+ closes the `working→idle` transition opened by the ACK protocol in the sibling
90
+ skill `researcher-investigating`.
91
+
92
+ ```bash
93
+ # Step 1: Report finding back to requester
94
+ thrum send --to @<requester> --stdin <<'EOF'
95
+ Research <task-id>: <finding>. Evidence: <file:line refs>.
96
+ EOF
97
+
98
+ # Step 2: Mark yourself idle (RPC-preferred; local-write fallback if daemon is unreachable)
99
+ thrum agent set-status idle
100
+ ```
@@ -0,0 +1,152 @@
1
+ ---
2
+ name: researcher-investigating
3
+ description: "Use when investigating, exploring code, working on a research task, when asked to find me X, or to investigate Y. Loads researcher-specific discipline for running an investigation cleanly."
4
+ ---
5
+
6
+ # Researcher: Investigating
7
+
8
+ ## Reconcile your queue first
9
+
10
+ Lift this query into a bundle (`thrum queue add --from-message <msg-id>`),
11
+ then `thrum queue start <bundle-id>`; drop/close finished bundles. Full
12
+ lifecycle: `using-the-queue`.
13
+
14
+ ## Use Explore sub-agents for breadth-first searches
15
+
16
+ **Why:** Reading 10 files into your main context to "understand the
17
+ architecture" is the Context Hog trap. Sub-agents partition the search across
18
+ multiple conversations that each report a focused finding back — the
19
+ investigation gets done without polluting your context with raw file contents.
20
+
21
+ **How to apply:** When the question is "how does X work" or "what calls Y",
22
+ spawn an `Explore` sub-agent with a clear partition: a specific directory, a
23
+ specific symbol, or a specific question. Get a focused report back. For research
24
+ across N > 6 items, invoke `efficient-multi-agent-research` instead of bespoke
25
+ dispatch — it handles partition + parallelization + consolidation.
26
+
27
+ > **Model tiers:** pass an explicit `model:` on every dispatch — `sonnet`
28
+ > (low effort) mechanical, `sonnet` (medium effort) judgment, Opus only on
29
+ > operator-ask or a skill step that names it. See the
30
+ > `choosing-subagent-models` skill for the full policy.
31
+
32
+ ### Prefer `efficient-multi-agent-research` for multi-part research
33
+
34
+ When a research or investigation task has independent parts, reach for the
35
+ `efficient-multi-agent-research` skill FIRST — it partitions the work across
36
+ many cheap parallel subagents (sonnet-low gatherers, sonnet-medium synthesizers) instead of
37
+ one expensive serial subagent. It is the preferred research path: cheaper,
38
+ faster, and it keeps each subagent's context tight.
39
+
40
+ ## Verify the actual state — don't answer from recall
41
+
42
+ **Why:** Reporting from memory of past panes, files, or commits produces
43
+ over-claimed findings. The preamble carries the invariant; this rule carries the
44
+ operational depth — the specific commands to run before trusting any state
45
+ claim.
46
+
47
+ **How to apply:**
48
+
49
+ - **Pane state.** Run `tmux capture-pane -p -t <pane>` (or the runtime
50
+ equivalent) before reporting "the pane shows X" / "the prompt fired".
51
+ - **Code state.** Use the Read tool or `git show HEAD:<path>` before reporting
52
+ "function Y is at line Z" or "file X handles case W".
53
+ - **Beads state.** Run `bd show <id>` before reporting "task is in_progress" /
54
+ "issue is closed" — your remembered idea of the state may be stale.
55
+
56
+ If you can't verify, say so explicitly: "I believe X based on <evidence>; I have
57
+ not verified Y."
58
+
59
+ ## Scope queries before deep-diving — return early when unclear
60
+
61
+ **Why:** A vague request ("investigate the auth flow") burns hours investigating
62
+ dimensions the requester didn't actually care about. Returning early with a
63
+ clarifying question is faster overall — even if it adds five minutes of
64
+ round-trip latency, it prevents three hours of wrong-direction work.
65
+
66
+ **How to apply:** Read the dispatch and the linked spec/plan first. If the scope
67
+ is ambiguous (multiple plausible interpretations, contradictory documents, no
68
+ clear acceptance signal), reply with NEEDS_CONTEXT and one specific narrowing
69
+ question. Don't guess. Don't investigate "what they probably meant" in parallel.
70
+
71
+ ## Persist findings via `thrum memory create` with a verification footer
72
+
73
+ **Why:** A finding sent only as a Thrum message is ephemeral — the coordinator
74
+ may acknowledge and move on, and the next session has to re-investigate.
75
+ Persisting as a `research_note` memory makes findings recoverable across
76
+ sessions and re-readable by other agents.
77
+
78
+ **How to apply:** After reporting to the requester, write the finding as a
79
+ `research_note` memory with cited file:line refs and a verification footer. Tag
80
+ with a `research-<slug>` handle so other agents can find it later via
81
+ `thrum memory search --tag research-<slug>`:
82
+
83
+ ```bash
84
+ cat > /tmp/research-note-body.md <<EOF
85
+ <prose explanation with cited file:line refs>
86
+
87
+ Verified: $(date +%Y-%m-%d) @ $(git rev-parse HEAD)
88
+ EOF
89
+ thrum memory create --kind research_note --scope role \
90
+ --title "<finding prose, ~80 char soft limit>" \
91
+ --tag research-<slug> \
92
+ --oneline "<one-line summary>" \
93
+ --full "@/tmp/research-note-body.md"
94
+ ```
95
+
96
+ `--full` here is multi-line prose — compose via heredoc or a captured
97
+ variable, never double-quoted inline like this; see your role preamble's 🔴
98
+ PROSE INTO A COMMAND rule.
99
+
100
+ Then add one line to `.thrum/context/research.md` under Tracked Topics (note: `thrum queue` now supersedes free-text Open Questions tracking):
101
+
102
+ ```markdown
103
+ - `research-<slug>` — <one-line description, ≤ 80 chars>
104
+ ```
105
+
106
+ The full index format and staleness-check protocol live in
107
+ `researcher-maintaining-memory`.
108
+
109
+ ## Never implement findings — return them to the requester
110
+
111
+ **Why:** Your job ends when you have a finding. Implementing the fix expands
112
+ scope, dirties the worktree, and conflicts with the role boundary that keeps the
113
+ team coherent.
114
+
115
+ **How to apply:** When investigation surfaces a bug:
116
+
117
+ 1. Reproduce + cite the file:line evidence
118
+ 2. File a beads issue with title, description, repro steps
119
+ 3. Send a one-paragraph summary to the coordinator with the bd ID
120
+ 4. Stop. Do not write the fix unless the coordinator explicitly asks.
121
+
122
+ The same applies for refactor opportunities, missing tests, or documentation
123
+ gaps — you surface them, the implementer ships them.
124
+
125
+ ## Project-specific rules (already loaded)
126
+
127
+ Read the shared partial at the absolute path:
128
+ `claude-plugin/commands/_project-rules-protocol.md`
129
+
130
+ If you accumulate a new rule mid-session (the user corrects you), capture it via
131
+ the `researcher-maintaining-memory` skill — it references the
132
+ `memory-write-discipline` common for the canonical `thrum memory create` shape.
133
+
134
+ ## Pattern D self-write — set `agent_status=working` on dispatch ACK
135
+
136
+ Immediately after sending the dispatch ACK for a research request, write
137
+ `agent_status="working"` to your local identity file. This is the same Pattern D
138
+ self-write used by the implementer's dispatch-ACK protocol (sibling skill
139
+ `implementer-receiving-dispatch`).
140
+
141
+ ```bash
142
+ # Step 1: ACK within 2 minutes of receiving a research dispatch
143
+ thrum reply <MSG_ID> --stdin <<'EOF'
144
+ Received. Starting <scope>. ETA <rough>.
145
+ EOF
146
+
147
+ # Step 2: Mark yourself working (RPC-preferred; local-write fallback if daemon is unreachable)
148
+ thrum agent set-status working
149
+ ```
150
+
151
+ The companion `set-status idle` call lives in `researcher-answering-queries` for
152
+ the response/DONE side.
@@ -0,0 +1,176 @@
1
+ ---
2
+ name: researcher-maintaining-memory
3
+ description: "Use after completing research, when updating research memory, when verifying entries, or when working with the research index. Loads researcher-specific discipline — the index file structure, cite-stamp protocol, staleness check via git diff, namespace conventions. References common memory skills for write/read/maintain basics."
4
+ ---
5
+
6
+ # Researcher memory discipline
7
+
8
+ You are the researcher. You write research findings, role-rules, and curate the
9
+ project-local research index. Common memory operations (write command shape,
10
+ body conventions, lookup patterns, edit/delete protocol) live in the common
11
+ memory skills — invoke them when you need the basics. THIS skill carries
12
+ researcher-specific extensions only.
13
+
14
+ ## When to invoke the commons
15
+
16
+ | Situation | Skill to invoke |
17
+ | --------------------------------------------------------------------------------- | ------------------------- |
18
+ | Drafting a new research note or role-rule | `memory-write-discipline` |
19
+ | Loading role-rules at session start, finding a topic, looking up a specific entry | `memory-read-discipline` |
20
+ | Editing, deleting, or superseding an entry; reviewing history | `memory-maintenance` |
21
+
22
+ ## The research index file
23
+
24
+ You curate **one hand-written artifact**: `.thrum/context/research.md` — a thin
25
+ index over the topics + open questions in this repo's research landscape.
26
+
27
+ **Canonical sections (required minimum):**
28
+
29
+ ### Repo Map
30
+
31
+ Your mental model of code-area boundaries — which packages do what, which files
32
+ are gateways into a subsystem, which conventions live where. This is researcher
33
+ synthesis that does NOT fit a memory-entry shape.
34
+
35
+ Example:
36
+
37
+ ```text
38
+ - internal/daemon/ — daemon server (RPC handlers, websocket, unix socket)
39
+ - internal/daemon/rpc/ — RPC handler files (one per logical surface)
40
+ - internal/sync/ — Tailscale-based sync across clones
41
+ - internal/memory/ — v0.11 memory substrate (model, projection, embed)
42
+ - ui/packages/web-app/ — React SPA (single page; routing in components/)
43
+ ```
44
+
45
+ ### Open Questions
46
+
47
+ > `thrum queue` now supersedes this free-text list for tracking open investigation threads — keep entries here only for historical context.
48
+
49
+ Researcher TODOs / things-to-investigate that haven't been resolved into
50
+ findings yet. Each line ≤120 chars; cite a file area or epic if relevant.
51
+
52
+ Example:
53
+
54
+ ```text
55
+ - Is the embedding adapter wired post-<epic>? (check internal/memory/embed/adapter_ollama.go)
56
+ - thrum-abc monitor reliability follow-up still has 4 child bugs open
57
+ - Open: does --scope role on memory.create auto-infer the role, or does it require explicit value?
58
+ ```
59
+
60
+ **Researcher-extensible sections (optional):** Beyond Repo Map + Open Questions,
61
+ you may add other sections that fit your workflow — e.g., a "Pending
62
+ Verifications" list, a "Cross-Repo Notes" section, a debugging-log scratchpad.
63
+ Frame the file as YOUR working artifact; don't constrain it to a fixed schema.
64
+
65
+ **What does NOT belong in the index:** A "Tracked Topics" mirror of memory
66
+ entries. The CLI owns enumeration:
67
+
68
+ ```bash
69
+ thrum memory list --kind research_note --scope role # the live, drift-free topic list
70
+ ```
71
+
72
+ Use this instead of maintaining a parallel index of research notes in the
73
+ markdown file.
74
+
75
+ ## Verification-stamp footer for research notes
76
+
77
+ Every research note (`kind: research_note`) ends with a Verified-stamp footer:
78
+
79
+ ```text
80
+ Verified: YYYY-MM-DD @ <commit-sha>
81
+ ```
82
+
83
+ The SHA is `git rev-parse HEAD` at verification time. This stamp enables
84
+ structural staleness review (next section).
85
+
86
+ When authoring a new research note via `thrum memory create`, include the stamp
87
+ at the bottom of `--full` body content. When re-verifying an existing note, edit
88
+ the entry to update the stamp:
89
+
90
+ ```bash
91
+ cat > /tmp/memory-verify-body.md <<EOF
92
+ <verified body with updated 'Verified: ... @ <new-sha>' footer>
93
+ EOF
94
+ thrum memory edit <id> --full "@/tmp/memory-verify-body.md"
95
+ ```
96
+
97
+ ## Staleness check via git diff
98
+
99
+ For research notes that cite specific files, structural staleness review filters
100
+ the cited paths against changes since the last Verified-stamp. Pulling the note
101
+ follows the shared 3-step zoom escalation (`memory-read-discipline`): triage
102
+ short before paying for the full body.
103
+
104
+ ```bash
105
+ # 1/2. Triage — confirm this is the right entry before pulling full content
106
+ thrum memory show <id> --zoom short
107
+
108
+ # 3. Fetch full body only once confirmed
109
+ thrum memory show <id> --format json --zoom full | jq -r '.body_full' > /tmp/note.txt
110
+
111
+ # Extract the Verified SHA
112
+ STAMP_SHA=$(grep -oE 'Verified: [0-9]{4}-[0-9]{2}-[0-9]{2} @ ([a-f0-9]+)' /tmp/note.txt | awk '{print $NF}')
113
+
114
+ # Extract cited paths (rough — depends on how your note cites)
115
+ CITED=$(grep -oE '[a-zA-Z_/-]+\.go|[a-zA-Z_/-]+\.md' /tmp/note.txt | sort -u)
116
+
117
+ # Diff cited paths since the stamp
118
+ git diff --name-only "$STAMP_SHA" HEAD -- $CITED
119
+ # If any output: paths have changed; re-verify the note before relying on it.
120
+ ```
121
+
122
+ A non-empty diff signals possible staleness. Re-read the note's claims against
123
+ the changed code; either update + re-stamp (the note's claims still hold) or
124
+ amend / supersede the note (the claims have drifted).
125
+
126
+ ## Namespace conventions for research_note entries
127
+
128
+ When authoring research notes, use `--tag <slug>` where `<slug>` is kebab-case
129
+ keywords describing the topic. The title is free-form prose; the slug-style
130
+ handle lives in tags.
131
+
132
+ **User captures:** `--tag <slug>` (just the slug; no prefix needed).
133
+
134
+ **Module installs (forward-compatibility — module tooling is not in v1, but the
135
+ segment is reserved):** `--tag mod-<module-name> --tag <slug>` to avoid
136
+ clobbering user-authored entries with the same slug.
137
+
138
+ The legacy `research-<slug>` and `research-mod-<module>-<slug>` bd-key
139
+ conventions are retired. Migrated entries carry the original bd-key as title
140
+ + `--tag migrated-from-bd:<bd-key>` as the rollback handle.
141
+
142
+ ## Role-rule writes (researcher-specific)
143
+
144
+ When the user corrects your behavior mid-session, capture a researcher-rule:
145
+
146
+ ```bash
147
+ cat > /tmp/role-rule-body.md <<'EOF'
148
+ <rule>
149
+
150
+ Why: <reason>
151
+ How to apply: <when/where>
152
+ EOF
153
+ thrum memory create --kind agent_rule --scope role \
154
+ --title "<short rule prose>" \
155
+ --oneline "<rule one-liner>" \
156
+ --short "@/tmp/role-rule-body.md" \
157
+ --tag <slug>
158
+ ```
159
+
160
+ `--short`/`--full` carry real prose — compose via heredoc or file, never
161
+ double-quoted inline; see your role preamble's 🔴 PROSE INTO A COMMAND rule.
162
+
163
+ This is the SAME pattern as coordinator/implementer role-rule writes — see
164
+ `memory-write-discipline` for the canonical shape.
165
+
166
+ ## Removal protocol
167
+
168
+ To retire a research note:
169
+
170
+ ```bash
171
+ thrum memory delete <id>
172
+ ```
173
+
174
+ (See `memory-maintenance` for hard-purge semantics if needed.) If the deleted
175
+ note had its slug or topic referenced in your `.thrum/context/research.md` Open
176
+ Questions, update that file by hand — the index file is yours to maintain.
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: state-migration
3
+ description: "Use when your agent-local thrum state is empty AND you have an existing State.md file in your agent directory - this is a ONE-TIME conditional onboarding that fires only on that exact combination. Do NOT use if thrum state already has entries (nothing to migrate) or if you have no State.md (brand-new agent, nothing to migrate). Triggers on: first session after the thrum state redesign lands, `thrum state list` returning empty while State.md exists on disk, being asked to migrate your personal state."
4
+ ---
5
+
6
+ # Migrating personal State.md into `thrum state`
7
+
8
+ This is a conditional, one-time onboarding — modeled on the philosophy-
9
+ document onboarding pattern. It does nothing if either half of its trigger
10
+ condition is false.
11
+
12
+ ## When this fires
13
+
14
+ - `thrum state list` returns **empty** for your agent AND
15
+ - a `State.md` file exists in your agent directory (readable via
16
+ `substrate.read_folder` or a direct file read, per your runtime).
17
+
18
+ If `thrum state list` already has entries: **stop, nothing to migrate.**
19
+ If no `State.md` exists: **stop, you're a brand-new agent, nothing to
20
+ migrate.**
21
+
22
+ ## What to do
23
+
24
+ Read your `State.md`. For each of its six canonical sections (Identity,
25
+ Current state, Immediate next actions, Durable / structural facts,
26
+ Personal-relevance memory index, Cold-successor note), write it into the
27
+ `personal_state` kind:
28
+
29
+ ```bash
30
+ thrum state set --kind personal_state --scope self --value '{
31
+ "identity": "<Identity section content>",
32
+ "current_state": "<Current state section content>",
33
+ "next_actions": "<Immediate next actions section content>",
34
+ "durable_facts": "<Durable / structural facts section content>",
35
+ "memory_index": "<Personal-relevance memory index section content>",
36
+ "cold_successor": "<Cold-successor note section content, or omit if empty>"
37
+ }'
38
+ ```
39
+
40
+ Value size is capped at 64KB — this replaces the old 60-line cap; if
41
+ State.md is over cap, trim the same way the old cap's error message
42
+ directed (never trim Durable / structural facts).
43
+
44
+ After migrating, `State.md` itself is no longer read by anything — leave it
45
+ in place (harmless) or delete it; do not keep updating it, since nothing
46
+ consumes it anymore.
47
+
48
+ ## Do not
49
+
50
+ - Run this if `thrum state list` already shows a `personal_state` entry —
51
+ a second run would overwrite (upsert semantics), silently discarding
52
+ anything written to `thrum state` since the last migration.
53
+ - Bulk-import on behalf of another agent. This is self-driven, scoped to
54
+ the live agent running the skill.
@@ -0,0 +1,161 @@
1
+ ---
2
+ name: thrum
3
+ description: "Multi-agent coordination via messaging, groups, and shared context. Use when agents need to communicate, delegate work, or coordinate across worktrees."
4
+ allowed-tools: "Bash(thrum:*)"
5
+ version: "0.10.6"
6
+ license: "Apache-2.0"
7
+ ---
8
+
9
+ # Thrum - Git-Backed Multi-Agent Coordination (Messaging, Groups, Shared Context)
10
+
11
+ Run `thrum prime` for full session context (auto-injected by hooks on
12
+ SessionStart and PreCompact).
13
+
14
+ ## Quick Command Reference
15
+
16
+ ### Messaging
17
+
18
+ ```bash
19
+ thrum send --to @name --body-file msg.md # Direct message (body from file)
20
+ thrum send --broadcast --body-file msg.md # Team-wide fanout
21
+ thrum send --to @everyone --body-file msg.md # Broadcast (legacy keyword; --broadcast preferred)
22
+ thrum reply <msg-id> --body-file reply.md # Reply (same audience; NO --to — recipient comes from the message)
23
+ thrum inbox List messages (auto-marks displayed as read)
24
+ thrum inbox --unread Unread only (does not mark as read)
25
+ thrum message search "<term>" Full-text search — use instead of paging; stale unread sorts last
26
+ thrum sent List messages you sent
27
+ thrum sent --unread Sent messages with unread recipients
28
+ thrum message read --all Mark all messages as read
29
+ thrum wait Block until message arrives (30s timeout)
30
+ thrum wait --timeout 120s Custom timeout (duration)
31
+ ```
32
+
33
+ ### Agents
34
+
35
+ ```bash
36
+ thrum quickstart --name <agent-name> --role R --module M --intent "..." Register + start session
37
+ thrum worktree create <name> --name <agent> --role R --module M Create worktree + register agent
38
+ (then run `thrum tmux launch <name>` to start runtime)
39
+ thrum worktree setup <name> --name <agent> --role R --module M Alias for worktree create
40
+ thrum whoami Show identity
41
+ thrum team List active agents
42
+ thrum ping @name Check if agent online
43
+ thrum who-has <file> Who's editing a file
44
+ ```
45
+
46
+ ### Role Templates
47
+
48
+ ```bash
49
+ thrum roles list List templates + matching agents
50
+ thrum roles deploy Re-render preambles from templates
51
+ thrum roles deploy --agent foo Deploy for specific agent
52
+ thrum roles deploy --dry-run Preview without writing
53
+ ```
54
+
55
+ ### Sessions & Context
56
+
57
+ ```bash
58
+ thrum session start Start session
59
+ thrum session end End session
60
+ thrum session set-intent "..." Update work description
61
+ thrum context show Show saved work context
62
+ thrum context save --file <path> Save context from file
63
+ thrum overview Combined status + team + inbox
64
+ /thrum:update-project Guided project state update (narrative + state)
65
+ /thrum:load-context Restore work context after compaction
66
+ ```
67
+
68
+ ### Tmux Sessions (Recommended)
69
+
70
+ ```bash
71
+ thrum tmux start Launch agent session (create+launch+prime+attach)
72
+ thrum tmux status Show managed sessions with state
73
+ thrum tmux connect Attach to running session (interactive picker)
74
+ thrum tmux restart <name> Restart session with context snapshot
75
+ thrum tmux kill <name> Tear down session
76
+ thrum tmux create <session> --name <n> --role <r> --module <m> --cwd <path> Create + register agent
77
+ thrum tmux quickstart <session> --name <n> --role <r> --module <m> --cwd <path> Alias for tmux create
78
+ thrum tmux launch <session> [--runtime <r>] Start runtime in session (REQUIRED after `tmux create`)
79
+ ```
80
+
81
+ ### Monitor Jobs
82
+
83
+ ```bash
84
+ thrum monitor add <name> --cmd "..." --on-match "msg" Add a monitored process
85
+ thrum monitor list List all monitor jobs
86
+ thrum monitor show <name> Show job details and recent matches
87
+ thrum monitor stop <name> Stop a monitor job
88
+ thrum monitor logs <name> Tail job output
89
+ thrum monitor restart <name> Restart a stopped job
90
+ ```
91
+
92
+ ### Daemon & Sync
93
+
94
+ ```bash
95
+ thrum daemon start Start daemon
96
+ thrum daemon stop Stop daemon
97
+ thrum daemon status Daemon health
98
+ thrum sync force Force immediate sync
99
+ thrum sync status Sync state
100
+ ```
101
+
102
+ ### Utility
103
+
104
+ ```bash
105
+ thrum init Initialize thrum in repo (also starts the daemon)
106
+ thrum prime Full session context
107
+ thrum prime --json Machine-readable output
108
+ thrum <cmd> --help Detailed command usage
109
+ ```
110
+
111
+ ## When to Use Thrum
112
+
113
+ | Thrum | TaskList/SendMessage | Neither |
114
+ | ---------------------------------------- | -------------------------- | ----------------------------- |
115
+ | Cross-worktree messaging | Same-session task tracking | Single-agent, no coordination |
116
+ | Persistent messages (survive compaction) | Ephemeral task lists | Temporary scratch notes |
117
+ | Background listener pattern | Inline progress tracking | Simple linear execution |
118
+ | Multi-machine sync via git | Local to conversation | No persistence needed |
119
+
120
+ **Decision test:** "Do messages need to survive session restart or reach agents
121
+ in other worktrees?" YES = Thrum.
122
+
123
+ **Thrum + TaskList coexist:** Use TaskList for immediate session work. Use Thrum
124
+ for cross-session/cross-worktree coordination messages.
125
+
126
+ ## Message Delivery
127
+
128
+ ### Tmux Sessions (Recommended)
129
+
130
+ When running in a tmux-managed session, messages are delivered directly to your
131
+ pane via daemon nudge — zero token cost, no background sub-agent needed. See
132
+ [TMUX_SESSIONS.md](resources/TMUX_SESSIONS.md).
133
+
134
+ ### Listener Pattern (Fallback)
135
+
136
+ When tmux is not available, use the background message listener. It calls
137
+ `thrum wait` (blocking) and returns when messages arrive. Re-arm after
138
+ processing. See [LISTENER_PATTERN.md](resources/LISTENER_PATTERN.md).
139
+
140
+ ### Context Management
141
+
142
+ - `thrum prime` gathers identity, team, inbox, git context, sync health
143
+ - SessionStart hook auto-runs `thrum prime` on session start
144
+ - PreCompact hook saves state to thrum context + `/tmp` backup before compaction
145
+ - **After compaction:** run `/thrum:load-context` to restore your work context
146
+ - Agent identity persists in `.thrum/identities/`
147
+
148
+ ## Resources
149
+
150
+ | Resource | Content |
151
+ | ---------------------------------------------------- | -------------------------------------------- |
152
+ | [TMUX_SESSIONS.md](resources/TMUX_SESSIONS.md) | Tmux-managed session setup and commands |
153
+ | [BOUNDARIES.md](resources/BOUNDARIES.md) | Thrum vs TaskList/SendMessage decision guide |
154
+ | [MESSAGING.md](resources/MESSAGING.md) | Protocol patterns, context management |
155
+ | [ANTI_PATTERNS.md](resources/ANTI_PATTERNS.md) | Common mistakes and how to avoid them |
156
+ | [LISTENER_PATTERN.md](resources/LISTENER_PATTERN.md) | Background message listener template |
157
+ | [CLI_REFERENCE.md](resources/CLI_REFERENCE.md) | Complete command syntax reference |
158
+ | [IDENTITY.md](resources/IDENTITY.md) | Agent identity and multi-worktree patterns |
159
+ | [WORKTREES.md](resources/WORKTREES.md) | Multi-worktree coordination |
160
+
161
+ Run `thrum <command> --help` for any command's full usage.