teamsmith 0.4.6 → 0.4.7

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/README.md +6 -6
  2. package/package.json +1 -1
  3. package/skills/teamsmith/CHANGELOG.md +24 -0
  4. package/skills/teamsmith/SKILL.md +32 -23
  5. package/skills/teamsmith/extension/team-bg.ts +5 -3
  6. package/skills/teamsmith/extension/team-inbox-watch.ts +14 -3
  7. package/skills/teamsmith/extension/team-notify.ts +20 -13
  8. package/skills/teamsmith/extension/team-remind.ts +189 -0
  9. package/skills/teamsmith/extension/team-reply.ts +4 -7
  10. package/skills/teamsmith/references/migration.md +101 -0
  11. package/skills/teamsmith/references/openspec.md +43 -27
  12. package/skills/teamsmith/references/protocol.md +26 -15
  13. package/skills/teamsmith/references/reminders.md +153 -161
  14. package/skills/teamsmith/references/troubleshooting.md +12 -7
  15. package/skills/teamsmith/references/workflows.md +84 -31
  16. package/skills/teamsmith/scripts/lib/cmd-agents.sh +10 -4
  17. package/skills/teamsmith/scripts/lib/cmd-project.sh +88 -6
  18. package/skills/teamsmith/scripts/lib/cmd-remind.sh +88 -2
  19. package/skills/teamsmith/scripts/lib/cmd-review.sh +42 -4
  20. package/skills/teamsmith/scripts/lib/cmd-watch.sh +48 -11
  21. package/skills/teamsmith/scripts/lib/common.sh +83 -13
  22. package/skills/teamsmith/scripts/panel/panel.js +179 -179
  23. package/skills/teamsmith/scripts/panel/src/data.ts +71 -15
  24. package/skills/teamsmith/scripts/panel/src/layout.ts +20 -8
  25. package/skills/teamsmith/scripts/panel/src/main.tsx +83 -21
  26. package/skills/teamsmith/scripts/remind-capability.mjs +261 -0
  27. package/skills/teamsmith/scripts/remind-store.mjs +55 -24
  28. package/skills/teamsmith/scripts/remind-tick.mjs +5 -2
  29. package/skills/teamsmith/scripts/reply-capture.mjs +8 -9
  30. package/skills/teamsmith/scripts/state-authority.mjs +72 -6
  31. package/skills/teamsmith/scripts/team +1 -0
  32. package/skills/teamsmith/templates/AGENTS.section.md.tmpl +11 -8
  33. package/skills/teamsmith/templates/DECISIONS.md.tmpl +2 -2
  34. package/skills/teamsmith/templates/OWNERSHIP.md.tmpl +3 -3
  35. package/skills/teamsmith/templates/PROTOCOL.md.tmpl +19 -14
  36. package/skills/teamsmith/templates/memory-seed.md.tmpl +2 -2
  37. package/skills/teamsmith/templates/pm-prompt.md.tmpl +31 -19
  38. package/skills/teamsmith/templates/report.md.tmpl +33 -0
  39. package/skills/teamsmith/tests/bg-ledger-harness.mjs +217 -33
  40. package/skills/teamsmith/tests/bg-ledger.sh +24 -10
  41. package/skills/teamsmith/tests/checkout-shape-probe.sh +7 -6
  42. package/skills/teamsmith/tests/fixtures/remind-adversarial-delay.ts +27 -0
  43. package/skills/teamsmith/tests/fixtures/remind-tool-provider.ts +65 -0
  44. package/skills/teamsmith/tests/help-surface.sh +3 -5
  45. package/skills/teamsmith/tests/isolation-ledger.sh +6 -2
  46. package/skills/teamsmith/tests/key-replies-ui.sh +53 -0
  47. package/skills/teamsmith/tests/key-replies.sh +307 -106
  48. package/skills/teamsmith/tests/lib/routes-pages.sh +243 -0
  49. package/skills/teamsmith/tests/loop-inventory.tsv +1 -0
  50. package/skills/teamsmith/tests/panel-b3-stub.sh +9 -2
  51. package/skills/teamsmith/tests/remind-adversarial-faults.mjs +163 -0
  52. package/skills/teamsmith/tests/remind-adversarial-faults.sh +26 -0
  53. package/skills/teamsmith/tests/remind-adversarial-real.sh +27 -0
  54. package/skills/teamsmith/tests/remind-cli.sh +108 -3
  55. package/skills/teamsmith/tests/remind-delivery-node.mjs +13 -0
  56. package/skills/teamsmith/tests/remind-delivery.sh +123 -35
  57. package/skills/teamsmith/tests/remind-lifecycle.sh +197 -0
  58. package/skills/teamsmith/tests/remind-pulse.sh +199 -0
  59. package/skills/teamsmith/tests/remind-recovery-real.sh +5 -0
  60. package/skills/teamsmith/tests/remind-recovery-unit.sh +118 -0
  61. package/skills/teamsmith/tests/remind-tool-node.mjs +159 -0
  62. package/skills/teamsmith/tests/remind-tool-real.mjs +754 -0
  63. package/skills/teamsmith/tests/remind-tool-real.sh +5 -0
  64. package/skills/teamsmith/tests/reply-capture-real.mjs +93 -2
  65. package/skills/teamsmith/tests/routes.sh +213 -293
  66. package/skills/teamsmith/tests/section-paths.tsv +10 -8
  67. package/skills/teamsmith/tests/smoke.sh +484 -28
  68. package/skills/teamsmith/tests/state-authority.sh +152 -8
  69. package/skills/teamsmith-init/SKILL.md +5 -5
  70. package/skills/teamsmith/tests/fixtures/delivery-truth-real/__pycache__/judge-second.cpython-313.pyc +0 -0
