KeiSeiKit-1.0/_manifests/critic-perf.toml
Parfii-bot cb1fddeabb feat(model-tier+branch-dna): activate cost router + give branches DNA
Phase 4 of substrate-unified-registry: turn on the existing
kei-model-router by changing manifest defaults from `model = "opus"`
to `model = "sonnet"` for routine agents, and give every git branch
a deterministic DNA in the kei-status dashboard.

The model-tier system was BUILT (`_primitives/_rust/kei-model-router/`
crate with Beta posterior, complexity τ-estimator, escalate ladder,
calibrate subcommand) and the advisor hook
(`~/.claude/hooks/model-router-advisor.sh`) was REGISTERED. But every
ledger row from this session ran on Opus because:
  1. All 38 manifests hard-coded `model = "opus"` → no chance for the
     router to recommend cheaper.
  2. The orchestrator (me) ignored the stderr advisory.

This commit closes (1). (2) is a behavioural change tracked separately.

Manifest reclassification (4 Opus + 34 Sonnet):
  Opus (hard reasoning):
    - architect            (system-design synthesis)
    - ml-implementer       (Math-First paradigm)
    - ml-researcher        (literature analysis)
    - security-auditor     (deep risk synthesis)
  Sonnet (everything else):
    - 8 code-implementer-* + code-implementer
    - 5 critic-* + critic
    - 6 infra-implementer-* + infra-implementer
    - 4 researcher-* + researcher
    - 6 validator-* + validator
    - 3 security-auditor-{differential,supply-chain,variant}
    - cost-guardian, fal-ai-runner, frontend-validator, modal-runner

Regenerated all 38 `_generated/*.md` so the YAML frontmatter `model:`
field matches the manifest.

Branch DNA (kei-registry status):
  - New `compute_branch_dna(name, commit_sha)` in `status.rs`. Format
    `branch::git::<sha8(name)>::<sha8(commit)>`, mirrors kei-shared
    DNA wire layout `<role>::<caps>::<scope_sha8>::<body_sha8>`.
  - Deterministic — same `(name, commit)` → same DNA. Changes when
    either changes. No DB persistence: the underlying truth lives in
    `.git/refs/heads/<name>`.
  - 3 new unit tests cover format, determinism, name-change, commit-
    change. `cargo test status::tests` → 10 passed.

`kei-registry status` output now shows DNA prefix per branch alongside
ahead/behind, last commit. Combined with existing per-block DNA in the
[Blocks] and [Path Atoms] sections + `dna` column on `agents` table in
kei-ledger, every artefact in the dashboard has an identifier:

  Atoms (incl path-atoms)  → atom::<caps>::<scope>::<body>     (registry)
  Skills/Rules/Hooks/Prim  → <role>::<caps>::<scope>::<body>   (registry)
  Agent forks              → row.dna in agents table           (ledger)
  Local branches           → branch::git::<sha8>::<sha8>       (computed)

What this does NOT do:
- No outcome backfill — the 205 NULL outcomes in ledger still prevent
  the Beta posterior from learning. Router falls back to top-tier
  until ≥1 datapoint per (task_class, model) accumulates. Tracked as
  follow-up.
- No post-checkout hook to auto-register branches in kei-ledger. Live
  shell-out to `git for-each-ref` is fast enough for the dashboard;
  persistence buys nothing the .git tree doesn't already give.

=== STATUS-TRUTH MARKER ===
shipped: functional
stubs: 0
cargo-check: PASS
behaviour-verified: yes
follow-up-required:
  - Outcome backfill hook (writes outcome to ledger after agent done)
  - User /model claude-sonnet-4-6 for current session (5x cheaper)
  - Push the orchestrator (me) to read advisor stderr in real-time

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 23:05:07 +08:00

44 lines
1.3 KiB
TOML

# Atomar agent — auto-generated 2026-04-29 (RULE ZERO decomposition).
# 1 cube = 1 responsibility. Edit this manifest, not the .md.
name = "critic-perf"
description = "Detects performance traps: N+1 queries, allocator hot loops, blocking-in-async, unbounded retention. Read-only."
tools = ["Glob", "Grep", "Read"]
model = "sonnet"
substrate_role = "read-only"
role = """
You scan for performance footguns — N+1 SQL, allocator pressure inside hot loops, blocking std::sync::Mutex inside async, unbounded Vec growth, sync I/O on async runtime. Severity-sorted with line:line evidence.
"""
blocks = [
"baseline",
"evidence-grading",
"memory-protocol",
]
domain_in = ["task scope (verbatim user prompt)", "target paths / files"]
forbidden_domain = ["hardcoded secrets (RULE 0.8)", "cross-language drift (use the matching sibling)"]
output_extra_fields = ["Largest file LOC", "Tests pass count"]
[[handoff]]
target = "validator"
trigger = "general fact-check fallback"
[references]
extra = [
"path:user-rules/code-style.md",
"path:user-rules/karpathy-behavioral.md",
]
[taxonomy]
kingdom = "manifest"
mechanism = "compose"
domain = "agent"
layer = "agent-substrate"
stage = "design-time"
stability = "stable"
language = "toml"
[lineage]
creator = "ag-orchestrator-human"
created = "2026-04-29"