teamsmith 0.1.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/README.md +13 -7
  2. package/package.json +1 -1
  3. package/skills/teamsmith/CHANGELOG.md +67 -0
  4. package/skills/teamsmith/SKILL.md +26 -8
  5. package/skills/teamsmith/extension/team-notify.ts +37 -6
  6. package/skills/teamsmith/extension/team.ts +438 -0
  7. package/skills/teamsmith/references/agent-adapters.md +7 -7
  8. package/skills/teamsmith/references/config.md +65 -18
  9. package/skills/teamsmith/references/migration.md +220 -34
  10. package/skills/teamsmith/references/protocol.md +250 -25
  11. package/skills/teamsmith/references/troubleshooting.md +124 -7
  12. package/skills/teamsmith/references/workflows.md +66 -20
  13. package/skills/teamsmith/scripts/lib/cmd-agents.sh +525 -90
  14. package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +71 -10
  15. package/skills/teamsmith/scripts/lib/cmd-config.sh +562 -128
  16. package/skills/teamsmith/scripts/lib/cmd-death.sh +2 -15
  17. package/skills/teamsmith/scripts/lib/cmd-docs.sh +6 -3
  18. package/skills/teamsmith/scripts/lib/cmd-draft.sh +4 -4
  19. package/skills/teamsmith/scripts/lib/cmd-help.sh +677 -0
  20. package/skills/teamsmith/scripts/lib/cmd-init.sh +157 -5
  21. package/skills/teamsmith/scripts/lib/cmd-interrupt.sh +461 -0
  22. package/skills/teamsmith/scripts/lib/cmd-meeting.sh +2 -25
  23. package/skills/teamsmith/scripts/lib/cmd-project.sh +149 -105
  24. package/skills/teamsmith/scripts/lib/cmd-reap.sh +277 -0
  25. package/skills/teamsmith/scripts/lib/cmd-reply.sh +96 -0
  26. package/skills/teamsmith/scripts/lib/cmd-review.sh +188 -40
  27. package/skills/teamsmith/scripts/lib/cmd-status.sh +268 -30
  28. package/skills/teamsmith/scripts/lib/cmd-update.sh +36 -7
  29. package/skills/teamsmith/scripts/lib/cmd-watch.sh +634 -54
  30. package/skills/teamsmith/scripts/lib/common.sh +1560 -109
  31. package/skills/teamsmith/scripts/lib/gate-lock.sh +544 -0
  32. package/skills/teamsmith/scripts/monitor.mjs +34 -3
  33. package/skills/teamsmith/scripts/panel/README.md +22 -11
  34. package/skills/teamsmith/scripts/panel/draft-send.sh +11 -1
  35. package/skills/teamsmith/scripts/panel/panel.js +226 -224
  36. package/skills/teamsmith/scripts/panel/src/App.tsx +478 -184
  37. package/skills/teamsmith/scripts/panel/src/clipboard.ts +11 -5
  38. package/skills/teamsmith/scripts/panel/src/compose.ts +6 -3
  39. package/skills/teamsmith/scripts/panel/src/data.ts +95 -7
  40. package/skills/teamsmith/scripts/panel/src/layout.ts +703 -152
  41. package/skills/teamsmith/scripts/panel/src/main.tsx +129 -19
  42. package/skills/teamsmith/scripts/panel/src/settings.ts +1 -1
  43. package/skills/teamsmith/scripts/panel/src/strings/en.ts +76 -31
  44. package/skills/teamsmith/scripts/panel/src/strings/zh.ts +78 -33
  45. package/skills/teamsmith/scripts/panel/src/types.ts +204 -17
  46. package/skills/teamsmith/scripts/replies.mjs +896 -0
  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 +20 -6
  52. package/skills/teamsmith/templates/AGENTS.section.md.tmpl +23 -3
  53. package/skills/teamsmith/templates/BOARD.md.tmpl +2 -2
  54. package/skills/teamsmith/templates/OWNERSHIP.md.tmpl +7 -3
  55. package/skills/teamsmith/templates/PROTOCOL.md.tmpl +17 -0
  56. package/skills/teamsmith/templates/config.sh.tmpl +29 -5
  57. package/skills/teamsmith/templates/memory-seed.md.tmpl +3 -0
  58. package/skills/teamsmith/templates/pm-prompt.md.tmpl +41 -1
  59. package/skills/teamsmith/templates/report.md.tmpl +12 -0
  60. package/skills/teamsmith/templates/task.md.tmpl +4 -0
  61. package/skills/teamsmith/tests/bg-ledger-harness.mjs +464 -40
  62. package/skills/teamsmith/tests/bg-ledger.sh +168 -10
  63. package/skills/teamsmith/tests/checkout-shape-probe.sh +3 -1
  64. package/skills/teamsmith/tests/config-cli.sh +320 -300
  65. package/skills/teamsmith/tests/death-cause.sh +5 -2
  66. package/skills/teamsmith/tests/fixtures/delivery-truth-real/scenario.sh +7 -1
  67. package/skills/teamsmith/tests/fixtures/p287/lint-good.sh.in +3 -0
  68. package/skills/teamsmith/tests/fixtures/p287/lint-hardcoded.sh.in +3 -0
  69. package/skills/teamsmith/tests/fixtures/p287/lint-no-ns.sh.in +3 -0
  70. package/skills/teamsmith/tests/fixtures/p55/flip-p49.sh +18 -6
  71. package/skills/teamsmith/tests/flip-m33.sh +5 -3
  72. package/skills/teamsmith/tests/flip-m37.sh +4 -1
  73. package/skills/teamsmith/tests/flip-m4.3.sh +4 -1
  74. package/skills/teamsmith/tests/flip-m6.3.sh +4 -1
  75. package/skills/teamsmith/tests/flip-m6.5.sh +4 -1
  76. package/skills/teamsmith/tests/flip-m7.2.sh +4 -1
  77. package/skills/teamsmith/tests/flip-p158.sh +2 -1
  78. package/skills/teamsmith/tests/flip-p210.sh +4 -1
  79. package/skills/teamsmith/tests/flip-p217.sh +4 -1
  80. package/skills/teamsmith/tests/flip-p287-lock.sh +342 -0
  81. package/skills/teamsmith/tests/flip-p287-name.sh +279 -0
  82. package/skills/teamsmith/tests/flip-p304-read-side.sh +98 -0
  83. package/skills/teamsmith/tests/flip-p308-skip-not-pass.sh +151 -0
  84. package/skills/teamsmith/tests/flip-p309-p162-deep.sh +122 -0
  85. package/skills/teamsmith/tests/flip-p310-lock.sh +216 -0
  86. package/skills/teamsmith/tests/flip-p310-socket.sh +125 -0
  87. package/skills/teamsmith/tests/help-surface.sh +1664 -0
  88. package/skills/teamsmith/tests/install-shape.sh +283 -22
  89. package/skills/teamsmith/tests/key-replies-pty.sh +374 -0
  90. package/skills/teamsmith/tests/key-replies-ui.sh +325 -0
  91. package/skills/teamsmith/tests/key-replies.sh +1314 -0
  92. package/skills/teamsmith/tests/ledger-ban.sh +9 -8
  93. package/skills/teamsmith/tests/ledger-claim.sh +248 -0
  94. package/skills/teamsmith/tests/lib/bounded-spin.sh +90 -0
  95. package/skills/teamsmith/tests/lib/model-policy.sh +30 -0
  96. package/skills/teamsmith/tests/lib/model-routing-boundary.sh +420 -0
  97. package/skills/teamsmith/tests/lib/model-routing-expansion.sh +155 -0
  98. package/skills/teamsmith/tests/lib/model-routing-flips.py +187 -0
  99. package/skills/teamsmith/tests/lib/model-routing-roles.sh +250 -0
  100. package/skills/teamsmith/tests/lib/proc-io.sh +103 -0
  101. package/skills/teamsmith/tests/lib/reply-fixture.sh +367 -0
  102. package/skills/teamsmith/tests/lib/section-guard.sh +258 -13
  103. package/skills/teamsmith/tests/lib/tmp-root.sh +139 -27
  104. package/skills/teamsmith/tests/lib/tmux-cap.sh +10 -1
  105. package/skills/teamsmith/tests/lib/tmux-iso.sh +39 -13
  106. package/skills/teamsmith/tests/loop-inventory.tsv +59 -47
  107. package/skills/teamsmith/tests/panel-b2.sh +107 -4
  108. package/skills/teamsmith/tests/panel-b3-stub.sh +139 -4
  109. package/skills/teamsmith/tests/panel-b3.sh +189 -29
  110. package/skills/teamsmith/tests/panel-choices.sh +81 -63
  111. package/skills/teamsmith/tests/panel-cpu.sh +3 -2
  112. package/skills/teamsmith/tests/panel-knobs.sh +7 -1
  113. package/skills/teamsmith/tests/panel-p21.sh +445 -241
  114. package/skills/teamsmith/tests/panel-snapshots.sh +41 -225
  115. package/skills/teamsmith/tests/panel-strings.mjs +33 -18
  116. package/skills/teamsmith/tests/perf.sh +122 -31
  117. package/skills/teamsmith/tests/pm-box-real.sh +1 -1
  118. package/skills/teamsmith/tests/pulse-nudge-key.sh +1 -1
  119. package/skills/teamsmith/tests/routes.sh +364 -109
  120. package/skills/teamsmith/tests/seat-interrupt.sh +1002 -0
  121. package/skills/teamsmith/tests/seat-visibility.sh +675 -0
  122. package/skills/teamsmith/tests/section-budgets.tsv +26 -12
  123. package/skills/teamsmith/tests/section-guard.sh +6 -1
  124. package/skills/teamsmith/tests/section-needs-audit.sh +24 -7
  125. package/skills/teamsmith/tests/section-paths.tsv +42 -26
  126. package/skills/teamsmith/tests/section-select.sh +90 -7
  127. package/skills/teamsmith/tests/slash-team-e2e.sh +323 -0
  128. package/skills/teamsmith/tests/slash-team.sh +617 -0
  129. package/skills/teamsmith/tests/smoke.sh +3762 -628
  130. package/skills/teamsmith/tests/snapshots/zh-dark-120-detail.txt +2 -2
  131. package/skills/teamsmith/tests/snapshots/zh-dark-120-p4.txt +2 -2
  132. package/skills/teamsmith/tests/snapshots/zh-dark-120.txt +9 -9
  133. package/skills/teamsmith/tests/snapshots/zh-dark-160-p4.txt +2 -2
  134. package/skills/teamsmith/tests/snapshots/zh-dark-160.txt +9 -9
  135. package/skills/teamsmith/tests/snapshots/zh-dark-59-detail.txt +1 -1
  136. package/skills/teamsmith/tests/snapshots/zh-dark-59-p4.txt +1 -1
  137. package/skills/teamsmith/tests/snapshots/zh-dark-59.txt +5 -5
  138. package/skills/teamsmith/tests/snapshots/zh-dark-99-p4.txt +2 -2
  139. package/skills/teamsmith/tests/snapshots/zh-dark-99.txt +5 -5
  140. package/skills/teamsmith/tests/snapshots/zh-light-120-detail.txt +2 -2
  141. package/skills/teamsmith/tests/snapshots/zh-light-120-p4.txt +2 -2
  142. package/skills/teamsmith/tests/snapshots/zh-light-120.txt +9 -9
  143. package/skills/teamsmith/tests/snapshots/zh-light-160-p4.txt +2 -2
  144. package/skills/teamsmith/tests/snapshots/zh-light-160.txt +9 -9
  145. package/skills/teamsmith/tests/snapshots/zh-light-59-detail.txt +1 -1
  146. package/skills/teamsmith/tests/snapshots/zh-light-59-p4.txt +1 -1
  147. package/skills/teamsmith/tests/snapshots/zh-light-59.txt +5 -5
  148. package/skills/teamsmith/tests/snapshots/zh-light-99-p4.txt +2 -2
  149. package/skills/teamsmith/tests/snapshots/zh-light-99.txt +5 -5
  150. package/skills/teamsmith/tests/task-header-model.sh +2 -1
  151. package/skills/teamsmith/tests/task-model-routing.sh +1511 -0
  152. package/skills/teamsmith/tests/tmp-hygiene.sh +782 -45
  153. package/skills/teamsmith/tests/tmux-identity-leak.sh +773 -0
  154. package/skills/teamsmith/tests/tmux-lint-legacy.txt +12 -18
  155. package/skills/teamsmith/tests/upgrade-recipe.sh +537 -0
  156. package/skills/teamsmith-init/SKILL.md +43 -43
  157. package/skills/teamsmith-init/references/bootstrap.md +8 -6
  158. package/skills/teamsmith-init/templates/bootstrap-prompt.md.tmpl +9 -5