@@ -455,3 +455,104 @@ team mark-loaded # re-record what this session sho
455
455
 
456
456
  If something here does not match what `team doctor`, `team version --check` or `team smoke` actually print, that is a
457
457
  bug in the guide (or in the tool): report it with the command and the output rather than working around it.
458
+
459
+ ## 9. Reminder state and prompt-free recovery
460
+
461
+ The Reminder/Standby authority adds one shared snapshot and an OS `flock` dependency. This is a
462
+ required dependency **even for Standby in a project with no Reminders**. `team paths` reports the
463
+ executable used by the real transaction as `flock_runner` (an empty string means unresolved), and
464
+ `team doctor` fails with a concrete repair when it is absent or unusable:
465
+
466
+ ```text
467
+ flock unavailable: no executable flock on PATH; install util-linux ...
468
+ flock unavailable: <path> is not an executable regular file ...
469
+ exclusive flock failed at <state>/reminders/authority.lock: flock: <OS error> ...
470
+ ```
471
+
472
+ Install `util-linux` (which provides `flock`), fix the named file's execute permission, or correct
473
+ `PATH`. For the third form, repair the filesystem containing `<state>/reminders` or move the project
474
+ state to a filesystem that supports exclusive locks. There is no unlocked fallback and no
475
+ `TEAM_REQUIRE_*` switch that makes a mutation safe without the lock. Once the authority exists,
476
+ `doctor` probes its real `authority.lock` without changing the snapshot.
477
+
478
+ ### 9a. Quiesced upgrade and migration failure
479
+
480
+ 1. Stop the old PM, Pulse and every other old writer. `team pulse down` stops Pulse; use the existing
481
+ PM stop/restart procedure for the PM. Do not let an old Standby-marker writer run beside the new
482
+ authority.
483
+ 2. Resolve and test the dependencies before writing:
484
+
485
+ ```bash
486
+ team paths # inspect flock_runner and js_runner
487
+ team doctor # a missing/unusable flock is a failure
488
+ ```
489
+
490
+ 3. Preserve the old runtime state. The destination is outside the old code's state directory:
491
+
492
+ ```bash
493
+ backup=".pi/team/reminder-rollback-$(date -u +%Y%m%dT%H%M%SZ)"
494
+ mkdir -p "$backup"
495
+ if [ -f .pi/team/state/reminders/state.json ]; then
496
+ cp .pi/team/state/reminders/state.json "$backup/state.json"
497
+ fi
498
+ if [ -f .pi/team/state/standby ]; then
499
+ cp .pi/team/state/standby "$backup/standby.before-upgrade"
500
+ fi
501
+ ```
502
+
503
+ 4. Migrate with the real command:
504
+
505
+ ```bash
506
+ team standby migrate
507
+ ```
508
+
509
+ A lock or legacy-import failure happens before snapshot commit: the previous snapshot and legacy
510
+ marker remain in place, so repair the named cause and rerun the same command. A write/fsync error
511
+ can instead be indeterminate after the atomic rename; inspect `standby.migrated` in the snapshot
512
+ rather than assuming the old state. Migration is idempotent. If the snapshot was committed but only
513
+ the marker rename failed, the command warns instead: the snapshot already says
514
+ `standby.migrated=true`, the leftover marker is inert, and this is **not** a rollback to the old
515
+ writer.
516
+
517
+ ### 9b. Export and roll back
518
+
519
+ Stop the new PM, Pulse and writers first. Inspect outstanding Reminders and intents with
520
+ `team remind list --all`; resolve them from their observed outcomes rather than assuming delivery.
521
+ Then export the snapshot outside the old code's state path:
522
+
523
+ ```bash
524
+ backup=".pi/team/reminder-rollback-$(date -u +%Y%m%dT%H%M%SZ)"
525
+ mkdir -p "$backup"
526
+ cp .pi/team/state/reminders/state.json "$backup/state.json"
527
+ node -e '
528
+ const fs = require("fs");
529
+ const [snapshotFile, markerFile, backupDir] = process.argv.slice(1);
530
+ const s = JSON.parse(fs.readFileSync(snapshotFile, "utf8"));
531
+ if (!s.standby.migrated) throw new Error("Standby migration has not completed");
532
+ if (s.standby.on) {
533
+ fs.writeFileSync(markerFile, `${s.standby.since} ${s.standby.reason}\n`);
534
+ } else if (fs.existsSync(markerFile)) {
535
+ fs.renameSync(markerFile, `${backupDir}/standby.pre-rollback`);
536
+ }
537
+ ' "$backup/state.json" ".pi/team/state/standby" "$backup"
538
+ ```
539
+
540
+ This recreates the only Standby file the old code reads, preserving the current generation's `since`
541
+ and `reason`; an authoritative off state has no marker. To prove the export can restore an on marker,
542
+ save the generated marker, move it away, rerun the same `node -e` command and compare the regenerated
543
+ file with the saved one. To verify the exported snapshot itself:
544
+
545
+ ```bash
546
+ cp "$backup/state.json" "$backup/state.restore-check.json"
547
+ cmp "$backup/state.json" "$backup/state.restore-check.json"
548
+ node -e 'JSON.parse(require("fs").readFileSync(process.argv[1], "utf8"))' "$backup/state.json"
549
+ ```
550
+
551
+ Pin the older tool using §7 only after the export, marker and stopped processes have been checked.
552
+ There is no `team remind export`, automatic rollback helper or old-code Reminder reader. Old binaries
553
+ cannot interpret or deliver outstanding Reminders: rollback suspends them and never auto-replays them.
554
+ Do not copy the exported snapshot back while old writers are running.
555
+
556
+ A stopped built-in Pi PM may be resumed for an eligible Reminder without `@pm-prompt`; custom PM
557
+ adapters report `unsupported-adapter` instead of receiving the ordinary startup prompt. State paths,
558
+ unknown handling and recovery outcomes are in `skills/teamsmith/references/reminders.md`.
@@ -41,16 +41,16 @@ CLI they are the equivalent prompt/skill files (§0).
41
41
  | 1 | `opsx-explore` | an **explorer** worker — never the eventual implementer (the verify agent, or a dedicated explorer) | the user's request / problem statement, existing specs and code | exploration report: options, risks, recommended approach, effort — written as the task's report | **PM**: accepts the approach, records the decision in `docs/team/DECISIONS.md`, and writes the propose brief |
