teamsmith 0.2.0 → 0.3.1

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 (163) hide show
  1. package/README.md +4 -4
  2. package/package.json +1 -1
  3. package/skills/teamsmith/CHANGELOG.md +69 -0
  4. package/skills/teamsmith/SKILL.md +20 -13
  5. package/skills/teamsmith/extension/team-inbox-watch.ts +5 -3
  6. package/skills/teamsmith/extension/team-notify.ts +37 -6
  7. package/skills/teamsmith/extension/team.ts +438 -0
  8. package/skills/teamsmith/references/config.md +39 -6
  9. package/skills/teamsmith/references/migration.md +197 -47
  10. package/skills/teamsmith/references/protocol.md +201 -30
  11. package/skills/teamsmith/references/troubleshooting.md +130 -10
  12. package/skills/teamsmith/references/workflows.md +36 -2
  13. package/skills/teamsmith/scripts/lib/cmd-agents.sh +318 -23
  14. package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +2 -2
  15. package/skills/teamsmith/scripts/lib/cmd-config.sh +349 -67
  16. package/skills/teamsmith/scripts/lib/cmd-draft.sh +4 -4
  17. package/skills/teamsmith/scripts/lib/cmd-help.sh +677 -0
  18. package/skills/teamsmith/scripts/lib/cmd-init.sh +157 -5
  19. package/skills/teamsmith/scripts/lib/cmd-interrupt.sh +461 -0
  20. package/skills/teamsmith/scripts/lib/cmd-meeting.sh +2 -25
  21. package/skills/teamsmith/scripts/lib/cmd-project.sh +30 -103
  22. package/skills/teamsmith/scripts/lib/cmd-reap.sh +277 -0
  23. package/skills/teamsmith/scripts/lib/cmd-reply.sh +3 -3
  24. package/skills/teamsmith/scripts/lib/cmd-review.sh +182 -32
  25. package/skills/teamsmith/scripts/lib/cmd-status.sh +234 -21
  26. package/skills/teamsmith/scripts/lib/cmd-update.sh +36 -7
  27. package/skills/teamsmith/scripts/lib/cmd-watch.sh +564 -46
  28. package/skills/teamsmith/scripts/lib/common.sh +1004 -245
  29. package/skills/teamsmith/scripts/lib/gate-lock.sh +582 -0
  30. package/skills/teamsmith/scripts/panel/draft-send.sh +11 -1
  31. package/skills/teamsmith/scripts/panel/panel.js +211 -211
  32. package/skills/teamsmith/scripts/panel/src/App.tsx +58 -21
  33. package/skills/teamsmith/scripts/panel/src/clipboard.ts +12 -5
  34. package/skills/teamsmith/scripts/panel/src/compose.ts +6 -3
  35. package/skills/teamsmith/scripts/panel/src/data.ts +51 -5
  36. package/skills/teamsmith/scripts/panel/src/layout.ts +209 -69
  37. package/skills/teamsmith/scripts/panel/src/main.tsx +37 -8
  38. package/skills/teamsmith/scripts/panel/src/strings/en.ts +39 -29
  39. package/skills/teamsmith/scripts/panel/src/strings/zh.ts +41 -31
  40. package/skills/teamsmith/scripts/panel/src/types.ts +28 -3
  41. package/skills/teamsmith/scripts/replies.mjs +4 -1
  42. package/skills/teamsmith/scripts/shim/killall +10 -0
  43. package/skills/teamsmith/scripts/shim/pgrep +10 -0
  44. package/skills/teamsmith/scripts/shim/pidof +10 -0
  45. package/skills/teamsmith/scripts/shim/pkill +10 -0
  46. package/skills/teamsmith/scripts/shim/signal-gate +108 -31
  47. package/skills/teamsmith/scripts/shim/tmux +18 -0
  48. package/skills/teamsmith/scripts/strings/commands.tsv +86 -0
  49. package/skills/teamsmith/scripts/strings/help.en.tsv +503 -0
  50. package/skills/teamsmith/scripts/strings/help.zh.tsv +489 -0
  51. package/skills/teamsmith/scripts/team +19 -6
  52. package/skills/teamsmith/templates/AGENTS.section.md.tmpl +8 -1
  53. package/skills/teamsmith/templates/config.sh.tmpl +20 -1
  54. package/skills/teamsmith/templates/pm-prompt.md.tmpl +21 -0
  55. package/skills/teamsmith/tests/README.md +31 -0
  56. package/skills/teamsmith/tests/bg-ledger-harness.mjs +464 -40
  57. package/skills/teamsmith/tests/bg-ledger.sh +168 -10
  58. package/skills/teamsmith/tests/checkout-shape-probe.sh +83 -54
  59. package/skills/teamsmith/tests/config-cli.sh +184 -32
  60. package/skills/teamsmith/tests/fixtures/delivery-truth-real/scenario.sh +7 -1
  61. package/skills/teamsmith/tests/fixtures/p287/lint-good.sh.in +3 -0
  62. package/skills/teamsmith/tests/fixtures/p287/lint-hardcoded.sh.in +3 -0
  63. package/skills/teamsmith/tests/fixtures/p287/lint-no-ns.sh.in +3 -0
  64. package/skills/teamsmith/tests/fixtures/p55/flip-p49.sh +18 -6
  65. package/skills/teamsmith/tests/flip-m33.sh +5 -3
  66. package/skills/teamsmith/tests/flip-p158.sh +2 -1
  67. package/skills/teamsmith/tests/flip-p308-skip-not-pass.sh +151 -0
  68. package/skills/teamsmith/tests/flip-p310-lock.sh +210 -0
  69. package/skills/teamsmith/tests/flip-p310-socket.sh +125 -0
  70. package/skills/teamsmith/tests/gate-guard.sh +52 -79
  71. package/skills/teamsmith/tests/help-surface.sh +1664 -0
  72. package/skills/teamsmith/tests/install-shape.sh +359 -22
  73. package/skills/teamsmith/tests/key-replies-pty.sh +9 -10
  74. package/skills/teamsmith/tests/key-replies-ui.sh +2 -8
  75. package/skills/teamsmith/tests/key-replies.sh +281 -28
  76. package/skills/teamsmith/tests/ledger-ban.sh +5 -4
  77. package/skills/teamsmith/tests/ledger-claim.sh +2 -1
  78. package/skills/teamsmith/tests/lib/bounded-spin.sh +90 -0
  79. package/skills/teamsmith/tests/lib/model-policy.sh +4 -0
  80. package/skills/teamsmith/tests/lib/model-routing-flips.py +51 -0
  81. package/skills/teamsmith/tests/lib/pty-wait.sh +21 -111
  82. package/skills/teamsmith/tests/lib/reply-fixture.sh +4 -9
  83. package/skills/teamsmith/tests/lib/section-guard.sh +316 -164
  84. package/skills/teamsmith/tests/lib/tmp-root.sh +139 -27
  85. package/skills/teamsmith/tests/lib/tmux-cap.sh +10 -1
  86. package/skills/teamsmith/tests/lib/tmux-iso.sh +31 -13
  87. package/skills/teamsmith/tests/loop-inventory.tsv +83 -77
  88. package/skills/teamsmith/tests/panel-b2.sh +430 -352
  89. package/skills/teamsmith/tests/panel-b3-stub.sh +112 -4
  90. package/skills/teamsmith/tests/panel-b3.sh +314 -62
  91. package/skills/teamsmith/tests/panel-choices.sh +11 -6
  92. package/skills/teamsmith/tests/panel-cpu.sh +43 -130
  93. package/skills/teamsmith/tests/panel-p21.sh +251 -265
  94. package/skills/teamsmith/tests/panel-snapshots.sh +41 -225
  95. package/skills/teamsmith/tests/panel-strings.mjs +33 -18
  96. package/skills/teamsmith/tests/perf.sh +187 -396
  97. package/skills/teamsmith/tests/routes.sh +440 -117
  98. package/skills/teamsmith/tests/seat-interrupt.sh +1012 -0
  99. package/skills/teamsmith/tests/seat-visibility.sh +675 -0
  100. package/skills/teamsmith/tests/section-guard.sh +13 -102
  101. package/skills/teamsmith/tests/section-needs-audit.sh +24 -7
  102. package/skills/teamsmith/tests/section-paths.tsv +32 -18
  103. package/skills/teamsmith/tests/section-select.sh +371 -19
  104. package/skills/teamsmith/tests/signal-gate.sh +249 -27
  105. package/skills/teamsmith/tests/signal-lint-legacy.txt +4 -1
  106. package/skills/teamsmith/tests/slash-team-e2e.sh +323 -0
  107. package/skills/teamsmith/tests/slash-team.sh +617 -0
  108. package/skills/teamsmith/tests/slice-coverage.sh +206 -0
  109. package/skills/teamsmith/tests/smoke.sh +3595 -788
  110. package/skills/teamsmith/tests/task-model-routing.sh +530 -15
  111. package/skills/teamsmith/tests/team-bg-stop.sh +18 -10
  112. package/skills/teamsmith/tests/tmp-hygiene.sh +782 -45
  113. package/skills/teamsmith/tests/tmux-identity-leak.sh +773 -0
  114. package/skills/teamsmith/tests/tmux-lint-legacy.txt +12 -18
  115. package/skills/teamsmith/tests/upgrade-recipe.sh +537 -0
  116. package/skills/teamsmith/tests/workflow-entry.sh +207 -0
  117. package/skills/teamsmith-init/SKILL.md +12 -12
  118. package/skills/teamsmith-init/references/bootstrap.md +3 -3
  119. package/skills/teamsmith/tests/flip-glue.sh +0 -162
  120. package/skills/teamsmith/tests/flip-m12-26c.sh +0 -129
  121. package/skills/teamsmith/tests/flip-m12.sh +0 -185
  122. package/skills/teamsmith/tests/flip-m16.sh +0 -166
  123. package/skills/teamsmith/tests/flip-m17.sh +0 -204
  124. package/skills/teamsmith/tests/flip-m34.sh +0 -96
  125. package/skills/teamsmith/tests/flip-m37.sh +0 -185
  126. package/skills/teamsmith/tests/flip-m4.3.sh +0 -375
  127. package/skills/teamsmith/tests/flip-m43.sh +0 -128
  128. package/skills/teamsmith/tests/flip-m45.sh +0 -244
  129. package/skills/teamsmith/tests/flip-m46.sh +0 -238
  130. package/skills/teamsmith/tests/flip-m48.sh +0 -304
  131. package/skills/teamsmith/tests/flip-m6.2.sh +0 -205
  132. package/skills/teamsmith/tests/flip-m6.3.sh +0 -283
  133. package/skills/teamsmith/tests/flip-m6.4.sh +0 -267
  134. package/skills/teamsmith/tests/flip-m6.5.sh +0 -113
  135. package/skills/teamsmith/tests/flip-m7.1.sh +0 -135
  136. package/skills/teamsmith/tests/flip-m7.2.sh +0 -321
  137. package/skills/teamsmith/tests/flip-p144.sh +0 -112
  138. package/skills/teamsmith/tests/flip-p156.sh +0 -133
  139. package/skills/teamsmith/tests/flip-p160.sh +0 -182
  140. package/skills/teamsmith/tests/flip-p171.sh +0 -249
  141. package/skills/teamsmith/tests/flip-p18.1.sh +0 -95
  142. package/skills/teamsmith/tests/flip-p20.sh +0 -286
  143. package/skills/teamsmith/tests/flip-p201.sh +0 -249
  144. package/skills/teamsmith/tests/flip-p210.sh +0 -239
  145. package/skills/teamsmith/tests/flip-p211.sh +0 -152
  146. package/skills/teamsmith/tests/flip-p217.sh +0 -288
  147. package/skills/teamsmith/tests/flip-p22.sh +0 -123
  148. package/skills/teamsmith/tests/flip-p23.sh +0 -239
  149. package/skills/teamsmith/tests/flip-p25.sh +0 -165
  150. package/skills/teamsmith/tests/flip-p71.sh +0 -184
  151. package/skills/teamsmith/tests/flip-p72.sh +0 -202
  152. package/skills/teamsmith/tests/load-experiment.sh +0 -290
  153. package/skills/teamsmith/tests/panel-cpu-premise.sh +0 -173
  154. package/skills/teamsmith/tests/panel-flip-m54.sh +0 -207
  155. package/skills/teamsmith/tests/panel-flip-p123.sh +0 -278
  156. package/skills/teamsmith/tests/panel-flip-p125.sh +0 -318
  157. package/skills/teamsmith/tests/panel-flip-p128.sh +0 -259
  158. package/skills/teamsmith/tests/panel-keyprobe-stub.sh +0 -41
  159. package/skills/teamsmith/tests/panel-keyprobe.sh +0 -82
  160. package/skills/teamsmith/tests/panel-knobs.sh +0 -83
  161. package/skills/teamsmith/tests/section-budgets.tsv +0 -154
  162. package/skills/teamsmith/tests/team-bg-flip.sh +0 -239
  163. package/skills/teamsmith/tests/team-inbox-watch-flip.sh +0 -191
