session-orchestrator 4.1.0 → 5.0.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 (230) hide show
  1. package/.agents/skills/session-plan/SKILL.md +1 -1
  2. package/.agents/skills/session-start/SKILL.md +1 -1
  3. package/.agents/skills/ux-grill/SKILL.md +22 -0
  4. package/.claude-plugin/marketplace.json +1 -1
  5. package/.claude-plugin/plugin.json +3 -2
  6. package/.codex-plugin/plugin.json +1 -1
  7. package/.codex-plugin/skills/session-plan/SKILL.md +1 -1
  8. package/.codex-plugin/skills/session-start/SKILL.md +1 -1
  9. package/.codex-plugin/skills/ux-grill/SKILL.md +21 -0
  10. package/.codex-plugin/skills/ux-grill/agents/openai.yaml +5 -0
  11. package/.cursor/commands/ux-grill.md +14 -0
  12. package/.cursor/skills/session-plan/SKILL.md +1 -1
  13. package/.cursor/skills/session-start/SKILL.md +1 -1
  14. package/.cursor/skills/ux-grill/SKILL.md +13 -0
  15. package/.cursor-plugin/plugin.json +1 -1
  16. package/AGENTS.md +2 -1
  17. package/CHANGELOG.md +128 -1
  18. package/README.md +98 -86
  19. package/agents/dialectic-deriver.md +11 -0
  20. package/agents/ux-evaluator.md +1 -1
  21. package/commands/close.md +3 -3
  22. package/commands/go.md +2 -0
  23. package/commands/memory-cleanup.md +4 -3
  24. package/commands/persona-panel.md +1 -1
  25. package/commands/session.md +3 -2
  26. package/commands/ux-grill.md +51 -0
  27. package/docs/README.md +4 -4
  28. package/docs/USER-GUIDE.md +117 -50
  29. package/docs/agent-authoring.md +2 -2
  30. package/docs/baseline.md +55 -1
  31. package/docs/ci-setup.md +1 -1
  32. package/docs/codex-setup.md +9 -0
  33. package/docs/components.md +9 -9
  34. package/docs/cursor-setup.md +1 -0
  35. package/docs/events-schema.md +13 -6
  36. package/docs/github-mirror-protection.md +61 -20
  37. package/docs/instruction-delivery.md +1 -1
  38. package/docs/memory-proposal-flow.md +3 -3
  39. package/docs/migration-v4.md +2 -2
  40. package/docs/migration-v5.md +62 -0
  41. package/docs/owner-config-schema.md +74 -90
  42. package/docs/persona-panel.md +4 -4
  43. package/docs/pi-setup.md +1 -0
  44. package/docs/rule-authoring.md +13 -6
  45. package/docs/scope-collision-guard.md +16 -0
  46. package/docs/session-config-reference.md +55 -22
  47. package/docs/session-config-template.md +9 -5
  48. package/docs/vault-docs-architecture.md +4 -2
  49. package/hooks/_lib/hook-import-set.json +70 -3
  50. package/hooks/_lib/lock-bootstrap.mjs +84 -1
  51. package/hooks/_lib/vcs-create-matcher.mjs +401 -16
  52. package/hooks/enforce-scope.mjs +201 -0
  53. package/hooks/hooks-codex.json +1 -1
  54. package/hooks/hooks-cursor.json +5 -0
  55. package/hooks/hooks.json +7 -2
  56. package/hooks/on-session-start.mjs +171 -49
  57. package/hooks/post-bash-issue-budget-refund.mjs +375 -0
  58. package/hooks/pre-auq-clarity.mjs +70 -18
  59. package/hooks/pre-bash-issue-budget.mjs +170 -26
  60. package/hooks/subagent-telemetry.mjs +106 -20
  61. package/package.json +5 -4
  62. package/pi/prompts/ux-grill.md +12 -0
  63. package/scripts/baseline-archetypes.mjs +28 -0
  64. package/scripts/ci/assert-vitest-green.mjs +4 -2
  65. package/scripts/dialectic-deriver.mjs +32 -8
  66. package/scripts/emit-session.mjs +72 -1
  67. package/scripts/lib/agent-status.mjs +441 -9
  68. package/scripts/lib/auq/schema.mjs +10 -3
  69. package/scripts/lib/auto-dialectic.mjs +0 -68
  70. package/scripts/lib/baseline-archetypes.mjs +439 -0
  71. package/scripts/lib/build-live-signals.mjs +5 -6
  72. package/scripts/lib/ci-status-banner.mjs +29 -6
  73. package/scripts/lib/claude-md-budget-lint.mjs +52 -2
  74. package/scripts/lib/config/issue-budget.mjs +68 -8
  75. package/scripts/lib/config/private-config-dir.mjs +3 -2
  76. package/scripts/lib/config/remote-hosts.mjs +2 -2
  77. package/scripts/lib/config-schema.mjs +79 -0
  78. package/scripts/lib/config.mjs +12 -1
  79. package/scripts/lib/eval/engine.mjs +7 -1
  80. package/scripts/lib/file-lock.mjs +151 -8
  81. package/scripts/lib/git-porcelain.mjs +113 -0
  82. package/scripts/lib/instruction-budget-guard.mjs +415 -47
  83. package/scripts/lib/io.mjs +29 -4
  84. package/scripts/lib/issue-budget-reconcile.mjs +392 -0
  85. package/scripts/lib/issue-budget.mjs +412 -9
  86. package/scripts/lib/learnings/evolve-telemetry.mjs +1 -2
  87. package/scripts/lib/learnings/sizing-subject.mjs +44 -0
  88. package/scripts/lib/locks/staging-fence-lock.mjs +19 -38
  89. package/scripts/lib/locks/state-md-lock.mjs +19 -41
  90. package/scripts/lib/maintenance-due-banner.mjs +450 -0
  91. package/scripts/lib/owner-config.example.yaml +29 -46
  92. package/scripts/lib/owner-yaml.mjs +14 -13
  93. package/scripts/lib/peer-cards/merger.mjs +143 -0
  94. package/scripts/lib/pre-dispatch-check.mjs +20 -14
  95. package/scripts/lib/project-hygiene.mjs +81 -30
  96. package/scripts/lib/quality-gate.mjs +27 -71
  97. package/scripts/lib/reconcile/engine.mjs +19 -1
  98. package/scripts/lib/reconcile/writer.mjs +278 -11
  99. package/scripts/lib/resource-probe/evaluate.mjs +19 -21
  100. package/scripts/lib/rules-sync.mjs +34 -4
  101. package/scripts/lib/scope-echo.mjs +346 -0
  102. package/scripts/lib/session-close-backfill.mjs +182 -40
  103. package/scripts/lib/session-end/phase-skip.mjs +85 -86
  104. package/scripts/lib/session-end/tail-runner.mjs +178 -0
  105. package/scripts/lib/session-lock.mjs +62 -2
  106. package/scripts/lib/session-record-repair.mjs +91 -0
  107. package/scripts/lib/session-schema/constants.mjs +6 -0
  108. package/scripts/lib/session-schema/filters.mjs +26 -1
  109. package/scripts/lib/session-schema/validator.mjs +20 -0
  110. package/scripts/lib/session-shape.mjs +558 -0
  111. package/scripts/lib/session-start-probes.mjs +429 -56
  112. package/scripts/lib/session-token-rollup.mjs +95 -10
  113. package/scripts/lib/state-md/frontmatter-mutators.mjs +22 -34
  114. package/scripts/lib/state-md.mjs +1 -0
  115. package/scripts/lib/subagents-schema.mjs +77 -9
  116. package/scripts/lib/telemetry/pricing.mjs +197 -0
  117. package/scripts/lib/telemetry/sync.mjs +50 -1
  118. package/scripts/lib/test-runner/artifact-paths.mjs +30 -5
  119. package/scripts/lib/test-runner/issue-reconcile.mjs +45 -8
  120. package/scripts/lib/tmux-layout/layouts.mjs +62 -4
  121. package/scripts/lib/ux-grill/collect.mjs +1163 -0
  122. package/scripts/lib/ux-grill/compare.mjs +285 -0
  123. package/scripts/lib/ux-grill/manifest.mjs +618 -0
  124. package/scripts/lib/ux-grill/measures.mjs +431 -0
  125. package/scripts/lib/ux-grill/paths.mjs +224 -0
  126. package/scripts/lib/ux-grill/pencil-coverage.mjs +284 -0
  127. package/scripts/lib/ux-grill/reconcile.mjs +344 -0
  128. package/scripts/lib/ux-grill/run-record.mjs +316 -0
  129. package/scripts/lib/ux-grill/schema.mjs +321 -0
  130. package/scripts/lib/validate/check-skill-script-paths.mjs +33 -10
  131. package/scripts/lib/validate/check-untracked-test-deps.mjs +33 -19
  132. package/scripts/lib/validate/check-unwired-features.mjs +56 -27
  133. package/scripts/lib/vault-mirror/process.mjs +2 -1
  134. package/scripts/lib/vault-status/board-lock.mjs +18 -0
  135. package/scripts/lib/vault-status/board-writer.mjs +8 -0
  136. package/scripts/lib/vault-status/narrative-mirror.mjs +4 -4
  137. package/scripts/lib/wave-resource-gate.mjs +23 -27
  138. package/scripts/lib/wave-sizing.mjs +10 -3
  139. package/scripts/materialize-wave-scope.mjs +68 -14
  140. package/scripts/mcp-server.sh +16 -1
  141. package/scripts/print-applicable-rules.mjs +7 -6
  142. package/scripts/print-learnings-index.mjs +3 -2
  143. package/scripts/release.mjs +7 -2
  144. package/scripts/session-shape.mjs +266 -0
  145. package/skills/_shared/config-reading.md +15 -9
  146. package/skills/_shared/private-capability-context.md +89 -0
  147. package/skills/bootstrap/SKILL.md +60 -209
  148. package/skills/bootstrap/_shared-template.md +99 -14
  149. package/skills/bootstrap/deep-template.md +36 -26
  150. package/skills/bootstrap/fast-template.md +44 -8
  151. package/skills/bootstrap/intensity-heuristic.md +10 -4
  152. package/skills/bootstrap/private-contract.md +119 -0
  153. package/skills/bootstrap/public-fallback.md +30 -18
  154. package/skills/bootstrap/references/bootstrap-ecosystem-health-flow.md +48 -0
  155. package/skills/bootstrap/references/bootstrap-refresh-lock-flow.md +37 -0
  156. package/skills/bootstrap/references/bootstrap-retroactive-flow.md +108 -0
  157. package/skills/bootstrap/references/bootstrap-rules-fetch-bridge.md +64 -0
  158. package/skills/bootstrap/standard-template.md +39 -24
  159. package/skills/claude-md-drift-check/SKILL.md +9 -2
  160. package/skills/claude-md-drift-check/checker.mjs +213 -21
  161. package/skills/discovery/SKILL.md +6 -173
  162. package/skills/discovery/probes/vault-staleness.mjs +35 -5
  163. package/skills/discovery/probes-docs.md +8 -4
  164. package/skills/discovery/probes-supply-chain.md +4 -2
  165. package/skills/discovery/probes-ui.md +8 -4
  166. package/skills/discovery/probes-vault.md +12 -4
  167. package/skills/discovery/references/discovery-interactive-triage.md +139 -0
  168. package/skills/discovery/references/discovery-triage-state.md +54 -0
  169. package/skills/docs-orchestrator/audience-mapping.md +1 -1
  170. package/skills/eval/rubric-v1.md +13 -0
  171. package/skills/evolve/SKILL.md +2 -458
  172. package/skills/evolve/references/evolve-analyze-mode.md +360 -0
  173. package/skills/evolve/references/evolve-dialectic-mode.md +139 -0
  174. package/skills/gitlab-ops/SKILL.md +3 -3
  175. package/skills/grill/SKILL.md +1 -1
  176. package/skills/memory-cleanup/SKILL.md +2 -2
  177. package/skills/plan/mode-new.md +9 -0
  178. package/skills/plan/mode-retro.md +4 -3
  179. package/skills/reconcile/SKILL.md +11 -1
  180. package/skills/session-end/SKILL.md +3 -2
  181. package/skills/session-end/drift-operations.md +20 -5
  182. package/skills/session-end/metrics-collection.md +1 -0
  183. package/skills/session-end/phase-3-2-docs-verification.md +1 -1
  184. package/skills/session-end/phase-3-6-tail.md +27 -67
  185. package/skills/session-end/phase-3-7a-recommendations.md +2 -2
  186. package/skills/session-end/references/phase-2-quality-gate.md +3 -3
  187. package/skills/session-end/references/phase-3-documentation-updates.md +8 -6
  188. package/skills/session-end/references/phase-5-issue-cleanup.md +32 -1
  189. package/skills/session-end/session-metrics-write.md +33 -12
  190. package/skills/session-plan/SKILL.md +46 -180
  191. package/skills/session-plan/references/session-plan-task-classification.md +152 -0
  192. package/skills/session-plan/wave-template.md +8 -15
  193. package/skills/session-start/SKILL.md +41 -7
  194. package/skills/session-start/phase-2-5-docs-planning.md +1 -1
  195. package/skills/session-start/phase-8-5-express-path.md +12 -9
  196. package/skills/session-start/references/operations-contract.md +114 -0
  197. package/skills/session-start/references/phase-1-5-session-continuity.md +2 -0
  198. package/skills/session-start/references/phase-4-ssot-environment-check.md +42 -24
  199. package/skills/session-start/references/phase-6-7-memory-banner-telemetry-consent.md +3 -1
  200. package/skills/session-start/soul.md +2 -2
  201. package/skills/test-runner/SKILL.md +1 -1
  202. package/skills/test-runner/rubric-v1.md +2 -2
  203. package/skills/tmux-layout/SKILL.md +3 -1
  204. package/skills/ux-grill/SKILL.md +211 -0
  205. package/skills/ux-grill/rubric-v2.md +201 -0
  206. package/skills/ux-grill/soul.md +76 -0
  207. package/skills/wave-executor/SKILL.md +32 -127
  208. package/skills/wave-executor/circuit-breaker.md +3 -1
  209. package/skills/wave-executor/references/wave-executor-quality-gate.md +61 -0
  210. package/skills/wave-executor/references/wave-executor-state-init.md +86 -0
  211. package/skills/wave-executor/references/wave-loop-dispatch.md +12 -2
  212. package/skills/wave-executor/references/wave-loop-review.md +19 -6
  213. package/skills/wave-executor/references/wave-loop-scope-manifest.md +6 -2
  214. package/templates/_shared/ux-manifest.template.md +149 -0
  215. package/templates/nextjs-minimal/package.json +1 -1
  216. package/templates/node-minimal/package.json +1 -1
  217. package/scripts/lib/multi-provider-build/providers.mjs +0 -64
  218. package/scripts/lib/multi-provider-build/templating.mjs +0 -130
  219. package/scripts/lib/owner-config/coerce.mjs +0 -29
  220. package/scripts/lib/owner-config/constants.mjs +0 -21
  221. package/scripts/lib/owner-config/defaults.mjs +0 -50
  222. package/scripts/lib/owner-config/error.mjs +0 -19
  223. package/scripts/lib/owner-config/index.mjs +0 -13
  224. package/scripts/lib/owner-config/merge.mjs +0 -52
  225. package/scripts/lib/owner-config/validate.mjs +0 -259
  226. package/scripts/lib/owner-config-loader.mjs +0 -170
  227. package/scripts/lib/owner-config.mjs +0 -28
  228. package/scripts/lib/soul-resolve.mjs +0 -130
  229. package/scripts/lib/vault-mirror/render.mjs +0 -8
  230. package/templates/_shared/journey-manifest.md +0 -114