@@ -40,10 +40,11 @@ literals or simple `$VAR`.
40
40
  | `TEAM_SESSION` | `$TEAM_PROJECT` | tmux session (shared by the PM and every agent) |
41
41
  | `TEAM_PM_WINDOW` | `pm` | the window the PM session lives in; notifications are typed there |
42
42
  | `TEAM_AGENTS` | empty (`init` sets `dev verify`) | roster, space separated; grows only through `team add-agent <a> --register` and shrinks only through `team teardown --agent <a> --register` (both audited; a bare `team add-agent <a>` refuses a seat the roster does not carry and names both routes) |
43
- | `TEAM_AGENT_MODELS` | empty | per-agent model override: `dev=deepseek/deepseek-flash verify=xai/grok-4.6` |
44
- | `TEAM_DEFAULT_MODEL` | `deepseek/deepseek-flash` | default model (`provider/model`) |
43
+ | `TEAM_TASK_MODELS` | empty (required) | the project's task-category → model map: `routine=provider/light analysis=provider/strong verify=provider/strong`. A **new** dispatch selects the model of the brief's `category:` from it; a complete same-task recovery keeps the model/SID it was already assigned, even after the category leaves the map. One category: `team config set-task-model <category> <model>`; the whole map: `team config set TEAM_TASK_MODELS '<map>' --yes`; breaking migration: the next `team up` (startup transaction) or `team config upgrade-models` |
44
+ | `TEAM_PM_MODEL` | empty (required) | the **independent PM model** — never a fallback to a task model or a worker default. `team up` guards it (a running PM with a different model needs an explicit `--fresh-pm`) |
45
+ | `TEAM_CONFIG_VERSION` | the current shape (written by the tool) | the configuration **shape number** (`refuse` class — the console never writes it). A project without the key is classified by its keys; a number higher than this tool's newest known shape is refused instead of migrated. `init`/`bootstrap` write the current number and the startup transaction writes it when it migrates an old shape |
45
46
 
