Files
brain/docs/router-procedure.md
T

77 lines
5.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Router procedure v1.4
**Status:** active (introduced 2026-05-19, spec dd5bded, ADR-011; backend-tooling 2026-05-20, ADR-013)
**Owner:** Claude Code automatic at session start.
## Purpose
Single source of truth for «task → node(s)» routing. Replaces implicit routing scattered across Pravila §12/§14/§15, PSR_v1 R0R15, Tooling §3, and routing-off-phase.md by explicitly listing the procedure executed every turn.
## Inputs
1. Active task from user prompt.
2. Node registry: [`docs/Tooling_v8_3.md`](Tooling_v8_3.md) Прил. Н §4.X (9 obligatory attributes per row — see §4.1 spec).
3. Off-phase routing table: [`docs/routing-off-phase.md`](routing-off-phase.md).
4. Hard-floor rules: [Pravila §12 / §14 / §15](Pravila_raboty_Claude_v1_1.md).
5. ADR boundaries: `docs/adr/*.md`.
## Procedure (5 steps, executed per turn)
### Step 1 — Hard-floor check (Pravila §12 / §14 / §15)
- Does the prompt contain `queen` / `королева`? → Pravila §14 (currently dormant per §14.9).
- Is the task in Pravila §12.2 map (TDD / debug / brainstorm / writing-plans / verification / discovery / migration / commit / review / UI-feature / arch-decision / refactor / parallel-sessions / worktree / writing-skills)? → invoke skill FIRST (hard-rule).
- Will any of the 8 normative files be edited? → §15.2 pre-flight sync MANDATORY.
- Subagent + git tasks? → §15.1 Sonnet/Opus only (NEVER Haiku).
If any hard-floor rule applies and is skipped — this is a violation, regardless of subsequent steps.
### Step 2 — Classification
- Phase-active (0/1/2/3) or off-phase?
- Type: TDD / debug / brainstorm / writing-plan / verification / discovery / migration / commit / review / UI-feature / arch-decision / refactor / docs / sync / other.
- Identify task triggers (keywords, file types touched, output requested).
### Step 3 — Trigger-based node selection
- Scan Tooling Прил. Н §4.X for rows whose `triggers` attribute matches the classified task.
- If ≥2 nodes match — apply ADR boundaries (the `boundaries` attribute points to the relevant ADR-NNN).
- If conflict remains — apply PSR_v1 R15.3 (specificity priority).
### Step 4 — Canonical chain check (if applicable)
- If the matched node-set corresponds to one of L1L12 chains in `routing-off-phase.md` §4 — invoke the chain.
- If no chain matches — execute as ad-hoc combination. Observer will record `path_type: improvised`.
### Step 5 — Execution
- Invoke skill (if §12 applies) or apply selected node(s) by trigger.
- Document boundary decisions in inline comments OR in the observer log.
## What this procedure does NOT consult
- **No cache of «verified chains»** (history-based records). Such a cache was explicitly rejected in brainstorming turn 8 (2026-05-19).
- **No `last-used-on-real-task` attribute** on registry rows. Unused-status is not used to choose or skip a node (capability-readiness — see `memory/feedback_brain_unused_tools_not_problem.md`).
- **No forced-choice gate**. Nodes that don't match triggers are silently skipped.
## When this procedure is consulted
Every turn — implicitly by Claude at session start, explicitly when routing is ambiguous.
## Relationship to other documents
- Pravila §12/§14/§15 — hard-floor; this procedure step 1 enforces them.
- PSR_v1 R0R14 — UI-stack apparatus; consulted in step 3 when task touches UI.
- PSR_v1 R15 — off-phase routing extension; consulted in step 3 for off-phase nodes.
- Tooling §3 / §4.X — node registry; the input to step 3.
- routing-off-phase.md — chains L1L12; consulted in step 4.
## Changelog
- **v1.0 (2026-05-19)** — initial fixation. Replaces implicit-scattered routing. ADR-011.
- **v1.1 (2026-05-20)** — finance-tooling узлы #61-#63 добавлены в реестр Tooling §4.36-§4.38 (читаются step 3) и routing-off-phase.md (+3 строки routing + связка L13). Структурных правок процедуры нет. ADR-012.
- **v1.2 (2026-05-20)** — A1 backend-tooling узлы #64-#67 добавлены в реестр Tooling §4.39-§4.42 (читаются step 3) и routing-off-phase.md (+4 строки routing + связка L14). NightOwl #67 — DEFERRED (native-Windows без pcntl/posix). Структурных правок процедуры нет. ADR-013.
- **v1.3 (2026-05-21)** — A8 infosec-tooling узлы #68-#73 добавлены в реестр Tooling §4.43-§4.48 (читаются step 3) и routing-off-phase.md (+6 строк routing + связка L15 security go-live). #69 Nuclei/#70 Ward — CLI (не MCP); #68 ZAP/#70 Ward — pending install. Структурных правок процедуры нет. ADR-014.
- **v1.4 (2026-05-22)** — C1 marketing-tooling узлы #74-#83 добавлены в реестр Tooling §4.49-§4.58 (читаются step 3) и routing-off-phase.md (+10 строк routing + связка L16 marketing chain). #82 DataForSEO/#83 Unisender Go — DEFERRED. Структурных правок процедуры нет. ADR-015.