teamsmith 0.3.4 → 0.4.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 (68) hide show
  1. package/README.md +8 -8
  2. package/package.json +1 -1
  3. package/skills/teamsmith/CHANGELOG.md +40 -0
  4. package/skills/teamsmith/SKILL.md +83 -163
  5. package/skills/teamsmith/extension/team-notify.ts +1 -1
  6. package/skills/teamsmith/extension/team-reply.ts +105 -0
  7. package/skills/teamsmith/references/agent-adapters.md +1 -1
  8. package/skills/teamsmith/references/config.md +20 -11
  9. package/skills/teamsmith/references/migration.md +47 -3
  10. package/skills/teamsmith/references/protocol.md +64 -31
  11. package/skills/teamsmith/references/reminders.md +131 -0
  12. package/skills/teamsmith/references/troubleshooting.md +19 -5
  13. package/skills/teamsmith/references/workflows.md +18 -16
  14. package/skills/teamsmith/scripts/lib/cmd-agents.sh +77 -49
  15. package/skills/teamsmith/scripts/lib/cmd-project.sh +193 -21
  16. package/skills/teamsmith/scripts/lib/cmd-remind.sh +103 -0
  17. package/skills/teamsmith/scripts/lib/cmd-update.sh +7 -4
  18. package/skills/teamsmith/scripts/lib/common.sh +44 -4
  19. package/skills/teamsmith/scripts/lib/outbox.sh +72 -18
  20. package/skills/teamsmith/scripts/remind-store.mjs +529 -0
  21. package/skills/teamsmith/scripts/replies.mjs +9 -3
  22. package/skills/teamsmith/scripts/reply-capture.mjs +612 -0
  23. package/skills/teamsmith/scripts/state-authority.mjs +500 -0
  24. package/skills/teamsmith/scripts/strings/commands.tsv +2 -1
  25. package/skills/teamsmith/scripts/strings/help.en.tsv +16 -2
  26. package/skills/teamsmith/scripts/strings/help.zh.tsv +16 -2
  27. package/skills/teamsmith/scripts/team +1 -0
  28. package/skills/teamsmith/templates/AGENTS.section.md.tmpl +68 -123
  29. package/skills/teamsmith/templates/PROTOCOL.md.tmpl +48 -55
  30. package/skills/teamsmith/templates/pm-prompt.md.tmpl +126 -119
  31. package/skills/teamsmith/tests/checkout-shape-probe.sh +6 -5
  32. package/skills/teamsmith/tests/delivery-truth.sh +82 -47
  33. package/skills/teamsmith/tests/fixtures/delivery-truth-real/README.md +71 -23
  34. package/skills/teamsmith/tests/fixtures/delivery-truth-real/__pycache__/judge-second.cpython-313.pyc +0 -0
  35. package/skills/teamsmith/tests/fixtures/delivery-truth-real/judge-dirty-ab.py +143 -0
  36. package/skills/teamsmith/tests/fixtures/delivery-truth-real/judge-second.py +26 -9
  37. package/skills/teamsmith/tests/fixtures/delivery-truth-real/run-case.sh +92 -20
  38. package/skills/teamsmith/tests/fixtures/delivery-truth-real/scenario.sh +47 -3
  39. package/skills/teamsmith/tests/fixtures/reply-capture-provider.ts +76 -0
  40. package/skills/teamsmith/tests/flip-p410-order2.sh +205 -0
  41. package/skills/teamsmith/tests/frames/README.md +3 -1
  42. package/skills/teamsmith/tests/gate-guard.sh +20 -4
  43. package/skills/teamsmith/tests/help-surface.sh +60 -2
  44. package/skills/teamsmith/tests/install-shape.sh +312 -0
  45. package/skills/teamsmith/tests/key-replies-pty.sh +197 -21
  46. package/skills/teamsmith/tests/key-replies.sh +187 -68
  47. package/skills/teamsmith/tests/ledger-claim.sh +8 -6
  48. package/skills/teamsmith/tests/lib/box-judge.sh +2 -1
  49. package/skills/teamsmith/tests/lib/main-team-fingerprint.sh +104 -0
  50. package/skills/teamsmith/tests/lib/pm-window.sh +143 -0
  51. package/skills/teamsmith/tests/lib/reply-fixture.sh +7 -19
  52. package/skills/teamsmith/tests/lib/reply-guard.sh +188 -0
  53. package/skills/teamsmith/tests/lib/section-calls.pl +171 -0
  54. package/skills/teamsmith/tests/loop-inventory.tsv +7 -5
  55. package/skills/teamsmith/tests/meta-suite.sh +215 -0
  56. package/skills/teamsmith/tests/panel-b3-pty-mouse.py +154 -17
  57. package/skills/teamsmith/tests/panel-b3.sh +33 -4
  58. package/skills/teamsmith/tests/remind-cli.sh +574 -0
  59. package/skills/teamsmith/tests/reply-capture-real.mjs +360 -0
  60. package/skills/teamsmith/tests/reply-capture-real.sh +5 -0
  61. package/skills/teamsmith/tests/reply-capture.mjs +756 -0
  62. package/skills/teamsmith/tests/section-paths.tsv +40 -9
  63. package/skills/teamsmith/tests/section-select.sh +180 -26
  64. package/skills/teamsmith/tests/smoke.sh +1235 -238
  65. package/skills/teamsmith/tests/state-authority-node.mjs +42 -0
  66. package/skills/teamsmith/tests/state-authority.sh +629 -0
  67. package/skills/teamsmith/tests/workflow-entry.sh +123 -3
  68. package/skills/teamsmith-init/SKILL.md +1 -1
