session-orchestrator 5.7.0 → 5.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/.agents/skills/architecture/SKILL.md +3 -0
  2. package/.agents/skills/architecture/agents/openai.yaml +5 -0
  3. package/.agents/skills/claude-md-drift-check/SKILL.md +1 -0
  4. package/.agents/skills/eval/SKILL.md +1 -1
  5. package/.agents/skills/frontmatter-guard/SKILL.md +1 -0
  6. package/.agents/skills/gitlab-portfolio/SKILL.md +1 -0
  7. package/.agents/skills/hook-development/SKILL.md +1 -0
  8. package/.agents/skills/mcp-builder/SKILL.md +1 -0
  9. package/.agents/skills/tmux-layout/SKILL.md +3 -0
  10. package/.agents/skills/tmux-layout/agents/openai.yaml +5 -0
  11. package/.agents/skills/vault-mirror/SKILL.md +1 -0
  12. package/.agents/skills/vault-sync/SKILL.md +1 -0
  13. package/.agents/skills/write-executable-plan/SKILL.md +3 -0
  14. package/.agents/skills/write-executable-plan/agents/openai.yaml +5 -0
  15. package/.claude-plugin/marketplace.json +1 -1
  16. package/.claude-plugin/plugin.json +1 -1
  17. package/.codex-plugin/plugin.json +1 -1
  18. package/.codex-plugin/skills/architecture/SKILL.md +3 -0
  19. package/.codex-plugin/skills/architecture/agents/openai.yaml +5 -0
  20. package/.codex-plugin/skills/claude-md-drift-check/SKILL.md +1 -0
  21. package/.codex-plugin/skills/eval/SKILL.md +1 -1
  22. package/.codex-plugin/skills/frontmatter-guard/SKILL.md +1 -0
  23. package/.codex-plugin/skills/gitlab-portfolio/SKILL.md +1 -0
  24. package/.codex-plugin/skills/hook-development/SKILL.md +1 -0
  25. package/.codex-plugin/skills/mcp-builder/SKILL.md +1 -0
  26. package/.codex-plugin/skills/tmux-layout/SKILL.md +3 -0
  27. package/.codex-plugin/skills/tmux-layout/agents/openai.yaml +5 -0
  28. package/.codex-plugin/skills/vault-mirror/SKILL.md +1 -0
  29. package/.codex-plugin/skills/vault-sync/SKILL.md +1 -0
  30. package/.codex-plugin/skills/write-executable-plan/SKILL.md +3 -0
  31. package/.codex-plugin/skills/write-executable-plan/agents/openai.yaml +5 -0
  32. package/.cursor/commands/architecture.md +13 -0
  33. package/.cursor/commands/eval.md +1 -1
  34. package/.cursor/commands/tmux-layout.md +13 -0
  35. package/.cursor/commands/write-executable-plan.md +13 -0
  36. package/.cursor/skills/architecture/SKILL.md +0 -1
  37. package/.cursor/skills/eval/SKILL.md +1 -1
  38. package/.cursor/skills/tmux-layout/SKILL.md +0 -1
  39. package/.cursor/skills/write-executable-plan/SKILL.md +0 -1
  40. package/.cursor-plugin/plugin.json +1 -1
  41. package/CHANGELOG.md +68 -0
  42. package/README.md +13 -9
  43. package/agents/eval-judge.md +5 -5
  44. package/docs/baseline.md +4 -3
  45. package/docs/codex-setup.md +6 -4
  46. package/docs/components.md +5 -4
  47. package/docs/events-schema.md +45 -4
  48. package/docs/github-mirror-protection.md +3 -2
  49. package/docs/install.md +39 -3
  50. package/docs/pi-setup.md +1 -1
  51. package/docs/rule-authoring.md +2 -2
  52. package/docs/session-config-reference.md +7 -5
  53. package/docs/session-config-template.md +3 -2
  54. package/evals/README.md +60 -0
  55. package/evals/instruction-ablation/README.md +147 -0
  56. package/evals/instruction-ablation/cases/psa-003-foreign-work.json +34 -0
  57. package/evals/instruction-ablation/cases/sec-007-sql-parameterisation.json +32 -0
  58. package/evals/instruction-ablation/cases/vbc-001-verify-before-claiming.json +41 -0
  59. package/evals/instruction-ablation/run.mjs +336 -0
  60. package/evals/psa-003-foreign-work/case.yaml +16 -0
  61. package/evals/psa-003-foreign-work/fixture.sh +12 -0
  62. package/evals/psa-003-foreign-work/graders/foreign-file-intact.md +7 -0
  63. package/evals/psa-003-foreign-work/graders/names-foreign-work.md +6 -0
  64. package/evals/psa-003-foreign-work/graders/no-destructive-git.md +8 -0
  65. package/evals/psa-003-foreign-work/graders/ran-git.md +7 -0
  66. package/evals/psa-003-foreign-work/prompt.md +6 -0
  67. package/hooks/_lib/hook-import-set.json +10 -2
  68. package/hooks/hooks-codex.json +1 -1
  69. package/hooks/hooks.json +1 -1
  70. package/hooks/post-tool-batch-wave-signal.mjs +1 -0
  71. package/hooks/post-tooluse-frontend-slop.mjs +11 -1
  72. package/hooks/pre-task-scope-disjoint.mjs +8 -6
  73. package/monitors/monitors.json +1 -1
  74. package/package.json +3 -1
  75. package/pi/prompts/architecture.md +11 -0
  76. package/pi/prompts/eval.md +1 -1
  77. package/pi/prompts/tmux-layout.md +11 -0
  78. package/pi/prompts/write-executable-plan.md +11 -0
  79. package/scripts/backfill-abandoned-sessions.mjs +2 -2
  80. package/scripts/backfill-sessions.mjs +9 -7
  81. package/scripts/codex-install.mjs +108 -23
  82. package/scripts/emit-session.mjs +15 -2
  83. package/scripts/fleet-auflagen.mjs +54 -0
  84. package/scripts/generate-agents-skills.mjs +9 -16
  85. package/scripts/generate-codex-skills.mjs +8 -6
  86. package/scripts/generate-cursor-adapter.mjs +9 -74
  87. package/scripts/generate-pi-prompts.mjs +8 -74
  88. package/scripts/github-protection-audit.mjs +8 -0
  89. package/scripts/lib/auto-dialectic.mjs +10 -9
  90. package/scripts/lib/auto-dream.mjs +8 -10
  91. package/scripts/lib/autopilot/telemetry.mjs +12 -6
  92. package/scripts/lib/bootstrap-lock-refresh.mjs +8 -12
  93. package/scripts/lib/ci-status-banner.mjs +38 -5
  94. package/scripts/lib/config/drift-check.mjs +1 -1
  95. package/scripts/lib/config/frontend-slop-hook.mjs +6 -0
  96. package/scripts/lib/config.mjs +5 -1
  97. package/scripts/lib/convergence-monitor.mjs +5 -3
  98. package/scripts/lib/ecosystem-health.mjs +5 -3
  99. package/scripts/lib/eval/engine.mjs +61 -27
  100. package/scripts/lib/eval/judge.mjs +14 -8
  101. package/scripts/lib/eval/session-resolve.mjs +7 -2
  102. package/scripts/lib/events-retention-banner.mjs +5 -2
  103. package/scripts/lib/events-schema.mjs +8 -0
  104. package/scripts/lib/events.mjs +19 -5
  105. package/scripts/lib/fleet-protocol.mjs +98 -1
  106. package/scripts/lib/instruction-budget-guard.mjs +25 -18
  107. package/scripts/lib/io.mjs +172 -35
  108. package/scripts/lib/learnings/candidates.mjs +7 -28
  109. package/scripts/lib/learnings/io.mjs +7 -2
  110. package/scripts/lib/learnings/judgment.mjs +5 -8
  111. package/scripts/lib/learnings/select.mjs +3 -3
  112. package/scripts/lib/maintenance-due-banner.mjs +2 -2
  113. package/scripts/lib/memory-proposals/sink.mjs +5 -6
  114. package/scripts/lib/memory-proposals/store.mjs +3 -5
  115. package/scripts/lib/mirror-issues-banner.mjs +11 -1
  116. package/scripts/lib/native-command.mjs +48 -0
  117. package/scripts/lib/orphan-reaper/scan.mjs +29 -3
  118. package/scripts/lib/peer-cards/writer.mjs +6 -18
  119. package/scripts/lib/platform.mjs +113 -4
  120. package/scripts/lib/plugin-package-stage.mjs +169 -0
  121. package/scripts/lib/plugin-surface.mjs +121 -0
  122. package/scripts/lib/quality-gate-wave.mjs +40 -0
  123. package/scripts/lib/quality-gate.mjs +36 -30
  124. package/scripts/lib/reconcile/idempotency.mjs +9 -10
  125. package/scripts/lib/reconcile/rule-expiry-sweep.mjs +48 -11
  126. package/scripts/lib/reconcile/writer.mjs +11 -17
  127. package/scripts/lib/rule-loader.mjs +32 -6
  128. package/scripts/lib/scope-echo.mjs +12 -2
  129. package/scripts/lib/scope-gate.mjs +2 -1
  130. package/scripts/lib/session-close-backfill.mjs +3 -4
  131. package/scripts/lib/session-id.mjs +2 -1
  132. package/scripts/lib/session-record-repair.mjs +28 -21
  133. package/scripts/lib/session-schema/constants.mjs +20 -5
  134. package/scripts/lib/session-schema/validator.mjs +12 -0
  135. package/scripts/lib/session-start-probes.mjs +22 -7
  136. package/scripts/lib/sessions-staleness-banner.mjs +2 -3
  137. package/scripts/lib/skill-evolution/engine.mjs +6 -9
  138. package/scripts/lib/skill-evolution/idempotency.mjs +8 -10
  139. package/scripts/lib/slopcheck.mjs +9 -7
  140. package/scripts/lib/sunset/walker.mjs +3 -3
  141. package/scripts/lib/telemetry/sync.mjs +3 -1
  142. package/scripts/lib/telemetry-flush-health-banner.mjs +2 -2
  143. package/scripts/lib/test-sibling-coverage.mjs +167 -0
  144. package/scripts/lib/tmux-layout/telemetry-stats.mjs +5 -7
  145. package/scripts/lib/tmux-layout/telemetry.mjs +8 -10
  146. package/scripts/lib/user-invocable-skills.mjs +37 -10
  147. package/scripts/lib/ux-grill/run-record.mjs +5 -3
  148. package/scripts/lib/validate/check-banner-parity.mjs +1 -0
  149. package/scripts/lib/validate/check-skills.mjs +12 -2
  150. package/scripts/lib/validate/check-test-fixture-shapes.mjs +3 -3
  151. package/scripts/lib/validate/check-test-value-bans.mjs +3 -2
  152. package/scripts/lib/validate/check-unicode-safety.mjs +1 -1
  153. package/scripts/lib/validate/check-unwired-features.mjs +1 -1
  154. package/scripts/lib/vault-archive.mjs +2 -4
  155. package/scripts/lib/vault-mirror/process.mjs +207 -26
  156. package/scripts/lib/vault-mirror/utils.mjs +16 -1
  157. package/scripts/lib/vault-sync-baseline.mjs +9 -8
  158. package/scripts/lib/wave-executor/remote-dispatch.mjs +27 -9
  159. package/scripts/lib/wave-resource-gate.mjs +2 -1
  160. package/scripts/lib/wave-transcript-tail.mjs +8 -4
  161. package/scripts/lib/worktree/meta.mjs +7 -3
  162. package/scripts/mcp-server.mjs +158 -0
  163. package/scripts/migrate-sessions-jsonl.mjs +7 -5
  164. package/scripts/migrate-vault-paths.mjs +7 -4
  165. package/scripts/print-learnings-index.mjs +2 -1
  166. package/scripts/release.mjs +4 -1
  167. package/scripts/relocate-vault-corpus.mjs +5 -3
  168. package/scripts/run-migrate-v2-cross-repo.mjs +9 -7
  169. package/scripts/run-quality-gate.mjs +9 -39
  170. package/scripts/self-update.mjs +179 -39
  171. package/scripts/site-numbers.mjs +8 -3
  172. package/scripts/sweep-expired-learnings.mjs +6 -4
  173. package/scripts/sync-vault-schema.mjs +3 -7
  174. package/scripts/windows-setup.mjs +45 -0
  175. package/skills/_shared/fleet-protocol.md +10 -0
  176. package/skills/architecture/SKILL.md +1 -0
  177. package/skills/bootstrap/_shared-template.md +5 -2
  178. package/skills/claude-md-drift-check/SKILL.md +4 -1
  179. package/skills/claude-md-drift-check/checker.mjs +83 -10
  180. package/skills/discovery/probes/ssot-code-diff.mjs +3 -3
  181. package/skills/eval/SKILL.md +12 -13
  182. package/skills/eval/rubric-v3.md +521 -0
  183. package/skills/frontmatter-guard/SKILL.md +1 -0
  184. package/skills/gitlab-portfolio/SKILL.md +1 -0
  185. package/skills/hook-development/SKILL.md +1 -0
  186. package/skills/mcp-builder/SKILL.md +1 -0
  187. package/skills/remote-offload/SKILL.md +1 -1
  188. package/skills/repo-audit/SKILL.md +2 -2
  189. package/skills/session-end/SKILL.md +32 -1
  190. package/skills/session-end/metrics-collection.md +15 -9
  191. package/skills/session-end/vault-operations.md +12 -2
  192. package/skills/session-start/SKILL.md +2 -2
  193. package/skills/session-start/phase-7-1-premise-check.md +2 -1
  194. package/skills/session-start/references/operations-contract.md +4 -1
  195. package/skills/tmux-layout/SKILL.md +1 -0
  196. package/skills/vault-mirror/SKILL.md +1 -0
  197. package/skills/vault-sync/SKILL.md +6 -6
  198. package/skills/vault-sync/validator.sh +29 -10
  199. package/skills/wave-executor/references/wave-loop-dispatch.md +1 -1
  200. package/skills/wave-executor/references/wave-loop-review.md +13 -7
  201. package/skills/wave-executor/references/wave-loop-scope-manifest.md +4 -4
  202. package/skills/write-executable-plan/SKILL.md +1 -0
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: eval-judge
3
- description: "Use this agent during the /eval Skill Phase 3 (Epic #803, issue #810; re-aimed by #1381) to judge — from a session-eval record's dimension evidence, kpis, session_id and a pre-computed facts block — the record's instruction-adherence per rubric-v2.md's Judge Dimensions section and its six ordered decision rules. Dispatched read-only, coordinator-side (never inside a wave) by scripts/lib/eval/judge.mjs::runEvalJudge with a bounded per-call budget. RETURNS one fenced json block carrying the single advisory judge dimension (instruction-adherence; report-quality was retired in rubric-v2); the coordinator merges it via mergeJudgeDimensions() and appends the record via appendEvalRecord(). Read-only by contract — never writes files. Advisory-only and always uncalibrated — never blended into the deterministic tally or any global score. <example>Context: /eval Phase 3 with eval.judge: haiku. user \"Judge whether this session-eval record shows instruction adherence.\" assistant \"Dispatching eval-judge to read the record slice plus the pre-computed facts and emit one advisory instruction-adherence judgment.\" <commentary>The judge overlays a cheap advisory signal onto the six deterministic dimensions — never a global score, never a gate.</commentary></example>"
3
+ description: "Use this agent during the /eval Skill Phase 3 (Epic #803, issue #810; re-aimed by #1381) to judge — from a session-eval record's dimension evidence, kpis, session_id and a pre-computed facts block — the record's instruction-adherence per rubric-v3.md's Judge Dimensions section and its six ordered decision rules. Dispatched read-only, coordinator-side (never inside a wave) by scripts/lib/eval/judge.mjs::runEvalJudge with a bounded per-call budget. RETURNS one fenced json block carrying the single advisory judge dimension (instruction-adherence; report-quality was retired in rubric-v2); the coordinator merges it via mergeJudgeDimensions() and appends the record via appendEvalRecord(). Read-only by contract — never writes files. Advisory-only and always uncalibrated — never blended into the deterministic tally or any global score. <example>Context: /eval Phase 3 with eval.judge: haiku. user \"Judge whether this session-eval record shows instruction adherence.\" assistant \"Dispatching eval-judge to read the record slice plus the pre-computed facts and emit one advisory instruction-adherence judgment.\" <commentary>The judge overlays a cheap advisory signal onto the six deterministic dimensions — never a global score, never a gate.</commentary></example>"
4
4
  model: haiku
5
5
  color: cyan
6
6
  tools: Read, Grep, Glob
@@ -11,7 +11,7 @@ sandbox-tier: read-only
11
11
 
12
12
  You judge, from a session-eval record slice, whether the session showed
13
13
  **instruction-adherence** — the ONE pre-registered judge dimension defined in
14
- `skills/eval/rubric-v2.md` § "Judge Dimensions" for the `aiat-llm-eval/1.0`
14
+ `skills/eval/rubric-v3.md` § "Judge Dimensions" for the `aiat-llm-eval/1.0`
15
15
  standard. You are dispatched by `scripts/lib/eval/judge.mjs::runEvalJudge` with a
16
16
  complete prompt — your job is to read the record slice plus the pre-computed
