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,186 @@
1
+ ---
2
+ description:
3
+ Park this agent for operator-initiated wake with a comprehensive 16-section
4
+ snapshot (does NOT signal coordinator) then thrum-tmux-kills own session. Use
5
+ for designer/architect-grade work where wake may be cold and must recover wire
6
+ contracts + capability matrix + design rationale.
7
+ ---
8
+
9
+ # Sleep — Extended (16-section snapshot)
10
+
11
+ Compose a comprehensive 16-section prose continuation, write it directly to your
12
+ restart file, then end session cleanly and kill own tmux session. The agent goes
13
+ to sleep until the operator wakes it later. Same termination semantics as
14
+ `/thrum:sleep`; the only difference is snapshot grade.
15
+
16
+ ## When to use extended vs standard
17
+
18
+ - **Use `/thrum:sleep` (standard)** for routine park-and-resume where future-you
19
+ can reconstruct from project state + a compact 11-section snapshot.
20
+ - **Use `/thrum:sleep-extended` (this variant)** for designer/architect-grade
21
+ work: parking a complex brainstorm with multiple owner-decided forks, parking a
22
+ fanout implementation (≥3 call sites or ≥2 epics), or any sleep where the next
23
+ wake may be a fresh restart and must recover wire-contract precision without
24
+ re-reading the source files.
25
+
26
+ ## Steps
27
+
28
+ ### 1. Resolve identity + verify tmux session (Tier 1 pre-check; run BEFORE anything else)
29
+
30
+ ```bash
31
+ # Resolve identity + your worktree (needed before reading the partial).
32
+ # $REPO must be YOUR worktree — the directory `thrum prime` reads the restart
33
+ # snapshot back from. Resolve it from the daemon's authoritative identity, NOT
34
+ # `git rev-parse` (which keys off the current shell CWD and would write to the
35
+ # wrong .thrum/restart/ if a bash step left your worktree). Fall back to git
36
+ # only if whoami can't answer.
37
+ REPO=$(thrum whoami --field worktree 2>/dev/null)
38
+ [ -n "$REPO" ] || REPO=$(git rev-parse --show-toplevel) || { echo "ERROR: cannot resolve your worktree"; exit 1; }
39
+ AGENT=$(thrum whoami --field agent_id) || { echo "ERROR: agent not registered"; exit 1; }
40
+ [ -n "$AGENT" ] || { echo "ERROR: empty agent_id"; exit 1; }
41
+ mkdir -p "${REPO}/.thrum/restart"
42
+
43
+ # Tier 1 pre-check: tmux session must exist BEFORE writing snapshot:
44
+ SESSION=$(thrum whoami --field tmux_session)
45
+ if [ -z "$SESSION" ]; then
46
+ echo "ERROR: the sleep-extended command requires a tmux-managed agent session (tmux_session field is empty)."
47
+ echo "Use the restart-extended command for non-tmux sessions."
48
+ exit 1
49
+ fi
50
+ ```
51
+
52
+ If `tmux_session` is empty: ABORT before writing any snapshot. No status change,
53
+ no session end. Exit code 1.
54
+
55
+ ### 2. Read the shared snapshot-composition partial
56
+
57
+ Read the partial at the absolute path:
58
+
59
+ ```text
60
+ ${REPO}/claude-plugin/commands/_snapshot-protocol.md
61
+ ```
62
+
63
+ Apply its Step 2 (compose your continuation) per the structure guidance.
64
+
65
+ **Use the EXTENDED 16-section structure.** The structure block is `§1.` through
66
+ `§16.` with per-section guidance documented in the partial.
67
+
68
+ **Note on §3 framing:** For sleep snapshots, §3 frames as "where work stands at
69
+ park time" rather than "what shipped" — the agent is parking, not completing.
70
+ Composition discipline (1–3 sentences, specific, load-bearing-first) is
71
+ identical to restart-extended.
72
+
73
+ ### 3. Write the continuation
74
+
75
+ Per Step 3 of the partial, use the Write tool to save your composed continuation
76
+ to `${REPO}/.thrum/restart/${AGENT}.md`. On next boot, `thrum prime`
77
+ auto-injects this file — same mechanism as restart wake.
78
+
79
+ ### 4. Back up important files to your durable agents folder (survives worktree teardown)
80
+
81
+ **Your worktree may be torn down while you sleep — and if it is, YOUR SNAPSHOT
82
+ GOES WITH IT unless you do this step.**
83
+
84
+ 🔴 **READ THIS CAREFULLY.** A worktree's `.thrum/` is a REAL LOCAL DIRECTORY. The
85
+ `redirect` inside it is just a plain text FILE containing a path — a pointer
86
+ thrum's code consults. The filesystem redirects nothing. Your worktree keeps its
87
+ own local `agents/`, `context/`, `identities/`, and `restart/`.
88
+
89
+ **THE ACTUAL MECHANISM:** your snapshot at `<worktree>/.thrum/restart/<agent-id>.md`
90
+ is **worktree-local**. It is copied into the main repo **only when you WAKE** —
91
+ `thrum prime` reads it from the worktree and archives it to
92
+ `<main-repo>/.thrum/agents/<agent-id>/sessions/`. **Then and only then.** So a
93
+ teardown that happens BEFORE your wake destroys the snapshot, permanently, and
94
+ nothing warns you. This matters more for an extended snapshot: you are parking
95
+ wire contracts, a capability matrix, and design rationale that are expensive to
96
+ reconstruct and exist nowhere else.
97
+
98
+ **Leave the snapshot where it is** — `thrum prime` reads it from the worktree on
99
+ wake, so that path is correct and required. **Additionally**, copy anything you
100
+ need to survive teardown to the MAIN REPO PATH, resolved explicitly:
101
+
102
+ ```bash
103
+ # Resolve the main repo's .thrum from the redirect FILE (do not assume a path).
104
+ MAIN_THRUM=$(cat "${REPO}/.thrum/redirect" 2>/dev/null) || MAIN_THRUM="${REPO}/.thrum"
105
+ mkdir -p "${MAIN_THRUM}/agents/${AGENT}"
106
+ cp "${REPO}/.thrum/restart/${AGENT}.md" "${MAIN_THRUM}/agents/${AGENT}/last-sleep-snapshot.md"
107
+ # ...and any other artifact you need on wake.
108
+ ls -la "${MAIN_THRUM}/agents/${AGENT}/last-sleep-snapshot.md" # VERIFY IT LANDED
109
+ ```
110
+
111
+ Copy there: reports / findings you authored, important uncommitted artifacts, and
112
+ anything your resume plan references.
113
+
114
+ **VERIFY THE COPY EXISTS AT THE MAIN PATH before ending your session.** Do not
115
+ trust `cp`'s exit code — list the destination file. This step is your ONLY
116
+ recoverability guarantee against teardown-while-asleep; the redirect is not one.
117
+
118
+ ### 5. Mark agent operational status idle
119
+
120
+ ```bash
121
+ thrum agent set-status idle
122
+ ```
123
+
124
+ `idle` is the signal that this agent has parked. NO new "sleeping" state was
125
+ added — `idle` covers both "no active work" and "parked for operator wake."
126
+
127
+ If `thrum agent set-status` returns an error, continue to Step 6 — the snapshot
128
+ on disk is the load-bearing artifact.
129
+
130
+ ### 6. End session cleanly
131
+
132
+ ```bash
133
+ thrum session end
134
+ ```
135
+
136
+ This emits `agent.session.end` cleanly so the dead-agent sweeper does NOT treat
137
+ the disconnect as a crash.
138
+
139
+ ### 7. Kill own tmux session
140
+
141
+ ```bash
142
+ thrum tmux kill "$SESSION"
143
+ ```
144
+
145
+ Tmux pane terminates → runtime process exits → no further activity until
146
+ operator wakes the agent.
147
+
148
+ ## How wake works
149
+
150
+ On runtime start, `thrum prime` auto-injects the snapshot — same mechanism as
151
+ restart. Resume from §16 immediate-next-actions.
152
+
153
+ **Two wake paths, NOT interchangeable — pick by WHO is waking you.**
154
+
155
+ **A. THE OPERATOR (a human at a terminal):** `thrum tmux start` from the agent's
156
+ own working directory — create + launch + prime + attach in one.
157
+
158
+ **B. ANOTHER AGENT (e.g. a coordinator):** path A will FAIL for you by design —
159
+ running it from someone else's worktree fires the `cross_worktree` identity guard
160
+ (`pid_mismatch`), which exists to stop one agent assuming another's identity and
161
+ is working correctly when it blocks you. Instead:
162
+
163
+ ```bash
164
+ # 1. PROVE THE STALE PID IS DEAD — DIRECT OBSERVATION, never from the DB.
165
+ ps -p <identity-pid> -o pid=,lstart=,comm= # must return NOTHING
166
+ tmux list-panes -a -F '#{pane_pid}' | grep -w <identity-pid> # must return NOTHING
167
+ # If either shows life: STOP. Not parked. Do not force.
168
+
169
+ # 2. SALVAGE FIRST if the snapshot is not already in the main repo — it is
170
+ # worktree-local until wake (see Step 4). Forcing is safe; losing is not.
171
+
172
+ # 3. Create, replacing the stale identity. Quickstart flags are REQUIRED.
173
+ thrum tmux create <name> --cwd <worktree> \
174
+ --name <agent-id> --role <role> --module <module> \
175
+ --model <model> --effort <effort> --force
176
+
177
+ # 4. Launch; the runtime re-binds the identity on start.
178
+ thrum tmux launch <name>
179
+ ```
180
+
181
+ `--force` replaces the STALE IDENTITY FILE (`tmux.create.identity-replaced`); it
182
+ does NOT touch the snapshot — which is why prove-dead and salvage come first.
183
+ Forcing against a LIVE agent would evict a working agent from its own identity.
184
+
185
+ The snapshot file moves to `.thrum/agents/<your-agent-id>/sessions/` archive on
186
+ wake (same as restart).
@@ -0,0 +1,212 @@
1
+ ---
2
+ description:
3
+ Park this agent for operator-initiated wake. Saves a standard 11-section
4
+ snapshot (does NOT signal coordinator) then thrum-tmux-kills own session. Use
5
+ when the operator is shutting down (e.g. computer restart) and the agent
6
+ should resume from snapshot on next boot.
7
+ ---
8
+
9
+ # Sleep — Park Until Operator Wake
10
+
11
+ Compose a standard 11-section prose continuation, write it directly to your
12
+ restart file, then end session cleanly and kill own tmux session. The agent goes
13
+ to sleep until the operator wakes it later via
14
+ `thrum tmux create <session-name>`. Unlike `/thrum:restart`, sleep does NOT
15
+ signal the coordinator and does NOT wait for an external mover — it terminates
16
+ its own tmux session.
17
+
18
+ ## When to Use
19
+
20
+ - The operator is shutting down the machine (e.g. computer restart) and wants
21
+ this agent's work durably parked.
22
+ - The operator wants to free a tmux session slot but resume this agent's work
23
+ later.
24
+ - You (the agent) decide independently that further progress requires the
25
+ operator's attention later, not the coordinator's now.
26
+
27
+ For routine context-exhaustion / rate-limit restarts where the coordinator
28
+ should bring you back in-place, use `/thrum:restart` instead.
29
+
30
+ ## Steps
31
+
32
+ ### 1. Resolve identity + verify tmux session (Tier 1 pre-check; run BEFORE anything else)
33
+
34
+ ```bash
35
+ # Resolve identity + your worktree (needed before reading the partial).
36
+ # $REPO must be YOUR worktree — the directory `thrum prime` reads the restart
37
+ # snapshot back from. Resolve it from the daemon's authoritative identity, NOT
38
+ # `git rev-parse` (which keys off the current shell CWD and would write to the
39
+ # wrong .thrum/restart/ if a bash step left your worktree). Fall back to git
40
+ # only if whoami can't answer.
41
+ REPO=$(thrum whoami --field worktree 2>/dev/null)
42
+ [ -n "$REPO" ] || REPO=$(git rev-parse --show-toplevel) || { echo "ERROR: cannot resolve your worktree"; exit 1; }
43
+ AGENT=$(thrum whoami --field agent_id) || { echo "ERROR: agent not registered"; exit 1; }
44
+ [ -n "$AGENT" ] || { echo "ERROR: empty agent_id"; exit 1; }
45
+ mkdir -p "${REPO}/.thrum/restart"
46
+
47
+ # Tier 1 pre-check: tmux session must exist BEFORE writing snapshot:
48
+ SESSION=$(thrum whoami --field tmux_session)
49
+ if [ -z "$SESSION" ]; then
50
+ echo "ERROR: the sleep command requires a tmux-managed agent session (tmux_session field is empty)."
51
+ echo "Use the restart command for non-tmux sessions."
52
+ exit 1
53
+ fi
54
+ ```
55
+
56
+ If `tmux_session` is empty: ABORT before writing any snapshot. No status change,
57
+ no session end. Exit code 1. The skill is the wrong tool for non-tmux agents.
58
+
59
+ ### 2. Read the shared snapshot-composition partial
60
+
61
+ Read the partial at the absolute path:
62
+
63
+ ```text
64
+ ${REPO}/claude-plugin/commands/_snapshot-protocol.md
65
+ ```
66
+
67
+ Apply its Step 2 (compose your continuation) per the structure guidance.
68
+
69
+ **Use the STANDARD 11-section structure.** For comprehensive
70
+ designer/architect-grade snapshots, use `/thrum:sleep-extended` instead.
71
+
72
+ **Note on §1 framing:** For sleep snapshots, the Big Picture section frames as
73
+ "where work stands at park time" rather than "what shipped" — the agent is
74
+ parking, not completing. Composition discipline (1–3 sentences, specific,
75
+ load-bearing-first) is identical to restart.
76
+
77
+ ### 3. Write the continuation
78
+
79
+ Per Step 3 of the partial, use the Write tool to save your composed continuation
80
+ to `${REPO}/.thrum/restart/${AGENT}.md`. On next boot, `thrum prime`
81
+ auto-injects this file — same mechanism as restart wake.
82
+
83
+ ### 4. Back up important files to your durable agents folder (survives worktree teardown)
84
+
85
+ **Your worktree may be torn down while you sleep — and if it is, YOUR SNAPSHOT
86
+ GOES WITH IT unless you do this step.**
87
+
88
+ 🔴 **READ THIS CAREFULLY.** A worktree's `.thrum/` is a REAL LOCAL DIRECTORY. The
89
+ `redirect` inside it is just a plain text FILE containing a path — a pointer
90
+ thrum's code consults. The filesystem redirects nothing. Your worktree keeps its
91
+ own local `agents/`, `context/`, `identities/`, and `restart/`.
92
+
93
+ **THE ACTUAL MECHANISM:** your snapshot at `<worktree>/.thrum/restart/<agent-id>.md`
94
+ is **worktree-local**. It is copied into the main repo **only when you WAKE** —
95
+ `thrum prime` reads it from the worktree and archives it to
96
+ `<main-repo>/.thrum/agents/<agent-id>/sessions/`. **Then and only then.** So a
97
+ teardown that happens BEFORE your wake destroys the snapshot, permanently, and
98
+ nothing warns you.
99
+
100
+ **Leave the snapshot where it is** — `thrum prime` reads it from the worktree on
101
+ wake, so that path is correct and required. **Additionally**, copy anything you
102
+ need to survive teardown to the MAIN REPO PATH, resolved explicitly:
103
+
104
+ ```bash
105
+ # Resolve the main repo's .thrum from the redirect FILE (do not assume a path).
106
+ MAIN_THRUM=$(cat "${REPO}/.thrum/redirect" 2>/dev/null) || MAIN_THRUM="${REPO}/.thrum"
107
+ mkdir -p "${MAIN_THRUM}/agents/${AGENT}"
108
+ cp "${REPO}/.thrum/restart/${AGENT}.md" "${MAIN_THRUM}/agents/${AGENT}/last-sleep-snapshot.md"
109
+ # ...and any other artifact you need on wake.
110
+ ls -la "${MAIN_THRUM}/agents/${AGENT}/last-sleep-snapshot.md" # VERIFY IT LANDED
111
+ ```
112
+
113
+ Copy there: reports / findings you authored, important uncommitted artifacts, and
114
+ anything your resume plan references.
115
+
116
+ **VERIFY THE COPY EXISTS AT THE MAIN PATH before ending your session.** Do not
117
+ trust `cp`'s exit code — list the destination file. This step is your ONLY
118
+ recoverability guarantee against teardown-while-asleep; the redirect is not one.
119
+
120
+ ### 5. Mark agent operational status idle
121
+
122
+ ```bash
123
+ thrum agent set-status idle
124
+ ```
125
+
126
+ `idle` is the signal that this agent has parked. NO new "sleeping" state was
127
+ added — `idle` covers both "no active work" and "parked for operator wake."
128
+
129
+ If `thrum agent set-status` returns an error (e.g. rate-limited), continue to
130
+ Step 6 — the snapshot on disk is the load-bearing artifact, not the status
131
+ field. The operator can set status post-wake.
132
+
133
+ ### 6. End session cleanly
134
+
135
+ ```bash
136
+ thrum session end
137
+ ```
138
+
139
+ This emits an `agent.session.end` event cleanly so the dead-agent sweeper does
140
+ NOT later treat the disconnect as a crash. If `thrum session end` fails,
141
+ continue to Step 7.
142
+
143
+ ### 7. Kill own tmux session
144
+
145
+ ```bash
146
+ thrum tmux kill "$SESSION"
147
+ ```
148
+
149
+ Tmux pane terminates → runtime process exits → no further activity until
150
+ operator wakes the agent via `thrum tmux create <session-name>`.
151
+
152
+ **If Step 7 fails with "anonymous caller cannot invoke":** `thrum session end`
153
+ (Step 6) severs the daemon binding, so `thrum tmux kill` may be rejected if the
154
+ daemon hasn't yet processed the CallerWorktree self-kill path. Use the raw tmux
155
+ fallback — the lifecycle safeguards (snapshot, status idle, session end) were
156
+ already discharged by Steps 1-6, so nothing is lost:
157
+
158
+ ```bash
159
+ tmux kill-session -t "$SESSION"
160
+ ```
161
+
162
+ ## How wake works
163
+
164
+ On runtime start, `thrum prime` auto-injects the snapshot at
165
+ `.thrum/restart/<your-agent-id>.md` — same mechanism used by restart. Resume
166
+ from §9 (Numbered resume plan).
167
+
168
+ **Two wake paths, and they are NOT interchangeable — pick by WHO is waking you.**
169
+
170
+ **A. THE OPERATOR (a human, at a terminal):** `thrum tmux start` from the agent's
171
+ own working directory. That is create + launch + prime + attach in one, and it is
172
+ the simplest path.
173
+
174
+ **B. ANOTHER AGENT (e.g. a coordinator waking a parked agent):** the operator path
175
+ will FAIL for you, by design. Running `thrum tmux start` from someone else's
176
+ worktree fires the `cross_worktree` identity guard (`pid_mismatch`) — that guard
177
+ exists to stop one agent assuming another's identity, and it is working correctly
178
+ when it blocks you. Use this instead, in order:
179
+
180
+ ```bash
181
+ # 1. PROVE THE STALE PID IS DEAD — by DIRECT OBSERVATION, never from the DB.
182
+ ps -p <identity-pid> -o pid=,lstart=,comm= # must return NOTHING
183
+ tmux list-panes -a -F '#{pane_pid}' | grep -w <identity-pid> # must return NOTHING
184
+ # If either shows life, STOP. The agent is not parked; do not force anything.
185
+
186
+ # 2. SALVAGE FIRST if the snapshot is not already in the main repo — it is
187
+ # worktree-local until wake (see Step 4 above). Forcing is safe; losing is not.
188
+
189
+ # 3. Create, replacing the stale identity. The quickstart flags are REQUIRED —
190
+ # without --name/--role/--module this fails with "quickstart flags required".
191
+ thrum tmux create <name> --cwd <worktree> \
192
+ --name <agent-id> --role <role> --module <module> \
193
+ --model <model> --effort <effort> --force
194
+
195
+ # 4. Launch the runtime; it re-binds the identity on start.
196
+ thrum tmux launch <name>
197
+ ```
198
+
199
+ `--force` replaces the STALE IDENTITY FILE (you will see
200
+ `tmux.create.identity-replaced`). It does **not** touch the snapshot — that is why
201
+ step 1 (prove dead) and step 2 (salvage) come first. Forcing against a LIVE agent
202
+ would evict a working agent from its own identity.
203
+
204
+ The snapshot file moves to `.thrum/agents/<your-agent-id>/sessions/` archive on
205
+ wake (same as restart). Worst-case fallback: previous Claude session may be
206
+ resumable via Claude Code's native session-continuation mechanism.
207
+
208
+ ## Programmatic use (operator shutdown scripts)
209
+
210
+ The underlying mechanic — write snapshot + set status idle + session end + tmux
211
+ kill — can be invoked from an operator's shutdown script directly via the bash
212
+ commands above (without going through the skill).
@@ -0,0 +1,12 @@
1
+ ---
2
+ description: Show active team members
3
+ ---
4
+
5
+ List all active agents with their roles, modules, and current intents.
6
+
7
+ ```bash
8
+ thrum team # Human-readable
9
+ thrum team --json # Machine-readable
10
+ ```
11
+
12
+ Use `thrum ping @name` to check if a specific agent is online.
@@ -0,0 +1,259 @@
1
+ ---
2
+ description: Update project state with session summary and mechanical state
3
+ ---
4
+
5
+ Update `.thrum/context/project_state.md` with fresh project state so a new
6
+ session can pick up exactly where this one left off.
7
+
8
+ **Do this IN YOUR OWN CONTEXT. Do NOT delegate it to a subagent.**
9
+
10
+ This is a named exception to the general dispatch discipline in your role
11
+ preamble ("delegate essentially all investigation to sub-agents to preserve
12
+ your context"). That rule is correct and stays — it protects your context from
13
+ repetitive investigation a subagent can do just as well. update-project is
14
+ different in kind: it is not investigation, it is the **serialisation of
15
+ context that exists only in your own head**. A subagent works from a brief you
16
+ hand it and can only render what the brief contains. What gets lost is exactly
17
+ what makes the artifact worth having — the rulings and their reasoning, the
18
+ corrections and *why*, which claims were VERIFIED versus merely assumed, and
19
+ which of this session's confident statements turned out WRONG. If you could
20
+ summarize those faithfully into a brief, you would already have written the
21
+ state yourself. Two more reasons this delegation is pure downside here
22
+ specifically: (1) you are already live with the session loaded — a subagent
23
+ re-processes context you already hold, at extra cost, from a summary instead
24
+ of the full session; (2) update-project runs only at session end, immediately
25
+ before a restart — there is no "later work" this session to protect, so the
26
+ usual token-saving justification for delegating does not apply.
27
+
28
+ ### Step 1: Compose Your Session Summary
29
+
30
+ From YOUR context (what you already know), write a brief summary covering:
31
+
32
+ - **Session number**: Increment from the current project_state.md's session
33
+ number (check `Phase` line or latest session heading)
34
+ - **What you worked on**: Key tasks, epics, beads progressed or closed
35
+ - **What changed**: Files modified, features shipped, bugs fixed
36
+ - **Key decisions**: Architecture choices, approach changes, investigations done
37
+ - **Current state**: What's in progress, what's blocked, what's next
38
+
39
+ This is the most valuable input — only you have the session narrative. Keep it
40
+ concise but complete (10-30 lines). You gather the mechanical state yourself in
41
+ the next step.
42
+
43
+ ### Step 2: Gather Mechanical State Yourself
44
+
45
+ Run this ONE compound command directly in your own turn — do not dispatch it
46
+ to a subagent:
47
+
48
+ ```bash
49
+ cd REPO_ROOT && \
50
+ echo "=== GIT LOG ===" && git --no-pager log --oneline -15 && \
51
+ echo "=== GIT STATUS ===" && git branch --show-current && git status --short && \
52
+ echo "=== BEADS STATS ===" && bd stats 2>&1 && \
53
+ echo "=== OPEN EPICS ===" && (bd list --status=open --type=epic 2>/dev/null || echo "(none)") && \
54
+ echo "=== READY ISSUES ===" && (bd ready -n 5 2>/dev/null || echo "(none)")
55
+ ```
56
+
57
+ (Replace `REPO_ROOT` with the absolute path to the project root.)
58
+
59
+ ### Step 3: Read the Current File
60
+
61
+ Read `REPO_ROOT/.thrum/context/project_state.md` in full, yourself, using the
62
+ Read tool.
63
+
64
+ ### Step 3.5: Staleness Check First (Parallel Fan-Out)
65
+
66
+ Before you edit anything, verify what's actually still true. Stale rows in
67
+ this file are how a coordinator ends up citing a merged bead as open or a torn-down
68
+ worktree as active — the fan-out below catches that before you write, not after.
69
+
70
+ This is narrower than the no-delegation rule above and does not conflict with
71
+ it: these sub-agents verify facts, they do not compose the session narrative
72
+ and they do not edit the file. You still write every Edit call yourself in
73
+ Step 4.
74
+
75
+ Dispatch one **read-only**, background sub-agent per section, each scoped to
76
+ exactly one section and returning only a verified-stale delete-list plus an
77
+ unsure-list (unsure ⇒ keep, never delete on a guess):
78
+
79
+ 1. `## Current State Summary` — for each cited SHA, `git merge-base
80
+ --is-ancestor <sha> origin/<merge_target>`; for each cited bead, `bd show
81
+ <id>`.
82
+ 2. `## Open Epics / Active Work` — `bd show` each bead ID; rows whose bead is
83
+ CLOSED are stale.
84
+
85
+ Consolidate the delete-lists yourself, then fold the confirmed-stale
86
+ rows into the section edits in Step 4. Fan-out keeps this fast without
87
+ sacrificing thoroughness — a single-threaded pass over independent
88
+ sections is the slow path, not the safe one.
89
+
90
+ **Deploy state, fleet topology, worktree layout, agent pool, and standing
91
+ rulings are NOT maintained here anymore** — they live in `thrum state`
92
+ (`--kind deploy_state|topology|worktree|agent_pool|ruling`), a cheap `thrum
93
+ state set` upsert done at the moment a fact changes, not part of this
94
+ end-of-session ritual. Staleness for those kinds is read-time (`as_of` +
95
+ per-kind threshold), not something this command curates.
96
+
97
+ ### Step 4: Edit the File In-Place, Yourself
98
+
99
+ Use the **Edit tool** directly to make targeted updates. Do NOT rewrite the
100
+ entire file with the Write tool. Make one Edit call per section that needs
101
+ updating.
102
+
103
+ #### Sections to Update (use Edit tool for each)
104
+
105
+ 1. **Header line** — Update `Last Updated` date and `Phase` status summary. Also
106
+ derive and insert the Authored-against stamp, placing it immediately after
107
+ the `Last Updated` line (see `claude-plugin/commands/_stamp-protocol.md`
108
+ for the exact two-line format).
109
+
110
+ 2. **Current State Summary — LIVE STATE ONLY, SUPERSEDED EACH SESSION.**
111
+ Update version, branch, beads counts, and hold *only* what is currently
112
+ in flight, owed, blocked, or pending the owner's decision. It carries
113
+ **no session narrative** — no "what we did", no "why", no derivation.
114
+ - **This is a SUPERSESSION, not an append.** Rewrite it to reflect
115
+ current reality; do not add this session's items on top of last
116
+ session's.
117
+ - **Resolved items are DELETED, not annotated.** Do not leave a
118
+ "~~fixed in S42~~" line — remove the line entirely. The line's absence
119
+ *is* the record that it's resolved; the memory record (rule 4 below) is
120
+ where the resolution's story lives.
121
+ - Bounding only the session-index entries (rule 4/5 below) is a point fix:
122
+ if narrative is merely blocked from `## Recent Sessions`, it reappears
123
+ here under a different heading with no cap at all — the identical
124
+ growth, one section over. This rule closes that sibling surface.
125
+
126
+ 3. **Architecture Health table** (STRICT 10-row rolling window):
127
+ - The table has a **Session / Date** column — format: `S<N> · YYYY-MM-DD`
128
+ (e.g. `S32 · 2026-04-14`)
129
+ - Add new rows for work done this session at the TOP of the table
130
+ - Then TRIM: keep only the 10 most recent rows PLUS any row currently in a
131
+ broken/regressed state (statuses like BROKEN, REGRESSED, BLOCKED, or a
132
+ note explicitly describing ongoing breakage). Drop all other historical
133
+ COMPLETE/FIXED/MOVED/UPDATED rows — they live in git history + Recent
134
+ Sessions below
135
+ - This is a rolling window, not an append log. If the table is at 10 and
136
+ you add 2 new rows, remove 2 of the oldest non-broken rows
137
+ - Do NOT add rows for routine work already covered in Recent Sessions —
138
+ only genuinely new capabilities, architectural shifts, or broken state
139
+
140
+ 4. **Recent Sessions** — EVERY session, including the one you are closing
141
+ right now, is exactly ONE LINE. No session ever gets a prose block.
142
+ - For the session being closed, emit a `session_summary` memory record:
143
+ ```
144
+ thrum memory create \
145
+ --kind session_summary \
146
+ --scope project \
147
+ --title "Session N — <title>" \
148
+ --oneline "<one-line summary>" \
149
+ --short "<short narrative (2-4 sentences)>" \
150
+ --full "<full session body>"
151
+ ```
152
+ Capture the returned memory ID (e.g. `thrum-mem-01HQXZ...`).
153
+ - Append a **single index line** to the `## Recent Sessions` block in
154
+ project_state.md — no body prose, ever:
155
+ ```
156
+ - Session N (YYYY-MM-DD) — <what changed, ≤30 words> — [mem:<id>]
157
+ ```
158
+ - **The cap is on WORDS, not on newlines.** A 200-word run-on sentence
159
+ crammed onto one physical line VIOLATES this rule just as much as a
160
+ multi-line prose block does. Count words; keep the line ≤30 of them.
161
+ - The full body lives in the memory record and is retrieved on demand via
162
+ `thrum memory show <id>` or surfaced by the progressive-disclosure prime.
163
+ - **What goes where** — the mechanical tell for sorting content: if a
164
+ sentence contains "because", "I verified", "the mechanism was", "caught
165
+ by", or "control fired", that sentence is DERIVATION, not state, and it
166
+ belongs in the memory record, never in project_state.md.
167
+ | Content | Destination |
168
+ | --- | --- |
169
+ | What changed | The one-line session index entry |
170
+ | How you concluded it / verified it / why an earlier claim was wrong / what it taught | `thrum memory`, never project_state.md |
171
+ | What's currently in flight, owed, blocked, or pending the owner | `## Current State Summary` (rule 2 above) |
172
+
173
+ **NOTE:** the old `update-agent-state` / `update-state` skills (State.md
174
+ surface, MI1) were retired — superseded by `thrum state` (personal_state
175
+ kind). This command (`update-project`) is unaffected; it always governed
176
+ `project_state.md`, a separate surface.
177
+
178
+ 5. **Session History Update Rule** (CRITICAL — keeps this cheap):
179
+ - **At most TEN index entries in `## Recent Sessions`.** Older entries are
180
+ **DELETED**, not archived in-file or moved to another section — the
181
+ memory record IS the archive, so deleting the 11th line loses nothing.
182
+ - **Adding this session's line and deleting the overflow line happen in
183
+ the SAME edit / SAME commit.** Do not split "append now, trim later"
184
+ into two steps; there is no later step. Emit the memory record, append
185
+ the new index line, and delete the 11th-oldest line (if present)
186
+ together.
187
+ - Do NOT re-write or re-consolidate the other index lines you keep — they
188
+ are frozen once written. The section stays compact indefinitely because
189
+ it is bounded at 10, not because entries shrink over time.
190
+
191
+ 6. **Open Epics / Active Work** — Replace with current epic list from beads.
192
+
193
+ 7. **What's Queued / Next Steps** — Update priorities based on current state.
194
+
195
+ #### Edit Rules
196
+
197
+ - Use the Edit tool's old_string / new_string to target specific sections
198
+ - Each Edit should replace a clearly bounded section (between headings)
199
+ - Do NOT touch sections that haven't changed
200
+ - Do NOT re-write frozen `## Recent Sessions` index lines you are keeping
201
+ - Preserve all markdown formatting and heading hierarchy
202
+ - Use ABSOLUTE paths for all file operations
203
+
204
+ ### Step 5: Verify Before Finishing
205
+
206
+ Run these checks yourself before reporting done — this is a required step,
207
+ not advice you may skip:
208
+
209
+ - `wc -l` the file BEFORE your edits and AFTER — report both counts.
210
+ - Count the entries under `## Recent Sessions` — must be **≤10**.
211
+ - Word-count the newly added session index line — must be **≤30 words**.
212
+ - Confirm no `## Sxxx` (or any other) prose block exists for any session —
213
+ every entry in `## Recent Sessions` is a single index line.
214
+ - If the file GREW, state the reason. Growth is not automatically wrong
215
+ (a legitimately new structural section can grow it), but an update that
216
+ grows the file with no stated reason is a defect, not a style choice.
217
+
218
+ ### Step 6: Report What You Changed
219
+
220
+ State directly (no subagent summary to relay):
221
+ - Which sections were edited
222
+ - Architecture Health: N rows dropped, N rows added, final count
223
+ - Recent Sessions: entry count before/after (must be ≤10), and the
224
+ word count of the new entry (must be ≤30)
225
+ - Line count before/after (Step 5)
226
+ - Any issues encountered
227
+
228
+ ## CRITICAL Rules
229
+
230
+ - Use the EDIT tool, not the Write tool — targeted changes only
231
+ - Architecture Health table is a **strict 10-row rolling window** + broken
232
+ rows. Never let it grow beyond that
233
+ - **`## Recent Sessions` — every session is ONE LINE, no exceptions, including
234
+ the session you are closing right now.** At most **10** entries; older ones
235
+ are **deleted**, not archived in-file — the memory record is the archive.
236
+ Deletion of the overflow entry happens in the **same edit** as the addition
237
+ of the new one; it is one step, never two. The line cap is **≤30 words**,
238
+ measured on words, not physical newlines — a long run-on sentence on one
239
+ line still violates this.
240
+ - **`## Current State Summary` is superseded each session, never appended
241
+ to.** It holds only what is in flight/owed/blocked/pending the owner.
242
+ Resolved items are deleted outright, not annotated as resolved. Session
243
+ narrative and derivation NEVER belong here — that is what `thrum memory`
244
+ is for.
245
+ - Do NOT touch stable sections (Key Architecture Files, etc.) unless they
246
+ changed
247
+ - Target total file size: ~150-300 lines for a SMALL project. A mature project
248
+ will legitimately be larger and that is not bloat to be trimmed. The bounded
249
+ part is SESSION HISTORY — those bodies now live in `session_summary` memories
250
+ with a one-line index entry for the ~10 most recent, and older sessions are
251
+ recoverable via `thrum memory search`. The rest (schema-compat contract,
252
+ merge protocol, architecture decisions) is DURABLE STRUCTURAL DATA that a
253
+ restarting agent needs in order to act safely; shrinking it costs more than
254
+ it saves. Do not trim structural sections to hit a line count. (Deploy
255
+ state, fleet topology, worktree layout, agent pool, and standing rulings
256
+ are no longer in this file at all — see the note above Step 4's section
257
+ list.)
258
+ - **Do not delegate any part of this to a subagent.** See the reasoning at the
259
+ top of this file — it is a deliberate, named exception, not an oversight.