@nidvue/teamwork 0.0.0-stage → 1.1.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 (70) hide show
  1. package/CHANGELOG.md +329 -0
  2. package/LICENSE +661 -0
  3. package/NOTICE +16 -0
  4. package/README.md +462 -2
  5. package/SECURITY.md +64 -0
  6. package/package.json +71 -4
  7. package/prompts/teamwork-pulse.md +12 -0
  8. package/prompts/teamwork-review.md +16 -0
  9. package/skills/teamwork/AGENTS.md +462 -0
  10. package/skills/teamwork/SKILL.md +795 -0
  11. package/skills/teamwork/references/Adapters.md +112 -0
  12. package/skills/teamwork/references/Audit.md +120 -0
  13. package/skills/teamwork/references/Concurrency.md +160 -0
  14. package/skills/teamwork/references/Dissent.md +85 -0
  15. package/skills/teamwork/references/Docs.md +74 -0
  16. package/skills/teamwork/references/Engineering.md +410 -0
  17. package/skills/teamwork/references/Evidence.md +140 -0
  18. package/skills/teamwork/references/Remotes.md +144 -0
  19. package/skills/teamwork/references/Roles.md +201 -0
  20. package/skills/teamwork/references/State.md +64 -0
  21. package/skills/teamwork/references/Testing.md +144 -0
  22. package/skills/teamwork/roles/architect.md +153 -0
  23. package/skills/teamwork/roles/ceo.md +218 -0
  24. package/skills/teamwork/roles/cfo.md +150 -0
  25. package/skills/teamwork/roles/coo.md +147 -0
  26. package/skills/teamwork/roles/cto.md +162 -0
  27. package/skills/teamwork/roles/data-engineer.md +120 -0
  28. package/skills/teamwork/roles/designer.md +349 -0
  29. package/skills/teamwork/roles/developer.md +166 -0
  30. package/skills/teamwork/roles/product-manager.md +151 -0
  31. package/skills/teamwork/roles/project-manager.md +159 -0
  32. package/skills/teamwork/roles/release-engineer.md +245 -0
  33. package/skills/teamwork/roles/reviewer.md +254 -0
  34. package/skills/teamwork/roles/security-auditor.md +157 -0
  35. package/skills/teamwork/roles/technical-writer.md +121 -0
  36. package/skills/teamwork/roles/tester.md +180 -0
  37. package/skills/teamwork/scripts/build_pi_package.py +200 -0
  38. package/skills/teamwork/scripts/privacy_scan.py +1185 -0
  39. package/skills/teamwork/scripts/sync_skill.py +108 -0
  40. package/skills/teamwork/scripts/teamwork.py +28 -0
  41. package/skills/teamwork/scripts/verify_release.py +502 -0
  42. package/skills/teamwork/src/teamwork/__init__.py +18 -0
  43. package/skills/teamwork/src/teamwork/__main__.py +10 -0
  44. package/skills/teamwork/src/teamwork/bundle.py +157 -0
  45. package/skills/teamwork/src/teamwork/cli.py +16 -0
  46. package/skills/teamwork/src/teamwork/config.py +396 -0
  47. package/skills/teamwork/src/teamwork/engine.py +10119 -0
  48. package/skills/teamwork/src/teamwork/gitutil.py +172 -0
  49. package/skills/teamwork/src/teamwork/imaging.py +124 -0
  50. package/skills/teamwork/src/teamwork/io.py +144 -0
  51. package/skills/teamwork/src/teamwork/layout.py +253 -0
  52. package/skills/teamwork/src/teamwork/names.py +191 -0
  53. package/skills/teamwork/src/teamwork/portable.py +79 -0
  54. package/skills/teamwork/src/teamwork/records.py +1220 -0
  55. package/skills/teamwork/src/teamwork/resources.py +120 -0
  56. package/skills/teamwork/src/teamwork/version.py +13 -0
  57. package/skills/teamwork/templates/AGENTS.md +460 -0
  58. package/skills/teamwork/templates/Docs/Architecture.md +40 -0
  59. package/skills/teamwork/templates/Docs/Archive.md +8 -0
  60. package/skills/teamwork/templates/Docs/Board.md +28 -0
  61. package/skills/teamwork/templates/Docs/Costs.md +30 -0
  62. package/skills/teamwork/templates/Docs/Decisions.md +26 -0
  63. package/skills/teamwork/templates/Docs/Design.md +106 -0
  64. package/skills/teamwork/templates/Docs/Plan.md +24 -0
  65. package/skills/teamwork/templates/Docs/Project.md +40 -0
  66. package/skills/teamwork/templates/Docs/Release.md +43 -0
  67. package/skills/teamwork/templates/Docs/Research.md +36 -0
  68. package/skills/teamwork/templates/Docs/Risks.md +18 -0
  69. package/skills/teamwork/templates/TeamMap.md +100 -0
  70. package/skills/teamwork-pi/SKILL.md +77 -0