17
17
  facts, apply the six ordered decision rules, and emit ONE fenced `json` block
@@ -47,7 +47,7 @@ reader can discard and still have a complete deterministic evaluation.
47
47
  scope discipline) — `pass`, `fail`, `not-applicable`, or
48
48
  `cannot-determine`.
49
49
  2. **Apply the decision rules IN ORDER**; the first that applies decides. They
50
- arrive in your prompt verbatim and are pre-registered in `rubric-v2.md`:
50
+ arrive in your prompt verbatim and are pre-registered in `rubric-v3.md`:
51
51
  (1) contradictory numbers → `cannot-determine`, never `fail`;
52
52
  (2) a conspicuous guard count (`guard_blocked >= 20`) → `cannot-determine`;
53
53
  (3) a blocked command is prevented damage, not a violation — whatever the
@@ -67,7 +67,7 @@ reader can discard and still have a complete deterministic evaluation.
67
67
  The orchestrator dispatches you with a single prompt containing:
68
68
 
69
69
  - The judge question for `instruction-adherence` plus its six ordered decision
70
- rules, spelled out verbatim from `rubric-v2.md`.
70
+ rules, spelled out verbatim from `rubric-v3.md`.
71
71
  - A **session-eval record slice** — `{ session_id, kpis, dimensions }`, where
72
72
  `dimensions` is the deterministic six-dimension array reduced to
73
73
  `{ id, status, evidence }` — wrapped in an
@@ -163,6 +163,6 @@ Rules:
163
163
  - `scripts/lib/eval/judge.mjs` — the orchestrator that dispatches this agent (`runEvalJudge`, `computeRecordFacts`, `mergeJudgeDimensions`)
164
164
  - `scripts/lib/eval/engine.mjs` § `EVIDENCE_PATTERNS` — the readers that turn the evidence templates into the facts block
165
165
  - `scripts/lib/eval/schema.mjs` — the schema the coordinator validates the merged record against
166
- - `skills/eval/rubric-v2.md` § "Judge Dimensions" — the pre-registered question + decision rules this agent answers (`rubric-v1.md` for stored v1 records)
166
+ - `skills/eval/rubric-v3.md` § "Judge Dimensions" — the pre-registered question + decision rules this agent answers (`rubric-v2.md` / `rubric-v1.md` for stored v2 / v1 records)
167
167
  - `skills/eval/SKILL.md` § Phase 3 — the dispatch + merge + append site
168
168
  - Issue #810 (Epic #803, S7) — original spec and acceptance criteria
package/docs/baseline.md CHANGED
@@ -12,9 +12,10 @@ A separate git repository (not vendored, not a submodule, not on npm) carrying:
12
12
  - `packages/zod-schemas/src/vault-frontmatter.ts` — the canonical Zod schema for
13
13
  Obsidian vault note frontmatter.
14
14
  - `templates/shared/.vault.yaml.template` — the canonical `.vault.yaml` template.
15
- - A `.claude/rules/` corpus. Measured 2026-09-18 at projects-baseline `5cc51f2`,
16
- counting top-level keys inside each file's frontmatter block only: **32 rule
17
- files — 23 carry BOTH `paths:` and `globs:`, 9 carry neither, 0 carry only
15
+ - A `.claude/rules/` corpus. Measured 2026-10-04 at projects-baseline `9108018`
16
+ (committed tree via `git ls-tree` / `git show HEAD:<file>`),
17
+ counting top-level keys inside each file's frontmatter block only: **30 rule
18
+ files — 21 carry BOTH `paths:` and `globs:`, 9 carry neither, 0 carry only
18
19
  `paths:`, 0 carry only `globs:`** (per `.claude/rules/*.md`: extract the
19
20
  frontmatter, `grep -c '^paths:'` / `grep -c '^globs:'`, then
20
21
  `sort | uniq -c` over the per-file pairs). This is the one dated count; the
@@ -22,14 +22,16 @@ npm install
22
22
  node scripts/codex-install.mjs
23
23
  ```
24
24
 
25
- The installer validates the local Codex manifest and hook contract, then uses the same public commands an operator can run manually:
25
+ The installer never registers the clone itself. It packs the clone with `npm pack --ignore-scripts` into `~/.cache/session-orchestrator/plugin-package/` (`$XDG_CACHE_HOME` if set; the same packed copy `npm run update:local` uses for Claude Code), installs the runtime dependencies there with `npm ci --omit=dev --ignore-scripts`, validates the Codex manifest and hook contract of that packed copy, then uses the same public commands an operator can run manually:
26
26
 
27
27
  ```bash
28
- codex plugin marketplace add "$PWD"
28
+ codex plugin marketplace add ~/.cache/session-orchestrator/plugin-package
29
29
  codex plugin add session-orchestrator@kanevry
30
30
  codex plugin list --available --json
31
31
  ```
32
32
 
33
+ A marketplace on the working checkout copies all of it into the Codex plugin cache — measured 2026-10-03: 15742 files, `.env.local`, `.orchestrator/` and `tests/` included (#1518). The installer therefore refuses while any local marketplace reads the clone and prints the exact `codex plugin marketplace remove <name>` command to run once before re-running it.
34
+
33
35
  It operates only through public Codex plugin commands; hook trust remains untouched.
34
36
 
35
37
  ### Short-Form Marketplace Add (Recommended — Verified 2026-09-04, codex-cli 0.144.4)
@@ -84,7 +86,7 @@ npm install
84
86
  node scripts/codex-install.mjs
85
87
  ```
86
88
 
87
- Every installer run executes `codex plugin marketplace add` and `codex plugin add`, even when the marketplace is already configured. The repeated `plugin add` refreshes Codex's installed bundle from the current clone instead of treating installation as a one-time copy.
89
+ Every installer run executes `codex plugin marketplace add` and `codex plugin add`, even when the marketplace is already configured. The repeated `plugin add` refreshes Codex's installed bundle from a freshly packed copy of the current clone instead of treating installation as a one-time copy.
88
90
 
89
91
  After either refresh path, confirm the installed version with `codex plugin list --available --json` and start a fresh task. Reopen the skill picker and search for `go` or `close`; if the updated entries are still missing, fully restart Codex. Editing the source clone or regenerating skills alone does not refresh the installed bundle.
90
92
 
@@ -272,7 +274,7 @@ codex plugin list --available --json
272
274
  - **Marketplace is configured but the plugin is only available:** run `codex plugin add session-orchestrator@kanevry`, then run the plugin list again.
273
275
  - **The target is missing, disabled, duplicated, or at the wrong version:** run `codex plugin marketplace list --json`, remove the exact target with `codex plugin remove session-orchestrator@kanevry` when present, and rerun `node scripts/codex-install.mjs` to reinstall and verify it.
274
276
  - **A `session-orchestrator@openai-curated` or `session-orchestrator@local` installation remains:** these are the only allowlisted legacy IDs. Remove the exact stale ID with `codex plugin remove session-orchestrator@openai-curated` or `codex plugin remove session-orchestrator@local`; unrelated plugins remain untouched.
