spec(router-gate): v3.6-3.8 sweep — rounds 5/6 closure (45 holes in 22 classes)

Adversarial audit rounds 5+6 на v3.5 spec выявили 45 attack-векторов:
- Round 5 (v3.5→v3.6 + v3.6→v3.7 maximum-closure): 15 + 7 acceptable residual closed
- Round 6 (v3.7→v3.8): 30 attack-векторов в 18 классах вкл. 4 FATAL

v3.6 — Round 5 closure (15 holes, +9 protected paths, Smoke 4-7,
§5.1↔§4.5 sync, recovery-pattern hard-block в §4.7).

v3.7 — Maximum closure pass (7 v3.6 residual + edge): LLM-judge на
каждую AskUser-опцию (R-NEW-1), parent_random_id 256-bit sentinel
(R-NEW-4), restricted/ subdir + journal-reader CLI (R-NEW-2),
shell-quote tokenizer (R-NEW-3), TF-IDF + LLM-judge для off-topic
(R12), smart batching multi-question AskUser (S6), git stash variants
в conditional class (Edge).

v3.8 — Round 6 closure (30 holes в 18 classes):
- F1 PowerShell tool gate (был полностью вне scope §5.1 — обнуляло
  архитектуру на Windows)
- F2 Workflow internal agent() enumeration (nested агенты вне
  gate-visibility — unlimited bypass)
- F3 node_modules whole-dir hard-deny + dep-checksums verification
  через SHA-256 ключевых deps
- F4 LLM-judge anti-injection (delimiter tokens + pre-filter +
  multi-judge consensus Sonnet+Haiku)

§3.1 protected paths расширен +30 entries (memory/CLAUDE.md/Pravila/
PSR/Tooling с Skill exemption для claude-md-management, CI/CD configs,
lint/build configs, plugin cache, shell init, npm configs, node_modules,
parent-sentinel, dep-checksums, expected-path).

§3.0.1 OS-keychain для LLM key (Windows Credential Manager / Keychain /
libsecret через keytar); key не в process.env → не утечёт через npm
test stdout.

§3.2.1 automated bootstrap smoke (1/5/6/7 на каждый session start,
cached 7 days); user-run остаётся для 3/4/8.

§6.1 docs/recovery-procedures.md новый файл — пошаговая шпаргалка
PowerShell-команд для 3 уровней recovery.

Budget: 13.5-20h (v3.5) → 22.5-32h (v3.6) → 33-44h (v3.7) → 45-60h (v3.8).
Закрыто 105 holes total через 9 раундов adversarial audit.

Generalisable lesson v3.8: каждый раунд аудита должен начинать с
abstract classification классов атак до enumeration конкретных дыр.
v3.7 «maximum closure» был maximum внутри границ воображения v3.6 R5-audit;
Round 6 показал что сами границы имели дыры.

