KeiSeiKit-1.0/docs
Parfii-bot 187661714f fix(kei-model-router): close 10 audit-blocker findings
Codex CRITICAL + 4 HIGH + 5 MEDIUM/LOW from RULE 0.23 dual-review and
RULE 0.25 multi-critic swarm — all closed.

CRITICAL fix
  - Model::slug() ledger compatibility: posterior.rs + select_kernel.rs
    query `WHERE model = ?2 OR model = ?3`, binding canonical + legacy
    slug pair via new `Model::legacy_slug()`. Production ledger rows
    written under "haiku"/"sonnet"/"opus" remain visible to posterior
    aggregation. Regression test ledger_legacy_slug_counted.

HIGH fixes
  - cmd_select(): no longer early-returns on profile match. Profile's
    default_model_ref now becomes DecisionInput.fallback; select() always
    runs, posterior/kernel evidence wins if present. RULE 0.20 cost
    optimisation restored for all 18 registered agents.
  - Registry pricing SSoT: DecisionInput now carries Option<Arc<Registry>>.
    estimated_cost() tries registry first; hardcoded match is documented
    fallback only. select_posterior.rs no longer duplicates models.toml
    constants.
  - registry.rs portability: include_str!() embeds the three TOMLs at
    compile time. load_embedded() new; disk path tried first via
    KEI_REGISTRIES_DIR, embedded as fallback. `cargo install`d binaries
    now find registries unconditionally. embedded_registry_matches_disk
    test ensures embedded ≡ disk source.
  - next_model() ambiguity: replaced Option<&Model> with EscalationResult
    enum (Next(&Model) / AtTop / NotFound). Callers can distinguish typo
    from ceiling. 5 new tests.

MEDIUM fixes
  - posterior.rs u32 overflow: `(n_plus + n_minus) as u32` →
    `u32::try_from(n_plus.saturating_add(n_minus)).unwrap_or(u32::MAX)`.
    overflow_guard_on_huge_n test with i64::MAX.
  - pick() unknown-model: now returns None when default_model_ref's model
    is absent from registry. Inverted the deprecation guard.
  - HOME unset: disk_registries_dir() returns None on empty HOME and
    falls through to embedded registries. open_ledger() logs warning
    and returns None instead of opening at malformed path.
  - SQLite WAL + busy_timeout: applied to ledger connection in
    open_ledger() — concurrent CLI invocations no longer SQLITE_BUSY.

LOW fixes
  - impl Model consolidation: next_tier() moved to pricing.rs.
    escalate.rs uses current.next_tier() instead of duplicating logic.
  - complexity.rs: removed duplicate "ml-implementer" in HEAVY_ROLES.
  - dna_class.rs: role("") now returns None instead of Some("").

Verification (orchestrator-side, RULE 0.13 §Verify-before-commit):
  - cargo check        → clean
  - cargo test --release → 63 passed / 0 failed (was 58 → +5 new tests
    cover legacy-slug, EscalationResult, overflow, unknown-model, embedded)
  - Constructor Pattern → all files ≤ 200 LOC (max registry.rs 196)
  - Largest fn from_ledger 28 LOC / limit 30

DNA-INDEX.md regenerated by kei-registry hook (cosmetic).

=== STATUS-TRUTH MARKER ===
shipped: functional
stubs: 0
cargo-check: PASS
behaviour-verified: yes
follow-up-required:
  - (none from this commit; next audit pass before merge to main)
2026-05-13 22:09:19 +08:00
..
encyclopedia fix(audit-batch-2): regressions from prev batch + 2nd-wave audit findings 2026-05-03 20:30:51 +08:00
AGENT-ROLES.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
AGENT-SCHEMA-LOCKED.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
AGENT-SUBSTRATE-SCHEMA.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
ARCHITECTURE.md fix(release+slices): v0.14.4 publish auth fallback + 4 fix-implementer slices 2026-05-04 00:16:48 +08:00
CONVERGENCE-PLAN.md docs: SKILL.md triggers + STATUS-TRUTH footer + phase placeholders 2026-05-02 21:41:41 +08:00
DNA-FORMAT.md docs: reviewer-response — honesty pass + portable format specs 2026-05-03 16:59:25 +08:00
DNA-INDEX.md fix(kei-model-router): close 10 audit-blocker findings 2026-05-13 22:09:19 +08:00
HANDOFF-WAKE.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
IMPORT-RUNTIME.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
INSTALL.md fix(release+slices): v0.14.4 publish auth fallback + 4 fix-implementer slices 2026-05-04 00:16:48 +08:00
LEDGER-SCHEMA.md docs: reviewer-response — honesty pass + portable format specs 2026-05-03 16:59:25 +08:00
MEMORY-FORMAT.md docs: reviewer-response — honesty pass + portable format specs 2026-05-03 16:59:25 +08:00
PHILOSOPHY.md fix(audit-batch-2): regressions from prev batch + 2nd-wave audit findings 2026-05-03 20:30:51 +08:00
PROFILE-OUTCOME-ONLY.md fix(release+slices): v0.14.4 publish auth fallback + 4 fix-implementer slices 2026-05-04 00:16:48 +08:00
PUBLISHING.md docs: reviewer-response — honesty pass + portable format specs 2026-05-03 16:59:25 +08:00
QUICKSTART.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
REFERENCE.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
RULES-AS-BLOCKS.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
SCHEMA-LOCKED.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
SCHEMA-UNLOCKED.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
SECURITY.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
SLEEP-LAYER.md fix(audit-batch-2): regressions from prev batch + 2nd-wave audit findings 2026-05-03 20:30:51 +08:00
SUBSTRATE-SCHEMA.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
TAXONOMY.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
USB-BRAIN-GUIDE-linux.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
USB-BRAIN-GUIDE-macos.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
USB-BRAIN-GUIDE-windows.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
USB-BRAIN-GUIDE.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
WHY.md KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00