@@ -0,0 +1,795 @@
1
+ ---
2
+ name: teamwork
3
+ description: "Nidvue Teamwork - run a user prompt to completion with an autonomous multi-agent company: CEO, CTO, COO, CFO, Architect, Product Manager, Project Manager, Designer, Release Engineer, Technical Writer, Data Engineer, Developer(s), Tester(s), Reviewer and Security Auditor. Use when the user invokes /teamwork, asks for a team of sub-agents with roles, wants an org chart of agents that plans, builds, tests and iterates until the goal is met, or wants long-running parallel work with per-agent memory. The user talks only to the CEO; every other agent communicates internally."
4
+ ---
5
+
6
+ # Nidvue Teamwork - `teamwork` skill
7
+
8
+ > **Nidvue Teamwork** is the product brand; `teamwork` is the command, package and
9
+ > workspace identifier. This is a **skill**, not a standalone application: the
10
+ > engine is a stdlib-only tool the skill calls, and every agent runs through the
11
+ > host's own LLM API with a model configured per agent (`references/Concurrency.md`).
12
+
13
+ Turn one prompt into a functioning, self-organising team that keeps working until
14
+ the goal is verified. The user talks **only to the CEO**. The CEO decomposes the
15
+ goal, spawns the roles, and keeps developer/tester/designer lanes running in
16
+ parallel. Nothing is ever declared done on an unverified claim.
17
+
18
+ ## Usage
19
+
20
+ ```
21
+ use the teamwork skill: <prompt> # any host: the skill is loaded by its description
22
+ /teamwork <prompt> # where the host maps skills to commands
23
+ /teamwork --team <Name> # use a specific per-team tree
24
+ ```
25
+
26
+ Anything else after the prompt is an instruction to the CEO in plain language
27
+ ("resume the existing team", "only staff developer and reviewer", "four
28
+ developers"): the CEO honours it when writing the roster and `Plan.md`. Only
29
+ `--project` and `--team` are CLI flags.
30
+
31
+ The prompt is the product brief. If it is genuinely ambiguous in a way that
32
+ changes what gets built, the CEO asks **one** consolidated round of questions and
33
+ then proceeds on recorded assumptions.
34
+
35
+ The skill is **agent-agnostic and remote-agnostic**: it runs on any agent host
36
+ that loads a skill directory, or that can run `teamwork.py` and read `AGENTS.md`,
37
+ and against GitHub, GitLab, Bitbucket, Gitea/Forgejo, Azure DevOps or a bare
38
+ server. The protocol is identical; only the six host operations and the integrity
39
+ settings are adapted (`references/Adapters.md`, `references/Remotes.md`).
40
+
41
+ ## Non-negotiable contract
42
+
43
+ 1. **One voice to the user.** Only the CEO reports, asks, and accepts. No other
44
+ agent ever contacts the user.
45
+ 2. **Run to completion.** Work ends only when every acceptance criterion is
46
+ verified by executed evidence. Blocked is not done; idle with executable work
47
+ left is a bug.
48
+ 3. **Evidence or `UNVERIFIED`.** No claim about code, tests, CI, or the world
49
+ without a path/command/revision/result. This is enforced: a task cannot be
50
+ marked `done` without recorded evidence.
51
+ 4. **Independent parallel lanes.** Freeze interfaces first, then developer, tester
52
+ and designer lanes run concurrently against the same contract. Agents do not
53
+ wait for each other.
54
+ 5. **Code, then tests, then docs.** Documentation never blocks code or tests.
55
+ 6. **Role-shared state, private workspace.** Memory and the task queue belong to
56
+ the ROLE and are shared by all its instances; only the charter copy, worklog,
57
+ inbox, artifacts, reports and scratch are private to an instance.
58
+ 7. **Red lines are absolute.** Unsafe, illegal, irreversible or fabrication
59
+ actions stop the lane and escalate to the CEO (see RED LINES).
60
+ 8. **Nothing unnecessary is kept.** No duplicate docs, no scratch, no build
61
+ output, no secrets in the repository.
62
+ 9. **Style is automated.** Every role uses the language's canonical formatter,
63
+ linter and type checker (Python: `ruff format` + `ruff check` + `mypy`); the
64
+ fixer runs before the commit and the checker gates the merge. No hand
65
+ formatting, no competing config, no rule weakened to pass. The per-language
66
+ toolchain is in `references/Engineering.md`.
67
+ 10. **Names are deliberate.** Team directories are PascalCase; file names follow
68
+ the ecosystem, and PascalCase/camelCase are allowed wherever it permits them
69
+ (docs `Architecture.md`, components `ButtonGroup.tsx`). Python modules stay
70
+ `lower_snake_case` because the name is the import path, and tool-mandated
71
+ files are never renamed.
72
+ 11. **History is minimal and modular.** Commit while you work, then rebase and
73
+ squash before the review: one coherent change-set per commit, `wip`/`fixup`
74
+ commits squashed, rebased onto the latest default branch, one commit per task
75
+ after the squash-merge. Never rebase or force-push a shared branch, or
76
+ anything already on the default branch.
77
+ 12. **Each agent's model is its own.** The skill ships no model and calls no LLM
78
+ API; the engine configures a model per role and per instance
79
+ (`teamwork.py model set|get|list`), so a strong model can drive the Reviewer
80
+ while a cheap one drives mechanical lanes. `teamwork.py model auto --apply`
81
+ reads the runtime environment (the agent host and the model it exposes) and
82
+ routes the strongest available model to the decision lanes and the economy one
83
+ to the mechanical lanes, so quality is maximised where it compounds and cost is
84
+ minimised where it does not. Model choice never changes the
85
+ protocol: the gates, the review and the ledger hold anyway.
86
+ The CEO sets the lanes in one step with `teamwork.py model auto --apply`, which
87
+ detects the running agent host where the environment identifies it and routes
88
+ the strongest available model to the decision lanes and the economy model to
89
+ the mechanical lanes - automatic cost-aware routing, never an invented model id.
90
+ 13. **Warnings are errors.** The toolchain fails on them by configuration, the
91
+ cause is fixed, and a third-party warning is suppressed narrowly with a
92
+ reason. CI annotations (a deprecated action, a cache notice, a runner banner)
93
+ count as warnings and are fixed, not ignored.
94
+
95
+ ## The org
96
+
97
+ | Role | Instance names | Charter |
98
+ |---|---|---|
99
+ | CEO | leader session (not spawned) | `roles/ceo.md` |
100
+ | CTO | `cto` | `roles/cto.md` |
101
+ | COO | `coo` | `roles/coo.md` |
102
+ | CFO | `cfo` | `roles/cfo.md` |
103
+ | Architect | `architect` | `roles/architect.md` |
104
+ | Product Manager | `product-manager` | `roles/product-manager.md` |
105
+ | Project Manager | `project-manager` | `roles/project-manager.md` |
106
+ | Designer | `designer-1..N` | `roles/designer.md` - also owns every visual asset, raster **and** vector (recorded in `Design.md`), and decides what is needed |
107
+ | Developer | `developer-1..N` | `roles/developer.md` |
108
+ | Tester | `tester-1..N` | `roles/tester.md` |
109
+ | Release Engineer | `release-engineer` | `roles/release-engineer.md` - also owns repository and CI integrity: branch protection, required checks, merge strategy and protected tags, on any git host |
110
+ | Technical Writer | `technical-writer` | `roles/technical-writer.md` |
111
+ | Data Engineer (conditional) | `data-engineer` | `roles/data-engineer.md` |
112
+ | Reviewer | `reviewer-1..N` (several may run **in parallel**) | `roles/reviewer.md` - deep independent second review of every deliverable from one shared queue; one claim per deliverable; only a Reviewer may pass/merge, and never the author |
113
+ | Security Auditor | `security-auditor` | `roles/security-auditor.md` |
114
+
115
+ ### Who reports to whom
116
+
117
+ ```text
118
+ CEO - user interface, arbitration, final acceptance
119
+ |- CTO - technology strategy, engineering standards, the build/release policy
120
+ | |- Architect, Developer-1..N, Tester-1..N, Release Engineer, Data Engineer
121
+ |- COO - process, risk, throughput
122
+ | |- Project Manager
123
+ |- Product Manager - research, requirements, acceptance criteria
124
+ | |- Designer, Technical Writer
125
+ |- CFO - cost, budget, unit economics
126
+ |- Reviewer-1..N - independent review, the only pass/merge right
127
+ `- Security Auditor - audits everyone, CTO included
128
+ ```
129
+
130
+ One parent per role, and the parent owns the standard the child is judged by.
131
+ **Escalate up your own line first** (`Architect` -> `CTO` -> `CEO`); go sideways
132
+ only for a fact or artifact a peer holds. Three roles stay directly under the CEO
133
+ because their job is to disagree with everyone else: the Reviewer merges the work
134
+ it reviews, so no reviewed lane can manage it; the Security Auditor audits the
135
+ CTO; the CFO holds the cap that binds the team. `ROLE_PARENT` in
136
+ `src/teamwork/config.py` is the single source of truth - `teamwork.py map` renders
137
+ the tree and `tests/unit/test_reporting_hierarchy.py` fails when a doc drifts.
138
+
139
+ ### Staff the smallest roster that still closes the gates
140
+
141
+ Start from a tier instead of listing fifteen roles. `init --roster slim` is the
142
+ default; `--agents` overrides it for a roster you name exactly.
143
+
144
+ | Tier | Instances | Startup read |
145
+ |---|---|---|
146
+ | `slim` (default) | 6 | 226 kB |
147
+ | `standard` | 9 | 336 kB |
148
+ | `full` | 16 | 586 kB |
149
+
150
+ Startup read = every instance's `AGENTS.md` plus its own role charter, summed -
151
+ the text a full roster pays for before any work starts, and 2.6x what `slim` costs.
152
+
153
+ A role earns a seat only if it owns a deliverable, a test layer and a decision
154
+ right no other role holds. Everything else is a **lane, not a role**: it costs no
155
+ charter, no queue and no memory set.
156
+
157
+ | Dropped from `slim` | Where the work goes |
158
+ |---|---|
159
+ | Product Manager | requirements and acceptance criteria ride with the CEO; `Research.md` becomes a task |
160
+ | Project Manager | `Plan.md`/`Board.md` ride with the CEO; `pulse` already does the chasing |
161
+ | CTO / COO | stack and risk are recorded in `Decisions.md`/`Risks.md` by whoever owns the change |
162
+ | CFO | `Costs.md` only when the work has a real cost dimension |
163
+ | Designer | `ui` layer unstaffed - add the role when the deliverable has a UI |
164
+ | Technical Writer | `docs` layer unstaffed - authors write their own docs, the Reviewer verifies |
165
+ | Data Engineer | `data` layer unstaffed - only a project owning persistent state needs it |
166
+ | Security Auditor | `security` layer unstaffed - add it when the brief has a compliance or threat surface |
167
+ | Release Engineer | the CEO pushes after review until shipping becomes a schedule of its own |
168
+
169
+ Two rules keep a slim roster honest, and both are enforced:
170
+
171
+ - `tests plan` only requires the layers of **staffed** roles, so a slim tier does
172
+ not print gaps for work nobody owns.
173
+ - In either tier the tribunal never falls below two members: with no CTO/CFO
174
+ staffed the Reviewer takes the neutral seat (`TRIBUNAL_MIN_SIGNERS`), and **a
175
+ party to a dispute can never rule it**.
176
+ - **A vacant manager escalates to the CEO.** With no CTO staffed, the engineering
177
+ lanes report straight to the CEO for the duration; dropping a manager never
178
+ leaves a lane with nobody to escalate to, and it never quietly hands that lane to
179
+ the Product Manager or the COO. An explicit `--agents` list is the one
180
+ exception: staff fewer than two independent roles and `dispute resolve` prints a
181
+ `1-member panel` warning, so the reduced panel is visible rather than silent.
182
+
183
+ `init` prints the folded lanes and warns when a gate-critical role is missing.
184
+ Scale writers with the critical path: add `developer-N`/`tester-N` before adding a
185
+ coordination role. **The Reviewer is not optional**, and two Reviewer lanes are the
186
+ minimum - one verifies, a different one merges.
187
+
188
+ ## Workspace layout
189
+
190
+ Two separate worlds: the team's own tree is **hidden** and local; project output
191
+ is committed. All team-created names are **PascalCase**.
192
+
193
+ ```text
194
+ <project>/
195
+ ├── AGENTS.md # team constitution (auto-loaded, managed block)
196
+ ├── .agents/skills/<Name>/SKILL.md # team skills extracted from repeated flows
197
+ ├── docs/Team/ # committed project output
198
+ │ ├── Project.md Plan.md Board.md Archive.md Decisions.md
199
+ │ ├── Architecture.md Research.md Design.md Risks.md Costs.md Release.md
200
+ │ └── AuditManifest.json AuditManifest.md # written by `ledger export`
201
+ ├── <code/> <tests/> # committed project output
202
+ └── .pi/Teamwork/Teams/<Team>/ # the team's own tree (hidden, gitignored)
203
+ ├── TeamMap.md # workspace map
204
+ ├── Settings.json # provider caps + pulse interval
205
+ ├── Criteria.md # acceptance criteria + verification evidence
206
+ ├── Tests.md TestPlan.md # layered test records + required layers
207
+ ├── Reviews.md # PRs and review verdicts
208
+ ├── Disputes.md # design/decision challenges
209
+ ├── Skills.md # team-skill registry
210
+ ├── Ledger.jsonl # append-only, hash-chained audit trail
211
+ ├── Global/ # CEO-owned shared memory (+ its .gitignore)
212
+ │ ├── GlobalMemory.md
213
+ │ └── GlobalMemoryArchive.md (created on the first eviction)
214
+ ├── Roles/<Role>/ # SHARED by every instance of the role
215
+ │ ├── ShortTermMemory.md LongTermMemory.md ArchivedMemory.md
216
+ │ ├── Role.md # charter copy
217
+ │ └── TaskQueue.md
218
+ ├── Agents/<Instance>/ # private to one instance
219
+ │ ├── StartHere.md WorkLog.md Inbox.md
220
+ │ └── Artifacts/ Reports/ Scratch/
221
+ └── Runtime/ # ephemeral
222
+ ├── LedgerHead.json # fast-path checkpoint for the chain
223
+ ├── Locks/ # per-file and per-role locks
224
+ ├── Worktrees/<Instance>/ # created by `branch start --worktree`
225
+ └── Slots/<Provider>/<Agent>.slot
226
+ ```
227
+
228
+ Each team gets its own `<Team>` tree, named after the project, or `--team Name` / `TEAMWORK_TEAM=Name`,
229
+ so several teams in one repository never collide.
230
+
231
+ **Memory and the task queue belong to the ROLE, not the instance.** `Developer-1`
232
+ and `Developer-2` read and write one `Roles/Developer/` memory and claim from one
233
+ `Roles/Developer/TaskQueue.md`. `Role.md` is per role; only `StartHere.md`, `WorkLog.md`, `Inbox.md`,
234
+ `Artifacts/`, `Reports/` and `Scratch/` are private to an instance.
235
+
236
+ ## Bootstrap procedure (CEO)
237
+
238
+ Run these in order. Use `SKILL` for this skill's directory.
239
+
240
+ ### 1. Intake
241
+
242
+ - Restate the prompt as objective + non-goals + constraints in
243
+ `docs/Team/Project.md`.
244
+ - Record every acceptance criterion as a machine-checkable record: `criteria add
245
+ --id AC-1 --text '<verifiable statement>' --owner <role>`. `loop` cannot report
246
+ STOP while a criterion is unverified, so this is what "done" actually means.
247
+ - Ask the user at most one consolidated question set for genuinely blocking
248
+ ambiguity; otherwise decide, record the assumption, and continue.
249
+ - Name the evidence for each criterion (command, test, artifact). An independent
250
+ role verifies it: `criteria verify AC-1 --by <other-role> --evidence '<cmd @rev -> result>'`.
251
+ - Declare required test layers per area:
252
+ `tests require --area <a> --layers unit,integration --by <instance> --reason <why>`
253
+ (Architect or CEO). The default is the proportionate core set
254
+ (`unit`, `integration`, `acceptance`) restricted to staffed roles. Each layer is
255
+ designed, built and run by its owner (see `references/Testing.md`).
256
+ - **Visual assets are the Designer's call.** The Designer decides what images,
257
+ icons, banners and diagrams a deliverable needs - unasked - then produces and
258
+ improves them. Everything the Designer touches is **user first**: layout,
259
+ typography, fonts and images are judged by the user's task, and the standing
260
+ criteria are simplicity, efficiency, usability and a great experience (real
261
+ text never text-as-image, >= 4.5:1 contrast, >= 16 px body, explicit font
262
+ fallback chain, no external font dependency in an SVG). Vector first
263
+ (SVG / diagram-as-code); for a raster, `imaging probe` picks the best available
264
+ text-to-image model (cloud first, else local, else SVG). The full process - one
265
+ prompt per asset, four-plus candidates off one seed base, a visual review of
266
+ every candidate, improvement rounds until it passes, integration and evidence -
267
+ plus the privacy and licence red lines live in `roles/designer.md`; the asset
268
+ record lives in `docs/Team/Design.md`. Never send private data to a cloud image
269
+ model, never ship an asset nobody reviewed, and never lower a criterion to make
270
+ an asset pass.
271
+
272
+ ### 2. Workspace, repository, constitution
273
+
274
+ ```sh
275
+ python3 "$SKILL/scripts/teamwork.py" init --roster slim # ceo, architect, developer,\
276
+ tester, reviewer-1, reviewer-2 - or --roster standard|full, or --agents for an exact list
277
+ python3 "$SKILL/scripts/teamwork.py" agents-md # write/patch <project>/AGENTS.md
278
+ python3 "$SKILL/scripts/teamwork.py" map # confirm layout + repo structure
279
+ ```
280
+
281
+ `init` creates the git repository if the project has none, writes a `.gitignore`
282
+ that keeps `.pi/`, secrets, caches and build output out of the repository, and
283
+ makes the initial commit. If no git identity is configured it warns instead of
284
+ inventing one - resolve that with the user before the first commit. Commit
285
+ `AGENTS.md` and the project documents as the first real commit, once a task
286
+ scaffold exists.
287
+
288
+ Then seed global memory with the facts every agent will otherwise re-ask:
289
+
290
+ ```sh
291
+ python3 "$SKILL/scripts/teamwork.py" global "Objective: <one line>" --key objective --importance 5 --pin
292
+ python3 "$SKILL/scripts/teamwork.py" global "Stack: <lang/framework>; build: <cmd>; test: <cmd>" --key build
293
+ python3 "$SKILL/scripts/teamwork.py" global "Repo layout: <src/ tests/ docs/>" --key layout
294
+ ```
295
+
296
+ ### 3. Plan and freeze interfaces (the parallelism gate)
297
+
298
+ Dispatch in parallel, before any implementation:
299
+
300
+ - **Product Manager** - `Research.md`: competitors, state of the art, popular
301
+ solutions, comparison table, gap analysis, recommendation (sources + dates).
302
+ - **Architect** - `Architecture.md` with **frozen interface contracts** plus test
303
+ seams; `Decisions.md` for irreversible choices.
304
+ - **CTO** - stack, build/test/release commands, feasibility, dependency review.
305
+ - **COO** - `Risks.md`, process, blockers, duplicate-work risks.
306
+ - **CFO** - `Costs.md` if the work has a real cost dimension.
307
+ - **Project Manager** - `Plan.md`: milestones -> dependency-ordered tasks with
308
+ role, priority, artifacts, evidence, and the parallel lanes.
309
+
310
+ (All of the above live in `docs/Team/`.)
311
+
312
+ Everything else waits only on the interface freeze, not on each other.
313
+
314
+ ### 4. Staff and dispatch
315
+
316
+ The host may offer a long-lived teammate tool or none at all; either way each lane is a bounded `subagent`-style run that
317
+ reads the role charter and the queue and takes its own work, so the fan-out is
318
+ one call per lane and the CEO stays free while they run:
319
+
320
+ ```text
321
+ <teammate tool>(agent: "architect", task: "<packet>", background: true)
322
+ <teammate tool>(agent: "developer", task: "<packet>", background: true)
323
+ <teammate tool>(agent: "tester", task: "<packet>", background: true)
324
+ ```
325
+
326
+ The concrete name per host - `subagent`, `Task`, a CLI job - is the adapter table
327
+ in `references/Adapters.md`; the packet and the queue are the same everywhere.
328
+
329
+ A dependent multi-step batch is one workflow call: the workflow owns the fan-out,
330
+ each child gets its own task text and the parent gets every child's output back
331
+ (`runs.all([...])` on hosts that offer workflows). Use worktree isolation only on
332
+ a clean tree; otherwise run the lanes in the shared checkout and require
333
+ `commit --paths` so no lane sweeps a peer's uncommitted work.
334
+
335
+ Each dispatched task packet must contain: task id, objective, the frozen
336
+ interface to build against, file/component boundary, acceptance evidence, the
337
+ artifact path, dependencies, and the stop/ask condition. Point every teammate at
338
+ its startup routine:
339
+
340
+ ```text
341
+ You are <name>. Read .pi/Teamwork/Teams/<Team>/Roles/<Role>/Role.md and
342
+ .pi/Teamwork/Teams/<Team>/Agents/<Instance>/StartHere.md, then run:
343
+ teamwork.py load <name>
344
+ teamwork.py task next <name>
345
+ Start that task immediately. Work only in your lane. Report evidence, then take
346
+ the next executable task yourself.
347
+ ```
348
+
349
+ For bounded one-shot work (a review, a research brief, a verification pass), use
350
+ `subagent` with a matching role agent instead of a long-lived teammate.
351
+
352
+ ### 5. Run the loop
353
+
354
+ One iteration is: re-plan -> dispatch -> work in parallel -> independent review ->
355
+ rework -> integrate. The loop repeats automatically until `teamwork.py loop`
356
+ reports STOP.
357
+
358
+ - Teammates auto-claim the highest-priority unblocked task; when one finishes it
359
+ submits for review and takes the next one.
360
+ - **Every deliverable is second-reviewed by the Reviewer**, independently: code,
361
+ unit tests, integration/E2E tests, docs, design specs, plans, research, cost
362
+ models and risk registers. A fail goes straight back to the owner with findings,
363
+ the owner fixes it, and it is re-reviewed. Review failures are counted: at
364
+ 3 the Reviewer must open a dispute so the tribunal rules (see
365
+ `references/Dissent.md`), and `loop` blocks STOP until it does.
366
+ - **Every agent tests its own layer, comprehensively and in parallel**: `goal`
367
+ CEO · `requirements` Product Manager · `plan` Project Manager · `tech` CTO ·
368
+ `release` Release Engineer · `data` Data Engineer · `process` COO · `cost` CFO ·
369
+ `system` Architect · `ui` Designer · `docs` Technical Writer · `unit` Developer ·
370
+ `integration` Tester · `acceptance` Reviewer · `security` Security Auditor. Each role designs, implements and executes its own tests and
371
+ evidences the run. `tests plan` shows the matrix, role coverage and gaps;
372
+ `loop` blocks STOP while a required layer is missing/failing or a role has
373
+ designed no tests at all.
374
+ - **Review is a parallel lane.** `reviewer-1..N` claim *different* deliverables
375
+ from the shared review queue at the same time (`review --queue`); one claim per
376
+ deliverable, high-risk work gets two Reviewers on purpose, nobody reviews their
377
+ own contribution, and findings union - a deliverable passes only when no open
378
+ finding remains on the revision. **A pass is the merge**: the lane that verified
379
+ the revision lands it and deletes the branch, so an approved deliverable never
380
+ waits in a second queue.
381
+ - The CEO keeps the interface contract stable, arbitrates conflicts, resolves
382
+ duplicate work, and updates global memory.
383
+ - The Project Manager chases stalled tasks and duplicates and refreshes
384
+ `Plan.md`/`Board.md`; the COO keeps `Risks.md` honest; the Product Manager
385
+ keeps `Research.md` current.
386
+ - The team is self-managing: the CEO resolves internal conflicts and disputes
387
+ (tribunal for escalations) without involving the user. The user is contacted
388
+ only for an authorization, a goal/scope/budget change, a blocking ambiguity,
389
+ or the final report.
390
+ - Periodically:
391
+
392
+ ```sh
393
+ python3 "$SKILL/scripts/teamwork.py" criteria list # are the goals actually met?
394
+ python3 "$SKILL/scripts/teamwork.py" tests plan # layered test coverage and gaps
395
+ python3 "$SKILL/scripts/teamwork.py" board
396
+ python3 "$SKILL/scripts/teamwork.py" review --queue # Reviewer's work list
397
+ python3 "$SKILL/scripts/teamwork.py" audit # fabricated completions, stale work, duplicates, link health
398
+ python3 "$SKILL/scripts/teamwork.py" links # markdown links, URLs, back-links
399
+ python3 "$SKILL/scripts/teamwork.py" pulse --commit # idle lanes -> assignment
400
+ python3 "$SKILL/scripts/teamwork.py" parallel # free slots vs ready work
401
+ python3 "$SKILL/scripts/teamwork.py" loop # may we stop yet?
402
+ python3 "$SKILL/scripts/teamwork.py" clean # remove temp files
403
+ ```
404
+
405
+ - Report to the user at milestones: what changed, evidence, blockers, next. Never
406
+ report progress that is not backed by evidence.
407
+
408
+ ### 5a. Parallelism is the default, not the reward
409
+
410
+ A team that runs one lane at a time is a slow single agent with extra records.
411
+ Four rules keep every lane busy without inventing work:
412
+
413
+ | Rule | Mechanism | Why |
414
+ |---|---|---|
415
+ | A lane holds more than one unit | `LANE_WIP` (2): one deliverable in review plus the next one in progress | a lane waiting for its own review is idle capacity |
416
+ | `pulse` fills capacity, not idle lanes | it computes `LANE_WIP - held` per lane and assigns that many | the old one-task-per-idle-lane rule capped the team at one task per lane per wake |
417
+ | A dependency can release early | `deps: role:T-id@review` (submitted) or `@started` (picked up) | the downstream lane needs a frozen interface, not a merged deliverable |
418
+ | Reviews are the exception | a Reviewer lane holds exactly one claim; run several Reviewer lanes | a deep review is not divisible, and the queue is the concurrency limit |
419
+
420
+ Capacity is bounded by the provider caps in `Settings.json`, never by the number
421
+ of lanes: `pulse` refuses to plan more assignments than there are free slots and
422
+ prints the shortfall, so the team fills 64 Ollama Cloud lanes or 2500 DeepSeek
423
+ lanes without over-subscribing either.
424
+
425
+ The anti-patterns this replaces, all measured on a real run: a lane that took one
426
+ task and then sat in review while nine lanes idled; a tester blocked for hours on
427
+ `developer:T-0003` when the interface file had been frozen in the first hour; a
428
+ pulse that handed the whole review backlog to one lane.
429
+
430
+ ### 5b. Keep the lanes full: the CEO pulse
431
+
432
+ After dispatching, the CEO **re-wakes on an interval**, looks for idle lanes, and
433
+ hands them runnable work immediately. This is not optional and not manual: arm a
434
+ recurring wake-up once, and act on every wake.
435
+
436
+ ```sh
437
+ python3 "$SKILL/scripts/teamwork.py" pulse --commit --interval 5
438
+ ```
439
+
440
+ `pulse` prints idle lanes, ready work per role, and a dispatch plan; `--commit`
441
+ applies the assignments (claiming the task and recording which instance owns it).
442
+ Review deliverables are fanned out **one per idle Reviewer lane** and `--commit`
443
+ pins each one with a review claim, so lanes never review the same deliverable and
444
+ never queue the whole backlog on the first lane. Exit code 3 means "nothing to
445
+ dispatch" - then check blocked tasks and disputes.
446
+
447
+ An instance counts as **busy** when it holds a provider slot, has a task in
448
+ `doing`/`selfcheck` claimed by it, or holds a live review claim. A claim is a
449
+ lease (`SlotTtlMinutes`, default **90** min): a lane that dies mid-review stops
450
+ holding the deliverable when the lease expires and another lane takes it over.
451
+ Everything else is idle and must be fed.
452
+
453
+ Arm the recurring wake-up with the host's durable scheduler (the teammate
454
+ package persists schedules per project):
455
+
456
+ ```text
457
+ <scheduler>(id: "teamwork-pulse", every: "5m", prompt: "<the pulse prompt below>")
458
+ ```
459
+
460
+ The scheduler is a host capability, not part of the protocol: whichever timer
461
+ the host offers - a scheduler tool, a cron entry or a background loop - runs the
462
+ same pulse prompt (`references/Adapters.md`).
463
+
464
+ The workflow body is the pulse prompt: run `pulse --commit`; message every
465
+ assigned lane to start now; give each idle lane its highest-priority unblocked
466
+ task; unblock what is stuck; aim a DIFFERENT Reviewer lane at each unclaimed
467
+ deliverable in `review --queue`; report one short line. Never stop the team while
468
+ `loop` says CONTINUE.
469
+
470
+ - Interval: `PulseMinutes` in `Settings.json`, default **5** minutes. Use a longer
471
+ interval for long-running lanes, a shorter one near the end of a milestone.
472
+ - The pulse must never be the only thing keeping the team alive: instances
473
+ self-serve with `task next` between pulses.
474
+ - Disarm it when the team closes: delete the schedule with the same host tool.
475
+ - If a wake reports idle lanes *and* ready work and nothing moves, that is a
476
+ process defect: fix the assignment path, do not let the lane sit.
477
+
478
+ ### 5c. Push in stages, and certify both signals
479
+
480
+ Two duties that keep the remote and the confidence level honest:
481
+
482
+ - **Release Engineer - push after review, stage by stage.** The Release Engineer is
483
+ the role that pushes commits to the shared remote, and only once the Reviewer
484
+ has passed that revision with no open finding. Push after each reviewed +
485
+ merged stage rather than batching everything to the end, so the remote never
486
+ drifts far from local `main`. **A stage ends with a push, not with a merge.** Locally, before the push: build, tests,
487
+ `privacy_scan.py --tree --history` and the link check must be green on exactly
488
+ that revision. After the push, watch CI and confirm it is green **on that SHA**.
489
+ A red run is routed to its owner from the log (code -> Developer, test ->
490
+ Tester, contract -> Architect, workflow/packaging/flake -> Release Engineer,
491
+ scope -> CEO) and re-run after the fix. **A GitHub (or GitLab / Azure)
492
+ code-scanning alert is part of the same gate**: `teamwork code-scanning` reads
493
+ the open alerts, an `error`/`critical`/`high` one is a red release signal on the
494
+ shipped revision, and `--commit` files a `P0` task with the role that owns the
495
+ file. It exits `1` while a blocking alert is open (filing the fix does not
496
+ close the gate), and `2` with `unreadable: ...` when the security tab could not
497
+ be read at all - an unread scanner is `UNVERIFIED`, never a green zero.
498
+ Dismissing an alert is a Security Auditor triage with a recorded reason, never
499
+ a way to silence the gate. Force-push and published-history rewrites need the
500
+ CEO's explicit authorization; tags and public releases are the CEO's step,
501
+ prepared and verified by the Release Engineer.
502
+ - **Tester - certify local *and* CI.** The Tester runs the layers locally and then
503
+ confirms the same result in CI on the pushed revision, job by job across the OS
504
+ and Python matrix. A green local run with a red CI run is a failure, and so is
505
+ the reverse. Any failure - local or CI - is filed to the owning agent with the
506
+ exact command, expected vs actual, log excerpt, SHA and run id, and nobody
507
+ reports a suite as passing while the matching CI run is red.
508
+ - **CI triggers are path-filtered: code in, prose and media out.** Documentation,
509
+ images and other non-code edits must not run the code matrix; they get a cheap
510
+ docs workflow instead (link health, privacy scan, `mkdocs build --strict`).
511
+ Anything that ships - `src/`, `scripts/`, `tests/`, packaging, workflows,
512
+ `roles/`, `references/`, `templates/` - always runs the full matrix. Never
513
+ ignore a path that ships, and keep the two path lists in sync.
514
+
515
+ - **Everyone keeps the tree clean.** No comment the code already gives you, no
516
+ commented-out code, no `TODO`/`FIXME` without a tracked task id; delete temp and
517
+ stale files in the same task (`teamwork.py clean` plus the rest by hand); keep
518
+ one canonical home per file and an obvious structure, and leave the working tree
519
+ cleaner than you found it. A reviewer who cannot tell deliverable from debris
520
+ fails the task.
521
+
522
+ Both duties are evidence, not ceremony: `tests plan` and the task record must name
523
+ the local result **and** the CI run (id + conclusion) for the certified revision.
524
+
525
+ ### 5d. Any agent host, any git host
526
+
527
+ - **Agent host.** The engine, the workspace format, the criteria records, the
528
+ two-stage gate, the ledger and the test matrix are host-independent. Only six
529
+ operations need a host mechanism - spawn a teammate, delegate one-shot work,
530
+ message an agent, inspect state, re-wake on a schedule, close the team. Name the
531
+ operation, then use the adapter in `references/Adapters.md` (a teammate tool, a
532
+ host CLI in a `bash` job, or the files themselves). Never hard-code a host tool
533
+ in a normative step, and never fake a tool the host lacks: record the degraded
534
+ mode.
535
+ The protocol must still complete with no scheduler and no teammate tool at all -
536
+ one agent wearing the hats sequentially, with the same gates.
537
+ - **Git host.** The Release Engineer guarantees repository and CI integrity on
538
+ whatever host is in use: protected default branch, **no force-push**, no
539
+ deletion, required status checks on the exact revision, at least one non-author
540
+ approval, squash-only merges with the source branch deleted, protected `v*`
541
+ tags created only by the CEO, and least-privilege CI with no secret in the tree.
542
+ Policy and the per-host mapping are in `references/Remotes.md`. Record the actual
543
+ settings from the host API as evidence and re-read them to detect drift; an
544
+ unprotected setting is a defect on par with a red build.
545
+
546
+ ### 5e. Keep the installed skill on the remote's `main`
547
+
548
+ The repository root *is* the skill, but the host loads a **copy** from its skills
549
+ directory. Updating one without the other means the agent keeps reading an old
550
+ `SKILL.md` - measured on a real machine as a stale `SKILL.md` plus eight engine
551
+ modules that were simply absent from the copy.
552
+
553
+ One command does both halves, and it is a startup and post-push step, not a
554
+ manual chore:
555
+
556
+ ```sh
557
+ python3 "$SKILL/scripts/teamwork.py" refresh # fetch origin/main, then mirror into the skills dir
558
+ python3 "$SKILL/scripts/teamwork.py" refresh --check # drift only: writes nothing, exit 1 when stale
559
+ python3 "$SKILL/scripts/teamwork.py" refresh --dry-run # the file plan, no writes
560
+ ```
561
+
562
+ - It fast-forwards a checkout source from `--remote/--branch` (default
563
+ `origin/main`), then mirrors the bundle into `--dest` (default the host's
564
+ skills directory). Files the source dropped are deleted so a renamed module
565
+ cannot shadow the new one; files outside the bundle trees are never touched.
566
+ - **A dirty checkout is mirrored, never reset**: the operator's uncommitted work
567
+ is theirs, and the command says "fast-forward skipped".
568
+ - With no checkout in use it keeps a tool-managed mirror at
569
+ `~/.pi/.teamwork-source`, created once with `--mirror --repo <url>`.
570
+ - After a refresh the host must **reload** the skill (restart the session or
571
+ re-scan). The command prints that reminder whenever it wrote something.
572
+ - Releasing the skill's own work ends with this: the Release Engineer pushes the
573
+ reviewed revision, then runs `refresh --check` so the machine that ships the
574
+ protocol also runs it. A failing `--check` is a defect on par with a red gate.
575
+
576
+ ### 6. Close
577
+
578
+ Completion gate - all of:
579
+
580
+ - [ ] Every acceptance criterion in `docs/Team/Project.md` has evidence from a
581
+ revision.
582
+ - [ ] Every deliverable passed its own self-check and an independent Reviewer
583
+ verdict with reproducible evidence (code, tests, docs, design, plans,
584
+ research), and appears in `docs/Team/Archive.md`.
585
+ - [ ] Every required test layer for every area passes, each run by its owning
586
+ role (`tests plan` reports no gaps).
587
+ - [ ] No open high-severity security finding; no unresolved red-line escalation.
588
+ - [ ] Every task branch has been reviewed and merged into `main` by the
589
+ Reviewer, and the merged branch is deleted; no work remains only on a branch.
590
+ - [ ] Every staffed role has designed, implemented and run its own test layer,
591
+ and every area's required layers pass (`tests plan` reports no gaps).
592
+ - [ ] `ledger verify` reports an intact chain, `audit` reports no provenance gaps,
593
+ and the final `ledger export` manifest is committed with the milestone.
594
+ - [ ] `teamwork.py loop` reports STOP and `teamwork.py audit` reports zero
595
+ problems.
596
+ - [ ] Docs match merged code; no scratch or temp files left; nothing unnecessary
597
+ committed.
598
+ - [ ] Final user report: deliverable, how to run it, evidence table, known
599
+ limitations, follow-ups.
600
+
601
+ Then stop the team: end every live lane with the host's stop action, confirm
602
+ `loop` still reports STOP on the final head, and deliver the report.
603
+
604
+ ## Reference files (read on demand)
605
+
606
+ `SKILL.md` is the operating procedure. The policy detail lives in `references/`;
607
+ read the one you need instead of the whole skill.
608
+
609
+ | File | Read it for |
610
+ |---|---|
611
+ | `references/Evidence.md` | evidence shape, claim discipline, red lines, what to escalate |
612
+ | `references/Dissent.md` | independent decisions, challenging a design, the 3-round cap, the CEO+CTO+CFO tribunal |
613
+ | `references/State.md` | role-shared memory (short/long/global) and the priority task queue |
614
+ | `references/Concurrency.md` | provider caps, slot leases, parallelism plan, reuse |
615
+ | `references/Docs.md` | markdown structure, concision rules, bidirectional links |
616
+ | `references/Engineering.md` | commit identity, commit style, Git LFS, branch/PR/merge, worktrees, build economy |
617
+ | `references/Roles.md` | the full roster, handoffs, decision rights and boundaries |
618
+ | `references/Testing.md` | the 15 role-owned test layers, how each is designed/run, dedupe and required coverage |
619
+ | `references/Audit.md` | what is recorded, provenance, the hash-chained ledger, internal and external audit |
620
+ | `references/Adapters.md` | running the team on any agent host: the six operations, the optional per-host mapping, installation and degraded modes |
621
+ | `references/Remotes.md` | repository and CI integrity on any git host: branch protection, required checks, merge strategy, protected tags, least privilege, and the GitHub / GitLab / Bitbucket / Gitea / Azure mapping |
622
+
623
+ Team skills: when a flow is repetitive, widely reused and must stay consistent,
624
+ the owning role extracts it into `<project>/.agents/skills/<name>/SKILL.md` and
625
+ shares it with its peers (`skill create`, `skill share`, `skill candidates`). The
626
+ file is project output: it goes through the normal branch, commit, PR and review.
627
+
628
+ Recording and audit: every mutation appends to the hash-chained `Ledger.jsonl`
629
+ (`ledger verify`, `ledger show`, `trace <id>`), and `ledger export` writes
630
+ `docs/Team/AuditManifest.json` for verification by anyone. A broken chain blocks STOP.
631
+
632
+ Stop condition: acceptance criteria are records, not checkboxes -
633
+ `criteria add|verify|list`, `loop`. Reclaim stuck work with
634
+ `task reclaim <role> <T-id> --as <Instance> --reason "..."`.
635
+
636
+ ## Two-stage quality gate
637
+
638
+ Every deliverable passes **two** gates, in this order, before it counts as done:
639
+
640
+ 1. **Self-check (the author).** After finishing the work, the owner reviews their
641
+ own diff and *runs* a self-test, then records the result. This is mandatory -
642
+ you cannot submit work you have not checked yourself.
643
+ 2. **Independent review (the Reviewer).** The Reviewer verifies the submitted
644
+ result from scratch and either passes it (task becomes `done`, result is
645
+ archived) or fails it (task returns to the owner with findings).
646
+
647
+ Task lifecycle for a deliverable:
648
+
649
+ ```text
650
+ todo -> doing -> selfcheck -> review -> done (merged into main by the Reviewer)
651
+ | ^ |
652
+ branch start | v (fail)
653
+ +-------- doing
654
+ ```
655
+
656
+ ```sh
657
+ # 1) owner finishes the work and starts their own check
658
+ teamwork.py task set developer-1 T-0007 --status selfcheck
659
+ # 2a) self-check found a problem -> back to doing
660
+ teamwork.py selfcheck developer-1 T-0007 --by developer-1 --result fail \
661
+ --note "off-by-one at the empty-input boundary" \
662
+ --test "go test -run TestBoundary @abc123 -> FAIL"
663
+ # 2b) self-check passed -> records the check AND submits for review
664
+ teamwork.py selfcheck developer-1 T-0007 --by developer-1 \
665
+ --note "re-read the diff: boundary, error paths, docs updated" \
666
+ --test "go test ./internal/x @def456 -> ok 12 tests"
667
+ # 3) a Reviewer lane takes the deliverable off the shared queue, then verdicts it
668
+ teamwork.py review --queue # who holds what, what is free
669
+ teamwork.py review developer T-0007 --claim --by reviewer-1 # pins it to that lane (90 min lease)
670
+ # 3a) Reviewer-1 fails it -> task returns to the owner as `doing`, findings recorded
671
+ teamwork.py review developer T-0007 --by reviewer-1 --result fail \
672
+ --findings "missing empty-input test; go test -run TestEmpty -> FAIL @abc123"
673
+ # 3b) Reviewer-1 passes it -> task becomes `done` and is archived
674
+ teamwork.py review developer T-0007 --by reviewer-1 --result pass \
675
+ --evidence "go test ./... @def456 -> ok 42 tests"
676
+ # 3c) a lane that cannot finish hands it back so another lane can take it
677
+ teamwork.py review developer T-0007 --release --by reviewer-1
678
+ ```
679
+
680
+ Mechanical enforcement:
681
+
682
+ - `task set --status review` is refused until `self_check: passed`; a passing
683
+ self-check requires a `--test` line - reading your own diff is not a test.
684
+ - evidence is a packet: `--baseline`, `--artifact` (hashed into the ledger) and
685
+ `--replay` travel with the claim, on self-check and review as well as `tests run`.
686
+ - a `--bug` task cannot pass its self-check without a `tests repro <T-id>` record
687
+ on that task showing the failing run before the passing one (`--force` with a
688
+ reason if the defect genuinely cannot be reproduced).
689
+ - only the owner may self-check their own task (`--by <owner>`), and only the
690
+ Reviewer may review it; an author can never close a `review=required` task.
691
+ - a review claim belongs to one lane: another Reviewer is refused while the lease
692
+ is live (`review <role> <T-id> --claim --by <lane>`), only the holder releases
693
+ it (`--release`, or `--force <reason>` when the holder is dead), a verdict clears
694
+ it, and an expired lease is open for take-over. With several lanes `--by reviewer`
695
+ is ambiguous - name the instance (`reviewer-1`).
696
+ - a `review --result pass` appends the accepted result to
697
+ `docs/Team/Archive.md` (what, who, verified how, which revision) - the team's
698
+ evidence ledger. Read it with `teamwork.py archive [--agent X]`.
699
+ - a re-submitted fix is reviewed from scratch; there is no round limit, but at
700
+ fail, fix, re-check, re-submit, re-review until it passes.
701
+ - if a finding turns into a design disagreement, use the dispute protocol.
702
+
703
+ This applies to code, unit tests, integration/E2E tests, documentation, design
704
+ specifications, plans, research briefs, architecture contracts, cost models and
705
+ risk registers.
706
+
707
+ ## Self-management charter
708
+
709
+ The team manages and corrects itself. The user is not part of the loop.
710
+
711
+ - The CEO resolves priority and scope conflicts, design disagreements, blocked
712
+ tasks and duplicate work internally, records the decision, and moves on.
713
+ - Escalations go to the tribunal (CEO + CTO + CFO) after 3 rounds of dispute,
714
+ never to the user mid-flight.
715
+ - The user is contacted **only** for: authorization of an irreversible/external
716
+ or red-line action; a change to the goal, budget or non-negotiable constraints;
717
+ a genuine ambiguity that changes what gets built and cannot be resolved from
718
+ the repository, research or a recorded assumption; and the final report.
719
+ - Every other decision is made, recorded in `Decisions.md` / global memory, and
720
+ implemented.
721
+
722
+ ## Stop condition
723
+
724
+ `teamwork.py loop` is the mechanical stop check. It reports CONTINUE with reasons
725
+ while any of these hold, and STOP only when none do:
726
+
727
+ - an acceptance criterion record is missing, pending or unverified (`criteria`);
728
+ - a required test layer for an area is missing or not passing, or a staffed role
729
+ has designed no test at all (`tests plan`);
730
+ - any task is `todo`, `doing`, `selfcheck`, `blocked` or `review`;
731
+ - any `review=required` deliverable is not `review_status: passed`;
732
+ - any task branch is not merged into `main`, or a merged branch still exists;
733
+ - a gate override is in force, or a memory entry has no `by` provenance;
734
+ - any dispute is unresolved (an escalated one needs its tribunal);
735
+ - the audit trail is missing, altered or truncated (`ledger verify`).
736
+
737
+ The human checkboxes in `Project.md`/`Plan.md` are advisory; the machine records
738
+ above are what actually gate completion. Run `audit` as well before reporting:
739
+ it covers the same ground plus links, LFS, duplicates and ownership sanity.
740
+
741
+ ## Quick reference
742
+
743
+ ```sh
744
+ S=<this skill dir>/scripts/teamwork.py
745
+
746
+ # bootstrap from a tier (slim is the default; two Reviewers always)
747
+ python3 $S init --roster slim
748
+ python3 $S init --agents ceo,architect,developer-1,developer-2,tester-1,reviewer-1,reviewer-2
749
+ python3 $S agents-md && python3 $S repo && python3 $S map
750
+
751
+ # plan and shared state
752
+ python3 $S criteria add --id AC-1 --text "<verifiable statement>" --owner developer --by ceo
753
+ python3 $S tests require --area auth --layers unit,integration,acceptance --by ceo --reason "core"
754
+ python3 $S tests add --layer unit --area auth --command "go test ./internal/auth"
755
+ python3 $S tests run TS-0001 --by developer-1 --result pass --evidence "<cmd> @<rev> -> <result>" \
756
+ --baseline "<state before>" --artifact <path> --replay "<cmd>"
757
+ python3 $S tests repro T-0007 --by developer-1 --pre-rev <rev> \
758
+ --pre-evidence "<cmd> @<rev> -> 3 failed" --post-rev <rev> \
759
+ --post-evidence "<cmd> @<rev> -> 12 passed"
760
+ python3 $S global "<shared fact>" --key k --importance 4
761
+ python3 $S remember developer-1 "<fact>" --key k --importance 4 --by developer-1 --src T-0007 --rev <sha>
762
+ python3 $S task add developer "<task>" --priority P0 --deps architect:T-0002
763
+
764
+ # work: own branch -> commit -> self-check -> PR -> review -> Reviewer merge
765
+ python3 $S task next developer-1
766
+ python3 $S branch start --agent developer-1 --task T-0007 [--worktree]
767
+ python3 $S commit --role developer --type feat --task T-0007 --area auth \
768
+ --goal "..." --deliverable "..." --why "..." --status "..." --result "<cmd> @<rev> -> result" --all
769
+ python3 $S selfcheck developer T-0007 --by developer-1 --note "<what you re-read>" \
770
+ --test "<cmd> @<rev> -> <result>"
771
+ python3 $S pr open --agent developer-1 --task T-0007
772
+ python3 $S review developer T-0007 --by reviewer-1 --result pass --evidence "<verify cmd @<rev> -> result>"
773
+ python3 $S pr merge --pr P-0001 --by reviewer-1 # only if a pass was landed --no-merge
774
+
775
+ # reuse: extract a repeated flow and share it with same-role peers
776
+ python3 $S skill candidates
777
+ python3 $S skill create --name <kebab-name> --role developer --by developer-1 --for "<when to use>"
778
+ python3 $S skill share <kebab-name> --by developer-1
779
+
780
+ # keep the lanes full and the trail honest
781
+ python3 $S board && python3 $S pulse --commit && python3 $S parallel
782
+ python3 $S ledger show --tail 20 && python3 $S ledger verify && python3 $S ledger export
783
+ python3 $S trace T-0007
784
+ python3 $S task reclaim developer T-0007 --as Developer-2 --reason "owner went silent"
785
+ python3 $S tests plan && python3 $S audit && python3 $S links && python3 $S loop
786
+ python3 $S dispute open --by developer-1 --against architect --topic "..." --evidence "..."
787
+ python3 $S slot acquire --agent developer-3 --provider deepseek --task T-0012
788
+ python3 $S slot renew --agent developer-3 && python3 $S slot release --agent developer-3
789
+ python3 $S clean
790
+ ```
791
+
792
+ Team lifecycle: the teammate tool to staff a lane, the host's reply/steer
793
+ channel to coordinate, its status view to inspect, its scheduler for the pulse
794
+ and its stop action to close a lane. The exact names per host are in
795
+ `references/Adapters.md`.