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
package/README.md CHANGED
@@ -56,14 +56,14 @@ than replaced (`--force` replaces only an entry recognised as this skill).
56
56
  ### As a Pi package (no global CLI)
57
57
 
58
58
  ```bash
59
- pi install git:git@github.com:Track07-cda/teamsmith@v0.2.0 # user level: every project
60
- pi install -l git:git@github.com:Track07-cda/teamsmith@v0.2.0 # project level: recorded in .pi/settings.json
59
+ pi install git:git@github.com:Track07-cda/teamsmith@v0.3.1 # user level: every project
60
+ pi install -l git:git@github.com:Track07-cda/teamsmith@v0.3.1 # project level: recorded in .pi/settings.json
61
61
  ```
62
62
 
63
63
  - **Pin a released tag**: `@v<version>`, the version `team version` prints. Latest tag:
64
64
  `git tag --sort=-v:refname | head -1`.
65
- - The `git@github.com:` form (or `ssh://git@github.com/Track07-cda/teamsmith@v0.2.0`) uses your SSH key and works
66
- whether or not you have a token; the shorthand `git:github.com/Track07-cda/teamsmith@v0.2.0` takes the HTTPS
65
+ - The `git@github.com:` form (or `ssh://git@github.com/Track07-cda/teamsmith@v0.3.1`) uses your SSH key and works
66
+ whether or not you have a token; the shorthand `git:github.com/Track07-cda/teamsmith@v0.3.1` takes the HTTPS
67
67
  route, so it works anonymously on the public repository and asks for credentials if your access is private.
68
68
  - The clone lands in `~/.pi/agent/git/<host>/<path>` (user level) or `.pi/git/<host>/<path>` (project level); the
69
69
  skill directory — the `<skill>` used in every command below — is `<clone>/skills/teamsmith`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teamsmith",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "Turn one agent session into a project owner: self-contained task briefs dispatched to worker agents in their own git worktrees, independent verification on a separate checkout, and an auditable ledger (BOARD / reviews / threads / DECISIONS). Runs on Pi today.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -5,6 +5,75 @@
5
5
  > `SKILL.md`/`references/**`/`templates/**`/`extension/**` 在 Pi 里输入 `/reload`(或 `/pi-team-reload`)即生效;
6
6
  > 判断自己是不是旧的:`team mark-loaded`(开局记一次)→ `team version --check`。
7
7
 