46
- Dispatch model resolution order: `--model` > `TEAM_AGENT_MODELS` (per-agent) > `TEAM_DEFAULT_MODEL`. The roster's recorded `model` is display-only ("what ran last time"); `team roster` and `team ps` tag it with its source label (current config / explicit `--model` / stale record whose config changed since — the CLI prints these labels in Chinese). It never feeds resolution, so editing the config takes effect on the very next dispatch. |
47
+ Categories are the project's own vocabulary (`[a-z][a-z0-9-]*`, unique): routine/analysis/verify are the initial example, not an engine list, and `phase:`/seat never selects a model automatically. The initial suggestion is `routine=opencode-go/deepseek-v4.1-flash`, `analysis`/`verify=openai-codex/gpt-6.1-sol:high`, independent PM the same strong model — examples, not defaults or a provider-availability claim. The retired keys TEAM_AGENT_MODELS / TEAM_DEFAULT_MODEL are no longer read: a project that still carries them is refused by the loader and by init/bootstrap, and migrates on the next `team up` (the startup transaction derives the pairs from the old keys, prints them before → after, backs the file up and writes through the same checked writer) or through the explicit `team config upgrade-models --task-models '<map>' --pm-model '<model>'` transaction (preview first, then `--yes`) — never through `team init --force`, bootstrap or an inference. The refusal advice carries one paste-ready `team config upgrade-models …` command derived from that project's own configuration, or names the obstacle when the derivation is not unambiguous.
47
48
  | `TEAM_MODEL_LIMITS` | `kimi-coding/k3=2` | concurrency limits, `provider/model=N` space separated; `0` = unlimited |
48
49
  | `TEAM_EXTRA_PI_ARGS` | empty | extra arguments passed to pi (space separated, values with spaces are unsupported) |
49
50
 