@@ -1,41 +1,41 @@
1
1
  <!-- teamsmith:begin -->
2
2
  ## Team protocol (teamsmith)
3
3
 
4
- This project runs a team of agents: a **PM (orchestrator)** in tmux `{{SESSION}}:{{PM_WINDOW}}` owns tasks and merge
5
- authority, while **worker agents** implement in parallel inside their own git worktrees.
6
- Tooling: `bash {{SKILL_DIR}}/scripts/team help`.
4
+ A **PM (orchestrator)** in tmux `{{SESSION}}:{{PM_WINDOW}}` owns tasks and merge authority; **worker agents**
5
+ implement in parallel inside their own git worktrees. Tooling: `bash {{SKILL_DIR}}/scripts/team help`.
6
+ Roster: {{AGENTS}} (editable in `.pi/team/config.sh`).
7
+
8
+ **Project rules belong outside this block.** Everything between `<!-- teamsmith:begin -->` and
9
+ `<!-- teamsmith:end -->` is generated and `team init` replaces it on refresh, so a rule written inside is lost at
10
+ the next upgrade: the managed block is not a customization surface. Rules already inside the pair must be
11
+ inventoried and preserved outside first -- the PM's job, recipe in `{{SKILL_DIR}}/references/migration.md`.
7
12
 
8
- ### Roles and boundaries
13
+ ### Roles and reading order
9
14
 
10
15
  | Role | Owns | Must not |
11
16
  |---|---|---|
12
17
  | PM | Briefs / roadmap / decision log, dispatch, independent verification, merging, wrap-up | Treat "the agent says it passed" as evidence |
13
18
  | agent:<name> | Exactly the brief, tests and reports, opening PR/MRs | push `main`, force-push, merge PR/MRs, touch other people's directories |
14
19
 
15
- Roster: {{AGENTS}} (editable in `.pi/team/config.sh`).
16
-
17
- ### Reading order (before any agent starts)
18
-
19
- 1. This file (especially this section)
20
- 2. Your own thread `{{DOCS_DIR}}/threads/<agent>.md` (the PM may have added instructions)
21
- 3. The task brief `{{DOCS_DIR}}/tasks/<ID>-<slug>.md` (the single source of scope and acceptance commands)
20
+ Before starting, in this order: this file (especially this section), your own thread
21
+ `{{DOCS_DIR}}/threads/<agent>.md` (the PM may have added instructions), and the task brief
22
+ `{{DOCS_DIR}}/tasks/<ID>-<slug>.md` -- the brief is the single source of scope and acceptance commands.
23
+ `{{DOCS_DIR}}/OWNERSHIP.md` decides whose directory is whose.
22
24
 
23
25
  ### Specs (OpenSpec)
24
26
 
