teamsmith 0.0.0-stage → 0.1.2

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 (245) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +158 -2
  3. package/bin/team.mjs +59 -0
  4. package/install.sh +94 -0
  5. package/package.json +37 -4
  6. package/skills/teamsmith/CHANGELOG.md +763 -0
  7. package/skills/teamsmith/SKILL.md +312 -0
  8. package/skills/teamsmith/extension/team-bg.ts +435 -0
  9. package/skills/teamsmith/extension/team-inbox-watch.ts +1412 -0
  10. package/skills/teamsmith/extension/team-notify.ts +663 -0
  11. package/skills/teamsmith/references/agent-adapters.md +643 -0
  12. package/skills/teamsmith/references/config.md +477 -0
  13. package/skills/teamsmith/references/meeting.md +124 -0
  14. package/skills/teamsmith/references/memory.md +133 -0
  15. package/skills/teamsmith/references/migration.md +227 -0
  16. package/skills/teamsmith/references/openspec.md +222 -0
  17. package/skills/teamsmith/references/philosophy.md +95 -0
  18. package/skills/teamsmith/references/protocol.md +712 -0
  19. package/skills/teamsmith/references/troubleshooting.md +1384 -0
  20. package/skills/teamsmith/references/workflows.md +448 -0
  21. package/skills/teamsmith/scripts/lib/cmd-agents.sh +1709 -0
  22. package/skills/teamsmith/scripts/lib/cmd-bg.sh +284 -0
  23. package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +311 -0
  24. package/skills/teamsmith/scripts/lib/cmd-config.sh +1156 -0
  25. package/skills/teamsmith/scripts/lib/cmd-death.sh +562 -0
  26. package/skills/teamsmith/scripts/lib/cmd-docs.sh +149 -0
  27. package/skills/teamsmith/scripts/lib/cmd-draft.sh +124 -0
  28. package/skills/teamsmith/scripts/lib/cmd-init.sh +212 -0
  29. package/skills/teamsmith/scripts/lib/cmd-meeting.sh +904 -0
  30. package/skills/teamsmith/scripts/lib/cmd-outbox.sh +196 -0
  31. package/skills/teamsmith/scripts/lib/cmd-project.sh +642 -0
  32. package/skills/teamsmith/scripts/lib/cmd-review.sh +1393 -0
  33. package/skills/teamsmith/scripts/lib/cmd-status.sh +1399 -0
  34. package/skills/teamsmith/scripts/lib/cmd-update.sh +191 -0
  35. package/skills/teamsmith/scripts/lib/cmd-watch.sh +1681 -0
  36. package/skills/teamsmith/scripts/lib/common.sh +4964 -0
  37. package/skills/teamsmith/scripts/lib/draft-entry.sh +51 -0
  38. package/skills/teamsmith/scripts/lib/outbox.sh +2042 -0
  39. package/skills/teamsmith/scripts/lib/tmux-argv.sh +165 -0
  40. package/skills/teamsmith/scripts/monitor.mjs +616 -0
  41. package/skills/teamsmith/scripts/panel/README.md +192 -0
  42. package/skills/teamsmith/scripts/panel/build.sh +47 -0
  43. package/skills/teamsmith/scripts/panel/bun.lock +109 -0
  44. package/skills/teamsmith/scripts/panel/draft-send.sh +68 -0
  45. package/skills/teamsmith/scripts/panel/package.json +24 -0
  46. package/skills/teamsmith/scripts/panel/panel.js +388 -0
  47. package/skills/teamsmith/scripts/panel/src/App.tsx +2150 -0
  48. package/skills/teamsmith/scripts/panel/src/clipboard.ts +154 -0
  49. package/skills/teamsmith/scripts/panel/src/compose.ts +691 -0
  50. package/skills/teamsmith/scripts/panel/src/data.ts +555 -0
  51. package/skills/teamsmith/scripts/panel/src/format.ts +50 -0
  52. package/skills/teamsmith/scripts/panel/src/layout.ts +2562 -0
  53. package/skills/teamsmith/scripts/panel/src/main.tsx +894 -0
  54. package/skills/teamsmith/scripts/panel/src/markdown.ts +340 -0
  55. package/skills/teamsmith/scripts/panel/src/sanitize.ts +42 -0
  56. package/skills/teamsmith/scripts/panel/src/settings.ts +154 -0
  57. package/skills/teamsmith/scripts/panel/src/strings/en.ts +416 -0
  58. package/skills/teamsmith/scripts/panel/src/strings/index.ts +65 -0
  59. package/skills/teamsmith/scripts/panel/src/strings/types.ts +9 -0
  60. package/skills/teamsmith/scripts/panel/src/strings/zh.ts +414 -0
  61. package/skills/teamsmith/scripts/panel/src/theme.ts +116 -0
  62. package/skills/teamsmith/scripts/panel/src/types.ts +652 -0
  63. package/skills/teamsmith/scripts/panel/src/width.ts +105 -0
  64. package/skills/teamsmith/scripts/panel/tsconfig.json +16 -0
  65. package/skills/teamsmith/scripts/shim/signal-gate +156 -0
  66. package/skills/teamsmith/scripts/shim/tmux +403 -0
  67. package/skills/teamsmith/scripts/team +143 -0
  68. package/skills/teamsmith/templates/AGENTS.section.md.tmpl +147 -0
  69. package/skills/teamsmith/templates/BOARD.md.tmpl +18 -0
  70. package/skills/teamsmith/templates/DECISIONS.md.tmpl +22 -0
  71. package/skills/teamsmith/templates/OWNERSHIP.md.tmpl +25 -0
  72. package/skills/teamsmith/templates/PROTOCOL.md.tmpl +84 -0
  73. package/skills/teamsmith/templates/ROADMAP.md.tmpl +29 -0
  74. package/skills/teamsmith/templates/config.sh.tmpl +106 -0
  75. package/skills/teamsmith/templates/memory-seed.md.tmpl +46 -0
  76. package/skills/teamsmith/templates/pm-prompt.md.tmpl +110 -0
  77. package/skills/teamsmith/templates/report.md.tmpl +36 -0
  78. package/skills/teamsmith/templates/task.md.tmpl +65 -0
  79. package/skills/teamsmith/templates/threads-README.md +17 -0
  80. package/skills/teamsmith/tests/bg-ledger-harness.mjs +682 -0
  81. package/skills/teamsmith/tests/bg-ledger.sh +307 -0
  82. package/skills/teamsmith/tests/checkout-shape-probe.sh +800 -0
  83. package/skills/teamsmith/tests/config-cli.sh +1562 -0
  84. package/skills/teamsmith/tests/container-tmux.sh +493 -0
  85. package/skills/teamsmith/tests/coverage-inventory.sh +173 -0
  86. package/skills/teamsmith/tests/death-cause.sh +564 -0
  87. package/skills/teamsmith/tests/delivery-truth.sh +1231 -0
  88. package/skills/teamsmith/tests/fake-tui.py +450 -0
  89. package/skills/teamsmith/tests/fixtures/delivery-truth-real/README.md +60 -0
  90. package/skills/teamsmith/tests/fixtures/delivery-truth-real/judge-second.py +139 -0
  91. package/skills/teamsmith/tests/fixtures/delivery-truth-real/mock-server.py +29 -0
  92. package/skills/teamsmith/tests/fixtures/delivery-truth-real/observe.ts +20 -0
  93. package/skills/teamsmith/tests/fixtures/delivery-truth-real/run-case.sh +79 -0
  94. package/skills/teamsmith/tests/fixtures/delivery-truth-real/scenario.sh +175 -0
  95. package/skills/teamsmith/tests/fixtures/p55/flip-p49.sh +229 -0
  96. package/skills/teamsmith/tests/fixtures/p71-incident/README.md +22 -0
  97. package/skills/teamsmith/tests/fixtures/p71-incident/dev2.seen +8 -0
  98. package/skills/teamsmith/tests/fixtures/p71-incident/dev2.wake +9 -0
  99. package/skills/teamsmith/tests/fixtures/p71-incident/pm-nudges.wake +3 -0
  100. package/skills/teamsmith/tests/fixtures/signal-lint-cases.txt +40 -0
  101. package/skills/teamsmith/tests/flip-glue.sh +162 -0
  102. package/skills/teamsmith/tests/flip-m12-26c.sh +129 -0
  103. package/skills/teamsmith/tests/flip-m12.sh +185 -0
  104. package/skills/teamsmith/tests/flip-m16.sh +166 -0
  105. package/skills/teamsmith/tests/flip-m17.sh +204 -0
  106. package/skills/teamsmith/tests/flip-m33.sh +284 -0
  107. package/skills/teamsmith/tests/flip-m34.sh +96 -0
  108. package/skills/teamsmith/tests/flip-m37.sh +185 -0
  109. package/skills/teamsmith/tests/flip-m4.3.sh +375 -0
  110. package/skills/teamsmith/tests/flip-m43.sh +128 -0
  111. package/skills/teamsmith/tests/flip-m44.sh +262 -0
  112. package/skills/teamsmith/tests/flip-m45.sh +244 -0
  113. package/skills/teamsmith/tests/flip-m46.sh +238 -0
  114. package/skills/teamsmith/tests/flip-m48.sh +304 -0
  115. package/skills/teamsmith/tests/flip-m6.2.sh +205 -0
  116. package/skills/teamsmith/tests/flip-m6.3.sh +283 -0
  117. package/skills/teamsmith/tests/flip-m6.4.sh +267 -0
  118. package/skills/teamsmith/tests/flip-m6.5.sh +113 -0
  119. package/skills/teamsmith/tests/flip-m7.1.sh +135 -0
  120. package/skills/teamsmith/tests/flip-m7.2.sh +321 -0
  121. package/skills/teamsmith/tests/flip-p144.sh +112 -0
  122. package/skills/teamsmith/tests/flip-p156.sh +133 -0
  123. package/skills/teamsmith/tests/flip-p158.sh +301 -0
  124. package/skills/teamsmith/tests/flip-p160.sh +182 -0
  125. package/skills/teamsmith/tests/flip-p171.sh +249 -0
  126. package/skills/teamsmith/tests/flip-p18.1.sh +95 -0
  127. package/skills/teamsmith/tests/flip-p20.sh +286 -0
  128. package/skills/teamsmith/tests/flip-p201.sh +249 -0
  129. package/skills/teamsmith/tests/flip-p210.sh +239 -0
  130. package/skills/teamsmith/tests/flip-p211.sh +152 -0
  131. package/skills/teamsmith/tests/flip-p217.sh +288 -0
  132. package/skills/teamsmith/tests/flip-p22.sh +123 -0
  133. package/skills/teamsmith/tests/flip-p23.sh +239 -0
  134. package/skills/teamsmith/tests/flip-p25.sh +165 -0
  135. package/skills/teamsmith/tests/flip-p71.sh +184 -0
  136. package/skills/teamsmith/tests/flip-p72.sh +202 -0
  137. package/skills/teamsmith/tests/frames/README.md +176 -0
  138. package/skills/teamsmith/tests/frames/p78-conversation-rule-below-box.txt +6 -0
  139. package/skills/teamsmith/tests/frames/p78-cursor-mid-draft.txt +6 -0
  140. package/skills/teamsmith/tests/frames/p78-draft-rule-below-cursor-line.txt +6 -0
  141. package/skills/teamsmith/tests/frames/p78-draft-rule-below-cursor.txt +6 -0
  142. package/skills/teamsmith/tests/frames/p78-draft-rule-blank-region.txt +6 -0
  143. package/skills/teamsmith/tests/frames/p78-draft-rule-only.txt +5 -0
  144. package/skills/teamsmith/tests/frames/p78-spinner-row-below-cursor.txt +6 -0
  145. package/skills/teamsmith/tests/frames/p78-wider-rule-below-cursor.txt +6 -0
  146. package/skills/teamsmith/tests/frames/p86-f1-mixed-width-disjoint-box.txt +8 -0
  147. package/skills/teamsmith/tests/frames/p86-f1-narrower-width-disjoint-box.txt +8 -0
  148. package/skills/teamsmith/tests/frames/p86-f1-spinner-top-disjoint-box.txt +8 -0
  149. package/skills/teamsmith/tests/frames/pi-0.85.1-update-banner.txt +30 -0
  150. package/skills/teamsmith/tests/frames/pi-0.87.0-draft-half-sentence.txt +30 -0
  151. package/skills/teamsmith/tests/frames/pi-0.87.0-empty-box.txt +30 -0
  152. package/skills/teamsmith/tests/frames/pi-0.87.0-one-line-draft.txt +30 -0
  153. package/skills/teamsmith/tests/frames/pi-0.87.0-project-trust-prompt.txt +30 -0
  154. package/skills/teamsmith/tests/frames/pi-0.99.2-empty-editor.txt +32 -0
  155. package/skills/teamsmith/tests/frames/pi-0.99.2-human-draft.txt +32 -0
  156. package/skills/teamsmith/tests/frames/pi-1.0.0-git-error-in-box.txt +32 -0
  157. package/skills/teamsmith/tests/gate-guard.sh +112 -0
  158. package/skills/teamsmith/tests/guard-matrix.sh +233 -0
  159. package/skills/teamsmith/tests/install-shape.sh +731 -0
  160. package/skills/teamsmith/tests/ledger-ban.sh +612 -0
  161. package/skills/teamsmith/tests/lib/box-judge.sh +68 -0
  162. package/skills/teamsmith/tests/lib/checkout-shape.sh +129 -0
  163. package/skills/teamsmith/tests/lib/loop-scan.awk +114 -0
  164. package/skills/teamsmith/tests/lib/pty-wait.sh +676 -0
  165. package/skills/teamsmith/tests/lib/section-guard.sh +855 -0
  166. package/skills/teamsmith/tests/lib/shell-lex.pl +261 -0
  167. package/skills/teamsmith/tests/lib/tmp-root.sh +528 -0
  168. package/skills/teamsmith/tests/lib/tmux-cap.sh +35 -0
  169. package/skills/teamsmith/tests/lib/tmux-iso-call-probe.sh +81 -0
  170. package/skills/teamsmith/tests/lib/tmux-iso-probe.sh +46 -0
  171. package/skills/teamsmith/tests/lib/tmux-iso.sh +381 -0
  172. package/skills/teamsmith/tests/load-experiment.sh +290 -0
  173. package/skills/teamsmith/tests/loop-inventory.tsv +84 -0
  174. package/skills/teamsmith/tests/panel-b2-slow-stub.sh +19 -0
  175. package/skills/teamsmith/tests/panel-b2.sh +1183 -0
  176. package/skills/teamsmith/tests/panel-b3-pty-mouse.py +240 -0
  177. package/skills/teamsmith/tests/panel-b3-pty-tmux-mouse.py +138 -0
  178. package/skills/teamsmith/tests/panel-b3-stub.sh +279 -0
  179. package/skills/teamsmith/tests/panel-b3.sh +1301 -0
  180. package/skills/teamsmith/tests/panel-choices.sh +572 -0
  181. package/skills/teamsmith/tests/panel-clipboard-model.ts +187 -0
  182. package/skills/teamsmith/tests/panel-compose-model.ts +290 -0
  183. package/skills/teamsmith/tests/panel-contrast.mjs +81 -0
  184. package/skills/teamsmith/tests/panel-cpu-premise.sh +173 -0
  185. package/skills/teamsmith/tests/panel-cpu.sh +391 -0
  186. package/skills/teamsmith/tests/panel-flip-m54.sh +207 -0
  187. package/skills/teamsmith/tests/panel-flip-p123.sh +278 -0
  188. package/skills/teamsmith/tests/panel-flip-p125.sh +318 -0
  189. package/skills/teamsmith/tests/panel-flip-p128.sh +259 -0
  190. package/skills/teamsmith/tests/panel-keyprobe-pty.py +99 -0
  191. package/skills/teamsmith/tests/panel-keyprobe-stub.sh +41 -0
  192. package/skills/teamsmith/tests/panel-keyprobe.sh +82 -0
  193. package/skills/teamsmith/tests/panel-keyprobe.tsx +116 -0
  194. package/skills/teamsmith/tests/panel-knobs.sh +83 -0
  195. package/skills/teamsmith/tests/panel-p21.sh +2181 -0
  196. package/skills/teamsmith/tests/panel-snapshots.sh +802 -0
  197. package/skills/teamsmith/tests/panel-strings.mjs +195 -0
  198. package/skills/teamsmith/tests/perf.sh +740 -0
  199. package/skills/teamsmith/tests/pm-box-real.sh +350 -0
  200. package/skills/teamsmith/tests/pulse-nudge-key.sh +563 -0
  201. package/skills/teamsmith/tests/routes.sh +1652 -0
  202. package/skills/teamsmith/tests/section-budgets.tsv +150 -0
  203. package/skills/teamsmith/tests/section-guard.sh +231 -0
  204. package/skills/teamsmith/tests/section-needs-audit.sh +94 -0
  205. package/skills/teamsmith/tests/section-paths.tsv +142 -0
  206. package/skills/teamsmith/tests/section-select.sh +655 -0
  207. package/skills/teamsmith/tests/signal-gate.sh +366 -0
  208. package/skills/teamsmith/tests/signal-lint-legacy.txt +14 -0
  209. package/skills/teamsmith/tests/signal-lint.pl +416 -0
  210. package/skills/teamsmith/tests/skill-load.mjs +65 -0
  211. package/skills/teamsmith/tests/smoke.sh +19711 -0
  212. package/skills/teamsmith/tests/snapshots/zh-dark-120-detail.txt +32 -0
  213. package/skills/teamsmith/tests/snapshots/zh-dark-120-p4.txt +32 -0
  214. package/skills/teamsmith/tests/snapshots/zh-dark-120.txt +32 -0
  215. package/skills/teamsmith/tests/snapshots/zh-dark-160-p4.txt +32 -0
  216. package/skills/teamsmith/tests/snapshots/zh-dark-160.txt +32 -0
  217. package/skills/teamsmith/tests/snapshots/zh-dark-59-detail.txt +32 -0
  218. package/skills/teamsmith/tests/snapshots/zh-dark-59-p4.txt +32 -0
  219. package/skills/teamsmith/tests/snapshots/zh-dark-59.txt +32 -0
  220. package/skills/teamsmith/tests/snapshots/zh-dark-99-p4.txt +32 -0
  221. package/skills/teamsmith/tests/snapshots/zh-dark-99.txt +32 -0
  222. package/skills/teamsmith/tests/snapshots/zh-light-120-detail.txt +32 -0
  223. package/skills/teamsmith/tests/snapshots/zh-light-120-p4.txt +32 -0
  224. package/skills/teamsmith/tests/snapshots/zh-light-120.txt +32 -0
  225. package/skills/teamsmith/tests/snapshots/zh-light-160-p4.txt +32 -0
  226. package/skills/teamsmith/tests/snapshots/zh-light-160.txt +32 -0
  227. package/skills/teamsmith/tests/snapshots/zh-light-59-detail.txt +32 -0
  228. package/skills/teamsmith/tests/snapshots/zh-light-59-p4.txt +32 -0
  229. package/skills/teamsmith/tests/snapshots/zh-light-59.txt +32 -0
  230. package/skills/teamsmith/tests/snapshots/zh-light-99-p4.txt +32 -0
  231. package/skills/teamsmith/tests/snapshots/zh-light-99.txt +32 -0
  232. package/skills/teamsmith/tests/spec-ledger-refs.tsv +78 -0
  233. package/skills/teamsmith/tests/spec-refs.sh +826 -0
  234. package/skills/teamsmith/tests/task-header-model.sh +267 -0
  235. package/skills/teamsmith/tests/team-bg-flip.sh +239 -0
  236. package/skills/teamsmith/tests/team-bg-harness.mjs +392 -0
  237. package/skills/teamsmith/tests/team-bg-stop.sh +434 -0
  238. package/skills/teamsmith/tests/team-inbox-watch-flip.sh +191 -0
  239. package/skills/teamsmith/tests/team-inbox-watch-harness.mjs +1559 -0
  240. package/skills/teamsmith/tests/tmp-hygiene.sh +1190 -0
  241. package/skills/teamsmith/tests/tmux-lint-legacy.txt +31 -0
  242. package/skills/teamsmith/tests/tmux-lint.pl +604 -0
  243. package/skills/teamsmith-init/SKILL.md +100 -0
  244. package/skills/teamsmith-init/references/bootstrap.md +74 -0
  245. package/skills/teamsmith-init/templates/bootstrap-prompt.md.tmpl +46 -0
