chore(brain): unwire §12 skill-discipline hooks from settings.json, keep economy (phase 1 task 2)

Phase 1 Task 2 of LLM-first router overhaul.

Live user-level changes (NOT in git, see TASKLOG.md for full diff manifest):
- ~/.claude/settings.json — removed 2 PreToolUse blocks:
  - matcher 'Skill' -> skill-marker.py (§12 trigger marker)
  - matcher 'Edit|Write|MultiEdit' -> skill-check.py (§12 enforcement on Edit)
  - Remaining PreToolUse: 1 block (economy-state-guard, pure economy)
- ~/.claude/hooks/economy-mode.py — trailer text:
  '§12 hard rule из Pravila НЕ override-ится' -> '§17 universal skill-coverage НЕ override-ится'
- ~/.claude/hooks/economy-state-guard.py — NO-OP (no §12 logic; pure economy)

Economy system (0%/5%/25%/50%/75%/100%) remains fully active. Stop-hook
subagent verifier (model: claude-sonnet-4-6) remains. PostCompact, SessionStart
hooks unchanged.

skill-marker.py and skill-check.py files remain on disk in ~/.claude/hooks/
(snapshot already in docs/archive/.../user-hooks/ from Task 1). They are
unwired from PreToolUse — no longer invoked. Task 4 moves them into the
archive proper.

permissions.ask still references skill-marker.py/skill-check.py (4 entries
Edit/Write each) — these gate direct file edits and are harmless. Cleaned
up alongside Task 4 archive.

Verification:
- ~/.claude/settings.json parses as valid JSON (1 PreToolUse block).
- All 4 economy hooks (economy-mode, economy-state-guard, economy-postcompact,
  economy-self-check) still run with exit 0.
- Live economy-mode.py with prompt 'тест экономия 5%' returns valid hook
  JSON with FIRST LINE '=== ECONOMY MODE: 5%' and trailer mentioning §17.