42
42
  | 2 | `opsx-propose` | the **explorer** (the same agent — it holds the context) | the accepted approach | `openspec/changes/<id>/` (proposal, delta specs, design, tasks) — **planning only, no code** (the workflow itself states this boundary) | **PM proposal review — a recorded gate, same standing as `team review`**: `openspec validate --all --strict` green **and** the verdict written to `docs/team/reviews/<change>-proposal.md` as ACCEPTED (§4). **No apply brief may be dispatched before that.** |
43
43
  | 3 | `opsx-apply` | a **dev** agent, different from 1 and 4 | the change + the brief | code committed on its task branch + report | **independent verification** is dispatched to a different agent |
44
- | 4 | `opsx-verify` | an **independent verify** agent (never the implementer) | the change, the landed code, the report | verification record `docs/team/reviews/<ID>.md` + findings; every scenario of the change exercised, with red/green evidence | **PM**: re-runs the gate on the merged tree, decides `done`, and only then proposes archiving |
45
- | 5 | `opsx-archive` | **PM** (it changes the ledger) | the verified change | `openspec/changes/archive/<date>-<id>/` + updated capability specs | `team change status <id>` exits 0 (every task finished **and** its `tasks.md` checklist fully ticked — §5); **the user** confirms; the PM may confirm as the user's proxy only when it states that plainly and records why (small, reversible, already covered by the approved approach) |
44
+ | 4 | `opsx-verify` | an **independent verify** agent (never the implementer) | the change, the landed code, the report | implementation-ID execution record + verifier assessment; candidate and merged SHAs, every applicable scenario and red/green evidence | after the PM merges, the **same verifier** resumes on a clean checkout pinned to the merged SHA and runs the applicable gates + OpenSpec assessment; the PM accepts passing evidence before `done` or archive authorization; inspection-only `team review --post-merge` is not that run |
45
+ | 5 | `opsx-archive` | a **non-implementer worker** (possibly that verifier), on its own worktree/task branch | the accepted merged change, completed assessment and valid confirmation | `openspec/changes/archive/<date>-<id>/` + updated capability specs + worker report | completed merged-revision verification, zero unresolved CRITICAL findings, disclosed WARNING/unverified checks, reconciled sibling/checklist evidence; `team change status <id>` may have only the exact archive-task-ID + literal `phase=archive` self blocker; **the user** confirms, or the PM explicitly records a proxy confirmation only for a small, reversible change already covered by the approved approach |
46
46
 
