teamsmith 0.1.1 → 0.2.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 (104) hide show
  1. package/README.md +16 -8
  2. package/package.json +1 -1
  3. package/skills/teamsmith/CHANGELOG.md +55 -0
  4. package/skills/teamsmith/SKILL.md +18 -7
  5. package/skills/teamsmith/extension/team-bg.ts +47 -11
  6. package/skills/teamsmith/extension/team-notify.ts +143 -4
  7. package/skills/teamsmith/references/agent-adapters.md +7 -7
  8. package/skills/teamsmith/references/config.md +29 -15
  9. package/skills/teamsmith/references/migration.md +38 -2
  10. package/skills/teamsmith/references/openspec.md +23 -9
  11. package/skills/teamsmith/references/protocol.md +81 -13
  12. package/skills/teamsmith/references/workflows.md +31 -19
  13. package/skills/teamsmith/scripts/lib/cmd-agents.sh +210 -70
  14. package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +70 -9
  15. package/skills/teamsmith/scripts/lib/cmd-config.sh +222 -70
  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-project.sh +134 -17
  19. package/skills/teamsmith/scripts/lib/cmd-reply.sh +96 -0
  20. package/skills/teamsmith/scripts/lib/cmd-review.sh +13 -10
  21. package/skills/teamsmith/scripts/lib/cmd-status.sh +42 -13
  22. package/skills/teamsmith/scripts/lib/cmd-watch.sh +75 -13
  23. package/skills/teamsmith/scripts/lib/common.sh +797 -71
  24. package/skills/teamsmith/scripts/monitor.mjs +34 -3
  25. package/skills/teamsmith/scripts/panel/README.md +22 -11
  26. package/skills/teamsmith/scripts/panel/panel.js +217 -215
  27. package/skills/teamsmith/scripts/panel/src/App.tsx +421 -164
  28. package/skills/teamsmith/scripts/panel/src/data.ts +84 -4
  29. package/skills/teamsmith/scripts/panel/src/layout.ts +502 -91
  30. package/skills/teamsmith/scripts/panel/src/main.tsx +97 -12
  31. package/skills/teamsmith/scripts/panel/src/settings.ts +1 -1
  32. package/skills/teamsmith/scripts/panel/src/strings/en.ts +56 -21
  33. package/skills/teamsmith/scripts/panel/src/strings/zh.ts +56 -21
  34. package/skills/teamsmith/scripts/panel/src/types.ts +178 -16
  35. package/skills/teamsmith/scripts/replies.mjs +893 -0
  36. package/skills/teamsmith/scripts/team +1 -0
  37. package/skills/teamsmith/templates/AGENTS.section.md.tmpl +15 -2
  38. package/skills/teamsmith/templates/BOARD.md.tmpl +2 -2
  39. package/skills/teamsmith/templates/OWNERSHIP.md.tmpl +7 -3
  40. package/skills/teamsmith/templates/PROTOCOL.md.tmpl +17 -0
  41. package/skills/teamsmith/templates/config.sh.tmpl +10 -5
  42. package/skills/teamsmith/templates/memory-seed.md.tmpl +3 -0
  43. package/skills/teamsmith/templates/pm-prompt.md.tmpl +20 -1
  44. package/skills/teamsmith/templates/report.md.tmpl +12 -0
  45. package/skills/teamsmith/templates/task.md.tmpl +4 -0
  46. package/skills/teamsmith/tests/bg-ledger-harness.mjs +682 -0
  47. package/skills/teamsmith/tests/bg-ledger.sh +307 -0
  48. package/skills/teamsmith/tests/checkout-shape-probe.sh +287 -58
  49. package/skills/teamsmith/tests/config-cli.sh +162 -288
  50. package/skills/teamsmith/tests/death-cause.sh +5 -2
  51. package/skills/teamsmith/tests/install-shape.sh +4 -2
  52. package/skills/teamsmith/tests/key-replies-pty.sh +375 -0
  53. package/skills/teamsmith/tests/key-replies-ui.sh +332 -0
  54. package/skills/teamsmith/tests/key-replies.sh +1075 -0
  55. package/skills/teamsmith/tests/ledger-ban.sh +5 -5
  56. package/skills/teamsmith/tests/ledger-claim.sh +247 -0
  57. package/skills/teamsmith/tests/lib/checkout-shape.sh +66 -14
  58. package/skills/teamsmith/tests/lib/model-policy.sh +26 -0
  59. package/skills/teamsmith/tests/lib/model-routing-boundary.sh +420 -0
  60. package/skills/teamsmith/tests/lib/model-routing-expansion.sh +155 -0
  61. package/skills/teamsmith/tests/lib/model-routing-flips.py +136 -0
  62. package/skills/teamsmith/tests/lib/model-routing-roles.sh +250 -0
  63. package/skills/teamsmith/tests/lib/proc-io.sh +103 -0
  64. package/skills/teamsmith/tests/lib/reply-fixture.sh +372 -0
  65. package/skills/teamsmith/tests/lib/tmux-iso.sh +8 -0
  66. package/skills/teamsmith/tests/panel-b2.sh +1 -1
  67. package/skills/teamsmith/tests/panel-b3-stub.sh +27 -0
  68. package/skills/teamsmith/tests/panel-b3.sh +14 -10
  69. package/skills/teamsmith/tests/panel-choices.sh +74 -61
  70. package/skills/teamsmith/tests/panel-cpu.sh +1 -1
  71. package/skills/teamsmith/tests/panel-p21.sh +311 -190
  72. package/skills/teamsmith/tests/perf.sh +1 -1
  73. package/skills/teamsmith/tests/pm-box-real.sh +1 -1
  74. package/skills/teamsmith/tests/pulse-nudge-key.sh +1 -1
  75. package/skills/teamsmith/tests/routes.sh +43 -22
  76. package/skills/teamsmith/tests/section-budgets.tsv +9 -5
  77. package/skills/teamsmith/tests/section-paths.tsv +26 -16
  78. package/skills/teamsmith/tests/section-select.sh +99 -16
  79. package/skills/teamsmith/tests/smoke.sh +930 -216
  80. package/skills/teamsmith/tests/snapshots/zh-dark-120-detail.txt +2 -2
  81. package/skills/teamsmith/tests/snapshots/zh-dark-120-p4.txt +2 -2
  82. package/skills/teamsmith/tests/snapshots/zh-dark-120.txt +9 -9
  83. package/skills/teamsmith/tests/snapshots/zh-dark-160-p4.txt +2 -2
  84. package/skills/teamsmith/tests/snapshots/zh-dark-160.txt +9 -9
  85. package/skills/teamsmith/tests/snapshots/zh-dark-59-detail.txt +1 -1
  86. package/skills/teamsmith/tests/snapshots/zh-dark-59-p4.txt +1 -1
  87. package/skills/teamsmith/tests/snapshots/zh-dark-59.txt +5 -5
  88. package/skills/teamsmith/tests/snapshots/zh-dark-99-p4.txt +2 -2
  89. package/skills/teamsmith/tests/snapshots/zh-dark-99.txt +5 -5
  90. package/skills/teamsmith/tests/snapshots/zh-light-120-detail.txt +2 -2
  91. package/skills/teamsmith/tests/snapshots/zh-light-120-p4.txt +2 -2
  92. package/skills/teamsmith/tests/snapshots/zh-light-120.txt +9 -9
  93. package/skills/teamsmith/tests/snapshots/zh-light-160-p4.txt +2 -2
  94. package/skills/teamsmith/tests/snapshots/zh-light-160.txt +9 -9
  95. package/skills/teamsmith/tests/snapshots/zh-light-59-detail.txt +1 -1
  96. package/skills/teamsmith/tests/snapshots/zh-light-59-p4.txt +1 -1
  97. package/skills/teamsmith/tests/snapshots/zh-light-59.txt +5 -5
  98. package/skills/teamsmith/tests/snapshots/zh-light-99-p4.txt +2 -2
  99. package/skills/teamsmith/tests/snapshots/zh-light-99.txt +5 -5
  100. package/skills/teamsmith/tests/task-header-model.sh +2 -1
  101. package/skills/teamsmith/tests/task-model-routing.sh +1014 -0
  102. package/skills/teamsmith-init/SKILL.md +38 -38
  103. package/skills/teamsmith-init/references/bootstrap.md +6 -4
  104. package/skills/teamsmith-init/templates/bootstrap-prompt.md.tmpl +9 -5
