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,104 @@
1
+ ---
2
+ name: trace-spec-to-plan
3
+ description: "Use before converting a plan into epics/beads/worktrees, and whenever you need to know whether a plan actually implements its spec. Walks EVERY requirement in the spec forward into the plan, one item at a time, and reports PLANNED / NAME-ONLY / ABSENT / PARTIAL. Distinct from verify-against-source, which reads the ARTIFACT and asks 'does this honor its source' — this reads the SPEC and asks 'where did this land'. Triggers - about to run project-setup, about to create epics or beads, plan review, 'does the plan cover the spec', 'did we miss anything', 'is the plan complete'."
4
+ ---
5
+
6
+ # Trace Spec → Plan
7
+
8
+ **Announce at start:** "I'm using trace-spec-to-plan to walk every spec requirement into the plan."
9
+
10
+ ## Why this exists
11
+
12
+ > 🔑 **A reviewer reading an artifact cannot see what isn't in it.**
13
+
14
+ That sentence is the whole justification. Every other review in the pipeline reads the **plan** and asks *"is this sound?"* — so it can only find defects in what is present. **Absence has nothing to look at.**
15
+
16
+ ⇒ **This replaces ad-hoc extra audits in the standard flow rather than supplementing them.**
17
+
18
+ ## When it runs
19
+
20
+ **Immediately before `project-setup` creates epics and beads.** That is the last moment the spec is still in the room. Once a requirement is missing from the plan **and** absent from the beads, the beads become the working set, nobody consults the spec again, and the gap stops being discoverable at all.
21
+
22
+ Also valid: any time someone asks whether a plan is complete against its source.
23
+
24
+ ### Two hard preconditions
25
+
26
+ 🚫 **NEVER run by the plan's own author.** Self-review cannot catch a requirement the author never perceived — same person, same anchoring, same blind spot. **Dispatch it.**
27
+
28
+ ⚠️ **Run against a FROZEN plan.** A sweep racing live edits produces stale findings that cost more to triage than they are worth.
29
+
30
+ ## Sizing — the judgment call
31
+
32
+ 1. **COUNT THE SPEC ITEMS FIRST, NOT PAGES.** Include every sub-item: `A3.1–3.4`, `P1–P8`, each ruled-out branch, each contradiction disposition, each named sequencing constraint. A spec that reads as "20-something sections" was **~65 discrete requirements**.
33
+ 2. **≤ ~15 items ⇒ one agent. More ⇒ partition at ~12–15 items per agent.**
34
+ 3. 🔴 **PARTITION BY SPEC ITEM, NEVER BY PLAN SECTION.** Section-partitioning manufactures false ABSENTs whenever a requirement is covered in a phase that auditor wasn't given. **Every agent searches the WHOLE plan for its own items.**
35
+ 4. Write the shared instructions to **one file** (`resources/sweep-agent-prompt.md`) and give each agent only its item list. Keeps dispatches short and identical.
36
+ 5. Use `efficient-multi-agent-research` for launch-and-wait mechanics.
37
+
38
+ ## The four verdicts
39
+
40
+ | Verdict | Means |
41
+ |---|---|
42
+ | **PLANNED** | A task exists with concrete steps that would make the requirement true — files named, code or commands shown. |
43
+ | **NAME-ONLY** | The plan mentions, quotes, or asserts the requirement — but no task carries out steps. |
44
+ | **ABSENT** | Not mentioned anywhere. |
45
+ | **PARTIAL** | Part is planned; a named part is not. Say which. |
46
+
47
+ 🔑 **NAME-ONLY IS THE LOAD-BEARING VERDICT AND THE ONE AN AGENT WILL AVOID ASSIGNING.** It feels harsh against well-written prose, and PLANNED is always the cheaper answer. **A requirement restated in a warning box, a doc comment, an architecture paragraph, or a Definition-of-Done row is NAME-ONLY unless a task carries out steps.**
48
+
49
+ ### Worked example — the judgement that decides this skill's value
50
+
51
+ ```go
52
+ // assess computes one agent's verdict from the joined snapshot. It decides
53
+ // from PROCESS EVIDENCE — PID pair union session presence — and never from a
54
+ // self-written timestamp. It writes nothing.
55
+ func assess(s *Snapshot, j *Joined, agentID string) Verdict
56
+ ```
57
+
58
+ A correct doc comment restating the spec, a precise signature, and it is **consumed by a task elsewhere in the plan**. It reads as covered.
59
+
60
+ **Verdict: NAME-ONLY.** There is no body and no task anywhere implements one. That function *was* the reconciler. **The tell is not the quality of the prose — it is that no step produces the thing.**
61
+
62
+ ## Three questions per requirement
63
+
64
+ 1. **Is there a task?** Naming a mechanism is not doing it.
65
+ 2. 🔴 **Does the plan contain every step to make it true — INCLUDING CREATING SUBSTRATE THAT DOES NOT EXIST YET?** Open the real struct / table / interface at the plan's authored-against SHA. **A mechanism operating on a substrate that cannot hold the data is a silent no-op.** *Highest-yield question here:* a paired-write primitive was fully and correctly specified while the struct lacked the field and the table lacked the column.
66
+ 3. **Would anything FAIL if it regressed?** A property with an implementation but no failing test is not achieved. **A manual grep in a Definition of Done cannot fail next month.**
67
+
68
+ ## Framing — do not get this backwards
69
+
70
+ 🔴 **A gap is a MISSING STEP IN THE PLAN, never a defect in the spec.** The spec is owner-ruled. If a requirement needs a field that does not exist, **the plan must add the field** — that is what plans are for.
71
+
72
+ **Never report a requirement as "impossible" and never suggest narrowing one.** "Impossible" points the next reader at scoping down the spec, which is the opposite of the repair.
73
+
74
+ 🚫 **The spec is never edited by this skill or its findings.** A finding that appears to require a spec change is an escalation to the owner, never an action.
75
+
76
+ ## Reporting rules
77
+
78
+ - **Write the report to a FILE first and append as you go.** The final message is a summary; the file is the deliverable. *(Dispatched agents have completed full audits whose final text never reached the parent. The agent does not notice.)*
79
+ - **Record PLANNED items too.** A map that lists only holes cannot show what is safe to build on, and cannot be checked for completeness.
80
+ - **Report what could not be resolved**, naming the search run — never guess. An honest "unresolved" is what makes the PLANNED verdicts worth anything.
81
+ - 🔴 **If a partition returns ALL PLANNED with zero NAME-ONLY, hand-verify two PLANNED rows at random and show the working.** **An all-clear is the result most likely to be produced by not looking.**
82
+
83
+ ## After the sweep — the dispatcher's job
84
+
85
+ 1. **Consolidate into ONE numbered list** across all partitions. Never act on partial batches.
86
+ 2. **Filter stale findings** if the plan moved during the sweep — and say so rather than counting them.
87
+ 3. **Close every gap before epics are created.** That is the entire point of running it here; a filed-and-deferred gap is the failure this skill exists to prevent.
88
+ 4. **Spot-verify any finding that names a file, line, or symbol** before acting. Auditors misread cites, and a correction carries the same evidence bar as the finding it replaces.
89
+
90
+ ## What this does NOT cover
91
+
92
+ **Compositional defects.** Per-item traversal cannot see *"every phase individually fine, the whole broken."* Measured example: an end state that would run **two concurrent reconcilers**, violating the premise of the design's own no-multi-writer ruling — while every individual requirement was satisfied.
93
+
94
+ ⇒ **Pair this with a compositional pass.** They are different lenses and neither substitutes for the other. **The standard flow wants two audits, not eight.**
95
+
96
+ ## Failure modes of this skill itself
97
+
98
+ | Failure | Symptom | Guard |
99
+ |---|---|---|
100
+ | Folded into `verify-against-source` as redundant | "we already check coverage" | The traversal direction differs; keep both |
101
+ | Run by the plan's author | Everything PLANNED | Dispatch it |
102
+ | Partitioned by plan section | False ABSENTs | Partition by spec item |
103
+ | Agent avoids NAME-ONLY | Zero NAME-ONLY across a large partition | Mandatory hand-verify of two rows |
104
+ | Findings filed, not fixed | Gaps reach the beads anyway | Close before epics |
@@ -0,0 +1,57 @@
1
+ # Sweep agent — shared instructions
2
+
3
+ > Dispatcher: write this file once, then give each agent ONLY its item list and its report path. Keeps dispatches short and identical.
4
+ > **Model:** sonnet · **Effort:** medium. The verdict call needs judgement; the searching does not.
5
+
6
+ ---
7
+
8
+ For each assigned spec requirement: is it in the plan, and does the plan actually **plan to implement it** rather than merely name it?
9
+
10
+ ## 🔴 WRITE YOUR REPORT TO YOUR ASSIGNED FILE FIRST, then append as you go
11
+
12
+ Create it with headings before any analysis. **Your final message is a SUMMARY; the FILE is the deliverable.**
13
+
14
+ Agents have completed full audits whose final text never reached the parent, and other dispatches left no artifact at all — that work is unrecoverable, and an idle notification is indistinguishable from "did nothing" and "did everything, and it vanished."
15
+
16
+ ## CONSTRAINTS
17
+
18
+ - READ-ONLY git ONLY: `show`, `log`, `diff`, `grep`, `rev-parse`, `merge-base`, `status`. NEVER `checkout`, `reset`, `restore`, `stash`, `clean`, `rebase`, `commit`, `push` — in ANY directory.
19
+ - Operate ONLY in the worktree named in your dispatch. Write ONLY your report file.
20
+ - `rm -r`, never `rm -rf`. Work synchronously. No background children. Any sub-agent needs explicit `model:` and `effort:`.
21
+ - Read the plan in ~400-line windows. **Search the WHOLE plan for each of your items** — coverage may live in any phase.
22
+ - Verify code claims at the plan's **authored-against SHA** with `git show <sha>:<path>`. **The working tree may be on a different base**; reading it yields wrong line numbers.
23
+
24
+ ## THE VERDICTS
25
+
26
+ | Verdict | Means |
27
+ |---|---|
28
+ | **PLANNED** | A task exists with concrete steps that would make the requirement true — files named, code or commands shown. |
29
+ | **NAME-ONLY** | The plan mentions, quotes, or asserts it — but no task carries out steps. |
30
+ | **ABSENT** | Not mentioned anywhere. |
31
+ | **PARTIAL** | Part planned, a named part not. Say which. |
32
+
33
+ 🔑 **NAME-ONLY IS THE FINDING THAT MATTERS AND IT IS EASY TO MISS**, because good plans quote their spec often. **Quoting a rule is not implementing it.** A requirement restated in a warning box, a doc comment, an architecture paragraph, or a Definition-of-Done row is **NAME-ONLY unless a task carries out steps.**
34
+
35
+ **Worked example.** A function declared as a bare signature with a correct doc comment restating the spec, consumed by a task elsewhere — **NAME-ONLY**, because no step produces a body. The tell is not prose quality; it is that nothing produces the thing.
36
+
37
+ ## THREE QUESTIONS PER ITEM
38
+
39
+ 1. **Is there a task?**
40
+ 2. 🔴 **Does the plan include every step to make it true — INCLUDING CREATING SUBSTRATE THAT DOES NOT EXIST YET?** Open the real struct/table/interface at the authored-against SHA. **A mechanism over a substrate that cannot hold the data is a SILENT NO-OP.** Weight this heaviest.
41
+ 3. **Would anything FAIL if it regressed?** An implementation with no failing test has not achieved the property.
42
+
43
+ ## FRAMING — do not get this backwards
44
+
45
+ 🔴 **A gap is a MISSING STEP IN THE PLAN, never a defect in the spec.** If a requirement needs a field that does not exist, the correct finding is **"the plan is missing a task that adds the field"** — never "impossible", and never a suggestion to narrow the requirement. The spec is owner-ruled and correct; the plan is what is incomplete.
46
+
47
+ ## REPORTING
48
+
49
+ - **Record PLANNED items too** — the complete map is the deliverable, not just the holes.
50
+ - **Report what you could not resolve**, naming the search you ran. Never guess. Pair any zero with a control showing the search can return something.
51
+ - 🔴 **If ALL your items come back PLANNED with zero NAME-ONLY, hand-verify two PLANNED rows at random and show your working.** An all-clear is the result most likely to be produced by not looking.
52
+
53
+ ## OUTPUT (into your file)
54
+
55
+ A table: `Item · Spec line · Verdict · Plan task/line · One-line justification`
56
+ Then every NAME-ONLY / ABSENT / PARTIAL with the **concrete missing step**.
57
+ Then COVERAGE: items checked, and anything unresolved.
@@ -0,0 +1,149 @@
1
+ ---
2
+ name: update-queue
3
+ description: "Use to reconcile your own thrum queue against ground truth - 'update my queue', 'audit my queue', 'my queue is stale', 'reconcile the queue', 'clean up done bundles', or at any session start / lull when you are about to conclude nothing is pending. Verifies each live bundle against git + beads + merge state, drops rot, adds missing committed work. Any role. A repeatable subset of a full multi-agent reconcile - scoped to YOUR queue only."
4
+ ---
5
+
6
+ # Thrum: Update Your Queue (reconcile against ground truth)
7
+
8
+ Reconcile YOUR OWN `thrum queue` so its status matches reality: drop finished
9
+ rot, verify each live bundle against git + beads + merge state, add committed
10
+ work that is missing. Scoped to your queue only — cross-agent reconciles are a
11
+ larger pass (see the final section). Run it at session start, at a lull, or
12
+ whenever the queue can no longer be trusted at a glance.
13
+
14
+ Edit only your OWN queue. Handing work to another agent is a message,
15
+ never a write to their queue (see the `using-the-queue` skill).
16
+
17
+ ---
18
+
19
+ ## Step 1 — Snapshot the denominator
20
+
21
+ ```bash
22
+ thrum queue list
23
+ thrum queue list | awk -F'\t' 'NF>1{print $2}' | sort | uniq -c # status counts
24
+ ```
25
+
26
+ Read the whole list yourself. The status counts are the before-number to
27
+ reconcile against and report the delta from. `-F'\t'` is load-bearing: bundle
28
+ rows are tab-delimited, but `queue list` also prints a space-delimited footer
29
+ (`Oldest bundle updated …`) to stdout — under default whitespace splitting that
30
+ footer's second word lands in the status tally and corrupts the denominator.
31
+ The tab delimiter drops it (footer has no tab ⇒ NF=1).
32
+
33
+ Two staleness classes to expect:
34
+
35
+ - **done-rot** — bundles left `done` from prior sessions, never dropped.
36
+ - **zombie live** — bundles marked `in_progress`/`blocked` (or `pending`) whose
37
+ work has actually landed or been superseded.
38
+
39
+ `done` is a waypoint, not a resting place — it stays visible and `start`
40
+ reopens it. Only `drop` removes a bundle, and it deletes every item inside.
41
+
42
+ ## Step 2 — Drop done-rot (cheap, no verification)
43
+
44
+ Every `done` bundle you are not deliberately keeping this session → `drop`.
45
+ Batch it:
46
+
47
+ ```bash
48
+ thrum queue list | awk -F'\t' '$2=="done"{print $1}' | while read id; do
49
+ thrum queue drop "$id" && echo "dropped: $id"
50
+ done
51
+ ```
52
+
53
+ Keep a done bundle past this step only as a deliberate act (e.g. it may reopen
54
+ on a pending review finding) — never as the default.
55
+
56
+ ## Step 3 — Verify each live bundle against ground truth
57
+
58
+ For every `in_progress`/`blocked` bundle, and any `pending` you suspect has
59
+ landed, use its lookup key to check reality. The key is the bundle's
60
+ `--ref bead:<id>` and/or a branch/SHA named in its title:
61
+
62
+ ```bash
63
+ thrum queue show <bundle-id> # read refs + title to get the key
64
+ bd show <bead-id> # open vs closed (NEVER `bd list --all`)
65
+ git merge-base --is-ancestor <sha> origin/<trunk> && echo MERGED || echo NOT-MERGED
66
+ git --no-pager log --oneline --merges origin/<trunk> | grep <branch-or-sha> # find the merge commit
67
+ ```
68
+
69
+ 🔴 **`--is-ancestor` answers "is this SHA reachable", not "is this content
70
+ present".** A squash- or cherry-pick-merged branch is NOT an ancestor yet its
71
+ content is on trunk — for those, `git diff <sha> origin/<trunk> -- <files>`
72
+ (empty ⇒ content landed), never ancestry alone.
73
+
74
+ 🔴 **Run the check so it COULD come back negative.** Point the same
75
+ merge/ancestor check at one bundle you KNOW is still open — it must report
76
+ NOT-MERGED. A verification that cannot fail is not verifying; this control is
77
+ what separated the in-depth audit from a guess.
78
+
79
+ Classify each bundle from the evidence:
80
+
81
+ | Evidence | Verdict | Action |
82
+ |---|---|---|
83
+ | Bead closed AND content on trunk | merged | `done` then `drop` |
84
+ | Bead open / branch not landed | still open | keep (`start` if wrongly `done`) |
85
+ | Some work landed, more owed | partial | keep; make its status reflect reality |
86
+ | Work replaced by newer bundle/approach | superseded | `drop` |
87
+ | Committed/dispatched work with NO bundle | missing | add in Step 5 |
88
+ | Evidence unclear | unsure | keep — never drop on a guess |
89
+
90
+ Two-phase close for a landed bundle (make the state machine explicit):
91
+
92
+ ```bash
93
+ thrum queue done <bundle-id> && thrum queue drop <bundle-id>
94
+ ```
95
+
96
+ ## Step 4 — Delegate the cross-referencing when it does not fit in one pass
97
+
98
+ More than ~6 live bundles to verify → dispatch read-only sub-agents, one slice
99
+ each, rather than checking them inline (see `efficient-multi-agent-research`).
100
+ Consume consolidated verdicts and make every drop/keep/add/start call yourself
101
+ — the sub-agents only gather evidence.
102
+
103
+ Give each sub-agent:
104
+
105
+ - its slice of bundles (id + ref + title),
106
+ - the exact recipe from Step 3 (`bd show`, `--is-ancestor` + the content-diff
107
+ caveat, the discriminating control),
108
+ - the verdict table above as the required return format
109
+ (`bundle-id → merged | open | partial | superseded | unsure`, with the
110
+ one-line evidence for each),
111
+ - **READ-ONLY git fence**: `show`, `log`, `diff`, `grep`, `rev-parse`,
112
+ `merge-base`, `status` ONLY — never `checkout`/`reset`/`restore`/`stash`/
113
+ `clean`/`rebase`/`commit`/`push`, in any directory; never enter another
114
+ worktree.
115
+ - pinned `model:` + `effort:` (sonnet, low for mechanical lookups).
116
+
117
+ ## Step 5 — Add missing committed work
118
+
119
+ Work you have actually committed to that has no bundle is invisible after a
120
+ restart. Add each — branches you own, dispatches you accepted, in-flight epics
121
+ — with its backlog ref:
122
+
123
+ ```bash
124
+ thrum queue add --title "<what>" --ref bead:<id> --priority <N>
125
+ ```
126
+
127
+ ## Step 6 — Accept ambiguity, then report
128
+
129
+ Anything still `unsure` stays. A false negative (keeping stale work) is cheap;
130
+ a false positive (`drop` deletes the bundle and its items) is not — never drop
131
+ on a guess.
132
+
133
+ Re-run the status counts and report the delta:
134
+
135
+ ```bash
136
+ thrum queue list | awk -F'\t' 'NF>1{print $2}' | sort | uniq -c
137
+ ```
138
+
139
+ One line: dropped N, added M, reclassified K; note anything left deliberately
140
+ unsure for a deeper pass.
141
+
142
+ ---
143
+
144
+ ## What this skill is NOT
145
+
146
+ This reconciles YOUR queue. A whole-fleet or cross-agent reconcile — auditing
147
+ what every agent is doing, routing orphaned work, re-deriving ownership — is a
148
+ larger, coordinator-scoped pass. This is the routine, repeatable subset you run
149
+ on your own queue to keep it trustworthy between those.
@@ -0,0 +1,172 @@
1
+ ---
2
+ name: using-the-queue
3
+ description: "Use when an agent tracks its own committed work or needs to see who is doing what - keeping a task list of what you are working on, recording work someone assigned you, promoting a backlog bead or issue into active work, lifting an assignment out of a message you received, routing work to another agent, checking what another agent has on its plate, or moving a task through pending / in_progress / blocked / done. Also use when you reach a lull, go idle, or finish a thread and are about to conclude 'nothing pending' - reconcile your committed work against the queue before deciding you are done. Covers the full thrum queue CLI - bundles, embedded items, status, assignment provenance, and reading another agent's queue."
4
+ ---
5
+
6
+ # Using the Thrum Queue
7
+
8
+ ## Overview
9
+
10
+ `thrum queue` is a per-agent, local-only, daemon-resident list of the work an
11
+ agent has committed to. One queue per `agent_id`; you EDIT your own, anyone may
12
+ READ any queue. It is not beads and not a message inbox - beads is the shared
13
+ backlog of what COULD be done; the queue is the private, short-lived list of
14
+ what an agent IS doing right now, and it is gone when the agent is deleted.
15
+
16
+ **One rule governs everything else: the queue never crosses agents by itself.**
17
+ You only ever write your OWN queue. Assigning, handing off, and cross-box status
18
+ all travel as MESSAGES; the receiving agent adds the work to its own queue. No
19
+ command writes another agent's queue.
20
+
21
+ ## When to Use
22
+
23
+ - You need a task list of what you are actively working on.
24
+ - Someone messaged you an assignment and you want it tracked as committed work.
25
+ - You are promoting a backlog item (a bead / thrum-issue) into active work.
26
+ - You are a coordinator/orchestrator routing work and want to record who you
27
+ handed a bundle to.
28
+ - You need to see what another agent is working on or how loaded it is.
29
+ - You are moving a task between pending / in_progress / blocked / done, or
30
+ clearing finished work out.
31
+
32
+ ## Mental Model
33
+
34
+ - **Bundle** = one unit of committed work (the only top-level record). Carries a
35
+ title, optional backlog `refs`, a status, a priority, and provenance.
36
+ - **Item** = a short checklist entry EMBEDDED inside a bundle. Items are never
37
+ standalone and never linked across bundles. There is no nesting - a bundle
38
+ holds items, nothing deeper.
39
+ - **`title` carries the whole content** - there is no body field (40 KB cap).
40
+ - **Local-only**: `.thrum/var/queue/<agent>.jsonl`, projected to SQLite, rebuilt
41
+ on cold boot, included in `thrum backup`. Never peer-synced.
42
+
43
+ ## Who-is-doing-what (read this if that is your goal)
44
+
45
+ Three distinct fields, do not conflate them:
46
+
47
+ - **`assigned_by`** - provenance: which agent assigned this to me. Auto-filled
48
+ when a bundle/item is created with `--from-message` (from the message author).
49
+ Answers "who gave me this."
50
+ - **`assigned_to`** - routing metadata I put on MY OWN bundle via
51
+ `thrum queue assign`. It is informational only. **It does NOT write the
52
+ named agent's queue and does NOT hand the work off.** Answers "who I intend
53
+ this for." The actual handoff is a separate `thrum send`; that agent runs
54
+ `thrum queue add --from-message` to pull it into its own queue.
55
+ - **`thrum queue list --agent <id>` / `show <id> --agent <id>`** - read another
56
+ agent's queue directly. Answers "what is agent X working on / how loaded is
57
+ it." Read-only, no permission gate.
58
+
59
+ ## Quick Reference
60
+
61
+ | Command | Does |
62
+ |---|---|
63
+ | `thrum queue add --title "..."` | Create a bundle in your queue |
64
+ | `thrum queue add --from-message <msg_id>` | Special case: lift ONE specific message you received (content->title, author->assigned_by, refs->refs). Use the exact msg-id you're acting on - never head-1 of the inbox |
65
+ | `thrum queue add --ref bead:<id>` | Promote a backlog item into active work |
66
+ | `thrum queue list [--status <s>] [--agent <id>]` | List your queue (or another agent's) |
67
+ | `thrum queue show <bundle-id> [--agent <id>]` | Full detail for one bundle |
68
+ | `thrum queue start <bundle-id>` | -> in_progress (clears block_reason) |
69
+ | `thrum queue block <bundle-id> [--reason "..."]` | -> blocked (records the reason) |
70
+ | `thrum queue done <bundle-id>` | -> done (TEMPORARY waypoint, not deleted; `start` reopens it; clears block_reason) |
71
+ | `thrum queue drop <bundle-id>` | DELETE bundle + all its items, any status (the one destructive verb - drop promptly once a done bundle's record stops being useful) |
72
+ | `thrum queue assign <bundle-id> <agent-id>...` | Append agent(s) to assigned_to (routing metadata only) |
73
+ | `thrum queue item add <bundle-id> --title "..."` | Add one embedded item |
74
+ | `thrum queue item batch-add <bundle-id> --title "..." --title "..."` | Add several items in one call (shared --ref/--priority) |
75
+ | `thrum queue item start/block/done <bundle-id> <item-id>` | Item-level status (start/done clear the item's block_reason) |
76
+
77
+ Optional: `--ref <type>:<value>` (repeatable), `--priority N` (higher sorts
78
+ first), and `--from-message` (special case, below). `add` / `item add` require at
79
+ least one of `--title` or `--from-message`; explicit `--title` wins over
80
+ `--from-message`. **`--title` is the normal way to add work.**
81
+
82
+ ## Common Flows
83
+
84
+ **Add work you're taking on (the normal case):**
85
+ ```
86
+ thrum queue add --title "Ship the X migration"
87
+ ```
88
+
89
+ **Promote a backlog bead into active work:**
90
+ ```
91
+ thrum queue add --title "Ship the X migration" --ref bead:thrum-abc12 --priority 5
92
+ ```
93
+
94
+ **Lift a SPECIFIC message you received** (special case - mainly an
95
+ orchestrator/agent taking a dispatch it was handed):
96
+ ```
97
+ thrum queue add --from-message <msg_id>
98
+ ```
99
+ Copies the message's content into the bundle title, its author into
100
+ `assigned_by`, its refs into `refs`, then discards the message ID. 🔴 Pass the
101
+ EXACT id of the assignment you are acting on, matched to its sender - NEVER pipe
102
+ `inbox --unread | head -1`, which grabs whatever is newest (often a monitor
103
+ alert or an unrelated message) and stores it as your title. For anything you
104
+ create yourself, use `--title`.
105
+
106
+ **Hand work to another agent** (two steps, in this order - there is no one-shot):
107
+ ```
108
+ thrum queue assign <bundle-id> @impl_foo # record intent on YOUR bundle
109
+ thrum send --to @impl_foo --stdin <<'EOF' # actually route it
110
+ Assigned you <bundle>: <what + refs>. Add it with: thrum queue add --from-message <this msg id>
111
+ EOF
112
+ ```
113
+
114
+ **See what an agent has on its plate:**
115
+ ```
116
+ thrum queue list --agent @impl_foo --status in_progress
117
+ ```
118
+
119
+ **Finish vs discard:** `done` is a WAYPOINT, not a resting place - it marks a
120
+ bundle done and KEEPS it visible (`start` reopens it), but it is not where
121
+ finished work should live. `drop` DELETES it and every item inside, regardless
122
+ of status. Reconcile at session start and natural breakpoints: `done` then a
123
+ prompt `drop` is the normal close-out; `drop` alone is fine too. Don't let a
124
+ done bundle outlive your next reconcile unless you deliberately keep it.
125
+
126
+ **Close on a TRIGGER, not a reminder.** The moment a bundle's branch merges into
127
+ trunk, OR its last referenced bead closes, `done` + `drop` it in that same turn -
128
+ closure is part of the merge/close act, exactly as `add` is part of dispatch. A
129
+ bundle whose branch is an ancestor of trunk, or whose beads are all closed, is
130
+ completed-but-open rot; do not leave it for "later". `add` has a natural trigger
131
+ (dispatch) and gets done reliably; the close has no trigger unless you make the
132
+ merge/close BE the trigger.
133
+
134
+ **Reconcile is a bounded sweep, not a review.** At session start / breakpoint,
135
+ close only the bundles a check proves done, and skip the rest. Two checks only:
136
+ - branch is an ancestor of trunk (`git merge-base --is-ancestor <tip> origin/<trunk>`) -> `done` + `drop`
137
+ - every `bead:` ref is closed (`bd show <id>`) -> `done` + `drop`
138
+
139
+ Do NOT read each bundle's full history - the sweep is those two checks against
140
+ merged/closed state, nothing more.
141
+
142
+ ## Common Mistakes
143
+
144
+ - **Treating `add`/`done` as the work itself.** The queue *tracks* your work; it
145
+ does not perform it. `add` is not dispatching — the dispatch is the
146
+ `thrum send` / merge / deploy the bundle *mirrors*. `done` means the tracked
147
+ work actually landed, not "I'm finished thinking about it." Marking bundles
148
+ `done` when nothing was dispatched or deployed is a false record, exactly like
149
+ filing a bead and calling the bug fixed — and it inflates the queue while
150
+ little actually ships. Verify the thing landed before `done` (branch merged /
151
+ bead closed / deploy confirmed); otherwise it is still `in_progress` or
152
+ `blocked`.
153
+ - **Piping a guessed id into `--from-message` (e.g. `inbox --unread | head -1`).**
154
+ That grabs whatever is newest - often a monitor alert or an unrelated message -
155
+ and stores it as your bundle title. `--from-message` takes the EXACT id of the
156
+ assignment you are lifting, matched to its sender; for anything self-created use
157
+ `--title`.
158
+ - **Expecting `assign` to put work in the other agent's queue.** It does not -
159
+ it only tags your own bundle. Always follow it with a `thrum send`; the
160
+ recipient adds it themselves via `--from-message` (with that message's exact id).
161
+ - **Leaving done bundles to pile up.** `done` never removes anything - the
162
+ bundle stays, and only `drop` deletes it. Drop each done bundle promptly once
163
+ its record stops being useful; a queue full of undropped done bundles is the
164
+ primary rot mode.
165
+ - **Reaching for a `remove`/`rename`/item-`drop` verb.** They do not exist by
166
+ design: removal happens only at the bundle level via `drop`; titles are set at
167
+ creation and not edited.
168
+ - **Trying to edit another agent's queue.** Impossible by design - you only
169
+ write your own. Cross-agent work is messaging plus the recipient's own `add`.
170
+ - **Treating the queue as durable/shared history.** It is local, private, and
171
+ deleted with the agent. Anything that must survive belongs in beads or a
172
+ committed doc, referenced from the bundle via `--ref`.
@@ -0,0 +1,104 @@
1
+ ---
2
+ name: using-thrum-state
3
+ description: "Use when reading or writing thrum state - checking your own agent-local current state at session start, updating your status/next-actions, reading a fleet fact like deploy state or topology before acting on it, citing a SHA or box fact in a decision, deciding whether a fleet row is fresh enough to trust, or responding to a freshness-sweep ping. Also use before writing any fleet row - deploy state, topology, worktree, agent pool, or a standing ruling - to confirm you are writing from a by-effect measurement, not a guess. Triggers on: citing a fleet fact, deploying, restarting a daemon, migrating schema, reconciling state at session start, receiving a stale-row ping."
4
+ ---
5
+
6
+ # Using Thrum State
7
+
8
+ ## Overview
9
+
10
+ `thrum state` is a two-tier current-value store. **Agent-local** state
11
+ (`thrum state set/get/list/show/delete` with an undeclared or `personal_state`
12
+ kind) is your own standing status — reconcile it like your queue, at session
13
+ start and every breakpoint. **Fleet state** (deploy_state, topology,
14
+ worktree, agent_pool, ruling) is different in kind: it describes a fact
15
+ about a DIFFERENT machine that changes elsewhere, with no owner present when
16
+ it goes stale.
17
+
18
+ **The governing invariant: a fleet row is a timestamped measurement, not a
19
+ current truth.** Every row carries `as_of`/`method`/`established_by` — read
20
+ them before you act.
21
+
22
+ ## When to Use
23
+
24
+ - Checking your own agent-local current state at session start.
25
+ - Updating your own status/next-actions.
26
+ - Reading a fleet fact (deploy state, topology) before acting on it.
27
+ - Citing a SHA or box fact in a decision.
28
+ - Deciding whether a fleet row is fresh enough to trust.
29
+ - Responding to a freshness-sweep ping.
30
+ - Writing any fleet row (deploy state, topology, worktree, agent pool, or a
31
+ standing ruling) — confirm you are writing from a by-effect measurement,
32
+ not a guess, before you do.
33
+
34
+ ## The named rot mode: "the tidied row"
35
+
36
+ A normalized or guessed value that reads byte-identically to a measured
37
+ one. This is how a coordinator acts on a confidently-wrong SHA. The
38
+ corrected intuition: **`as_of` is a measurement time, not a last-edit
39
+ time** — writing a fleet row without a fresh by-effect check, even to
40
+ "fix" a value you believe is stale, is exactly this failure.
41
+
42
+ ## Reconcile, don't just read
43
+
44
+ - **Agent-local** (all roles): check at session start
45
+ (`thrum state list`), update as you go. Carried-over state is NOT
46
+ auto-injected into prime — you must ask.
47
+ - **Fleet** (coordinators write; everyone reads): before citing a fleet
48
+ fact in a decision, check `as_of`/`method`. Past the kind's threshold
49
+ (`thrum state describe <kind>`)? Re-verify by effect before acting, or
50
+ say explicitly that you're acting on a stale value and why that's
51
+ acceptable this once.
52
+
53
+ **Unmeasured ≠ measured-negative.** An absent row does not mean "at tip" or
54
+ "clean" — it means nobody has measured it. Do not read absence as a
55
+ negative result.
56
+
57
+ ## Quick Reference
58
+
59
+ | Command | Effect |
60
+ |---|---|
61
+ | `thrum state set --kind <k> --scope <s> --value '<json>'` | Upsert (create or overwrite) |
62
+ | `thrum state get <kind>:<scope>` | Read one entry |
63
+ | `thrum state list [--kind <k>] [--agent <id>]` | List entries |
64
+ | `thrum state show <kind>:<scope>` | Full metadata for one entry |
65
+ | `thrum state delete <kind>:<scope>` | Remove outright (fleet: tombstones) |
66
+ | `thrum state describe <kind>` | Dump a declared kind's field shape + threshold |
67
+ | `thrum state history <kind>:<scope>` | Append-only write history (recovers LWW losers) |
68
+
69
+ `--method by_effect` when you measured it directly; `--method asserted`
70
+ when you're stating it without a live check; a write relayed from a message
71
+ is forced to `--method relayed` (low-trust) — never choose `relayed`
72
+ yourself.
73
+
74
+ ## Common Flows
75
+
76
+ **Deploy runbook, after verifying a box's serving SHA:**
77
+
78
+ ```bash
79
+ thrum state set --kind deploy_state --scope box-a \
80
+ --value '{"serving_sha":"<sha>","schema":77}' --method by_effect
81
+ ```
82
+
83
+ **Session-start reconcile (agent-local):**
84
+
85
+ ```bash
86
+ thrum state list
87
+ # update anything stale; nothing auto-loads, so do this every session
88
+ ```
89
+
90
+ **Responding to a freshness-sweep ping:** re-verify the named row by
91
+ effect, then `thrum state set` with the fresh value and `--method
92
+ by_effect`. Never "correct" a row you have not personally re-measured.
93
+
94
+ ## Common Mistakes
95
+
96
+ - **Normalising the deploy table to one SHA "because that's probably
97
+ right."** This is the tidied-row catastrophe. Re-verify by effect or
98
+ leave it stale-flagged.
99
+ - Writing the same fact to both agent-local AND fleet state (coordinators
100
+ especially — see the coordinator preamble's anti-double-add rule).
101
+ - Choosing `--method relayed` yourself instead of letting a message-relay
102
+ path force it.
103
+ - Treating an absent fleet row as a negative result instead of "nobody has
104
+ measured this."