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>
Observer infrastructure
Passive evidence-loop for the Лидерра «brain» per ADR-011.
Files
episodes-YYYY-MM.jsonl— append-only JSONL, one line per Stop-event. Schema v2 (schema_version: 2): the 5 mandatory fields +decision_provenance(who chose the node),environment(economy_level / model / post_compaction / session_turn / parallel_session),task_size,task_ref,prompt_signal, and anoutcomethat isunknownat write time (refined by/brain-retro). On an internal hook failure a minimalobserver_errormarker line is written instead of a silent skip. Written bytools/observer-stop-hook.mjsviatools/observer-transcript-parser.mjs.notes/YYYY-MM-DD-<slug>.md— optional MD notes for sessions with qualitative history.STATUS.md— auto-generated dashboard. Regenerated per-commit bytools/status-md-generator.mjs..read-counter.json— C3 observer-of-observer counter. Updated on Read of observer files.dashboard.html+dashboard.js+dashboard-core.js— Brain Dashboard: visualises the episode log over the automation-graph topology (4 views — Карта / Разбор / Лента / Агрегат). Runnpm run brain:dashboard, open the printed localhost URL.dashboard-core.jsis pure logic, unit-tested intools/brain-dashboard-core.test.mjs.
Lifecycle
- Write: every Stop-event appends one JSONL line, parsed from the session transcript (Stop-hook).
- Aggregate:
/brain-retroskill reads JSONL each sprint, proposes regulatory candidates. - Surface:
STATUS.mdshows controllers + monthly stats. - Self-prune: C3 warns if 54 weeks pass without any read of observer files.
Routing-tag discipline
When the user dictates a specific method/node (e.g. «запусти discovery-interview»), Claude must emit one line in its response:
<!-- routing: provenance=user_directed_method node=<chosen> counterfactual=<node Claude would have chosen autonomously> -->
The Stop-hook routing-gate (tools/observer-routing-detector.mjs + routingGateDecision) detects a dictated method; if the tag is missing it returns decision: block, so the turn cannot end without the tag. The gate fires at most once per turn (stop_hook_active guard). This makes decision_provenance reliable — factor analysis can separate a router error from a user-dictated one.
Privacy
PII filter (phone numbers, emails, tokens) is applied before every write — see tools/observer-pii-filter.mjs. gitleaks pre-push also scans observer files as part of full-history sweep.
Don't
- Don't edit
episodes-*.jsonlmanually — it's append-only. - Don't write outside
docs/observer/notes/for hand-curated notes. - Don't change
.read-counter.jsonmanually — it's maintained by hooks.
HK1 pre-check (Pravila ADR-010) — verified 2026-05-19
Before registering tools/observer-stop-hook.mjs on Stop event (Task B5), verified collision against 6-component economy/skill-discipline architecture:
- User-level
~/.claude/settings.jsonalready has Stop hook: agent-type Sonnet-4.6 economy compliance verifier (analyzes transcript for claim-without-evidence violations). - Project-level
.claude/settings.json— Stop slot empty.
Result: no overwrite. observer-stop-hook will be added as command-type entry in project-level Stop array. Project + user scopes are independent slots in Claude Code 2.x — both run on the same Stop event without conflict. The agent verifier (user scope) and the JSONL appender (project scope) have non-overlapping responsibilities.