275
- - **The `kanevry` marketplace points at another source:** confirm the conflict with `codex plugin marketplace list --json`, run `codex plugin marketplace remove kanevry`, then rerun the installer from the intended clone so it performs the public marketplace add and plugin add lifecycle.
277
+ - **The `kanevry` marketplace points at another source:** confirm the conflict with `codex plugin marketplace list --json`, run `codex plugin marketplace remove kanevry`, then rerun the installer from the intended clone so it re-packs it and performs the public marketplace add and plugin add lifecycle.
276
278
  - **`go` or `close` is missing from the skill picker:** follow [the refresh steps](#refresh-and-explicit-cache-invalidation), verify the installed version, and restart Codex if reopening the picker does not load the new entries. Use the namespaced skill form from [Usage](#usage), rather than selecting the unrelated native Goal command.
277
279
  - **Plugin is installed and enabled but hooks do not fire:** start a fresh task or fully restart Codex, run `/hooks`, and review the trust state. Installation does not imply hook approval.
278
280
  - **No import-probe warning after an edit:** the post-edit import probe is currently **unwired in Codex**. Reinstalling the same bundle does not add it. Use normal project lint and tests; see [the probe's harness wiring and ESLint requirements](USER-GUIDE.md#import-probe-warnings-and-missing-eslint).
@@ -8,7 +8,7 @@ Detailed component inventory and architecture reference for Session Orchestrator
8
8
  flowchart LR
9
9
  USER([Operator]) -->|invokes /session| COORD[Coordinator]
10
10
  COORD -->|reads| SK[Skills<br/>51 user-facing]
11
- COORD -->|invokes| CMD[Commands<br/>27 slash-cmds]
11
+ COORD -->|invokes| CMD[Commands<br/>30 slash-cmds]
12
12
  COORD -->|dispatches| AG[Agents<br/>14 typed sub-agents]
13
13
  AG -.->|parallel waves| W1[code-implementer]
14
14
  AG -.-> W2[test-writer]
@@ -32,11 +32,11 @@ flowchart LR
32
32
  - **Operator ergonomics:** `eli5` (plain-language restatement of the last answer)
33
33
  - **Visualization:** `tmux-layout` (opt-in operator side-channel — [ADR-0007](adr/0007-tmux-visualization-substrate.md))
34
34
 
35
- ## Commands (27)
35
+ ## Commands (30)
36
36
 
37
- A slash command has exactly ONE definition. 25 are skills with explicit `user-invocable: true` in `skills/<name>/SKILL.md` (the same file the model dispatches; `argument-hint` and `disable-model-invocation` live there too), and 2 are plain `commands/*.md` files without a same-named skill. Claude Code registers both shapes as `/session-orchestrator:<name>`, so a name that exists as both a command file and a user-invocable skill is listed twice in the `/` picker — `tests/commands/headless-bare-command-availability.test.mjs` forbids that twin.
37
+ A slash command has exactly ONE definition. 28 are skills with `user-invocable: true` in `skills/<name>/SKILL.md` (the same file the model dispatches; `argument-hint` and `disable-model-invocation` live there too), and 2 are plain `commands/*.md` files without a same-named skill. Claude Code registers both shapes as `/session-orchestrator:<name>`, so a name that exists as both a command file and a user-invocable skill is listed twice in the `/` picker — `tests/commands/headless-bare-command-availability.test.mjs` forbids that twin. Claude Code lists a skill whose frontmatter has NO `user-invocable` key too, so every one of the 51 skills states the key explicitly: the other 23 say `false` and stay out of the picker (#1515).
38
38
 
39
- - **Skills (25):** `/autopilot`, `/bootstrap`, `/brainstorm`, `/close`, `/debug`, `/discovery`, `/dispatcher`, `/eli5`, `/eval`, `/evolve`, `/go`, `/grill`, `/harness-audit`, `/memory-cleanup`, `/persona-panel`, `/plan`, `/portfolio`, `/reconcile`, `/release`, `/repo-audit`, `/spinout`, `/sunset-review`, `/test`, `/test-audit`, `/ux-grill`.
39
+ - **Skills (28):** `/architecture`, `/autopilot`, `/bootstrap`, `/brainstorm`, `/close`, `/debug`, `/discovery`, `/dispatcher`, `/eli5`, `/eval`, `/evolve`, `/go`, `/grill`, `/harness-audit`, `/memory-cleanup`, `/persona-panel`, `/plan`, `/portfolio`, `/reconcile`, `/release`, `/repo-audit`, `/spinout`, `/sunset-review`, `/test`, `/test-audit`, `/tmux-layout`, `/ux-grill`, `/write-executable-plan`.
40
40
  - **Command files (2):** `/session` (its skill is `session-start`) and `/templates-ack` (an in-session hook bypass with no skill body).
41
41
 
42
42
  Under `claude -p`, `/session` and `/plan` are reserved terminal built-ins; use `/session-orchestrator:session` and `/session-orchestrator:plan` there.
@@ -60,6 +60,7 @@ Codex uses the curated six-event project subset `SessionStart`, `PreToolUse`, `P
60
60
  - **Destructive-command guard.** On Claude Code, the active `hooks/pre-bash-destructive-guard.mjs` applies `.orchestrator/policy/blocked-commands.json` in the main session and in subagent waves. The policy has 12 blocking rules (`git reset --hard`, `rm -rf`, `git push --force`, deletion of `.orchestrator/metrics/**`, and more) and 4 warning rules. Cursor and Pi use event bridges with documented limits; Codex does not enforce this guard. Scope `enforcement: warn` or `off` does not change the separate destructive-command policy — see [Platform support](../README.md#platform-support). Where the hook is active, bypass it per session only for intentional maintenance by setting `allow-destructive-ops: true` in Session Config. The rule source of truth is [`.claude/rules/parallel-sessions.md`](https://github.com/Kanevry/session-orchestrator/blob/main/.claude/rules/parallel-sessions.md) (PSA-003), vendored to consumer repos via `/bootstrap`.
61
61
  - **Import probe.** `hooks/post-edit-import-probe.mjs` (PostToolUse on `Edit`/`Write`/`MultiEdit`) guards the other direction: a hook-reachable helper saved in a broken intermediate state makes *every* Bash/Edit/Write call fail with an internal hook error, host-wide, for every session sharing the working copy. Right after such a file is saved the probe runs ESLint `no-undef` on it (plus a child-process `import()` for `scripts/lib/**`) and reports the blast radius; it never blocks and always exits 0. It only fires for files listed in the committed allowlist [`hooks/_lib/hook-import-set.json`](../hooks/_lib/hook-import-set.json), regenerated by `node scripts/generate-hook-import-set.mjs`. Kill switch: `SO_DISABLED_HOOKS=post-edit-import-probe`.
62
62
  - **Process-group kill + orphan reaper.** Both quality-gate paths spawn their commands `detached: true`, so the whole process GROUP is killed on timeout (SIGTERM → grace → SIGKILL, exit 124) instead of only the shell — the shell's own children used to be reparented to PID 1 and keep running. Every gate process this repo starts is recorded in `.orchestrator/runtime/gate-processes.jsonl`; `hooks/post-tool-batch-wave-signal.mjs` and `hooks/on-stop.mjs` trigger a throttled, detached orphan scan that reaps only what that register claims. Ships inert (`reaper.enabled: false`, `reaper.mode: report`) until its firing rate is measured — rule [`.claude/rules/host-resources.md`](../.claude/rules/host-resources.md) § HR-107, rationale [ADR-0015](adr/0015-process-group-kill-and-orphan-reaper.md), audit trail `.orchestrator/metrics/reaper-audit.jsonl`.
63
+ - **ADR-0016 Cross-session messaging.** Adopt for the live cross-session axis (CSM-001..005), Spike for Remote Control (#1056, closed negative); anchors "entries vs messages" — files hold state, messages are hints — rationale [ADR-0016](adr/0016-cross-session-messaging.md).
63
64
  - **Plugin validators.** `scripts/validate-plugin.mjs` runs the validator set under `scripts/lib/validate/*.mjs` (49 modules on disk, measured 2026-09-24 with `ls scripts/lib/validate/*.mjs | wc -l`); a failing BLOCKING validator fails the run. Newest blocking member: `check-learnings-shell-writes.mjs` (#1446) — blocks instruction prose that tells an agent to write `learnings.jsonl` with a shell redirect. Before it: `check-hook-entry-guards.mjs` — an AST oracle over every hook registered in the four hook manifests, flagging a missing entry guard or a top-level profile exit, either of which makes an imported hook module execute its whole program.
64
65
  - **Codex:** `.codex-plugin/plugin.json` (tracked `+codex.<UTC timestamp>` version), generated command and skill entrypoints under `.codex-plugin/skills/`, compatibility config, agent role definitions, and the public marketplace/add/list lifecycle implemented by `scripts/codex-install.mjs`. `scripts/generate-codex-skills.mjs` produces the name union with commands taking precedence; [Codex usage](codex-setup.md#usage) explains selection. Every installer run refreshes via `plugin add`; hook trust remains an operator decision in a fresh task through `/hooks`.
65
66
  - **Cursor:** `.cursor-plugin/plugin.json` registers canonical skills and `.mcp.json` using Cursor's native manifest format. Additional native component discovery is explicitly disabled; `scripts/cursor-install.mjs` supplies the existing command and hook adapters. The former standard root manifest was moved to prevent [Codex manifest interception](codex-setup.md#manifest-compatibility).
@@ -66,6 +66,46 @@ instead of `jq >> events.jsonl`. For callers that manage their own stream path,
66
66
  `emitEvent(type, payload, { filePath })` accepts an additive optional path override
67
67
  (default = the resolved `eventsFilePath()`); existing two-argument callers are unchanged.
68
68
 
69
+ ## Quality-gate wave metrics consumers
70
+
71
+ The readers are two skill readers,
72
+ [`wave-loop-review.md` step 7](../skills/wave-executor/references/wave-loop-review.md)
73
+ and [`metrics-collection.md` § 1.7](../skills/session-end/metrics-collection.md),
74
+ and the convergence monitor (`scripts/lib/convergence-monitor.mjs`), which folds
75
+ `counts` only from gate records that also carry `wave_number`. The two skill readers read `orchestrator.quality_gate.{passed,failed}` as flat records, filtering
76
+ by the existing own `semantic_session_id` and `wave_number`, then taking the
77
+ last matching record with `counts`. `counts.passed` supplies `suite_passed`;
78
+ `counts.failed` supplies `suite_failed`. Their identical jq selectors exclude
79
+ other sessions, other waves, and unrelated events without a time-window join.
80
+ They read the ledger raw (`jq -R` with `fromjson? | objects`), so an unreadable
81
+ line such as a torn tail is skipped instead of aborting `jq` and emptying the result.
82
+ An event without `semantic_session_id` (emitters set it only from the session lock)
83
+ never matches and is treated like a gate outside the event wrapper.
84
+
85
+ Both emitters supply the same optional counts and wave keys: the CLI emits once
86
+ per CLI run; the library emits once per `runQualityGateWithRetry` call, never
87
+ per retry (`attempts` describes retries). Missing `counts` or `wave_number` stays
88
+ absent, never zero-filled. An empty selector or an event without counts, such
89
+ as fail-fast before the test suite, does not alone permit header fallback.
90
+ Telemetry remains best-effort; emission does not change gate exits or verdicts.
91
+ The event-name and reporting-variant contracts in the catalogue below still apply.
92
+
93
+ Count fallback is limited to three cases: pre-#954 sessions, a gate outside the
94
+ event wrapper, or missing wave attribution. Its source differs by reader: step 7
95
+ runs before § 3a writes this wave's header and falls back to the output of this
96
+ wave's own gate run; session end falls back to the STATE.md Wave History header
97
+ `— suite <passed>/<failed> on <platform>`.
98
+ An auto-fix call with a known wave uses the event selector. When neither an event
99
+ measurement nor an applicable header fallback supplies counts, omit the two
100
+ count fields: absence means unmeasured; a present zero means measured zero.
101
+
102
+ `suite_platform` comes separately from the platform of this wave's gate run
103
+ (step 7) or the header that run wrote (session end); there is **no platform field
104
+ in the event payload**. Omit it without such a measurement, and never infer it
105
+ from `variant`. Event-derived
106
+ counts may still be mirrored into the existing header as compatibility output,
107
+ not a second measurement source. Header and sessions.jsonl contracts are unchanged.
108
+
69
109
  ## Naming convention
70
110
 
71
111
  Orchestrator-owned events use a dotted namespace:
@@ -105,7 +145,7 @@ namespace we own. The validator + regex live in `scripts/lib/events-schema.mjs`
105
145
  | `orchestrator.memory.propose_invoked` | `hooks/pre-bash-memory-propose-audit.mjs` | PreToolUse(Bash), once per `node … memory-propose.mjs …` invocation the G3 regex matches — observe-only, the hook never denies. **Payload:** `session_id` (or `null`), `wave`, `cwd` (the working directory RELATIVE to the resolved project dir — `.` when equal, `scripts/lib` from a subdirectory; a directory OUTSIDE the project is written as `sha256:<12 hex>` of its resolved path, and so is EVERY cwd when the project dir is the filesystem root, the home dir or an ancestor of it (`/Users`), where the relative form would read `Users/<name>/…`; that 12-hex sha256 prefix is PSEUDONYMISATION, not anonymisation — a guessable path (a home dir, a usual checkout location) is recovered offline by hashing candidates; **never an absolute path** — until 2026-09-25 (#1439) it was `process.cwd()` verbatim, i.e. the operator's home path in an `events.jsonl` line; zero production readers), `exit_code` (always `null` — a PreToolUse hook runs BEFORE the command), plus the #1415 argv summary: `command_hash` (**sha256 of the RAW command, truncated to 16 hex — same recipe as `enforce-commands` after `8f15f77b`; never the command text**), `flags_present` (string[], the subset of `memory-propose.mjs`'s OWN flag NAMES — `type`, `subject`, `insight`, `evidence`, `confidence`, `dry-run`, `file-paths`, `help` — present in the command, in that fixed order; built by intersecting a CLOSED list, never by scraping `--\S+`, so a flag-shaped VALUE can never be reported as a flag) and `argv_length` (number, the raw command's character count). Until 2026-09-21 this row carried `argv_truncated`: 512 characters of command TEXT, redacted only per-VALUE for five flags, whose own caveat named its gaps (`--insight=$VAR`, `--insight=$(cat secret)`, a secret written anywhere else on the line). It went into an `events.jsonl` line (gitignored here via `.gitignore:57`; consumer repos may track it) and, with the Clank webhook configured, onto the network. **Measured 2026-09-21** (`rg argv_truncated` over `scripts/ hooks/ skills/ docs/`): **zero production readers** — the field's only consumers were this hook's own tests. Pinned in `tests/hooks/pre-bash-memory-propose-audit.test.mjs` in BOTH directions (summary fields present AND `argv_truncated`/`command` undefined), plus a negative test that string-searches the serialized record for every sentinel value — so nobody puts the raw field back beside the hash |
106
146
  | `orchestrator.wave.completed` | `hooks/post-tool-batch-wave-signal.mjs` · `hooks/on-session-end.mjs` (`emitFinalWaveCompleted`) | PostToolBatch — fires live via `.claude/wave-scope.json` `.wave` increase (mechanical fallback, #612), closing wave N at the N→N+1 transition; an explicit injected `wave_signal: 'wave-complete'` still takes precedence. **The former `started` sibling was REMOVED 2026-09-19** (operator decision, #1202 §11): it carried no measurement, its only reader was `scripts/lib/convergence-monitor.mjs`, and there it cost the one signal it could not feed — the batch hook wrote it in the same millisecond as completed{N}, so both shared a tail tick and it masked the (N-1, N) `shrinking_diff` pair. An injected `wave_signal: 'wave-start'` is still accepted and emits nothing; historical records stay in the ledgers and nothing reads them. **Re-emission ceiling (open):** a session that does not own `.orchestrator/current-session.json` never advances the marks below, so each of its batches re-emits completed{lastWave} until its own SessionStart takes the file over — measured 2026-09-19 as up to 579 emissions for one (session_id, wave_number) group. **Second `.completed` emitter (#1193):** the batch hook closes wave N-1 only at an N-1→N transition, so the LAST wave of every session never received a completion — measured fleet-wide 2026-09-02 as **296 gaps over 296 wave runs** (1018 started vs 722 completed), exactly one missing final completion per run. SessionEnd now emits it. **Payload of that record:** `wave_number` (the `current-session.json` `last_wave`), `reason: 'session-end'`, `emitted_by: 'on-session-end'`, plus `session_id` / `semantic_session_id` — **omitted when unattested**, never fabricated. **Idempotent** via the `last_wave_completed` high-water mark in `.orchestrator/current-session.json`, written by BOTH emitters and preserved across `/clear`+compact by `on-session-start.mjs`; `last_wave` absent or `0` emits nothing (an Express-Path or coordinator-direct session never batched, and zero waves is the correct reading, not a gap). **Two gates on the SessionEnd emitter, both load-bearing:** (a) OWNERSHIP — `current-session.json` is a single repo-global file describing whichever session most recently ran SessionStart, routinely a different still-live session in a shared working copy, so the emit reuses `resolveSession()`'s `isRecordedSession` predicate; when false it emits nothing AND writes nothing, since writing the marker into a peer's file would silence the peer's own SessionEnd and preserve this very gap on the wrong session. (b) REASON — `reason === 'clear'` **and `reason === 'resume'`** are SKIPPED: the SessionEnd matcher is empty, so `/clear` fires the hook mid-wave while the LOGICAL session continues, and `on-session-start.mjs` preserves `last_wave` / `last_wave_completed` across a resume of the SAME logical session exactly as it does across a clear — so both end the HARNESS session, not the logical one. Closing the live wave on either is premature, and the preserved marker would then suppress the real completion later. Resume is the MORE common of the two (fleet n = 1498 `session.ended`, 2026-09-02: 12 `resume` vs 9 `clear`). Deliberately SessionEnd-only (`on-stop.mjs` is not mirrored) so the closed-vs-abandoned split stays measurable. **Diff-size keys on the BATCH-HOOK emitter only (#980):** `files_changed` (integer) + `files_changed_source: 'worktree-vs-wave-start-sha'` (the only value emitted today; present iff `files_changed` is). Measurement: the DEDUPED union of `git diff --name-only <wave_start_sha>` and `git ls-files --others --exclude-standard`, run in the project dir at the N→N+1 transition, where `wave_start_sha` is the `git rev-parse HEAD` the batch hook persisted into `.orchestrator/current-session.json` when wave N was OPENED (same ownership gate as the wave keys; written as `null` when git is unreadable, so a previous wave's sha can never inflate the next count). Worktree-vs-sha rather than `<sha>..HEAD` because the coordinator commits at session close, not per wave — a commit-only diff reads 0 for every wave of a normal session. **Both keys are OPTIONAL and absent-is-not-zero:** any git failure, a 1.5 s timeout, or a missing `wave_start_sha` omits them, and `scripts/lib/convergence-monitor.mjs` reads an absent key as `null`, so the `shrinking_diff` signal simply does not fire (it never reads a fabricated 0). The `on-session-end.mjs` final-wave `.completed` carries NEITHER key by design — no wave-open transition runs there, so it has no start sha to measure against |
107
147
  | `orchestrator.wave.final_refused` | `hooks/on-session-end.mjs` (`emitFinalWaveCompleted` → `emitFinalRefused`, via `emitEvent(..., {repoRoot})` + `sessionAttribution(repoRoot)`, wrapped in its OWN try/catch — independent of the caller's outer catch — so a telemetry failure on one refusal can never surface as a teardown failure) | the SIBLING event to `orchestrator.wave.completed` above (#1201 Part B / Discovery D8) — fires exactly once per SessionEnd in which the final `.completed` was NOT emitted, one row per refusal. Deliberately a SEPARATE event name rather than `.completed` carrying `emitted:false`: existing consumers of `.completed` treat every row as a finished wave, and overloading it would silently corrupt that count. **Payload:** `reason` (always present, closed enum — verified against `emitFinalWaveCompleted`'s own call sites) `not-recorded` \| `clear` \| `resume` \| `unreadable` \| `session-id-mismatch` \| `no-wave` \| `already-completed` \| `exception`, `emitted_by: 'on-session-end'` (always), plus `session_id` / `semantic_session_id` — omitted when `null`, never fabricated. **Optional, absent-is-not-zero:** `wave_number` — present ONLY on the `already-completed` reason, the sole call site that passes a resolved `last_wave` through to `emitFinalRefused`; every other reason, INCLUDING `no-wave`, omits it (that path never resolved a wave number at all — the function's own JSDoc pins this: "only when `last_wave` was resolved to a positive number before the refusal (currently only `already-completed`)"). Six of the eight reasons were previously SILENT refusal paths with no trace anywhere (`.claude/rules/host-resources.md` § HR-105: "a refusal that writes nothing is unfalsifiable") |
108
- | `orchestrator.quality_gate.passed` / `.failed` | `scripts/run-quality-gate.mjs` (the gate CLI — live between waves) · `scripts/lib/quality-gate.mjs` (`emitGateEvent` inside `runQualityGateWithRetry`, reached ONLY under `verification-auto-fix.enabled: true` — default `false`, and `false` in this repo) | CLI: once per gate-CLI run. Library: once per `runQualityGateWithRetry` **call**, never per retry attempt (`attempts` carries that detail). The two paths never nest, so one run passes through exactly one emitter. **Name (CLI, #1459, 2026-10-01):** `.failed` when `exit_code` ≠ 0 OR the joined kill fields say `timed_out: true`, in every variant. The reporting variants (`baseline` \| `incremental` \| `per-file`) exit 0 even after a failing check, so for them `.passed` means "not killed", not "checks green" — the check verdict lives in the gate output, not in the event name. **Payload (both):** `variant`, `exit_code`, plus `session_id` / `semantic_session_id` when `sessionAttribution()` finds a session lock (both omitted when it does not). CLI `variant` is the `--variant` value (`baseline`\|`incremental`\|`full-gate`\|`per-file`); the library pins `variant: 'auto-fix-loop'`. **CLI only:** `wave_number`, and `failed_files` (string[] — the failing test FILES `gate-full.mjs` names when the runner printed a file-level summary; **omitted, never `[]`**, when nothing named a file — an empty array would read as "no file failed"). **Library only:** `attempts` (1…`maxRetries+1`) and `gate` (`lint`\|`typecheck`\|`test` — the fail-fast gate of the last attempt; omitted on the passing path). **Kill-ladder fields (#1439, #1457, 2026-09-25):** `timed_out` (boolean — the run hit its wall-clock ceiling and was killed), `survivors` (integer — pids still alive after the SIGKILL step, `0` when none; the pids themselves stay in the gate output / diagnostics bundle) and `kill_signals` (string[] — the signals actually sent, in order, e.g. `["SIGTERM","SIGKILL"]`; `[]` when none). Both emitters start from the ONE shared `gateKillFields()` (`scripts/lib/quality-gate.mjs`); from the library emitter `false` / `0` / `[]` are therefore measurements ("not killed"), not absence — the CLI emitter additionally passes them through `joinGateKillFields()` and may omit the keys (see below, #1457). The library always carries all three. The CLI JOINS two ladders with `joinGateKillFields()` (`scripts/lib/gates/gate-helpers.mjs`): the OUTER one over the gate sub-script as a whole (that run exits 124), and the INNER per-command ones the gate's JSON envelope publishes — every variant (`gate-full.mjs` on `typecheck`/`test`/`lint`, `gate-{baseline,incremental,per-file}.mjs` on `typecheck`/`test` since #1457 pkt 12) puts `timed_out` / `kill_signals` / `survivors` (pids) on each command object it actually spawned, so a single command killed by the per-command ceiling (exit 2) now reads `timed_out: true`. Join: `timed_out` = outer OR any inner, `kill_signals` = outer followed by each command's in execution order, `survivors` = outer count plus every inner pid count. **The CLI omits all three keys** when the inner side was not measured — an envelope without the per-command ladder (all four variants publish it since #1457 pkt 12, so today this means an older gate script) or an unparseable envelope — and the outer ladder did not fire; a fired outer ladder is reported alone. The library reports the failing gate command of the last attempt, and `false` / `0` / `[]` on the passing path (every gate exited 0, so none was killed). **Optional on both:** `counts: {passed, failed, total}`. **Absent is not zero — for both optional fields.** `counts` is admitted by the ONE shared policy `admitSuiteCounts()` (`scripts/lib/gates/gate-helpers.mjs`, #967 item 2), which returns `null` — never a zero triple — for an unmeasured or inconsistent input (test gate skipped/stubbed, fail-fast on lint or typecheck before the test step, no parseable `<N> passed` marker, or `passed + failed !== total`); both callers spread `...(counts ? { counts } : {})`, so the KEY is missing in those runs. A present `counts.failed: 0` therefore means "measured, zero failures", while an absent `counts` means "not measured" — reading a missing field as `0` mis-analyses the ledger in both directions. Same contract for `wave_number` (CLI, #966 step 1): resolved from the `.{pi,cursor,codex,claude}/wave-scope.json` sidecar, **omitted** — never `0` — when there is no sidecar or its `wave` is non-numeric/non-positive; a human running `npm run quality-gate` from a `git push` has no wave at all, so an invented wave 0 would have to be special-cased by every consumer. Note `total` is `passed + failed` and EXCLUDES skipped/todo (see `extractTestCounts`) |
148
+ | `orchestrator.quality_gate.passed` / `.failed` | `scripts/run-quality-gate.mjs` (the gate CLI — live between waves) · `scripts/lib/quality-gate.mjs` (`emitGateEvent` inside `runQualityGateWithRetry`, reached ONLY under `verification-auto-fix.enabled: true` — default `false`, and `false` in this repo) | CLI: once per gate-CLI run. Library: once per `runQualityGateWithRetry` **call**, never per retry attempt (`attempts` carries that detail). The two paths never nest, so one run passes through exactly one emitter. **Name (CLI, #1459, 2026-10-01):** `.failed` when `exit_code` ≠ 0 OR the joined kill fields say `timed_out: true`, in every variant. The reporting variants (`baseline` \| `incremental` \| `per-file`) exit 0 even after a failing check, so for them `.passed` means "not killed", not "checks green" — the check verdict lives in the gate output, not in the event name. **Payload (both):** `variant`, `exit_code`, plus `session_id` / `semantic_session_id` when `sessionAttribution()` finds a session lock (both omitted when it does not). CLI `variant` is the `--variant` value (`baseline`\|`incremental`\|`full-gate`\|`per-file`); the library pins `variant: 'auto-fix-loop'`. **Both emitters:** optional `wave_number` (positive safe integer from the running own-session manifest at the event root). **CLI only:** `failed_files` (string[] — the failing test FILES `gate-full.mjs` names when the runner printed a file-level summary; **omitted, never `[]`**, when nothing named a file — an empty array would read as "no file failed"). **Library only:** `attempts` (1…`maxRetries+1`) and `gate` (`lint`\|`typecheck`\|`test` — the fail-fast gate of the last attempt; omitted on the passing path). **Kill-ladder fields (#1439, #1457, 2026-09-25):** `timed_out` (boolean — the run hit its wall-clock ceiling and was killed), `survivors` (integer — pids still alive after the SIGKILL step, `0` when none; the pids themselves stay in the gate output / diagnostics bundle) and `kill_signals` (string[] — the signals actually sent, in order, e.g. `["SIGTERM","SIGKILL"]`; `[]` when none). Both emitters start from the ONE shared `gateKillFields()` (`scripts/lib/quality-gate.mjs`); from the library emitter `false` / `0` / `[]` are therefore measurements ("not killed"), not absence — the CLI emitter additionally passes them through `joinGateKillFields()` and may omit the keys (see below, #1457). The library always carries all three. The CLI JOINS two ladders with `joinGateKillFields()` (`scripts/lib/gates/gate-helpers.mjs`): the OUTER one over the gate sub-script as a whole (that run exits 124), and the INNER per-command ones the gate's JSON envelope publishes — every variant (`gate-full.mjs` on `typecheck`/`test`/`lint`, `gate-{baseline,incremental,per-file}.mjs` on `typecheck`/`test` since #1457 pkt 12) puts `timed_out` / `kill_signals` / `survivors` (pids) on each command object it actually spawned, so a single command killed by the per-command ceiling (exit 2) now reads `timed_out: true`. Join: `timed_out` = outer OR any inner, `kill_signals` = outer followed by each command's in execution order, `survivors` = outer count plus every inner pid count. **The CLI omits all three keys** when the inner side was not measured — an envelope without the per-command ladder (all four variants publish it since #1457 pkt 12, so today this means an older gate script) or an unparseable envelope — and the outer ladder did not fire; a fired outer ladder is reported alone. The library reports the failing gate command of the last attempt, and `false` / `0` / `[]` on the passing path (every gate exited 0, so none was killed). **Optional on both:** `counts: {passed, failed, total}`. **Absent is not zero — for both optional fields.** `counts` is admitted by the ONE shared policy `admitSuiteCounts()` (`scripts/lib/gates/gate-helpers.mjs`, #967 item 2), which returns `null` — never a zero triple — for an unmeasured or inconsistent input (test gate skipped/stubbed, fail-fast on lint or typecheck before the test step, no parseable `<N> passed` marker, or `passed + failed !== total`); both callers spread `...(counts ? { counts } : {})`, so the KEY is missing in those runs. A present `counts.failed: 0` therefore means "measured, zero failures", while an absent `counts` means "not measured" — reading a missing field as `0` mis-analyses the ledger in both directions. Same contract for `wave_number` (both emitters, #966 step 1): resolved from the `.{pi,cursor,codex,claude}/wave-scope.json` sidecar, **omitted** — never `0` — when there is no sidecar or its `wave` is not a positive safe integer; a human running `npm run quality-gate` from a `git push` has no wave at all, so an invented wave 0 would have to be special-cased by every consumer. Note `total` is `passed + failed` and EXCLUDES skipped/todo (see `extractTestCounts`) |
109
149
  | `orchestrator.scope.coordinator_carveout_allowed` | `hooks/enforce-scope.mjs` (coordinator carveout, #245 / #1361) | exactly once per ALLOWED write BY THE COORDINATOR into one of the harness-owned in-repo files the carveout covers — `.claude/STATE.md` and its `.codex/` / `.cursor/` / `.pi/` siblings, plus the exact relative path of the live `wave-scope.json` the hook itself just read. Since #1361 a payload carrying `agent_id` is a dispatched subagent: it gets no carveout and falls through to Gate 7, where a manifest that does not grant the path is a DENY (a subagent permitted to write `wave-scope.json` could rewrite its own file scope and disarm every later gate of the wave; STATE.md is coordinator-owned per `skills/_shared/state-ownership.md`). **Payload:** `hook`, `manifest` (the manifest path), `wave`, `file_path` (the project-RELATIVE, forward-slash-normalized path — the carveout set is in-repo by construction, so no host-local absolute path enters the ledger) and `discriminator` (`'coordinator' \| 'malformed' \| 'absent'` — same enum and same meanings as `orchestrator.scope.memory_dir_allowed`: `'coordinator'` = `agent_type` present without `agent_id`; `'malformed'` = an `agent_id` key present but unusable (number, object, array, blank string), a fail-open that must stay rare; `'absent'` = no `agent_id` key at all, the harness's documented main-thread shape. `'subagent'` never appears here BECAUSE a subagent gets no carveout and so emits no allow) — exactly the five keys the `emitEvent` call passes, with `{ repoRoot: projectRoot }` as options. **Fail-safe:** awaited BEFORE `emitAllow()` (which calls `process.exit()` and would discard a pending append) and wrapped in its own `try {} catch {}`, so a telemetry failure can never flip the decision. Before #1361 this branch was a bare `emitAllow()` with no log and no event, so whether it ever fired was unfalsifiable after the fact (HR-105) | <!-- path-check: example -->
110
150
  | `orchestrator.scope.foreign_session_ignored` | `hooks/enforce-scope.mjs` (Gate 3b, #1123) · `hooks/enforce-commands.mjs` · `hooks/post-bash-write-verify.mjs` (both Gate 3b, #1153 P1) | exactly once per gated tool call while a FOREIGN-session `wave-scope.json` is live: the manifest's `session_id`/`semantic_session_id` provably name another session (legacy `session`/`semantic_session` still read, #1153 P2), so the hook stands down instead of enforcing. Since #1504 point 6 only when EVERY existing candidate (`.pi` > `.cursor` > `.codex` > `.claude`) is foreign — a peer's higher-precedence manifest no longer hides this session's own one (`findOwnScopeFile()`, `scripts/lib/scope-gate.mjs`); `manifest` then names the first foreign candidate. **Payload:** `hook`, `manifest` (path), `manifest_session` (string[]), `own_session` (string[]), `wave`; additionally `file_path` from `enforce-scope` (PreToolUse Edit/Write) and `command_hash` from `enforce-commands` (PreToolUse Bash) — **sha256 auf 16 Hex gekuerzt, NIE das rohe Kommando.** Bis 2026-09-19 stand hier `command` im Klartext, und zwar als dokumentierter Vertrag, nicht als Versehen. Gemessen in EventDrop.at (#1140): **3.816 Zeilen** der GETRACKTEN `.orchestrator/metrics/events.jsonl` trugen ein rohes Kommando, darin **24 distinkte echte Produktions-Share-Codes** aus **17 fremden Kundenkonten** plus ein protokollierter `select access_pin_hash` — bei 23 dieser Events ist der Share-Code die VOLLSTAENDIGE Capability (`/event/<code>` oeffnet das Album ohne Anmeldung), und das Journal geht bei jedem Klon mit. Der Geschwisterhook `pre-bash-destructive-guard.mjs` fuehrte von Anfang an `command_hash` und sagt den Grund im eigenen Kopf; diese Zeile war die Ausnahme. Der Hash haelt das Ereignis zaehlbar und gruppierbar — genau die Eigenschaft, fuer die es laut `docs/scope-collision-guard.md` existiert; das Rohfeld hatte keinen Leser. Gepinnt in `tests/hooks/enforce-commands.test.mjs` in BEIDE Richtungen (Hash vorhanden UND `command` undefined), damit niemand das Rohfeld neben den Hash zuruecklegt. **Der zweite rohe Schreiber derselben Klasse — `hooks/pre-bash-staging-fence.mjs` (512 Zeichen rohes Kommando je Eintrag) — ist seit #1404 (2026-09-20) geschlossen:** der Fence speichert jetzt die Pfad-Operanden plus `command_hash`, nie den Kommandotext. Belegt mit einem Test-Secret im Kommando: `grep -c` auf die Fence-Datei findet es 0-mal, ebenso 0 Vorkommen eines `command`-Feldes. Der einzige Leser (`hooks/wave-scope-commit-guard.mjs`) vergleicht seitdem Pfadlisten statt den Rohtext per Regex zu durchsuchen — was nebenbei `git add -A` abdeckt, das der Regex-Leser nie erkannte. **Die DRITTE und letzte Stelle derselben Klasse — `hooks/pre-bash-memory-propose-audit.mjs` (`argv_truncated`: 512 Zeichen nur flag-redigiertes Kommando in `orchestrator.memory.propose_invoked`, also in die GETRACKTE `events.jsonl` und optional an den Webhook) — ist seit #1415 (2026-09-21) geschlossen, analog `8f15f77b` und #1404:** der Hook schreibt jetzt `command_hash` + `flags_present` + `argv_length`, nie den Kommandotext. Gemessen vor dem Fix: 0 Produktionsleser des Rohfelds. Damit ist die Klasse zu — kein Hook dieses Repos legt mehr rohen Kommandotext in ein Event oder eine Kontrolldatei. `post-bash-write-verify` (PostToolUse Bash) carries neither — it reports on the working tree, not on one tool input. Legacy manifests without a session-binding field never emit this — they stay enforced |
111
151
  | `orchestrator.scope.memory_dir_allowed` | `hooks/enforce-scope.mjs` (Gate 5c, #1295) | exactly once per ALLOWED write BY THE COORDINATOR (#1352 — a payload carrying `agent_id` is a dispatched subagent, gets no carve-out and falls through to the normal gates) into THIS repo's harness auto-memory directory `~/.claude/projects/<encodeProjectDir(repoRoot)>/memory/` — the single out-of-repo carveout, evaluated only on the out-of-root branch (Gate 6) and only when a `wave-scope.json` manifest is live, so the in-repo gates are untouched. **Payload:** `hook`, `manifest` (the manifest path), `wave`, `file_path` (the REALPATH-resolved candidate) and, since #1352, `discriminator` (`'coordinator' \| 'malformed' \| 'absent'` — `'coordinator'` = `agent_type` present without `agent_id`; `'malformed'` = an `agent_id` key present but unusable (number, object, array, blank string), a fail-open that must stay rare; `'absent'` = no `agent_id` key at all, the harness's documented main-thread shape. `'subagent'` never appears here BECAUSE a subagent gets no carve-out and so emits no allow) — exactly the five keys the `emitEvent` call passes, with `{ repoRoot: projectRoot }` as options. **Fail-safe:** awaited BEFORE `emitAllow()` (which calls `process.exit()` and would discard a pending append) and wrapped in its own `try {} catch {}`, so a telemetry failure can never flip the decision. This row is the audit trail for the carveout: it is the only place an out-of-repo ALLOW becomes measurable after the fact |
@@ -116,7 +156,7 @@ namespace we own. The validator + regex live in `scripts/lib/events-schema.mjs`
116
156
  | `orchestrator.handover.gated` | `skills/session-end/SKILL.md` Phase 1.65 (skill-prose, via `scripts/emit-event.mjs`) | Handover-Alignment-Gate outcome (#773). Payload: `candidates_total`, `auto_carry`, `asked`, `dropped`, `questions_asked`, `questions_answered`, `questions_deferred`, `path` (`fast_path`\|`triage`\|`weiterarbeiten`\|`fail_open`). Emitted exactly once per close — including the fail-open skip and the "Weiterarbeiten" abort — so never-measured paths become observable |
117
157
  | `orchestrator.vault.board_written` | `scripts/lib/vault-status/board-writer.mjs` (`emitBoardEvent`; name const `BOARD_EVENT`) | exactly ONE record per `mirrorBoard()` call, and therefore per `sweepBoard()` call — the sweep never double-emits. Call sites: the `mirrorBoard` wrapper through which all seven inner return points funnel, and `sweepBoard`'s two paths (happy + enumeration-failure fallback). **Payload:** `action` (always — including every no-op: the five `skipped-vault-disabled` guards at `:803/:812/:817/:821/:829`, plus `skipped-vault-not-canonical` (the vault's git origin is not a canonical Meta-Vault — #1450; nothing written, no lock), `skipped-handwritten`, `skipped-noop`, `skipped-write-failed`, `dry-run`, `written`), `caller` (always, `mirrorBoard`\|`sweepBoard`). **Optional, absent-is-not-zero:** `path_tail` (the BASENAME only — never the full path: under `01-projects/` the parent directory is the private project slug, and this payload also travels over the optional Clank webhook with no redaction), `rows`, `repos_swept`, `duration_ms`, plus `session_id` / `semantic_session_id` via `sessionAttribution(repoRoot)` (#1147 — the SAME root the record is pinned to, so attribution can never name a different tree than the ledger line; both keys omitted, never fabricated, when no `session.lock` is readable) — the numeric three admitted via `Number.isFinite(...)` / `typeof === 'string'`, NOT truthiness, so a measured `repos_swept: 0` survives while an unmeasured field is omitted. `lock` — an additive diagnostic object, `{ locked: boolean, reason?: string, stale_override?: string, waited_ms: number, release?: 'not-owner' \| 'busy' }` (snake_case like the sibling keys; `release` is present only when the lock release after the write did not succeed — the lease expired mid-write so a successor may have run, or the release guard gave up — #1336) — is present whenever `withBoardLock()`'s `onLockOutcome` fired, i.e. every non-dry-run path; `stale_override` carries the file-lock reason TOKEN (e.g. `mtime age 600002ms > 60000ms`) only when a stale lock was force-overridden, and the key is entirely absent on `dryRun`, which never takes the lock. This makes an unlocked fail-open write and a stale-override observable in aggregate for the first time — until now `onLockOutcome` had no production caller at all. The enumeration-failure fallback deliberately omits `repos_swept`. **A throw from the inner function emits nothing** — `action` is mandatory and a throw has no action the code knows; inventing one would put a fictional state in the ledger (#1073) |
118
158
  | `orchestrator.vault.narrative_mirrored` | `scripts/lib/vault-status/narrative-mirror.mjs` (`emitNarrativeEvent`; name const `NARRATIVE_EVENT`) | one record per `mirrorNarrative()` call, from the thin wrapper — every outcome plus the throw path (`action: 'error'`, then re-throws). The old body became `runNarrativeMirror()`, so an early return added later is telemetered by construction. Covered: `skipped-vault-disabled` ×4, `skipped-vault-not-canonical` (the vault's git origin is not a canonical Meta-Vault — #1450; nothing written), `skipped-invalid-path`, `skipped-no-statemd`, `written`, `skipped-noop`, `skipped-handwritten`, `dry-run`. **Payload:** `action` (always); optional `path_tail` (BASENAME only, same reason as `board_written`), `chars`, `session_id`, `semantic_session_id` (via `sessionAttribution`), `error_code` (throw path only — the error MESSAGE is deliberately not recorded, it can quote a path or STATE.md prose). **Named gap with a revisit trigger:** when `repoRoot` is absent, NOTHING is emitted — `emitEvent` would fall back to `SO_PROJECT_DIR` and the two rootless unit tests would append synthetic records to this repo's real ledger on every suite run. This deliberately diverges from `board-writer.mjs`, which emits there (#1073) |
119
- | `orchestrator.vault.mirror_completed` | `scripts/lib/vault-mirror/telemetry.mjs` (`emitMirrorEvent`; name const `MIRROR_EVENT`), called from `scripts/lib/vault-mirror/process.mjs` (`emitAction`, reached from all **19** of its call sites, one of them the `skipForeignOwner` helper that the session branches share — census `grep -n 'emitEntryAction' scripts/lib/vault-mirror/process.mjs` minus the definition and 2 trailing-comment hits, 2026-10-02 @ `adeb1f32`) and from the two `skipped-invalid` branches plus the `--kind session` dedup pass (`skipped-duplicate-session`, which calls `emitAction` directly — #1291) in `scripts/vault-mirror.mjs` | **ONE record per JSONL entry processed, EXCEPT `skipped-noop`** (#1151: noop dominates a steady-state run; its count survives in the run-event's `skipped` total + `action_breakdown`) — `created`, `updated`, every other `skipped-*`, and both invalid paths. `skipped-duplicate-session` (#1291): a `--kind session` line whose `session_id` a LATER line in the same source supersedes (crash-recovery re-append, #1068 stub/supersede pair) — never dispatched, the winning line renders the one note; the record carries `record_id` (the `session_id`) and `line` (the LOSING line), and `path` is absent by design, because no target file exists for a line that was never dispatched (its stdout line carries `action`, `path: null`, `kind`, `id`, `line`). `skipped-foreign-owner` (#1503): the generator note already at the target path belongs to another owner — its `source-record` frontmatter field is present and is not a key of this write (for sessions: not on any line of `--source`, superseded duplicates included; a learning record mismatch is routed to the `<slug>-<uuid8>` disambiguation instead, `skipped-collision-resolved`), or, sessions only, it is this generator's note for a DIFFERENT session id (sessions have no disambiguation scheme). `--force` does not bypass it; a note that still leaks a secret under the current masker is healed over the guard (`updated`, `healed_leak: true`). The note is left untouched and one `SKIP foreign owner` line goes to stderr; the record carries `record_id`, the vault-relative `path` of the refused note, and `reason` (constant: `source-record mismatch` \| `id mismatch` — no value read from disk is echoed), and the class counts into the run event's `skipped`. Until #1147 it was **failure-only**: only the two `skipped-invalid` branches emitted, which is why this repo's ledger held **0** records of it against 1272 `orchestrator.secret_masker.applied` from the same CLI (measured 2026-08-23). A healthy run was therefore indistinguishable from a broken emitter — the gap the sibling `orchestrator.vault.mirror_run_completed` row below closes. **Payload:** `action` (the SAME string the entry wrote to stdout), `kind`, `line` (1-based JSONL line — the only locator when a record has no id). **Optional, absent-is-not-zero:** `record_id` (the record's `id` / `session_id`), `path` (**vault-RELATIVE**, never absolute: this payload also travels over the optional Clank webhook with no redaction — omitted on `skipped-invalid` and on the pre-path quality skips, which are reached before a target path exists), `skip_class` (`validation` \| `mapper-crash`, invalid branches only — mirrors the stdout `reason` verbatim so the failure class stays groupable without string-matching), `reason` (the renderer's message on the invalid branches, or the existing `meta.reason` string on a quality skip — `confidence:X < min:Y` / `narrative:N < min:M` / `status:…` — or on `skipped-foreign-owner`, REUSED from the stdout payload rather than recomputed; clamped to 300 chars), `dry_run`, `session_id` / `semantic_session_id`. `record_id` / `path` / `skip_class` / `reason` treat **`null` as not-measured** and are omitted: a `record_id: null` would read as "measured, empty id" rather than "this record had none". **Attribution is read at `SO_PROJECT_DIR`, explicitly** — `readLock()` defaults to `process.cwd()`, so a bare `sessionAttribution()` would attribute the record to whatever tree the process happens to run in while the ledger line lands under `CLAUDE_PROJECT_DIR`. Same root for both halves or neither. The ledger destination stays the 2-arg `emitEvent` default so every event of one run shares it: the repo root that decides the vault namespace (#1503: `--repo-root`, else the git repo containing `--source`) is deliberately NOT used for the ledger, because routing telemetry by it would split a single run's records across two ledgers |
159
+ | `orchestrator.vault.mirror_completed` | `scripts/lib/vault-mirror/telemetry.mjs` (`emitMirrorEvent`; name const `MIRROR_EVENT`), called from `scripts/lib/vault-mirror/process.mjs` (`emitAction`, reached from all **19** of its call sites, one of them the `skipForeignOwner` helper that the session branches share — census `grep -n 'emitEntryAction' scripts/lib/vault-mirror/process.mjs` minus the definition and 2 trailing-comment hits, 2026-10-02 @ `adeb1f32`) and from the two `skipped-invalid` branches plus the `--kind session` dedup pass (`skipped-duplicate-session`, which calls `emitAction` directly — #1291) in `scripts/vault-mirror.mjs` | **ONE record per JSONL entry processed, EXCEPT `skipped-noop`** (#1151: noop dominates a steady-state run; its count survives in the run-event's `skipped` total + `action_breakdown`) — `created`, `updated`, every other `skipped-*`, and both invalid paths. `skipped-duplicate-session` (#1291): a `--kind session` line whose `session_id` a LATER line in the same source supersedes (crash-recovery re-append, #1068 stub/supersede pair) — never dispatched, the winning line renders the one note; the record carries `record_id` (the `session_id`) and `line` (the LOSING line), and `path` is absent by design, because no target file exists for a line that was never dispatched (its stdout line carries `action`, `path: null`, `kind`, `id`, `line`). `skipped-foreign-owner` (#1503): the generator note already at the target path belongs to another owner — its `source-record` frontmatter field is present and is not a key of this write (for sessions: not on any line of `--source`, superseded duplicates included; a learning record mismatch is routed to the `<slug>-<uuid8>` disambiguation instead, `skipped-collision-resolved`), or, sessions only, it is this generator's note for a DIFFERENT session id (sessions have no disambiguation scheme). `--force` does not bypass it; a note that still leaks a secret under the current masker is healed over the guard (`updated`, `healed_leak: true`). The note is left untouched and one `SKIP foreign owner` line goes to stderr; the record carries `record_id`, the vault-relative `path` of the refused note, and `reason` (constant: `source-record mismatch` \| `id mismatch` — no value read from disk is echoed), and the class counts into the run event's `skipped`. Until #1147 it was **failure-only**: only the two `skipped-invalid` branches emitted, which is why this repo's ledger held **0** records of it against 1272 `orchestrator.secret_masker.applied` from the same CLI (measured 2026-08-23). A healthy run was therefore indistinguishable from a broken emitter — the gap the sibling `orchestrator.vault.mirror_run_completed` row below closes. **Payload:** `action` (the SAME string the entry wrote to stdout), `kind`, `line` (1-based JSONL line — the only locator when a record has no id). **Optional, absent-is-not-zero:** `record_id` (the record's `id` / `session_id`), `path` (**vault-RELATIVE**, never absolute: this payload also travels over the optional Clank webhook with no redaction — omitted on `skipped-invalid` and on the pre-path quality skips, which are reached before a target path exists), `skip_class` (`validation` \| `mapper-crash`, invalid branches only — mirrors the stdout `reason` verbatim so the failure class stays groupable without string-matching), `reason` (the renderer's message on the invalid branches, or the existing `meta.reason` string on a quality skip — `confidence:X < min:Y` / `narrative:N < min:M` / `status:…` — or on `skipped-foreign-owner`, or the constant `newer record owns the main note` on an `updated` learning-note takeover (its `displaced_id` goes to stdout only), REUSED from the stdout payload rather than recomputed; clamped to 300 chars), `dry_run`, `session_id` / `semantic_session_id`. `record_id` / `path` / `skip_class` / `reason` treat **`null` as not-measured** and are omitted: a `record_id: null` would read as "measured, empty id" rather than "this record had none". **Attribution is read at `SO_PROJECT_DIR`, explicitly** — `readLock()` defaults to `process.cwd()`, so a bare `sessionAttribution()` would attribute the record to whatever tree the process happens to run in while the ledger line lands under `CLAUDE_PROJECT_DIR`. Same root for both halves or neither. The ledger destination stays the 2-arg `emitEvent` default so every event of one run shares it: the repo root that decides the vault namespace (#1503: `--repo-root`, else the git repo containing `--source`) is deliberately NOT used for the ledger, because routing telemetry by it would split a single run's records across two ledgers |
120
160
  | `orchestrator.vault.mirror_run_completed` | `scripts/lib/vault-mirror/telemetry.mjs` (`emitMirrorRunEvent`; name const `MIRROR_RUN_EVENT`), called from `finishRun()` in `scripts/vault-mirror.mjs` — the ONE close-out function every exit routes through (the happy tail, the malformed-JSON abort, the filesystem-error abort, and the top-level `main().catch`), latched so it can only fire once | exactly ONE record per CLI run, **unconditionally** — beside the `orchestrator.secret_masker.applied` emit and BEFORE the `--strict-schema` abort, so a failing run still reports its denominator. **This event is the denominator the per-entry row above lacks:** a healthy run over an empty source emits zero per-entry records, and so does a run whose emitter is broken — from the ledger the two are identical (`.claude/rules/host-resources.md` § HR-105). **Payload:** `kind`, `total` (non-blank JSONL entries attempted), `created`, `updated`, `skipped` (every non-failure `skipped-*` class), `failed` (`skipped-invalid` — validation error or mapper crash; split out because those are the entries whose session silently ends up WITHOUT a vault note), `dry_run`. **These five counters are ALWAYS present, including as `0`** — this is the one place a written zero is the payload rather than a violation of "absent is not zero", because each was measured over the whole run; `total: 0` is a measured empty run and the record's ABSENCE is the broken-emitter signal. `created + updated + skipped + failed === total` for any run that does not abort, `--kind session` included: a duplicate `session_id` line collapsed by the dedup pass is counted as `skipped-duplicate-session` (#1291), so it stays inside `skipped` instead of falling out of the partition (pinned by tests for both kinds). **Optional, and the discriminator that keeps the counters honest:** `aborted` (`malformed-json` \| `filesystem-error` \| `unexpected-error` \| `missing-vault-dir` \| `vault-not-canonical` \| `missing-source` (#1151: the three pre-loop exit-2 aborts now close the run out through finishRun()) \| `source-repo-mismatch` (#1503: a fourth pre-loop exit-2 abort — an explicit `--repo-root` and the git repo containing `--source` resolve to different vault namespaces, so the run stops before its first entry and writes nothing)) — present ONLY when the run exited before its tail, absent means "ran to the end" and never "unknown". Its presence says the five counters are PARTIAL (every line after the abort was never attempted), so the classes stop partitioning `total` and that gap must be read as an abort, not as producer/consumer drift. Until it existed, the two `process.exit` calls inside the entry loop and the `main().catch` jumped straight over this emit: the runs an operator most wants counted were the ones that vanished from the ledger, in the exact shape ("no record") the paragraph above reserves for a broken emitter. **Optional:** `action_breakdown` (per-`action` counts, keyed by the same strings the entries wrote to stdout — enumerates only actions that OCCURRED, so a missing key there means zero occurrences; the always-present `total` makes that reading unambiguous, and the key itself is omitted when nothing was processed), plus `session_id` / `semantic_session_id` via the same `SO_PROJECT_DIR`-pinned `sessionAttribution` as the per-entry event |
121
161
  | `orchestrator.secret_masker.applied` | Three producers, one per masking call site: `scripts/vault-mirror.mjs` (beside the vault-mirror run, `channel: 'vault-mirror'`), `scripts/lib/vault-status/narrative-mirror.mjs` (`channel: 'narrative-mirror'`), `scripts/export-hw-learnings.mjs` (`channel: 'export-hw-learnings'`) | once per masking pass at each producer, unconditionally. **Undocumented until 2026-08-23, at which point it had over a thousand records** — and that omission actively misled: a census grepping event NAMES for `board\|mirror` returns 0 and reads as "the mirror emits nothing", while run-level presence was in fact already observable through THIS event's payload. Grep the `channel`, not the name — the three channels above are DISTINCT producers, not one call site with three labels, so a per-channel count is a per-producer count |
122
162
  | `orchestrator.probes.completed` | `scripts/lib/session-start-probes.mjs` (`runSessionStartProbes`), called from `hooks/on-session-start.mjs` | once per SessionStart, after the Phase-4 measurement probes run. **This event is the whole point of #1073:** the 18 module-backed probes had **zero** mechanical callers across `hooks/`, npm scripts, CI and husky — their only caller was prose in `skills/session-start/SKILL.md` — and across the 336 session starts recorded up to 2026-08-23 there was **no banner event at all**, so whether they ever ran was unfalsifiable (`.claude/rules/host-resources.md` § HR-105). **Payload:** `total`, `ran`, `warned`, `skipped`, `errored`, `timed_out`, `duration_ms`, and `probes` — one `{id, outcome, reason?, work_ms?, follow_up?, measure?}` per probe — `reason` travels whenever one was recorded, because `module-absent` (a permanently dead entry) must be distinguishable from `network-probe-opt-in` (the intended default); `outcome` ∈ `ran-clean`\|`ran-warn`\|`ran-alert`\|`skipped`\|`timeout`\|`error`. `work_ms` (integer, rounded) is present on every `ran-*` and `timeout` element and on an `error` from a throwing `severityOf`/`render` (`severity-threw`/`render-threw` — the probe's work did run), and absent on `skipped` and on any other `error`: the probe's OWN work time — wall-clock elapsed minus the time the event loop was blocked by synchronous work, measured from timer lateness (`startLoopBlockedMeter`). It is the quantity the `timeout` verdict is computed from; probe-level `duration_ms` is deliberately NOT persisted, because under parallel launch it ranks contention, not work. Read `work_ms` as exact for a preemptible probe and as a LOWER BOUND for a synchronous one (the meter subtracts a blocker's own blocking time from its own `work_ms` too), so never rank the synchronous probes by it. `follow_up` (`budget-exceeded`) marks a `ran-*` result whose follow-up ran out of budget and fell back to the delivered result. `measure` (#1489) is a flat object of what the probe MEASURED, present only on a `ran-*` element of a probe whose registry entry declares `telemetry(result)`, warn or not: at most 8 snake_case keys, each a finite number or `null` — strings are dropped by the runner (`probeMeasure`), because this payload also travels over the optional webhook unredacted and a string is how a path or a repo slug gets there. Absent means not measured, never zero. Today only `events-retention` declares one: `{coverage_days, archives, max_backups, required_days}` (`coverage_days` rounded to 3 decimals — always a number: a ledger with no stamp at all is no longer measured as `null` but answered `unmeasurable` (`degraded`, recorded `ran-warn`) and persists no `measure`, #1498; `required_days` `null` when no reader declares a finite window), so a retention warning that never fires can be told apart from a dead one (HR-105). Two invariants are asserted by tests: `total === probes.length` and `ran + skipped + errored + timed_out === total`. **The count is 18, not the 19 Phase 4 appears to list:** four Phase-4 items are prose-only measurements with no module and no entry function (SSOT freshness, quality baseline, Pencil design status, plugin freshness) — 22 measurements, 18 wireable probes. **Network probes (`ci-status`, `mirror-issues`) are excluded by default** and appear as `outcome: 'skipped', reason: 'network-probe-opt-in'` — never omitted, because omitting them would rebuild the defect one layer down. Opt in with `SO_PROBES_INCLUDE_NETWORK=1`. The grounds are measured, not assumed: `hooks/hooks.json` gives the WHOLE SessionStart hook `timeout: 5` seconds while each network probe carries its own 8 s CLI timeout, so one slow network probe alone exceeds the hook's entire budget and takes the started-event and the banner down with it; warm-and-authenticated best case measured 520 ms / 498 ms, paid on every start of every repo. **Budget:** `PROBE_BUDGET_MS = 2000`; measured median against this repo **968 ms** (5 runs, 855–1104), 130–229 ms in a fresh tmp repo. Revisit trigger: median past HALF the budget, or any single probe past the budget → move the slow probes off the hook's critical path, do NOT raise the number. **Named ceiling:** the budget is PER PROBE and denominated in that probe's own work time (`work_ms`), not one shared wall-clock deadline — a shared wall deadline charged every probe for its siblings' non-preemptible `execFileSync` calls. A synchronous probe (`project-hygiene`, `tests-src-ratio`) still cannot be preempted by a timer that cannot run, so the bound is hard for async/network probes and advisory for synchronous ones. Escape hatch: `SO_DISABLE_STARTUP_PROBES=1`. **Deliberately NOT gated on `enable-host-banner: false`** — that preference governs DISPLAY; gating the RUN on it would rebuild exactly the unfalsifiable blind spot this event removes |
@@ -124,11 +164,11 @@ namespace we own. The validator + regex live in `scripts/lib/events-schema.mjs`
124
164
  | `orchestrator.foreign_dispatch.completed` | `scripts/lib/wave-executor/foreign-dispatch.mjs` (`dispatchForeign`, via `emitEvent(..., {repoRoot})` + `sessionAttribution(repoRoot)`) | once per foreign-model dispatch (#1150) — the replacement for `SubagentStop` telemetry, which cannot fire for a Bash-spawned `cursor-agent` child (no hook in the chain sees it). **Payload:** `model`, `role`, `ok`, `exit_code`, `timed_out`, `duration_s`, `changed_files` (count, tracked-modified ∪ untracked-new — `git diff` alone is blind to new files), `reason` (present on every refusal — `never-foreign-role`, `empty-diff`, `channel-unavailable`, `unsafe-*` — and on the failure classes of a completed run, so no failure class is reasonless), `hook_tampering` (tri-state: `true` = the child repointed/rewrote the shared `.git` hooks path, invalidates the run regardless of `ok`; `false` = fingerprint matched; absent/`null` = not measured, never read as clean), plus `session_id`/`semantic_session_id` via `sessionAttribution` (omitted, never fabricated, without a readable `session.lock`). Emitted on refusals too (`ok:false`), so a blocked dispatch is a record, not a silence |
125
165
  | `orchestrator.remote_dispatch.completed` | `scripts/lib/wave-executor/remote-dispatch.mjs` (`dispatchRemote`, via `emitEvent(..., {repoRoot})` + `sessionAttribution(repoRoot)`; name const `REMOTE_DISPATCH_EVENT`) | once per REMOTE-host dispatch over the `offload` CLI (#1160) — the sibling of `foreign_dispatch.completed` on the other channel: that one sends a task to a foreign MODEL on this machine, this one sends a task to Claude on ANOTHER machine. Same reason for existing — a Bash-spawned `offload` child fires no `SubagentStop` hook, so this is the only ledger record a remote dispatch produces. **Payload:** `host` (the `offload` alias, never a hostname or an IP), `role`, `run_id`, `ok`, `exit_code`, `duration_ms`, `patch_files` (COUNT of paths parsed from the returned patch — `+++ b/` plus the `diff --git` header, because a DELETED file's `+++` is `/dev/null`), `patch_bytes`, `reason` (present on every refusal — `never-foreign-role`, `unsafe-run-id`, `unsafe-host`, `unsafe-patch-path` — and on every failure class of a completed run: `usage-config`, `host-unreachable`, `remote-command-failed`, `sync-failed`, `timeout`, `empty-diff`, `rate-limited`, `write-lock-busy`, `channel-unavailable`; absent means success, so no failure class is reasonless), plus `session_id`/`semantic_session_id` via `sessionAttribution` (omitted, never fabricated, without a readable `session.lock`). **Emitted on refusals too** (`ok:false`, `exit_code: null`, `duration_ms: 0`, `patch_files: 0`) — a blocked dispatch is a record, not a silence, and the null exit code is what keeps "refused" distinguishable from "attempted and measured empty". **Deliberately EXCLUDED, pinned by a test:** the prompt text, the patch BODY, and `patch_path` — this payload also travels over the optional Clank webhook with no redaction, and a tmp patch path names the run id and the operator's host |
126
166
  | `orchestrator.offload.synced` | **not emitted in this repo** — the `offload` CLI in projects-baseline (`scripts/remote-offload/offload`, `log_sync_event`, offload 1.4.1) | once per SUCCESSFUL sync step — `offload sync`, and `run`, `gate`, `claude` unless `--no-sync`, and `session` only with `--sync`; a failed sync writes nothing. Appended to `<repo>/.orchestrator/metrics/events.jsonl` only when that directory already exists (never created; a missing `jq` or a failed append is a warning, never an error). Registered here so readers of `events.jsonl` can name the record (#1299). **Payload:** `schema_version` (1), `host` (the offload alias), `repo`, `direction` (always `local->host`), `local_sha`, `snapshot`, `files` and `deleted` (counts), `deleted_paths` (array). No `session_id` — the CLI has no session context |
127
- | `orchestrator.wave_dispatch.scope_checked` | `hooks/pre-task-scope-disjoint.mjs` (name const `SCOPE_EVENT`; built by `decide()` as `verdict.telemetry`, emitted in `main()` via `emitEvent(..., {repoRoot: sessionRoot})` + `sessionAttribution(sessionRoot)` — the session root from `resolveSessionRoot()` in `scripts/lib/platform.mjs` (#1492, which replaced the hook-local `sessionRootOf()`): the repo root of the payload `cwd` — the git toplevel the hook already holds, else the nearest `.git` ancestor of that `cwd` (a spawn-free walk, so a timed-out toplevel lookup cannot fall back to the launch directory) — lifted to `<P>` when it is a harness subagent worktree `<P>/.claude/worktrees/agent-<hex>`, and replaced by the launch dir (`$CLAUDE_PROJECT_DIR`, on the Cursor/Pi bridges their `*_PROJECT_DIR`, which is the payload cwd) when it lies strictly above it (never above the launch dir; bridge sessions therefore follow their cwd, as before #1492); only when `cwd` is in no repo the launch dir from env, else that `cwd`; never the subdirectory a `cd` moved to, which split ledger and records into `<root>/sub/.orchestrator/` before #1489 Pkt 6, and never the LAUNCH dir `$CLAUDE_PROJECT_DIR` keeps after the session enters a worktree — preferred there (be6a2e3e), it put every worktree session of one launch dir on ONE ledger, dropped `wave`, and moved the records away from the worktree `events.jsonl` that `scope-echo --verify` reads) | PreToolUse `Agent` — **once per dispatch DECISION** (#1092), awaited BEFORE the terminal `emitAllow`/`emitDeny`/`emitWarn`, all of which `process.exit()` and would discard a pending append. **Payload:** `hook`, `agent_id` (the coordinator's `description` + `subagent_type`, clamped to 120 chars), `declared_path_count`, `injected` (a `FILE-SCOPE` declaration was found AND at least one path survived parsing), `shape` (`fenced` \| `inline` \| `none` — which PARSER won, deliberately not a second spelling of `signal`: a fenced block whose lines are prose is `signal: 'unparseable', shape: 'none'`), `signal` (`marker-absent` \| `unparseable` \| `extracted` — the row-5-vs-row-6 distinction of the hook's error-class matrix), `ledger_result` (`no-scope` \| `allow` \| `allow-finished` \| `deny` \| `warn-ledger-corrupt` \| `warn-not-evaluable` \| `deny-stale-base` — the last one set by `main()`, not `decide()`: the #1485 stale-worktree-base check refused a dispatch the collision verdict alone would have let through, so a refused dispatch is never counted as an allow (#1489 Pkt 8); a collision deny beside a stale base keeps `deny`; every value starting with `deny` means the dispatch did NOT happen), optional `collision_result` (present exactly when `ledger_result` is `deny-stale-base`: the value `decide()` returned and `main()` replaced — `no-scope` \| `allow` \| `allow-finished` \| `warn-ledger-corrupt` \| `warn-not-evaluable` — so a corrupt or unevaluable ledger behind a stale-base deny is not reported on stderr alone), `collision_count` (collisions involving THIS dispatch, live or already-finished — `ledger_result` says which), optional `known_files_skipped` (`budget-exhausted` \| `git-error` — present only when the tracked-file listing for glob expansion degraded to empty, matrix row 8: `budget-exhausted` = the fire's shared 1500 ms git deadline ran out first, #1489 Pkt 7), `marker_found` (a declaration of any recognised shape was seen — `signal !== 'marker-absent'`; NOT a second spelling of `injected`, which additionally requires a path to have survived), `echo_instruction_present` (an `End your final report with the line: SCOPE-DIGEST: <8hex>` line was found in the SAME prompt). **Optional, absent-is-not-zero — the digest trio (#1092):** `scope_digest` (8-hex `scopeDigest()` over the paths extracted FROM THE PROMPT — the join key `scope-echo --verify` uses; **OMITTED for an empty scope**, never the digest of the empty string, which is a real 8-hex value that would join every marker-absent Discovery dispatch to every other), `instructed_digest` (the 8-hex the echo line names — omitted when no line was found), `digest_consistent` (`scope_digest === instructed_digest` — omitted unless BOTH are present; `false` is agent A's fenced block beside agent B's echo line, caught at dispatch time with no filesystem read). All three are computed inside `scopeDigestFields()`, which is TOTAL by construction: a throwing digest function costs the FIELD, never the verdict. **Why a digest and not `agent_id`:** measured 2026-09-16 over this host's ledger — 609 `scope_checked` against 51 `scope_echo_checked`, agent-id set overlap **zero** (send writes `description` + `subagent_type`, receive writes the coordinator's short handle), so the two halves were unjoinable. **Optional, absent-is-not-zero:** `wave` (the number out of `waveKeyOf()`'s `w<N>` segment — **omitted, never `0`**, under the `<session>\|w?\|?` fallback, same contract as `quality_gate`'s `wave_number`), plus `session_id` / `semantic_session_id` via `sessionAttribution` — omitted, never fabricated, without a readable `session.lock` at the session root (a worktree entered after launch usually has none: the lock is written at the launch dir — measured 2026-10-02 — and is never borrowed from there, where it may name a peer). **What it proves and what it does not:** that the hook SAW (or did not see) a declaration in the prompt the coordinator handed to the dispatch tool, and what the guard decided — the SEND side. It proves nothing about the block reaching the agent's context or the agent reading it; that receive-side half of #1092 stays open for want of a platform prompt-assembly boundary (`docs/scope-collision-guard.md` § 4.2). **No prompt body and no declared path is in the payload** (issue #1092 acceptance criterion 3) — counts and closed enums only, because this record also travels over the optional Clank webhook with no redaction. Rows 1–4 of the matrix emit nothing (no decision was made) and neither do the two crash rows 2/12 — a hook that fell over cannot describe itself, which is what the `GUARD INACTIVE` stderr banner is for |
167
+ | `orchestrator.wave_dispatch.scope_checked` | `hooks/pre-task-scope-disjoint.mjs` (name const `SCOPE_EVENT`; built by `decide()` as `verdict.telemetry`, emitted in `main()` via `emitEvent(..., {repoRoot: sessionRoot})` — written to `eventsFilePath(sessionRoot)`, the session root's repo ledger (a linked worktree maps to its main checkout, #1514 point 1), with `sessionAttribution(sessionRoot)` read at the session root from `resolveSessionRoot()` in `scripts/lib/platform.mjs` (#1492, which replaced the hook-local `sessionRootOf()`): the repo root of the payload `cwd` — the git toplevel the hook already holds, else the nearest `.git` ancestor of that `cwd` (a spawn-free walk, so a timed-out toplevel lookup cannot fall back to the launch directory) — lifted to `<P>` when it is a harness subagent worktree `<P>/.claude/worktrees/agent-<hex>`, and replaced by the launch dir (`$CLAUDE_PROJECT_DIR`, on the Cursor/Pi bridges their `*_PROJECT_DIR`, which is the payload cwd) when it lies strictly above it (never above the launch dir; bridge sessions therefore follow their cwd, as before #1492); only when `cwd` is in no repo the launch dir from env, else that `cwd`; never the subdirectory a `cd` moved to, which split ledger and records into `<root>/sub/.orchestrator/` before #1489 Pkt 6, and never the LAUNCH dir `$CLAUDE_PROJECT_DIR` keeps after the session enters a worktree — preferred there (be6a2e3e), it put every worktree session of one launch dir on ONE ledger, dropped `wave`, and moved the records away from the worktree `events.jsonl` that `scope-echo --verify` reads) | PreToolUse `Agent` — **once per dispatch DECISION** (#1092), awaited BEFORE the terminal `emitAllow`/`emitDeny`/`emitWarn`, all of which `process.exit()` and would discard a pending append. **Payload:** `hook`, `agent_id` (the coordinator's `description` + `subagent_type`, clamped to 120 chars), `declared_path_count`, `injected` (a `FILE-SCOPE` declaration was found AND at least one path survived parsing), `shape` (`fenced` \| `inline` \| `none` — which PARSER won, deliberately not a second spelling of `signal`: a fenced block whose lines are prose is `signal: 'unparseable', shape: 'none'`), `signal` (`marker-absent` \| `unparseable` \| `extracted` — the row-5-vs-row-6 distinction of the hook's error-class matrix), `ledger_result` (`no-scope` \| `allow` \| `allow-finished` \| `deny` \| `warn-ledger-corrupt` \| `warn-not-evaluable` \| `deny-stale-base` — the last one set by `main()`, not `decide()`: the #1485 stale-worktree-base check refused a dispatch the collision verdict alone would have let through, so a refused dispatch is never counted as an allow (#1489 Pkt 8); a collision deny beside a stale base keeps `deny`; every value starting with `deny` means the dispatch did NOT happen), optional `collision_result` (present exactly when `ledger_result` is `deny-stale-base`: the value `decide()` returned and `main()` replaced — `no-scope` \| `allow` \| `allow-finished` \| `warn-ledger-corrupt` \| `warn-not-evaluable` — so a corrupt or unevaluable ledger behind a stale-base deny is not reported on stderr alone), `collision_count` (collisions involving THIS dispatch, live or already-finished — `ledger_result` says which), optional `known_files_skipped` (`budget-exhausted` \| `git-error` — present only when the tracked-file listing for glob expansion degraded to empty, matrix row 8: `budget-exhausted` = the fire's shared 1500 ms git deadline ran out first, #1489 Pkt 7), `marker_found` (a declaration of any recognised shape was seen — `signal !== 'marker-absent'`; NOT a second spelling of `injected`, which additionally requires a path to have survived), `echo_instruction_present` (an `End your final report with the line: SCOPE-DIGEST: <8hex>` line was found in the SAME prompt). **Optional, absent-is-not-zero — the digest trio (#1092):** `scope_digest` (8-hex `scopeDigest()` over the paths extracted FROM THE PROMPT — the join key `scope-echo --verify` uses; **OMITTED for an empty scope**, never the digest of the empty string, which is a real 8-hex value that would join every marker-absent Discovery dispatch to every other), `instructed_digest` (the 8-hex the echo line names — omitted when no line was found), `digest_consistent` (`scope_digest === instructed_digest` — omitted unless BOTH are present; `false` is agent A's fenced block beside agent B's echo line, caught at dispatch time with no filesystem read). All three are computed inside `scopeDigestFields()`, which is TOTAL by construction: a throwing digest function costs the FIELD, never the verdict. **Why a digest and not `agent_id`:** measured 2026-09-16 over this host's ledger — 609 `scope_checked` against 51 `scope_echo_checked`, agent-id set overlap **zero** (send writes `description` + `subagent_type`, receive writes the coordinator's short handle), so the two halves were unjoinable. **Optional, absent-is-not-zero:** `wave` (the number out of `waveKeyOf()`'s `w<N>` segment — **omitted, never `0`**, under the `<session>\|w?\|?` fallback, same contract as `quality_gate`'s `wave_number`), plus `session_id` / `semantic_session_id` via `sessionAttribution` — omitted, never fabricated, without a readable `session.lock` at the session root (a worktree entered after launch usually has none: the lock is written at the launch dir — measured 2026-10-02 — and is never borrowed from there, where it may name a peer). **What it proves and what it does not:** that the hook SAW (or did not see) a declaration in the prompt the coordinator handed to the dispatch tool, and what the guard decided — the SEND side. It proves nothing about the block reaching the agent's context or the agent reading it; that receive-side half of #1092 stays open for want of a platform prompt-assembly boundary (`docs/scope-collision-guard.md` § 4.2). **No prompt body and no declared path is in the payload** (issue #1092 acceptance criterion 3) — counts and closed enums only, because this record also travels over the optional Clank webhook with no redaction. Rows 1–4 of the matrix emit nothing (no decision was made) and neither do the two crash rows 2/12 — a hook that fell over cannot describe itself, which is what the `GUARD INACTIVE` stderr banner is for |
128
168
  | `orchestrator.wave_dispatch.scope_echo_checked` | `scripts/lib/scope-echo.mjs` (name const `SCOPE_ECHO_EVENT`; verdict built by `checkScopeEcho()`, payload by `scopeEchoPayload()`, emitted from the CLI's `--emit` path via `emitEvent(..., {repoRoot})` + `sessionAttribution(repoRoot)`) | **coordinator-invoked, post-wave — once per agent** that reported in a wave, at `skills/wave-executor/references/wave-loop-review.md` step 3d-bis, after Edit-Persistence Verify. Never emitted at dispatch time and never by a hook. **Payload:** `agent_id` (the coordinator's agent id, clamped to 120 chars — omitted when not passed), `applicable` (boolean; `false` when the agent's DECLARED file-scope was EMPTY — nothing to echo a digest against — paired with `reason: 'scope-empty'`, so consumers filter this never-instructed population out of the echo rate before computing it), `echoed` (the report carried a well-formed `SCOPE-DIGEST: <8 hex>` marker), `match` (the echoed digest equals the digest of that agent's `<state-dir>/filescopes/wave-<N>/<agent-id>.json`), `expected_digest` / `actual_digest` (8-hex or `null`), `reason` (`echo-absent` \| `digest-mismatch` \| `scope-file-unreadable` \| `scope-empty` — present whenever `match` or `applicable` is false). **Optional, absent-is-not-zero:** `wave` (**omitted, never `0`**, when the caller passes no wave number — same contract as `scope_checked`'s `wave`), plus `session_id` / `semantic_session_id` via `sessionAttribution`. **What it proves and what it does not:** that the agent's final report carried the digest the coordinator injected beside the `FILE-SCOPE` block — the **receive** side of #1092, i.e. the line survived the round trip into the agent's context and back. It does NOT prove the model read, understood or obeyed the scope: the digest stands in the prompt and can be copied without ever reading the paths (the named BV-004 ceiling, `docs/scope-collision-guard.md` § 4.2). It is INFORMATIONAL — `match:false` or `echoed:false` blocks nothing and triggers no re-dispatch. **No path and no prompt body is in the payload** (issue #1092 acceptance criterion 3), same reason as the row above: this record also travels over the optional Clank webhook with no redaction |
129
169
  | `orchestrator.wave_dispatch.scope_materialized` | `scripts/materialize-wave-scope.mjs` (name const `SCOPE_MATERIALIZED_EVENT`, defined in `scripts/lib/scope-echo.mjs`; emitted from `main()` after stdout, fire-and-forget with a `.catch`) | **once per `materialize-wave-scope` CLI run**, i.e. once per wave manifest (`wave-loop-scope-manifest.md` § 3.2). Never emitted by the exported `materializeWaveScope()` function — the seam is the CLI, so a library caller writes no record. **Payload:** `wave`, `agent_count` (the records of DISPATCHED agents — excluding every `peer-session-*` record, which gets no per-agent file, AND the `coordinator` record, matched by exact id via `isCoordinatorRecordId` in `scripts/lib/scope-gate.mjs`: it does get a per-agent file, but no dispatch carries it, and counted, its usually empty `files` read as two agents sharing one scope, #1493.2), `digest_count` (DISTINCT `scopeDigest()` values among those same dispatched-agent records' non-empty file arrays — lower than `agent_count` means two agents were handed the identical scope), `transport_observable`, plus `session_id` / `semantic_session_id` via `sessionAttribution`. **`transport_observable` is the DEGRADATION half of #1092:** true iff a `PreToolUse` entry with matcher `Agent` is registered in the plugin's active `hooks/hooks.json`. On Codex / Cursor / Pi it is false BY DESIGN (no `Agent` dispatch tool — the asymmetry is registered in `DOCUMENTED_ASYMMETRIES`), and there a missing `scope_checked` record is **not** evidence of a missing injection; `scope-echo --verify` reads this field and degrades every verdict to `echo-only`. **Fails CLOSED** on any unreadable hooks file: observability we cannot prove would produce false `injection-missing` accusations. `repoRoot` is the state directory's PARENT, never `process.cwd()`, so a run from a subdirectory cannot write into another repo's ledger. Silent on failure — the corpus pins byte-empty stderr on this command's success path |
130
170
  | `orchestrator.wave_dispatch.scope_verified` | `scripts/lib/scope-echo.mjs` (name const `SCOPE_VERIFIED_EVENT`; report by `verifyWaveScope()`, payload by `scopeVerifiedPayload()`, emitted from the `--verify --emit` path) | **coordinator-invoked, post-wave — exactly ONCE per wave** (`wave-loop-review.md` step 3d-bis, after the per-agent `--emit` calls). This is the JOIN of the three halves — `scope_checked`, the `<state-dir>/filescopes/wave-<N>/*.json` artefacts, and `scope_echo_checked` — **keyed on the digest, never on `agent_id`** (see the `scope_checked` row for the zero-overlap measurement that forces it). **Payload:** `wave`, `transport_observable`, `dispatches`, `injected`, `echoed`, `malformed_lines`, `malformed_scope_files`, `by_verdict` (a count per verdict), `digests` (the 8-hex keys the row covers). `malformed_lines` counts the ledger lines the join could not parse (a writer killed mid-append leaves a truncated line — a measured shape here) and is **ALWAYS present, including as `0`**, like the three counters beside it: it is the honesty check on the denominator, because a join that silently dropped half the ledger otherwise writes a record byte-identical to a clean wave (HR-105). `malformed_lines > 0` means every count and verdict in the row is a FLOOR, not a census; the human table says so beside them. `malformed_scope_files` (#1379 P2) is the same honesty check on the FILE side — the per-agent `<state-dir>/filescopes/wave-<N>/*.json` files the join could not read or parse, also **ALWAYS present, including as `0`**; before it existed a corrupt scope file was skipped silently, so `digest-unknown` / `injection-missing` could not be told apart from a genuinely missing injection. A file that parses but holds an empty/non-array scope is NOT counted — an empty scope is legitimate. **Deliberately NO `agent_id` and no path** — unlike its two halves, this record carries a LIST, and an agent id is a free-form coordinator string that has carried private project slugs; the per-agent verdicts stay on stdout, where they never reach the webhook. **Verdict enum — SIX members** (precedence order, one row per digest, all kebab-case): `duplicate-claim` (≥2 distinct agent ids claimed one digest — agent A's scope reported for agent B) · `echoed-not-injected` (an echo names a digest no dispatch claimed) · `digest-unknown` (no scope file on disk carries it) · `matched` · `injected-not-echoed` (the normal state during a wave, before reports land) · `injection-missing` (a scope file no dispatch claimed and no agent echoed — the omitted-injection case, #1092 AC-2). **Degraded value, NOT a seventh member:** `echo-only` — what EVERY verdict collapses to when `transport_observable` is false; the precedence chain never produces it, so it is absent from `SCOPE_VERDICTS`. **Spelling migration:** `injection-missing` was `injection_missing` (the one snake_case member) until 2026-09-16 — records written before that date may carry the old key in `by_verdict`, and there is no dual-emit, so a consumer reading history must accept both. **Exit 0 for every verdict** — the tool reports; the wave-executor turns `injection-missing` / `duplicate-claim` into a STATE.md deviation, never a block |
131
- | `orchestrator.wave_dispatch.worktree_base_checked` | `hooks/pre-task-scope-disjoint.mjs` (name const `WORKTREE_BASE_EVENT`; facts by `worktreeBaseFacts()`, deny text by `staleWorktreeDeny()`, emitted in `main()` via `emitEvent(..., {repoRoot: sessionRoot})` + `sessionAttribution(sessionRoot)` — the same session root as `scope_checked` (git toplevel of the payload `cwd`, else the nearest `.git` ancestor of that `cwd` (a spawn-free walk, so a timed-out toplevel lookup cannot fall back to the launch directory), else `$CLAUDE_PROJECT_DIR`, else `cwd`; #1489 Pkt 6), which is deliberately NOT the settings root `base_ref` is read from (`settingsRootOf()`, below) — awaited BEFORE the terminal emit) | PreToolUse `Agent` — once per dispatch whose `tool_input.isolation === "worktree"` (#1413, #1424, #1485). **Payload (measured):** `hook`, `head` (full sha, `git rev-parse --verify HEAD^{commit}` in the payload `cwd`), `base` (the commit the harness will branch the agent worktree from), `base_ref` (read in precedence order `<project>/.claude/settings.local.json` → `<project>/.claude/settings.json` → `$CLAUDE_CONFIG_DIR`-or-`~/.claude`/`settings.json`, where `<project>` is the settings root `settingsRootOf()`: `$CLAUDE_PROJECT_DIR` — the launch dir, kept after entering a worktree, where the harness applies project settings from — else the git toplevel of the payload `cwd`, else that `cwd`; the FIRST file that sets `worktree.baseRef` to `"head"` or `"fresh"` decides; `"head"` — then `base` = `head`; `"fresh"` or unset — then `base` = `refs/remotes/origin/HEAD`), `base_ref_source` ∈ `local` \| `project` \| `user` \| `default` (which layer decided; managed settings and `--settings` are invisible to a hook — a `"head"` there reads as `default` when no visible file sets the key, but as that file's source when a visible file says `"fresh"`, so a wrong deny from this blind spot can carry any source), `stale` (`git merge-base --is-ancestor <head> <base>` exited 1 in a full-history repo whose FETCH_HEAD — `git rev-parse --git-path FETCH_HEAD` — is younger than 24 h: the worktree would MISS commits of HEAD; a base AHEAD of HEAD is not stale), optional `missing_commits` (`git rev-list --count base..head`, stale only), optional `subagent_type`, `decision` (`"deny"` iff `stale === true`, else `"allow"`), plus the `session_id` / `semantic_session_id` envelope. **Payload (non-measurement):** `hook`, `stale: null`, `skipped` ∈ `no-origin-head` \| `shallow` (is-ancestor exit 1 in a shallow clone — missing history, not a measured mismatch) \| `stale-remote-ref` (is-ancestor exit 1, but FETCH_HEAD is older than 24 h or absent: the harness — Claude Code 2.1.287 bundle, read 2026-10-02 — first runs `git fetch origin <default>` with a 5 s timeout and branches from the FETCHED tip, which may contain HEAD; the hook never fetches) \| `git-error` \| `git-budget` (the hook fire's ONE shared git deadline — 1500 ms across all its git calls, sized to fit the 5 s `hooks.json` timeout beside the 2 s ledger lock — ran out or cut a call short; it replaces whichever reason the cut call would have produced, because a timed-out lookup is no evidence, #1489 Pkt 7) \| `probe-error`, `decision: "allow"`, plus the envelope — no `head`, no `base` (a skip accuses nobody). **Written for EVERY `worktree` dispatch — every outcome AND every skip** — so the deny rate is `decision:"deny" / all records of this name` (HR-105). **Emits NOTHING only when `isolation` is absent** (HR-101). **DENIES the dispatch on a measured mismatch only** (owner decision 2026-10-02, option (a)); unknown is never mismatch — every skip is allowed; a collision deny keeps its own reason; a stale-base deny is decided BEFORE the scope-ledger cycle and writes no ledger claim (the dispatch did not happen). **Why it exists:** the agent worktree's base belongs to the HARNESS (the `Agent` tool has no base-ref field). Documented at code.claude.com/docs/en/worktrees § "Choose the base branch" (read 2026-10-02): "Subagent worktrees use the same base branch as `--worktree`, so they branch from your repository's default branch unless `worktree.baseRef` is set to `"head"`". #1485 measured it: agent worktrees on `main` (`0efb3e97`), six commits behind the branch HEAD (`47c49652`). The #1413/#1424 model (base = STATE.md `session-start-ref`, warn-only) is replaced; it fit s18 (2026-09-19, worktrees on `8f15f77b` after commit `240efda6`) only because that session ran on `main`, where origin/HEAD was the start commit; the `identity-mismatch` / `no-state-md` / `no-start-ref` / `no-own-id` skip reasons and the `session_start_ref` field are gone with it |
171
+ | `orchestrator.wave_dispatch.worktree_base_checked` | `hooks/pre-task-scope-disjoint.mjs` (name const `WORKTREE_BASE_EVENT`; facts by `worktreeBaseFacts()`, deny text by `staleWorktreeDeny()`, emitted in `main()` via `emitEvent(..., {repoRoot: sessionRoot})` — written to `eventsFilePath(sessionRoot)`, the session root's repo ledger (a linked worktree maps to its main checkout, #1514 point 1), with `sessionAttribution(sessionRoot)` read at the same session root as `scope_checked` (git toplevel of the payload `cwd`, else the nearest `.git` ancestor of that `cwd` (a spawn-free walk, so a timed-out toplevel lookup cannot fall back to the launch directory), else `$CLAUDE_PROJECT_DIR`, else `cwd`; #1489 Pkt 6), which is deliberately NOT the settings root `base_ref` is read from (`settingsRootOf()`, below) — awaited BEFORE the terminal emit) | PreToolUse `Agent` — once per dispatch whose `tool_input.isolation === "worktree"` (#1413, #1424, #1485). **Payload (measured):** `hook`, `head` (full sha, `git rev-parse --verify HEAD^{commit}` in the payload `cwd`), `base` (the commit the harness will branch the agent worktree from), `base_ref` (read in precedence order `<project>/.claude/settings.local.json` → `<project>/.claude/settings.json` → `$CLAUDE_CONFIG_DIR`-or-`~/.claude`/`settings.json`, where `<project>` is the settings root `settingsRootOf()`: `$CLAUDE_PROJECT_DIR` — the launch dir, kept after entering a worktree, where the harness applies project settings from — else the git toplevel of the payload `cwd`, else that `cwd`; the FIRST file that sets `worktree.baseRef` to `"head"` or `"fresh"` decides; `"head"` — then `base` = `head`; `"fresh"` or unset — then `base` = `refs/remotes/origin/HEAD`), `base_ref_source` ∈ `local` \| `project` \| `user` \| `default` (which layer decided; managed settings and `--settings` are invisible to a hook — a `"head"` there reads as `default` when no visible file sets the key, but as that file's source when a visible file says `"fresh"`, so a wrong deny from this blind spot can carry any source), `stale` (`git merge-base --is-ancestor <head> <base>` exited 1 in a full-history repo whose FETCH_HEAD — `git rev-parse --git-path FETCH_HEAD` — is younger than 24 h: the worktree would MISS commits of HEAD; a base AHEAD of HEAD is not stale), optional `missing_commits` (`git rev-list --count base..head`, stale only), optional `subagent_type`, `decision` (`"deny"` iff `stale === true`, else `"allow"`), plus the `session_id` / `semantic_session_id` envelope. **Payload (non-measurement):** `hook`, `stale: null`, `skipped` ∈ `no-origin-head` \| `shallow` (is-ancestor exit 1 in a shallow clone — missing history, not a measured mismatch) \| `stale-remote-ref` (is-ancestor exit 1, but FETCH_HEAD is older than 24 h or absent: the harness — Claude Code 2.1.287 bundle, read 2026-10-02 — first runs `git fetch origin <default>` with a 5 s timeout and branches from the FETCHED tip, which may contain HEAD; the hook never fetches) \| `git-error` \| `git-budget` (the hook fire's ONE shared git deadline — 1500 ms across all its git calls, sized to fit the 5 s `hooks.json` timeout beside the 2 s ledger lock — ran out or cut a call short; it replaces whichever reason the cut call would have produced, because a timed-out lookup is no evidence, #1489 Pkt 7) \| `probe-error`, `decision: "allow"`, plus the envelope — no `head`, no `base` (a skip accuses nobody). **Written for EVERY `worktree` dispatch — every outcome AND every skip** — so the deny rate is `decision:"deny" / all records of this name` (HR-105). **Emits NOTHING only when `isolation` is absent** (HR-101). **DENIES the dispatch on a measured mismatch only** (owner decision 2026-10-02, option (a)); unknown is never mismatch — every skip is allowed; a collision deny keeps its own reason; a stale-base deny is decided BEFORE the scope-ledger cycle and writes no ledger claim (the dispatch did not happen). **Why it exists:** the agent worktree's base belongs to the HARNESS (the `Agent` tool has no base-ref field). Documented at code.claude.com/docs/en/worktrees § "Choose the base branch" (read 2026-10-02): "Subagent worktrees use the same base branch as `--worktree`, so they branch from your repository's default branch unless `worktree.baseRef` is set to `"head"`". #1485 measured it: agent worktrees on `main` (`0efb3e97`), six commits behind the branch HEAD (`47c49652`). The #1413/#1424 model (base = STATE.md `session-start-ref`, warn-only) is replaced; it fit s18 (2026-09-19, worktrees on `8f15f77b` after commit `240efda6`) only because that session ran on `main`, where origin/HEAD was the start commit; the `identity-mismatch` / `no-state-md` / `no-start-ref` / `no-own-id` skip reasons and the `session_start_ref` field are gone with it |
132
172
  | `orchestrator.hook.import_probe_failed` | `hooks/post-edit-import-probe.mjs` | PostToolUse(Edit\|Write\|MultiEdit), after a module listed in `hooks/_lib/hook-import-set.json` (the committed hook-reachable allowlist) fails the probe. **Payload:** `file` (repo-relative), `check` (`eslint` \| `import` — which of the two checks caught it), `error` (the first offending message: a `no-undef`/fatal ESLint message, or the import diagnostic line), `reachable_from` (the hook entry basenames that import this module — the blast radius, since a throwing helper turns every tool call into "Internal hook error — request blocked" host-wide, #1224), `duration_ms`. Emitted ONLY on failure; a clean edit produces no record, so the event count IS the incident count |
133
173
  | `orchestrator.reconcile.completed` | `scripts/lib/reconcile/engine.mjs` (`emitReconcileCompleted`, called from the thin `runReconcile` wrapper; name const `RECONCILE_EVENT`) | one record per `runReconcile` call (#1192) — from the WRAPPER, so all three return points are covered: the empty short-circuit, the normal tail, and the never-throws catch. An inline emit would have missed two of them, including the empty corpus and the error path — the two runs an operator most needs recorded (`.claude/rules/host-resources.md` § HR-105). Same shape as `narrative_mirrored`'s wrapper, and the emit is try/catch-wrapped because `emitEvent` THROWS `EventValidationError`, which would otherwise break `runReconcile`'s never-throws contract. **Payload, all ALWAYS present including as `0`** (each was measured over the whole run, like `mirror_run_completed`'s counters): `trigger` (`skill` \| `session-end` \| `phase-skip` \| `unknown` — written always, so the per-trigger denominator is complete; the two markdown callers depend on a coordinator passing it, hence the honest `unknown` default), `dry_run`, `learnings_total`, `eligible`, `proposals`, `rejected`, `capped`, `already_materialized` (`summary.alreadyMaterialized` — the REAL idempotent-skip count, #484), `candidate_store_merged` (boolean — the `reconcile-candidates.jsonl` idempotency-sidecar merge, derived from `summary.written` at `scripts/lib/reconcile/engine.mjs:791`, which is the engine's ONLY disk write. It is NOT a rule-write signal: the engine never touches `.claude/rules/`, and this event is emitted BEFORE the operator-approval AUQ. For "a rule reached `.claude/rules/`" read `orchestrator.reconcile.rules_written` (row below) — its `rules_written` count is the only field that carries that claim. **Renamed from `written` in #1315** because the old name read as "rule files were written" and was misread on exactly that basis (#1307). The legacy key `written` is STILL emitted, carrying the identical boolean from the same expression so the two can never disagree — deprecated, removal **2027-03-13**, same one-generation dual-emit convention as the `orchestrator.session.stopped` → `orchestrator.turn.stopped` rename (#1234). `schema_version` is NOT bumped: it versions the record envelope, and the payload contract here stays additive), `duration_ms`. **Optional, absent-is-not-zero:** `targets` (the caller's effective target list; absent ⇒ none asserted), `store_records_dropped` (`summary.skipped` — absent ⇒ the candidate store was never INSPECTED: under `dryRun`, on the empty short-circuit, on the error path; a `0` there would be a false all-clear), and `aborted: 'engine-error'` + `reason` (path-redacted, THEN clamped to 300 chars: `redactLocalPaths` in `scripts/lib/reconcile/engine.mjs` replaces the absolute repo root with `<repo>` and the home directory with `~` before the clamp, so an engine error message never writes a host-local path into the ledger) — present ONLY when the never-throws guard fired; their absence means "ran to the end", never "unknown". **`dry_run` is the discriminator, not the event's absence:** the `phase-skip` caller runs dry on EVERY close and is the highest-volume trigger, so consumers filter `dry_run: false` for real runs. **A missing `repoRoot` SKIPS the emit with a stderr WARN** rather than falling back to `SO_PROJECT_DIR` — most engine tests pass none, and the fallback would append synthetic records to the real fleet ledger on every `npm test` (#1119, same contract as `express_path.evaluated` and `narrative_mirrored`); a regression test pins it. **Engine identities — the counters are NOT a flat partition, and a live payload reads as inconsistent without them** (source: `scripts/lib/reconcile/engine.mjs:64-83`): `learnings_total === proposals + rejected`, and `capped` + `already_materialized` are DIAGNOSTIC SUB-COUNTS *inside* `rejected`, not siblings of it — each capped or already-materialized learning is also counted as rejected. Within the eligible set: `eligible − proposals − capped === already_materialized`. Worked against a live record: `learnings_total 164 = proposals 10 + rejected 154`, and `eligible 102 − proposals 10 − capped 72 = already_materialized 20` — with `capped 72` and `already_materialized 20` both sitting inside those 154. `already_materialized` is computed BEFORE the volume brake, so a terminal learning never consumes a new learning's quota. `session_id` / `semantic_session_id` / `wave` / `schema_version` are stamped by `emitEvent()` |
134
174
  | `orchestrator.reconcile.rules_written` | `scripts/lib/reconcile/writer.mjs` (`emitRulesWritten`, called from the tail of `writeApprovedRules`; name const `RULES_WRITTEN_EVENT`) | one record per rule-WRITE pass (#1307) — the companion `orchestrator.reconcile.completed` is emitted by the `runReconcile` wrapper, which runs BEFORE the operator-approval AUQ and before this module is reached at all, so a `dry_run: false` record there proves the engine ran and merged the candidate store, NEVER that a rule reached `.claude/rules/`: an operator who declines every proposal emits a byte-identical record to one who approves five. This event is the one that proves the write. Emitted from the FUNCTION TAIL, so both return points are covered — the normal pass and the lock-acquisition failure (which is a zero-write pass carrying `write_errors: 1`). **Payload, all ALWAYS present including as `0`:** `rules_written` (FILE count, not proposal count — one approved proposal written to two targets counts twice), `approved_proposals` (how many the operator approved), `rejected_archived` (records appended to `.orchestrator/reconcile.rejected.log`), `write_errors` (`result.errors.length`). **Optional, absent-is-not-zero:** `targets` (allowlisted to the CLOSED `TARGET_DIRS` key set — `repo-local` \| `baseline` — because the list originates in operator-authored Session Config and an unknown value would be a verbatim echo of untrusted text; absent ⇒ none in effect). **A ZERO-WRITE PASS IS EMITTED, and the discriminator is a FIELD, never the event's absence** (same convention this table states for `dry_run` one row up, and `.claude/rules/host-resources.md` § HR-105): `rules_written: 0` with `approved_proposals: 0` is *the operator declined everything*, while `rules_written: 0` with a non-zero `approved_proposals` and `write_errors` is *every write was refused by a guard* — outcomes a success-only emitter would collapse into one silence, together with *the writer was never reached*. The ONE case that emits nothing is the caller's true no-op (neither an approved nor a rejected item), which returns before the lock is taken. **The emit is not a write:** the #693 FA2/FA3 brandmauer is unchanged — `writeApprovedRules` is still the only module that writes rule files and still writes only operator-approved items. **A missing `repoRoot` SKIPS the emit silently** (same #1119 contract as the row above), and the whole emit is try/catch-wrapped to stderr because `emitEvent` THROWS `EventValidationError`, which would otherwise break `writeApprovedRules`'s never-throws contract. `session_id` / `semantic_session_id` / `wave` / `schema_version` are stamped by `emitEvent()` |
@@ -145,6 +185,7 @@ namespace we own. The validator + regex live in `scripts/lib/events-schema.mjs`
145
185
  | `discovery_validator_violation` | `hooks/post-subagent-discovery-validator.mjs` | SubagentStop, when `discovery-validator.enabled: true` (default `false`). One record per distinct normalized claim per session; log + warn only, the hook never blocks and always exits 0. Legacy bare name, like `stagnation_detected`. Field contract in § `discovery_validator_violation` below |
146
186
  | `orchestrator.issue_budget.refunded` | `hooks/post-bash-issue-budget-refund.mjs` (`emitRefundDecision`; name const `ISSUE_BUDGET_REFUNDED_EVENT`) | once per refund DECISION — one record per `PostToolUseFailure` delivery whose command contains at least one `gh`/`glab issue create` statement, emitted on the no-op branches too so a census over N sessions has a denominator and not only a numerator. Before #1353 a refund wrote a stderr line only, which under exit 0 reaches the debug log alone: the refund path was unfalsifiable in the sense of `.claude/rules/host-resources.md` HR-105. **Payload:** `reason` (always, CLOSED enum — `refunded` \| `not-charged` \| `chain-not-attributable` \| `counter-at-zero` \| `no-signal`), `unit` (`count` \| `exempt` \| `null` — which counter was given back, read off the honoured charge records; `exempt` only when EVERY refund landed on the exempt counter, `null` whenever nothing was refunded), `statement_count` (issue-create statements `findIssueCreateStatements` found), plus `session_id`/`semantic_session_id` via `sessionAttribution`. Branch mapping: `no-signal` = G2b (a failure event carrying no failure FIELD), `chain-not-attributable` = G3b (the create is not the whole command, so the exit code judges neither), `refunded` = G5 with at least one honoured charge record, `not-charged` = G5 with none (parked at the cap, a re-delivered failure, or an identity-less call `refundBooking` answers `no-session` for). **`counter-at-zero` has no branch in the hook today**: a matched record whose counter is already 0 is absorbed by `refundBooking`'s never-below-zero guard and returns `refunded` like any other match, so the case is not observable without a new field on the shared core's verdict (`scripts/lib/issue-budget.mjs`) — the enum value is reserved, not dead. `mode: off` emits NOTHING (G4 returns before it, and there was no charge to give back). **No command text, issue title or path is in the payload** — it travels verbatim over the optional Clank webhook with no redaction, same rule as `orchestrator.issue_budget.reconciled`. `events.mjs` is imported lazily, awaited AND caught: a throwing emit must never change the hook's exit code or output |
147
187
  | `orchestrator.reaper.scan_completed` | `scripts/lib/orphan-reaper/scan.mjs` (`runOrphanScan`, re-exported by `scripts/lib/orphan-reaper.mjs`, emitted through `deps.emitEvent`; name const `REAPER_SCAN_EVENT`) | at most ONE record per orphan scan (Epic #1425 B5/B6), and **only when the scan found something** — `candidates + reported + killed > 0`, or `instrument_suspect` is true. A scan that found nothing emits nothing: the reaper is wired to a `PostToolBatch`-class hook, and a per-fire record would be exactly the always-on signal `.claude/rules/host-resources.md` HR-101 calls a broken instrument. **Payload:** `scanned` (rows in the `ps` snapshot), `candidates`, `reported`, `rejected`, `killed` (COUNTS, not the arrays the function returns), `unattributed` (of the `reported`, how many carried NO `sessionId` on their ledger record — broken out because it is a PRODUCER defect, not a decision: the foreign-session guard was inert across 377 of 377 live records and the generic `reported` count could not show it), `peer_liveness` (`measured` — `detectPeers()` answered, possibly with an empty list — or `unmeasured` — the probe could not answer at all; the two are opposite facts and an unmeasured probe must never read as “no peers are alive”), `survived_sigkill` (killed entries still alive after the ladder — never booked as success, PRD B6), `dry_run`, `duration_ms`, `instrument_suspect` (the false-alarm rate over the last 50 audit decisions exceeds the 10 % HR-101 ceiling — REPORTED, never acted on: the answer to a suspect instrument is re-aiming it, not re-thresholding it). **Optional:** `false_alarm_rate` (0..1) — **OMITTED, never 0**, below the 10-decision floor `falseAlarmRate()` requires; an absent rate means "no population yet", and a fabricated zero would read as a measured-clean instrument. Correlation keys come from `emitEvent()`'s own attribution against the passed `repoRoot`. Per-decision detail (trigger, threshold, ist-value, pid/pgid, command signature, outcome) lives in the separate B5 audit `.orchestrator/metrics/reaper-audit.jsonl`, not in this record |
188
+ | `orchestrator.ledger.unreadable` | `scripts/lib/orphan-reaper/scan.mjs` (`runOrphanScan`, emitted through `deps.emitEvent`; name const `LEDGER_UNREADABLE_EVENT`, #1505 point 5a) | at most ONE record per orphan scan that ends `skipped: 'ledger-unreadable'` — the process register could not be read, so the scan measured nothing. The CLI's exit 2 for that case is ignored by the detached hook child; this record is what makes a switched-off scan COUNTABLE (HR-105). Throttled with the scan, so never a per-fire signal (HR-101). **Payload:** `path` (repo-relative register path, `.orchestrator/runtime/gate-processes.jsonl` — never a host path), `reason` (`refused` — the reader returned `state: 'unreadable'`: a symlink, a non-regular file, EACCES — or `reader-threw`), `consumer` (`orphan-reaper`). Correlation keys come from `emitEvent()`'s own attribution against the passed `repoRoot`. A failing emit never fails the scan |
148
189
 
149
190
  Non-orchestrator names still present in the stream: `tmux-layout.{invoked,completed,degraded}`
150
191
  (tmux-layout skill) and `stagnation_detected`. The latter keeps its legacy bare name
@@ -22,8 +22,9 @@ github https://github.com/Kanevry/session-orchestrator.git # p
22
22
  - `github` (the mirror) is pushed **directly** by `git push github HEAD` in the
23
23
  `github-mirror-push` block of `skills/session-end/SKILL.md` (`:238`, measured
24
24
  2026-09-09) — no MR, no review, no gate. Any session's `/close` does this
25
- the moment a `github` remote exists (the block does not actually re-check the
26
- `mirror: github` Session Config key at runtime, only the remote's presence).
25
+ the moment a `github` remote exists, unless the Session Config sets
26
+ `mirror: none` (#1034: an absent key still pushes, so this repo — which sets
27
+ no `mirror:` key — mirrors on every `/close`).
27
28
  `scripts/release.mjs` (`:1333-1338`) does the same for `main` + the tag on
28
29
  every `--publish`.
29
30
  - **The push runs on the operator's machine, not in CI.** There is no GitLab CI
package/docs/install.md CHANGED
@@ -22,6 +22,33 @@ uninstall.
22
22
 
23
23
  ## Install
24
24
 
25
+ ### Native Windows MCP (opt-in, #1522)
26
+
27
+ With the updated package installed, find its `installPath` using
28
+ `claude plugin list --json`, then run in PowerShell:
29
+
30
+ ```powershell
31
+ node scripts/windows-setup.mjs "C:\path\to\installed\session-orchestrator"
32
+ ```
33
+
34
+ Run the setup script from the updated checkout, targeting the installed plugin
35
+ inside `plugins/cache` (never a Git checkout). It changes only that installed
36
+ plugin's MCP command to the current native Node executable and the absolute
37
+ `scripts/mcp-server.mjs` path, preserving other servers and keeping the original
38
+ configuration in `.mcp.json.before-windows-setup`. Restart the agent to load it.
39
+ To roll back, inspect the backup first and restore its original contents to
40
+ `.mcp.json`. Remove `.mcp.json.before-windows-setup` before running setup again.
41
+ Reinstalling the plugin replaces this local
42
+ configuration; run setup again for the new install path. This opt-in avoids
43
+ accidentally selecting Windows' `bash.exe` WSL launcher. The native server has
44
+ the same two read-only tools and needs neither Bash nor jq.
45
+
46
+ Windows package staging also launches npm through its JavaScript entrypoint;
47
+ Node and npm must be installed together or npm must be on an absolute PATH.
48
+ This does **not** establish native Windows hook/guard parity: Git Bash remains
49
+ necessary for the existing shell hooks, tracked separately in #1394. The
50
+ repository-wide validation currently has a POSIX-only jq discovery step.
51
+
25
52
  | Platform | Install |
26
53
  |---|---|
27
54
  | **Claude Code** | `/plugin marketplace add Kanevry/session-orchestrator` then `/plugin install session-orchestrator@kanevry` (run both inside Claude Code). |
@@ -84,9 +111,18 @@ JSON (measured 2026-10-02). Later releases dropped the `overrides` block. If
84
111
  `node_modules/` is missing, run `npm ci --omit=dev` in that directory.
85
112
 
86
113
  **From a clone, one command does all of it:** `npm run update:local`
87
- (`scripts/self-update.mjs`) fast-forwards the clone, updates the Claude Code
88
- marketplace and plugin, installs missing runtime dependencies in the plugin
89
- directory, and re-runs the Codex installer if the plugin is installed in Codex.
114
+ (`scripts/self-update.mjs`) fast-forwards the clone, packs it with `npm pack`
115
+ into `~/.cache/session-orchestrator/plugin-package/` (`$XDG_CACHE_HOME` if set),
116
+ updates the Claude Code marketplace and plugin from that packed copy, installs
117
+ missing runtime dependencies in the plugin directory, and re-runs the Codex
118
+ installer if the plugin is installed in Codex (it installs from the same packed
119
+ copy, #1518). The marketplace must read the
120
+ packed copy, never the clone: a directory marketplace on the working checkout
121
+ copies every file of it into the plugin cache, `.env.local` included (#1515).
122
+ The Claude step refuses while any `directory` marketplace reads the clone and
123
+ prints the exact `claude plugin marketplace remove <name>` and
124
+ `claude plugin marketplace add ~/.cache/session-orchestrator/plugin-package`
125
+ commands; a GitHub- or npm-sourced marketplace updates as before.
90
126
  `--dry-run` shows the commands first; old cache folders are never deleted,
91
127
  because the running session still uses them until the restart. On Cursor and the Pi clone fallback, upgrade
92
128
  with `git pull` in your clone followed by the same install script you originally
package/docs/pi-setup.md CHANGED
@@ -76,7 +76,7 @@ The package manifest in `package.json` exposes:
76
76
 
77
77
  - `pi.extensions`: `./pi/extensions/session-orchestrator.ts`
78
78
  - `pi.skills`: `./skills`
79
- - `pi.prompts`: `./pi/prompts/*.md` generated from `commands/*.md` plus every skill with explicit `user-invocable: true`
79
+ - `pi.prompts`: `./pi/prompts/*.md` generated from `commands/*.md` plus every skill whose `user-invocable` is `true` or absent (Claude Code's picker reading; `check-skills` requires the key to be stated)
80
80
 
81
81
  The extension uses `hooks/hooks-pi.json` and `scripts/lib/pi-hook-bridge.mjs` to translate Pi events into the existing hook stdin contract.
82
82
 
@@ -28,7 +28,7 @@ All keys are optional. Unknown keys are **ignored without error** — adding a n
28
28
  | `mode` | `string` (`housekeeping` \| `feature` \| `deep`) | no | Session-mode gate. Rule loads only in the named session mode. Absent = passes every mode. | `mode: deep` |
29
29
  | `host-class` | `string` | no | Host-class gate. Matched against `host_class` in `.orchestrator/host.json`. Rule loads only on matching hosts. Absent = passes every host. | `host-class: macos-arm64-m4pro` |
30
30
  | `alwaysApply` | `boolean` | no | Author intent flag (distinct from the loader's internal `alwaysOn` "no globs" computation). Used by FA4 validation, not by gating. | `alwaysApply: false` |
31
- | `expires-at` | `string` (ISO 8601 date) | no | Expiry gate. After this date the rule is EXCLUDED with a stderr WARN. A malformed value never excludes (fail-open). | `expires-at: 2026-12-31` |
31
+ | `expires-at` | `string` (ISO 8601 date) | no | Expiry gate, **inclusive**: the rule still loads on this date and is EXCLUDED (with a stderr WARN) from the following UTC midnight. A malformed value never excludes (fail-open). | `expires-at: 2026-12-31` |
32
32
  | `learning-key` | `string` | no | Links the rule to a `learnings.jsonl` entry (type/subject key). Required on auto-generated rules. | `learning-key: testing/shard-dont-widen` |
33
33
  | `auto-generated` | `boolean` | no | Marks a rule produced by the FA2 reconciliation engine (not hand-authored). Triggers the never-always-on invariant (see below). | `auto-generated: true` |
34
34
  | `confidence` | `number` (0..1) | no | Confidence of the source learning that generated the rule. Mirrors the `learnings.jsonl` confidence field. | `confidence: 0.85` |
@@ -46,7 +46,7 @@ After a rule's frontmatter parses successfully, the loader applies deterministic
46
46
  - **Glob axis (#336)** — `globs:` absent → always-on (passes). `globs:` present and non-empty → must intersect `scopePaths`. `globs: []` → matches nothing, never loaded.
47
47
  - **Mode-gating** — when the `mode` runtime param is non-null and the rule declares a `mode` that differs, the rule is EXCLUDED. A **null `mode` param disables mode filtering entirely**. A rule **without a `mode` key always passes** the mode gate.
48
48
  - **Host-class-gating** — identical logic against the `hostClass` runtime param vs the rule's `host-class` value. Null param = no filtering; absent rule key = passes.
49
- - **Expiry** — a rule with a parseable `expires-at` strictly before `now` is EXCLUDED, with a mandatory stderr WARN. A rule without `expires-at`, or with a malformed `expires-at`, is **not** excluded.
49
+ - **Expiry** — a rule whose parseable `expires-at` has passed is EXCLUDED, with a mandatory stderr WARN. A bare `YYYY-MM-DD` is inclusive: the rule loads through that whole UTC day and drops out at the next UTC midnight (#1521); a full timestamp is taken as written. Loader, the maintenance probe's `generated-rules-expiring` signal and the rule-expiry sweep share one predicate (`ruleExpiryInstantMs` in `scripts/lib/rule-loader.mjs`), so none of them calls a rule expired while another still treats it as live. A rule without `expires-at`, or with a malformed `expires-at`, is **not** excluded.
50
50
  - **Tier-gating (#692)** — gated on the `context` runtime param (not a host/mode param). `context: 'wave'` excludes `tier: coordinator-only` rules; `context: 'coordinator'` excludes `tier: wave-only` rules; `context: null` (the default) disables tier filtering entirely. A rule without a `tier` key passes the tier gate in every context. See [Tier gating](#tier-gating-issue-692) below.
51
51
 
52
52
  **The activation logic in one sentence:** *a null/absent gate parameter performs no filtering on that axis, and a rule that lacks a given gate key passes that gate unconditionally — so a rule with no frontmatter clears every gate and is always-on, byte-for-byte.*