47
47
  An exploration whose conclusion is "not worth doing", and a verification that fails twice, do not advance: see §7.
48
48
 
49
49
  ## 2. One phase = one task = one owner
50
50
 
51
- - The phases are **never merged into a single brief**: explore, propose, apply, verify and archive are five briefs
52
- (or five gate decisions for the phases the PM owns), each with its own `task:` id, `agent:`, `deps:` and `phase:`
53
- header line.
51
+ - The phases are **never merged into a single brief**: explore, propose, apply, verify and archive are five briefs,
52
+ each with its own `task:` id, `agent:`, `deps:` and `phase:` header line. An archive brief declares the literal
53
+ `phase: archive`, not the command name `opsx-archive` or `-`.
54
54
  - **No agent verifies its own work** — the `team review` rule applied to the OpenSpec phases. The verify phase is
55
55
  owned by an agent that did not implement, and the apply phase by an agent that did not propose. Explore and
56
56
  propose may be the same agent (it holds the context) — but neither may apply its own proposal.
@@ -150,10 +150,28 @@ $ <a command the proposal itself promises> # → spot-checked: it exists and run
150
150
  | explore | the exploration report, the specs and code it cites | the recommendation is one option with its risks and effort, and the scope is the user's request — not a wish list | the decision in `docs/team/DECISIONS.md` + the propose brief |
151
151
  | propose | `openspec/changes/<id>/` end to end | `openspec validate --all --strict` green and all eight checklist points pass | `docs/team/reviews/<change>-proposal.md` = ACCEPTED (or NEEDS-CHANGES + per-item findings) |
152
152
  | apply | the brief, the change, the branch, the report | the branch carries exactly the change's scenarios; the acceptance commands really ran; nothing outside the boundaries was touched | the verify brief (a different agent) |