8
+ ## v0.3.1(2026-10-21)
9
+
10
+ 补丁版:**没有破坏性变化、没有默认行为切换、没有新依赖**。这一版修的是 0.3.0 发出后才暴露的六件事。
11
+
12
+ ### ⚠️ 用 npm 装的人必须重装
13
+
14
+ `npm i -g teamsmith` 装出来的 0.3.0 **缺少 `pkill` / `killall` / `pgrep` / `pidof` 四个命令入口** —— npm 的 tarball 不携带软链接,
15
+ 四个名字装完全部落到 `/usr/bin` 的系统命令上,也就是说**防误杀的信号闸门在 npm 路线上等于不存在**(用 Git 检出安装的人不受影响)。
16
+ 这一版把四个入口改成普通文件,随包一起装;装完用 `command -v pkill` 应指向 teamsmith 的 shim。
17
+
18
+ ### 修好的行为
19
+
20
+ - **图片粘贴真的落盘**:新建项目没有容量历史时,容量块降级会连带丢掉临时根信息,`Ctrl-V` 插入的是空路径、文件没写。
21
+ - **已 squash 合并的分支不再被报「领先 N」**:那条判定把命令输出管进 `grep -q`,`pipefail` 下左端吃 SIGPIPE、整条管道判失败 ——
22
+ 它今天只靠 8 字节余量活着(本仓 8200 字节的树列表 vs 8192 字节管道缓冲),把 `TEAM_SQUASH_LOOKBACK` 上调即必错。
23
+ - **长标题流时不再误判「没有接受记录」**:同一类管道判定,explore 阶段的证据检查在标题流多 1 KB 时 30/30 误判。
24
+ - **合法的长门禁不再让等待者超时失败**:等待上限原来看一个从没人公布的数字(恒为 0 → 固定 30 分钟),一次 80 分钟的全量门禁会让
25
+ 所有等待者红。现在跟随持有者心跳:心跳新鲜就继续等(硬顶 4×W),停跳满一个窗口才判卡死并点名持有者;旧记录(无心跳字段)行为不变。
26
+ - **PM 起不来时诊断说得清**:诊断里原来会冒出 shell 自己的「文件不存在」报错和一个空数字;现在具名说明「谁还没写出什么」。
27
+
28
+ ### 门禁与 CI(写给仓库使用者)
29
+
30
+ - 普通推送**不再跑整套**:`--floor` 跑产品地板,改动路径只加相关段;**未知路径仍退回全量**。
31
+ - 门禁的私有 tmux 锚点不再泄漏:外部 `kill -9` 之后它 2 秒内自己消失(此前会带着 `sleep 100000` 留到天荒地老);
32
+ socket 目录的回收形状修对(此前每轮漏一个空目录,本机曾积到 1233 个)。
33
+ - 两处时红时绿修根:运行登记的 EXIT trap 武装得太晚(前七百行落一个 TERM 就没人删记录,等满 300 秒再红);
34
+ `§34b` 里最后两处墙钟窗口换成确定性条件。
35
+ - 三条发布门禁自身的缺陷修掉:`--keep` 不再泄进夹具自己发起的嵌套运行(保留开关属于发起它的那一层);
36
+ `seat-interrupt` 的一个组自 P309 起其实从未跑过(隔离前置只认一个自有目录,而私有 socket 目录早已搬出临时根)——
37
+ 它现在恢复执行;路由变异矩阵给最慢那条臂的预算从 900 s 提到 1 800 s(实测 844 s),撞上限时点名「哪条臂、用满多少秒」。
38
+ - 一条**死了两个版本**的断言被救活:`§36③` 的红标检查拿带 ANSI 的串去比对已去色的文本,永不命中;现在匹配串同样去色,
39
+ 并配一条正向对照 —— 仪表坏了自己报红,不许绿。
40
+
41
+ ### 内部卫生(不改变行为)
42
+
43
+ - 门禁瘦身一轮(−196 条断言:逐字节快照与文案定位针退场,渲染正确性与一致性不变量保留)。
44
+ - 测试精简三轮:`signal-gate` 223→143、`team-bg-stop` 81→76、`config-cli` 350→331、`key-replies` 212→203、`panel-b2` 13→11 场景。
45
+ - 死夹具清理:删掉从不被调用的夹具,其中 7 个在修复落地后结构上就跑不起来(红树取 `merge-base HEAD main`)。
46
+ - 两个「写好了却没人跑」的夹具接线;其中一个已经红了两个星期没人知道。
47
+ - `common.sh` 的吞错清理:251 处 `|| true` / `2>/dev/null` 逐条判(改 66、留 181 并说明理由)。
48
+
49
+ ## v0.3.0(2026-10-18)
50
+
51
+ ### ⚠️ 默认变化:临时根落到磁盘(tmp-root-on-disk)
52
+
53
+ 夹具、门禁、评审与清扫用的临时根,默认从 `/tmp` 搬到**磁盘**上的 `/var/tmp/teamsmith-<项目 ns>`
54
+ (`/var/tmp` 不可写时退回 `/tmp`)。理由:本机 `/tmp` 是 tmpfs —— 夹具写盘吃的是 RAM,与 OOM killer
55
+ 读同一个池(现场读数见 `openspec/changes/tmp-root-on-disk/design.md`)。
56
+
57
+ - **一个解析函数**:`team_tmp_root`(`TMPDIR` → `TEAM_TMP_ROOT` → 平台默认)是唯一实现;清扫器、门禁、
58
+ 派单地板、doctor、面板与夹具都调它。谁怎么解析的会被打印出来:`team status`、派单的余量行、
59
+ `tmp-hygiene --status` 都在根旁边写 `source=tmpdir|config|default`;环境里的 `TMPDIR` 盖过项目钉的
60
+ `TEAM_TMP_ROOT` 时,输出**点名**这件事。
61
+ - **升级须知**(老项目不用做任何事,但有三件事会变):
62
+ 1. 第一次写盘时创建 `/var/tmp/teamsmith-<ns>`(0700);显式指定的根(`TMPDIR` / `TEAM_TMP_ROOT`)**不会**
63
+ 被代建 —— 不可用就具名失败(点名路径 + 修法)并拒绝派单,绝不静默换一个根。
64
+ 2. 旧默认根 `/tmp` 里的残留不会自己搬家:`tmp-hygiene --status` 会报旧根下的家族目录数量,并给出
65
+ `TMPDIR=/tmp … --sweep` 这一条(同一条清扫命令,把旧基准显式选出来);清扫器一次只作用于一个基准
66
+ (混着判会把新根里的东西判成「别家」)。
67
+ 3. `tmp-hygiene --lint` 多一条规则:任何自己算临时根的地方(`${TMPDIR:-/tmp}`、`${TMPDIR}`、面板源码里的
68
+ `process.env.TMPDIR` / 无参 `tmpdir()`)都是 finding。豁免只有两处:解析函数自己、以及**冻结的**门禁锁
69
+ 发布路径 `/tmp/teamsmith-smoke.lock`(P287:搬它会在升级窗口里新开一条静默并发窗口)。
70
+ - **回滚**:在项目配置 `.pi/team/config.sh` 里写 `TEAM_TMP_ROOT="/tmp"`(旧行为;`team config set` 按
71
+ `refuse` 类拒绝改它 —— 搬家是操作者动作)。门禁锁的位置不受这个键影响,它仍是 `/tmp/teamsmith-smoke.lock`。
72
+ - **锁不搬**:项目锁与门禁锁的位置仍按环境里的 `TMPDIR`(未设则 `/tmp`),**不**跟着临时根走 ——
73
+ 锁是跨版本串行用的共享状态,跟着搬会在升级窗口里让新旧两版各取各的锁(与 P287 冻结门禁锁发布路径同一条纪律)。
74
+ - **地板**:派单的字节/inode 余量判的是**选定的**那个根(不再硬编码 `/tmp`),拒绝文案点名它;
75
+ doctor 多一行「锁文件系统」只警告行 —— 锁所在的文件系统可能没被别的行覆盖,但它不拒绝派单。
76
+
8
77
  ## v0.2.0 · 2026-10-14