@@ -21,10 +21,12 @@ if (!sources.includes('discovery')) { console.log('SKIPPED: supply-chain-slopche
21
21
  "
22
22
 
23
23
  # Step 2: Run the probe
24
- test -f skills/discovery/probes/supply-chain-slopcheck.mjs || { echo "SKIPPED: supply-chain-slopcheck -- probe file not found"; exit 0; }
24
+ # Probes live in the PLUGIN, not the project: ${PLUGIN_ROOT} is resolved per
25
+ # skills/_shared/config-reading.md. The probe still scans process.cwd() (project root).
26
+ test -f "${PLUGIN_ROOT}/skills/discovery/probes/supply-chain-slopcheck.mjs" || { echo "SKIPPED: supply-chain-slopcheck -- ${PLUGIN_ROOT}/skills/discovery/probes/supply-chain-slopcheck.mjs not found (PLUGIN_ROOT='${PLUGIN_ROOT}'; empty = unresolved, see skills/_shared/config-reading.md)"; exit 0; }
25
27
 
26
28
  node --input-type=module -e "
27
- import probe from './skills/discovery/probes/supply-chain-slopcheck.mjs';
29
+ import probe from '${PLUGIN_ROOT}/skills/discovery/probes/supply-chain-slopcheck.mjs';
28
30
  const r = await probe({ repoRoot: process.cwd() });
29
31
  for (const f of r.findings) {
30
32
  console.log('FINDING:', JSON.stringify(f));
@@ -79,14 +79,18 @@ Value: <dimension if applicable>
79
79
 
80
80
  ### Probe: design-drift
81
81
 
82
+ > **Naming collision — unresolved (2026-09-11).** This probe, specified below, is agent-based: Pencil MCP tools, qualitative visual comparison, no fixed detection script. GitLab issue #1300 (`projects-baseline` design-first Pencil-token-contract epic, scope item B3-Wrapper) plans `skills/discovery/probes/design-drift.mjs` — a *second*, mechanical, git-only probe under the identical name `design-drift`, sourced from a staleness script in the sibling `projects-baseline` repo — and explicitly proposes replacing this section (lines 79–107 at the time of writing) with that new spec. Whether the two converge, take distinct names, or one supersedes the other is a naming/design decision for whoever implements #1300; it is not decided here. Resolve the name before writing any code against either contract.
83
+
82
84
  **Activation:** Pencil MCP configured in Session Config (`pencil` path provided, e.g. `pencil: designs/app.pen`).
83
85
 
84
86
  **Detection Method:**
85
87
 
86
88
  Use Pencil MCP tools to compare design specifications against implementation:
87
- 1. `get_editor_state` -- check current design file
88
- 2. `batch_get` -- retrieve design node properties (colors, spacing, typography)
89
- 3. `get_screenshot` -- capture design frames for visual comparison
89
+ 1. `mcp__pencil__get_app_state` -- check current design file
90
+ 2. `mcp__pencil__execute` with a Get visitor (depth 1 for top-level frames, depth 2 for their children) -- retrieve design node properties (colors, spacing, typography). Read the execute tool's input schema for the exact visitor shape; `.pen` files are encrypted, so never `Read`/`Grep` them.
91
+ 3. `mcp__pencil__browser` -- view/capture design frames for visual comparison (no direct screenshot tool exists on the current surface)
92
+
93
+ Tool names have one definition in code: `PENCIL_TOOL_NAMES` in `scripts/lib/ux-grill/pencil-coverage.mjs`. The pre-2026 tool surface it replaced no longer exists (dead names enumerated in that module's JSDoc).
90
94
 
91
95
  Compare against:
92
96
  - CSS custom properties / design tokens in codebase
@@ -142,6 +146,6 @@ fpRisk: low | medium | high
142
146
 
143
147
  **Default Severity:** Per-rule (high for the absolute-ban tells, low for advisory quality nits). `fpRisk` is reported so triage can weight high-FP rules (`ai-purple-gradient`) more skeptically.
144
148
 
145
- > **Precision boundary (honest):** this regex tier cannot resolve CSS cascade, so `side-stripe-border` flags any ≥2px side accent even when the element is unrounded — `.claude/rules/frontend.md` bans those (>1px accent), but a cascade-aware detector would narrow further. The heavier static-HTML + browser tiers are deliberately omitted (cost ≫ value for a probe/hook). See `scripts/lib/frontend-detect/rules.mjs`.
149
+ > **Precision boundary (honest):** this regex tier cannot resolve CSS cascade, so `side-stripe-border` flags any ≥2px side accent even when the element is unrounded — `rules/opt-in-stack/frontend.md` bans those (>1px accent), but a cascade-aware detector would narrow further. The heavier static-HTML + browser tiers are deliberately omitted (cost ≫ value for a probe/hook). See `scripts/lib/frontend-detect/rules.mjs`.
146
150
 
147
151
  ---
@@ -10,12 +10,14 @@
10
10
 
11
11
  ```bash
12
12
  # Step 1: Verify the probe exists; skip if missing
13
- test -f skills/discovery/probes/vault-staleness.mjs || { echo "SKIPPED: vault-staleness -- skills/discovery/probes/vault-staleness.mjs not found"; exit 0; }
13
+ # Probes live in the PLUGIN, not the project: ${PLUGIN_ROOT} is resolved per
14
+ # skills/_shared/config-reading.md. The probe still scans process.cwd() (project root).
15
+ test -f "${PLUGIN_ROOT}/skills/discovery/probes/vault-staleness.mjs" || { echo "SKIPPED: vault-staleness -- ${PLUGIN_ROOT}/skills/discovery/probes/vault-staleness.mjs not found (PLUGIN_ROOT='${PLUGIN_ROOT}'; empty = unresolved, see skills/_shared/config-reading.md)"; exit 0; }
14
16
 
15
17
  # Step 2: Run the probe. It reads vault-integration.vault-dir from $CONFIG
16
18
  # (passed from the discovery skill) and scans the vault.
17
19
  node --input-type=module -e "
18
- import {runProbe} from './skills/discovery/probes/vault-staleness.mjs';
20
+ import {runProbe} from '${PLUGIN_ROOT}/skills/discovery/probes/vault-staleness.mjs';
19
21
  const cfg = JSON.parse(process.env.SO_CONFIG || '{}');
20
22
  const r = await runProbe(process.cwd(), cfg);
21
23
  for (const f of r.findings) {
@@ -30,6 +32,10 @@ if (r.skipped_reason) console.log('SKIPPED:', r.skipped_reason);
30
32
 
31
33
  **Default severity:** low (<7d delta), medium (≥7d delta). Missing frontmatter fields → low.
32
34
 
35
+ **Denominator:** staleness is `lastCommit - lastSync` — both read from the same `_overview.md` frontmatter — never `now - lastSync`. An overview without `lastCommit` falls back to the probe runtime (`basis: 'probe-runtime'` in the evidence, lower confidence).
36
+
37
+ **Passive skip (#1238):** a `01-projects/<slug>/` carrying a `_passive.md` marker is skipped BEFORE any staleness comparison — it is excluded from `scanned_projects` and counted instead in `metrics.passive_skipped` — the SAME key in the in-memory metrics and in the JSONL record — so the skip is visible rather than indistinguishable from a healthy project. The marker is checked before the `_overview.md` existence test, so a passive folder without an overview is counted too rather than falling into the silent non-project branch.
38
+
33
39
  ---
34
40
 
35
41
  ### Probe: vault-narrative-staleness
@@ -39,10 +45,12 @@ if (r.skipped_reason) console.log('SKIPPED:', r.skipped_reason);
39
45
  **Detection Method:**
40
46
 
41
47
  ```bash
42
- test -f skills/discovery/probes/vault-narrative-staleness.mjs || { echo "SKIPPED: vault-narrative-staleness -- probe file not found"; exit 0; }
48
+ # Probes live in the PLUGIN, not the project: ${PLUGIN_ROOT} is resolved per
49
+ # skills/_shared/config-reading.md. The probe still scans process.cwd() (project root).
50
+ test -f "${PLUGIN_ROOT}/skills/discovery/probes/vault-narrative-staleness.mjs" || { echo "SKIPPED: vault-narrative-staleness -- ${PLUGIN_ROOT}/skills/discovery/probes/vault-narrative-staleness.mjs not found (PLUGIN_ROOT='${PLUGIN_ROOT}'; empty = unresolved, see skills/_shared/config-reading.md)"; exit 0; }
43
51
 
44
52
  node --input-type=module -e "
45
- import {runProbe} from './skills/discovery/probes/vault-narrative-staleness.mjs';
53
+ import {runProbe} from '${PLUGIN_ROOT}/skills/discovery/probes/vault-narrative-staleness.mjs';
46
54
  const cfg = JSON.parse(process.env.SO_CONFIG || '{}');
47
55
  const r = await runProbe(process.cwd(), cfg);
48
56
  for (const f of r.findings) {
@@ -0,0 +1,139 @@
1
+ # Discovery — Phase 5: Interactive Triage (Standalone Mode Only)
2
+
3
+ > Reference of the `discovery` skill, split out of `SKILL.md` (#1246). Body moved **byte-identical**; only this header is new.
4
+ > **Sibling-file paths inside this body are relative to the parent directory, not to `references/`**: `SKILL.md` → `../SKILL.md`. They were deliberately NOT rewritten, so the moved bytes stay verifiable against the pre-split file.
5
+
6
+ ## Phase 5: Interactive Triage (Standalone Mode Only)
7
+
8
+ ### 5.0 Load Triage State & Partition Findings
9
+
10
+ Before auto-defer and before presenting any findings for triage, load the persistent discovery triage state and filter findings through it:
11
+
12
+ 1. Call `loadTriageState()` from `scripts/lib/discovery/triage-state.mjs` (uses default path `.orchestrator/metrics/discovery-triage.jsonl`). Returns an empty Map if the file does not exist — no error.
13
+ 2. Call `filterFindings({ findings: verifiedFindings, stateMap })` to partition findings into three buckets:
14
+ - `toShow` — state is `open`, `reopened`, or **no prior state entry** (new findings — present for user triage)
15
+ - `suppressed` — state is `dismissed` or `accepted-as-known` (skip silently)
16
+ - `tracked` — state is `promoted-to-#NNN` (issue already filed; show as informational)
17
+
18
+ 3. Emit a one-line state banner before the summary table:
19
+ ```
20
+ Triage state: [N suppressed] suppressed (dismissed/accepted-as-known), [N tracked] tracked in existing issues. Presenting [N toShow] findings.
21
+ ```
22
+ Omit the banner entirely if all three counts are zero (first run).
23
+
24
+ 4. Render `tracked` findings as informational lines in the summary — NOT as interactive triage items:
25
+ ```
26
+ [INFO] Finding "<title>" (<file_path>) is tracked in #<issue_id> — not re-triaged.
27
+ ```
28
+
29
+ 5. Continue Phase 5 triage using only `toShow` findings. The `suppressed` bucket requires no user interaction.
30
+
31
+ 6. After the user completes triage (Steps 1-4 below), append state changes to `.orchestrator/metrics/discovery-triage.jsonl` via `appendTriageEntry()` from `triage-state.mjs`:
32
+ - User selects "Create issue" → append `{ fingerprint, state: 'promoted-to-#<issue_id>', issue_id: <N>, timestamp, session_id }`
33
+ - User selects "Dismiss -- intentional" or "Dismiss -- false positive" → append `{ fingerprint, state: 'dismissed', user_decision: '<reason>', timestamp, session_id }`
34
+ - User selects "Accept all" for batch → append one `{ fingerprint, state: 'open', ... }` entry per finding (so they re-appear next run if not yet promoted)
35
+
36
+ ### 5.1 Auto-Defer Low-Confidence Findings
37
+
38
+ Before presenting findings for triage, separate by confidence threshold:
39
+
40
+ 1. Findings with confidence >= threshold → present for interactive triage (below)
41
+ 2. Findings with confidence < threshold → auto-defer with summary:
42
+ "Auto-deferred [N] low-confidence findings (score < [threshold]). Review with `/discovery --include-deferred`."
43
+ 3. List auto-deferred findings in a collapsed section (not interactive — informational only)
44
+
45
+ ### 5.1 Present High-Confidence Findings
46
+
47
+ Present findings using AskUserQuestion -- NEVER plain text options. On Codex CLI where AskUserQuestion is unavailable, present as numbered Markdown lists.
48
+
49
+ Include confidence scores in the presentation:
50
+ ```
51
+ [CRITICAL] (confidence: 85) hardcoded-values: API key found in src/config.ts:42
52
+ [HIGH] (confidence: 72) security-basics: eval() usage in src/utils/parser.ts:18
53
+ [MEDIUM] (confidence: 61) orphaned-annotations: TODO without issue in src/lib/auth.ts:55
54
+ ```
55
+
56
+ ### Step 1: Summary
57
+
58
+ Present a findings overview table:
59
+
60
+ ```
61
+ ## Discovery Results
62
+
63
+ Probes run: [N] | Findings verified: [N] | False positives discarded: [N]
64
+
65
+ | Category | Critical | High | Medium | Low | Total |
66
+ |----------|----------|------|--------|-----|-------|
67
+ | Code | ... | ... | ... | ... | ... |
68
+ | Infra | ... | ... | ... | ... | ... |
69
+ | UI | ... | ... | ... | ... | ... |
70
+ | Arch | ... | ... | ... | ... | ... |
71
+ | Session | ... | ... | ... | ... | ... |
72
+ | Audit | ... | ... | ... | ... | ... |
73
+ | Vault | ... | ... | ... | ... | ... |
74
+ | Feature | ... | ... | ... | ... | ... |
75
+ ```
76
+
77
+ ### Step 2: Critical + High Findings -- Review Individually
78
+
79
+ For each Critical or High finding, use AskUserQuestion (on Codex CLI where AskUserQuestion is unavailable, present as numbered Markdown lists):
80
+
81
+ ```
82
+ AskUserQuestion({
83
+ questions: [{
84
+ question: "<severity> finding in <file_path> — what should happen with it?",
85
+ header: "Finding",
86
+ options: [
87
+ { label: "Create issue (<severity>)", description: "Files it as priority::<severity>, so it is tracked outside this session. The code below is copied into the issue body.",
88
+ preview: "<finding title>\n\n<file_path>:<line_number>\n```\n<matched_text with +/-3 lines context>\n```\n\n<description>\n\nRecommended fix: <recommended_fix>" },
89
+ { label: "Adjust priority", description: "Same issue, a priority you pick — this question then comes back with the new label." },
90
+ { label: "Dismiss -- intentional", description: "The code is deliberate. Nothing is filed, and the finding stays only in this run's report." },
91
+ { label: "Dismiss -- false positive", description: "The probe misread the code. Nothing is filed; worth reporting if the same probe misfires again." }
92
+ ],
93
+ multiSelect: false
94
+ }]
95
+ })
96
+ ```
97
+
98
+ If user selects "Adjust priority", ask which priority with another AskUserQuestion. On Codex CLI where AskUserQuestion is unavailable, present as numbered Markdown lists.
99
+
100
+ ### Step 3: Medium + Low Findings -- Review Batched
101
+
102
+ Group remaining findings by category. For each category with medium/low findings (on Codex CLI where AskUserQuestion is unavailable, present as numbered Markdown lists):
103
+
104
+ ```
105
+ AskUserQuestion({
106
+ questions: [{
107
+ question: "Create issues for all [N] medium/low findings in [category]?",
108
+ header: "Findings",
109
+ options: [
110
+ { label: "Accept all (Recommended)", description: "Medium and low findings are cheap to file and cheap to close. Cost: [N] issues, roughly one second apart.",
111
+ preview: "1. [title] -- [file_path]:[line] ([severity])\n2. [title] -- [file_path]:[line] ([severity])\n..." },
112
+ { label: "Review individually", description: "One question per finding, same options as the critical ones. Cost: [N] more prompts." },
113
+ { label: "Dismiss all", description: "Nothing is filed for this category. The findings stay in this run's report only." }
114
+ ],
115
+ multiSelect: false
116
+ }]
117
+ })
118
+ ```
119
+
120
+ If "Review individually" selected, walk through each like Step 2.
121
+
122
+ ### Step 4: Batch Confirmation
123
+
124
+ Before creating any issues (on Codex CLI where AskUserQuestion is unavailable, present as numbered Markdown lists):
125
+
126
+ ```
127
+ AskUserQuestion({
128
+ questions: [{
129
+ question: "Ready to create [N] issues?\n\n- [X] critical\n- [Y] high\n- [Z] medium\n- [W] low",
130
+ header: "Confirm",
131
+ options: [
132
+ { label: "Create all [N] issues", description: "Proceed with issue creation" },
133
+ { label: "Review list first", description: "Show full list before creating" },
134
+ { label: "Cancel", description: "Do not create any issues" }
135
+ ]
136
+ }]
137
+ })
138
+ ```
139
+
@@ -0,0 +1,54 @@
1
+ # Discovery — Discovery Triage State (#419)
2
+
3
+ > Reference of the `discovery` skill, split out of `SKILL.md` (#1246). Body moved **byte-identical**; only this header is new.
4
+ > **Sibling-file paths inside this body are relative to the parent directory, not to `references/`**: `SKILL.md` → `../SKILL.md`. They were deliberately NOT rewritten, so the moved bytes stay verifiable against the pre-split file.
5
+
6
+ ## Discovery Triage State (#419)
7
+
8
+ Persistent triage state prevents re-presenting the same finding on every `/discovery` run. State is stored in an append-only JSONL file and keyed by a stable fingerprint.
9
+
10
+ ### State File
11
+
12
+ **Location:** `.orchestrator/metrics/discovery-triage.jsonl` (gitignored via `.orchestrator/metrics/*.jsonl` pattern — machine-local, never committed)
13
+
14
+ **Format:** One JSON object per line:
15
+ ```json
16
+ {"fingerprint":"aabb1122ccdd3344","state":"dismissed","user_decision":"intentional — debug log","timestamp":"2026-05-17T10:00:00.000Z","session_id":"deep-2"}
17
+ {"fingerprint":"eeff5566aabb7788","state":"promoted-to-#119","issue_id":119,"timestamp":"2026-05-17T10:01:00.000Z","session_id":"deep-2"}
18
+ ```
19
+
20
+ ### Fingerprint
21
+
22
+ `computeFingerprint({probe, file, severity, ruleId})` → 16-char hex (sha256 prefix).
23
+
24
+ `line_number` is **intentionally excluded** — it drifts on refactoring without the underlying issue changing. A finding is considered "the same" as long as the probe, file path, severity, and ruleId match.
25
+
26
+ ### State Enum
27
+
28
+ | State | Meaning |
29
+ |---|---|
30
+ | `open` | Actively needs triage or was explicitly marked for re-review |
31
+ | `dismissed` | User dismissed as intentional or false positive — suppressed on future runs |
32
+ | `accepted-as-known` | Known issue, accepted without creating a VCS issue — suppressed on future runs |
33
+ | `reopened` | Previously suppressed but re-surfaced by user decision — shown again |
34
+ | `promoted-to-#NNN` | VCS issue created; shown informational ("tracked in #NNN") on future runs |
35
+
36
+ ### Re-run Semantics
37
+
38
+ On each `/discovery` run, Phase 5 loads the state file and partitions findings before presenting them:
39
+
40
+ - **New findings** (no fingerprint entry) → always shown
41
+ - **`open` or `reopened`** → shown for triage
42
+ - **`dismissed` or `accepted-as-known`** → suppressed (silent — no user interaction needed)
43
+ - **`promoted-to-#NNN`** → informational line only ("tracked in #NNN")
44
+
45
+ A suppressed finding re-appears only if its fingerprint changes — i.e., the probe, file path, severity, or ruleId changes. No TTL on dismissed state.
46
+
47
+ ### Module
48
+
49
+ `scripts/lib/discovery/triage-state.mjs` — pure ESM, Node stdlib only. Exports:
50
+ - `computeFingerprint({probe, file, severity, ruleId}): string`
51
+ - `loadTriageState(stateFilePath?): Promise<Map<fingerprint, entry>>`
52
+ - `appendTriageEntry(stateFilePath, entry): Promise<void>`
53
+ - `filterFindings({findings, stateMap}): {toShow, suppressed, tracked}`
54
+
@@ -8,7 +8,7 @@ Rules for mapping session scope to target audiences, content sources, and docume
8
8
 
9
9
  | Audience | Target files (globs) | Typical update triggers |
10
10
  |----------|----------------------|-------------------------|
11
- | User | `README.md`, `docs/user/**/*.md`, `docs/getting-started.md`, `examples/**/*.md` | new CLI command, breaking API change, install flow change, new user-facing feature, changed example output |
11
+ | User | `README.md`, `docs/user/**/*.md`, `docs/getting-started.md`, `examples/**/*.md` | new CLI command, breaking API change, install flow change, new user-facing feature, changed example output <!-- path-check: example --> |
12
12
  | Dev | `CLAUDE.md` (or `AGENTS.md` on Codex CLI), `docs/dev/**/*.md`, `docs/adr/**/*.md` | architecture decision, major refactor, new module/subsystem, test coverage change, dependency upgrade, ADR-worthy choice |
13
13
  | Vault/Ops | `<vault>/01-projects/<slug>/context.md`, `<vault>/01-projects/<slug>/decisions.md`, `<vault>/01-projects/<slug>/people.md` | project status change, ownership transition, stack/infra decision, cross-project dependency, migration, archival event |
14
14
 
@@ -126,6 +126,19 @@ full-gate quality_gate events + `record.total_waves` / `record.waves`.
126
126
  | `≥1` full-gate event in window; the **last by timestamp** has `exit_code === 0` | `pass` |
127
127
  | `≥1` full-gate event in window; the **last by timestamp** has `exit_code !== 0` | `fail` |
128
128
 
129
+ Clarification, not a formula change: a record whose waves are **all**
130
+ coordinator-direct `Housekeeping` waves (the session-end writer rule since
131
+ #1321; predicate `isCoordinatorDirectHousekeeping` in
132
+ `scripts/lib/session-schema/filters.mjs`) counts as "no waves ran". The
133
+ decision keys on that wave shape only, never on `session_type`: a housekeeping
134
+ session that ran real waves stays `cannot-determine`. No record written before
135
+ #1321 has that shape. Measured 2026-09-12 on the working copy (the ledger is
136
+ gitignored, so no commit pins it): `jq -s
137
+ '[.[]|select((.waves|type)=="array" and (.waves|length)>0 and
138
+ all(.waves[]; .role=="Housekeeping" and .coordinator_direct==true))]|length'
139
+ .orchestrator/metrics/sessions.jsonl` → `0` of 427 records. So no historical
140
+ verdict changes, and `RUBRIC_VERSION` stays `rubric-v1`.
141
+
129
142
  Scorer: `scoreGateHealth`. No `score` field.
130
143
 
131
144
  ### 4. `process-safety`