153
- | verify | the change, the landed code, the verification record, the diff | every scenario was exercised with red/green evidence, on a clean independent checkout | `docs/team/reviews/<ID>.md`; then `team board set <ID> done` after re-running the gate on the merged tree |
154
- | archive | the verified change + the user's confirmation | `team change status <id>` exits 0 — every task of the change is finished **and the change's `tasks.md` has no unchecked `- [ ]` item** (the command names the count and the first three line numbers/titles and exits non-zero) — and the user confirmed; **trial archive first**: `cp -r openspec /tmp/trial && (cd /tmp/trial && openspec archive -y <id>)` — OpenSpec catches some delta defects (a MODIFIED naming a requirement the base lacks, an ADDED collision, …) *only here*; the trial surfaces them while fixing is cheap, and a failure hands the change back to apply with the archiver's message | then `openspec archive -y <id>` for real, and the user's confirmation recorded (who confirmed, or why the PM acted as proxy) |
153
+ | verify | the change, landed code, implementation-ID execution record, verifier report and diff | the assigned non-implementer verifier ran every applicable scenario on the PM-prepared clean checkout; after merge the **same verifier** resumed on the pinned merged SHA and completed the applicable gates + OpenSpec assessment | PM accepts the merged-SHA evidence, then `team board set <ID> done`; when IDs differ the PM writes `reviews/<verify-task>.md` explicitly as **PM acceptance**, linking the implementation-ID execution record, verifier report and verified merged SHA |
154
+ | archive | the accepted merged baseline, linked execution record + completed assessment, and valid confirmation | zero unresolved CRITICAL findings; WARNING/SUGGESTION and every unverified applicable check/reason disclosed before confirmation; sibling/checklist evidence reconciled; `team change status <id>` need not exit zero while this archive task is active; the tool excludes only the row whose task ID equals this brief's ID, and the brief must declare literal `phase: archive` so that row reads as `archive` (`opsx-archive` and `-` do not satisfy the header) — the tool does not match self by phase text, and every other task/archive/checklist/unreadable blocker stops archive; user confirmation, or PM proxy only for a small, reversible change already covered by the approved approach with confirmer/reason recorded | the assigned worker trials and runs `openspec archive -y <id>` on its own authorized branch; PM inspects/integrates and closes the task after acceptance |
155
+
156
+ The archive worker trials native archive on a private disk-backed copy before using its own branch:
157
+
158
+ ```sh
159
+ trial_root="$(mktemp -d -p /var/tmp teamsmith-archive.XXXXXX)" # substitute the project's declared disk root
160
+ mkdir "$trial_root/project"
161
+ cp -a openspec "$trial_root/project/openspec"
162
+ (cd "$trial_root/project" && openspec archive -y <id>)
163
+ # Inspect complete output and resulting specs; failure returns for correction, never a real archive.
164
+ rm -rf -- "$trial_root"
165
+ ```
166
+
167
+ The archive grant covers only the selected change/native dated destination, enumerated capability specs and the
168
+ worker's report in its own worktree/task branch. Native synchronization preserves existing capability Purpose text.
169
+ The stale verification Purpose is updated only afterwards in a separate, explicitly authorized Purpose-only
170
+ documentation commit with its before/after diff. For dependent archives, the predecessor archive is accepted and
171
+ merged first; the successor starts from that baseline and reconciles every complete MODIFIED block/scenario. A stale
172
+ block or missing merged predecessor returns for authorized correction and independent re-verification.
155
173
 
156
- The checklist half of that exit code is the apply phase's own ledger: three changes reached archive with 23/24/16
174
+ The checklist half of readiness is the apply phase's own ledger: three changes reached archive with 23/24/16
157
175
  items unticked (P151 F3, P175 F3, P206 F1), each caught by a human instead of by the gate. The check counts
158
176
  **empty boxes only** — an item ticked with its reason (`- [x] 2.3 … 引用 P206`) is complete, and a box ticked to