@@ -56,6 +57,7 @@ Dispatch model resolution order: `--model` > `TEAM_AGENT_MODELS` (per-agent) > `
56
57
  | `TEAM_INSTALL_CMD` | empty | install command run after creating a worktree (e.g. `pnpm install --frozen-lockfile`) |
57
58
  | `TEAM_DOCS_DIR` | `docs/team` | directory for briefs/reports/reviews/threads/inbox |
58
59
  | `TEAM_WORKTREES_DIR` | `.worktrees` | long-lived worktree directory (also how "this is an agent session" is recognised) |
60
+ | `TEAM_TMP_ROOT` | empty (resolved) | temp root for fixtures and gates. Resolution happens in exactly one place (`team_tmp_root`): a non-empty `TMPDIR` in the environment wins, then this key, then the platform default `/var/tmp/teamsmith-<project-ns>` — a filesystem, not the memory-backed `/tmp` (fixture writes must not compete with the OOM killer). The two-step order is printed, not guessed: `team status`, the dispatch capacity line and `tmp-hygiene --status` all name the value and its `source=tmpdir|config|default`, and a `TMPDIR` that overrides this key is reported as such. An explicit value that is relative, missing, not a directory or not writable blocks dispatch with the path and a remedy — it is never replaced by another root. Only the default leg is created (0700, first write); explicit roots are never created for you. Rollback to the old behaviour: `TEAM_TMP_ROOT="/tmp"` |
59
61
  | `TEAM_PROTECTED_BRANCH` | `main` | the branch only the PM may advance |
60
62
  | `TEAM_REMOTE` | `origin` | remote name (present even in local mode, used when pushing branches) |
61
63
  | `TEAM_PI_AGENT_DIR` | the directory of `TEAM_PI_SETTINGS_FILE` | where Pi keeps `sessions/` and its model catalog — the only place the session-size guard and the model windows are read from (read-only: `stat` of the session file, the catalog files) |
@@ -64,6 +66,7 @@ Dispatch model resolution order: `--model` > `TEAM_AGENT_MODELS` (per-agent) > `
64
66
  | `TEAM_DISPATCH_VERIFY_SEC` | `8` | how long a dispatch waits for the pane's launch proof before it kills the window and retries |
65
67
  | `TEAM_DISPATCH_ALIVE_SEC` | `1` | after the launch proof, how long to observe whether the agent is still in the window (built-in Pi only; `0` = skip the observation). A subsequent exit is reported as a warning, never as a failed dispatch |
66
68
  | `TEAM_SQUASH_LOOKBACK` | `200` | how many commits on the protected branch are scanned when deciding "this branch was already squash-merged" (one tree comparison per agent row; a heuristic, see workflows.md) |
69
+ | `TEAM_UPDATE_CHECK` | `1` | `0` = `team up` makes no npm version lookup at all (no query, no cache read or write). `1` = at most one bounded (≤2 s) lookup per 24 h, cached in `<state>/update-check.env`; every outcome except "local is older than the published version" prints nothing and never changes `team up`'s exit code. The tool never installs itself |
67
70
 
68
71
  ### agent adapter (the internal seam (frozen); leave all four empty for the built-in Pi behaviour)
69
72
 
@@ -135,7 +138,6 @@ long-running TUI keep today's tick semantics (one patrol tick per `TEAM_PULSE_IN
135
138
  `--no-watchdog`, keeps the panel and stops the ticks). A missing runtime is a loud failure in every mode, never an
136
139
  empty panel reported as success.
137
140
 
138
- | `TEAM_PM_MODEL` | empty | the PM's own model; empty = `TEAM_DEFAULT_MODEL` |
139
141
  | `TEAM_PM_SESSION_ID` | empty | empty = `pi -c` (continue the previous session in this directory, keeping the PM's history). Explicit session id for a CLI whose session concept you control (`{session_id}` in `TEAM_PM_CMD`); on the built-in Pi path it still becomes `--session-id <id>` |
140
142
  | `TEAM_PM_EXTRA_PI_ARGS` | empty | extra pi arguments for the PM (`{extra_args}` in a `TEAM_PM_CMD` template) |
141
143
  | `TEAM_PM_CMD` | empty | **launch template for the PM's own CLI** (the PM side of the adapter, M8.1). Placeholders: `{cwd}` `{session_id}` `{model}` `{provider}` `{prompt_file}` `{prompt}` `{skill_dir}` `{extra_args}` `{resume_args}`. Empty = the built-in Pi command, byte-for-byte the pre-M8.1 behaviour; the rules (unknown/malformed placeholder, blank or multi-line template) are shared with `TEAM_AGENT_CMD` and fail loudly. See [agent-adapters.md](agent-adapters.md) §2. A start that fails leaves a diagnosis (window output, the rendered command, the CLI's exit code) in `state/pm-launch-failed.log`, and `team up` exits non-zero |
@@ -150,7 +152,7 @@ empty panel reported as success.
150
152
  |---|---|---|
151
153
  | `TEAM_MIN_FREE_SWAP_MB` | `1024` | **floor**: below this much free swap the dispatch is refused (a full swap gets processes killed by the OOM killer) |
152
154
  | `TEAM_MIN_TOTAL_MB` | `512` | the absolute RAM+swap floor |
153
- | `TEAM_TMP_MIN_FREE_MB` | `1024` | **floor**: below this much free space the dispatch is refused — judged on the filesystems a worker writes to (the temp root `${TMPDIR:-/tmp}` **and** the worktree filesystem). Derivation: one gate round's root measured 95 MB / 11,797 files, a killed `config-cli` root 99 MB / 10,954 files, so 1 GiB leaves ~10 gate rounds of headroom |
155
+ | `TEAM_TMP_MIN_FREE_MB` | `1024` | **floor**: below this much free space the dispatch is refused — judged on the filesystems a worker writes to (the **resolved** temp root — `TMPDIR` → `TEAM_TMP_ROOT` → `/var/tmp/teamsmith-<ns>`, named with its `source=` — **and** the worktree filesystem). Derivation: one gate round's root measured 95 MB / 11,797 files, a killed `config-cli` root 99 MB / 10,954 files, so 1 GiB leaves ~10 gate rounds of headroom |
154
156
  | `TEAM_TMP_MIN_FREE_INODES` | `100000` | **floor**: the same filesystems' free inodes (judged only where the filesystem reports an inode table). Derivation: the same 10,954-file roots → ~9 roots of headroom; the tmpfs died with 4,645 of 3,811,434 inodes free |