Spec: 1980 → 2554 строк (+1110 inserts / -44 deletes за v3.6-3.8 sweep).
+13 терминов в cspell-words.txt (PowerShell aliases, npm deps).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Дмитрий
2026-05-29 13:55:11 +03:00
parent ef19b9f256
commit 46c4316966
3 changed files with 1152 additions and 63 deletions
+16
View File
@@ -1903,3 +1903,19 @@ coln
esac
cnt
bytea
# Router-gate v3.6-v3.8 — Round 5/6 audit closure terms
# TF-IDF + PowerShell aliases + npm package names + tokenizer artifacts
IDF
pnpmrc
toolu
rnd
iwr
spps
gci
sls
rvpa
dxf
misattributes
сканится
социалка
+20 -19
View File
@@ -1,6 +1,6 @@
# Brain Status (auto-generated)
Last updated: 2026-05-29T06:21:28.317Z
Last updated: 2026-05-29T10:53:23.126Z
| Контролёр | Состояние | Детали |
|---|---|---|
@@ -8,13 +8,13 @@ Last updated: 2026-05-29T06:21:28.317Z
| C2 Cross-ref consistency | ✅ | [cross-ref-checker] OK — 0 drift in 4 files |
| C3 Observer-of-observer | ✅ | [observer-of-observer] OK — last read 0 week(s) ago |
| C4 Сигнальный статус | ✅ | This file (self-reference) |
| C5 Observer-coverage | ⚠️ | 696 episode(s) this month · Stop-hook + post-commit OK · 20 missed activation(s) — see /brain-retro |
| C5 Observer-coverage | ⚠️ | 628 episode(s) this month · Stop-hook + post-commit OK · 20 missed activation(s) — see /brain-retro |
| C6 Chain map sync | ✅ | [chain-map-checker] OK — 16 chains in sync |
## Метрики (информационные, не алерты)
- Observer evidence: 696 episodes this month, 0 observer_error markers, 143 PII matches before filter
- Legacy v1 episodes (not in factor analysis): 557
- Observer evidence: 628 episodes this month, 0 observer_error markers, 125 PII matches before filter
- Legacy v1 episodes (not in factor analysis): 489
- Last /brain-retro: 2 day(s) ago
- Использование узлов: см. `/brain-retro` (раз в спринт). missed_activations: 20. **Неиспользованные узлы — не алерт, если профильной задачи не было** (Pravila §16.4 v1.36; capability-readiness; см. memory `feedback_brain_unused_tools_not_problem` — outside-repo memory store).
@@ -24,16 +24,16 @@ Baseline дисциплины роутера (этап 2 router discipline overh
| Тип задачи | Эпизодов | % с триггер-матчем | % через скил |
|---|---|---|---|
| analysis | 33 | 27.3% | 18.2% |
| planning | 19 | 15.8% | 15.8% |
| analysis | 26 | 30.8% | 15.4% |
| bugfix | 18 | 22.2% | 27.8% |
| feature | 17 | 11.8% | 0.0% |
| cleanup | 6 | 0.0% | 0.0% |
| planning | 16 | 18.8% | 18.8% |
| feature | 16 | 12.5% | 0.0% |
| cleanup | 7 | 0.0% | 0.0% |
| refactor | 1 | 0.0% | 0.0% |
Router step distribution: 1: 311, 2: 245, 3: 64, 5: 64
Router step distribution: 1: 272, 2: 229, 3: 60, 5: 60
Boundaries applied (ADR / границы): 76 of 684 эпизодов (11.1%).
Boundaries applied (ADR / границы): 72 of 621 эпизодов (11.6%).
## Активные многоэтапные проекты
@@ -51,10 +51,10 @@ Boundaries applied (ADR / границы): 76 of 684 эпизодов (11.1%).
| Компонент | Токены (in/out) | USD |
|---|---|---|
| Classifier (Sonnet 4.6) | 4802/63364 | $0.96 |
| Classifier (Sonnet 4.6) | 2856/37425 | $0.57 |
| Self-assessment (Sonnet 4.6) | 0/0 | $0.00 |
| Reviewer (Opus 4.7 + fallback) | 0/0 | $0.00 |
| **Итого** | | **$0.96** |
| **Итого** | | **$0.57** |
## Аномалии классификатора
@@ -67,7 +67,7 @@ Episodes since last run: 542 / threshold: 10
## Reviewer: субагент vs fallback
0 эпизодов проверено из 696.
0 эпизодов проверено из 628.
## Reviewer findings
@@ -109,11 +109,11 @@ Episodes since last run: 542 / threshold: 10
| Фраза | За всё время | За сегодня |
|---|---|---|
| `recovery` | 1364 | 467 ⚠️ |
| `без скилов` | 265 | 87 ⚠️ |
| `ремонт инфраструктуры` | 229 | 44 ⚠️ |
| `срочно` | 148 | 55 ⚠️ |
| `memory dump` | 17 | 0 |
| `recovery` | 1393 | 496 ⚠️ |
| `ремонт инфраструктуры` | 292 | 107 ⚠️ |
| `без скилов` | 283 | 105 ⚠️ |
| `срочно` | 199 | 106 ⚠️ |
| `memory dump` | 22 | 5 ⚠️ |
| `direct ok` | 6 | 0 |
| `быстрый коммит` | 3 | 0 |
@@ -123,7 +123,8 @@ Episodes since last run: 542 / threshold: 10
| PID | Имя | CPU-время | Возраст |
|---|---|---|---|
| 3464 | MsMpEng | 2.04ч | NaNч |
| 3464 | MsMpEng | 2.25ч | 0.0ч |
| 16128 | Code | 1.40ч | NaNч |
⚠️ Проверь, не «осиротевшие» ли это процессы от завершённых Claude-сессий.
File diff suppressed because it is too large Load Diff