Rollback: 'node tools/test-rollback.mjs --execute' restores both files
from snapshot (verified e2e in Task 1).

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

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Дмитрий
2026-05-25 09:39:20 +03:00
parent dc7fd5792f
commit 3073e0cbde
3 changed files with 90 additions and 13 deletions
+2
View File
@@ -1755,3 +1755,5 @@ creds
гэп
misowned
деплоями
subdirs
unwired
@@ -0,0 +1,75 @@
# Task log — LLM-first router overhaul (phase 1)
This file tracks the per-task progression of Phase 1, recording user-level
state changes (not in git) so the audit trail survives the overhaul.
## Task 1 — Rollback infra ⭐ (commit `dc7fd579`, 2026-05-25)
Established and proved a full rollback mechanism BEFORE any destructive step.
- Git tag `brain-pre-llm-bootstrap``9d4a30c3` (origin/main pre-overhaul).
- Archive structure `docs/archive/llm-bootstrap-2026-05/` with 8 subdirs.
- Snapshots: `~/.claude/settings.json`, all 14 hooks in `~/.claude/hooks/`,
`~/.claude/runtime/router-gate-mode.json`, `docs/registry/nodes.yaml`,
project `.claude/settings.json`.
- `tools/test-rollback.mjs` + 3 TDD tests (GREEN).
- `ROLLBACK.md` runbook with from→to manifest.
- E2E smoke proof (Task 1 Step 9) verified user-level + git-tracked rollback,
Task 1 untracked files survived. Smoke caught a bug in the plan's procedure
(`git checkout tag -- .` + `--soft` does NOT delete files committed after
the tag — `git reset --hard tag` is correct). ROLLBACK.md uses `--hard`.
## Task 2 — Remove §12 skill-discipline, keep economy (2026-05-25)
Removed §12 enforcement hooks from the live user environment; the economy
system (0% / 5% / 75% / 100%, etc.) remains fully active.
**Changes to `~/.claude/settings.json`** (live user file, not in git):
- Removed PreToolUse block `matcher: "Skill"``skill-marker.py` (§12 trigger).
- Removed PreToolUse block `matcher: "Edit|Write|MultiEdit"`
`skill-check.py` (§12 enforcement on Edit/Write).
- Remaining PreToolUse: 1 block — `matcher: "Edit|Write|MultiEdit|Bash|Agent"`
`economy-state-guard.py` (pure economy concern, kept).
- All UserPromptSubmit / PostCompact / SessionStart / Stop hooks unchanged.
**Changes to `~/.claude/hooks/economy-mode.py`** (live user file):
- Line ~337: replaced trailing reminder
«§12 hard rule из Pravila НЕ override-ится этим режимом — на всех уровнях.»
→ «§17 universal skill-coverage НЕ override-ится этим режимом — на всех уровнях.»
- All economy logic (LEVELS dict, parse_level, closest_level, state file
write) unchanged.
- The references to `§12.2` inside `LEVELS[5]["rules"]` and `LEVELS[100]["rules"]`
remain — those describe process gates and are migrated to `§17` cross-refs
in Task 6.
**Changes to `~/.claude/hooks/economy-state-guard.py`** (live user file):
- NO-OP. Inspected for §12 skill-discipline logic; the file is pure
economy (BASH_FILE_MOD_PATTERNS is the test-cadence reminder, not §12
enforcement). Plan Step 3 allows no-op for pure-economy guards.
**Files NOT removed** (only their PreToolUse triggers were unwired):
- `~/.claude/hooks/skill-marker.py` — still on disk, no longer invoked.
- `~/.claude/hooks/skill-check.py` — still on disk, no longer invoked.
These two files move into `docs/archive/.../user-hooks/` archive in Task 4
(snapshot is already in archive from Task 1).
**Permissions.ask still references** `skill-marker.py` / `skill-check.py`
4 entries (Edit/Write on each). Left as-is; they only require permission
for direct file edits, no enforcement. Cleaned up alongside Task 4.
**Verification:**
- `~/.claude/settings.json` parses as valid JSON; `hooks.PreToolUse` length = 1.
- All 4 economy hooks still run with exit 0 on `< /dev/null`.
- Live `economy-mode.py` run with prompt «тест экономия 5%» returns valid
JSON with FIRST LINE `=== ECONOMY MODE: 5%` and trailer mentioning `§17`,
no `§12 hard rule` substring.
**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.
+13 -13
View File
@@ -1,6 +1,6 @@
# Brain Status (auto-generated)
Last updated: 2026-05-25T04:31:41.337Z
Last updated: 2026-05-25T06:31:41.211Z
| Контролёр | Состояние | Детали |
|---|---|---|
@@ -8,15 +8,15 @@ Last updated: 2026-05-25T04:31:41.337Z
| C2 Cross-ref consistency | 🔴 | Update cross-refs in offending files. |
| C3 Observer-of-observer | ✅ | [observer-of-observer] OK — last read 0 week(s) ago |
| C4 Сигнальный статус | ✅ | This file (self-reference) |
| C5 Observer-coverage | ⚠️ | 341 episode(s) this month · Stop-hook + post-commit OK · 21 missed activation(s) — see /brain-retro |
| C5 Observer-coverage | ⚠️ | 135 episode(s) this month · .git/hooks/post-commit not installed (run: npx lefthook install --force) · 17 missed activation(s) — see /brain-retro |
| C6 Chain map sync | ✅ | [chain-map-checker] OK — 16 chains in sync |
## Метрики (информационные, не алерты)
- Observer evidence: 341 episodes this month, 0 observer_error markers, 31 PII matches before filter
- Legacy v1 episodes (not in factor analysis): 202
- Last /brain-retro: 0 day(s) ago
- Использование узлов: см. `/brain-retro` (раз в спринт). missed_activations: 21. **Неиспользованные узлы — не алерт, если профильной задачи не было** (Pravila §16.4 v1.36; capability-readiness; см. memory `feedback_brain_unused_tools_not_problem` — outside-repo memory store).
- Observer evidence: 135 episodes this month, 0 observer_error markers, 6 PII matches before filter
- Legacy v1 episodes (not in factor analysis): 11
- Last /brain-retro: 1 day(s) ago
- Использование узлов: см. `/brain-retro` (раз в спринт). missed_activations: 17. **Неиспользованные узлы — не алерт, если профильной задачи не было** (Pravila §16.4 v1.36; capability-readiness; см. memory `feedback_brain_unused_tools_not_problem` — outside-repo memory store).
## Метрики дисциплины
@@ -24,17 +24,17 @@ Baseline дисциплины роутера (этап 2 router discipline overh
| Тип задачи | Эпизодов | % с триггер-матчем | % через скил |
|---|---|---|---|
| analysis | 15 | 46.7% | 26.7% |
| monitoring | 12 | 0.0% | 0.0% |
| bugfix | 10 | 40.0% | 40.0% |
| planning | 9 | 11.1% | 22.2% |
| feature | 9 | 22.2% | 0.0% |
| bugfix | 7 | 28.6% | 42.9% |
| feature | 5 | 0.0% | 0.0% |
| analysis | 4 | 0.0% | 25.0% |
| planning | 2 | 0.0% | 0.0% |
| refactor | 1 | 0.0% | 0.0% |
| cleanup | 1 | 0.0% | 0.0% |
| monitoring | 1 | 0.0% | 0.0% |
Router step distribution: 1: 139, 2: 118, 3: 37, 5: 42
Router step distribution: 1: 55, 2: 45, 3: 12, 5: 18
Boundaries applied (ADR / границы): 47 of 336 эпизодов (14.0%).
Boundaries applied (ADR / границы): 13 of 130 эпизодов (10.0%).
## Активные многоэтапные проекты