155
157
  | `TEAM_WARN_AVAIL_MB` | `2048` | below this much available RAM: warn only (slowness is acceptable), never refuse |
156
158
  | `TEAM_AGENT_MEM_MB` | `6144` | empirical footprint of one agent, used by `team ps` for its "how many more fit" estimate |
@@ -158,9 +160,34 @@ empty panel reported as success.
158
160
  | `TEAM_NOTIFY_DEDUP_SEC` | `20` | deduplication window (seconds); `0` = no deduplication |
159
161
  | `TEAM_INBOX_MAX_CHARS` | `150` | truncation length of the agent's last message inside a briefing |
160
162
  | `TEAM_NOTIFY_LOG` | `/tmp/<project>-teamsmith-notify.log` | extension debug log (look here when notifications misbehave) |
163
+ | `TEAM_NOTIFY_DETAIL_MAX` | `2048` | events a turn-end notification's detail file (`state/notify.log`) may hold before it is rotated to `state/notify.log.1` (one generation kept; a rotation is named in the extension log) |
161
164
  | `TEAM_DEFER_TTL` | `300` | delivery guard: seconds a queued message may wait before it is moved to `state/outbox/held/` (holding never types anything; the payload is already in the recipient's inbox). A backstop, not the first symptom: an untrusted geometry holds immediately and three trusted-empty drains with no progress hold as `queue-stalled` |
162
165
  | `TEAM_OUTBOX_MAX` | `200` | delivery guard: maximum active queue entries; beyond it the oldest entry is escalated to `held/` |
163
166
 
167
+ ### Orphan seat processes (`seat-visibility`)
168
+
169
+ A seat's liveness is judged **by its window**: a process whose tmux window is gone is invisible to `team status`
170
+ and `team resume` while still holding memory (one host had seven such processes summing to ~4 GB). `team ps`,
171
+ `team status` and `team up` therefore append a **host-side census** read from `/proc` — a process is a seat when
172
+ its own environment carries teamsmith's identity (`TEAM_MAIN_ROOT`/`TEAM_ROOT`) and its command line names the
173
+ project's configured agent or PM executable. A seat is an orphan exactly when it has **no live pane**, judged on
174
+ the tmux server the process itself names; when that server cannot be queried the process is left **unjudged** and
175
+ is never called an orphan. Only this project's orphans are named (each with a copy-pasteable `team reap <pid>
176
+ --yes`); another project's orphans and identity-less processes are reported as a count and a **floor** (`≥`) only,
177
+ because the reading is meant to be copied into the ledger. The census writes nothing and signals nothing.
178
+
179
+ | Key | Default | Purpose |
180
+ |---|---|---|
181
+ | `TEAM_ORPHAN_WARN_MB` | `1024` | when the host-wide orphan total is at or above this many MB, `team digest`'s capacity line carries one hint (total, this project's share, the cleanup command). `0` = never hint (needs `--allow-danger`). It never changes the exit code |
182
+ | `TEAM_ORPHAN_SCAN` | `1` | whether the host-side census runs at all. `0` = read no process's environment: `team ps`, `team status` and `team up` print one named skip line instead of the reading, `team digest` adds no hint, and `team reap --orphans` refuses (exit 2) — cleanup then needs an explicit pid (`team reap <pid> --yes`). It exists for hosts where reading another process's environment is refused; the reading — and the cleanup plan it feeds — needs the default `1` |
183
+ | `TEAM_ORPHAN_PROC_ROOT` | `/proc` | fixture-only: the proc root the census reads, so the unreadable / vanished / empty-environment / missing-field edges can be built deterministically. Not writable from the console |
184
+
185
+ Cleanup is never automatic: `team reap --orphans` prints the plan and signals nothing, and `team reap --orphans
186
+ --yes` (or `team reap <pid> --yes`) re-verifies every target immediately before signalling it — still this
187
+ project's seat, still without a live pane, and the same process start time the plan recorded — then sends
188
+ `SIGTERM`, waits a bounded 5 s and only then `SIGKILL`. Every signal appends one line to `state/reap.log`.
189
+ `--yes` is the only authorization: no configuration key, environment variable or inherited value turns it on.
190
+
164
191
  ### Deferred delivery (`delivery-guard`)
165
192
 
166
193
  Automatic senders never type into an input box that already holds a draft: the message is queued in
@@ -314,7 +341,7 @@ see it.
314
341
  | `TEAM_MIN_FREE_SWAP_MB` | temporarily override the disk swap floor |
315
342
  | `TEAM_MEMINFO_FILE` | point at another meminfo file (for containers/tests without `/proc/meminfo`) |
316
343
  | `TEAM_DISK_STATS_FILE` | the disk-reading fixture (`TEAM_MEMINFO_FILE`'s sibling): rows `path<TAB>total_kb<TAB>avail_kb<TAB>itotal<TAB>ifree`, longest matching path prefix wins; a path with no row reads as unreadable — tests only |
317
- | `TMPDIR` | the temp root every fixture's root resolves to (`${TMPDIR:-/tmp}`); `TMPDIR=D bash tests/config-cli.sh` is the shape of the temp-root flip, and no fixture template may hardcode `/tmp` |
344
+ | `TMPDIR` | the **first** source of the temp root (`team_tmp_root`): a non-empty value wins over `TEAM_TMP_ROOT` and the disk default `/var/tmp/teamsmith-<ns>`; `TMPDIR=D bash tests/config-cli.sh` is the shape of the temp-root flip, the override is printed as `source=tmpdir`, and no fixture template may hardcode `/tmp` |
318
345
 
319
346
  Environment-only temp-root knobs are deliberately **not** part of the config surface (no schema row, not writable into
320
347
  `.pi/team/config.sh`): they live in `references/protocol.md` §9b-2 and `references/troubleshooting.md` §25 —
@@ -340,7 +367,7 @@ second source of truth: the value lives in the contract, the class table lives i
340
367
  | class | meaning | examples |
341
368
  |---|---|---|
342
369
  | `apply` | the next process that reads the contract sees the new value | `TEAM_GATES`, the capacity floors, the review escape hatches, the patrol policy |
343
- | `restart` | a running process holds the value it started with; the receipt names the target and the command | the pulse (`TEAM_PULSE_INTERVAL`, `TEAM_MONITOR_REFRESH`), a seat's model (`TEAM_AGENT_MODELS`, `TEAM_PM_MODEL` — a running seat keeps its model until its next `dispatch`/`resume`), a live session (`TEAM_INBOX_WATCH_*`) |
370
+ | `restart` | a running process holds the value it started with; the receipt names the target and the command | the pulse (`TEAM_PULSE_INTERVAL`, `TEAM_MONITOR_REFRESH`), the PM's model (`TEAM_PM_MODEL` — a running PM keeps it until an explicit `--fresh-pm` restart), a live session (`TEAM_INBOX_WATCH_*`) |
344
371
  | `refuse` | not the console's to change: the project's identity, the roster, the ledger's layout, the branch/forge definitions, the authority guards, the dependency policy and the machine paths Pi's own state is read from — the console may not widen its own authority and may not move the ledger it is reading | `TEAM_PROJECT`, `TEAM_AGENTS` (route: `team add-agent <a> --register` / `team teardown --agent <a> --register`), `TEAM_STATE_DIR`, `TEAM_PROTECTED_BRANCH`, `TEAM_ALLOW_FOREIGN_IDENTITY` … |
345
372
 
346
373
  A key the schema does not know is listed read-only ("not a known project setting", pointing at this file) and is
@@ -366,7 +393,7 @@ The vocabulary is exactly these twelve tokens; the visible heading is the table
366
393
  | `branch` | branch semantics and forge | `TEAM_BRANCH_MODE`, `TEAM_GITLAB_HOST` |
367
394
  | `policy` | permission and dependency policy | `TEAM_ALLOW_FOREIGN_IDENTITY`, `TEAM_REQUIRE_JS` |
368
395
  | `roster` | roster, model resolution and adapters | `TEAM_AGENT_CMD`, `TEAM_AGENT_BIN`, `TEAM_MODEL_LIMITS` |
369
- | `seat-model` | per-seat models | `TEAM_DEFAULT_MODEL`, `TEAM_AGENT_MODELS`, `TEAM_PM_MODEL` |
396
+ | `task-model` | task category policy and the independent PM model | `TEAM_TASK_MODELS`, `TEAM_PM_MODEL` |
370
397
  | `workflow` | workflow and gates | `TEAM_GATES`, `TEAM_REVIEW_TIMEOUT` |
371
398
  | `delivery` | capacity and delivery notices | `TEAM_MIN_AVAIL_MB`, `TEAM_TMP_MIN_FREE_MB`, `TEAM_DEFER_TTL` |
372
399
  | `panel` | pulse and console | `TEAM_PULSE_INTERVAL`, `TEAM_MONITOR_REFRESH` |
@@ -390,7 +417,8 @@ under its domain with the committed console bundle, and no group list exists any
390
417
  never reaches a running process (the measured `TEAM_MONITOR_ACTIVITY` case).
391
418
  * A `'` inside the value is written `'\''`. A line break or a `#` is refused (the notify extension's flat reader
392
419
  cuts at ` #`). On the eight keys that reader parses — `TEAM_SESSION`, `TEAM_PM_WINDOW`, `TEAM_WORKTREES_DIR`,