25
27
  Specs and change proposals live in `openspec/` -- a **required dependency** (`openspec init --tools none` creates
26
- the spec root; `openspec init --tools pi` also generates the five phase commands, see
27
- `{{SKILL_DIR}}/references/openspec.md`). Before implementing a change, read its proposal in
28
- `openspec/changes/<id>/` and the capability spec it touches (`openspec/specs/<capability>/spec.md`; finished changes
29
- move to `openspec/changes/archive/`). `openspec validate --all --strict` is part of the gate. **Do not create a
30
- parallel spec system**: no requirement lists, spec copies or design sections in task briefs or docs -- if it must
31
- hold, it goes into a spec.
32
-
33
- A change runs as **five phases, one brief and one owner each**: an explorer runs `opsx-explore`, then
34
- `opsx-propose` (planning only); a dev runs `opsx-apply`; a **different** agent runs `opsx-verify`; the PM runs
35
- `opsx-archive`. Two hard rules: **no `apply` brief before the PM's proposal review
36
- (`{{DOCS_DIR}}/reviews/<change>-proposal.md`) is ACCEPTED**, and no agent verifies its own work; the PM archives
37
- only after independent verification **and the user's confirmation**. The phase names go in the brief's `phase:`
38
- line; the full pipeline and its gates are in `{{SKILL_DIR}}/references/openspec.md`.
28
+ the spec root). Read the change's proposal in `openspec/changes/<id>/` and the capability spec it touches
29
+ (`openspec/specs/<capability>/spec.md`; finished changes move to `openspec/changes/archive/`).
30
+ `openspec validate --all --strict` is part of the gate. **Do not create a parallel spec system**: no requirement
31
+ lists, spec copies or design sections in task briefs or docs -- if it must hold, it goes into a spec.
32
+
33
+ A change runs as **five phases, one brief and one owner each**: `opsx-explore`, then `opsx-propose` (planning only);
34
+ a dev runs `opsx-apply`; a **different** agent runs `opsx-verify`; the PM runs `opsx-archive`. Two hard rules: **no
35
+ `apply` brief before the PM's proposal review (`{{DOCS_DIR}}/reviews/<change>-proposal.md`) is ACCEPTED**, and no
36
+ agent verifies its own work; the PM archives only after independent verification **and the user's confirmation**.
37
+ Phase names go in the brief's `phase:` line; flags, phase-command source and pinned-toolchain caveat are in
38
+ `{{SKILL_DIR}}/references/openspec.md`.
39
39
 
40
40
  **The change is the assignment unit** (`1 change : N tasks`, `1 task : 0..1 change`): the brief's header is the
41
41
  foreign key — `change:` (exactly one id, or `-`), `specs:`/`anchor:` (a change-less brief must resolve
@@ -52,116 +52,61 @@ last three take `--force` + one audited line). `team change status <id>` shows t
52
52
  the report and hand it back to the PM.