@@ -101,6 +101,7 @@ case "$CMD" in
101
101
  notify) team_cmd_notify "$@" ;;
102
102
  outbox) team_cmd_outbox "$@" ;;
103
103
  draft) team_cmd_draft "$@" ;;
104
+ reply) team_cmd_reply "$@" ;;
104
105
  review) team_cmd_review "$@" ;;
105
106
  close) team_cmd_close "$@" ;;
106
107
  teardown) team_cmd_teardown "$@" ;;
@@ -50,12 +50,25 @@ last three take `--force` + one audited line). `team change status <id>` shows t
50
50
 
51
51
  - **Only change directories you own** (`{{DOCS_DIR}}/OWNERSHIP.md`); for cross-directory work write `BLOCKED:` in
52
52
  the report and hand it back to the PM.
53
- - **Never stop mid-task to ask for confirmation**: either deliver (gates run + report + push + PR/MR) or be
54
- hard-blocked (notify the PM + PARTIAL report).
53
+ - **Never stop mid-task to ask for confirmation**: end the turn in exactly three states -- **delivered** (gates run
54
+ + report written + branch settled), **hard-blocked** (notify the PM + `BLOCKED:` in the report), or
55
+ **suspended on background jobs** (this session's jobs still running, every step independent of them done; its
56
+ last line names every awaited job id). The lane rule is the suspend default: `team_bg_run` starts a long job and
57
+ the turn ends -- the completion wake-up is the normal harvest point -- while in-turn waiting is the bounded
58
+ exception, only inside the inline-wait budget (about 2 minutes), when the result blocks the next step and nothing
59
+ else can advance.
55
60
  - **Never claim tests passed without having run them.** The PM re-runs in an independent worktree; a false report