9
78
 
10
79
  功能版:**按任务类别分配模型**(含破坏式配置迁移)、**Pulse 关键回复页**,以及长作业车道的提示词侧。
@@ -3,7 +3,7 @@ name: teamsmith
3
3
  description: teamsmith gives one agent real ownership of a project — it plans, writes self-contained task briefs, dispatches worker agents into their own tmux windows and git worktrees, verifies their work on an independent checkout, merges, and keeps an auditable ledger (BOARD/reviews/threads/DECISIONS). A pulse window (the periodic patrol) wakes the owner only when there is pending work, and the owner can deliberately stand down. Works with Pi; the launch/notify seam is an internal seam (frozen) reserved for a possible future non-Pi adapter, with no compatibility promise. Use when the user wants an agent to own a project end to end, dispatch tasks to worker agents, run agents in parallel in tmux with git worktree isolation, act as a PM/orchestrator over other agents, review an agent's work independently, run the patrol (`pulse`) as a tmux window, wake the PM only when there is pending work, or resume and coordinate a multi-agent project. To start a new project, use the teamsmith-init skill.
4
4
  license: MIT
5
5
  metadata:
6
- version: "0.2.0"
6
+ version: "0.3.1"
7
7
  ---
8
8
 
9
9
  # teamsmith · one agent that actually owns the project