159
177
  clear the gate is no evidence: the ledger is reconciled on the apply side (tick what was really done, say in the
@@ -185,23 +203,20 @@ tip.
185
203
 
186
204
  ## 6. Preconditions
187
205
 
188
- - Generate what the installed OpenSpec can generate: `openspec init --tools pi` writes the command and skill files
189
- for the workflows of the active profile (use the tool's own id for a non-Pi CLI). With the version this project
190
- pins — **1.8.0, whose only profile is `core`** (`openspec config list` prints
191
- `workflows: propose, explore, apply, update, sync, archive (from core profile)`) — that is
192
- `opsx-{explore,propose,apply,archive}` plus the helper commands `opsx-update`/`opsx-sync`, and the matching
193
- skills `openspec-{explore,propose,apply-change,archive-change}` plus `openspec-sync-specs`/`openspec-update-change`.
194
- **It does not generate the verify pair** (`opsx-verify.md`,
195
- `openspec-verify-change/SKILL.md`): 1.8.0 has no `verify` workflow, and the `expanded` profile this guide used to
196
- name does not exist (`openspec config profile expanded` → `Error: Unknown profile preset "expanded". Available
197
- presets: core`). Once a project has generated files, `openspec update` refreshes them; it finds the configured
198
- tools from those files and answers "No configured tools found" when there are none.
199
- - **A phase whose command is missing is not a phase that did not run.** The verify phase is owned by this guide, not
200
- by a generated file: run it from §1 and §5 — a different agent than the implementer, the change + the landed code
201
- + the report as its hand-in, `docs/team/reviews/<ID>.md` as its hand-out. If you want a command for it, write the
202
- prompt yourself and say it is yours; do not record a hand-written prompt as generated. What teamsmith gates on is
203
- the **artifact** (the review record); the command file is only checked where the checkout carries one (a checkout
204
- without the machine-generated surface gets a named skip, never a red — P222).
206
+ - Generate what the installed OpenSpec can generate: `openspec init --tools pi` writes command and skill files for
207
+ the active profile (use the tool's own id for a non-Pi CLI), and `openspec update` refreshes configured tools.
208
+ Inspect the **actually generated** `.pi/prompts/opsx-verify.md` and
209
+ `.pi/skills/openspec-verify-change/SKILL.md`: when present, the verifier follows that workflow's completeness,
210
+ correctness and coherence assessment and its CRITICAL/WARNING/SUGGESTION/Final assessment definitions. Do not infer
211
+ availability from an OpenSpec release number or prescribe `openspec instructions verify`, which is not an artifact
212
+ command for the `spec-driven` profile.
213
+ - **A missing generated verify workflow is a disclosed limitation, not a skipped phase.** The assigned different agent
214
+ performs the documented equivalent review of completeness, requirement/scenario correctness and design coherence,
215
+ using this guide's phase ownership plus the same findings/readiness structure; structural `openspec validate` alone
216
+ is not verification. The hand-out remains the implementation-ID execution record plus the verifier's completed
217
+ assessment report. What teamsmith gates on is the **artifact** (the review record and assessment); generated command
218
+ files are checked only where the checkout carries them (a checkout without the machine-generated surface gets a
219
+ named skip, never a red — P222).
205
220
  - Whether the generated files are committed follows the project's own ignore rules. This repository ignores `.pi/**`
206
221
  (`.gitignore`): the files are per-machine, every clone and every CI checkout starts without them, and the gate
207
222
  reports the `.pi/prompts` / `.pi/skills` checks as named skips there. A project that does commit them gets those
@@ -216,7 +231,8 @@ tip.
216
231
  propose, and says so in the ledger. Nothing is archived, nothing is left half-planned.
217
232
  - **Verification fails twice** → the PM **stops the change**: leave it in `openspec/changes/<id>/` with a note
218
233
  naming the blocker (and the failed findings), rather than pushing it through. The next PM can see it.
219
- - **The user is not available for the archive decision** → the change stays open; the code can already be merged
220
- and `done` on the board (the ledger proves it), only the archive waits for the user.
234
+ - **The user is not available for the archive decision** → the change stays open unless the PM explicitly records
235
+ the limited proxy case: small, reversible, already covered by the approved approach, with confirmer and reason.
236
+ PM evidence acceptance alone is not confirmation; WARNING findings and unverified checks/reasons are disclosed first.
221
237
  - Never archive to make a red thing disappear: `openspec archive` merges the deltas into `specs/` — after it, the
222
238
  spec set claims the change is real. Archive only after the gate passed and the user confirmed.
@@ -18,8 +18,9 @@ reasons are what stop a future you (and future agents) from treating them as bur
18
18
  | Authority | the protected branch, forge writes, repository settings | its own task branch |
19
19
 
20
20
  Splitting "writing code" from "judging whether the code is acceptable" across different sessions is what creates
21
- **independent verification**: the agent's report is a **claim**, the gate results the PM obtains on an independent
22
- worktree are **evidence**.
21
+ **independent verification**: the agent's report is a **claim**, and the gate results a non-implementer verifier
22
+ obtains on the PM-prepared independent worktree are **evidence**. The PM reviews and accepts that evidence without
23
+ executing the gates.
23
24
 
24
25
  > A real CEP lesson: a report claimed 28/28 tests passing, the PM re-ran it and 4 specs failed (the cause was a value
25
26
  > import used to import a pure type under `verbatimModuleSyntax`). Conclusion: a report ≠ evidence, verification has
@@ -29,11 +30,11 @@ worktree are **evidence**.
29
30
 
30
31
  1. **Claim**: the conclusion an agent writes in its report (least trustworthy).
31
32
  2. **Checkable artefact**: commits, test files, log files, diffs.
32
- 3. **Independent verification**: the result the PM gets by running the same commands on **another checkout** (most
33
- trustworthy).
33
+ 3. **Independent verification**: the result a non-implementer verifier gets by running the same commands on **another
34
+ checkout** prepared by the PM (most trustworthy).
34
35
 
35
- Any "passes/done" has to land in layers 2 and 3. The acceptance commands in a brief plus the PM's `team review` are
36
- the implementation of that chain.
36
+ Any "passes/done" has to land in layers 2 and 3. The acceptance commands in a brief plus the verifier's `team review`
37
+ are the implementation of that chain; the PM independently reads and compares the evidence and diff.
37
38
 
38
39
  ## 3. Isolation: worktree + branch + a long-lived cwd
39
40
 
@@ -42,8 +43,10 @@ the implementation of that chain.
42
43
  (CEP has been there).
43
44
  - Why not "one worktree per task": sessions fragment, and both follow-up questions and resuming from a checkpoint get
44
45
  harder; a long-lived worktree lets the agent keep its memory.
45
- - The main worktree (main) belongs to the PM alone: merges, verification and documentation happen there, so nobody
46
- fights an agent over the workspace.
46
+ - The main worktree (main) belongs to the PM alone: merges, evidence acceptance and documentation happen there, so
47
+ nobody fights an agent over the workspace. The only worker-side exception is that `team review`, invoked by the
48
+ assigned verifier from its own worktree, writes the brief-named `docs/team/reviews/<ID>.md` and `<ID>-verify.log`
49
+ plus its existing runtime bookkeeping. This grants no manual main edits or other paths.
47
50
  - **A merged branch is deleted at once.** Landing is `merge --squash` + commit + push, then `close`, then
48
51
  `git branch -D <branch>`: the commit on `main` is the deliverable and the branch is only the vehicle. Nothing of
49
52
  value lives only on a branch, and keeping them turns the branch list into an archeology site (134 branches removed
@@ -71,7 +74,10 @@ Guards and limitations:
71
74
  never falls back to `send-keys`, and a failed enqueue is logged while the inbox line stays.
72
75
  - The inbox is transient state (gitignored); the durable record is still the report + verification + decision log.
73
76
  - **Settles inside one stretch of work become one line, not one line each**: consecutive notices with the same
74
- merge key (seat, task, state class, `awaiting=` set) fold into the line at the end of the inbox file, which then
77
+ merge key (seat, task, state class, `awaiting=` set, delivered revision) fold into the line at the end of the
78
+ inbox file. The last component is the twelve-character `tip=` only for delivered lines, or one shared no-revision
79
+ marker when no tip can be proven; suspended and interrupted progress ignore tips and keep merging. Different
80
+ delivered tips start separate lines and wake once each; same-tip events merge without another wake. A merged line
75
81
  carries `×N first=<ISO> last=<ISO>` and the **field values of the last event** (`tip=`, `branch=`, `uncommitted=`).
76
82
  The line is a **window summary**, not the seat's current state: `last=` names the event whose revision it
77
83
  describes, and the run's earlier events are read from the detail file with `team inbox <agent> --detail` (raw
@@ -129,7 +135,11 @@ Guards and limitations:
129
135
  it, a harvested job stays silent, several finishing jobs arrive as one message, and every turn end appends
130
136
  `settled-with-unharvested=<n>` to `state/bg.log` (runbook: `workflows.md` §E2).
131
137
  - **The identity record** (P159): the extension writes `state/bg/<id>.job` **before** it returns the id — `id`,
132
- `pid`, `pgid`, `start` (the start-time fingerprint from `/proc/<pid>/stat`), `cwd`, `log`, `cmd`.
138
+ `pid`, `pgid`, `start` (the start-time fingerprint from `/proc/<pid>/stat`), `session_cwd`, `cwd`, `log`, `cmd`.
139
+ `session_cwd` is the absolute initiating session directory; `cwd` remains the command's execution directory and
140
+ may be an independent checkout. Suspension ownership uses only `session_cwd` after the same live
141
+ `(pid, start-time)` validation. A legacy record without that field is accepted only when `cwd` resolves exactly
142
+ to the seat worktree; relative, missing, foreign, subdirectory and independent-checkout paths belong to no seat.
133
143
  `team bg list` prints one row per record of **this** project's state directory and signals nothing;
134
144
  `team bg stop <id>` signals exactly the recorded job and prints what it signalled. Identity is
135
145
  `(pid, start-time)`: the pid must be alive **and** the fingerprint must match, so a reused pid is refused
@@ -646,8 +656,8 @@ A trap: an add/add conflict is often git's rename detection pairing two differen
646
656
  refuses and explains why);
647
657
  2. **Read-only observation**: `roster` / `digest` show the branch, dirty file count, commits ahead and a
648
658
  "waiting to be wrapped up" list;
649
- 3. **Verification evidence**: `review <ID> --dir <the checkout the PM prepared>` runs the gates and writes
650
- `reviews/<ID>.md` (git is prepared by the PM).
659
+ 3. **Verification evidence**: the assigned non-implementer verifier runs `review <ID> --dir <the checkout the PM
660
+ prepared>`; the tool writes the named central `reviews/<ID>.md` and companion log (git is prepared by the PM).
651
661
  - The conventions (written in SKILL.md and the project's PROTOCOL, for the PM to follow): one long-lived worktree per
652
662
  agent; task branches cut off the protected branch; verification on a detached independent checkout; merging =
653
663
  squashing into the protected branch (with a PR, merge the PR first and then `fetch + merge --ff-only`);
@@ -829,9 +839,10 @@ what it cannot judge (P148's rule); an unchanged tree adds no stdout at all. The
829
839
  `tests/flip-p158.sh` (four cases plus two `--break=` shadows), and suite section `0i` runs it.
830
840
 
831
841
  **How often the full suite runs (2026-09-23, user directive).** The full suite takes 13-20 minutes and the
832
- machine runs one at a time, so it is a *milestone* gate, not a per-change habit: a task runs it **once at
833
- delivery** (not per batch), a review runs it **once**, and the PM runs it on the protected branch **only at
834
- archive/release milestones** - per merge it reads the delivered run plus CI. A change whose diff touches no
842
+ machine runs one at a time, so it is a *milestone* gate, not a per-change habit: an implementation worker runs it
843
+ **once at delivery** (not per batch), the assigned verifier runs it **once per applicable review**, and a delegated
844
+ non-PM worker runs it on the protected branch **only at archive/release milestones** — per merge the PM reads the
845
+ delivered run plus CI and never substitutes a PM-owned background gate for delegation. A change whose diff touches no
835
846
  product path (for example records under `docs/**` only) needs **no** suite run: say so in the report and let
836
847
  the guarded FAST set (or nothing) stand as the evidence. When in doubt prefer FAST plus the affected
837
848
  sections and name what you did not run; **never** claim a full run you did not do. Which sections a changed path affects is