393
- `TEAM_DOCS_DIR`, `TEAM_NOTIFY_TMUX`, `TEAM_NOTIFY_DEDUP_SEC`, `TEAM_INBOX_MAX_CHARS`, `TEAM_NOTIFY_LOG` — a `'`
420
+ `TEAM_DOCS_DIR`, `TEAM_NOTIFY_TMUX`, `TEAM_NOTIFY_DEDUP_SEC`, `TEAM_INBOX_MAX_CHARS`, `TEAM_NOTIFY_LOG`,
421
+ `TEAM_NOTIFY_DETAIL_MAX` — a `'`
394
422
  is refused too (that reader has no escape).
395
423
  * Every byte the write does not change survives: comments, blank lines, the order of the keys and the changed
396
424
  line's own inline comment. A key the file lacks is appended on a line of its own (a missing final newline is
@@ -413,17 +441,37 @@ name. Danger never makes an invalid value legal.
413
441
  ```sh
414
442
  team config list --json
415
443
  team config set TEAM_PULSE_NUDGE_GAP 1200 --dry-run
416
- team config set-agent-model dev deepseek/deepseek-flash --dry-run
444
+ team config set-task-model routine deepseek/deepseek-flash --dry-run
445
+ team config set TEAM_PM_MODEL deepseek/deepseek-flash --dry-run
446
+ team config upgrade-models --task-models 'routine=deepseek/deepseek-flash analysis=xai/grok-4.6' --pm-model deepseek/deepseek-flash --dry-run
417
447
  team config log 5
418
448
  ```
419
449
 
420
450
  `0` written/valid · `3` fingerprint conflict (nothing written) · `4` invalid value · `5` key not editable ·