@@ -51,7 +51,7 @@ everything below is the daily loop, which starts once the project is up.
51
51
  | Init / self-check | `team init [--session s] [--agents "a b"] [--vcs local\|remote] --task-models '<category=provider/model …>' --pm-model '<provider/model>' [--copy\|--no-skills]` (fresh projects must pass both model inputs; installs both skills into the project's `.pi/skills/`), `team doctor` (reports that install, warns on drift) |
52
52
  | Observe | `team roster` (windows/branch/dirty/ahead), `team status [ID]`, `team ps` (capacity + model limits + PM/pulse liveness), `team digest` (PM's pending work) |
53
53
  | Inbox | `team inbox [agent] [--ack] [--all]` |
54
- | Key replies | `team reply post --from <seat> --title "<short>" --stdin` (publish the body you are about to send; a saved receipt means project-local durable publication only — never user delivery, approval, read status or a refreshed console), `team reply list [--before <no>] [--json]`, `team reply show <no> [--json\|--raw]` (readers are observation-only: no mkdir, no writes, no lock; `--raw` exports the original bytes and refuses a TTY). The console's page 5 shows the latest reply plus the numbered history. See `references/protocol.md` §4b |
54
+ | Key replies | **The outlet for replies written for the user** (a landed milestone, a ruling, a conclusion, an answer, a status or progress report, a decision you ask the user for, a delivery or verification summary — however short, and never held back because it reads like process rather than like a conclusion): publish the complete reply — the substance the user needs to read, not a play-by-play — with `team reply post --from <seat> --title "<short>" --stdin`, then send that same body; a batch of user-facing replies may be one reply. A reply written to the patrol, to another seat or to another project's PM, and a tool receipt, are not for the user and stay out. Distinct from the internal channels: `say`/`notify` carry one-line coordination to a seat or the PM, not the reply itself. A saved receipt means project-local durable publication only — never user delivery, approval, read status or a refreshed console. `team reply list [--before <no>] [--json]`, `team reply show <no> [--json\|--raw]` (readers are observation-only: no mkdir, no writes, no lock; `--raw` exports the original bytes and refuses a TTY). The console's page 5 shows the latest reply plus the numbered history. See `references/protocol.md` §4b |
55
55
  | Document contracts | `team task <ID> --title ... --agent a`, `team board add\|assign\|set\|ls`, `team change status <id> [--json]` (readiness view: tasks/evidence, declared vs touched delta files, blockers; exit 0 iff every mapped task is finished), `team thread <a> "..." --from pm --re <ID>`, `team report <ID> <a>` |
56
56
  | Dispatch | `team add-agent <a> [--register] [--create] [--no-install] [--print]`, `team dispatch <a> <ID> <taskfile> [--model m] [--branch <name>] [--fresh] [--allow-overflow] [--force] [--print]` (a new dispatch selects the brief's `category:` model from `TEAM_TASK_MODELS` unless `--model` overrides; same-task recovery keeps the committed model/SID; all pre-launch guards are judged in **one pass**: one refusal lists every blocker, each with a paste-able `修法:<command>` or `改行:<exact line>` and a final count line; `--force` overrides only the guards that carry an override, printed as a warning and logged after a real launch) |
57
57
  | Collaborate | `team say <a> "<one-line message>" [--no-verify]` (verifies delivery; falls back to the inbox when the agent is not running), `team notify <a> "<one line>" [--from <sender>]` (agent → PM; the sender comes from the runtime directory — an unresolved sender is refused, never recorded as `pm`) |
@@ -66,15 +66,16 @@ everything below is the daily loop, which starts once the project is up.
66
66
  | PM/agent lifecycle | `team up [--agents]` (recover the PM), `team resume` (PM's tool: continue stopped agents), `team standby on\|off` (PM deliberately stands down) |
67
67
  | Cross-project meetings | `team meeting open/say/read/list/inbox/propose/agree/close` (PM-to-PM peer exchange: interface work, advice, problem reports; **not a command channel** — consensus needs both sides) |
68
68
  | Updates | `team mark-loaded` (record the version at session start), `team version --check` (should I reload?), `team changelog [--since X]`, `team reload` |
69
- | Diagnostics | `team paths` (resolved paths/session), `team smoke` (end-to-end self-test; `TEAM_SMOKE_FAST=1 team smoke` = **fast mode**, pure-logic sections only, ~10s, skipped process sections print `SKIP (FAST mode)`; the **full** run is for delivery/review and queues on the gate lock — `TEAM_SMOKE_LOCK` / `TEAM_SMOKE_LOCK_WAIT`, holder in `<lock>.holder`, and `team review` takes the same lock before its timeout so the record's `queued`/`ran` are separate; the gate judges **correctness only** — its panel section keeps the time-independent knob check), `team version` |
70
- | Performance | `team perf [--host \| --container]` (**separate from correctness**: the wall-clock/CPU red lines — interactive first frame, frame assembly, steady-state pane CPU — with the unchanged thresholds (2000 ms / 2000 ms / < 1 %), premise factors (`0.75` / `0.25`), medians, visible `SKIP` and exit codes `0`/`2`/`4`/`3`; its own lock `TEAM_PERF_LOCK`, never the gate lock; default = the pinned `ci/Containerfile` image, `--host` is labelled **not the reference**) |
69
+ | Diagnostics | `team paths` (resolved paths/session), `team smoke` (end-to-end self-test; `TEAM_SMOKE_FAST=1 team smoke` = **fast mode**, pure-logic sections only, ~10s, skipped process sections print `SKIP (FAST mode)`; the **full** run is for delivery/review and queues on the gate lock — `TEAM_SMOKE_LOCK` / `TEAM_SMOKE_LOCK_WAIT`, the mutex is a pair (published `<lock>` + dot-prefixed companion `<lock>.machine`, the holder recorded in `<companion>.holder`; neither file is ever unlinked, and losing the companion mid-run stops the run loudly), and `team review` takes the same pair before its timeout so the record's `queued`/`ran` are separate; the gate judges **correctness only** — its panel section keeps the time-independent knob check), `team version` |
70
+ | Performance | `team perf [--host \| --container]` (**separate from correctness**: it only measures and prints reference readings — interactive first frame, frame assembly, steady-state pane CPU — and names the environment it measured in; the exit codes are `0` (a reading was taken) and `3` (setup failed, or the perf lock was unavailable), with no thresholds, no premise factor and no `2`/`4`; its own lock `TEAM_PERF_LOCK`, never the gate lock; default = the pinned `ci/Containerfile` image, `--host` is labelled **not the reference**) |
71
71
 
72
72
  The two gates answer different questions and are run at different times. **Correctness, on every change:**
73
73
  `openspec validate --all --strict && bash skills/teamsmith/tests/smoke.sh </dev/null` (the pair `team review` runs;
74
74
  `team smoke` is the suite's front door). **Performance, separately and before a release:**
75
75
  `bash skills/teamsmith/tests/perf.sh` (front door `team perf`; the reference environment is the pinned
76
- `ci/Containerfile` image, `team perf --host` is explicitly *not* the reference). A red performance run never
77
- changes a review verdict and never blocks a merge.
76
+ `ci/Containerfile` image, `team perf --host` is explicitly *not* the reference). Its numbers are reference-only
77
+ and it has no verdict to give (exit `0` = a reading was taken, `3` = it could not measure), so a performance run
78
+ never changes a review verdict and never blocks a merge.
78
79
 
79
80
  ## Read the creed first, then the process
80
81
  The PM's judgement standard lives in [references/philosophy.md](references/philosophy.md) (8 principles, each with
@@ -164,6 +165,7 @@ bash <skill>/scripts/team changelog # change history (--since v1.8.0 for
164
165
  | `scripts/**` (CLI) | **Nothing to do**: every call reads from disk |
165
166
  | `SKILL.md` / `references/**` / `templates/**` | Type **`/reload`** in Pi (or `/teamsmith-reload`, or let the model call the `reload_skills` tool). **Note**: `/reload` refreshes the skill list/descriptions (system prompt) and extensions; **text already read into the conversation history does not change**, so after reloading you must `read <skill>/SKILL.md` again (the extension sends a follow-up prompt that triggers that re-read) |
166
167
  | `extension/team-notify.ts`, `extension/team-bg.ts`, `extension/team-inbox-watch.ts` | **Restart the process** — the launch paths pass the extensions with `pi -e`, and `-e` modules are read at process start (`/reload` hot-reloads only extensions from Pi's auto-discovery locations, `~/.pi/agent/extensions/` and `.pi/extensions/`). PM: `team up`; worker: `team resume <agent>`. `team version --check` fingerprints them |
168
+ | `extension/team.ts` (the `/team` slash command) | **`/reload`** — `team init` installs it into the project's `.pi/extensions/team.ts`, which Pi discovers from the working directory; it is deliberately **not** injected with `-e` (that needs a process restart, and `/reload` is the point) and it is installed only in the main worktree — a worker worktree has no `/team` (seats call the CLI from bash). `team doctor` reports its install state; it is **not** part of the session fingerprint |
167
169
 
168
170
  Rationale: Pi's `/reload` rediscovers skills, rebuilds the system prompt and re-imports extensions from its
169
171
  auto-discovery locations; extensions passed with `-e` (which is how the team launch paths load them) are a
@@ -246,11 +248,17 @@ about them). They stay writable so the seam can be maintained and diagnosed; to
246
248
  ## Non-negotiable rules (verified during review)
247
249
  - **Never claim something passed without having run it.** Reports must include commands and output tails; the PM
248
250
  re-runs independently.
249
- - **Publish the body before you answer.** Before sending a substantive answer, publish that same body with
250
- `team reply post --from <seat> --title "<short>" --stdin`, then send the answer normally — saved, input error,
251
+ - **Publish the body before you answer — it is a standing duty.** Whenever the reply is written for the user — an
252
+ answer, a status or progress report, a conclusion or a ruling, a delivery or verification summary, a decision you
253
+ ask the user for, however short, and never held back because it reads like process rather than like a conclusion —
254
+ publish the complete reply (the substance the user needs to read, not a play-by-play) with
255
+ `team reply post --from <seat> --title "<short>" --stdin`, then send that same body normally — saved, input error,
251
256
  storage error, busy or unconfirmed never changes what you send (the failure notice goes to stderr, never into the
252
- answer). A saved receipt means project-local durable publication only: not user delivery, not approval, not read
253
- status, not a refreshed console, and it creates no pending work, no outbox/inbox entry and no wake-up. See
257
+ answer). A batch of user-facing replies may be one reply. A reply written to the patrol, to another seat or to
258
+ another project's PM, and a tool receipt, are not for the user and stay out; when the reader is unclear, ask who
259
+ the reply is written for and treat an unsettled case as written for the user. A saved
260
+ receipt means project-local durable publication only: not user delivery, not approval, not read status, not a
261
+ refreshed console, and it creates no pending work, no outbox/inbox entry and no wake-up. See
254
262
  `references/protocol.md` §4b.
255
263
  - Agents only touch directories they own (`OWNERSHIP.md`); cross-directory needs → write `BLOCKED:` in the report.
256
264
  - Agents must not push the protected branch, force-push, merge PR/MRs, or rebase/delete other people's branches.
@@ -294,7 +302,7 @@ about them). They stay writable so the seam can be maintained and diagnosed; to
294
302
  | `references/troubleshooting.md` | Notifications not arriving, lost sessions, worktree conflicts, forge 403, dishonest reports |
295
303
  | `templates/` | Copy when you need to hand-write a brief/report/board |
296
304
  | `scripts/team`, `scripts/lib/*.sh` | When changing behaviour (use `team <cmd> --print` to see what it generates) |
297
- | `tests/smoke.sh`, `tests/perf.sh`, `tests/skill-load.mjs` | To confirm the tooling works here: `team smoke` (end-to-end in a temp repo, never touches this project). **Fast mode**: `TEAM_SMOKE_FAST=1 team smoke` runs only sections that need no real tmux stage or agent process — good for day-to-day gates before dispatch/verification; it **does not cover** dispatch actually launching an agent, the non-Pi agent end-to-end segment, window/close behaviour, the pulse waking the PM, standby/monitor, real agent resume, cross-session guards, offline `say` delivery, or knock probing (those print `SKIP (FAST mode)`); run the full suite before changing those paths or cutting a release. The full run is the machine's **one** shared gate resource: it queues on `TEAM_SMOKE_LOCK` up to `TEAM_SMOKE_LOCK_WAIT`, and `team review` takes the same lock *before* its hard timeout (so the record's `queued`/`ran` are separate and a long queue is a loud `FAIL`, never a `TIMEOUT`). The **performance** red lines live in `tests/perf.sh` (`team perf`), not in the correctness gate: correctness on every change, performance separately and before a release |
305
+ | `tests/smoke.sh`, `tests/perf.sh`, `tests/skill-load.mjs` | To confirm the tooling works here: `team smoke` (end-to-end in a temp repo, never touches this project). **Fast mode**: `TEAM_SMOKE_FAST=1 team smoke` runs only sections that need no real tmux stage or agent process — good for day-to-day gates before dispatch/verification; it **does not cover** dispatch actually launching an agent, the non-Pi agent end-to-end segment, window/close behaviour, the pulse waking the PM, standby/monitor, real agent resume, cross-session guards, offline `say` delivery, or knock probing (those print `SKIP (FAST mode)`); run the full suite before changing those paths or cutting a release. The full run is the machine's **one** shared gate resource: it queues on `TEAM_SMOKE_LOCK` up to `TEAM_SMOKE_LOCK_WAIT`, and `team review` takes the same lock *before* its hard timeout (so the record's `queued`/`ran` are separate and a long queue is a loud `FAIL`, never a `TIMEOUT`). The **performance** readings live in `tests/perf.sh` (`team perf`), not in the correctness gate (there are no performance red lines left to run there — the suite prints reference readings, names the environment it measured in, and cannot fail a run): correctness on every change, one performance reading before a release |
298
306
 
299
307
  ## Requirements
300
308
 
@@ -319,5 +327,4 @@ about them). They stay writable so the seam can be maintained and diagnosed; to
319
327
  - Optional helpers: `timeout` (hard timeout for gates; degrades with a warning), `lsof` (needed only where
320
328
  `/proc` is unavailable), `/usr/bin/time` (GNU time, not bash's `time` keyword: `tests/panel-cpu.sh` wraps the
321
329
  console with it to read the tree CPU figure — the gate image pins it, and where it is missing that fixture
322
- prints why and reports a visible SKIP (its own exit status) instead of judging, as does the `panel-cpu-premise`
323
- segment that drives it).
330
+ prints that the reading was not taken (exit `0`) instead of judging).
@@ -449,8 +449,9 @@ function forcedWatchErrno(): string {
449
449
  function writeDegradedRecord(root: string, target: string, info: {
450
450
  errno: string; watches: string; pollMs: number; forced: boolean
451
451
  }): void {
452
- // 变量名故意不叫 dir:flip-m46 包用 `}): void {\n const dir = watchDir(root)` 当 writeSkipRecord 的注射锚点,
453
- // 这里重名会让那个锚点变成 2 处(既有翻转包会 exit 2)——不动的包不该被新代码抵掉。
452
+ // 变量名故意不叫 dir:P354 之前 flip-m46 的翻转包用 `}): void {\n const dir = watchDir(root)` 当
453
+ // writeSkipRecord 的注射锚点,重名会让那个锚点变成 2 处(那个包会 exit 2)。那个包已在 P354 退役、
454
+ // 今天没有执行者;它守的 M46 行为由 §12b-pi 的 M46-S14…S17 活着守着。
454
455
  const wdir = watchDir(root)
455
456
  const key = targetKey(target)
456
457
  try { mkdirSync(wdir, { recursive: true }) } catch { return }
@@ -596,7 +597,8 @@ function readNewLines(file: string, offset: number): ReadResult {
596
597
  // 行中起步 = 碎片(被 clamp 截住的旧行的尾巴):跳到它自己的换行为止,绝不投递(B1.2)
597
598
  const start = midLine ? win.indexOf(0x0a) + 1 : 0
598
599
  const resync = start
599
- const advance = end + 1 // P28/B1:字节真值(flip-p25.sh 的 mutant A/B 把这一行换成解码→再编码的长度)
600
+ const advance = end + 1 // P28/B1:字节真值(曾由 flip-p25.sh 的 mutant A/B 把这一行换成解码→再编码的长度来
601
+ // 翻转,该夹具 P354 已退役;这条不变量今天由 §12b-pi S18–S21 守)
600
602
  const lines: string[] = []
601
603
  let from = start
602
604
  for (let i = start; i <= end; i++) {
@@ -528,15 +528,47 @@ export default function (pi: ExtensionAPI) {
528
528
  }
529
529
 
530
530
  const line = `${new Date().toISOString()} ${dirtyFlag}${tag} ${summary}${revStamp}${completed && last ? ` :: ${last}` : ''}`
531
+ // turn-notice-merge(写入侧合并 + 明细):判定「扩展末尾的同类 run 还是新起一行」在 CLI 的收件箱
532
+ // 写入口里(每收件人一把锁 + 先明细后合并),扩展只消费写入结果 —— 只有写下**新行**才入队 knock。
533
+ const cli = join(skillDir(), 'scripts/team')
534
+ const lineFile = join(stateDir, `notify-line-${process.pid}-${Date.now()}.txt`)
535
+ let writeOut = ''
531
536
  try {
532
- const dir = join(root, cfg.docsDir, 'inbox')
533
- mkdirSync(dir, { recursive: true })
534
- appendFileSync(join(dir, `${agent}.md`), `- ${line}\n`)
537
+ writeFileSync(lineFile, line)
538
+ writeOut = execFileSync(
539
+ 'bash',
540
+ [cli, '--root', root, '__inbox-write', '--agent', agent, '--from-file', lineFile],
541
+ { encoding: 'utf8', timeout: 5000 },
542
+ )
535
543
  log(`inbox ${tag} ${summary}`, cfg)
536
544
  } catch (error) {
545
+ writeOut = ''
537
546
  log(`inbox write failed: ${String(error)}`, cfg)
547
+ } finally {
548
+ try { rmSync(lineFile, { force: true }) } catch { /* ignore */ }
549
+ }
550
+ const writeState = /^state=([a-z]+)/m.exec(writeOut)?.[1] ?? ''
551
+ if (writeState !== 'new') {
552
+ // 扩展既有 run(state=extended)的 settle 不入队、不敲字:计数抖动看得见但不叫醒。
553
+ // 写盘失败(异常 / state=failed)也不叫醒 —— 与手工路径的「写失败不得授权唤醒」同一条规则。
554
+ log(`no knock (inbox write state=${writeState || 'failed'})`, cfg)
555
+ return
538
556
  }
539
557
 
558
+ // 挂起只记录、不叫醒(用户裁定 2026-10-14):`[auto·suspended]` 是设计好的状态(席位起了长任务并
559
+ // 正确地结束回合等叫醒),PM 没有可行动的事 —— 行、明细、面板、digest 照旧,但不入队 knock。交付
560
+ // (要复验/合并)与中断(要诊断)照旧敲门;挂起中的失败面(席位死去、任务永不完)归巡检的
561
+ // 「任务未完成 + 窗口不在」那一档,不由这条通知兜。
562
+ if (suspended) {
563
+ log('no knock (suspended records only)', cfg)
564
+ return
565
+ }
566
+ const firstEvent = /^first=(\S+)/m.exec(writeOut)?.[1] ?? ''
567
+ const mergeKey = /^key=(\S*)/m.exec(writeOut)?.[1] ?? ''
568
+ // knock 的去重身份 = **行身份**(席位 + 合并键 + 首事件时间):两条文本逐字相同但不同的行不会互吞,
569
+ // 同一 run 的重复 settle 也绝不会二次敲门(此时它连条目都不入队)。席位是 mergeKey 的第一个分量。
570
+ const lineIdentity = `line|${mergeKey}|${firstEvent}`
571
+
540
572
  if (!cfg.notifyTmux || !window) return
541
573
  const target = `${cfg.session}:${cfg.pmWindow}`
542
574
  try {
@@ -553,17 +585,16 @@ export default function (pi: ExtensionAPI) {
553
585
  }
554
586
  // 敲门不再自己 send-keys:交给 teamsmith 的投递守卫 + 延后队列(delivery-guard)。
555
587
  // 为什么:扩展原来直接 `send-keys -l` + Enter,人正在 PM 输入框里写草稿时会把草稿粘走
556
- // (D20 的原始事故)。入队时带上扩展自己的去重键(key),两层抑制不会打架。
588
+ // (D20 的原始事故)。入队时带上 knock 自己的**行身份**(lineIdentity),两层抑制不会打架。
557
589
  // 失败只记日志:绝不回退到打字(那会悄悄重建同一个 bug)。
558
590
  const notice = `${dirtyFlag}${tag} ${summary}${revStamp}${completed && last ? `\n> ${last}` : ''}`
559
- const cli = join(skillDir(), 'scripts/team')
560
591
  const tmp = join(stateDir, `knock-${process.pid}-${Date.now()}.txt`)
561
592
  try {
562
593
  writeFileSync(tmp, notice)
563
594
  const out = execFileSync(
564
595
  'bash',
565
596
  [cli, '--root', root, 'outbox', 'enqueue', '--kind', 'knock', '--target', target,
566
- '--from', agent, '--dedup', key, '--from-file', tmp],
597
+ '--from', agent, '--dedup', lineIdentity, '--from-file', tmp],
567
598
  { encoding: 'utf8', timeout: 5000 },
568
599
  )
569
600
  log(`knock queued (${String(out).trim() || 'entry written'})`, cfg)