@nidvue/teamwork 0.0.0-stage → 1.1.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 (70) hide show
  1. package/CHANGELOG.md +343 -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,144 @@
1
+ # Remotes - repository and CI integrity on any git host
2
+
3
+ Owner: Release Engineer. The skill is remote-agnostic: the *policy* below is the
4
+ contract, and the host table says how to configure it on GitHub, GitLab,
5
+ Bitbucket, Gitea/Forgejo, Azure DevOps or a bare server. Configuration is not
6
+ optional decoration - unprotected integrity is the failure this file exists to
7
+ prevent.
8
+
9
+ ## The integrity policy (host-neutral)
10
+
11
+ 1. **The default branch is protected.**
12
+ - no direct commits: every change arrives through a reviewable request;
13
+ - no force-push and no history rewrite: an already-published commit is
14
+ immutable (the single exception is a privacy purge, which is a CEO red line
15
+ and is recorded);
16
+ - no deletion of the branch or of a tag;
17
+ - linear history: no merge commits on the default branch.
18
+ 2. **Required status checks.** A merge is impossible while any required check is
19
+ red, on the exact merged revision:
20
+ - the test matrix (every supported OS x Python), lint, build + release
21
+ verification, the privacy scan, and the strict docs build;
22
+ - the checks are *required*, not advisory: "the release engineer saw it pass
23
+ locally" is not a check;
24
+ - require the branch to be up to date with the default branch before merge
25
+ (strict mode), so a green run cannot be stale;
26
+ - **a required check must always be reported.** A workflow skipped by a path
27
+ filter produces no check run at all, so a documentation-only pull request
28
+ would wait forever for a check that can never appear. Path filters belong on
29
+ `push` (a cost optimisation); on `pull_request` the required workflows run
30
+ unconditionally. This is the most common way branch protection deadlocks a
31
+ repository.
32
+ 3. **Required review.** At least one approval from a role that is not the author
33
+ - in this team, the **Reviewer**. Self-approval is impossible; a new commit on
34
+ the request dismisses the stale approval; the Reviewer - never the author -
35
+ performs the merge.
36
+ 4. **Merge strategy - one canonical shape.**
37
+ - feature work: **squash** into one commit on the default branch, so history
38
+ reads as one coherent change-set per task;
39
+ - delete the source branch on merge;
40
+ - releases: a tag on a commit that is already green on the default branch; never
41
+ tag an unmerged branch, never move a published tag;
42
+ - no `merge commit` and no `rebase merge` as a default, because they hide the
43
+ squash boundary.
44
+ 5. **Ref and secret hygiene.**
45
+ - protected tag pattern `v*`, created only by the CEO;
46
+ - CI least privilege: workflow default `contents: read`, each job widening only
47
+ what it needs; attestation/OIDC only where used;
48
+ - no secret in the tree, in a workflow log or in a prompt - the privacy scan is
49
+ the gate, and the host secret store is the only place a value lives;
50
+ - third-party actions/images pinned to a version (SHA pinning is the follow-up
51
+ for anything with write permission).
52
+ 6. **Verification is evidence, not assumption.** The Release Engineer records the
53
+ protection rules, the required checks and the merge settings, and periodically
54
+ re-reads them from the host API to detect drift. A protection change is a
55
+ governance event: recorded in `Decisions.md` with who changed it and why.
56
+
57
+ ## Single-owner repositories (the honest caveat)
58
+
59
+ `required_approving_review_count = 1` cannot be satisfied by the author, and a host
60
+ will not let you approve your own request. On a repository with one account that
61
+ means either:
62
+
63
+ - add a second collaborator (or a second account/bot with review rights) so a real
64
+ approval can happen - the preferred answer; or
65
+ - keep `enforce_admins = false` so the owner can bypass the approval for their own
66
+ authorized work - and then **every bypass is a recorded governance event**: who,
67
+ when, which revision, and why the internal Reviewer verdict stands in for the
68
+ host approval.
69
+
70
+ Do not set the approval count to zero to make life easier: that silently deletes
71
+ the review gate for everyone else too. State which of the two applies in
72
+ `Release.md`, and re-read it during the drift check.
73
+
74
+ ## Host mapping
75
+
76
+ | Policy | GitHub | GitLab | Bitbucket Cloud | Gitea / Forgejo | Azure DevOps |
77
+ |---|---|---|---|---|---|
78
+ | protect default branch | branch protection / Rulesets (`PATCH .../branches/main/protection`) | protected branches | branch restrictions | branch protection | branch policies |
79
+ | no force-push / delete | `allow_force_pushes=false`, `allow_deletions=false` | "Allowed to force push" off | "Prevent rewriting history" | "Enable force push" off | "Require a merge strategy" + locks |
80
+ | required checks | `required_status_checks` (strict) | "Pipelines must succeed" | merge checks | "Require status checks" | build validation policy |
81
+ | required review | `required_pull_request_reviews` | merge request approvals | default reviewers | "Require approvals" | "Require a minimum number of reviewers" |
82
+ | dismiss stale approval | `dismiss_stale_reviews=true` | "Reset approvals on push" | merge check | "Dismiss stale approvals" | "Reset votes on new pushes" |
83
+ | squash-only, delete branch | repo `allow_squash_merge=true`, `allow_merge_commit=false`, `allow_rebase_merge=false`, `delete_branch_on_merge=true` | project merge method `ff`/squash + "Delete source branch" | merge strategy setting | "Squash merge only" | "Squash merge" + delete source branch |
84
+ | protected tags | tag protection rules / Rulesets | protected tags | (use branch restrictions on the release branch) | protected tags | tag policies via a pipeline gate |
85
+ | least-privilege CI | workflow `permissions:` | job `rules` + protected variables | pipelines `deployment` permissions | Actions permissions | pipeline permissions + variable groups |
86
+ | code scanning as a gate | `code-scanning/alerts?state=open` (`--commit` routes the fixes) | SAST report in the MR / `vulnerabilities` API | Pipeline security report | integrated scanners (`gosec` via Actions) | Advanced Security alerts |
87
+ | bare git server | `update` hook / `pre-receive` + `receive.denyNonFastForwards` | - | - | - | - |
88
+
89
+ ## Minimum viable protection (what must be on)
90
+
91
+ | Setting | Value | Why |
92
+ |---|---|---|
93
+ | direct push to default branch | denied (admin bypass allowed only for an authorized purge) | review cannot be skipped |
94
+ | force-push | denied | published history is immutable |
95
+ | branch deletion | denied | the default branch cannot disappear |
96
+ | required checks | the CI matrix + privacy + docs, strict | nothing red merges |
97
+ | required approvals | >= 1, non-author, stale-dismissing | the two-stage gate is real |
98
+ | merge method | squash only | one change-set per task |
99
+ | delete branch on merge | on | no branch debt |
100
+ | tag protection | `v*`, CEO only | a release is deliberate |
101
+
102
+ ## Evidence shape
103
+
104
+ ```
105
+ gh api repos/<owner>/<repo>/branches/main/protection @<rev> -> required_checks=[CI, privacy, docs],
106
+ enforce_admins=false, allow_force_pushes=false, allow_deletions=false, required_approvals=1,
107
+ dismiss_stale_reviews=true
108
+ gh api repos/<owner>/<repo> --jq '.allow_squash_merge,.allow_merge_commit,.allow_rebase_merge,.delete_branch_on_merge'
109
+ @<rev> -> true false false true
110
+ gh run list --workflow CI --commit <sha> @<rev> -> success (all matrix jobs)
111
+ teamwork.py code-scanning @<rev> -> 0 open alerts (or: N blocking -> P0 tasks filed to the file owners)
112
+ ```
113
+
114
+ ## Code scanning is part of the release signal
115
+
116
+ On a forge that scans code (GitHub code scanning, GitLab SAST, Azure Advanced
117
+ Security), an open `error`/`critical`/`high` alert on the default branch is a
118
+ known defect **in the shipped revision**: the code is already public, so the
119
+ alert is a release blocker, not a backlog item. Two measured examples on this
120
+ repository's own remote, both `py/clear-text-logging-sensitive-data` on
121
+ `scripts/privacy_scan.py`, both `error`, both on `main` with no task and no owner.
122
+
123
+ The Release Engineer owns the gate:
124
+
125
+ ```sh
126
+ teamwork.py code-scanning # plan: alert -> owning role, exit 1 while blocking
127
+ teamwork.py code-scanning --commit # file one P0 task per (owner, rule, file)
128
+ ```
129
+
130
+ Routing follows file ownership (`SCAN_ROUTE` in `src/teamwork/config.py`); the
131
+ Security Auditor owns `scripts/privacy_scan.py` and the triage of a genuine
132
+ false positive, the Developer owns `src/**` and `tests/**`, the Release Engineer
133
+ owns `.github/**` and unfiled alerts. Dismissing an alert is a recorded
134
+ triage, never a way to quiet the gate. Re-read after the fix lands and record
135
+ the alert numbers and the `gh api` command as evidence, exactly like a CI run id.
136
+
137
+ ## Drift check
138
+
139
+ Re-read the settings and compare with the table above; a missing or weakened
140
+ setting is a defect of the same severity as a red build, routed to the Release
141
+ Engineer and closed only with the API output as evidence. If the host cannot
142
+ express a rule, say so and record the compensating control (for example: a bare
143
+ server with a `pre-receive` hook, or a release checklist item that a human
144
+ verifies) - never leave it silently unprotected.
@@ -0,0 +1,201 @@
1
+ # Roles, handoffs and decision rights
2
+
3
+ Reference for the /teamwork skill. Loaded on demand.
4
+
5
+ Related: [Engineering](Engineering.md) | [Evidence](Evidence.md) | [Docs](Docs.md) | [State](State.md) | [Concurrency](Concurrency.md) | [Testing](Testing.md) | [Audit](Audit.md)
6
+
7
+ ## Roster
8
+
9
+ | Role | Instances | Owns | Reports to |
10
+ |---|---|---|---|
11
+ | CEO | leader session, never spawned | user interface, decomposition, assignment, arbitration, global memory, final report | user |
12
+ | CTO | `cto` | technology strategy, feasibility, stack, engineering standards, the build/release *policy*, and the engineering lanes | CEO |
13
+ | COO | `coo` | process, tooling, dependencies, risk register, planning and throughput | CEO |
14
+ | CFO | `cfo` | cost model, budget, unit economics, build-vs-buy, ROI | CEO |
15
+ | Product Manager | `product-manager` | competitor/state-of-the-art research, stories, requirements, acceptance criteria, traceability, and the product/documentation lanes | CEO |
16
+ | Reviewer | `reviewer` or `reviewer-1..N` | independent second review of **every** deliverable; **the only role that passes review and merges into `main`** | CEO |
17
+ | Security Auditor | `security-auditor` | security assessment, red lines, remediation verification; audits the whole team, CTO included | CEO |
18
+ | Architect | `architect` | system/module/API/data/deployment architecture, **frozen interfaces**, ADRs | CTO |
19
+ | Developer | `developer-1..N` | production code, **its own unit tests**, inline docs, commits on its branch | CTO |
20
+ | Tester | `tester-1..N` | integration/system/E2E tests, running and monitoring them, defect routing, regression | CTO |
21
+ | Release Engineer | `release-engineer` | build/release pipeline, CI gates, packaging, rollback, observability, runbooks | CTO |
22
+ | Data Engineer *(conditional)* | `data-engineer` | schema, migrations, integrity, backup/restore drills, query health | CTO |
23
+ | Project Manager | `project-manager` | `Plan.md`, `Board.md`, task decomposition, dependency graph, duplicate detection, progress chasing | COO |
24
+ | Designer | `designer-1..N` | UX flows, accessibility, visual consistency, `Design.md` | Product Manager |
25
+ | Technical Writer | `technical-writer` | the committed documentation set, executed as written; release notes | Product Manager |
26
+
27
+ ```text
28
+ CEO - user interface, arbitration, final acceptance
29
+ ├── CTO - technology strategy, engineering standards
30
+ │ ├── Architect - frozen interfaces, ADRs
31
+ │ ├── Developer-1..N - code + its own unit tests
32
+ │ ├── Tester-1..N - integration/E2E, local + CI
33
+ │ ├── Release Engineer - pipeline, packaging, repo/CI integrity
34
+ │ └── Data Engineer - schema, integrity, restore drills
35
+ ├── COO - process, risk, throughput
36
+ │ └── Project Manager - plan, board, dependencies, chasing
37
+ ├── Product Manager - research, requirements, acceptance criteria
38
+ │ ├── Designer - UX, accessibility, every visual asset
39
+ │ └── Technical Writer - documentation, release notes
40
+ ├── CFO - cost, budget, unit economics
41
+ ├── Reviewer-1..N - independent review, the only pass/merge right
42
+ └── Security Auditor - audits everyone, CTO included
43
+ ```
44
+
45
+ **Why these three stay with the CEO.** The Reviewer passes and merges every
46
+ deliverable, so it cannot be managed by a lane whose work it reviews - that would
47
+ be review under a manager, not independent review. The Security Auditor audits the
48
+ CTO's own decisions. The CFO holds the cap that binds every other role. Everything
49
+ else hangs off the role that owns the standard it is judged by. `ROLE_PARENT` in
50
+ `src/teamwork/config.py` is the single source of truth: `teamwork.py map` renders
51
+ this tree and `tests/unit/test_reporting_hierarchy.py` fails if a doc drifts from it.
52
+
53
+ **Escalation walks the tree.** A blocked Developer tells the Architect, then the
54
+ CTO; a blocked Tester tells the CTO; a blocked Designer tells the Product Manager.
55
+ The CEO hears it only when the line cannot resolve it - or when it is a red line,
56
+ a goal change, or a decision that binds the whole team. This keeps the CEO out of
57
+ day-to-day arbitration without weakening a single gate: the two-stage review, the
58
+ ledger and the test matrix apply to every role wherever it sits.
59
+
60
+ ### Roster tiers
61
+
62
+ `init --roster <tier>` expands a tier into instances; `--agents` overrides it.
63
+
64
+ | Tier | Instances | Startup read |
65
+ |---|---|---|
66
+ | `slim` (default) | 6 | 226 kB |
67
+ | `standard` | 9 | 336 kB |
68
+ | `full` | 16 | 586 kB |
69
+
70
+ Startup read = every instance's `AGENTS.md` plus its own role charter, summed
71
+ (`engine.expand_roster(tier)` over `roles/*.md` and `templates/AGENTS.md`). A tier is a recipe, not a rule: add any role the brief
72
+ justifies, and prefer an extra `developer-N`/`tester-N` over a coordination role.
73
+
74
+ A tier drops **lanes**, not gates:
75
+
76
+ | Dropped from `slim` | Where the work goes |
77
+ |---|---|
78
+ | product-manager | requirements, acceptance criteria and `Research.md` ride with the CEO |
79
+ | project-manager | `Plan.md`/`Board.md` ride with the CEO; `pulse` does the chasing |
80
+ | cto / coo | stack and process facts go in `Decisions.md`/`Risks.md` |
81
+ | cfo | `Costs.md` only when the work has a real cost dimension |
82
+ | designer | `ui` layer unstaffed |
83
+ | technical-writer | `docs` layer unstaffed; authors write their own docs |
84
+ | data-engineer | `data` layer unstaffed |
85
+ | release-engineer | the CEO pushes after review |
86
+ | security-auditor | `security` layer unstaffed |
87
+
88
+ Two invariants hold at every tier, and both are tested:
89
+
90
+ - `staffed_layers` only requires a layer whose owning role has an instance, so
91
+ `tests plan` never reports a gap for work nobody owns.
92
+ - `required_tribunal` never drops below `TRIBUNAL_MIN_SIGNERS`: with no CTO/CFO,
93
+ the Reviewer is the neutral seat, and a party to a dispute can never rule it.
94
+
95
+ `init` prints the folded lanes and warns when `ceo`, `developer`, `tester` or
96
+ `reviewer` is missing (`ROSTER_REQUIRED`).
97
+
98
+ ### Roles we deliberately do not add
99
+
100
+ A role earns a place only if it owns a distinct deliverable, a distinct test layer
101
+ and a distinct decision right. On that bar these stay out, and their work is folded
102
+ in as a lane rather than a role: marketing/sales (out of scope for an engineering
103
+ team; the CEO can staff them if a project ships commercially), a separate QA lead
104
+ (test strategy is the Tester's, test seams the Architect's), an accessibility
105
+ specialist (Designer owns `ui`, Reviewer verifies), and a dedicated performance
106
+ engineer (perf and load live in the Release Engineer's `release` layer and the
107
+ Tester's `integration` layer). Adding these would add ceremony without adding a
108
+ gate. **Staff two Reviewers** (`reviewer-1`,
109
+ `reviewer-2`): a passing review merges its own PR, so the second lane exists to
110
+ fan the *review* queue out, not to land what the first lane passed. Without a `reviewer` the team cannot pass review
111
+ or merge; without an `architect` nothing freezes interfaces. `init` warns when
112
+ either is missing.
113
+
114
+ ## Handoff chain
115
+
116
+ ```text
117
+ user -> CEO -> Architect (freeze interfaces) -> Project Manager (task graph)
118
+ | |
119
+ v v
120
+ Developer / Tester / Designer lanes <-- dispatch (pulse)
121
+ | |
122
+ v v
123
+ SelfCheck (owner) -> PR -> Review (Reviewer) -> merge into main
124
+ | |
125
+ v v
126
+ Product Manager (traceability) Archive.md (evidence ledger)
127
+ ```
128
+
129
+ Every handoff is a record, not a conversation: task state, PR record, review
130
+ verdict, archive entry. A peer message is only a pointer to the record.
131
+
132
+ ## Decision rights
133
+
134
+ | Decision | Who decides | Where it is recorded |
135
+ |---|---|---|
136
+ | What to build, priority, scope | CEO (Product Manager proposes) | `docs/Team/Project.md`, `Plan.md` |
137
+ | Interfaces, architecture, ADRs | Architect (CTO consults) | `Architecture.md`, `Decisions.md` |
138
+ | Stack, feasibility, build/release policy | CTO | `Decisions.md` |
139
+ | Pipeline, packaging, rollback, observability | Release Engineer | `Release.md`, runbooks |
140
+ | Documentation set and release notes | Technical Writer | the committed docs |
141
+ | Schema, migrations, backup/restore | Data Engineer | migrations, data dictionary |
142
+ | Cost, budget, build-vs-buy | CFO | `Costs.md` |
143
+ | Process, risk register | COO | `Risks.md` |
144
+ | Acceptance criteria and their verification | CEO writes; an independent role verifies | `Criteria.md` |
145
+ | Review verdict | the Reviewer that verified it | task `review_status`, `Reviews.md` |
146
+ | Merge into `main` | the pass itself, recorded by the Reviewer who verified it; the author is refused | merge commit, `Archive.md` |
147
+ | Test layer ownership and required coverage | each layer's own role; the Architect declares the required layers | `Tests.md`, `TestPlan.md` |
148
+ | Contested design/decision | tribunal: CEO + CTO + CFO, after 3 rounds | `Disputes.md` + `Decisions.md` |
149
+ | Red-line refusal | blocked until the CEO relays explicit user authorization | `Global/GlobalMemory.md`, `Decisions.md` |
150
+ | Final completion report | CEO to the user | user message + `Archive.md` |
151
+
152
+ ## Test layers (independent, parallel)
153
+
154
+ Every role owns exactly one layer (see `Testing.md` for what each must verify):
155
+ `goal` CEO · `requirements` Product Manager · `plan` Project Manager · `tech` CTO ·
156
+ `release` Release Engineer · `data` Data Engineer · `process` COO · `cost` CFO ·
157
+ `system` Architect · `ui` Designer · `docs` Technical Writer · `unit` Developer ·
158
+ `integration` Tester · `acceptance` Reviewer · `security` Security Auditor.
159
+
160
+ Default required coverage per area is the proportionate core set
161
+ (`unit`, `integration`, `acceptance`); `tests require --area <a> --layers ... --by
162
+ <instance> --reason <why>` widens or narrows it on the record. Every staffed role
163
+ must design and run at least one test of its own layer.
164
+
165
+ Each layer is designed, implemented and run by its owner; one record per
166
+ (layer, area) prevents duplicate testing. Details: `{references}/Testing.md`.
167
+
168
+ ## Submission (the single canonical path)
169
+
170
+ Every role that produces work uses this path; nothing else closes a task.
171
+
172
+ ```sh
173
+ teamwork.py branch start --agent <you> --task <T-id> [--worktree]
174
+ teamwork.py commit --role <role> --type <feat|fix|test|docs|design|research|refactor|chore> \
175
+ --task <T-id> --area <area> \
176
+ --goal "<what was asked>" --deliverable "<what you produced>" \
177
+ --why "<why this change>" --status "<actual state, truthfully>" \
178
+ --result "<command @rev -> observed result>" --all
179
+ teamwork.py task set <role> <T-id> --status selfcheck
180
+ teamwork.py selfcheck <role> <T-id> --by <Instance> --note "<what you re-read>" \
181
+ --test "<self-test command @rev -> observed result>"
182
+ teamwork.py pr open --agent <Instance> --task <T-id>
183
+ # Reviewer:
184
+ teamwork.py review <role> <T-id> --by <Reviewer> --result pass --evidence "<verify cmd @rev -> result>"
185
+ teamwork.py pr merge --pr <P-id> --by <reviewer> # a pass already merged it;
186
+ # use this only to land a --no-merge pass
187
+ ```
188
+
189
+ A pass merges the deliverable at once and deletes its branch, so there is no
190
+ second Reviewer step: the engine refuses an author merging their own work and
191
+ records the pass-without-merge only when `--no-merge` is given.
192
+
193
+ Charters do not restate this; they state what the role produces and decides.
194
+
195
+ ## Boundaries that apply to every role
196
+
197
+ - Never contact the user; escalate to the CEO and keep working.
198
+ - Never approve or merge your own work; only the Reviewer merges.
199
+ - Never commit on `main`; work on your own branch.
200
+ - Never fake evidence, weaken tests, or claim an unexecuted result.
201
+ - Stop at a red line: record it, escalate, do other work meanwhile.
@@ -0,0 +1,64 @@
1
+ # Memory and task state
2
+
3
+ Reference for the /teamwork skill. Loaded on demand; `SKILL.md` keeps the
4
+ operating procedure.
5
+
6
+ Related: [Engineering](Engineering.md) | [Evidence](Evidence.md) | [Docs](Docs.md) | [State](State.md) | [Concurrency](Concurrency.md) | [Roles](Roles.md) | [Testing](Testing.md) | [Audit](Audit.md)
7
+
8
+ ## Memory model
9
+
10
+ Each agent owns three markdown files in its directory; the CEO additionally owns
11
+ the shared one. Management is via the script so caps and promotion are
12
+ deterministic, not vibes.
13
+
14
+ | Layer | File | Loaded | Purpose |
15
+ |---|---|---|---|
16
+ | Short-term | `ShortTermMemory.md` | at startup (`load`) | working memory for the current tasks |
17
+ | Long-term | `LongTermMemory.md` | never; queried (`recall`) | durable facts, interfaces, gotchas |
18
+ | Archive | `ArchivedMemory.md` | never; searchable | evicted long-term entries |
19
+ | Shared | `Global/GlobalMemory.md` | read on demand | facts no agent should re-ask |
20
+
21
+ ```sh
22
+ teamwork.py load <agent> # startup context
23
+ teamwork.py remember <agent> "<fact>" --key k --importance 0-5 [--pin]
24
+ teamwork.py recall "<query>" --agent <agent> | --global | --all
25
+ teamwork.py touch <agent> <key> # mark as used
26
+ teamwork.py consolidate --all # auto maintenance
27
+ teamwork.py global "<fact>" --key k --importance 4 # CEO only
28
+ ```
29
+
30
+ Consolidation rules (automatic on `remember`/`load`, run manually by the CEO):
31
+
32
+ - A short-term entry unused for `STALE_DAYS` (3) with fewer than `MIN_USES` (2)
33
+ uses is **promoted** to long-term when its importance >= 2, otherwise dropped.
34
+ - Overflow beyond `SHORT_CAP` (24) is promoted or dropped by score.
35
+ - Long-term is capped at `LONG_CAP` (64); the lowest-scoring entries (importance,
36
+ use count, recency) are moved to the archive, pinned entries are never evicted.
37
+ - Duplicate keys merge: highest importance, summed uses, newest body.
38
+ - Caps are configurable with `TEAMWORK_SHORT_CAP`, `TEAMWORK_LONG_CAP`,
39
+ `TEAMWORK_ARCHIVE_CAP`, `TEAMWORK_STALE_DAYS`, `TEAMWORK_MIN_USES`.
40
+
41
+ What belongs where: task-local working notes and in-flight decisions in
42
+ short-term; verified interfaces, commands, revisions, gotchas and rejected
43
+ approaches in long-term; team-wide facts in global memory (CEO), proposed by the
44
+ owner who discovered them.
45
+
46
+ ## Task lists and priority
47
+
48
+ Every agent keeps a private `TaskQueue.md`, priority ordered. `P0` = critical path
49
+ code, `P1` = tests/verification, `P2` = docs/polish, `P3` = nice-to-have.
50
+
51
+ ```sh
52
+ teamwork.py task add <agent> "<title>" --priority P1 --deps architect:T-0003 \
53
+ --shared <issue/PR> --body "acceptance criteria"
54
+ teamwork.py task next <agent> # highest-priority task with deps done
55
+ teamwork.py task list <agent> # ready/blocked per task
56
+ teamwork.py task set <agent> T-0002 --status doing
57
+ teamwork.py task set <role> T-0002 --status selfcheck # then selfcheck, pr open, review, pr merge
58
+ teamwork.py board # all queues: counts, next task, blockers
59
+ ```
60
+
61
+ Rules: dependencies are explicit (`agent:T-0001` for cross-agent), a task with
62
+ unmet dependencies is never started, a finished task is marked `done` with
63
+ evidence before the agent looks for the next one, and an agent with executable
64
+ work never idles.
@@ -0,0 +1,144 @@
1
+ # Layered testing - every agent tests its own work
2
+
3
+ Reference for the /teamwork skill. Loaded on demand.
4
+
5
+ Related: [Roles](Roles.md) | [Engineering](Engineering.md) | [Evidence](Evidence.md) | [State](State.md) | [Docs](Docs.md) | [Concurrency](Concurrency.md) | [Audit](Audit.md)
6
+
7
+ ## One layer per role
8
+
9
+ Every agent designs, develops **and executes** its own independent tests, and
10
+ evidences the run. No layer is delegated, and nobody substitutes for another
11
+ role's layer.
12
+
13
+ | Layer | Owner | What it must verify |
14
+ |---|---|---|
15
+ | `goal` | CEO | black-box: the delivered result actually meets the user's objective |
16
+ | `requirements` | Product Manager | every requirement maps to a passing check; traceability is complete |
17
+ | `plan` | Project Manager | plan integrity: dependency graph, duplicate work, milestone exit criteria |
18
+ | `tech` | CTO | toolchain and dependency upgrades, feasibility spikes, version drills |
19
+ | `release` | Release Engineer | reproducible build, CI gates, packaging, upgrade and rollback |
20
+ | `data` | Data Engineer | schema and migrations, backfill, backup and restore drills |
21
+ | `process` | COO | the documented workflow and tooling actually run end to end |
22
+ | `cost` | CFO | metering, cap enforcement, unit-economics assertions |
23
+ | `system` | Architect | architecture conformance: boundaries, dependency direction, contracts, ADRs |
24
+ | `ui` | Designer | UI use cases: flows, component states, accessibility |
25
+ | `docs` | Technical Writer | every documented command and claim executed as written |
26
+ | `unit` | Developer | unit tests for the code the Developer wrote |
27
+ | `integration` | Tester | integration / system / end-to-end behaviour |
28
+ | `acceptance` | Reviewer | acceptance tests over **every** role's output |
29
+ | `security` | Security Auditor | auth, input handling, secrets, red-line behaviour |
30
+
31
+ Ownership is enforced: `tests add --layer integration --owner developer-1` is
32
+ refused, and `tests run` only accepts instances of the owning role.
33
+
34
+ Several **Reviewers** may run at once (`reviewer-1`, `reviewer-2`, ...). One may
35
+ pass the verdict and that same lane merges it - an author never reviews or merges
36
+ its own work, which is where independence lives.
37
+
38
+ ## Comprehensive and systematic
39
+
40
+ Each layer is designed the same way, so coverage is comparable across roles:
41
+
42
+ 1. **Enumerate** the claims the role is accountable for (its own deliverables and
43
+ decisions) and the ways they can fail: normal path, boundaries, error paths,
44
+ concurrency, degraded inputs, and the regression case for each fixed defect.
45
+ 2. **Design before implementing**: write down the cases and the expected result,
46
+ then implement them. Tests are written from the frozen interface
47
+ (`Architecture.md`) and the role's own specification - not from the finished
48
+ code, so lanes stay independent.
49
+ 3. **Execute and evidence**: actually run them and record command + revision +
50
+ observed result. Reading a diff is not a test.
51
+ 4. **Keep them deterministic**: no network, no sleeps, no ordering assumptions;
52
+ quarantine flaky tests explicitly with an owner instead of ignoring them.
53
+ 5. **Keep them alive**: re-run after every change that touches the layer's subject;
54
+ a stale pass is not a pass.
55
+
56
+ Coverage is measured against the role's own claims, not line coverage. A layer
57
+ that cannot fail does not count as a test.
58
+
59
+ ## Records
60
+
61
+ One record per **(layer, area)** pair - that is the anti-duplication rule: the
62
+ same thing is not tested twice by accident.
63
+
64
+ ```sh
65
+ # each role declares its own layer for an area it is accountable for
66
+ teamwork.py tests add --layer unit --area auth --command "go test ./internal/auth"
67
+ teamwork.py tests add --layer system --area auth --command "check-boundaries ./..."
68
+ # the owning role runs it and records evidence
69
+ teamwork.py tests run TS-0002 --by tester-1 --result pass \
70
+ --evidence "go test ./test/integration -run Auth @a1b2c3d -> ok 4 tests" \
71
+ --baseline "empty auth table" --artifact Reports/auth-run.log --replay "go test ./test/integration -run Auth"
72
+
73
+ # a defect fix proves the failure first; the proof is stored on the defect task
74
+ # (task added with --bug), not on a layer record
75
+ teamwork.py tests repro T-0007 --by tester-1 \
76
+ --pre-rev a1b2c3d --pre-evidence "go test ./test/integration -run Auth @a1b2c3d -> FAIL, 2 tests" \
77
+ --post-rev d4e5f6a --post-evidence "go test ./test/integration -run Auth @d4e5f6a -> ok 4 tests"
78
+
79
+ teamwork.py tests list [--layer unit]
80
+ teamwork.py tests plan # matrix, role coverage, gaps
81
+
82
+ Exit codes: `0` every required layer passes, `1` gaps remain, `3` no area is
83
+ declared yet (nothing to check).
84
+ ```
85
+
86
+ `tests add` refuses a duplicate `(layer, area)` and warns when the same command
87
+ would run in two layers.
88
+
89
+ ## Required coverage
90
+
91
+ Default: **every staffed role's layer** must cover every area in use. Narrow it
92
+ deliberately, per area, and record why:
93
+
94
+ ```sh
95
+ teamwork.py tests require --area auth --layers unit,integration,system,ui,acceptance,security
96
+ ```
97
+
98
+ Default required coverage per area is the proportionate core set (`unit`,
99
+ `integration`, `acceptance`) restricted to staffed roles; widen or narrow it per
100
+ area with `tests require --area <a> --layers ... --by <architect|ceo> --reason <why>`,
101
+ which is recorded and audited. Every staffed role must still design and run at
102
+ least one test of its own layer.
103
+
104
+ `loop` will not report STOP while a required layer is missing, pending or failing,
105
+ nor (with four or more staffed layers) while a staffed role has designed no tests
106
+ at all. `audit` lists the same gaps, failing layers, duplicate commands and roles
107
+ with no tests.
108
+
109
+ ## Local and CI are one certification
110
+
111
+ The Tester owns both signals and must show they agree:
112
+
113
+ 1. **Local** - run the layers on the working revision; this is the fast signal.
114
+ 2. **CI** - confirm the Release Engineer's pushed SHA produced the same result,
115
+ job by job across the OS/Python matrix; this is the authoritative signal.
116
+ A green local run with a red CI run is a failure, and so is the reverse.
117
+ 3. **Divergence is a defect.** Route it to the owner and re-verify after the fix:
118
+ code -> Developer; test -> Tester; contract/interface -> Architect; workflow,
119
+ packaging, runner or flake -> Release Engineer; scope -> CEO. File the exact
120
+ command, expected vs actual, log excerpt, SHA, run id and a one-line repro.
121
+ 4. **Never report a suite as passing while the matching CI run is red** (or the
122
+ reverse), and never let a red run go unowned.
123
+
124
+ A `tests run` evidence string therefore names both:
125
+
126
+ ```
127
+ <local command> @<rev> -> <result>; CI <run-id> @<rev> -> <conclusion>
128
+ ```
129
+
130
+ ## How it fits the flow
131
+
132
+ ```text
133
+ interfaces frozen
134
+ |
135
+ +-- every role designs and runs its own layer, in parallel:
136
+ goal · requirements · plan · tech · release · data · process · cost
137
+ system · ui · docs · unit · integration · acceptance · security
138
+ |
139
+ v
140
+ PR -> Reviewer acceptance tests + independent review -> merge (same lane)
141
+ ```
142
+
143
+ Test layers are lanes like any other: they claim provider slots, run in parallel
144
+ with implementation, and are never deferred to the end of a milestone.