@caddis/cli 0.4.51 → 0.4.53

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 (100) hide show
  1. package/bundles/antigravity-plugin/CADDIS-GLOSSARY.md +1 -0
  2. package/bundles/antigravity-plugin/plugin.json +1 -1
  3. package/bundles/antigravity-plugin/repo_freshness.py +132 -5
  4. package/bundles/antigravity-plugin/scripts/caddis_checkout_guard.py +223 -0
  5. package/bundles/antigravity-plugin/scripts/caddis_docs_pr.py +284 -0
  6. package/bundles/antigravity-plugin/scripts/caddis_exit.py +2 -0
  7. package/bundles/antigravity-plugin/scripts/caddis_frontmatter.py +1 -0
  8. package/bundles/antigravity-plugin/scripts/caddis_gate.py +226 -195
  9. package/bundles/antigravity-plugin/scripts/caddis_glossary.py +3 -3
  10. package/bundles/antigravity-plugin/scripts/caddis_governor.py +48 -4
  11. package/bundles/antigravity-plugin/scripts/caddis_inventory.py +38 -0
  12. package/bundles/antigravity-plugin/scripts/caddis_lanes.py +294 -127
  13. package/bundles/antigravity-plugin/scripts/caddis_lineage_publish.py +458 -0
  14. package/bundles/antigravity-plugin/scripts/caddis_merge_chain.py +237 -0
  15. package/bundles/antigravity-plugin/scripts/caddis_notify.py +121 -0
  16. package/bundles/antigravity-plugin/scripts/caddis_prod_check.py +380 -0
  17. package/bundles/antigravity-plugin/scripts/caddis_redact.py +99 -0
  18. package/bundles/antigravity-plugin/scripts/caddis_relay_git.py +2 -2
  19. package/bundles/antigravity-plugin/scripts/caddis_review.py +1309 -0
  20. package/bundles/antigravity-plugin/scripts/caddis_roadmap.py +2056 -0
  21. package/bundles/antigravity-plugin/scripts/caddis_roadmap_run.py +2572 -0
  22. package/bundles/antigravity-plugin/scripts/caddis_routing.py +3 -2
  23. package/bundles/antigravity-plugin/scripts/caddis_rows.py +476 -0
  24. package/bundles/antigravity-plugin/scripts/caddis_spawn.py +8 -9
  25. package/bundles/antigravity-plugin/scripts/caddis_spend.py +415 -0
  26. package/bundles/antigravity-plugin/scripts/caddis_tidy.py +357 -20
  27. package/bundles/antigravity-plugin/scripts/caddis_todo.py +55 -0
  28. package/bundles/antigravity-plugin/scripts/caddis_workstreams.py +178 -19
  29. package/bundles/antigravity-plugin/scripts/caddis_worktree_close.py +349 -0
  30. package/bundles/antigravity-plugin/scripts/check_doc_coverage.py +0 -56
  31. package/bundles/antigravity-plugin/scripts/claudster_doctor.py +1 -1
  32. package/bundles/antigravity-plugin/scripts/enforcement_inventory.py +0 -1
  33. package/bundles/antigravity-plugin/scripts/oss_review.py +2 -2
  34. package/bundles/antigravity-plugin/scripts/roadmap-recheck.ps1 +89 -0
  35. package/bundles/antigravity-plugin/scripts/roadmap-run.ps1 +88 -0
  36. package/bundles/antigravity-plugin/scripts/setup_project_ai.py +86 -2
  37. package/bundles/antigravity-plugin/session_end_agy.py +3 -3
  38. package/bundles/antigravity-plugin/skills/_registry.md +2 -6
  39. package/bundles/antigravity-plugin/skills/best-practices/agents/best-practices-referencer.md +1 -1
  40. package/bundles/antigravity-plugin/skills/best-practices/agents/codebase-context-builder.md +1 -1
  41. package/bundles/antigravity-plugin/skills/best-practices/agents/task-intent-analyzer.md +1 -1
  42. package/bundles/antigravity-plugin/skills/catchup/SKILL.md +7 -0
  43. package/bundles/antigravity-plugin/skills/cloud-phases/SKILL.md +1 -1
  44. package/bundles/antigravity-plugin/skills/cross-review/SKILL.md +5 -2
  45. package/bundles/antigravity-plugin/skills/feature-plan/SKILL.md +29 -83
  46. package/bundles/antigravity-plugin/skills/handoff/SKILL.md +77 -48
  47. package/bundles/antigravity-plugin/skills/implement/SKILL.md +87 -147
  48. package/bundles/antigravity-plugin/skills/migrate-dir/SKILL.md +1 -1
  49. package/bundles/antigravity-plugin/skills/mmr/SKILL.md +5 -2
  50. package/bundles/antigravity-plugin/skills/office-documents-official/SKILL.md +24 -0
  51. package/bundles/antigravity-plugin/skills/park/SKILL.md +0 -1
  52. package/bundles/antigravity-plugin/skills/pr-merge/SKILL.md +8 -14
  53. package/bundles/antigravity-plugin/skills/prd/SKILL.md +2 -10
  54. package/bundles/antigravity-plugin/skills/roadmap/SKILL.md +259 -0
  55. package/bundles/antigravity-plugin/skills/roadmap/assets/plan-resume-prompt.md +77 -0
  56. package/bundles/antigravity-plugin/skills/roadmap/assets/render-check.template.mjs +68 -0
  57. package/bundles/antigravity-plugin/skills/roadmap/assets/review-protocol.md +78 -0
  58. package/bundles/antigravity-plugin/skills/roadmap/assets/roadmap.template.md +32 -0
  59. package/bundles/antigravity-plugin/skills/roadmap/assets/value-check.template.py +161 -0
  60. package/bundles/antigravity-plugin/skills/ship/SKILL.md +14 -14
  61. package/bundles/antigravity-plugin/skills/ship-merge/SKILL.md +6 -0
  62. package/bundles/antigravity-plugin/skills/ship-pr/SKILL.md +33 -14
  63. package/bundles/antigravity-plugin/skills/spawn-session/SKILL.md +4 -8
  64. package/bundles/antigravity-plugin/warm_start_agy.py +1 -3
  65. package/bundles/antigravity-plugin-extras/plugin.json +1 -1
  66. package/bundles/antigravity-plugin-extras/skills/_registry.md +1 -2
  67. package/bundles/antigravity-plugin-extras/skills/agent-orchestration/SKILL.md +5 -5
  68. package/bundles/antigravity-plugin-extras/skills/cross-review/SKILL.md +5 -2
  69. package/bundles/antigravity-plugin-extras/skills/runner-move/SKILL.md +214 -0
  70. package/bundles/codex/.codex/skills/docs/office-documents-official/SKILL.md +24 -0
  71. package/bundles/codex/.codex/skills/workflow/best-practices/agents/best-practices-referencer.md +1 -1
  72. package/bundles/codex/.codex/skills/workflow/best-practices/agents/codebase-context-builder.md +1 -1
  73. package/bundles/codex/.codex/skills/workflow/best-practices/agents/task-intent-analyzer.md +1 -1
  74. package/bundles/codex/.codex/skills/workflow/roadmap/SKILL.md +259 -0
  75. package/bundles/codex/.codex/skills/workflow/roadmap/assets/plan-resume-prompt.md +77 -0
  76. package/bundles/codex/.codex/skills/workflow/roadmap/assets/render-check.template.mjs +68 -0
  77. package/bundles/codex/.codex/skills/workflow/roadmap/assets/review-protocol.md +78 -0
  78. package/bundles/codex/.codex/skills/workflow/roadmap/assets/roadmap.template.md +32 -0
  79. package/bundles/codex/.codex/skills/workflow/roadmap/assets/value-check.template.py +161 -0
  80. package/bundles/codex/AGENTS.md +5 -4
  81. package/bundles/manifest.json +3 -3
  82. package/package.json +1 -1
  83. package/bundles/antigravity-plugin/skills/advisory-hub/SKILL.md +0 -233
  84. package/bundles/antigravity-plugin/skills/advisory-hub/reference/context-template.md +0 -214
  85. package/bundles/antigravity-plugin/skills/advisory-hub/reference/hub-handbook.md +0 -233
  86. package/bundles/antigravity-plugin/skills/advisory-hub/reference/report-contract.md +0 -94
  87. package/bundles/antigravity-plugin/skills/advisory-hub/reference/succession.md +0 -118
  88. package/bundles/antigravity-plugin/skills/resume/SKILL.md +0 -6
  89. package/bundles/antigravity-plugin/skills/review/SKILL.md +0 -6
  90. package/bundles/antigravity-plugin/skills/spawn-hub/SKILL.md +0 -341
  91. package/bundles/antigravity-plugin/skills/statusline/SKILL.md +0 -6
  92. package/bundles/antigravity-plugin/skills/validate-phase/SKILL.md +0 -143
  93. package/bundles/antigravity-plugin-extras/skills/data-lineage/SKILL.md +0 -158
  94. package/bundles/antigravity-plugin-extras/skills/data-lineage/scripts/convert_doc_to_confluence.py +0 -1430
  95. package/bundles/antigravity-plugin-extras/skills/golden-plan/SKILL.md +0 -586
  96. package/bundles/codex/.codex/skills/workflow/advisory-hub/SKILL.md +0 -233
  97. package/bundles/codex/.codex/skills/workflow/advisory-hub/reference/context-template.md +0 -214
  98. package/bundles/codex/.codex/skills/workflow/advisory-hub/reference/hub-handbook.md +0 -233
  99. package/bundles/codex/.codex/skills/workflow/advisory-hub/reference/report-contract.md +0 -94
  100. package/bundles/codex/.codex/skills/workflow/advisory-hub/reference/succession.md +0 -118