421
451
  `6` write error (file unchanged) · `7` dangerous (a `--dry-run` reports it too). `team config set … --fingerprint
422
452
  <sha256>` is a compare-and-swap: any byte change since the read refuses it, and a write without the flag is the
423
- caller's explicit "use the file as it is now". `team config set-agent-model <seat> <model|->` writes the pair
424
- list (`TEAM_AGENT_MODELS`, or `TEAM_PM_MODEL` for the `pm` seat) itself — the caller never composes it — and `-`
425
- removes the seat's override, leaving `TEAM_DEFAULT_MODEL` in force. `--actor <name>` labels the audit line (the
426
- console passes `panel`); `--dry-run` performs every check and writes neither the contract nor an audit line.
453
+ caller's explicit "use the file as it is now".
454
+
455
+ **The three model front doors.** `team config set-task-model <category> <model>` upserts exactly one category in
456
+ TEAM_TASK_MODELS (through the same checked writer, so category values are validated and the rest of the map is
457
+ preserved byte for byte); a new category is legal, an empty map is not, and removing a category is done by setting
458
+ the whole map (`team config set TEAM_TASK_MODELS '<remaining map>' --yes`) — which limits future selection but does
459
+ not invalidate a complete same-task assignment. `team config set TEAM_PM_MODEL <model>` writes the independent PM
460
+ model. `team config upgrade-models --task-models '<map>' --pm-model '<model>'` is the one **breaking migration**
461
+ transaction: it previews with `--dry-run`, writes only with `--yes`, replaces the four model keys (the two retired
462
+ worker keys are removed, the two new keys upserted) and keeps every other byte; its relevant-line grammar
463
+ (top-level unique literal assignments, optional inline comments) refuses export/duplicate/multiline/dynamic shapes
464
+ with the file and line named, and the repair is a hand-normalized literal line. The startup path calls the same
465
+ transaction (`team up`, actor `up-migration`): it derives the pairs from the old keys with the same table the
466
+ refusals use, writes `TEAM_CONFIG_VERSION`, prints every pair before → after with the backup path and the restore
467
+ command, and re-enters itself so later steps read the new bytes; `team up --print` writes nothing and `team up
468
+ --no-migrate` refuses instead of writing. The retired `set-agent-model`
469
+ route exits 5 pointing at these; `team add-agent --model` is retired too (a seat is a name in the roster, not a
470
+ model identity).
471
+
472
+ `team task --category` is only the **brief generator**: it writes the brief's `category:` header and nothing else —
473
+ it never selects or overrides a dispatch's model, and `team task` takes no model flag. The header is read by
474
+ `team dispatch` (which resolves it through the map), and only `team dispatch --model` overrides one launch.
427
475
 
428
476
  **The roster's two authorized entries.** `TEAM_AGENTS` keeps class `refuse` — `team config set TEAM_AGENTS …`
429
477
  still exits 5 and points at these entries instead. `team add-agent <a> --register` and `team teardown --agent <a>
@@ -433,10 +481,9 @@ still exits 5 and points at these entries instead. `team add-agent <a> --registe
433
481
  semantics (documented here, not printed in `team help`); a stale fingerprint exits 3 with one `result=conflict`
434
482
  line and nothing written. `--register` on a seat already in the roster is a visible no-op (exit 0, no write, no
435
483
  audit line); `team teardown --agent <a>` without the flag leaves the roster byte-identical (today's default).
436
- `team add-agent <a>` for a seat outside the roster, or `team add-agent <a> --model m` without `--register`,
437
- exits 5 naming both routes (hand-edit `.pi/team/config.sh`, or add `--register`) and touches nothing else;
438
- `--register --model <provider/model>|-` writes the roster first and then the seat's model through the same
439
- pairlist serializer as `set-agent-model` (`-` removes the override). Every attempt that passes argument parsing appends one line to `<state>/config.log`
484
+ `team add-agent <a>` for a seat outside the roster exits 5 naming both routes (hand-edit `.pi/team/config.sh`, or
485
+ add `--register`) and touches nothing else; the retired `--model` flag is refused with a pointer at the task-
486
+ category writers. Every attempt that passes argument parsing appends one line to `<state>/config.log`
440
487
  (`<UTC ISO-8601> result=<ok|refused|invalid|conflict|danger-refused|write-error> actor=… key=… old='…' new='…'`,
441
488
  plus `expected=`/`actual=` on a conflict); `team config log [N]` and `list --json`'s audit tail read at most the
442
489
  file's last 16 KiB and print at most N lines (default 10).
@@ -14,7 +14,7 @@ session) and for anyone deciding whether upgrading is safe.
14
14
  | Surface | Why it does not move |
15
15
  |---|---|
16
16
  | the `team` CLI | sub-commands are only ever **removed**, never renamed in place; everything that still exists keeps its name and flags |
17
- | `.pi/team/config.sh` | sourced by bash, flat `TEAM_*` keys; new keys ship with a default, so a config written years ago keeps working |
17
+ | `.pi/team/config.sh` | sourced by bash, flat `TEAM_*` keys; new keys ship with a default, so a config written years ago keeps working (the one exception is the breaking model-policy upgrade — §5b) |
18
18
  | `TEAM_*` environment variables | override the config file (env beats config) and are read that way in every version |
19
19
  | the `docs/team/**` layout | `tasks/ reports/ reviews/ threads/ inbox/` plus `BOARD.md ROADMAP.md OWNERSHIP.md DECISIONS.md PROTOCOL.md` |
20
20
  | `docs/team/BOARD.md` columns | `ID · task · agent · branch · deps · status`, with the status vocabulary `todo/wip/review/done/blocked/dropped` |
