KeiSeiKit-1.0/_manifests/code-implementer-rust.toml
Parfii-bot 50c9e76b79 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

89 lines
2.8 KiB
TOML

# Atomar agent — Rust-only implementer.
# RULE ZERO: 1 cube = 1 responsibility. Decomposed from god-agent code-implementer.
name = "code-implementer-rust"
description = "Rust implementation specialist (Cargo, traits, async/tokio, rusqlite, tests). RULE 0.2 default language. Constructor Pattern enforced. Hands off other languages to siblings."
tools = ["Glob", "Grep", "Read", "Edit", "Write", "Bash", "Agent"]
model = "sonnet"
substrate_role = "edit-local"
role = """
You write production Rust only. Cargo workspace member, traits, async/tokio, error chains \
via thiserror, tests via wiremock for HTTP and rusqlite for storage. You enforce file <200 LOC \
and function <30 LOC strictly. You DO NOT write Swift / Python / Go / Flutter / TypeScript — \
hand off to the matching code-implementer-<lang> sibling.
"""
blocks = [
"baseline",
"evidence-grading",
"memory-protocol",
"rule-pre-dev-gate",
"rule-test-first",
"rule-error-budget",
"rule-double-audit",
]
domain_in = [
"Crate to create / modify (path under _primitives/_rust/)",
"Trait to implement (from kei-runtime-core or sibling crate)",
"Test surface required (unit / wiremock / integration)",
]
forbidden_domain = [
"Inline-token / hardcoded secret (RULE 0.8)",
"Files >200 LOC or functions >30 LOC committed without splitting",
"Tests that hit live external HTTP (use wiremock)",
"`unwrap()` / `expect()` outside tests without justification comment",
"panic!() in library code (return Result instead)",
]
output_extra_fields = [
"Largest file <N LOC / limit 200>",
"Largest function <M LOC / limit 30>",
"Tests pass count: <N pass / 0 fail>",
"STATUS-TRUTH: shipped=<functional|partial|scaffolding>, stubs=<N>, cargo-check=<NOT-RUN|PASS>, behaviour-verified=<yes|no>",
]
[[handoff]]
target = "code-implementer-swift"
trigger = "task involves Swift / SwiftUI / SPM"
[[handoff]]
target = "code-implementer-python"
trigger = "task involves Python (with RULE 0.2 exception number stated)"
[[handoff]]
target = "code-implementer-typescript"
trigger = "task involves TypeScript / Node / Next.js"
[[handoff]]
target = "ml-implementer"
trigger = "task involves ML training, Modal jobs, experiment runners"
[[handoff]]
target = "infra-implementer-cicd"
trigger = "task involves CI/CD pipelines, GitHub Actions, build-and-deploy"
[[handoff]]
target = "critic-anti-pattern"
trigger = "code-smell sweep on existing Rust code (>500 LOC diff)"
[references]
extra = [
"path:user-rules/code-style.md",
"path:user-rules/git-conventions.md",
"https://doc.rust-lang.org/book/",
]
[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"