@@ -136,14 +136,18 @@ one-line reaction.
136
136
  | reports that are not committed yet no longer point at a review, and a squash-merged branch reports "already merged (squash, same content) — no push needed" | v1.22.0 | read the wording before acting: both lines exist to stop a PM from reviewing or pushing something that is already done |
137
137
  | the PM's own CLI is configurable (`TEAM_PM_CMD` / `TEAM_PM_BIN` / `TEAM_PM_RESUME_ARGS`) | M8.1 | nothing to do — all three keys are empty by default and the built-in Pi command is byte-for-byte unchanged. They belong to the internal seam (frozen): reserved for a possible future non-Pi adapter, no compatibility promise — the PM side runs Pi (`references/agent-adapters.md` §2) |
138
138
  | the console brings three state files and one changed default: `TEAM_MONITOR_REFRESH` drops `5` → `3` | v1.38.0 (pulse-console B3) | the TUI keeps its own preferences in `state/panel.conf` (`lang`, `page`, `activity`, `mouse`, `density` and an optional `theme`), remembers the last page in `state/panel-page`, and holds the PM's compose draft in `state/draft.md`. All three are runtime state: deleting them is safe and `--print`/`--json` never read them. Set `TEAM_MONITOR_REFRESH=5` to keep the old cadence (`references/config.md` lists the key) |
139
+ | the fixtures' and gates' temp root defaults to **disk** instead of the memory-backed `/tmp`: `/var/tmp/teamsmith-<ns>`, resolved by `team_tmp_root` (`TMPDIR` → `TEAM_TMP_ROOT` → default) and printed as `source=tmpdir|config|default` | v0.3.0 (tmp-root-on-disk) | nothing to migrate — the first write creates the new root (0700) and old `/tmp` residue stays where it is; `tmp-hygiene.sh --status` names the resolved root, its `source=` and the old root's leftovers, and `TMPDIR=/tmp bash skills/teamsmith/tests/tmp-hygiene.sh --sweep --dry-run` selects the old base explicitly. An explicit root (`TMPDIR` / `TEAM_TMP_ROOT`) must already exist and be writable — it is never created for you. Rollback: `TEAM_TMP_ROOT=/tmp` |
139
140
 
140
141
  ## 5b. The breaking model-policy upgrade (task categories)
141
142
 
