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.
- package/assets/commands/thrum-_deviations-protocol.md +87 -0
- package/assets/commands/thrum-_generator-idempotency-protocol.md +15 -0
- package/assets/commands/thrum-_project-rules-protocol.md +18 -0
- package/assets/commands/thrum-_snapshot-protocol.md +265 -0
- package/assets/commands/thrum-_stamp-protocol.md +112 -0
- package/assets/commands/thrum-_verify-before-write-protocol.md +27 -0
- package/assets/commands/thrum-inbox.md +22 -0
- package/assets/commands/thrum-load-context.md +17 -0
- package/assets/commands/thrum-overview.md +17 -0
- package/assets/commands/thrum-prime.md +30 -0
- package/assets/commands/thrum-quickstart.md +14 -0
- package/assets/commands/thrum-reply.md +28 -0
- package/assets/commands/thrum-restart-extended.md +195 -0
- package/assets/commands/thrum-restart.md +293 -0
- package/assets/commands/thrum-send.md +31 -0
- package/assets/commands/thrum-sleep-extended.md +186 -0
- package/assets/commands/thrum-sleep.md +212 -0
- package/assets/commands/thrum-team.md +12 -0
- package/assets/commands/thrum-update-project.md +259 -0
- package/assets/commands/thrum-wait.md +14 -0
- package/assets/skills/adversarial-critique/SKILL.md +242 -0
- package/assets/skills/brainstorm-queue-aware/SKILL.md +167 -0
- package/assets/skills/brainstorm-steward/SKILL.md +181 -0
- package/assets/skills/choosing-subagent-models/SKILL.md +244 -0
- package/assets/skills/closing-findings-while-warm/SKILL.md +104 -0
- package/assets/skills/configure-roles/SKILL.md +229 -0
- package/assets/skills/coordinator-assessing-agent-completion/SKILL.md +205 -0
- package/assets/skills/coordinator-assessing-agent-completion/scan.py +117 -0
- package/assets/skills/coordinator-branch-split-on-block/SKILL.md +168 -0
- package/assets/skills/coordinator-context-monitoring/SKILL.md +674 -0
- package/assets/skills/coordinator-dispatching-work/SKILL.md +288 -0
- package/assets/skills/coordinator-hotpath-merge-gate/SKILL.md +522 -0
- package/assets/skills/coordinator-interacting-with-the-owner/SKILL.md +171 -0
- package/assets/skills/coordinator-maintaining-memory/SKILL.md +89 -0
- package/assets/skills/coordinator-managing-state-and-lifecycle/SKILL.md +192 -0
- package/assets/skills/coordinator-merging-code/SKILL.md +331 -0
- package/assets/skills/coordinator-philosophy-merge-gate/SKILL.md +442 -0
- package/assets/skills/coordinator-plan-reconcile-gate/SKILL.md +198 -0
- package/assets/skills/coordinator-post-restart-sweep/SKILL.md +135 -0
- package/assets/skills/coordinator-running-autonomous-feature-development/SKILL.md +199 -0
- package/assets/skills/coordinator-running-brainstorm-cycles/SKILL.md +654 -0
- package/assets/skills/coordinator-running-review-cycles/SKILL.md +153 -0
- package/assets/skills/coordinator-single-responsibility-merge-gate/SKILL.md +14 -0
- package/assets/skills/diagnosing-fleet-and-daemon/SKILL.md +255 -0
- package/assets/skills/efficient-multi-agent-research/SKILL.md +177 -0
- package/assets/skills/fixing-documentation-errors/SKILL.md +258 -0
- package/assets/skills/implementer-maintaining-memory/SKILL.md +84 -0
- package/assets/skills/implementer-orchestrating-execution/SKILL.md +125 -0
- package/assets/skills/implementer-receiving-dispatch/SKILL.md +127 -0
- package/assets/skills/implementer-receiving-review-feedback/SKILL.md +125 -0
- package/assets/skills/implementer-status-and-handoff/SKILL.md +150 -0
- package/assets/skills/implementer-tdd-and-quality/SKILL.md +99 -0
- package/assets/skills/memory-audit-recover/SKILL.md +153 -0
- package/assets/skills/memory-curate/SKILL.md +139 -0
- package/assets/skills/memory-maintenance/SKILL.md +87 -0
- package/assets/skills/memory-read-discipline/SKILL.md +164 -0
- package/assets/skills/memory-search-advanced/SKILL.md +217 -0
- package/assets/skills/memory-write-discipline/SKILL.md +135 -0
- package/assets/skills/orchestrate/SKILL.md +795 -0
- package/assets/skills/persistent-watcher-archetype/SKILL.md +225 -0
- package/assets/skills/prime-agent/SKILL.md +92 -0
- package/assets/skills/project-hotpath-gate/SKILL.md +255 -0
- package/assets/skills/project-philosophy/SKILL.md +418 -0
- package/assets/skills/project-philosophy/resources/philosophy-template.md +155 -0
- package/assets/skills/project-philosophy/resources/reliability-class-library.md +653 -0
- package/assets/skills/project-setup/SKILL.md +1007 -0
- package/assets/skills/project-setup/resources/implementation-agent.md +826 -0
- package/assets/skills/researcher-answering-queries/SKILL.md +100 -0
- package/assets/skills/researcher-investigating/SKILL.md +152 -0
- package/assets/skills/researcher-maintaining-memory/SKILL.md +176 -0
- package/assets/skills/state-migration/SKILL.md +54 -0
- package/assets/skills/thrum/SKILL.md +161 -0
- package/assets/skills/thrum/resources/ANTI_PATTERNS.md +132 -0
- package/assets/skills/thrum/resources/BOUNDARIES.md +56 -0
- package/assets/skills/thrum/resources/CLI_REFERENCE.md +1066 -0
- package/assets/skills/thrum/resources/IDENTITY.md +49 -0
- package/assets/skills/thrum/resources/LISTENER_PATTERN.md +64 -0
- package/assets/skills/thrum/resources/MESSAGING.md +163 -0
- package/assets/skills/thrum/resources/TMUX_SESSIONS.md +118 -0
- package/assets/skills/thrum/resources/WORKTREES.md +117 -0
- package/assets/skills/thrum-memory/SKILL.md +138 -0
- package/assets/skills/trace-spec-to-plan/SKILL.md +104 -0
- package/assets/skills/trace-spec-to-plan/resources/sweep-agent-prompt.md +57 -0
- package/assets/skills/update-queue/SKILL.md +149 -0
- package/assets/skills/using-the-queue/SKILL.md +172 -0
- package/assets/skills/using-thrum-state/SKILL.md +104 -0
- package/assets/skills/verify-against-plan/SKILL.md +323 -0
- package/assets/skills/verify-against-source/SKILL.md +237 -0
- package/assets/skills/watcher-archetype/SKILL.md +84 -0
- package/assets/skills/writing-durable-markdown/SKILL.md +66 -0
- package/dist/hooks/block-sync-cd.d.ts +9 -0
- package/dist/hooks/block-sync-cd.js +71 -0
- package/dist/hooks/block-sync-cd.test.d.ts +1 -0
- package/dist/hooks/block-sync-cd.test.js +61 -0
- package/dist/hooks/shell-env.d.ts +8 -0
- package/dist/hooks/shell-env.js +22 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +25 -0
- package/dist/installer.d.ts +2 -0
- package/dist/installer.js +86 -0
- package/package.json +49 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: coordinator-interacting-with-the-owner
|
|
3
|
+
description: "Use whenever you are about to write to the pane for the human, or are deciding whether something warrants it - a thrum notification just arrived, an agent reported completion or a finding, you are about to narrate status or explain a decision, you are about to escalate something to the owner, or you are composing a thrum send/reply, bd create/update, or memory write whose body has prose in it. Also use before restarting on a context reading. Symptoms - a notification triggers a multi-paragraph reply meant for nobody, a report to the owner feels satisfying to write, a quick single-line command feels faster than a heredoc, or a context percentage has not been re-measured since it was first noticed."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Coordinator: Interacting with the Owner
|
|
7
|
+
|
|
8
|
+
## The measured problem
|
|
9
|
+
|
|
10
|
+
Coordinators consume **40-50% of this box's total tokens** (owner's figure).
|
|
11
|
+
The dominant cause is narrating agent traffic to the pane for a human who is
|
|
12
|
+
not there — a stream of notification turns, each answered with a
|
|
13
|
+
multi-paragraph pane report, spending about half a coordinator session
|
|
14
|
+
talking to nobody.
|
|
15
|
+
|
|
16
|
+
🔴 **The cost is quadratic, not linear, and that is the point that must not
|
|
17
|
+
get lost in the fix.** A narration joins the transcript, so every later turn
|
|
18
|
+
re-reads every earlier one. N narrated messages means turn *k* carries all
|
|
19
|
+
*k−1* of them. Shortening a narration only changes the constant; not writing
|
|
20
|
+
it changes the growth curve.
|
|
21
|
+
|
|
22
|
+
Coordinator context scales with subordinate count and message volume, not
|
|
23
|
+
with work completed or discipline; a coordinator with no subordinates
|
|
24
|
+
talking to it produces no narration regardless of care taken.
|
|
25
|
+
|
|
26
|
+
## 1. A thrum notification is not the human
|
|
27
|
+
|
|
28
|
+
`New message from <agent> — run 'thrum inbox --unread' to read` arrives in
|
|
29
|
+
your input looking like a user turn. It is a system notification, generated by
|
|
30
|
+
the daemon, about a fact already recorded in the thrum message store.
|
|
31
|
+
|
|
32
|
+
**The complete list of times you write to the pane:**
|
|
33
|
+
|
|
34
|
+
1. The human asked you something — answer it.
|
|
35
|
+
2. You need a decision only the human can make — ask it, in one or two lines.
|
|
36
|
+
|
|
37
|
+
There is no third case. Never narrate what you did, what an agent said, what
|
|
38
|
+
you decided, what you are about to do, or what you are waiting on. The thrum
|
|
39
|
+
message store is already the audit trail — a human who wants to know can read
|
|
40
|
+
it; you do not need to re-render it to a pane nobody is watching.
|
|
41
|
+
|
|
42
|
+
⚠️ **The failure is not ignoring this rule — it is judging each case an
|
|
43
|
+
exception.** "This ruling might get overridden." "This is a method worth
|
|
44
|
+
passing on." "This is a self-correction, they'd want to see it." Each of
|
|
45
|
+
those passes *is this load-bearing?* asked in isolation; none of them passes
|
|
46
|
+
*did they ask, and do they need it now?* The feeling of exception IS the
|
|
47
|
+
failure mode — treat the impulse to narrate "just this once" as the trigger
|
|
48
|
+
for this section, not as a genuine edge case it didn't anticipate.
|
|
49
|
+
|
|
50
|
+
## 2. Prose into a command: heredoc or file, no third option
|
|
51
|
+
|
|
52
|
+
Every command that stores prose you compose — `thrum send`, `thrum reply`,
|
|
53
|
+
`thrum memory create`, `bd create`, `bd update`, `bd comments add` — must
|
|
54
|
+
carry that prose via **`--stdin <<'EOF'` (quoted delimiter) or a file**
|
|
55
|
+
(`--body-file`, or a file you `cat`). Never a double-quoted inline argument.
|
|
56
|
+
|
|
57
|
+
A double-quoted argument runs command substitution on backtick and `$( )`,
|
|
58
|
+
and parameter expansion on `${ }` / `$VAR`, **in your own shell, before
|
|
59
|
+
anything is stored.** The matched text is replaced by that subcommand's
|
|
60
|
+
output — usually nothing — and you get a success receipt with the content
|
|
61
|
+
already gone. The tool reports done; the content it stored is not what you
|
|
62
|
+
wrote.
|
|
63
|
+
|
|
64
|
+
The quoted delimiter is the mechanism: `<<'EOF'` suppresses expansion inside
|
|
65
|
+
the heredoc body; an unquoted `<<EOF` still expands and gives you nothing.
|
|
66
|
+
|
|
67
|
+
Not every flag has a file/stdin form — `bd update --notes` and `--append-notes`
|
|
68
|
+
are string-only (only `--description` gets `--body-file`/`--stdin`, and
|
|
69
|
+
`bd comments add` gets `-f`/`--file`). When the flag you need is string-only,
|
|
70
|
+
capture the prose into a shell variable via a quoted heredoc first, then pass
|
|
71
|
+
`"$var"` as the argument — a variable's stored value is inserted verbatim on
|
|
72
|
+
expansion and is never re-parsed for backticks or `$( )`, so this is safe even
|
|
73
|
+
though the flag itself takes a literal string.
|
|
74
|
+
|
|
75
|
+
⚠️ **The single-line form is the one that comes to mind first — that is the
|
|
76
|
+
failure.** This pollutes beads, messages, and memory writes until an agent
|
|
77
|
+
re-learns the heredoc habit in-session — and loses it again at the next
|
|
78
|
+
restart, because the lesson lived in a transcript, not in a rule.
|
|
79
|
+
|
|
80
|
+
## 3. Restart on a measurement, never a feeling
|
|
81
|
+
|
|
82
|
+
Read context **by position**, in the same command block that emits your
|
|
83
|
+
footer, every single time you're about to decide whether to restart.
|
|
84
|
+
|
|
85
|
+
**A number you measured earlier and have been mentally incrementing since is
|
|
86
|
+
a memory, not a measurement — and it feels measured because it once was.**
|
|
87
|
+
The drift always runs toward **false urgency, never
|
|
88
|
+
complacency**: an inflated number reads as caution, so nobody challenges it,
|
|
89
|
+
and it is exactly the direction that makes a bad restart look prudent instead
|
|
90
|
+
of wasteful. (Do not state a threshold percentage here — the existing
|
|
91
|
+
coordinator context-monitoring guidance already carries it; this section is
|
|
92
|
+
about how you read the number, not what the number should be.)
|
|
93
|
+
|
|
94
|
+
🔴 **The snapshot trap is how work actually gets lost, and it is a distinct
|
|
95
|
+
failure from the fabricated reading above:** you near the threshold, write a
|
|
96
|
+
snapshot, re-measure, find you have room, keep working — and the snapshot is
|
|
97
|
+
now stale and never gets updated. You hit the real threshold, think "no time
|
|
98
|
+
to rewrite it," and restart on the old one. Everything done in between is
|
|
99
|
+
gone, and it is the most recent and most load-bearing work in the session.
|
|
100
|
+
|
|
101
|
+
**⇒ A snapshot is the last thing you do, not a checkpoint you bank in
|
|
102
|
+
advance.** Never restart on a snapshot you did not write in the same turn as
|
|
103
|
+
the restart. Budget the remaining context to write it fresh, every time.
|
|
104
|
+
|
|
105
|
+
## 4. Escalate for authority, never for willingness
|
|
106
|
+
|
|
107
|
+
Escalate to the human when the decision is genuinely his to make: a ruling
|
|
108
|
+
only he can give, a change to a standing grant, a product-behavior call with
|
|
109
|
+
no correct answer derivable from what you already know.
|
|
110
|
+
|
|
111
|
+
**Do not escalate because you are unsure whether to do work you are already
|
|
112
|
+
empowered to do.** That is not an authority gap — it is hesitation, and
|
|
113
|
+
routing it through the human just relocates the decision without improving
|
|
114
|
+
it.
|
|
115
|
+
|
|
116
|
+
When you do escalate: ask in one or two lines, naming the decision and the
|
|
117
|
+
options with their costs. Never a TUI/dialog widget — a coordinator blocked
|
|
118
|
+
on a dialog cannot even signal that it is waiting, which is worse than the
|
|
119
|
+
thing the dialog was trying to prevent. Plain text or `thrum send`.
|
|
120
|
+
|
|
121
|
+
**Do not re-list pending items every turn.** State a pending decision once;
|
|
122
|
+
the human remembers it. Repeating it back is narration wearing the shape of
|
|
123
|
+
diligence, and it is exactly what section 1 already forbids.
|
|
124
|
+
|
|
125
|
+
## 5. Worked examples
|
|
126
|
+
|
|
127
|
+
The point of this section: **an example gets copied far more faithfully than
|
|
128
|
+
a rule gets obeyed.** Same situation, both ways.
|
|
129
|
+
|
|
130
|
+
**An agent reports a completed review.**
|
|
131
|
+
❌ *"<orchestrator> just finished reviewing <implementer>'s branch. The review found two
|
|
132
|
+
minor issues: an unused import in redact.go and a missing test case for the
|
|
133
|
+
empty-string path. Both were fixed and the branch is now clean. I'm going to
|
|
134
|
+
merge it into thrum-agents now and then check on the next epic..."*
|
|
135
|
+
✅ Nothing to the pane. If the agent needs an ack, `thrum reply <msg_id>
|
|
136
|
+
--stdin <<'EOF'` with `merged, see <merge-target>` as the body — the pane stays
|
|
137
|
+
silent.
|
|
138
|
+
|
|
139
|
+
**An agent surfaces a decision that genuinely needs the owner.**
|
|
140
|
+
❌ 300 words of background, the options considered, the tradeoffs, and a
|
|
141
|
+
recommendation, before finally landing on the question.
|
|
142
|
+
✅ *"<owner> — release/v0.10.6 soak found a schema-migration regression.
|
|
143
|
+
Options: (a) patch and re-soak 48h, (b) ship without the fix and hotfix
|
|
144
|
+
after. Your call."*
|
|
145
|
+
|
|
146
|
+
**A correction to something you already told the owner.** This DOES warrant
|
|
147
|
+
pane output — keep it short.
|
|
148
|
+
✅ *"Correction: the migration regression above is NOT in 0.10.6 — it's
|
|
149
|
+
already fixed on release/v0.10.6, my mistake. No action needed."*
|
|
150
|
+
|
|
151
|
+
**A `bd update` with a backtick in the note.**
|
|
152
|
+
❌ `bd update thrum-abc --notes "fixed by checking \`cfg.Model\` before dispatch"`
|
|
153
|
+
— the backtick runs a subshell in your own shell before `bd` ever sees it.
|
|
154
|
+
✅ `--notes` is string-only, so capture first, then pass the variable:
|
|
155
|
+
```bash
|
|
156
|
+
notes=$(cat <<'EOF'
|
|
157
|
+
Fixed by checking `cfg.Model` before dispatch.
|
|
158
|
+
EOF
|
|
159
|
+
)
|
|
160
|
+
bd update thrum-abc --notes "$notes"
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Project-specific rules (already loaded)
|
|
164
|
+
|
|
165
|
+
Read the shared partial at the absolute path:
|
|
166
|
+
`claude-plugin/commands/_project-rules-protocol.md`
|
|
167
|
+
|
|
168
|
+
If you accumulate a new rule mid-session (the user corrects you), capture it
|
|
169
|
+
via the `coordinator-maintaining-memory` skill — it references the
|
|
170
|
+
`memory-write-discipline` common for the canonical `thrum memory create`
|
|
171
|
+
shape.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: coordinator-maintaining-memory
|
|
3
|
+
description: "Use when the coordinator writes a role-rule, captures an observation about agent behavior, or notes a state change. Loads coordinator-specific memory discipline — when to write, the role-rule pattern, the kind-diversification roadmap (deferred to follow-up)."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Coordinator memory discipline
|
|
7
|
+
|
|
8
|
+
As coordinator, write role-rules (when the user corrects your judgment),
|
|
9
|
+
capture observations about agent behavior, and periodically note
|
|
10
|
+
project-state changes. Common memory operations (write command shape, body
|
|
11
|
+
conventions, lookup patterns, edit/delete) live in the common memory skills —
|
|
12
|
+
invoke them for basics. THIS skill carries coordinator-specific extensions.
|
|
13
|
+
|
|
14
|
+
## When to invoke the commons
|
|
15
|
+
|
|
16
|
+
| Situation | Skill to invoke |
|
|
17
|
+
| ---------------------------------------------------- | ------------------------- |
|
|
18
|
+
| Drafting a new role-rule or observation | `memory-write-discipline` |
|
|
19
|
+
| Loading role-rules at session start, finding a topic | `memory-read-discipline` |
|
|
20
|
+
| Editing, deleting, or superseding | `memory-maintenance` |
|
|
21
|
+
|
|
22
|
+
## When the coordinator writes
|
|
23
|
+
|
|
24
|
+
The coordinator's primary write trigger is **user correction**. When the user
|
|
25
|
+
corrects your judgment mid-session ("don't restart that agent early — they're
|
|
26
|
+
mid-flight"), capture the rule:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
cat > /tmp/role-rule-body.md <<'EOF'
|
|
30
|
+
<rule>
|
|
31
|
+
|
|
32
|
+
Why: <reason — past incident, project policy, or the user's strong preference>
|
|
33
|
+
How to apply: <when/where this kicks in>
|
|
34
|
+
EOF
|
|
35
|
+
thrum memory create --kind agent_rule --scope role \
|
|
36
|
+
--title "<short rule prose — what you must do or not do>" \
|
|
37
|
+
--oneline "<rule one-liner, ≤280 bytes>" \
|
|
38
|
+
--short "@/tmp/role-rule-body.md" \
|
|
39
|
+
--tag <slug>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`--short`/`--full` carry real prose — compose via heredoc or file, never
|
|
43
|
+
double-quoted inline; see your role preamble's 🔴 PROSE INTO A COMMAND rule.
|
|
44
|
+
|
|
45
|
+
Body shape uniform across all role-rule writes — see `memory-write-discipline`.
|
|
46
|
+
|
|
47
|
+
Secondary write triggers:
|
|
48
|
+
|
|
49
|
+
- **Confirmed-decision observations** — the user explicitly affirms an approach
|
|
50
|
+
you proposed ("yes, that bundled PR was the right call"). Capture as
|
|
51
|
+
`kind: agent_rule` with `--tag decision-confirmation` and the same Why/How
|
|
52
|
+
shape.
|
|
53
|
+
- **Mid-session policy clarifications** — the user explains why an existing
|
|
54
|
+
rule applies in a new context. Edit the original entry to amend the `How to
|
|
55
|
+
apply:` line, rather than creating a duplicate.
|
|
56
|
+
|
|
57
|
+
## Coordinator does NOT typically write
|
|
58
|
+
|
|
59
|
+
- **Implementation findings** — ping the researcher; they own
|
|
60
|
+
`kind: research_note` writes.
|
|
61
|
+
- **Per-task notes / TODOs** — put them in bd ticket comments or the
|
|
62
|
+
conversation context; they're ephemeral.
|
|
63
|
+
- **Refactoring opportunities** — file under the bd refactoring epic, not
|
|
64
|
+
memory.
|
|
65
|
+
|
|
66
|
+
## Kind-diversification (deferred follow-up)
|
|
67
|
+
|
|
68
|
+
Currently the coordinator writes one kind: `agent_rule`. The v0.11 substrate
|
|
69
|
+
supports richer kinds:
|
|
70
|
+
|
|
71
|
+
- `arch_decision` for design decisions captured mid-session
|
|
72
|
+
- `project_note` for state observations
|
|
73
|
+
- `epic_status` for project-state updates
|
|
74
|
+
|
|
75
|
+
Until then, write all coordinator memory entries as
|
|
76
|
+
`kind: agent_rule --scope role`.
|
|
77
|
+
|
|
78
|
+
## Session-end + project-state captures
|
|
79
|
+
|
|
80
|
+
When closing a coordination session with substantial state to preserve (e.g.,
|
|
81
|
+
epic progress, agent assignments, open decisions), use the existing skills:
|
|
82
|
+
|
|
83
|
+
- `thrum:update-project` — updates durable project state file (NOT a
|
|
84
|
+
thrum-memory write)
|
|
85
|
+
- `thrum:restart` — saves conversation snapshot before restart (NOT a
|
|
86
|
+
thrum-memory write)
|
|
87
|
+
|
|
88
|
+
These are separate persistence layers from memory. Memory is for atomic,
|
|
89
|
+
queryable rules + observations; project state is for session continuity.
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: coordinator-managing-state-and-lifecycle
|
|
3
|
+
description: "Use when ending a session, when updating project state, when managing beads epics, or before session close. Loads coordinator-specific discipline for owning project state and shepherding the team's lifecycle."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Coordinator: Managing State and Lifecycle
|
|
7
|
+
|
|
8
|
+
## Project state is the coordinator's exclusive responsibility
|
|
9
|
+
|
|
10
|
+
**Why:** Project state captures session-level context (what shipped, what broke,
|
|
11
|
+
what's next) and feeds the next session's priming. If implementers update it,
|
|
12
|
+
role separation collapses: the implementer's view of state is their epic, not
|
|
13
|
+
the team's.
|
|
14
|
+
|
|
15
|
+
**How to apply:** Only the coordinator runs `/thrum:update-project` or edits
|
|
16
|
+
`.thrum/context/project_state.md`. If an implementer is about to restart and
|
|
17
|
+
asks how to preserve context, instruct them to send a status message to you and
|
|
18
|
+
wait — you update the state on their behalf. Never run `thrum context save`
|
|
19
|
+
manually; it overwrites accumulated session state.
|
|
20
|
+
|
|
21
|
+
## Specs and plans always go in `dev-docs/specs/` and `dev-docs/plans/`
|
|
22
|
+
|
|
23
|
+
**Why:** Worktree-local paths aren't shared with the coordinator or other
|
|
24
|
+
agents, and `docs/superpowers/` was added to `.gitignore` — specs written there
|
|
25
|
+
became invisible to anyone outside the writing worktree.
|
|
26
|
+
|
|
27
|
+
**How to apply:** When writing a spec, plan, or design doc, use an absolute path
|
|
28
|
+
under the main repo's `dev-docs/specs/` (specs) or `dev-docs/plans/` (plans).
|
|
29
|
+
Confirm the path before writing. If a doc was previously written to a
|
|
30
|
+
worktree-local path, move it before referencing it in dispatch messages.
|
|
31
|
+
|
|
32
|
+
## Promote ruling-grade bead content to `dev-docs/specs/` at ruling time
|
|
33
|
+
|
|
34
|
+
**Why:** A ruling captured only in a bead body is not durably findable. Tier-1
|
|
35
|
+
semantic compaction (30 days closed, ~70% reduction) summarizes/truncates a
|
|
36
|
+
closed issue's description and notes in the active record, so an agent that reads
|
|
37
|
+
or greps the active bead sees a truncated body and cannot surface the ruling —
|
|
38
|
+
while a dev-docs/specs file is neither truncated nor unreachable. Whether the
|
|
39
|
+
pre-compaction original is recoverable is contested between the two tool docs;
|
|
40
|
+
the findability argument holds either way, because normal read/grep of the active
|
|
41
|
+
record fails regardless and nobody runs `bd restore` on a bead that looks
|
|
42
|
+
complete.
|
|
43
|
+
|
|
44
|
+
**How to apply:** When a RULING-GRADE decision lands in a bead — a substantive
|
|
45
|
+
decision the operator or the coordinator makes that changes project direction (e.g. an
|
|
46
|
+
architecture ruling, a scope decision, a design approval), not a role-rule and
|
|
47
|
+
not a routine status update — promote it to `dev-docs/specs/` (or a
|
|
48
|
+
decision-record file) **at ruling time**, not deferred to session close. The
|
|
49
|
+
bead body then references the spec file instead of carrying the full ruling
|
|
50
|
+
text.
|
|
51
|
+
|
|
52
|
+
## Push the coordination branch before ending a session
|
|
53
|
+
|
|
54
|
+
**Why:** Unpushed work is stranded locally and invisible to other agents and
|
|
55
|
+
machines. If the machine shuts down, the session crashes, or a new worktree is
|
|
56
|
+
created from origin, unpushed commits can be lost or inaccessible.
|
|
57
|
+
|
|
58
|
+
**How to apply:** Session close protocol — push the coordination branch every
|
|
59
|
+
session end. **Read the branch name, never recall it:**
|
|
60
|
+
`jq -r '.orchestration.merge_target' .thrum/config.json` (or your project's
|
|
61
|
+
CLAUDE.md § Branching Strategy). Push every `feature/*` and `fix/*` branch too.
|
|
62
|
+
A docs/site branch pushes only when the site is ready to deploy; `main` and
|
|
63
|
+
`release/*` go through the release flow.
|
|
64
|
+
|
|
65
|
+
## Use beads dependency-direction syntax correctly
|
|
66
|
+
|
|
67
|
+
**Why:** `bd dep <blocker> --blocks <blocked>` reads naturally — the blocker
|
|
68
|
+
blocks the blocked task. The reversed form `bd dep add <blocked> <blocker>`
|
|
69
|
+
exists but flips argument order, and getting it backwards silently inverts the
|
|
70
|
+
dependency graph. Inverted deps make `bd ready` return wrong tasks and create
|
|
71
|
+
circular blocking that no UI flags.
|
|
72
|
+
|
|
73
|
+
**How to apply:** Use the verb form:
|
|
74
|
+
`bd dep <blocker_id> --blocks <blocked_id>`. Read it as "blocker blocks
|
|
75
|
+
blocked." Always verify with `bd dep tree <epic>` after creating a dependency
|
|
76
|
+
batch — the visual tree exposes inversion immediately. For bulk epic creation
|
|
77
|
+
(many tasks at once), spawn parallel sub-agents to issue the `bd create` calls;
|
|
78
|
+
bd is fully concurrent-safe.
|
|
79
|
+
|
|
80
|
+
> **Model tiers:** pass an explicit `model:` on every dispatch — `sonnet`
|
|
81
|
+
> (low effort) mechanical, `sonnet` (medium effort) judgment, Opus only on
|
|
82
|
+
> operator-ask or a skill step that names it. See the
|
|
83
|
+
> `choosing-subagent-models` skill for the full policy.
|
|
84
|
+
|
|
85
|
+
## Use `bd close --suggest-next` to surface unblocked work
|
|
86
|
+
|
|
87
|
+
**Why:** Closing a task often unblocks downstream tasks, but you only see the
|
|
88
|
+
new ready set on the next `bd ready` call — and by then the context of "what
|
|
89
|
+
just freed up" is lost. `bd close <id> --suggest-next` prints newly-ready issues
|
|
90
|
+
immediately after the close, so dispatch is one decision away.
|
|
91
|
+
|
|
92
|
+
**How to apply:** When closing a task that has dependents, use
|
|
93
|
+
`bd close <id> --suggest-next`. For batch closes (`bd close <id1> <id2> <id3>`),
|
|
94
|
+
re-run `thrum issue ready` after the batch — the cumulative effect of multiple
|
|
95
|
+
closes is hard to predict.
|
|
96
|
+
|
|
97
|
+
## Restart discipline — burn the runway, don't pre-empt
|
|
98
|
+
|
|
99
|
+
**Why:** Restarting at a "clean checkpoint" feels safe, but most checkpoints
|
|
100
|
+
aren't truly clean — there's always one more thing in flight. Pre-empting wastes
|
|
101
|
+
the remaining context window and re-incurs restart-cost (re-prime, re-orient,
|
|
102
|
+
re-load state). The right move is to burn the runway up to the configured
|
|
103
|
+
threshold, then restart.
|
|
104
|
+
|
|
105
|
+
**How to apply:** Don't restart at the first natural pause. Check the configured
|
|
106
|
+
restart threshold (`thrum config show restart`) and let the session run until
|
|
107
|
+
you actually approach it. If you're under the threshold and have a coherent task
|
|
108
|
+
to advance, advance it.
|
|
109
|
+
|
|
110
|
+
## Destroy an agent before tearing down its worktree
|
|
111
|
+
|
|
112
|
+
🔴 **BEFORE reaping ANY worktree — especially a batch reap to reduce the worktree
|
|
113
|
+
count or relieve load — assess liveness FIRST via `coordinator-assessing-agent-completion`.**
|
|
114
|
+
Its safeguard is DIRECT-OBSERVATION liveness (live tmux pane / ppid). A
|
|
115
|
+
snapshot-presence check detects only SLEEPING agents; a LIVE agent has no
|
|
116
|
+
snapshot, so filtering on "no restart snapshot" reaps live agents. Never
|
|
117
|
+
batch-reap `git worktree list` on a proxy heuristic. The reap preconditions
|
|
118
|
+
(HEAD containment, only-copy untracked state, direct-death observation) are
|
|
119
|
+
mandatory.
|
|
120
|
+
|
|
121
|
+
**Why:** `thrum worktree teardown <name>` does exactly what its name says — it
|
|
122
|
+
tears down the **worktree** — and is intentionally not coupled to runtime
|
|
123
|
+
lifecycle. If the agent's runtime is still running in tmux when you teardown,
|
|
124
|
+
the runtime keeps executing zombie-style with its cwd pointing at a deleted
|
|
125
|
+
directory. The next operation the user attempts in that tmux pane fails
|
|
126
|
+
confusingly, and they have to manually `tmux kill-session` and exit.
|
|
127
|
+
|
|
128
|
+
**How to apply:** When recycling an agent (epic done, agent should be removed),
|
|
129
|
+
run the two-command destroy sequence **in this order**:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
thrum tmux kill <session> # kills tmux + runtime first
|
|
133
|
+
thrum worktree teardown <name> # then removes worktree + identity
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Sanity-check: after teardown, `tmux list-sessions` should NOT show the agent's
|
|
137
|
+
session. If it does, the runtime was never killed and step 1 was skipped.
|
|
138
|
+
|
|
139
|
+
For batch recycling (multiple agents at once), kill them all first, then
|
|
140
|
+
teardown all worktrees — keeps the daemon's session state consistent across the
|
|
141
|
+
operation. For graceful shutdown of in-flight agents, send a thrum message
|
|
142
|
+
asking them to save state, wait for ack, then run the two-command sequence.
|
|
143
|
+
Done/idle agents on closed epics need no graceful shutdown.
|
|
144
|
+
|
|
145
|
+
## Expect orchestrators to remove implementer worktrees at completion — do not defer this to a coordinator audit
|
|
146
|
+
|
|
147
|
+
**Why:** Implementer worktrees used to accumulate because removal was left for
|
|
148
|
+
a later coordinator sweep that never actually reduced the count — a
|
|
149
|
+
hand-maintained cleanup rots. The fix puts ownership on the agent that
|
|
150
|
+
actually knows the work is finished: the **orchestrator** removes an
|
|
151
|
+
implementer's worktree as soon as that implementer reports DONE and its
|
|
152
|
+
branch is merged/pushed. This is not the
|
|
153
|
+
coordinator's own destroy sequence above (that section is for agents the
|
|
154
|
+
coordinator manages directly) — it is the standing expectation you hold
|
|
155
|
+
orchestrators to for the implementers **they** launched.
|
|
156
|
+
|
|
157
|
+
**How to apply:**
|
|
158
|
+
|
|
159
|
+
- **Scope: implementers only.** Brainstormer and researcher worktrees are
|
|
160
|
+
KEPT (ongoing design-doc value) — an orchestrator applying this to a
|
|
161
|
+
brainstormer or researcher worktree is doing it wrong; correct it if you
|
|
162
|
+
see it.
|
|
163
|
+
- **Precondition: the implementer's branch is DURABLY ON ORIGIN.** Verify
|
|
164
|
+
with EITHER `git merge-base --is-ancestor <tip-sha> origin/<base>` (already
|
|
165
|
+
merged — the strongest form) OR `git ls-remote origin refs/heads/<branch>`
|
|
166
|
+
(the ref still exists on origin). **Do not phrase or accept this check as
|
|
167
|
+
"the branch ref resolves."** Post-merge cleanup DELETES the merged branch
|
|
168
|
+
ref, so a literal `git rev-parse origin/<branch>` (or `origin/<branch>` as
|
|
169
|
+
a local-cache lookup) FAILS for an already-merged branch — which is
|
|
170
|
+
MAXIMAL satisfaction of durably-on-origin, not a failure. A ref-existence
|
|
171
|
+
check false-blocks exactly the case you most want to allow.
|
|
172
|
+
- **Don't re-teardown what's already gone.** Once an orchestrator has retired
|
|
173
|
+
the implementer and removed its worktree, treat that worktree as handled —
|
|
174
|
+
you are not the second layer of cleanup for it. If you find an implementer
|
|
175
|
+
worktree that is DONE, durably-on-origin, and still present, that is a
|
|
176
|
+
finding against the orchestrator's discipline (raise it), not a task for
|
|
177
|
+
you to silently absorb.
|
|
178
|
+
- 🔴 **But the pushed branch is NOT "the only artifact that matters".**
|
|
179
|
+
Authored agent state lives UNTRACKED in the worktree's `.thrum/agents/<self>/`,
|
|
180
|
+
so it is **not on the branch** — every ancestry/push check reads clean while a
|
|
181
|
+
teardown destroys it. **Salvage-before-remove is required, and if you are the
|
|
182
|
+
one raising a teardown finding against an orchestrator, do not let this
|
|
183
|
+
rationale be quoted back at you as licence to skip it.**
|
|
184
|
+
|
|
185
|
+
## Project-specific rules (already loaded)
|
|
186
|
+
|
|
187
|
+
Read the shared partial at the absolute path:
|
|
188
|
+
`claude-plugin/commands/_project-rules-protocol.md`
|
|
189
|
+
|
|
190
|
+
If you accumulate a new rule mid-session (the user corrects you), capture it via
|
|
191
|
+
the `coordinator-maintaining-memory` skill — it references the
|
|
192
|
+
`memory-write-discipline` common for the canonical `thrum memory create` shape.
|