56
61
  fails the task.
57
62
  - Never write tokens/secrets into code, config, logs or commit messages; never read credential files
58
63
  (e.g. `~/.pi/agent/auth.json`).
64
+ - **A brief declares one task category; models belong to the project, not to your seat.** The `category:` line
65
+ selects the model the PM dispatches with (`routine` for bounded ordinary work, `analysis` for complex
66
+ planning/judgment, `verify` for independent adversarial review — or the project's own names). A same-task
67
+ recovery keeps its committed model/SID: do not re-select, and never treat model strength as a substitute for a
68
+ self-contained brief. **Independent verification cannot be waived by a strong model.**
69
+ - **Scope, report and disk handover survive a fresh takeover**: keep exactly the brief's scope, commit in small
70
+ steps, write `{{DOCS_DIR}}/reports/<ID>-<agent>.md`, and leave the next step and evidence on disk — a new session
71
+ (or a verifier) must be able to continue from the files alone, never from your conversation.
59
72
  - Never push `{{PROTECTED_BRANCH}}`, never `git push --force`, never merge PR/MRs or rebase/delete other branches.
60
73
  - Commit in small steps: every verifiable step gets a commit (Conventional Commits + task ID + `Agent: <name>` trailer).
61
74
 
@@ -1,11 +1,11 @@
1
1
  # {{PROJECT}} · 任务板
2
2
 
3
3
  > PM 维护;agent 只读。状态:`todo` / `wip` / `review`(已交付待复验) / `done` / `blocked` / `dropped`
4
- > 工具:`team task <ID> --title ...` 建行 | `team board set <ID> <状态>` 改状态 | `team board assign <ID> <agent>` 指派 | `team board ls`
4
+ > 工具:`team task <ID> --title ... --category <类别>` 建行(category 决定派单用哪个模型) | `team board set <ID> <状态>` 改状态 | `team board assign <ID> <agent>` 指派 | `team board ls`
5
5
 
6
6
  | ID | 任务 | Agent | 分支 | 依赖 | 状态 |
7
7
  |---|---|---|---|---|---|
8
- | — | (还没有任务:`team task T1.1 --title "第一个任务" --agent dev`) | - | - | - | dropped |
8
+ | — | (还没有任务:`team task T1.1 --title "第一个任务" --category <类别> --agent dev`) | - | - | - | dropped |
9
9
 
10
10
  ## 当前里程碑
11
11
 
@@ -12,9 +12,13 @@
12
12
 
13
13
  ## Roster
14
14
 
15
- | Agent | Model | Long-lived worktree | Scope |
16
- |---|---|---|---|
17
- | <name> | <provider/model> | `.worktrees/<name>` | <module> |
15
+ | Agent | Long-lived worktree | Scope |
16
+ |---|---|---|
17
+ | <name> | `.worktrees/<name>` | <module> |
18
+
19
+ > A seat is a roster name and a directory, **not a model**. Models are the project's task-category policy
20
+ > (`TEAM_TASK_MODELS` in `.pi/team/config.sh`) plus the independent `TEAM_PM_MODEL`; a brief's `category:` selects
21
+ > one, and ownership never follows model strength.
18
22
 
19
23
  ## Change process
20
24
 
@@ -40,6 +40,23 @@
40
40
  `team review <ID> --dir <checkout>` runs the gates and writes the evidence.
41
41
  - A brief may require stricter commands than the project gates; the brief wins.
42
42
 
43
+ ## Model policy: task categories, not seats
44
+
45
+ - The contract maps **task categories** to models (`TEAM_TASK_MODELS`, e.g. `routine=… analysis=… verify=…`) and
46
+ names one independent `TEAM_PM_MODEL`; a seat is a roster name, not a model identity.
47
+ - The brief's `category:` picks a **new** dispatch's model; `team dispatch --model` overrides it for that launch.
48
+ A same-task recovery keeps the committed model/SID even if the category later leaves the map; a new task citing a
49
+ dropped category is refused. Editing the map changes future selections only.
50
+ - Choose by the work: routine for bounded ordinary implementation, analysis for complex planning/judgment, verify
51
+ for independent adversarial review (a project that uses other names says so in its briefs — the CLI never maps
52
+ phase or seat to a model automatically). Put the rationale in the brief when the choice is not obvious.
53
+ - Shared-token concurrency: strong models are the scarce resource (`TEAM_MODEL_LIMITS`); `team ps` shows the
54
+ current occupancy, so keep the parallel agent count inside the provider quota and queue the rest.
55
+ - A running PM keeps its model until an explicit `team up --fresh-pm`; hand over through disk (brief, report,
56
+ thread, `state/`), not through a session conversation.
57
+ - Changing the project's own contract, launching a fresh PM, landing source on a shared branch/skill path and
58
+ adopting a shared source are **distinct gates**: preview the exact command and get authorization per operation.
59
+
43
60
  ## Specs (OpenSpec)
44
61
 
45
62
  Specs and change proposals live in `openspec/` (required dependency). `openspec validate --all --strict` is part of
@@ -11,11 +11,17 @@ TEAM_SESSION="{{SESSION}}" # tmux session name (the PM and every agen
11
11
  # `team bootstrap` writes this default and renames a differently-named current window instead of inheriting it.
12
12
  TEAM_PM_WINDOW="{{PM_WINDOW}}" # window running the PM; notifications are typed into it
13
13
 
14
- # ---- roster and models ----
14
+ # ---- roster, task model policy and concurrency ----
15
15
  TEAM_AGENTS="{{AGENTS}}"
16
- # Per-agent default model (optional; falls back to TEAM_DEFAULT_MODEL): "dev=deepseek/deepseek-flash verify=xai/grok-4.6"
17
- TEAM_AGENT_MODELS=""
18
- TEAM_DEFAULT_MODEL="{{DEFAULT_MODEL}}"
16
+ # Task category → model policy (required; `team init --task-models '<map>'` writes it).
17
+ # Categories are the project's own words: "routine=provider/light analysis=provider/strong verify=provider/strong".
18
+ # A new dispatch picks its model from the brief's `category:` line; a same-task recovery keeps the model/SID it was
19
+ # already assigned, even if the map later drops that category. One category: team config set-task-model <category> <model>;
20
+ # the whole map: team config set TEAM_TASK_MODELS '<map>' --yes. The old TEAM_AGENT_MODELS / TEAM_DEFAULT_MODEL keys are
21
+ # retired: an existing project upgrades explicitly with `team config upgrade-models --task-models '<map>' --pm-model '<model>'`.
22
+ TEAM_TASK_MODELS=""
23
+ # Independent PM model (required; the PM never falls back to a worker/task model). `team up` guards it with --fresh-pm.
24
+ TEAM_PM_MODEL=""
19
25
  # Concurrency caps ("provider/model=N"): important when a provider quota is small,
20
26
  # e.g. "kimi-coding/k3=2 openai-codex/gpt-5.6-sol=1" (wildcards allowed)
21
27
  TEAM_MODEL_LIMITS="kimi-coding/k3=2 openai-codex/*=1"
@@ -98,7 +104,6 @@ TEAM_PULSE_INTERVAL=900 # patrol interval (seconds): 15 minutes by
98
104
  TEAM_PULSE_NUDGE_GAP=900 # minimum gap before the same backlog is mentioned again (seconds)
99
105
  TEAM_PULSE_REBUILD_TMUX=0 # 0 = leave tmux alone (report a missing session/window); 1 = allow rebuilding
100
106
  TEAM_PULSE_MAX_RESTARTS=5 # maximum automatic PM restarts per hour (crash-loop guard)
101
- TEAM_PM_MODEL="" # the PM's own model; empty = TEAM_DEFAULT_MODEL
102
107
  TEAM_PM_SESSION_ID="" # empty = `pi -c` (continue the previous session in this directory, keeping history)
103
108
  TEAM_PM_EXTRA_PI_ARGS=""
104
109
 
@@ -13,6 +13,9 @@
13
13
  - Project: {{PROJECT}}; main worktree `{{MAIN_ROOT}}`; team docs `{{DOCS_DIR}}`.
14
14
  - tmux session/window: `{{SESSION}}:{{PM_WINDOW}}` (PM), agent windows per roster, pulse window `pulse`.
15
15
  - Roster: {{AGENTS}}; gates command: `{{GATES}}`.
16
+ - Model policy: task categories → models in `TEAM_TASK_MODELS` (routine for bounded work, analysis for complex
17
+ judgment, verify for independent adversarial review — or this project's own names) plus the independent
18
+ `TEAM_PM_MODEL`. Editing the map changes future selections only; a committed assignment keeps its model/SID.
16
19
  - The protected branch `{{PROTECTED_BRANCH}}` is PM-only; one branch per task `task/<ID>-<slug>`.
17
20
  - Branch mode: `{{BRANCH_MODE}}`; agent worktrees: `{{WORKTREES_DIR}}/<agent>` (**never move them**: sessions are keyed by cwd).
18
21
 
@@ -36,7 +36,8 @@ If the pulse restarted you: first check the tail of `{{DOCS_DIR}}/../.pi/team/st
36
36
  `{{DOCS_DIR}}/threads/*.md` entries, work out where you stopped, and **do not redo finished work**.
37
37
 
38
38
  > If the project has never been initialised (no `.pi/team/config.sh`): run `team bootstrap` first
39
- > (one command: config + docs skeleton + agent worktrees + pulse window + next steps).
39
+ > (one command: config + docs skeleton + agent worktrees + pulse window + next steps; a **fresh** project must pass
40
+ > `--task-models '<category=provider/model …>' --pm-model '<provider/model>'` — there is no default model).
40
41
 
41
42
  ## Cross-project (you may talk; you may not command)
42
43
 
@@ -88,6 +89,24 @@ their repo. **Workers do not attend meetings** — they write `BLOCKED:` in thei
88
89
  that hold across tasks in project memory (`ctx_memory`) and park "do later" items as notes — but **evidence
89
90
  always lives in the files on disk**.
90
91
 
92
+ ## Choosing a model: categories, not seats
93
+
94
+ The contract maps task categories to models (`TEAM_TASK_MODELS`) and names your own model (`TEAM_PM_MODEL`); a seat
95
+ is a roster name, not a model identity. Each brief declares its `category:` — **routine** for bounded ordinary
96
+ implementation, **analysis** for complex planning/judgment, **verify** for independent adversarial review; a project
97
+ may define other names, and the CLI never picks a model from the phase or the seat. A new dispatch selects the
98
+ category's model (`team dispatch --model` overrides that one launch); a complete same-task recovery keeps the
99
+ committed model/SID even after the category leaves the map, while a **new** task citing a dropped category is
100
+ refused. Write the rationale into the brief prose when the choice is not obvious. Strong models are the
101
+ shared-token scarce resource: read `team ps` (model concurrency + `TEAM_MODEL_LIMITS`) before dispatching several
102
+ agents and queue what does not fit; the PM's own model changes only through an explicit `team up --fresh-pm`. Disk
103
+ beats memory across a fresh takeover: brief, report, thread and `state/` carry the work, never a session.
104
+
105
+ Four operations are **separate recorded gates**, each previewed and authorized per command: private source
106
+ verification; landing validated source on a shared/protected tree; writing this project's configuration (and the
107
+ first fresh launch that reads it); and adopting a changed shared skill/copy source — a shared link reads its
108
+ target's current bytes, so changing that target can affect other readers without any installer.
109
+
91
110
  ## Boundaries
92
111
 
93
112
  - **Act only inside this project / this team session**: do not modify other projects' repos, do not read other
@@ -18,6 +18,18 @@ $ <command>
18
18
 
19
19
  - Verdict: <pass / fail / not run>
20
20
  - Notes: what was not verified, known risks, TODOs (**be explicit**: if you did not run it, say so)
21
+ - Ledger ban (fixed acceptance line — run it **in your own worktree, on your branch's tree**):
22
+
23
+ ```
24
+ $ bash skills/teamsmith/tests/ledger-ban.sh --names-file "$(git rev-parse --path-format=absolute --git-common-dir)/../.pi/team/forbidden-names.txt"
25
+ ledger-ban: root=… scope=published files=<n> hits=<n> names=ok user=resolved
26
+ $ echo $?
27
+ <rc>
28
+ ```
29
+
30
+ Paste the real `hits=` and `rc` from this tree. **Running it in the main checkout cannot see files that exist
31
+ only on your branch** (a report you just wrote is simply absent there), so a `hits=0` from the main
32
+ checkout is not evidence that the branch's own ledger is clean.
21
33
 
22
34
  ## Flip evidence (required for defect-fix tasks)
23
35
 
@@ -21,6 +21,10 @@ budget: <one work block; if it runs long, deliver a PARTIAL report rather than s
21
21
  > The five phases are `explore|propose|apply|verify|archive` and the `phase:` line names the one this brief runs.
22
22
  > **An `apply` brief may not start before the PM's proposal review is ACCEPTED** in
23
23
  > `{{DOCS_DIR}}/reviews/<change>-proposal.md` (the PM's recorded gate — see the skill's `references/openspec.md`).
24
+ > The `category:` header (written by `team task --category`) selects a **new** dispatch's model from the project's
25
+ > `TEAM_TASK_MODELS`; a same-task recovery keeps its committed model/SID. Choose routine for bounded ordinary
26
+ > implementation, analysis for complex planning/judgment and verify for independent adversarial review (or the
27
+ > project's own category names), and say why in the brief when the choice is not obvious.
24
28
 
25
29
  ## Required evidence
26
30