142
- This is the one upgrade that needs an explicit transaction instead of a re-render. The retired keys
143
+ This is the one upgrade a re-render cannot do: it needs the four-key migration transaction. The retired keys
143
144
  TEAM_AGENT_MODELS and TEAM_DEFAULT_MODEL are no longer read (an old seat model is **not** reinterpreted as a task
144
145
  model): a project that still carries them is refused by `team dispatch`/`team up` and by `team init`/
145
- `team bootstrap` — before any install, ledger, worktree or pulse work — and the repair is the dedicated
146
- four-key transaction:
146
+ `team bootstrap` — before any install, ledger, worktree or pulse work. Two routes apply the same transaction: the
147
+ **startup transaction** (the next `team up` derives the pairs from the old keys, prints every pair before → after
148
+ with the backup path and the restore command, writes through the checked writer and re-enters itself) or the
149
+ **explicit transaction**. The full sequence — upgrading the tool itself, backing up the configuration and rolling
150
+ back — is §6.
147
151
 
148
152
  ```bash
149
153
  team config upgrade-models --task-models 'routine=<model> analysis=<model> verify=<model>' --pm-model '<model>' # preview: prints the diff, writes nothing
@@ -153,8 +157,19 @@ team config upgrade-models --task-models '…' --pm-model '<model>' --yes
153
157
  It rewrites only those keys through the checked writer (temp file → `bash -n` → fingerprint CAS → atomic rename →
154
158
  one audit line), turns a removed line's inline comment into a standalone one and leaves every other byte alone.
155
159
  Shapes it cannot locate unambiguously (export/multiline/variable expansion/duplicate keys) are refused with the
156
- file and line plus the manual-normalization route. `team init --force`, `bootstrap` and inference are **not**
157
- migration routes; a fresh project passes `--task-models`/`--pm-model` to `init`/`bootstrap` instead.
160
+ file and line plus the manual-normalization route. `team up --print` writes nothing (it prints the same
161
+ prediction, with the backup path it would use) and `team up --no-migrate` refuses instead of writing, naming the
162
+ manual command. `team init --force`, `bootstrap` and inference are **not** migration routes; a fresh project
163
+ passes `--task-models`/`--pm-model` to `init`/`bootstrap` instead. For the step-by-step upgrade of an existing
164
+ project, including the npm install, the configuration backup and the rollback, see §6.
165
+
166
+ **How the shape is detected.** Detection is a version table with **one row per migration** — the shape it matches
167
+ (`from`), the shape it produces (`to`), the transform it applies and the tool version that introduced it — applied
168
+ in order and idempotently; adding a migration is one table row plus one transform plus one fixture group. A
169
+ project's shape number is `TEAM_CONFIG_VERSION` (written by `init`/`bootstrap` and by every migration; a `refuse`
170
+ key — the console never writes it); a configuration **without** that key is classified by its keys (a retired key
171
+ ⇒ the pre-policy shape, otherwise the current one). A shape number **higher** than this tool's newest known one is
172
+ **refused** rather than migrated with an older row, and so is a shape the table has no row for.
158
173
 
159
174
  After the policy is in place: a **new** dispatch takes the brief's `category:` model (routine for bounded ordinary
160
175
  implementation, analysis for complex planning/judgment, verify for independent adversarial review — or the
@@ -173,55 +188,187 @@ promise is made for unknown consumers.
173
188
 
174
189
  ## 6. Upgrade recipe
175
190
 
176
- Replace `<skill checkout>` with the git checkout the installed skill points at (`team paths` prints it).
191
+ This moves a project set up with teamsmith 0.1.x onto 0.2.0 or later. §1 still holds — `docs/team/**`,
192
+ `.pi/team/state/**` and your own files keep their format, so there is no data conversion. What does move is the
193
+ **tool installation** (step 1), this project's **model policy** (step 2), the PM's **launch identity** (step 3),
194
+ the **sessions** (step 4), and the way you **prove** (step 5) and **roll back** (step 6) the result.
195
+
196
+ Run every command from the project's main checkout, and replace `<v>` with the version you are moving to (for
197
+ example `0.2.0`).
198
+
199
+ ### Step 1 — upgrade the tool itself (npm, not a checkout)
200
+
201
+ Since 0.2.0 the installed skill is a copy of the npm package `teamsmith`: `~/.agents/skills/teamsmith` is a
202
+ symlink into `$(npm root -g)/teamsmith/skills/teamsmith`. There is no checkout to `git pull`; the upgrade is the
203
+ package plus the installer that refreshes the shared links:
204
+
205
+ ```bash
206
+ npm i -g teamsmith@<v> --registry https://registry.npmjs.org
207
+ bash "$(npm root -g)/teamsmith/install.sh" # idempotent: refresh the shared skill links
208
+ team version # the version the CLI reports now
209
+ readlink -f ~/.agents/skills/teamsmith # must resolve under $(npm root -g)/teamsmith/skills/teamsmith
210
+ ```
211
+
212
+ `install.sh` is safe to re-run and installs the canonical directories only. If `readlink -f` still points at an
213
+ old checkout, this machine has a second skill source — fix that link (or re-run `install.sh` into the target you
214
+ want) before going on, or later reads will mix two versions.
215
+
216
+ ### Step 2 — per project: back up the configuration, then let the first `team up` migrate it
217
+
218
+ **Back up the configuration first.** The migration keeps its own backup, but this one is yours:
219
+
220
+ ```bash
221
+ cp .pi/team/config.sh ".pi/team/config.sh.pre-upgrade-$(date -u +%Y%m%dT%H%M%SZ)"
222
+ ```
223
+
224
+ Look before you write:
177
225
 
178
226
  ```bash
179
- # 1) get the new skill (a copy install updates by re-running ./install.sh instead)
180
- git -C <skill checkout> pull --ff-only # refuses when the checkout has diverged (local commits) — deliberate
181
-
182
- # 2) is this session still the old version?
183
- team version --check
184
- # expect two version numbers (loaded vs disk) and a hint to run /reload;
185
- # identical versions print "consistent" instead. Exit code stays 0 either way.
186
-
187
- # 3) environment self-check — fix every ✗ before going on
188
- team doctor
189
-
190
- # 4) re-render this project's contracts (idempotent: config is kept, the AGENTS.md
191
- # section is refreshed in place, and a legacy marker is rewritten to the new one).
192
- # A config still carrying the retired model keys is REFUSED here — run the explicit
193
- # migration first: team config upgrade-models --task-models '…' --pm-model '…' [--yes]
194
- team init
195
-
196
- # 5) the spec layer, only when openspec/ is missing
197
- openspec init --tools none
198
-
199
- # 6) put the spec gate into TEAM_GATES in .pi/team/config.sh
200
- # TEAM_GATES="openspec validate --all --strict && <old gates>"
201
-
202
- # 7) rebuild the pulse window and look at it (renamed from `watchdog` in v1.36.0 — §2b:
203
- # the old commands/window/variables still work; a running `watchdog` window is adopted
204
- # and `team pulse restart` swaps it for a `pulse` one)
205
- team pulse up
206
- team pulse status
207
-
208
- # 8) prove the tooling end to end in a throwaway repository (never touches this project)
209
- bash skills/teamsmith/tests/smoke.sh # full suite (tens of seconds idle, minutes on a loaded box)
210
- TEAM_SMOKE_FAST=1 bash skills/teamsmith/tests/smoke.sh # logic-only subset; each skipped section prints SKIP
227
+ team up --print
211
228
  ```
212
229
 
213
- Expected output, in order:
230
+ On a 0.1.x-shaped configuration this writes nothing and prints, in order: the migration row it matched (which
231
+ migration, from which shape to which), a **per-key before → after table**, the backup path it would use, the `cp`
232
+ command that restores it, and why the keys move. `team up --no-migrate` is the same promise from the other side:
233
+ it refuses, writes nothing, and prints the manual transaction in whichever of the two command forms below fits
234
+ your configuration — the derived command when the derivation is unambiguous, the placeholder route when it is not.
214
235
 
215
- | Step | What you should see |
236
+ Then run the real thing:
237
+
238
+ ```bash
239
+ team up
240
+ ```
241
+
242
+ `team up` now begins with a **startup transaction**. It prints the same before → after table, writes a backup
243
+ under `.pi/team/state/config-backups/config.sh.pre-<shape>-<timestamp>`, rewrites only the model keys through the
244
+ checked writer (temp file → `bash -n` → fingerprint compare-and-swap → atomic rename → one audit line in
245
+ `.pi/team/state/config.log`), prints the restore command, and re-enters itself to read the new configuration and
246
+ start the PM.
247
+
248
+ In 0.1.x terms the transaction does this:
249
+
250
+ | 0.1.x key | becomes |
216
251
  |---|---|
217
- | `version --check` | the disk version, the `SKILL.md` version and the loaded version, then either a "consistent" line or the "this session is old" line with the `/reload` hint |
218
- | `/reload` in Pi | the skill list is rebuilt; the extension sends a follow-up that makes the PM read `SKILL.md` again (text already in the conversation history does **not** change by itself) |
219
- | `doctor` | every line prefixed with a check mark; each `✗` line carries its own fix (`pi install …`, `openspec init --tools none`, `TEAM_*_BIN`, …); the summary line counts failures and warnings |
220
- | `init` | a write/refresh line per generated file — the `AGENTS.md` protocol section appears exactly once (check with `grep -c '<!-- teamsmith:begin -->' AGENTS.md`) |
221
- | `smoke` | an all-green summary (or the failure count), and in fast mode a line listing the skipped process sections |
252
+ | `TEAM_AGENT_MODELS='dev=<model> verify=<model>'` | one `TEAM_TASK_MODELS` pair per seat, with the seat name as the category |
253
+ | `TEAM_DEFAULT_MODEL='<model>'` | a `default=<model>` pair in `TEAM_TASK_MODELS` |
254
+ | `TEAM_PM_MODEL='<model>'` | the same value, re-written through the checked writer so the write is audited |
255
+ | — | `TEAM_CONFIG_VERSION='2'`, the shape number every later migration is measured against |
256
+
257
+ If it **refuses**, it names the obstacle and prints the manual transaction in one of **two command forms**. Which
258
+ one you get is a fact about *your* configuration, not a style: the tool never prints a command it cannot support.
259
+
260
+ - **A shape it can derive from** — every retired key is a top-level single-line literal, every value is a valid
261
+ `provider/model`, and no two seat names normalize onto one category. The command is **derived from your own
262
+ configuration**, with the map and the PM model already filled in
263
+ (`--task-models 'dev=vendor/light verify=vendor/strong:high default=vendor/base' --pm-model 'vendor/pm:high'`).
264
+ `team up --no-migrate` on such a configuration prints this form.
265
+ - **A shape the derivation stops on** — a value built by variable expansion or written as a multi-line literal, a
266
+ seat name that normalizes onto the fallback `default` (the fallback name collides), or a value that is not a
267
+ valid model. Here it prints the **placeholder route** instead: the command arrives with an *unfilled*
268
+ `--task-models` and `--pm-model`, each holding a bracketed placeholder written in the CLI's own language, and
269
+ *you* write the map. The refusal line above it names what stopped the derivation (for that first shape, the
270
+ file and line that is not a plain literal). A derivation that resolved some pairs before stopping still prints
271
+ them, with the bracketed placeholder standing in for the offending one — a partly filled map therefore means
272
+ "fix that one pair", not "start from scratch".
273
+
274
+ The same conditional holds wherever a refusal offers the manual transaction (a refused `team config set` or
275
+ `team dispatch` prints these two forms under its two routes). The two are distinguishable at a glance: in a
276
+ **derived** command every `--task-models` value was read from *your* file, while a **placeholder-route** command
277
+ leaves a bracketed placeholder somewhere among its arguments.
278
+
279
+ The manual route is the same transaction, run by hand:
280
+
281
+ ```bash
282
+ team config upgrade-models --task-models '<the map it printed>' --pm-model '<the model it printed>' --dry-run
283
+ team config upgrade-models --task-models '…' --pm-model '…' --yes
284
+ ```
285
+
286
+ `--dry-run` prints the diff and writes nothing; `--yes` is the one write. `team init --force`, `team bootstrap`
287
+ and inference are **not** migration routes (§5b). Confirm the new shape before going on:
288
+
289
+ ```bash
290
+ team config list # exit code 0, and no `migration_required` line at the end
291
+ ```
292
+
293
+ ### Step 3 — the PM launch identity (`state/pm-launch.env`)
294
+
295
+ `.pi/team/state/pm-launch.env` is a flat record of the identity the PM was last started with: the project and
296
+ window, the resolved model, the resume key (which Pi session it continues), the launch mode (`fresh` or
297
+ `continued`) and a nonce. It is what lets a later `team up` prove it is resuming the *same* conversation on the
298
+ *same* model, and it is deliberately not project data (§1).
299
+
300
+ A project upgraded from 0.1.x has no such record — the file did not exist then. The first `team up` after the
301
+ migration handles that for you: a missing record is read as "no claim about the past", this launch is
302
+ **registered**, and the run prints one line saying so. That line carries `model=<model>`, `resume_key=<key>` and
303
+ `mode=continued`, and reminds you that changing the PM model requires `--fresh-pm`.
304
+
305
+ Two exits exist, and they differ in what they keep:
306
+
307
+ - **Let it register (the default).** The PM continues the conversation `team_pm_continuity` resolves — `pi -c`, the
308
+ previous session for this directory, unless `TEAM_PM_SESSION_ID` or `TEAM_PM_RESUME_ARGS` say otherwise — and the
309
+ record is written from the successful launch.
310
+ - **`team up --fresh-pm`.** This one launch starts a **new** conversation: the resume arguments are dropped, the
311
+ old Pi session file is left untouched in the history, and the record is written with `mode=fresh`. Disk is the
312
+ handover — `docs/team/**` and `team digest` carry the work.
313
+
314
+ When a record **exists and disagrees** with what the configuration resolves now, `team up` refuses instead of
315
+ guessing. The refusal names `PM launch identity changed` plus the field that moved (`model`, `resume_key` or the
316
+ window), and prints two exits:
317
+
318
+ - **`team up --fresh-pm`** — start a new conversation. The Pi history is not touched.
319
+ - **`team up --adopt-pm-identity --yes`** — declare that this continued run really is the recorded identity: it
320
+ writes the record plus one audit line, and is refused while the PM is running.
321
+
322
+ **Why a changed model cannot continue the old conversation.** One conversation is pinned to one model: Pi's
323
+ session history is bound to the provider/model that produced it, so resuming that session under a different model
324
+ is not the same conversation. `--fresh-pm` is therefore the only honest way to change the PM's model;
325
+ `--adopt-pm-identity --yes` exists for the case where the *record* is stale but the resolved identity really is
326
+ what you are resuming. `team up --print` predicts all of this without writing: it prints the registration line it
327
+ would write, or the two exits when it would refuse.
328
+
329
+ ### Step 4 — sessions: bring the PM and the seats back up
330
+
331
+ ```bash
332
+ team up # the PM window in the project's own tmux session
333
+ team up --agents # also resume the seats that have unfinished tasks
334
+ team resume --dry-run # what --agents would do, without doing it
335
+ ```
336
+
337
+ Text already read into a running session does not change under it: restart each project's own agent sessions (or
338
+ `/reload` the PM in Pi) so they read the new `SKILL.md` and `references/**`. `team up` starts the PM and nothing
339
+ else; the patrol window is created by `team pulse up`, and `team pulse status` shows its state.
340
+
341
+ ### Step 5 — prove it
342
+
343
+ ```bash
344
+ team doctor # fix every ✗ before going on; each line carries its own fix
345
+ bash skills/teamsmith/tests/tmp-hygiene.sh --status # the resolved temp root, its `source=` and any old /tmp residue
346
+ team config list # the new keys, exit code 0
347
+ team dispatch --print <agent> <ID> <brief> # the brief's `category:` line resolves to the mapped model
348
+ ```
349
+
350
+ The status line also settles the one on-disk change since 0.3.0: fixture roots resolve to `/var/tmp/teamsmith-<ns>`
351
+ on disk unless `TMPDIR` or `TEAM_TMP_ROOT` says otherwise, the line prints which of the three won, and the old `/tmp`
352
+ roots are **not** migrated (`TMPDIR=/tmp bash skills/teamsmith/tests/tmp-hygiene.sh --sweep --dry-run` shows them).
353
+ `TEAM_TMP_ROOT=/tmp` is the rollback to the old behaviour.
354
+
355
+ The `dispatch --print` line is the one that proves the policy is live: it must print
356
+ `category=<the brief's category> model=<the mapped model>`. A brief with no `category:` line is refused.
357
+
358
+ ### Step 6 — roll back
359
+
360
+ ```bash
361
+ cp "<the backup path the migration printed>" .pi/team/config.sh # the configuration, byte for byte
362
+ ```
363
+
364
+ Restoring the backup puts the old shape back (and `team config list` says `migration_required` again), which is
365
+ what you want if the new policy is wrong. `--fresh-pm` needs no rollback: it never touched the Pi session
366
+ history, so the old conversation is still there to `team up` into after you restore the configuration. Nothing
367
+ else moved — `docs/team/**` and the rest of `.pi/team/state/**` were never rewritten. §7 covers pinning an older
368
+ tool version, which is the other half of a rollback.
222
369
 
223
- Do the upgrade **before** dispatching new work, and note the version in `DECISIONS.md`: a worker dispatched after the
224
- upgrade gets the new prompt template, one dispatched before does not.
370
+ Do the upgrade **before** dispatching new work, and note the version in `DECISIONS.md`: a worker dispatched after
371
+ the upgrade gets the new prompt template, one dispatched before does not.
225
372
 
226
373
  ## 7. Rolling back
227
374
 
@@ -244,6 +391,9 @@ team mark-loaded # re-record what this session sho
244
391
  git again. Pin at v1.11.0 or later unless that is exactly what you want.
245
392
  - Rollback and re-upgrade can be repeated freely; the only state the skill keeps about versions is
246
393
  `.pi/team/state/pm-loaded.env`.
394
+ - Since 0.3.0 the fixture/gate temp root lives on disk (`/var/tmp/teamsmith-<ns>`). Pinning an older tool sends it
395
+ back to `/tmp` on its own; with the new tool, `TEAM_TMP_ROOT=/tmp` restores the old behaviour. Nothing under
396
+ `/var/tmp/teamsmith-<ns>` is project data — those roots are disposable and the sweep reclaims them.
247
397
 
248
398
  ## 8. What is deliberately not supported
249
399
 
@@ -44,6 +44,10 @@ the implementation of that chain.
44
44
  harder; a long-lived worktree lets the agent keep its memory.
45
45
  - The main worktree (main) belongs to the PM alone: merges, verification and documentation happen there, so nobody
46
46
  fights an agent over the workspace.
47
+ - **A merged branch is deleted at once.** Landing is `merge --squash` + commit + push, then `close`, then
48
+ `git branch -D <branch>`: the commit on `main` is the deliverable and the branch is only the vehicle. Nothing of
49
+ value lives only on a branch, and keeping them turns the branch list into an archeology site (134 branches removed
50
+ in one pass on 2026-10-18, none of them an ancestor of `main` because squash merges leave no ancestry).
47
51
 
48
52
  ## 4. The wake-up loop: an asynchronous agent must be able to wake the PM by itself
49
53
 
@@ -66,8 +70,14 @@ Guards and limitations:
66
70
  be concatenated with what the human is typing. On a dirty PM box the entry waits in `state/outbox/`; the extension
67
71
  never falls back to `send-keys`, and a failed enqueue is logged while the inbox line stays.
68
72
  - The inbox is transient state (gitignored); the durable record is still the report + verification + decision log.
69
- - The same briefing is sent once per `TEAM_NOTIFY_DEDUP_SEC` seconds: Pi may settle several times inside one stretch
70
- of work.
73
+ - **Settles inside one stretch of work become one line, not one line each**: consecutive notices with the same
74
+ merge key (seat, task, state class, `awaiting=` set) fold into the line at the end of the inbox file, which then
75
+ carries `×N first=<ISO> last=<ISO>` and the **field values of the last event** (`tip=`, `branch=`, `uncommitted=`).
76
+ The line is a **window summary**, not the seat's current state: `last=` names the event whose revision it
77
+ describes, and the run's earlier events are read from the detail file with `team inbox <agent> --detail` (raw
78
+ records in `state/notify.log`, bounded by `TEAM_NOTIFY_DETAIL_MAX` and rotated once). A different key, a manual
79
+ notice in between, or a record write that failed starts a new line; a byte-identical briefing inside
80
+ `TEAM_NOTIFY_DEDUP_SEC` is still suppressed outright.
71
81
  - **A notice names the revision it describes** (R2/P139; width and branch proof fixed by P160): the durable inbox
72
82
  line and the knock payload carry `task=<ID> tip=<12-hex>` — the **first twelve hex characters of the branch tip,
73
83
  truncated by the sender itself** (`git rev-parse HEAD | cut -c1-12`; the extension's `TIP_WIDTH`), never a Git
@@ -129,12 +139,37 @@ Guards and limitations:
129
139
  call appends one line to `state/signal-calls.log` (`TEAM_SIGNAL_CALLS_LOG`), and a refusal is also copied byte
130
140
  for byte into `<log>.forensics` so it outlives the call log's rotation.
131
141
 
142
+ ## 4a. Two signal entries: `reap` the orphan, `interrupt` the turn
143
+
144
+ The tool has exactly two entries that end a *process*, and they answer different questions. `team reap` ends an
145
+ **orphan**: the process is alive but its pane is gone, so no turn is running and nothing is waiting for it
146
+ (troubleshooting §28). `team interrupt <seat>` ends the **turn of a live seat** — the window is alive, the agent
147
+ process is the one its assignment record names, and the seat is stuck inside one long tool call, which is exactly
148
+ why a queued message never reaches it: the wake-up loop delivers at turn end (§4). `team resume` is neither: it is
149
+ the way **back** into the same session, the step after either entry, never a third way to signal anything.
150
+
151
+ What the two entries share is the discipline, not the target: both pick the process from a **recorded pid**
152
+ (`reap`: the host census; `interrupt`: the seat's own window → pane → pid → identity and start time), both
153
+ re-verify immediately before the signal, both send `SIGTERM` → bounded wait → `SIGKILL`, both take `--yes` on the
154
+ same command line as the only authorization, and both append one audit line per authorized signal. `interrupt`
155
+ additionally requires `--reason` and writes it into the seat's thread and inbox **before** the signal: an
156
+ interrupted seat has to learn why it was stopped, and that entry is part of its reading order on resume.
157
+
158
+ Never swap them — an interrupt aimed at an orphan's pid is refused (no window), and a reap aimed at a live seat is
159
+ refused (its pane is alive; `reap` only judges orphans); each refusal names the other entry. Both are turn/process
160
+ entries only: `interrupt` leaves the window as a live shell, leaves the worktree, the session file and the
161
+ assignment record untouched, and does not touch the seat's detached background jobs (§4's `team-bg` lane).
162
+
132
163
  ## 4b. Key replies: publish the body before you answer
133
164
 
134
- The wake-up loop carries a *pointer* (`inbox/<agent>.md` plus a knock), and the report carries the *process*. Neither
135
- carries the **body** of a substantive answer, and both are transient or post-hoc: the inbox is gitignored, and a report
136
- is written after the work. When an answer itself is the durable artefact — a decision, a trade-off, a root cause, a
137
- finding someone will quote weeks later — publish that body explicitly before you send it:
165
+ Publishing the body of a key conclusion is a **standing duty of the PM**, not a licence for answers that merely look
166
+ memorable: it travels with the tool, so it holds in every project and on every machine. The wake-up loop carries a
167
+ *pointer* (`inbox/<agent>.md` plus a knock) and the report carries the *process*; neither carries the **body**, and
168
+ both are transient or post-hoc — the inbox is gitignored, and a report is written after the work. **The reader
169
+ decides what is published**: whenever the reply is written for the user — a landed milestone, an answer to a
170
+ question, a status or progress report, a conclusion or a ruling, a decision you ask the user for, a delivery or
171
+ verification summary, however short — publish the **complete reply** — the substance the user needs to read, not a
172
+ play-by-play of the work — with:
138
173
 
139
174
  ```
140
175
  team reply post --from <seat> --title "<short single line>" --stdin <<'EOF'
@@ -142,7 +177,15 @@ team reply post --from <seat> --title "<short single line>" --stdin <<'EOF'
142
177
  EOF
143
178
  ```
144
179
 
145
- Then send the answer normally. Publication **never gates the answer**: the same body goes out whether the post
180
+ **The reader decides, so ask "who is this reply written for?"** A reply meant for the patrol or the watchdog, for
181
+ another seat, or for another project's PM stays in its own channel, and a receipt a tool generated is not a reply at
182
+ all. Length never decides: a one-line answer or a short progress report meant for the user is published in full.
183
+ A reply is never held back because of its kind: a status or progress report, a delivery summary and a decision
184
+ request are published exactly as a conclusion is, and reading like process never makes a reply unpublishable.
185
+ When the reader cannot be settled, treat the reply as meant for the user rather than risk the user missing it.
186
+
187
+ A batch of user-facing replies may be one reply. Then send the answer normally. Publication **never gates the
188
+ answer**: the same body goes out whether the post
146
189
  reported `saved` (0), an input error (2), storage unavailable (4), a busy writer (5, the lock wait is bounded) or
147
190
  `unconfirmed` (6, the entry is visible but its durability could not be confirmed — never re-post it automatically).
148
191
  Failures are diagnostics on stderr; they must not be concatenated into the answer, and they must not stop it.
@@ -160,8 +203,10 @@ What a receipt does and does not mean:
160
203
  (newest first), `team reply show <no>` prints safe display text, `team reply show <no> --raw` exports the original
161
204
  bytes to a non-TTY stdout, and the console's page 5 renders the latest reply plus the numbered history. Flags and
162
205
  exit codes are in `team reply --help`.
163
- - **The honest limit**: the fixtures can only prove that both exits carry the same body for a *fixture* agent. No tool
164
- can verify that a real agent follows this guidance — so it is written here as a rule, not enforced by the store.
206
+ - **The honest limit**: the gate holds only that this duty is shipped on the instruction surfaces (the injected PM
207
+ prompt template, this section, the command table) and that the example command printed there is accepted by the real
208
+ parser. No tool can verify that a live PM follows the duty — whether a given reply was meant for the user, which
209
+ conclusions a PM published, and whether the body matched the answer, stay unprovable from here.
165
210
 
166
211
  ## 5. Task briefs: written for "a weak model without context"
167
212
 
@@ -609,20 +654,112 @@ carries an illegal token, so the read side and the write side can never disagree
609
654
  - Acceptance commands in a brief should carry their own timeout as well; destructive experiment scripts must restore
610
655
  the scene with `trap 'git checkout -- …' EXIT`.
611
656
 
612
- ### 9b-2. The gate is the machine's one shared resource (queue, and the measurement premise)
657
+ ### 9b-2. The gate is the machine's one shared resource (queue)
613
658
 
614
659
  The full gate — `openspec validate … && bash skills/teamsmith/tests/smoke.sh` — spends the machine's tmux servers,
615
660
  node/bun processes and login shells, so it is serialised on **one gate lock**
616
- (`${TEAM_SMOKE_LOCK:-${TMPDIR:-/tmp}/teamsmith-smoke.lock}`, holder recorded in `<lock>.holder`, wait capped by
617
- `TEAM_SMOKE_LOCK_WAIT`, default 1800 s). Use `TEAM_SMOKE_FAST=1` for in-batch self-tests (pure-logic sections
618
- only; measured in the low minutes on a loaded 32-core box, not the seconds it once was - P100's F6) and the
619
- **full** suite for delivery and review.
661
+ (`${TEAM_SMOKE_LOCK:-${TMPDIR:-/tmp}/teamsmith-smoke.lock}`, wait capped by `TEAM_SMOKE_LOCK_WAIT`, default
662
+ 1800 s — extended to `4 ×` that while the run it waits for keeps publishing heartbeats, see below). Use
663
+ `TEAM_SMOKE_FAST=1` for in-batch self-tests (pure-logic sections only; measured in the low minutes
664
+ on a loaded 32-core box, not the seconds it once was - P100's F6) and the **full** suite for delivery and review.
665
+
666
+ **The gate lock is a pair: a published path (compatibility) and a companion (the mutex).** The published path is
667
+ what a writer of an earlier release — which knows only that name — takes, so a run takes it **first** and then the
668
+ companion `<same dir>/.<basename>.machine`, where the mutex actually lives and where the run keeps its records
669
+ (`<companion>.holder`, `<companion>.runs/<pid>.run`). The companion is dot-prefixed on purpose: a shared temp root
670
+ collects other projects' cleanups, and a `rm -rf ${TMPDIR}/teamsmith-smoke.*` from one of them must not be able to
671
+ reach this project's lock (that incident deleted a running gate's lock and work root; a shared `teamsmith-` prefix
672
+ is not ownership). **Neither file is ever unlinked** — removing a lock file that waiters are blocked on is exactly
673
+ the silent split the pair exists to remove — and only the holder's own record and run entry are removed at the end
674
+ of the run. The run takes both locks **in its own process** (fds 8/9) and hands the suite to a child with those
675
+ descriptors closed (`8>&- 9>&-`), so a fixture's background process cannot inherit the lock and hold it past the
676
+ run. The holder record carries the locking process's own descriptor identity (`lock_identity=fd|path`,
677
+ `lock_dev_ino=<dev:ino>`) — the identity of the file the holder really holds, readable only through that process's
678
+ `/proc`; when that cannot be read the record says `path` and the path's identity instead, rather than guessing.
679
+
680
+ **Losing the lock while running is loud and stops the run.** The 0.2 s tripwire watches the companion as well:
681
+ when the lock is no longer the file the holder holds — *gone* (unlinked, not rebuilt) or *replaced* (the path now
682
+ names a different inode; `rm`+recreate and `mv`-over both land here) — it prints one line saying which of the two
683
+ happened, with the inode the holder holds and the one now on the path, appends the evidence (identity, the
684
+ published path's state, the last section reached) next to the run's `$TMP` — outside it, so deleting the scene
685
+ does not take it — and stops at the next safe point with exit 2 and **no result line**: a verdict computed after
686
+ the mutex broke is not honest, and a plain red would bury *when* the lock went. Losing the **published** path alone
687
+ is printed once and does not stop the run (the mutex is on the companion; what is lost is serialisation against
688
+ older writers). A run that takes a lock whose live `top` record attests **another** identity refuses in the same
689
+ way *before* running the suite — that record is the observable form of a mutex that is already broken.
620
690
 
621
691
  **A lock that cannot be taken is a visible degradation, not a hard failure.** If the lock file cannot be
622
692
  created (or `flock` is absent) the suite prints `注意:锁文件 … 建不了 → 不做排队` and runs anyway; only a
623
- *queue overrun* is loud (a one-line `排队超限` naming the holder in `<lock>.holder`, exit 2), and a genuine
693
+ *queue overrun* is loud (a one-line `排队超限` naming the holder in `<companion>.holder`, exit 2), and a genuine
624
694
  red is exit 1 with no queue wording (P66/P100's F1).
625
695
 
696
+ **A nested run does not queue on the gate lock, and it must prove its ancestor.** The lock serialises
697
+ **top-level** runs only. A run started inside a run that holds the lock — *proved* by walking the process
698
+ ancestry to a pid recorded in `<companion>.holder` / `<companion>.runs/<pid>.run` and matching that process's
699
+ start time, never by the inherited `SMOKE_LOCK_WRAPPED` marker (a fixture can clear it, and a nested run carrying
700
+ it used to overwrite and delete the real holder's record) — does not queue: queueing there hands the machine's one
701
+ shared resource to a fixture and deadlocks the run against its own ancestor. It registers itself in
702
+ `<companion>.runs/<pid>.run` instead, so a waiter can attribute what it is waiting for. A run that cannot prove a
703
+ live ancestor holding the lock (including on a host without `/proc`) is treated as top-level and queues exactly
704
+ as before, so skipping the queue is never unconditional. The claim that a run is "the one that holds the lock"
705
+ must be backed by the locking process's own `/proc` — its descriptor pointing at the companion, with the identity
706
+ the run was handed — or by a live record naming it: environment variables alone name nobody. The claimant must
707
+ also be a **strict** ancestor of the claiming suite (a section-selected run adds one more process layer, so the
708
+ locker is the grandparent there and the parent in the direct case, and both are covered). The holder record names its kind (`top`/`nested`), its
709
+ seat and its worktree (derived from the runtime directory by the same rule as `team notify`'s sender, never from
710
+ a tmux window name; unresolvable fields are written `?`, not guessed), its start time, and the `expected` /
711
+ `bound` pair (the section table's Σband / Σbudget over the sections that run will execute — since P316 retired
712
+ that table the pair is a **diagnostic** field: it is still written and still printed, and it decides nothing),
713
+ and the waiter prints
714
+ that record when it starts queueing and again when it hits its cap. Only the process that really holds the lock
715
+ writes and removes the holder record — and it writes only when that record is absent, stale (its process is gone)
716
+ or already names that same pid: the inherited `SMOKE_LOCK_MARKER` file is a hint, not a proof, so a descendant
717
+ that rewrites the marker with its own pid still cannot overwrite or delete a record naming another **live**
718
+ process. A record whose process is gone is printed as stale and ignored, and no run removes a record it did not
719
+ write. A nested run must finish inside the section that spawned it: its section
720
+ guard is armed with a deadline taken from the ancestor's currently armed section (the record publishes the
721
+ section guard's heartbeat path; the nested run reads `armed_epoch + budget` and takes the smaller of that and
722
+ its own table budget), so it trips at the suite's own safe point, names the section and the bound, stops and
723
+ leaves its scene; a fixture that leaves a registered nested run alive after its spawning section closed gets one
724
+ visible line naming it, and only the pids the fixture itself registered are signalled.
725
+
726
+ **The residual window is the explicit opt-out.** `TEAM_SMOKE_NO_LOCK=1`, a host without `flock` or the fast mode
727
+ (which runs no real-process section) leave the suite unserialised, so two seats' nested runs can overlap there.
728
+ The suite prints `no_lock=1` with the reason **and registers that run** in `<companion>.runs/<pid>.run` with
729
+ `no_lock=1` when that happens: the window is *observable* in the record, not just on stdout, and it is not
730
+ asserted away. The gate can prove that the record carries these fields, that a waiter prints them, and that a nested run
731
+ past its bound is named and stopped — it **cannot** prove that a live seat read the line and acted on it, nor
732
+ that two seats' nested runs never overlap. Those two are outside what the gate can show.
733
+
734
+ **A waiter re-resolves the path it is waiting on.** The wait is a bounded poll (one short non-blocking
735
+ `flock` per second, cap recomputed each round), not a single blocking `flock`: when the lock the waiter is
736
+ blocked on is unlinked and rebuilt while it waits, it prints one line with both identities (what it was waiting
737
+ on, what is on the path now) and goes on waiting on the path — never silently on a dead inode, which is how a
738
+ waiter ends up "holding" a lock nobody else can see.
739
+
740
+ **The queue cap follows the holder's heartbeat; the published `expected` no longer decides it.** Every round of
741
+ the poll re-reads the lock's **live** records — `<companion>.holder` *and* `<companion>.runs/<pid>.run` — and
742
+ takes the newest published heartbeat file that is still there. The holder record alone is not enough: a
743
+ top-level suite's holder record names the locking wrapper's heartbeat path, which nobody writes, and a
744
+ review's holder record carries `heartbeat=-` while the suite that review spawned registers a heartbeat that
745
+ does move. While the newest heartbeat's last movement is less than `TEAM_SMOKE_LOCK_WAIT` ago the waiter keeps
746
+ waiting, with the cap at `4 × TEAM_SMOKE_LOCK_WAIT`; when no usable heartbeat exists — an older writer, a
747
+ record whose `heartbeat=` is `-`, a published path whose file is gone, or a silence of `TEAM_SMOKE_LOCK_WAIT`
748
+ or more — the cap stays `TEAM_SMOKE_LOCK_WAIT` exactly as before, so a stalled holder is waited out for at most
749
+ `TEAM_SMOKE_LOCK_WAIT`. The queue line prints both bounds together with the heartbeat's state, and the failure
750
+ line says whether the heartbeat had been silent or had never been published. The read is not authenticated
751
+ against the current holder's ancestry: a leftover registration that is still alive can hold the cap at `4 ×`
752
+ while the real holder is stuck — accepted on purpose, and bounded at two hours by default. The verdict token
753
+ set (`PASS|FAIL|TIMEOUT|SKIPPED|UNKNOWN`), the
754
+ `queued Ns / ran Ns / limit Ns` accounting and the rule that a queue overrun is `FAIL` (never `TIMEOUT`) with
755
+ the holder named are all unchanged. `team review` takes the same pair, in the same order, in its own process,
756
+ and runs the project's gate with the lock descriptors closed: its gate record still separates `queued` from
757
+ `ran`, and a broken mutex makes the verdict `FAIL` with its own marker (internal `mutexbroken`; rendered as
758
+ `gate mutex broken(互斥被破坏:判定不可信)` in the record's flags, alongside `queuecap`) — either before the
759
+ gate runs (a live `top` record attesting another identity: the gate did **not** run, and the record says so,
760
+ exactly as the `queuecap` shape does) or after it (the gate ran, the record says the verdict is not trustworthy,
761
+ and it does not claim the gate never ran).
762
+
626
763
  **The gate fingerprints the tree it judges (P158).** Once the run's own root exists it records `HEAD` and the
627
764
  sha256 of `git status --porcelain --untracked-files=all` (untracked files included) into the run's scene file
628
765
  (`<run tmp>/run-fingerprint.txt`, next to `sections.tsv`), and compares that fingerprint again after the last
@@ -657,30 +794,43 @@ The gate judges **correctness only**: it contains no wall-clock or CPU-share red
657
794
  gate's own sources (`tests/gate-guard.sh`) fails when a frame-budget/CPU-share marker reappears in it or when the
658
795
  performance suite loses its markers. The three panel numbers — the interactive first frame, the uncached frame
659
796
  assembly and the steady-state pane CPU — belong to the **performance suite**
660
- (`bash skills/teamsmith/tests/perf.sh`, front door `team perf`): the thresholds (`2000 ms` / `2000 ms` / `< 1 %` of
661
- one core), the premise factors (`0.75` for the five-sample assembly median, `0.25` for the cold-start first frame
662
- and the sampled pane CPU, `TEAM_PANEL_CPU_PREMISE_FACTOR`) and the median-of-three/five rules are unchanged, every
663
- sample is printed, and above the premise the judgement **skips visibly** (exit `4` for a skip, `2` for a red, `0`
664
- only when every judgement ran green) rather than reporting a red the machine owes. The suite takes its **own** lock
665
- (`TEAM_PERF_LOCK`, `TEAM_PERF_LOCK_WAIT`, holder in `<lock>.holder`) and **never** takes `TEAM_SMOKE_LOCK`: it does
797
+ (`bash skills/teamsmith/tests/perf.sh`, front door `team perf`) and are **readings**: every sample is printed
798
+ together with the environment it was taken in, there is no threshold and no premise factor, and no number it prints
799
+ can fail a run. The suite takes its **own** lock
800
+ (`TEAM_PERF_LOCK`, `TEAM_PERF_LOCK_WAIT`, holder in `<companion>.holder`, where `<companion>` is
801
+ `<same dir>/.<basename>.machine` — the same pair the gate uses, so a perf lock survives the same incident) and **never** takes `TEAM_SMOKE_LOCK`: it does
666
802
  one read-only non-blocking probe of the gate lock and prints the holder when the correctness gate is running, but
667
- it never queues behind it. The gate's lock accounting (`limit=Ns queued=Ns ran=Ns`), the fixture-knob rule (those
668
- `TEAM_*` knobs only work under `TEAM_SMOKE_FIXTURE=1`, and in the real path they are ignored and printed) and the
669
- gate's time-independent half of that check (`tests/panel-knobs.sh`) are unchanged; a red performance run changes no
670
- review verdict. The contracts live in the specs (`verification#The correctness gate judges correctness only`,
671
- `verification#The performance suite is separate, self-describing and non-blocking`,
803
+ it never queues behind it. Its exit codes are `0` (a reading was taken) and `3` (setup failed, or the perf lock
804
+ was unavailable): there is no judgement, so there is no `2`/`4`. The gate's lock accounting (`limit=Ns queued=Ns
805
+ ran=Ns`), the fixture-knob rule (those `TEAM_*` knobs only work under `TEAM_SMOKE_FIXTURE=1`, and in the real path
806
+ they are ignored and printed) and the gate's time-independent half of that check (`tests/panel-knobs.sh`) are
807
+ unchanged; a performance run changes no review verdict. Its readings are taken once before a release, in the
808
+ pinned image, and pasted into that release's record (`docs/team/reviews/release-<version>.md`); the release
809
+ checklist names the command. The contracts live in the specs
810
+ (`verification#The correctness gate judges correctness only, and a duration is a reading`,
811
+ `verification#The performance suite is separate, self-describing, and its numbers are reference-only`,
672
812
  `verification#The hard timeout covers the gate run, not the queue`,
673
813
  `panel#Frame assembly is asynchronous, cached and never blocks input`); this section is the operational rule.
674
814
 
675
815
  The gate also reports **its own temp-root usage**: one line at the start and one with the result summary (also on
676
- failure) name the run's root, its size and its file count, and the run asserts that every root it created is gone
677
- unless it declared one kept. Fixtures get their root from `${TMPDIR:-/tmp}/teamsmith-<kind>.XXXXXX` through the
816
+ failure) name the run's root, its size, its file count and **how the root was resolved** (`source=tmpdir|config|
817
+ default`, plus the `TEAM_TMP_ROOT` value that lost when `TMPDIR` overrode it); the run also asserts that every root
818
+ it created is gone unless it declared one kept. Fixtures get their root from the
819
+ resolved temp root (`TMPDIR` → `TEAM_TMP_ROOT` → `/var/tmp/teamsmith-<ns>`, one resolver, never re-implemented):
820
+ `<that root>/teamsmith-<kind>-<ns>.XXXXXX`
821
+ (`ns = <slug>-<hash8>`, derived from the main checkout, so every worktree of one project shares it and two projects
822
+ cannot collide; the helper records it in the root's marker and the run ledger, `tmp-hygiene.sh --status` shows it,
823
+ and roots that predate the namespace are listed as `legacy`) through the
678
824
  single owner helper `tests/lib/tmp-root.sh` (owner marker inside, run ledger outside, reclaim on `EXIT`/`INT`/`TERM`,
679
825
  `TEAM_TMP_KEEP=1` to keep); residual roots are reclaimed by an **operator** action,
680
826
  `bash skills/teamsmith/tests/tmp-hygiene.sh --status` then `--sweep` (it proves a root is unoccupied before
681
- deleting, and refuses with nothing deleted when it cannot). The gate never sweeps: a fixture another agent started
827
+ deleting, and refuses with nothing deleted when it cannot), or by deleting only this project's own
828
+ `teamsmith-<kind>-<ns>.*` entries. A pattern against the shared prefix — `rm -rf "$(team_tmp_root)/teamsmith-*"` — is
829
+ forbidden: that shape is what deleted another project's running gate's lock on 2026-10-15, and a shared prefix is
830
+ not ownership. Everything a run creates directly under the temp root is either dot-prefixed (ledger, pid, evidence)
831
+ or carries the ns (root, queue marker, filter copy). The gate never sweeps: a fixture another agent started
682
832
  by hand is not in the gate lock, so pattern-deleting in the shared temp filesystem is the D37 family. `team doctor`
683
- prints the temp root's headroom (free/total bytes and inodes, warning only) so a full tmpfs is visible before it
833
+ prints the temp root's headroom (free/total bytes and inodes, warning only) so a full filesystem is visible before it
684
834
  turns into a red a fixture cannot explain.
685
835
 
686
836
  ### 9b-3. The ledger is public, so the ban is a gate check (D94)
@@ -778,3 +928,24 @@ The mechanism backs this up wherever the ledger already knows the name: `team di
778
928
  board-skipped line, wrap-up, suggestions), `team status` and `team roster` print the name next to the code, resolving
779
929
  it from the BOARD's task column first, then the task brief's H1, then the task's report H1. When no name is known the
780
930
  code is printed alone — never a made-up name, and never a hidden code: the code is the key to the ledger.
931
+
932
+ ### 11b. A caution earns its place by what it cites; a finding earns its place by what it changes
933
+
934
+ The rule in this section is about **support**, not tone. A sentence that hedges, qualifies, warns or sets a boundary
935
+ stays only when it names something the reader can check — a measurement, a counterexample, a gap in the reasoning,
936
+ or a boundary that was not observed; a sentence that names none is deleted, not kept as evidence of care. When the
937
+ evidence no longer supports a claim, say what the evidence does support instead of narrowing the claim, and never
938
+ delete a boundary statement that carries its evidence: it names exactly what this rule asks for. A finding,
939
+ likewise, states what it changed — the implementation, the next step, the conclusion, or nothing; an observation
940
+ that changes nothing does not stand between the reader and the answer. This is not an instruction to sound more
941
+ confident, more assertive or shorter (the measurements are in *Defensive Writing in GPT Models*, arXiv:2610.11355);
942
+ the vocabulary rule of §11 stands unchanged.
943
+
944
+ The reason is who rewards which text. In that study's comparison an AI reviewer scores a reviewer-oriented rewrite
945
+ higher (+1.22 on a ten-point scale) while the human readers find it harder to read (−0.70 on a seven-point scale)
946
+ with comprehension unchanged: a caution written for an imagined reviewer is paid for by the reader, so it has to
947
+ carry its evidence to earn its place.
948
+
949
+ **No tool verifies that a live author follows this rule.** The gate asserts nothing about wording — it can stay
950
+ green over a document that hedges everywhere — so whether a sentence earns its place is decided by the review that
951
+ reads the diff, and a surface that later loses the rule is caught there, by the reviewer naming the surface.