@@ -0,0 +1,448 @@
1
+ # Runbook
2
+
3
+ Every section is a command sequence you can copy as is. By default `team` means `bash <skill>/scripts/team` (once it
4
+ is on PATH or symlinked, just `team`).
5
+
6
+ ---
7
+
8
+ ## 0. The OpenSpec pipeline: five phases, five gates
9
+
10
+ What the tool **must hold** is written as OpenSpec requirements; a task brief is one work slice that satisfies some
11
+ of them (reasoning and guidance stay in `references/`). A change runs as **five phases, one brief and one owner
12
+ each** — the reasoning, owners and gates are in [openspec.md](openspec.md):
13
+
14
+ | # | Phase | Owner | Gate before the next phase |
15
+ |---|---|---|---|
16
+ | 1 | `opsx-explore` | an explorer worker (never the eventual implementer) | the PM accepts the approach, records it in `DECISIONS.md`, writes the propose brief |
17
+ | 2 | `opsx-propose` | the explorer, same agent (planning only — no code) | the PM's **proposal review is ACCEPTED** in `reviews/<change>-proposal.md`: `openspec validate --all --strict` green + the eight-point checklist |
18
+ | 3 | `opsx-apply` | a dev worker | independent verification is dispatched to a different agent |
19
+ | 4 | `opsx-verify` | an **independent** verify agent | the PM re-runs the gate on the merged tree and sets `done` |
20
+ | 5 | `opsx-archive` | the PM | the user confirms (the PM may act as the user's proxy only when it says so and records why) |
21
+
22
+ ```bash
23
+ openspec list --specs # capabilities and their requirement counts
24
+ openspec validate --all --strict # structural gate — the first step of TEAM_GATES
25
+ openspec archive -y <name> # merges the deltas into openspec/specs/ and moves the change to changes/archive/
26
+ ```
27
+
28
+ The phase commands are generated per project: `openspec init --tools pi` writes `.pi/prompts/opsx-*.md`, and
29
+ `openspec update` refreshes them (`openspec init --tools none` creates only the spec root). The two hard rules:
30
+ **no `apply` brief before the PM's proposal review is ACCEPTED**, and **no archive before independent verification
31
+ plus the user's confirmation**. A change that needs more than one work block stays open across several briefs,
32
+ verified one by one, archived only after the last one landed.
33
+
34
+ ## A. Assembling a team in a new project
35
+
36
+ New-project setup lives in the **`teamsmith-init`** skill: it carries the ordered question checklist (dependencies,
37
+ session/roster/models, gates, VCS mode, install command, the project's ROADMAP/OWNERSHIP/AGENTS.md red lines), the
38
+ `team bootstrap` command and the handoff back here. Read `skills/teamsmith-init/SKILL.md` before running anything;
39
+ the command's own behaviour is in
40
+ [../../teamsmith-init/references/bootstrap.md](../../teamsmith-init/references/bootstrap.md).
41
+
42
+ ## B. Dispatching the first task
43
+
44
+ ```bash
45
+ # one-command setup (recommended): bash <skill>/scripts/team bootstrap
46
+ # github mode: create the issue first (optional but recommended: the issue is the requirement, the brief is the execution)
47
+ printf '# skeleton and quality gates\n\n## DoD\n- ...\n' > /tmp/issue.md
48
+ # create the issue your own way: gh / curl against the API / the web UI (the skill neither takes part nor assumes a forge)
49
+ gh issue create --title "[T1.1] skeleton and quality gates" --body-file /tmp/issue.md
50
+
51
+ bash <skill>/scripts/team task T1.1 --title "skeleton and quality gates" --agent dev --issue 12
52
+ $EDITOR docs/team/tasks/T1.1-*.md # write background/deliverables/boundaries/acceptance commands
53
+
54
+ bash <skill>/scripts/team add-agent dev --create # only --create creates the worktree (the default prints the git command)
55
+ bash <skill>/scripts/team dispatch dev T1.1 docs/team/tasks/T1.1-*.md
56
+ bash <skill>/scripts/team dispatch dev T1.1 docs/team/tasks/T1.1-*.md --print # just want to see the prompt
57
+ ```
58
+
59
+ Dispatch does this: guards (memory, model concurrency, **session size vs the model window**) → builds the prompt
60
+ (scope, red lines, delivery process) → starts an interactive pi in `<session>:dev` (`--session-id <session>-dev`,
61
+ `-e` loading the notify extension, `--skill` loading this skill) → **waits for launch proof**: the pane harness
62
+ writes a per-attempt nonce right before it execs the agent, and only that proof is reported as success (the line
63
+ says the launch was verified). No proof → the window is killed, one retry is made, and the command reports a clear
64
+ failure ("the dispatch was sent but the launch could not be confirmed") with what to check. A dispatch never claims
65
+ success for a command that never ran.
66
+
67
+ Resuming: dispatch the same agent for the same task and the session is reused; `--fresh` starts a new one
68
+ (`<session>-<agent>-<timestamp>`; the old history stays in its own file). Use `--fresh` when the task is new and the
69
+ session carries a long history from an earlier task, when you switch model family/provider, or when the session is
70
+ wedged (the `Context full` / connection-error loop — troubleshooting §4a).
71
+
72
+ **One agent, one unfinished task.** Before launching, dispatch also reads what that agent is already carrying: the
73
+ recorded task (`state/<agent>.env`), its board row and the worktree's checked-out branch. If another task is still
74
+ unfinished — no non-`FAIL` review record, its branch tip is not in the protected branch, the board is not
75
+ `done`/`closed`/`dropped` — the dispatch is **refused**. The refusal names that task, its board status, the branch
76
+ the worktree sits on now, why the task still counts as unfinished, and the two ways out: finish it
77
+ (`team resume --agent <a>`, then verify/merge) or take the window over on purpose with
78
+ `team dispatch <a> <ID> <taskfile> --force`. `--force` prints the override in the dispatch output and appends a line
79
+ to `state/watchdog.log`, so a takeover is never silent; it covers only this refusal — a worktree parked on another
80
+ task's branch is still refused by the branch-identity guard (troubleshooting §4e).
81
+
82
+ Nothing changes on the paths that are not stacking: re-dispatching the agent's **own** task is the resume/recovery
83
+ path and is never refused, a task that is already reviewed, merged or decided by the board behaves exactly as before,
84
+ and when the state cannot be determined (no `state/<agent>.env`, an empty `task=`, no worktree, an unreadable
85
+ branch) the dispatch proceeds and prints one line naming the missing signal instead of guessing. One id that matches
86
+ **more than one** brief (`docs/team/tasks/<ID>-*.md`, e.g. after the title changed) is refused with both paths
87
+ listed: the glob order is not a decision procedure, so rename or drop the stale brief (or give it its own id) first.
88
+
89
+ Before resuming, dispatch compares the session's size with the selected model's window (estimate = session JSONL
90
+ bytes ÷ 4, crude on purpose; the window comes from `TEAM_MODEL_WINDOWS`, otherwise from Pi's model directory,
91
+ otherwise a conservative `TEAM_SESSION_WARN_TOKENS`) and **refuses** when the history does not fit. Two ways out:
92
+ `--fresh` (recommended) or `--allow-overflow` (you accept the risk; the refusal becomes a loud warning).
93
+ `team roster` and `team ps` show the same numbers next to the model (`used/window`, `?` when the window cannot be
94
+ resolved), so the mismatch is visible before dispatching; `--print` is guarded the same way.
95
+
96
+ ## C. Watching / asking / steering
97
+
98
+ ```bash
99
+ tmux attach -t myproj # watch directly (Ctrl-b d to leave)
100
+ bash <skill>/scripts/team say dev "hands off packages/api for now, that is api's directory" # one-line message (for multi-line, write a file for the agent to read)
101
+ bash <skill>/scripts/team thread dev "add an RLS test to T1.1 acceptance" --from pm --re T1.1
102
+ ```
103
+
104
+ **Be specific when asking**: name the failing command, expected vs. actual, and require a reproduction before the fix.
105
+
106
+ ## D. The PM loop (every 10~30 minutes)
107
+
108
+ ```bash
109
+ bash <skill>/scripts/team digest # pending work: new notifications + reports to verify + board + capacity/liveness
110
+ bash <skill>/scripts/team inbox --ack # read and mark as read
111
+ bash <skill>/scripts/team roster # who is running, branch, dirty files, ahead of the protected branch, unpushed commits
112
+ bash <skill>/scripts/team ps # capacity (RAM/swap/how many more fit) + model concurrency + PM/pulse liveness
113
+ bash <skill>/scripts/team up # one-shot repair: session/PM/agents that stopped without delivering
114
+ ```
115
+
116
+ `digest` §[4] measures the push state **against `@{upstream}`** (`git rev-list --count @{upstream}..HEAD`), never
117
+ against the protected branch: a branch that was pushed and then squash-merged stays "1 ahead of main" forever, and
118
+ treating that as "unpushed" sent the PM after a task that was already finished. `roster` therefore prints two
119
+ different columns — `ahead` (vs the protected branch) and `unpushed` (vs `@{upstream}`, where `-` means there is no
120
+ upstream at all, so the push state **cannot be judged**). §[4] only asks for a push when there really are unpushed
121
+ commits, says `no upstream (cannot judge unpushed)` when there is none, and keeps "ahead of main" as its own label.
122
+
123
+ A **squash-merged** branch is recognised instead of being reported as pending wrap-up: when the branch tip's tree
124
+ equals the tree of one of the last `TEAM_SQUASH_LOOKBACK` commits on the protected branch, `roster`/`digest` say
125
+ "already merged (squash, same content)" and stop suggesting a push. It is a documented heuristic (one tree
126
+ comparison); a squash older than that window, or one that changed something else as well, falls back to the honest
127
+ `ahead N` — the safe direction.
128
+
129
+ §[3] only points the PM at `team review <ID>` when the report is **committed on the task branch**, because the
130
+ reviewer reads the report from a checkout of that branch. A report that still lives only in an agent's working tree
131
+ is listed as "report not committed yet — wait for the agent to deliver" instead (the line stays visible; nothing is
132
+ silently dropped).
133
+
134
+ The same list is the pulse's wake-up counter — `pending verification N` is computed by the very function §[3]
135
+ renders (board `done`/`closed` skipped, drafts listed but *not* counted), and a long-lived patrol process
136
+ re-executes itself as soon as `scripts/lib/**` changes on disk, so the reason it wakes the PM is never older than
137
+ the digest the PM then reads.
138
+
139
+ When a "turn ended" notification arrives, look at `git -C .worktrees/<a> log --oneline -5` and `status` first, then
140
+ decide: dispatch the next task, send it back, or verify. After a long absence (end of day, machine reboot): **run
141
+ `team up` first**.
142
+
143
+ ## E. Verification (the PM's independent check, never skipped)
144
+
145
+ ```bash
146
+ git -C <root> worktree add --detach /tmp/review-T1.1 task/T1.1-* # the PM prepares an independent checkout
147
+ bash <skill>/scripts/team review T1.1 --dir /tmp/review-T1.1 # runs gates only + writes the verification record
148
+ bash <skill>/scripts/team review T1.1 --dir /tmp/review-T1.1 --no-gates # manual review only
149
+ ```
150
+
151
+ Artefact `docs/team/reviews/T1.1.md`: HEAD, diffstat, commit list, file list, tail of the gate output, verdict
152
+ checklist. When the gates fail the command returns non-zero — do not ignore it.
153
+
154
+ **The PM also has to read the diff**: gates only prove "the existing tests did not fail", not "the implementation
155
+ matches the brief".
156
+
157
+ **A gate that takes tens of minutes must not sit inside a turn.** teamsmith's own background lane is the default
158
+ on Pi (§E2); `team doctor` reports the harness and the plugins this project carries (`harness` /
159
+ `已装插件 packages` — information, never a recommendation); the background-tmux-window fallback plus the four delivery
160
+ rules are in [references/troubleshooting.md](troubleshooting.md) §17.
161
+
162
+ ### E2. The PM's background gate (the team's own lane, no extra window)
163
+
164
+ On the built-in Pi paths (both the PM and the workers) the session already has two tools for this:
165
+
166
+ ```text
167
+ team_bg_run command="bash <skill>/scripts/team review T1.1 --dir /tmp/review-T1.1" name="review-T1.1"
168
+ → job review-T1.1 started (pid 12345); log: <root>/.pi/team/state/bg/review-T1.1.log
169
+ cmd: bash <skill>/scripts/team review T1.1 --dir /tmp/review-T1.1 (single-lined; shortened with … past 100 code points)
170
+ (the tool returns at once — the turn is free again)
171
+
172
+ <the turn ends here; when the job finishes and you are idle you are woken once, with one merged
173
+ message naming every job that finished in that window>
174
+
175
+ team_bg_wait review-T1.1
176
+ → job review-T1.1 finished exit=0 after 412.3s; log: …
177
+ cmd: bash <skill>/scripts/team review T1.1 --dir /tmp/review-T1.1 + the tail of the log
178
+ ```
179
+
180
+ The four rules that make it safe (they are the extension's code, not a convention):
181
+
182
+ 1. **Harvest before the turn ends.** An unharvested job wakes you **once** when it finishes; a harvested job stays
183
+ silent (its result came back inline). Several jobs finishing together arrive as **one** message, and never while
184
+ you are running tools.
185
+ 2. **The ledger is on disk**: every turn end appends
186
+ `<ISO timestamp> settled-with-unharvested=<n> jobs=<id>:<running|exit<code>>,…` to
187
+ `<root>/.pi/team/state/bg.log` — a review or a digest can read “this turn ended with unharvested work”
188
+ afterwards. Deliveries append `wake count=<n> ids=…`.
189
+ 3. **The log is bounded**: `state/bg/<id>.log` keeps the tail (head dropped behind a truncation marker) past
190
+ `TEAM_BG_LOG_MAX_BYTES` (default 512 KB), so a chatty gate cannot fill the disk.
191
+ 4. **A restart does not kill a job** (the process is detached), but the job table is per session: after a
192
+ restart read `state/bg.log` and the log file instead of waiting for a wake-up.
193
+
194
+ A worker uses the same tools (its prompt says so) — that is how a worker can run a long build without burning its
195
+ turn. A CLI without the Pi extension API does not have them: fall back to a background tmux window
196
+ ([troubleshooting.md](troubleshooting.md) §17).
197
+
198
+ ### E3. Performance is a separate run (and a release step)
199
+
200
+ The gate above judges **correctness only** — `openspec validate --all --strict && bash
201
+ skills/teamsmith/tests/smoke.sh </dev/null` (front door `team smoke`). The wall-clock/CPU red lines (interactive
202
+ first frame, frame assembly, steady-state pane CPU) live in a separate suite, are never part of a review, and are
203
+ run **once before a release** in the reference image:
204
+
205
+ ```bash
206
+ bash <skill>/scripts/team perf --container # reference environment: the pinned ci/Containerfile image (default)
207
+ bash <skill>/scripts/team perf --host # this machine, explicitly labelled NOT the reference
208
+ ```
209
+
210
+ Exit `0` = all three judgements ran green; `2` = a red with its measured numbers; `4` = no conclusion (a visible
211
+ SKIP: the load premise does not hold, the machine lacks a tool, or the reference engine/image is missing — the
212
+ reason, the measured values and the exact build/run command are printed); `3` = setup failure. The suite takes its
213
+ own lock (`TEAM_PERF_LOCK`, `TEAM_PERF_LOCK_WAIT`) and never queues behind the gate lock. Record the numbers where
214
+ the release checklist says (`docs/team/PUBLISH.md`); a red performance run never delays a merge and never changes a
215
+ review verdict.
216
+
217
+ ## F. Merging and wrapping up
218
+
219
+ **Without a PR (local mode)**:
220
+
221
+ ```bash
222
+ git -C <root> status # the main worktree must be clean and on the protected branch
223
+ git -C <root> merge --squash <branch> # conflict handling: see protocol.md §8e
224
+ git -C <root> commit -m "T1.1: <title>"
225
+ git -C <root> push origin <protected-branch>
226
+ bash <skill>/scripts/team board set T1.1 done # only mark done once it is really in the protected branch
227
+ bash <skill>/scripts/team close T1.1 # close the window, clear the task
228
+ ```
229
+
230
+ > After a squash merge the branch still holds its own commits, so it stays "ahead of main" (and, with a forge,
231
+ > may even look "unpushed"). `roster`/`digest` recognise the usual case (same content) and say "already merged
232
+ > (squash)" — see section D for the heuristic and its limits. `board set <ID> done` + `close <ID>` is what actually
233
+ > finishes the task.
234
+
235
+ **With a PR/MR (forge-first: merge the PR, then fast-forward locally)**:
236
+
237
+ ```bash
238
+ gh pr merge --squash --delete-branch <PR> # GitLab: glab mr merge <iid> --squash
239
+ # 若 forge 合并 403(缺 Contents: write):本地 squash + push + 评论 + 关 PR
240
+ git -C <root> fetch origin <protected-branch> && git -C <root> merge --ff-only FETCH_HEAD
241
+ bash <skill>/scripts/team board set <ID> done
242
+ ```
243
+
244
+ > The order matters: **pushing locally first makes the PR unmergeable right away** (equivalent content, different
245
+ > commits), while the error is often misread as "the PAT lacks pull-requests:write". Merging the PR first avoids the
246
+ > whole problem.
247
+ > For a forge without a CLI (Gitea/self-hosted): use `tea` or the web UI, same order.
248
+ >
249
+ > **Fallback when the forge itself returns 403 on the merge** (the permission a squash-merge needs is
250
+ > **Contents: write**; a token can be allowed to open/read PRs and still be refused here): land it locally with the
251
+ > local-mode sequence — `git -C <root> merge --squash <branch>` + `git -C <root> commit`, then
252
+ > `git -C <root> push origin <protected-branch>` — leave one comment on the PR/MR saying it landed locally, and
253
+ > **close the PR/MR instead of merging it** (the content is already in; merging afterwards would create a second,
254
+ > empty change). The `board set <ID> done` step below is unchanged.
255
+
256
+ When the whole change (not just this task) is done, close the spec side too — **after** the verification record
257
+ exists, the code landed, the user confirmed, and **the change's own ledger is reconciled** (every box in its
258
+ `tasks.md` ticked against evidence, or ticked with the reason it could not be run):
259
+
260
+ ```bash
261
+ bash <skill>/scripts/team change status <change> # must exit 0: every task finished + no unchecked item
262
+ openspec archive -y <change> # merges the deltas into openspec/specs/ and archives the change (see §0)
263
+ ```
264
+
265
+ ## G. Scaling up / down
266
+
267
+ ```bash
268
+ bash <skill>/scripts/team add-agent api --register # new agent: roster (audited) + the worktree/branch step
269
+ bash <skill>/scripts/team ps # check remaining capacity and model concurrency before dispatching
270
+ bash <skill>/scripts/team dispatch api T2.1 <taskfile>
271
+ bash <skill>/scripts/team teardown --agent api --register # remove from the roster (audited) + close the window (keep the worktree)
272
+ bash <skill>/scripts/team teardown --all --purge --force # delete the worktrees too (careful)
273
+ ```
274
+
275
+ Sizing rule of thumb: **parallel agents ≈ min((RAM+free swap)/one-agent footprint, strong-model concurrency limit,
276
+ the verification bandwidth you actually have)**.
277
+ Memory no longer limits you so tightly (the floor is "do not fill swap"), but the PM's verification bandwidth is
278
+ usually the real bottleneck — dispatching too fast just builds a queue of reports waiting to be verified.
279
+ Tune the estimate with `TEAM_AGENT_MEM_MB` (default 6144); `team ps` tells you directly "how many more fit".
280
+
281
+ ## H. Blockers, conflicts, boundary crossings
282
+
283
+ - An agent is blocked: it calls `team notify` + writes a PARTIAL report. The PM's move: extend the brief → `team say`
284
+ to wake it up and let it continue.
285
+ - Two agents touched the same file: merge whoever delivered first, then `dispatch` the other to rebase/redo
286
+ (never have an agent rebase someone else's branch).
287
+ - An agent finds someone else's bug: write `BLOCKED:` in the report; the PM decides whether to insert a new task or
288
+ have the original owner fix it.
289
+ - Facts do not match the report: paste the failure evidence into the thread, send it back; if it keeps happening,
290
+ switch model families for the independent verification.
291
+
292
+ ## H2. Branches and merging (task mode)
293
+
294
+ ```bash
295
+ git -C .worktrees/dev branch --show-current # task/T1.2-api-health
296
+ git -C <root> worktree add --detach /tmp/review-T1.2 task/T1.2-api # the PM prepares an independent checkout
297
+ bash <skill>/scripts/team review T1.2 --dir /tmp/review-T1.2 --strong # gates with a hard timeout + structural strong-verification checks
298
+ gh pr merge --squash --delete-branch 17 && git -C <root> fetch origin main && git -C <root> merge --ff-only FETCH_HEAD
299
+ bash <skill>/scripts/team board set T1.2 done # only mark done once it is confirmed in main
300
+ ```
301
+
302
+ `review` **fails closed** on evidence that does not describe what it stamps: an unresolvable `--branch` (the old code
303
+ skipped the branch guard, so any clean checkout could be stamped with a branch name that does not exist), a dirty
304
+ checkout, or a checkout containing `.gitignore`d artefacts the gates can read but the commit does not. Each refusal
305
+ names the matching `TEAM_REVIEW_ALLOW_DIRTY` / `TEAM_REVIEW_ALLOW_IGNORED` / `TEAM_REVIEW_ALLOW_UNRESOLVED_BRANCH`
306
+ override and, when used, the record states the truth (`checkout dirty: 3 files (override)`, `ignored artifacts: 2`,
307
+ `branch-unresolved (override)`). `--no-gates` writes `SKIPPED` and is **not** evidence: the record carries `gates: none`
308
+ and `digest` keeps listing the task as awaiting verification. A record is bound to the revision it verified, so once
309
+ the branch moves on, `digest`/`team status` flag it again (`stale: verified <A>, branch now <B>`).
310
+
311
+ - Task branches come off the protected branch; when the worktree is dirty, `dispatch` refuses to switch branches (so
312
+ two tasks never end up in one diff).
313
+ - After `close T1.2` the worktree is normally still on `task/T1.2-*`: `close` **prints** the exact
314
+ `git -C .worktrees/dev switch --detach main` command to run (`TEAM_TASK_BRANCH_RESET=1`; `0` silences it) and never
315
+ runs git itself, so the next task starts clean only after the PM runs that command. See protocol.md §8e for the
316
+ `done` gate that sits in front of `close`/`board set … done`; it is **phase-aware**: a brief that declares `phase:`
317
+ is accepted on that phase's artifact (`explore` = the PM's recorded acceptance in `DECISIONS.md` (a heading
318
+ entry naming the task), or `reviews/<ID>.md`; `propose` = only an `ACCEPTED` `reviews/<change>-proposal.md`; `verify` = the task's review
319
+ record; `archive` = the change id under `openspec/changes/archive/`), while `apply` keeps the code-task rule. A
320
+ brief with no `phase:` line (or `-`, or an unknown value) keeps the two original routes unchanged — the gate is
321
+ never widened for tasks that do not declare a phase.
322
+
323
+ ## I. Periodic patrol and the PM's rhythm (the pulse only does this one thing)
324
+
325
+ > The patrol was called `watchdog` until v1.36.0; its old command names are aliases (`team watchdog …`,
326
+ > `install-watchdog`, `uninstall-watchdog`), the `watchdog` window name and the `TEAM_WATCH_*` variables still work
327
+ > as aliases/fallbacks until v2.0.0; `team pulse status` names every legacy variable in effect, and
328
+ > `team pulse restart` swaps a still-running `watchdog` window for a `pulse` one.
329
+
330
+ The problem: the PM (a pi process) stopped or went to sleep, an agent sent a notification, and nobody handled it.
331
+ The framing: **the pulse is not a keep-alive heartbeat, it asks on a timer "is there work right now"** — if there
332
+ is, it wakes the PM; if not, it stays quiet (the PM is not required to be running). Starting, stopping and resuming
333
+ agents is still the PM's job.
334
+
335
+ ```bash
336
+ bash <skill>/scripts/team pulse status # patrol interval, standby, pending work, PM state, capacity
337
+ bash <skill>/scripts/team standby on --reason "waiting for the user to pick a stack" # the PM stands down (no more wake-ups)
338
+ bash <skill>/scripts/team standby off # resume wake-ups
339
+ bash <skill>/scripts/team up # manual rescue: build the tmux stage + start the PM (agents untouched)
340
+ bash <skill>/scripts/team up --agents # also resume agents that have a task but no window
341
+ bash <skill>/scripts/team resume --dry-run # the PM looks for itself: which agents should be resumed
342
+ bash <skill>/scripts/team watch --once # run one patrol tick (one pulse tick, equivalently)
343
+ ```
344
+
345
+ ### Three deployment shapes (weakest to strongest)
346
+
347
+ | Shape | Command | What it survives | Fits |
348
+ |---|---|---|---|
349
+ | **tmux window (default)** | `team pulse up` | the PM crashing/sleeping, as long as the tmux server lives | everyday: one window is both the pulse and the **status monitor** |
350
+ | pulse window | `team pulse up` | the tmux server / window disappearing | there is only this one backend (no container dependency) |
351
+ | manual | `team up` / `team watch --once` | whenever you notice yourself | troubleshooting |
352
+
353
+ ```bash
354
+ bash <skill>/scripts/team pulse up # default: a pulse window in this session runs the monitor + patrols
355
+ bash <skill>/scripts/team pulse logs # look at the monitor screen (a pane snapshot)
356
+ bash <skill>/scripts/team pulse status # window/period/standby/pending work/PM liveness/capacity
357
+ bash <skill>/scripts/team pulse down # close the window
358
+ bash <skill>/scripts/team monitor --once # one screenful by hand (only the current session's state)
359
+ bash <skill>/scripts/team monitor --activity # opt in to each agent's session activity stream (off by default)
360
+ bash <skill>/scripts/team pulse up --print # show which window/period it would use (without doing it)
361
+ ```
362
+
363
+ The monitor serves **the current tmux session only**: whether windows are running, what the task is, pending work and
364
+ capacity.
365
+ The activity column is part of the layout by default (`TEAM_MONITOR_ACTIVITY=1`, changed in v1.38.0); turn it off
366
+ with `--no-activity` or `TEAM_MONITOR_ACTIVITY=0` when you want the older, narrower layout. It only ever reads live
367
+ windows in **this** session, and the read is a bounded tail (64 KiB by default), so it stays cheap.
368
+
369
+ ```
370
+ band A teamsmith pulse · <project> <time> patrol <N>s · standby on/off
371
+ PM <state> · pending counts · deferred queue · capacity + mini chart
372
+ band B agent table (agent · state · task · branch · dirty · ahead · session size)
373
+ | activity column (this session's windows) + the last six patrol actions
374
+ band C reserved visualization band (a labelled placeholder that reads no data)
375
+ band D key band: q / arrows / r / --print / --no-activity
376
+ ```
377
+
378
+ (The panel's own labels are the Chinese words the previous panel used — `team monitor` is unchanged as a surface;
379
+ this document stays English by the same rule as the rest of `references/**`.)
380
+
381
+ The same frame is available as text (pipes, `--print`) and as one JSON object (`--json`); `--width`/`--height`
382
+ override the geometry so the band order and the degradation order can be checked without a terminal.
383
+
384
+ The pulse *is* the `pulse` window in the same session: it runs `team monitor` (the status panel) and patrols on
385
+ `TEAM_PULSE_INTERVAL`. It is decoupled from the PM's **value dependencies** (it only looks at on-disk state and tmux
386
+ panes) but does not try to leave tmux behind — since v1.12.0 it no longer needs podman/images/sockets.
387
+
388
+ Every tick has three steps: ① append one capacity trend line to `state/capacity.log`; ② compute the pending work
389
+ (unread notifications / reports to verify / board todo·wip / blocked / agents with an unfinished task that stopped);
390
+ ③ **only wake the PM when there is pending work** — while it is running, send one `[pulse] pending: …` line (the
391
+ same batch is rate-limited by `TEAM_PULSE_NUDGE_GAP`), otherwise bring it up in its original window with `pi -c`;
392
+ **with nothing pending it does nothing at all**.
393
+ `team standby on --reason "…"` lets the PM stand down deliberately (the pulse stops waking it; the backlog is still
394
+ logged).
395
+
396
+ ### Boundaries (deliberate)
397
+
398
+ - **It does not manage tmux layout by default**: a missing session/window is only reported, never rebuilt
399
+ (`TEAM_PULSE_REBUILD_TMUX=0`).
400
+ With `TEAM_PULSE_REBUILD_TMUX=1` it rebuilds the session and the PM window when it notices they are gone — useful
401
+ for "the window was closed while the server still lives". It **cannot** help when the tmux *server* dies: the
402
+ patrol runs in a pane of that server, so it dies with it, and nothing in the project restarts it (a human runs
403
+ `team up`, which also rebuilds the session).
404
+ - **It does manage stopped agents, in one narrow way**: a seat with an unfinished task whose process has stopped is
405
+ auto-dispatched back onto **the same task** (the resume path in `cmd-watch.sh`; each attempt writes
406
+ `resume agent=<a> task=<id>` to `state/watchdog.log`). This is not a substitute for the PM's own `team resume`
407
+ decision — it exists so a seat that died mid-task comes back without waiting for a human.
408
+ - **It does not manage model quota and never merges**: those are the PM's job.
409
+ - **The PM is not required to run continuously**: between pending batches the PM may sit quietly (or not be running at
410
+ all); the pulse will not wake it just to "keep it alive".
411
+ - Runaway protection: a restart quota for the PM (`TEAM_PULSE_MAX_RESTARTS`, default 5 per hour) turns into a warning
412
+ when exceeded; the pulse itself holds a pid lock.
413
+
414
+ ### Standby (the PM or a human deliberately stops)
415
+
416
+ ```bash
417
+ bash <skill>/scripts/team standby on --reason "waiting for user authorization to merge" # the pulse stops waking it
418
+ bash <skill>/scripts/team standby status # see reason/start time/backlog
419
+ bash <skill>/scripts/team standby off # done, resume wake-ups
420
+ ```
421
+
422
+ When it applies: there really is nothing to push forward, or a human has to step in (authorization/choice of stack/
423
+ outside information). Going on standby loses nothing: the backlog still lands in `state/watchdog.log` and
424
+ `team digest` still shows it.
425
+
426
+ ### Why it can pick up again after a restart
427
+
428
+ All progress is on disk: `state/` (model/window/worktree/task/taskfile), `docs/team/` (briefs/reports/reviews/board/
429
+ threads), git branches and worktrees. When the PM is brought back it continues its original session with `pi -c` (no
430
+ history lost) and receives a kick-off prompt: run `team digest` → `team inbox --ack` → `team resume --dry-run`, and
431
+ then carry on.
432
+
433
+ ### Maintenance downtime / shutting it down on purpose
434
+
435
+ ```bash
436
+ bash <skill>/scripts/team standby on --reason "manual maintenance" # temporarily: stop waking the PM
437
+ bash <skill>/scripts/team pulse down # the pulse window goes (patrol stops)
438
+ bash <skill>/scripts/team teardown --all # close every window (worktrees/branches/state are kept)
439
+ ```
440
+
441
+ ## J. Running for a long time (long projects)
442
+
443
+ - `BOARD.md` is the single source of truth; statuses are only todo/wip/review/done/blocked/dropped.
444
+ - At the end of every milestone: update the status in `ROADMAP.md` and write the decision into `DECISIONS.md`
445
+ (with reasons/impact).
446
+ - Archive periodically: finished reports and verification records can move to `docs/team/archive/`; threads stay
447
+ (append-only).
448
+ - Worktrees left around eat disk: check with `git worktree list` and clean unused ones with `teardown --purge`.