@@ -136,56 +136,239 @@ 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` |
140
+
141
+ ## 5b. The breaking model-policy upgrade (task categories)
142
+
143
+ This is the one upgrade a re-render cannot do: it needs the four-key migration transaction. The retired keys
144
+ TEAM_AGENT_MODELS and TEAM_DEFAULT_MODEL are no longer read (an old seat model is **not** reinterpreted as a task
145
+ model): a project that still carries them is refused by `team dispatch`/`team up` and by `team init`/
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.
151
+
152
+ ```bash
153
+ team config upgrade-models --task-models 'routine=<model> analysis=<model> verify=<model>' --pm-model '<model>' # preview: prints the diff, writes nothing
154
+ team config upgrade-models --task-models '…' --pm-model '<model>' --yes # the one write
155
+ ```
156
+
157
+ It rewrites only those keys through the checked writer (temp file → `bash -n` → fingerprint CAS → atomic rename →
158
+ one audit line), turns a removed line's inline comment into a standalone one and leaves every other byte alone.
159
+ Shapes it cannot locate unambiguously (export/multiline/variable expansion/duplicate keys) are refused with the
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.
173
+
174
+ After the policy is in place: a **new** dispatch takes the brief's `category:` model (routine for bounded ordinary
175
+ implementation, analysis for complex planning/judgment, verify for independent adversarial review — or the
176
+ project's own names), while a running/completed assignment keeps its recorded model/SID and is never rewritten by
177
+ the upgrade; a brief must carry a `category:` header before it can be dispatched again; the PM's own model is
178
+ `TEAM_PM_MODEL`, and a running PM on a different model is continued only with `team up --fresh-pm`.
179
+
180
+ The operations around a source upgrade are **separate recorded gates**, each previewed and authorized per command:
181
+ private source verification; landing validated source on a shared/protected tree; writing this project's
182
+ configuration (and the first fresh launch that reads it); and adopting a changed shared skill source. A shared
183
+ skill link (e.g. `~/.agents/skills/teamsmith` → this checkout's `skills/teamsmith`) reads its target's **current**
184
+ bytes, so changing that target affects later reads in other projects even without an installer; before landing,
185
+ either isolate the known shared consumers to preserved stable source and verify the isolation, or obtain explicit
186
+ approval of the identified shared impact. No partial slice should land on a shared main, and no zero-impact
187
+ promise is made for unknown consumers.
139
188
 
140
189
  ## 6. Upgrade recipe
141
190
 
142
- 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:
143
204
 
144
205
  ```bash
145
- # 1) get the new skill (a copy install updates by re-running ./install.sh instead)
146
- git -C <skill checkout> pull --ff-only # refuses when the checkout has diverged (local commits) — deliberate
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
+ ```
147
211
 
148
- # 2) is this session still the old version?
149
- team version --check
150
- # expect two version numbers (loaded vs disk) and a hint to run /reload;
151
- # identical versions print "consistent" instead. Exit code stays 0 either way.
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.
152
215
 
153
- # 3) environment self-check — fix every ✗ before going on
154
- team doctor
216
+ ### Step 2 — per project: back up the configuration, then let the first `team up` migrate it
155
217
 
156
- # 4) re-render this project's contracts (idempotent: config is kept, the AGENTS.md
157
- # section is refreshed in place, and a legacy marker is rewritten to the new one)
158
- team init
218
+ **Back up the configuration first.** The migration keeps its own backup, but this one is yours:
159
219
 
160
- # 5) the spec layer, only when openspec/ is missing
161
- openspec init --tools none
220
+ ```bash
221
+ cp .pi/team/config.sh ".pi/team/config.sh.pre-upgrade-$(date -u +%Y%m%dT%H%M%SZ)"
222
+ ```
162
223
 
163
- # 6) put the spec gate into TEAM_GATES in .pi/team/config.sh
164
- # TEAM_GATES="openspec validate --all --strict && <old gates>"
224
+ Look before you write:
165
225
 
166
- # 7) rebuild the pulse window and look at it (renamed from `watchdog` in v1.36.0 — §2b:
167
- # the old commands/window/variables still work; a running `watchdog` window is adopted
168
- # and `team pulse restart` swaps it for a `pulse` one)
169
- team pulse up
170
- team pulse status
226
+ ```bash
227
+ team up --print
228
+ ```
229
+
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.
235
+
236
+ Then run the real thing:
171
237
 
172
- # 8) prove the tooling end to end in a throwaway repository (never touches this project)
173
- bash skills/teamsmith/tests/smoke.sh # full suite (tens of seconds idle, minutes on a loaded box)
174
- TEAM_SMOKE_FAST=1 bash skills/teamsmith/tests/smoke.sh # logic-only subset; each skipped section prints SKIP
238
+ ```bash
239
+ team up
175
240
  ```
176
241
 
177
- Expected output, in order:
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:
178
249
 
179
- | Step | What you should see |
250
+ | 0.1.x key | becomes |
180
251
  |---|---|
181
- | `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 |
182
- | `/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) |
183
- | `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 |
184
- | `init` | a write/refresh line per generated file — the `AGENTS.md` protocol section appears exactly once (check with `grep -c '<!-- teamsmith:begin -->' AGENTS.md`) |
185
- | `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.
186
369
 
187
- Do the upgrade **before** dispatching new work, and note the version in `DECISIONS.md`: a worker dispatched after the
188
- 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.
189
372
 
190
373
  ## 7. Rolling back
191
374
 
@@ -208,6 +391,9 @@ team mark-loaded # re-record what this session sho
208
391
  git again. Pin at v1.11.0 or later unless that is exactly what you want.
209
392
  - Rollback and re-upgrade can be repeated freely; the only state the skill keeps about versions is
210
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.
211
397
 
212
398
  ## 8. What is deliberately not supported
213
399