53
53
  - **Never stop mid-task to ask for confirmation**: end the turn in exactly three states -- **delivered** (gates run
54
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
+ **suspended on background jobs** (this session's jobs still running, every step that does not depend on them
56
+ done; the turn's last line names every awaited job id). The lane rule is the suspend default: `team_bg_run`
57
+ starts a long job and the turn ends -- the completion wake-up is the normal harvest point -- and in-turn waiting
58
+ is the bounded exception, only inside the inline-wait budget (about 2 minutes), when the result blocks the next
59
+ step and nothing else can advance. A previous session's wake-ups died with its process: find its jobs on disk
60
+ (`state/bg.log`, `team bg list`) before awaiting or re-running them (`{{SKILL_DIR}}/references/workflows.md` §E2).
60
61
  - **Never claim tests passed without having run them.** The PM re-runs in an independent worktree; a false report
61
62
  fails the task.
62
63
  - Never write tokens/secrets into code, config, logs or commit messages; never read credential files
63
64
  (e.g. `~/.pi/agent/auth.json`).
64
65
  - **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.**
66
+ selects the model the PM dispatches with (`routine` ordinary bounded work, `analysis` planning/judgment,
67
+ `verify` independent adversarial review -- or the project's own names). A same-task recovery keeps its committed
68
+ model/SID: do not re-select, and never treat model strength as a substitute for a self-contained brief.
69
+ **Independent verification cannot be waived by a strong model.**
69
70
  - **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.
71
+ steps, write `{{DOCS_DIR}}/reports/<ID>-<agent>.md`, and leave the next step and evidence on disk -- a new
72
+ session (or a verifier) must be able to continue from the files alone, never from your conversation.
72
73
  - **A report is read for its answer first, and every sentence carries its evidence**: state what the brief's
73
74
  question resolves to before the account of how you got there. A caution, a limitation or a boundary earns its
74
- place by what it cites — a measurement, a counterexample, a gap in the reasoning, or a boundary you did not
75
- observe — and a sentence that names none is deleted; one that carries its evidence stays. Every finding states
75
+ place by what it cites -- a measurement, a counterexample, a gap in the reasoning, or a boundary you did not
76
+ observe -- and a sentence that names none is deleted; one that carries its evidence stays. Every finding states
76
77
  what it changed: the implementation, the next step, the conclusion, or nothing; an observation that changed
77
78
  nothing stays out of the body. See `{{SKILL_DIR}}/references/protocol.md` §11b.
78
79
  - Never push `{{PROTECTED_BRANCH}}`, never `git push --force`, never merge PR/MRs or rebase/delete other branches.
79
80
  - Commit in small steps: every verifiable step gets a commit (Conventional Commits + task ID + `Agent: <name>` trailer).
80
81
 
81
- ### Collaboration loop
82
-
83
- ```
84
- PM writes the brief + creates the agent worktree
85
- │ team dispatch <agent> <ID> <task-file>
86
- ▼
87
- agent implements in its worktree → small commits → runs gates → writes report → pushes branch → opens PR/MR
88
- │ on turn end, automatically: appends {{DOCS_DIR}}/inbox/<agent>.md + knocks {{SESSION}}:{{PM_WINDOW}}
89
- ▼
90
- PM reads the inbox → team review <ID> (independent worktree, runs gates)
91
- ▼
92
- pass → the PM runs git itself (`merge --squash` + commit + push; with a PR, merge the PR first then
93
- `fetch && merge --ff-only`) → `team board set <ID> done` → `team close <ID>`
94
- fail → team say <agent> "..." with the concrete failure evidence
95
- ```
96
-
97
- - Blocked, or found someone else's bug: `bash {{SKILL_DIR}}/scripts/team notify <agent> "<one line>"`, and write a
98
- PARTIAL report.
99
- - Gates: `{{GATES}}` (a brief may require stricter commands; the brief wins).
100
- - One gate at a time: the full suite is the machine's shared resource — `TEAM_SMOKE_FAST=1` inside a batch, the
101
- full suite before delivery and review. `team review` queues on the gate lock (`TEAM_SMOKE_LOCK`,
102
- `TEAM_SMOKE_LOCK_WAIT`, holder in `<companion>.holder` — the pair is published path + dot-prefixed companion,
103
- never unlinked) before its hard timeout starts, so the record shows
104
- `queued` and `ran` separately; a queue past the cap is a loud `FAIL` naming the holder, not a `TIMEOUT`. On a
105
- busy machine the panel timing lines (2000 ms frame, 1 % CPU — medians of three printed samples) print the
106
- measured values and the load and **skip visibly** instead of reporting a red the machine owes; the premise is
107
- `loadavg ≤ factor × cores` with `factor` 0.75 in the gate and 0.25 for the cold-start fixture.
108
- - Messages are not deliverables: the real evidence lives in `{{DOCS_DIR}}/reports/`, `{{DOCS_DIR}}/reviews/` and commits.
109
-
110
- ### Bootstrap (first step in a new project)
111
-
112
- ```bash
113
- bash {{SKILL_DIR}}/scripts/team bootstrap # idempotent: config + docs skeleton + worktrees + pulse window + next steps
114
- ```
115
-
116
- ### Cross-project meetings (PM to PM)
117
-
118
- ```bash
119
- bash {{SKILL_DIR}}/scripts/team meeting inbox # meetings waiting for my reply
120
- bash {{SKILL_DIR}}/scripts/team meeting say <slug> --intent proposal "…"
121
- ```
122
-
123
- Allowed: interface work, advice with evidence, problem reports, scheduling joint test windows. Not allowed:
124
- commanding another PM, deciding on their behalf, impersonating a human. Consensus requires both sides to `agree`;
125
- landing the work always happens in each side's own project. **Workers do not attend** (cross-project traffic is PM-only).
126
-
127
- ### Periodic patrol (not a heartbeat)
128
-
129
- The pulse is a **metronome that wakes the PM**, not a daemon that keeps it alive:
130
-
131
- - **The PM owns the pulse**: `team pulse up|status|logs|down` -- by default it runs `team monitor` in a
132
- `pulse` window of the same tmux session (team status on top, per-agent activity below, optional) and patrols
133
- on an interval. There is exactly one backend (that window) -- no container, no systemd.
134
- - **Bring it up at session start**: if the pulse is not running and you are not on standby, `team pulse up` is part of
135
- the PM's job -- no one else will do it; while `standby on` is set, leave it alone.
136
- - Every **15 minutes** by default (`TEAM_PULSE_INTERVAL=900`, 300-3600 recommended) it asks "is there work for the
137
- PM?": unread notifications / reports awaiting verification / board todo·wip (opt-in) / blocked / agents with
138
- unfinished tasks that stopped running.
139
- - **Pending work** → wake the PM (nudge it if running, start it if not). **Nothing pending** → do nothing at all --
140
- the team stays quiet and the PM is not required to be running.
141
- - If there is nothing to do, or a human is needed, the PM can `team standby on --reason "…"` and stand down; the
142
- pulse stops waking it (backlog still lands in `state/watchdog.log`). A human runs `team standby off`.
143
- - It **does not manage tmux layout or agents** (agents belong to the PM: `team resume`).
144
-
145
- ```bash
146
- bash <skill>/scripts/team pulse status # interval / standby / pending / PM state
147
- bash <skill>/scripts/team standby on --reason "waiting for the user to pick a stack"
148
- bash <skill>/scripts/team standby off
149
- bash <skill>/scripts/team up # manual rescue: build the tmux stage + start the PM (agents untouched)
150
- bash <skill>/scripts/team up --agents # also resume agents that have tasks but no window
151
- bash <skill>/scripts/team watch --once # run a single patrol tick
152
- ```
153
-
154
- - The capacity floor is **swap must not be exhausted** (tight RAM only means slowness, not refusal); `team ps` shows headroom.
155
-
156
- ### Directories
157
-
158
- | Path | Owner | Purpose |
159
- |---|---|---|
160
- | `{{DOCS_DIR}}/tasks/` | PM | Task briefs |
161
- | `{{DOCS_DIR}}/reports/` | agent (its own file only) | Delivery reports |
162
- | `{{DOCS_DIR}}/reviews/` | PM | Independent verification records |
163
- | `{{DOCS_DIR}}/threads/` | PM + that agent (append-only) | Decision/clarification messages |
164
- | `{{DOCS_DIR}}/inbox/` | generated (gitignored) | Turn-end briefings |
165
- | `{{DOCS_DIR}}/{BOARD,ROADMAP,OWNERSHIP,DECISIONS}.md` | PM | Board / milestones / ownership / decisions |
166
- | `{{WORKTREES_DIR}}/<agent>/` | that agent | Long-lived worktree (sessions are keyed by cwd -- keep it stable) |
82
+ ### Delivering
83
+
84
+ Gates are `{{GATES}}`; a brief may require stricter commands and then the brief wins. One gate at a time -- the full
85
+ suite is the machine's shared resource, and `TEAM_SMOKE_FAST=1` runs a bounded batch. A selected run covers only
86
+ the sections it executed and names the ones it did not run; a full run stays a milestone/delivery check, not a
87
+ claim attached to a selected run. Review queues on the gate lock before its own timeout starts.
88
+
89
+ Implement in scope, small commits, run the brief's acceptance commands, then write
90
+ `{{DOCS_DIR}}/reports/<ID>-<agent>.md` with the real commands and output tails (plus flip evidence for a defect
91
+ fix) and settle the branch: a local branch stays local, and a remote push/PR follows only the PM's authorized
92
+ route. The PM verifies in an independent worktree, merges itself, sets the board and closes the task. Messages are
93
+ not deliverables -- evidence lives in `{{DOCS_DIR}}/reports/`, `{{DOCS_DIR}}/reviews/` and the commits (recipes:
94
+ `{{SKILL_DIR}}/references/workflows.md` §B dispatch, §E verification, §F merge). `{{DOCS_DIR}}/inbox/<agent>.md`
95
+ and the knock on `{{SESSION}}:{{PM_WINDOW}}` happen at turn end automatically. Blocked, or someone else's bug:
96
+ `bash {{SKILL_DIR}}/scripts/team notify <agent> "<one line>"` and a report that says `BLOCKED:`.
97
+
98
+ ### The rest of the machine (read on demand)
99
+
100
+ - New project, first step: `bash {{SKILL_DIR}}/scripts/team bootstrap` (idempotent); recipe in
101
+ `{{SKILL_DIR}}/references/workflows.md` §A.
102
+ - The pulse is the PM's metronome, not a daemon: `team pulse up|status|logs|down` every `TEAM_PULSE_INTERVAL`
103
+ seconds (default 900), waking the PM only when work is pending. It never manages tmux layout, agents or quota,
104
+ and a stopped worker is pending work for the PM to `resume`, not an automatic dispatch; `team standby on|off` is
105
+ a human's call. Mechanism: `{{SKILL_DIR}}/references/protocol.md` §8; patrol: `references/workflows.md` §D/§I.
106
+ - Capacity floor (`team ps`): neither RAM nor disk swap may bottom out; model quotas are a separate limit
107
+ (`{{SKILL_DIR}}/references/protocol.md` §9).
108
+ - Cross-project meetings are PM-to-PM only: workers do not attend, and no agent touches another project's
109
+ repository or session (`{{SKILL_DIR}}/references/meeting.md`).
110
+ - The ledger is `{{DOCS_DIR}}/` (`tasks/ reports/ reviews/ threads/ inbox/` and `BOARD·ROADMAP·OWNERSHIP·DECISIONS.md`);
111
+ seats are `{{WORKTREES_DIR}}/<agent>/` and sessions are keyed by cwd, so keep that directory stable.
167
112
  <!-- teamsmith:end -->
@@ -1,27 +1,27 @@
1
1
  # {{PROJECT}} · Collaboration protocol (teamsmith)
2
2
 
3
- > **This file is the short operational summary.** The full version lives in the teamsmith section of the project's
4
- > `AGENTS.md` plus the skill's `references/`. Tooling entry point: `bash {{SKILL_DIR}}/scripts/team help`
3
+ > **A short operational summary, not the rule book.** The shared constitution is the teamsmith section of
4
+ > `AGENTS.md`; detailed procedures live in the skill's `references/`. Tooling entry point:
5
+ > `bash {{SKILL_DIR}}/scripts/team help`
5
6
 
6
7
  ## Roles
7
8
 
8
9
  | Role | Where | Owns | Red lines |
9
10
  |---|---|---|---|
10
11
  | PM | tmux `{{SESSION}}:pm` | Milestones/board/briefs/decisions; dispatch; independent verification; merging; wrap-up | Never let an agent's own account replace evidence; never write tokens into any artifact |
11
- | agent:<name> | `{{WORKTREES_DIR}}/<name>` | Implementation + tests + report + PR/MR | Never push the protected branch, force-push, merge, or change directories it does not own |
12
+ | agent:<name> | `{{WORKTREES_DIR}}/<name>` | Implementation + tests + report + the branch it was given | Never push the protected branch, force-push, merge, or change directories it does not own |
12
13
 
13
14
  ## Lifecycle of a task
14
15
 
15
16
  1. **PM**: write the brief `{{DOCS_DIR}}/tasks/<ID>-<slug>.md` (context / deliverables / boundaries / acceptance commands / report requirements).
16
17
  2. **PM**: `team add-agent <a>` for the long-lived worktree → `team dispatch <a> <ID> <taskfile>`.
17
18
  3. **agent**: implement in the worktree; commit in small steps; run the acceptance commands; write the report
18
- `{{DOCS_DIR}}/reports/<ID>-<a>.md`; push the branch; open a PR/MR; **the PM is notified automatically when the
19
- turn ends** (inbox + tmux wake-up).
19
+ `{{DOCS_DIR}}/reports/<ID>-<a>.md`; settle the branch (local: the commits stay on the task branch; remote: the
20
+ PM's authorized push/PR route). The PM is notified automatically when the turn ends (inbox + tmux wake-up).
20
21
  4. **PM**: `team digest` for pending work → `team review <ID> --dir <independent checkout>` (run gates, read the
21
22
  diff, write `{{DOCS_DIR}}/reviews/<ID>.md`).
22
- 5. **Pass** → the PM runs git: `merge --squash` + commit + push (with a PR, merge the PR first and then
23
- `fetch && merge --ff-only`) → `team board set <ID> done` → `team close <ID>`.
24
- **Fail** → `team say <a> "<concrete failure evidence>"` and send it back.
23
+ 5. **Pass** → the PM runs git itself: squash-merge (with a PR, merge it first, then `fetch && merge --ff-only`) →
24
+ `team board set <ID> done` → `team close <ID>`. **Fail** → send the concrete failure evidence back.
25
25
 
26
26
  ## Hard rules
27
27
 
@@ -30,7 +30,7 @@
30
30
  3. Commit in small steps -- never one dump at the end; include the task ID and an `Agent: <name>` trailer.
31
31
  4. Only change directories assigned to you in `{{DOCS_DIR}}/OWNERSHIP.md`; cross-directory needs → write `BLOCKED:` in the report.
32
32
  5. Blocked, or you found a bug: `team notify <a> "<one line>"`, write a PARTIAL report, then end the turn.
33
- 6. Only the PM advances the protected branch (`main` by default); agents push their own task branches only.
33
+ 6. Only the PM advances the protected branch (`main` by default); agents never push it, force-push, merge or rebase other branches.
34
34
  7. Tokens are injected only when the PM calls a real tool (`GH_TOKEN="$(< .gh-pat)" gh …`); never echoed, never written into project files.
35
35
 
36
36
  ## Gates
@@ -38,64 +38,57 @@
38
38
  - Project gates: `{{GATES}}`
39
39
  - Verification uses an **independent checkout**: the PM prepares it (`git worktree add --detach`), then
40
40
  `team review <ID> --dir <checkout>` runs the gates and writes the evidence.
41
- - A brief may require stricter commands than the project gates; the brief wins.
41
+ - A brief may require stricter commands than the project gates; the brief wins. A selected run says which sections it
42
+ did not run instead of claiming the full suite.
43
+ - **Correctness on every change**: `openspec validate --all --strict && bash {{SKILL_DIR}}/tests/smoke.sh </dev/null`.
44
+ **Performance separately, before a release**: `bash {{SKILL_DIR}}/tests/perf.sh` (front door `team perf`) — reference
45
+ readings only, never part of a review verdict. Gate policy and its queue: `{{SKILL_DIR}}/references/protocol.md` §9b-2.
42
46
 
43
47
  ## Model policy: task categories, not seats
44
48
 
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.
49
+ - The contract maps **task categories** to models (`TEAM_TASK_MODELS`) and names one independent `TEAM_PM_MODEL`; a
50
+ seat is a roster name, not a model identity.
51
+ - The brief's `category:` picks a **new** dispatch's model; a same-task recovery keeps the committed model/SID even if
52
+ the category later leaves the map; a new task citing a dropped category is refused. Choose by the work and put the
53
+ rationale in the brief when the choice is not obvious.
54
+ - Shared-token concurrency: strong models are the scarce resource (`TEAM_MODEL_LIMITS`); `team ps` shows occupancy.
55
+ - Changing the project's own contract, launching a fresh PM, landing source on a shared branch/skill path and adopting
56
+ a shared source are **distinct gates**: preview the exact command and get authorization per operation.
57
+ - Full policy: `{{SKILL_DIR}}/references/protocol.md` §6 and `references/config.md`.
59
58
 
60
59
  ## Specs (OpenSpec)
61
60
 
62
- Specs and change proposals live in `openspec/` (required dependency). `openspec validate --all --strict` is part of
63
- the gate. A brief names the change id and the scenarios it must satisfy; `openspec change show <id>` reads a
64
- proposal, and the PM archives a change (`openspec archive -y <id>`) only after independent verification has landed
65
- and the user confirmed. No parallel spec system.
61
+ Specs and change proposals live in `openspec/` (required dependency). `openspec validate --all --strict` is part of the
62
+ gate. `openspec change show <id>` reads a proposal, and the PM archives a change (`openspec archive -y <id>`) only
63
+ after independent verification has landed and the user confirmed. No parallel spec system: a product promise goes into
64
+ a spec, reasoning or guidance into `references/`.
66
65
 
67
- A change runs as **five phases, one brief and one owner each**: `opsx-explore` (an explorer) → `opsx-propose` (the
68
- same explorer, planning only) → `opsx-apply` (a dev) → `opsx-verify` (an **independent** agent) → `opsx-archive`
69
- (the PM). Two hard rules: an `apply` brief may not start before the PM's proposal review
70
- (`{{DOCS_DIR}}/reviews/<change>-proposal.md`) is **ACCEPTED**, and no agent verifies its own work. The pipeline, its
71
- gates and the PM's review checklist: `{{SKILL_DIR}}/references/openspec.md`.
66
+ A change runs as **five phases, one brief and one owner each**: `opsx-explore` (an explorer) → `opsx-propose` (the same
67
+ explorer, planning only) → `opsx-apply` (a dev) → `opsx-verify` (an **independent** agent) → `opsx-archive` (the PM).
68
+ Two hard rules: no `apply` brief before the PM's proposal review (`{{DOCS_DIR}}/reviews/<change>-proposal.md`) is
69
+ **ACCEPTED**, and no agent verifies its own work; the PM archives only after independent verification and the user's confirmation.
70
+ Phase table, gates and the PM's review checklist: `{{SKILL_DIR}}/references/openspec.md`.
72
71
 
73
72
  **The change is the assignment unit** (`1 change : N tasks`, `1 task : 0..1 change`): the brief's header is the
74
- foreign key — `change:` (exactly one id, or `-`), `specs:`/`anchor:` (a change-less brief must resolve
75
- `openspec/specs/<capability>/spec.md#<requirement>` or declare `anchor: none (infra) — <reason>`) and `deltas:`
76
- (the change's delta files this task writes; an absent line means the whole set). `team dispatch` refuses **before it
77
- opens a window**: more than one `change:` id (no override), an unresolvable anchor, two unfinished tasks of one
78
- change writing the same delta file, and a `verify` task whose agent authored an `apply` task of that change (the
79
- last three take `--force` + one audited line). `team change status <id>` shows the tasks/deltas/blockers and exits
80
- 0 only when every mapped task is finished; an `archive` task cannot be set `done` while a sibling is unfinished.
73
+ foreign key — `change:`, `specs:`/`anchor:` and `deltas:` — and `team dispatch` refuses more than one change id, a
74
+ change-less brief without a resolvable anchor, two unfinished tasks writing one delta file, and a verifier who
75
+ authored the change. `team change status <id>` shows readiness and exits 0 only when every mapped task is finished.
81
76
 
82
77
  ## Bootstrap and pulse
83
78
 
84
79
  ```bash
85
- bash {{SKILL_DIR}}/scripts/team bootstrap # new project in one command: config + docs skeleton + worktrees + pulse window
86
- bash {{SKILL_DIR}}/scripts/team pulse up # the pulse window runs the monitor + patrols (PM-configured)
80
+ bash {{SKILL_DIR}}/scripts/team bootstrap # new project: config + docs skeleton + worktrees + pulse window
81
+ bash {{SKILL_DIR}}/scripts/team pulse up # the pulse window runs the monitor and patrols
87
82
  ```
88
83
 
89
- ## Liveness and periodic patrol
90
-
91
- - The pulse is a **metronome that wakes the PM**, not a heartbeat: every 15 minutes by default
92
- (`TEAM_PULSE_INTERVAL=900`, 300-3600 recommended) it checks for work (unread notifications / reports awaiting
93
- verification / board todo·wip / blocked / agents with unfinished tasks that stopped). With work → wake the PM
94
- (nudge if running, start with `pi -c` if not). Without work → stay silent, start nothing.
95
- - Nothing to do, or a human is needed: `team standby on --reason "…"`. No further wake-ups; a human runs
96
- `team standby off`.
97
- - It does not manage tmux layout or agents: a missing session/window is only reported (a human runs `team up`, or
98
- set `TEAM_PULSE_REBUILD_TMUX=1`); starting/resuming agents is the PM's job (`team resume [--dry-run]`,
99
- or a human runs `team up --agents`).
100
- - The capacity floor is swap must not be exhausted (`team ps` shows headroom); tight RAM only means slowness.
101
- - Standing the team down completely: `team standby on` (temporary), or `team teardown --all` for teardown.
84
+ - The pulse is a **metronome that wakes the PM**: every 15 minutes by default it checks for work and wakes the PM only
85
+ when there is pending work. It never manages tmux layout, agents or quota — a stopped worker is pending work, not an
86
+ automatic resume. Nothing to do, or a human is needed: `team standby on --reason "…"`; only a human clears it.
87
+ - **Capacity floor**: neither RAM nor disk swap may bottom out — the dispatch contract judges `MemAvailable`,
88
+ RAM+swap, free disk swap (zram excluded), and the free bytes and inodes of the filesystem the worker writes to (the
89
+ resolved temp root and the worktree), refusing below `TEAM_MIN_AVAIL_MB` / `TEAM_MIN_TOTAL_MB` /
90
+ `TEAM_MIN_FREE_SWAP_MB` / `TEAM_TMP_MIN_FREE_MB` / `TEAM_TMP_MIN_FREE_INODES`, and refusing a temp root it cannot
91
+ use. Model quotas are a separate limit. `team ps` shows the headroom; thresholds and overrides:
92
+ `{{SKILL_DIR}}/references/config.md` §2.
93
+ - Mechanism and boundaries: `{{SKILL_DIR}}/references/protocol.md` §8; patrol steps:
94
+ `{{SKILL_DIR}}/references/workflows.md` §§D/§I.