chore(brain): discipline-metrics.mjs — keep (phase 1 task 3)

Phase 1 Task 3 of LLM-first router overhaul.

Decision: KEEP tools/discipline-metrics.mjs as-is (no code change).

Rationale (see TASKLOG.md Task 3 section):
- Module exports 3 pure functions, all general-purpose metrics not bound
  to §12 specifically.
- disciplinePercentByClassification: classificationMap source migrates
  from observer-classification-map.json -> nodes.yaml in Task 11; metric
  shape preserved under §17 universal skill-coverage.
- deriveRouterStep + boundariesAppliedRate: general router-procedure /
  path_type metrics, untouched by overhaul.
- Active consumers: brain-retro-analyzer.mjs, status-md-generator.mjs.
- 19 tests GREEN, no regressions.

Plan: docs/superpowers/plans/2026-05-25-llm-first-router-overhaul.md Task 3.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Дмитрий
2026-05-25 09:41:44 +03:00
parent 3073e0cbde
commit 03600acccc
2 changed files with 36 additions and 1 deletions
@@ -73,3 +73,38 @@ for direct file edits, no enforcement. Cleaned up alongside Task 4.
**Rollback path**: `node tools/test-rollback.mjs --execute` restores
`~/.claude/settings.json` (with skill-marker/skill-check PreToolUse blocks)
and overwrites `economy-mode.py` from snapshot. Verified end-to-end in Task 1.
## Task 3 — Inventory `tools/discipline-metrics.mjs` (2026-05-25)
**Decision: KEEP** (no code change).
Read `tools/discipline-metrics.mjs` (115 lines, 3 exports, 19 passing tests).
The module is NOT only-§12. Three functions, all surviving the §12→§17 migration:
1. `disciplinePercentByClassification(episodes, classificationMap)`
counts skill-coverage % per task classification. Currently sourced from
`tools/observer-classification-map.json`; Task 11 re-sources it from
`docs/registry/nodes.yaml` (capabilities + triggers per node). The metric
shape stays — §17 universal skill-coverage is the same intent expressed
differently (was-skill-used vs default-deny-non-conversation).
2. `deriveRouterStep(pr)` — infers reached router-procedure stage (1..5)
from observable `primary_rationale` features (classification, triggers,
chain_ref, node_chosen). General router-procedure metric, untouched.
3. `boundariesAppliedRate(episodes)` — fraction of episodes with non-empty
boundaries_applied, grouped by `path_type`. General metric, untouched.
Consumers (re-verified before decision):
- `tools/brain-retro-analyzer.mjs` — calls all three for the brain-retro
factor matrix (already shipped in router-overhaul stage 2, commit
`b8adeeb9` on feature branch).
- `tools/status-md-generator.mjs` — surfaces «Метрики дисциплины» block
in `docs/observer/STATUS.md`.
Tests: `tools/discipline-metrics.test.mjs` 19 tests, all GREEN in baseline
and after Task 1-2 work (verified in Task 2 post-commit STATUS.md regen).
Plan Task 3 step «only-§12 → archive, общий path_type → keep» applies: KEEP.
+1 -1
View File
@@ -1,6 +1,6 @@
# Brain Status (auto-generated)
Last updated: 2026-05-25T06:31:41.211Z
Last updated: 2026-05-25T06:39:27.288Z
| Контролёр | Состояние | Детали |
|---|---|---|