@@ -13,9 +13,8 @@ The plan file is the **durable spine of the harness** — it must let any future
13
13
  agent, on any tool) resume with zero re-discovery. Optimize for that.
14
14
 
15
15
  ## Headless mode
16
- When the invocation contains the marker **`HEADLESS RUN RULES`**, **or `CADDIS_HEADLESS` /
17
- `DOCKET_PLAN` / `DOCKET_BRANCH` is set in the environment** (the caddis OSS launchers export
18
- `CADDIS_HEADLESS` on claude's `-p`/`--print`; the docket runner sets the others) — a non-interactive
16
+ When the invocation contains the marker **`HEADLESS RUN RULES`**, **or `CADDIS_HEADLESS` is set in
17
+ the environment** (the caddis OSS launchers export it on claude's `-p`/`--print`) — a non-interactive
19
18
  caller spawned this session and no human is present, so the scope-check questions and any interview are
20
19
  **suspended and forbidden**. This mode exists for one-line ideas: the card may be a short title with **no
21
20
  description**, and there may be **no codebase, PROJECT-FACTS, or prior PRD** to read. That is expected —
@@ -39,13 +38,6 @@ Absolute rules in this mode (they override everything below):
39
38
  a bullet under `## Constraints & decisions` — never a question to the user.
40
39
  - **Honor the caller's output path and slug** (falling back to `.caddis/plans/<feature-slug>.md`);
41
40
  set `feature: <slug>` in the frontmatter to that slug.
42
- - **Also emit a visual companion** — a self-contained, scannable HTML page at `<artifact_dir>/<slug>.html`
43
- presenting the plan visually (a goal card, phases as cards with their steps, an affected-files table,
44
- and a risks/decisions section). **Use inline `<style>` ONLY** — the visual is rendered in a *sandboxed*
45
- iframe with no script execution, so a `<script>`/CDN (e.g. the Tailwind browser CDN) would NOT run and
46
- the page would appear unstyled. Keep it fully portable — no external `<script>`/`<link>`, no local
47
- asset files, no `/`-rooted paths. This is the visual the human reviews in docket alongside the markdown.
48
- Write it after the `.md`; the runner finds it by the matching `<slug>.html` name.
49
41
  - **Always write the plan file, then end with exactly one fenced `json` highlights block** — nothing
50
42
  after it:
51
43
  ```json
@@ -63,7 +55,7 @@ exists instead of assumed. If the work fits comfortably in one session, say so a
63
55
  instead of planning. Only produce a plan for genuinely multi-phase work.
64
56
 
65
57
  ### Evidence gate — do not write plan content while a BLOCKER is unresolved
66
- Absorbed from `golden-plan`, whose strongest idea this is, and the direct counter to the failure
58
+ This is the direct counter to the failure
67
59
  mode that makes a plan dangerous: **you write the spec, so you cannot see its gaps.** A phase built
68
60
  on guessed field names or an imagined API is confidently wrong, passes every completeness check,
69
61
  and only fails at the exit gate — or worse, doesn't.
@@ -164,9 +156,11 @@ of that role and write its Lane line as follows:
164
156
  - `sonnet`: `claude — /model sonnet`
165
157
  - `claude`: `claude — this session`
166
158
  - `codex`: codex — `codex exec --ephemeral --sandbox workspace-write "HEADLESS RUN RULES. Read <plan path> and its Constraints. Implement Phase N only in the current checkout. Do not switch or create branches, commit, push, or edit files outside this phase. Run its exit gate and report the literal result."`
167
- - `agy`: agy — `agy --mode accept-edits --dangerously-skip-permissions --add-dir . --print-timeout 20m --output-format text -p "HEADLESS RUN RULES. Read <plan path> and its Constraints. Implement Phase N only in the current checkout. Do not switch or create branches, commit, push, or edit files outside this phase. Run its exit gate and report the literal result."`
159
+ - `agy`: agy — `python "${CLAUDE_PLUGIN_ROOT}/scripts/caddis_spend.py" run --caller lane-pN -- agy --mode accept-edits --dangerously-skip-permissions --add-dir . --print-timeout 20m --output-format json -p "HEADLESS RUN RULES. Read <plan path> and its Constraints. Implement Phase N only in the current checkout. Do not switch or create branches, commit, push, or edit files outside this phase. Run its exit gate and report the literal result."`
168
160
 
169
- Replace `<plan path>` and `N` with this plan's path and phase number. If the routing command fails
161
+ Replace `<plan path>` and `N` (also in `lane-pN`) with this plan's path and phase number. The agy line
162
+ always starts with `caddis_spend.py run`: it books the call against the global EUR spend cap, and
163
+ `caddis_gate.py lane-check` refuses a bare `agy` Lane line. If the routing command fails
170
164
  or exits 3, use `claude — this session` and state the reason in that phase.
171
165
 
172
166
  #### A phase may take a no-escalation lane only if its exit gate would fail on a spec error
@@ -186,14 +180,9 @@ internal repo path into stakeholder-facing copy, and set a `live` status flag th
186
180
  framework's own "Soon" badge). `tsc` clean, 632/632 tests green, cross-review CLEAN, exit gate
187
181
  satisfied. A headless run following it literally would have committed both, entirely green.
188
182
 
189
- In an Advisory-Hub plan, treat your lane as **provisional**: the Hub writes each `phase-NN.prompt.md`
190
- before the phase runs, and that is the first time anyone but the spec's author reads it. Let that
191
- read confirm or downgrade the lane. It costs nothing — the prompt is being written anyway.
192
-
193
183
  ### Group phases into MILESTONES — only when the plan is big enough
194
184
  **Add milestones when the plan has ~8+ phases OR spans multiple sessions.** Below that, phases and a
195
- Tracker are enough; a three-phase feature gains nothing from ceremony. (Same sizing instinct as the
196
- Advisory-Hub test, deliberately — one threshold to remember, not two.)
185
+ Tracker are enough; a three-phase feature gains nothing from ceremony.
197
186
 
198
187
  A milestone is **a group of phases that ship together**. It answers "what lands when this is done?",
199
188
  which is the question a long plan otherwise leaves the executor guessing at.
@@ -211,9 +200,10 @@ resuming session can see at a glance which group it is in and what remains befor
211
200
  ### Flag high-risk phases (`risk:` — a marker, not a mechanism)
212
201
  Each phase may carry **`risk: normal|high`** (default `normal` — omit the line unless the phase is
213
202
  `high`), meaning only "this is a phase where a wrong answer is expensive" — security/authz, a
214
- correctness-critical algorithm, an ambiguous spec, or an irreversible change. It is **inert**: it
215
- selects no model, spawns no agents, and implies no fan-out — it exists so the executor can decide **at
216
- runtime** whether an extra cross-check is worth it. Do not emit orchestration, lane fan-out, or
203
+ correctness-critical algorithm, an ambiguous spec, or an irreversible change. It selects no model and
204
+ implies no fan-out. It has one effect: the roadmap/plan runner reviews a finished `risk: high` phase
205
+ twice (`caddis_review.py --plan --phase --runs 2`), gives it one fix session on blocking
206
+ findings, and stops `BLOCKED review` when findings remain. Roadmap mode reviews before it publishes the PR. Do not emit orchestration, lane fan-out, or
217
207
  `Workflow` scripts from this command; the runtime decision rules and the intent→model map live in one
218
208
  place, the `agent-orchestration` skill's *Multi-model fan-out* section.
219
209
 
@@ -275,7 +265,10 @@ yourself (relay + Tracker) before stopping — do not hand back "run `/caddis:ha
275
265
  Three rules: one attempt, one review.
276
266
  1. **Think before you send.** Before a task goes to any coder, write its edge cases and check the facts it depends on (one query or one file read).
277
267
  2. **Run it before review.** The coder runs the same checks as CI (name the exact commands in the task). Then run the change once on real data.
278
- 3. **Review once.** Use whatever reviewer is available. Stop at the first CLEAN. After two blocking reviews, ask the owner.
268
+ 3. **Review by tier.** Run `python "${CLAUDE_PLUGIN_ROOT}/scripts/caddis_gate.py" review-tier --range <base>...HEAD` (add `--plan <plan> --phase <N>` inside a plan; no `TIER:` line means tier 2).
269
+ Tier 0: gates only. Tier 1-small: your self-check only. Tier 1: one review by another vendor; stop at
270
+ the first CLEAN. Tier 2: two reviewers of two other vendors, in one round. Fix blocking findings only;
271
+ park the rest. Re-review only the fix diff, and only when the fix changed logic. After 3 rounds, ask the owner.
279
272
 
280
273
  - One phase at a time: read this plan → run the phase on its **Lane** → RED→GREEN→VERIFY→CROSS-REVIEW→
281
274
  COMMIT → update the **Tracker** row. The Tracker is the resume signal for every future session.
@@ -293,6 +286,10 @@ Three rules: one attempt, one review.
293
286
  normally; the halt stops anything being **built on top of it** before a human has looked. Blast
294
287
  radius stays one reviewable, revertable commit. Halting *beforehand* buys nothing: the phase has
295
288
  to be executed either way, and a well-specced high-risk phase is as executable as any other.
289
+ One exception: when the session prompt says the runner reviews `risk: high` phases (the
290
+ runner's `plan-resume-prompt.md` says so), the runner's review gate replaces this halt: the
291
+ session ends `STATUS: CONTINUE`, and the runner reviews the phase twice before anything builds
292
+ on it. A headless marker (`CADDIS_HEADLESS=1`) alone does not lift the halt.
296
293
  4. **A failed or blocked phase** — tests red, exit gate unmet, or the plan turned out wrong. Stop;
297
294
  do not build on it.
298
295
  - **A lane change is NOT a halt.** `/caddis:implement` spawns the assigned lane itself and verifies
@@ -366,66 +363,15 @@ done:
366
363
 
367
364
  If any phase relies on the implementer *reasoning out* a gap, close the gap in the plan now.
368
365
 
369
- ## Step 3b — Does this plan need an Advisory Hub? (ask once, here)
370
-
371
- The Advisory Hub is **opt-in per plan**, gated on a single file: `<plan-stem>-advisory-context.md`
372
- beside the plan. `/caddis:implement`, `/caddis:handoff` and `/caddis:validate-phase` all check for it;
373
- **no file → no behaviour change, ever.** But nothing has ever *asked* whether to create it, so the
374
- pattern only ever gets used by someone who already knows it exists. This step closes that gap.
375
-
376
- **Ask it here** — at the end of planning is the only moment the phase count, risk levels and session
377
- boundaries are all known.
378
-
379
- > **You MUST call `Skill(advisory-hub)` and read *"When it earns its keep"* before deciding.**
380
- > Do not decide from memory, and do not decide from any summary — including one in this file.
381
- > The test is stated in exactly one place on purpose: two copies of a rule drift on the first edit,
382
- > and the copy that used to live here had already drifted. It compressed the REQUIRED leg to the
383
- > phrase *"expensive-to-reverse"* and dropped the enumeration that defines it — which reads as
384
- > *"can I `git revert` this?"*, and under that reading a plan that publishes € figures to business
385
- > stakeholders scores "no stakes". That is the one leg that fires on reporting, analytics and
386
- > dashboard work, i.e. most of what this fleet builds. Load the skill.
387
-
388
- If the test passes, tell the user plainly what it costs and what it buys, and offer to scaffold the
389
- context doc from the `advisory-hub` skill's template. **Do not create it silently** — an opt-in
390
- pattern that switches itself on is no longer opt-in.
391
-
392
- **In headless mode, never offer and never create.** Headless forbids asking anything, so an "offer"
393
- is impossible there. Instead record the result as a line under `## Constraints & decisions` —
394
- *"Advisory Hub: test passed (N phases, <criteria>) — not scaffolded, headless run; create
395
- `<plan-stem>-advisory-context.md` to enable"* — so the decision reaches a human rather than being
396
- silently dropped or silently taken.
397
-
398
- If it does not pass, say nothing **to the user** — a three-phase feature should never hear about
399
- this. But **always record the determination in the plan, pass or fail**: one line under
400
- `## Constraints & decisions`, naming which REQUIRED trigger was or was not hit.
401
-
402
- > `Advisory Hub: not applicable — no REQUIRED trigger (not a migration / security change /
403
- > production data correctness / numbers published to stakeholders).`
404
-
405
- ### If the test FAILS but this repo already runs a Hub for another plan
406
-
407
- Check for an existing `*-advisory-context.md` in `.caddis/plans/` belonging to a **different** plan.
408
- If one exists, add a second line under `## Constraints & decisions`:
409
-
410
- > `Hub conventions: this repo runs Advisory Hub for <other-plan>. This plan does NOT — if it borrows
411
- > the phase-NN.prompt.md / .report.md / CONTINUE GATE conventions, the lightweight rule applies: the
412
- > session that files a report must not write the next prompt without an independent re-check.`
413
-
414
- **Why this line exists.** A repo with one Hub plan has its artefacts sitting there as the most recent
415
- example of "how we structure a multi-session plan here", and the next plan copies them by analogy.
416
- It inherits the file names and none of the safety, because the safety was never in the names.
417
- Measured once already: an implementing session filed its own batch report and then wrote the next
418
- batch's prompt in the same session, with nobody having looked in between. Nothing was wrong that
419
- time — and nothing checked either.
420
-
421
- This is the cheapest possible place to catch it: when the second plan is created, before any
422
- artefact-mimicry has happened. See *"Failing this test correctly does not mean no discipline"* in the
423
- `advisory-hub` skill for the rule itself. Do not restate the rule here — one home, or the copies
424
- drift.
425
-
426
- Silent to the human, auditable in the artifact. "Say nothing" once meant *leave no trace anywhere*,
427
- and a wrong negative was then invisible — no line in the plan, no line in the chat, nothing for
428
- anyone to challenge. A rule whose failures leave no artifact cannot be reviewed.
366
+ A `risk: high` phase gets two independent review runs: run by the roadmap/plan runner automatically (from caddis-next Phase 11), and by hand in an interactive `/caddis:implement` run (`caddis_review.py --plan <plan> --phase <n> --runs 2`, from Phase 10). Only a `blocking` finding fails that review (exit 1); `should-fix` and `nit` findings go on a follow-up list and do not stop the merge. A phase gets 3 completed review rounds (a run that did not complete uses none); the 4th ends with exit 5, "stop, the owner decides". The advisory hub is retired; do not plan a separate validation session.
367
+
368
+ ## Programme triggers
369
+
370
+ Small work that does not meet a trigger skips its block.
371
+
372
+ **Trigger: Always.** Add one open-work row for the plan in `.caddis/open-work.md`. Set its cells with `python "${CLAUDE_PLUGIN_ROOT}/scripts/caddis_rows.py" set --file <open-work.md> --id <row id> --col Status=todo`, never with a regex edit.
373
+
374
+ **Trigger: The plan records a decision.** Record it with `/caddis:decide`.
429
375
 
430
376
  ## Step 4 — Report
431
377
  Output the plan path (`.caddis/plans/<feature-slug>.md`), the phase list (one line each, with each
@@ -8,6 +8,42 @@ description: End-of-session handoff — capture exact state so the next session
8
8
  You are ending a work session. Produce/refresh this workstream's resume doc (`.caddis/relay/<name>.md`) so the next session
9
9
  (you, a future you, or another agent on any tool) can resume immediately. This is the anti-context-rot checkpoint.
10
10
 
11
+ ## Step 0 — is this a shared checkout?
12
+ Another session may have uncommitted edits in this checkout. A handoff that commits here can carry
13
+ them into its commit, so check first, before Step 1.
14
+
15
+ 1. Write this session's own files to a temp file: copy the list under `## Files changed this session`
16
+ in `.caddis/session-state/<session-id>.md` (the `` - `path` `` lines can be copied as they are).
17
+ No state file or no list means an empty file.
18
+ 2. Run:
19
+ ```
20
+ python "${CLAUDE_PLUGIN_ROOT}/scripts/caddis_checkout_guard.py" shared --root . --own-files <temp-file>
21
+ ```
22
+ It prints `SHARED: yes <reason>` or `SHARED: no` and exits 0. It says yes when the root `AGENTS.md`
23
+ has a line `Shared checkout: yes`, or when `git status` lists a path this session did not change.
24
+ 3. **On `SHARED: no`,** do the steps below as written.
25
+ 4. **On `SHARED: yes`,** write NO tracked file in this checkout. Run:
26
+ ```
27
+ python "${CLAUDE_PLUGIN_ROOT}/scripts/caddis_docs_pr.py" start --repo .
28
+ ```
29
+ It makes a new worktree from `origin/<default>` on a `docs/handoff-<utc>` branch and prints
30
+ `WORKTREE: <path>`. That worktree is this session's only; no other session's edits can enter it.
31
+ Then, in the steps below:
32
+ - Step 1: tell the `knowledge-transfer` subagent to edit files ONLY under the `WORKTREE:` path.
33
+ - Step 3, point 4: run `caddis_rows.py set --file <worktree>/.caddis/open-work.md ...`, and make the
34
+ plan's Tracker edit in `<worktree>/.caddis/plans/<feature>.md`, not in this checkout.
35
+ - Step 4: skip `caddis_tidy.py --apply` (report `skipped: shared checkout`).
36
+ - Step 6b: skip `session_state.py prune` (report `skipped: shared checkout`).
37
+ - The relay stays in this checkout: `.caddis/relay/` is local and gitignored.
38
+ After Step 6b, run:
39
+ ```
40
+ python "${CLAUDE_PLUGIN_ROOT}/scripts/caddis_docs_pr.py" finish --worktree <path> --title "docs(handoff): <name> session notes" --body "Handoff doc edits from a shared checkout."
41
+ ```
42
+ It commits only the worktree's changed files, pushes, opens a PR, and prints `PR: <url>` and one
43
+ `FILE: <path>` line per file (or `PR: none` when nothing changed). It always removes the worktree, and
44
+ it never merges. On a failure it prints `PATCH: <path>` with the edits; report that path. Put the
45
+ `PR:` line and the file list in your final report, under `Docs PR needed:`.
46
+
11
47
  ## Step 1 — capture learnings FIRST (knowledge-transfer)
12
48
  **Before** gathering git signals or writing relay.md, decide on `knowledge-transfer` — and the default
13
49
  is to run it.
@@ -36,7 +72,7 @@ committed before its generator last changed. Paste the parts a next session need
36
72
  them from memory.
37
73
 
38
74
  **Why this step is mechanical.** A handover used to be composed from what the outgoing session
39
- remembered, so it was only ever as complete as that memory. Bringing one Hub to a usable state took
75
+ remembered, so it was only ever as complete as that memory. Bringing one successor session to a usable state took
40
76
  nine corrective round trips and the user caught six of them — including *"the handover listed no
41
77
  reports, documents, KB notes or scripts"*. None of those are judgement calls; every one is a
42
78
  directory listing. An agent recalls **what it did**; a generator enumerates **what exists**, and
@@ -53,39 +89,7 @@ clean phase boundary and lose or double-do the work.
53
89
  tracker shows plan A in progress, but the work moved to plan B), suggest the user run `/digress` to park
54
90
  plan A on the workstream stack — so its exact resume point survives and `/catchup [name]` can pop it back later.
55
91
 
56
- ## Step 2b — Advisory-Hub handoff audit (conditional — skip silently if not applicable)
57
-
58
- **Trigger:** the active plan found in Step 2 has a sibling `<slug>-advisory-context.md`. **No such file
59
- → skip this step entirely and silently** — no extra work on an ordinary handoff.
60
-
61
- > **First, say which command the user actually wants.** A context doc means a Hub is running, and
62
- > handing over a Hub is `/caddis:spawn-hub`, not this command. The two look interchangeable from
63
- > outside and are not: `/handoff` writes a resume doc for the same workstream, while `spawn-hub`
64
- > ends the Hub's tenure, runs the mechanical audit, conserves the carried-open ledger, and files
65
- > `hub-NN.spawn.md` in `.caddis/advisory-hub-reports/`. Tell the user plainly, then continue only if
66
- > they still want a plain handoff.
67
-
68
- **Why it is a distinct step:** a context doc is written *before* the work happens, so it is **always
69
- stale by the time it is needed**. The outgoing Hub's instinct is always "yes, this doc is designed for
70
- exactly this" — **that instinct has been measured and found wrong**: a real audit found seven gaps in a
71
- context file the outgoing Hub believed was current, including the single highest-value technique the Hub
72
- had developed by then.
73
-
74
- **Do not ask "are there gaps?" Assume there are, and find them mechanically** (full detail: the
75
- `advisory-hub` skill's §G):
76
- 1. **List every technique, decision, and correction you actually used this session** — from your own
77
- actions in this transcript, not by re-reading the context doc.
78
- 2. **For each, check whether the context doc's instruction itself already covers it** — not whether the
79
- word appears. Would a fresh Hub, reading only that file, be told to do the same thing?
80
- 3. **The caveat that will burn you:** a literal-string grep over prose produces **false MISSINGs**. A
81
- `0 matches` result means "this exact string isn't here," not "this isn't covered." **Read the section
82
- before believing a 0-match grep.**
83
- 4. **Land every real gap as a durable rule** in the right section of the advisory-context, carrying the
84
- specific failure that earned it — a note left for later is not a fix.
85
-
86
- Record the outcome in relay.md's `## Learnings captured` line (below).
87
-
88
- ## Step 2c — was any of it the harness?
92
+ ## Step 2b — was any of it the harness?
89
93
 
90
94
  <!-- shared:harness-friction-question — keep byte-identical across commands; a test pins it -->
91
95
  **One question, asked here because here is where you are already reflecting.** The observations
@@ -111,7 +115,7 @@ Nothing to say is the normal answer. Say nothing and move on — this must not b
111
115
  > `session_id` and `--session-id`. Never guess one: a wrong id disables session matching.
112
116
  >
113
117
  > 1. **Name the workstream** (active plan's `feature`, else the branch; the script prints nothing
114
- > on the default branch with no plan — then ask the user for a short name):
118
+ > on the default branch with no plan — run `caddis_workstreams.py list` (`python "${CLAUDE_PLUGIN_ROOT}/scripts/caddis_workstreams.py" list`) to show existing workstreams, then ask the user which one to use or for a short name):
115
119
  > `python "${CLAUDE_PLUGIN_ROOT}/scripts/caddis_workstreams.py" resolve --plan <feature> --branch <branch> --default-branch <main>`
116
120
  > 2. **Legacy repo:** if `.caddis/relay.md` exists and does not start with
117
121
  > `<!-- caddis-workstream-index-v1 -->`, or an old `/digress` stack `.caddis/workstreams.json`
@@ -120,11 +124,21 @@ Nothing to say is the normal answer. Say nothing and move on — this must not b
120
124
  > to the user and stop.
121
125
  > 3. **Read the stored version's hash** before you compose: `caddis_workstreams.py hash <name>`
122
126
  > (prints `none` for a new workstream).
123
- > 4. **Write** the relay below to a temp file, then
124
- > `caddis_workstreams.py write <name> <temp-file> --expected-hash <hash>`. Exit 1 means another
125
- > session changed the relay since step 3: it prints the diff and writes nothing. Show the diff,
126
- > merge by hand, and retry with the new hash. Never force it.
127
- > 5. **Refresh the index:** `caddis_workstreams.py render-index --session-id <id> --branch <branch>`.
127
+ > 4. **Open-work rows** (only when `.caddis/open-work.md` exists and its frontmatter says
128
+ > `type: open-work`): first set each row this session
129
+ > finished, by id and column name, never by hand:
130
+ > `python "${CLAUDE_PLUGIN_ROOT}/scripts/caddis_rows.py" set --file .caddis/open-work.md --id <row id> --col Status=done --col Evidence=<evidence>`.
131
+ > In a shared checkout (Step 0), use `--file <worktree>/.caddis/open-work.md` instead.
132
+ > **Order of work:** when the repo has a roadmap (`caddis_roadmap.py list` prints a slug), the
133
+ > roadmap on origin is the order of work. Write the relay's "Next step (exact)" as
134
+ > `next: top open item of roadmap <slug> (caddis_roadmap.py status --roadmap <slug>)`. Never copy a
135
+ > list of open items into the relay.
136
+ > 5. **Write** the relay below to a temp file, then
137
+ > `python "${CLAUDE_PLUGIN_ROOT}/scripts/caddis_workstreams.py" put <name> <temp-file> --require-status --expected-hash <hash>`.
138
+ > It refuses a relay whose last line is not a valid status line (see "Programme triggers" below).
139
+ > Exit 1 also means another session changed the relay since step 3: it prints the diff and writes
140
+ > nothing. Show the diff, merge by hand, and retry with the new hash. Never force it.
141
+ > 6. **Refresh the index:** `caddis_workstreams.py render-index --session-id <id> --branch <branch>`.
128
142
  >
129
143
  > (Source checkout: `scripts/caddis_workstreams.py`.) A repo still on the pre-rename `.claudster/`
130
144
  > won't see this relay until it's converted — `/caddis:migrate-dir` does that.
@@ -154,6 +168,7 @@ generated:
154
168
  <The single next action. Include the command/phase. Add a fallback if blocked.>
155
169
 
156
170
  ## Read first on resume
171
+ Paths are relative to the repo root.
157
172
  - `<path>` — why it matters
158
173
  - `.caddis/plans/<feature>.md` — the plan + tracker
159
174
 
@@ -165,18 +180,26 @@ generated:
165
180
 
166
181
  ## Learnings captured
167
182
  knowledge-transfer: <✓ ran → files written | ✗ skipped → reason>
168
- advisory-context audit: <N candidates → M gaps → landed in <path>> | n/a (no advisory-context for this plan)
169
183
 
170
184
  ## Resume prompt
171
185
  \`\`\`
172
186
  Read .caddis/relay/<name>.md, then the plan it points to. Continue from <phase/step>. Next action: <exact>.
173
187
  \`\`\`
188
+
189
+ STATUS: <CONTINUE | OWNER-GATE <P>-OG<n> | BLOCKED <owner> | FAILED <reason>>
174
190
  ```
175
191
 
192
+ ## Programme triggers
193
+
194
+ Small work that does not meet a trigger skips its block.
195
+
196
+ **Trigger: Always.** The relay ends with a status line, the last non-empty line, and it is exactly one of `STATUS: CONTINUE`, `STATUS: OWNER-GATE <P>-OG<n>`, `STATUS: BLOCKED <owner>` or `STATUS: FAILED <reason>`. In Step 3, point 5, write the relay with `python "${CLAUDE_PLUGIN_ROOT}/scripts/caddis_workstreams.py" put <name> <temp-file> --require-status --expected-hash <hash>` instead of `write` (in short: put --require-status), with the same hash Step 3 read, so a peer's newer relay is never overwritten. It rejects a relay with no valid status line, and renders the index. When the repo has `.caddis/open-work.md` with `type: open-work` in its frontmatter, also set each open-work row's status with `python "${CLAUDE_PLUGIN_ROOT}/scripts/caddis_rows.py" set --file <open-work.md> --id <row id> --col Status=<status>` (in a shared checkout, the copy in the Step 0 worktree). When the status is `done`, also pass `--col Evidence=<commit, PR or test>`: caddis_rows.py refuses `done` with no Evidence.
197
+
176
198
  ## Step 4 — tidy finished artifacts
177
199
  Flip any plan/prompt's frontmatter `status:` to `done` (or `superseded`) if this session actually
178
200
  finished it — that is your judgment call; the script below never makes it and never auto-flips
179
- status. Then run:
201
+ status. In a shared checkout (Step 0), make the `status:` flip in the Step 0 worktree copy of the plan,
202
+ never in this checkout. Then run (skip it in a shared checkout, Step 0: it moves tracked files):
180
203
  ```
181
204
  python "${CLAUDE_PLUGIN_ROOT}/scripts/caddis_tidy.py" --apply
182
205
  ```
@@ -184,7 +207,13 @@ python "${CLAUDE_PLUGIN_ROOT}/scripts/caddis_tidy.py" --apply
184
207
  skip this step** — it degrades open, same as the other machine gates; an older install must not
185
208
  be blocked by a script it does not have. Include its report in your output. A **collision**
186
209
  (`done/<name>` already exists) is reported by the script, not fatal — surface it, do not fail the
187
- handoff over it.
210
+ handoff over it. Exit 2 means a plan is held because its Tracker still has open rows (`held (open Tracker rows): ...` lines, from Phase 3): show those lines; finish, park (`.caddis/parking-lot/<file>.md` in the row) or mark the rows `dropped: <reason>`, or set the plan status back. Do not fail the handoff over it.
211
+
212
+ After step 4, for each item this session closed (a phase `<plan>#<n>`, a plan slug, or an open-work row id), run `mentions` to check whether another relay's Next step still names it:
213
+ ```
214
+ python "${CLAUDE_PLUGIN_ROOT}/scripts/caddis_workstreams.py" mentions --item "<item>" --except <name>
215
+ ```
216
+ Print a `WARNING:` line per hit (`WARNING: relay <other> still names closed item <item> in its Next step`). Never edit another workstream's relay (`caddis_workstreams.py mentions` only reads).
188
217
 
189
218
  ## Step 5 — check the handover you just wrote
190
219
 
@@ -197,7 +226,7 @@ report that repo's paths as missing, which is the tool being right about the wro
197
226
 
198
227
  It fails when the handover names a file that does not exist. The incoming session has **no other
199
228
  source** for those paths, so it cannot tell a typo from a real file: one live handover sent an
200
- incoming Hub looking for a prompt that was never written. Fix what it lists, then re-run.
229
+ incoming session looking for a prompt that was never written. Fix what it lists, then re-run.
201
230
 
202
231
  It also notes any generated artefact committed before its generator last changed. That is advisory,
203
232
  not blocking — but do not quote a report the note names without rebuilding it first.
@@ -219,7 +248,8 @@ python "${CLAUDE_PLUGIN_ROOT}/scripts/session_state.py" prune
219
248
  `usage` finds this session's transcript by its id and appends one token-and-skill record to
220
249
  `.caddis/usage-log.jsonl`, which `/usage-review` reads. Pass `--transcript <path>` if you know the
221
250
  path and it is not under the Claude config folder. `prune` keeps the newest 8 files in
222
- `.caddis/session-state/`; run it after Step 6, which reads this session's file. Include the
251
+ `.caddis/session-state/`; run it after Step 6, which reads this session's file. Skip `prune` in a
252
+ shared checkout (Step 0). Include the
223
253
  `[USAGE]` line in your output. Both always exit 0; if the script is missing, skip this step.
224
254
 
225
255
  Then list old local state (falls back to `scripts/caddis_tidy.py`; skip if missing):
@@ -247,10 +277,9 @@ On the other machine, `/catchup <name>` fetches it.
247
277
  order: (1) interrupted mid-phase work → finish + commit it; else (2) the active plan's next not-started
248
278
  phase; else (3) the top open question/decision. Everything else is context, not the next step.
249
279
  - Only verified facts and real paths. Mark anything unconfirmed as `Unknown`.
250
- - Update the plan's tracker rows too (status + last commit) — relay and tracker must agree.
280
+ - Update the plan's tracker rows too (status + last commit) — relay and tracker must agree. In a shared
281
+ checkout, edit the Tracker in the Step 0 worktree, never in this checkout.
251
282
  - Don't commit unless asked. Report which `.caddis/relay/<name>.md` was written and the one next action.
252
- - **Never hand off a Hub session on the strength of "the context doc is designed for this."** That is the
253
- one instinct that has been measured and found wrong. Run Step 2b's audit instead.
254
283
  - **Prune the Done section — two rules, both apply:**
255
284
  1. **Merge-based:** Phases already merged to `main` (confirmed by a tag or commit) must be compressed
256
285
  to a single line: `- **RW-N**: merged to main as vYYYY.MM.DD.N (<commit>) ✅`. Only the current