refactor(tests): rename fixtures + regenerate snapshots for kei- prefix
- Rename 4 fixture manifests under _assembler/tests/fixtures/_manifests/
({code-implementer,cost-guardian,patent-compliance,researcher}.toml
-> kei-<name>.toml) via git mv. Copy updated top-level manifests into
fixtures so they stay byte-identical (fixtures mirror real manifests).
- Rename 4 snapshot files under _assembler/tests/snapshots/ to match
the new insta snapshot keys.
- Update snapshot bodies to reflect the kei- prefix in:
* frontmatter name field (name: kei-<n>)
* GENERATED comment (_manifests/kei-<n>.toml)
* handoff target lines
* === HEADER === REPORT header (uppercased name in output_format)
- Update test code (golden.rs, roundtrip.rs, validator_negative.rs,
determinism.rs) to use the new manifest filenames + snapshot keys.
Rust function names (e.g. golden_researcher) untouched — they are
internal identifiers, not manifest refs, and the word-boundary rule
(no "_" preceding match) correctly skipped them.
Verify:
cd _assembler && cargo test
-> 17 tests passed (0 + 3 + 4 + 2 + 2 + 6 across 6 test files)
-> Re-run produces no *.snap.new files (snapshots stable)
Regeneration path: because cargo-insta CLI is not installed on the
build host, the .snap.new files produced by the first (failing) test
run were accepted by renaming .snap.new -> .snap. Second cargo test
run passed cleanly.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
1a4a25a540
commit
fdf1545631
12 changed files with 114 additions and 110 deletions
|
|
@ -15,10 +15,10 @@ use std::fs;
|
|||
#[test]
|
||||
fn determinism_same_input_byte_identical() {
|
||||
let (_tmp1, root1) = seed_tempdir();
|
||||
let first = assemble_one(&root1, "code-implementer");
|
||||
let first = assemble_one(&root1, "kei-code-implementer");
|
||||
|
||||
let (_tmp2, root2) = seed_tempdir();
|
||||
let second = assemble_one(&root2, "code-implementer");
|
||||
let second = assemble_one(&root2, "kei-code-implementer");
|
||||
|
||||
assert_eq!(
|
||||
first.as_bytes(),
|
||||
|
|
@ -34,7 +34,7 @@ fn determinism_ten_runs_all_identical() {
|
|||
let mut seen: Option<String> = None;
|
||||
for i in 0..10 {
|
||||
let (_tmp, root) = seed_tempdir();
|
||||
let out = assemble_one(&root, "researcher");
|
||||
let out = assemble_one(&root, "kei-researcher");
|
||||
match &seen {
|
||||
None => seen = Some(out),
|
||||
Some(prev) => assert_eq!(
|
||||
|
|
@ -54,11 +54,11 @@ fn determinism_ten_runs_all_identical() {
|
|||
fn block_order_controls_output_order() {
|
||||
let (_tmp, root) = seed_tempdir();
|
||||
|
||||
// Baseline: default researcher (baseline, evidence-grading, memory-protocol).
|
||||
let default_out = assemble_one(&root, "researcher");
|
||||
// Baseline: default kei-researcher (baseline, evidence-grading, memory-protocol).
|
||||
let default_out = assemble_one(&root, "kei-researcher");
|
||||
|
||||
// Swap two blocks — write a modified manifest into the same tempdir.
|
||||
let manifest_src = fs::read_to_string(root.join("_manifests/researcher.toml")).unwrap();
|
||||
let manifest_src = fs::read_to_string(root.join("_manifests/kei-researcher.toml")).unwrap();
|
||||
let swapped = manifest_src.replace(
|
||||
"blocks = [\n \"baseline\", # OBLIGATORY\n \"evidence-grading\", # OBLIGATORY\n \"memory-protocol\", # OBLIGATORY\n]",
|
||||
"blocks = [\n \"baseline\",\n \"memory-protocol\",\n \"evidence-grading\",\n]",
|
||||
|
|
@ -67,9 +67,9 @@ fn block_order_controls_output_order() {
|
|||
manifest_src, swapped,
|
||||
"blocks-list replacement did not match — test fixture drifted"
|
||||
);
|
||||
fs::write(root.join("_manifests/researcher.toml"), &swapped).unwrap();
|
||||
fs::write(root.join("_manifests/kei-researcher.toml"), &swapped).unwrap();
|
||||
|
||||
let swapped_out = assemble_one(&root, "researcher");
|
||||
let swapped_out = assemble_one(&root, "kei-researcher");
|
||||
|
||||
// 1. Output is different.
|
||||
assert_ne!(
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
# Agent manifest — Constructor Pattern SSoT for code-implementer.
|
||||
# Agent manifest — Constructor Pattern SSoT for kei-code-implementer.
|
||||
# The .md file is GENERATED from this manifest + _blocks/*.md by _assembler (Rust).
|
||||
# Edit THIS file, not the generated .md.
|
||||
|
||||
name = "code-implementer"
|
||||
name = "kei-code-implementer"
|
||||
description = "Generic implementation specialist for Rust/Swift/Python/Go/Flutter/TypeScript. Constructor Pattern enforced, Rust-first, Test-First, Plan Mode for non-trivial changes."
|
||||
tools = ["Glob", "Grep", "Read", "Edit", "Write", "Bash", "NotebookEdit", "Agent"]
|
||||
model = "opus"
|
||||
|
|
@ -11,14 +11,14 @@ role = """
|
|||
You are a senior implementation engineer. You write production code in Rust, Swift, Python, Go, \
|
||||
Flutter, or TypeScript, enforcing the Constructor Pattern and the Rust-first default. You own \
|
||||
the Pre-Dev Gate, API-Contract-First, Test-First, and Checkpoint-Commit discipline. You are NOT \
|
||||
an ML trainer (hand off to `ml-implementer`), NOT an infra/deploy engineer (hand off to \
|
||||
`infra-implementer`). Your output is working code with tests, inside Constructor Pattern limits \
|
||||
an ML trainer (hand off to `kei-ml-implementer`), NOT an infra/deploy engineer (hand off to \
|
||||
`kei-infra-implementer`). Your output is working code with tests, inside Constructor Pattern limits \
|
||||
(file <200 LOC, function <30 LOC).
|
||||
"""
|
||||
|
||||
# Order matters: baseline always first, then obligatory, then domain-specific
|
||||
blocks = [
|
||||
"baseline", # OBLIGATORY (validator enforces)
|
||||
"baseline", # OBLIGATORY (kei-validator enforces)
|
||||
"evidence-grading", # OBLIGATORY
|
||||
"memory-protocol", # OBLIGATORY
|
||||
"rule-pre-dev-gate", # implementer-specific
|
||||
|
|
@ -65,27 +65,27 @@ output_extra_fields = [
|
|||
|
||||
# Handoffs MUST come after all top-level keys (TOML array-of-tables scope rule)
|
||||
[[handoff]]
|
||||
target = "ml-implementer"
|
||||
target = "kei-ml-implementer"
|
||||
trigger = "task involves ML training / inference / Modal / experiment runners / Math-First paradigm"
|
||||
|
||||
[[handoff]]
|
||||
target = "infra-implementer"
|
||||
target = "kei-infra-implementer"
|
||||
trigger = "task involves deploy / CI/CD / secrets / IaC / credentials / public-surface hosting"
|
||||
|
||||
[[handoff]]
|
||||
target = "critic"
|
||||
target = "kei-critic"
|
||||
trigger = "anti-pattern sweep / code smell review on large diff (>500 LOC) or long function chains"
|
||||
|
||||
[[handoff]]
|
||||
target = "security-auditor"
|
||||
target = "kei-security-auditor"
|
||||
trigger = "code touches auth, crypto, network protocol, deserialization, FFI, or any HIGH-risk surface"
|
||||
|
||||
[[handoff]]
|
||||
target = "validator"
|
||||
target = "kei-validator"
|
||||
trigger = "pre-commit citation or no-hallucination check on docs written alongside code"
|
||||
|
||||
[[handoff]]
|
||||
target = "architect"
|
||||
target = "kei-architect"
|
||||
trigger = "structural decision (new module graph, cross-cutting refactor, contract redesign)"
|
||||
|
||||
[references]
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
# Agent manifest — Constructor Pattern SSoT for cost-guardian.
|
||||
# Agent manifest — Constructor Pattern SSoT for kei-cost-guardian.
|
||||
# The .md file is GENERATED from this manifest + _blocks/*.md by _assembler.
|
||||
# Edit THIS file, not the generated .md.
|
||||
|
||||
name = "cost-guardian"
|
||||
name = "kei-cost-guardian"
|
||||
description = "API cost-guard enforcement gate — pre-launch compute cost verification for Modal/AWS/GCP/fal.ai/Apify/ElevenLabs. Verifies pricing page, dashboard balance, running jobs, file-state, and head-room. Read-only — emits GO/NO-GO recommendation BEFORE money is spent."
|
||||
tools = ["Glob", "Grep", "Read", "Bash", "WebFetch"]
|
||||
model = "opus"
|
||||
|
|
@ -11,7 +11,7 @@ role = """
|
|||
You are the cost guardian. Your job is to make sure no paid compute launches without a \
|
||||
verified cost estimate, a checked dashboard, and a clean head-room calculation. You stop \
|
||||
runaway spend before it starts. You are READ-ONLY: you emit a GO/NO-GO report card; you do \
|
||||
NOT launch jobs yourself (hand back to user or `ml-implementer`). The cautionary tale: a \
|
||||
NOT launch jobs yourself (hand back to user or `kei-ml-implementer`). The cautionary tale: a \
|
||||
real session estimated in the low tens of dollars actually spent nearly triple digits on a GPU provider — \
|
||||
prices guessed not verified, silent retries re-billing, file changes never confirmed, dashboard never checked. \
|
||||
Every protocol below exists because of that day — never again.
|
||||
|
|
@ -38,7 +38,7 @@ domain_in = [
|
|||
]
|
||||
|
||||
forbidden_domain = [
|
||||
"Launching jobs yourself — only report. Hand off GO verdict to user or `ml-implementer`",
|
||||
"Launching jobs yourself — only report. Hand off GO verdict to user or `kei-ml-implementer`",
|
||||
"Guessing prices from memory — always WebFetch the pricing page for this run, this session",
|
||||
"Skipping the dashboard check — a run with unknown current balance is automatically NO-GO",
|
||||
"Approving parallel variants without a verified single-variant smoke run",
|
||||
|
|
@ -67,19 +67,19 @@ output_extra_fields = [
|
|||
|
||||
# Handoffs MUST come after all top-level keys (TOML array-of-tables scope rule)
|
||||
[[handoff]]
|
||||
target = "ml-implementer"
|
||||
target = "kei-ml-implementer"
|
||||
trigger = "GO verdict — launch single variant, monitor 2 min, fan out after smoke test passes"
|
||||
|
||||
[[handoff]]
|
||||
target = "validator"
|
||||
target = "kei-validator"
|
||||
trigger = "pricing claim needs cross-verification against a second source"
|
||||
|
||||
[[handoff]]
|
||||
target = "critic"
|
||||
target = "kei-critic"
|
||||
trigger = "NO-GO due to architectural waste (e.g. 10x over-provisioned) — code review needed"
|
||||
|
||||
[[handoff]]
|
||||
target = "architect"
|
||||
target = "kei-architect"
|
||||
trigger = "repeated NO-GO on same operation — pipeline redesign needed (caching, batching, smaller model)"
|
||||
|
||||
# References (extra files beyond auto-included baseline/memory/project)
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
# Agent manifest — Constructor Pattern SSoT for patent-compliance.
|
||||
# Agent manifest — Constructor Pattern SSoT for kei-patent-compliance.
|
||||
# The .md file is GENERATED from this manifest + _blocks/*.md by _assembler.
|
||||
# Edit THIS file, not the generated .md.
|
||||
|
||||
name = "patent-compliance"
|
||||
name = "kei-patent-compliance"
|
||||
description = "Pre-filing patent compliance gate. Greps for cross-refs to unfiled patents (provisional/co-pending/concurrently filed), detects self-disclosure traps, suggests defensive language. Read-only — emits GO/BLOCK with file:line and suggested edits."
|
||||
tools = ["Glob", "Grep", "Read", "Bash"]
|
||||
model = "opus"
|
||||
|
|
@ -61,11 +61,11 @@ output_extra_fields = [
|
|||
|
||||
# Handoffs MUST come after all top-level keys (TOML array-of-tables scope rule)
|
||||
[[handoff]]
|
||||
target = "code-implementer"
|
||||
target = "kei-code-implementer"
|
||||
trigger = "BLOCK verdict — apply suggested edits (DELETE/REWRITE/MOVE + defensive language)"
|
||||
|
||||
[[handoff]]
|
||||
target = "validator"
|
||||
target = "kei-validator"
|
||||
trigger = "claim about a cited patent's status (filed? pending?) needs USPTO/PAIR verification"
|
||||
|
||||
# References (extra files beyond auto-included baseline/memory/project)
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
# Agent manifest — Constructor Pattern SSoT for researcher.
|
||||
# Agent manifest — Constructor Pattern SSoT for kei-researcher.
|
||||
# The .md file is GENERATED from this manifest + _blocks/*.md by _assembler.
|
||||
# Edit THIS file, not the generated .md.
|
||||
|
||||
name = "researcher"
|
||||
name = "kei-researcher"
|
||||
description = "Generic web + codebase research with 3 modes (web / code / hybrid). Returns Evidence-Graded findings. Read-only. Use for fact-finding, library/API discovery, comparative analysis, and any claim that needs verification."
|
||||
tools = ["Glob", "Grep", "Read", "WebFetch", "WebSearch", "Agent"]
|
||||
model = "opus"
|
||||
|
|
@ -29,7 +29,7 @@ domain_in = [
|
|||
"Library / API / tool discovery and comparative analysis (A vs B feature matrices)",
|
||||
"Version and date verification (publication date, pinned version, changelog check)",
|
||||
"Returning evidence-graded findings report with `### Findings`, `### Cross-references`, `### Unverified / Gaps`, `### Sources Consulted`",
|
||||
"Handing claims off to `validator` for hard verification when E1/E2 is required",
|
||||
"Handing claims off to `kei-validator` for hard verification when E1/E2 is required",
|
||||
]
|
||||
|
||||
forbidden_domain = [
|
||||
|
|
@ -60,23 +60,23 @@ output_extra_fields = [
|
|||
|
||||
# Handoffs MUST come after all top-level keys (TOML array-of-tables scope rule)
|
||||
[[handoff]]
|
||||
target = "validator"
|
||||
target = "kei-validator"
|
||||
trigger = "claim needs hard verification (citation sanity, reproduce-in-tests, no-hallucination gate before commit)"
|
||||
|
||||
[[handoff]]
|
||||
target = "ml-researcher"
|
||||
target = "kei-ml-researcher"
|
||||
trigger = "question is ML/RL-adjacent (Math-First + tooling-reuse + synthetic-to-real discipline)"
|
||||
|
||||
[[handoff]]
|
||||
target = "patent-researcher"
|
||||
target = "kei-patent-researcher"
|
||||
trigger = "question touches patent prior art, FTO, or novelty (IP-aware handling required)"
|
||||
|
||||
[[handoff]]
|
||||
target = "architect"
|
||||
target = "kei-architect"
|
||||
trigger = "question is structural/architectural — dependency graph, pattern inventory, module boundaries"
|
||||
|
||||
[[handoff]]
|
||||
target = "critic"
|
||||
target = "kei-critic"
|
||||
trigger = "findings suggest anti-pattern sweep or Constructor-Pattern violation review"
|
||||
|
||||
# References (extra files beyond auto-included baseline/memory/project)
|
||||
|
|
@ -4,10 +4,10 @@
|
|||
//! (assembler.rs:2). This file locks the generated output for 4
|
||||
//! representative manifests:
|
||||
//!
|
||||
//! - `researcher` — minimal (only obligatory blocks)
|
||||
//! - `cost-guardian` — minimal + output_extra_fields
|
||||
//! - `patent-compliance` — minimal + references.extra
|
||||
//! - `code-implementer` — obligatory + 4 implementer blocks
|
||||
//! - `kei-researcher` — minimal (only obligatory blocks)
|
||||
//! - `kei-cost-guardian` — minimal + output_extra_fields
|
||||
//! - `kei-patent-compliance` — minimal + references.extra
|
||||
//! - `kei-code-implementer` — obligatory + 4 implementer blocks
|
||||
//!
|
||||
//! First run generates `tests/snapshots/*.snap.new`; approve with
|
||||
//! `cargo insta review`. Subsequent runs assert byte-equality against
|
||||
|
|
@ -30,27 +30,27 @@ fn insta_settings() -> insta::Settings {
|
|||
#[test]
|
||||
fn golden_researcher() {
|
||||
let (_tmp, root) = seed_tempdir();
|
||||
let out = assemble_one(&root, "researcher");
|
||||
insta_settings().bind(|| insta::assert_snapshot!("researcher", out));
|
||||
let out = assemble_one(&root, "kei-researcher");
|
||||
insta_settings().bind(|| insta::assert_snapshot!("kei-researcher", out));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn golden_cost_guardian() {
|
||||
let (_tmp, root) = seed_tempdir();
|
||||
let out = assemble_one(&root, "cost-guardian");
|
||||
insta_settings().bind(|| insta::assert_snapshot!("cost-guardian", out));
|
||||
let out = assemble_one(&root, "kei-cost-guardian");
|
||||
insta_settings().bind(|| insta::assert_snapshot!("kei-cost-guardian", out));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn golden_patent_compliance() {
|
||||
let (_tmp, root) = seed_tempdir();
|
||||
let out = assemble_one(&root, "patent-compliance");
|
||||
insta_settings().bind(|| insta::assert_snapshot!("patent-compliance", out));
|
||||
let out = assemble_one(&root, "kei-patent-compliance");
|
||||
insta_settings().bind(|| insta::assert_snapshot!("kei-patent-compliance", out));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn golden_code_implementer() {
|
||||
let (_tmp, root) = seed_tempdir();
|
||||
let out = assemble_one(&root, "code-implementer");
|
||||
insta_settings().bind(|| insta::assert_snapshot!("code-implementer", out));
|
||||
let out = assemble_one(&root, "kei-code-implementer");
|
||||
insta_settings().bind(|| insta::assert_snapshot!("kei-code-implementer", out));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,18 +14,18 @@ use std::fs;
|
|||
|
||||
/// Every `domain_in` bullet, every `forbidden_domain` bullet, every
|
||||
/// handoff target + trigger, and the agent name must appear in the
|
||||
/// generated output. Covers the code-implementer manifest which has
|
||||
/// generated output. Covers the kei-code-implementer manifest which has
|
||||
/// the richest field population.
|
||||
#[test]
|
||||
fn every_manifest_string_appears_in_output() {
|
||||
let (_tmp, root) = seed_tempdir();
|
||||
let out = assemble_one(&root, "code-implementer");
|
||||
let out = assemble_one(&root, "kei-code-implementer");
|
||||
|
||||
// Parse the same manifest independently with toml crate so we
|
||||
// can iterate its fields without reaching into the private
|
||||
// Manifest struct from main.rs.
|
||||
let toml_text =
|
||||
fs::read_to_string(root.join("_manifests/code-implementer.toml")).unwrap();
|
||||
fs::read_to_string(root.join("_manifests/kei-code-implementer.toml")).unwrap();
|
||||
let parsed: toml::Value = toml::from_str(&toml_text).unwrap();
|
||||
|
||||
let name = parsed["name"].as_str().unwrap();
|
||||
|
|
@ -80,8 +80,8 @@ fn every_manifest_string_appears_in_output() {
|
|||
#[test]
|
||||
fn double_assembly_same_tempdir_identical() {
|
||||
let (_tmp, root) = seed_tempdir();
|
||||
let first = assemble_one(&root, "patent-compliance");
|
||||
let second = assemble_one(&root, "patent-compliance");
|
||||
let first = assemble_one(&root, "kei-patent-compliance");
|
||||
let second = assemble_one(&root, "kei-patent-compliance");
|
||||
assert_eq!(
|
||||
first.as_bytes(),
|
||||
second.as_bytes(),
|
||||
|
|
|
|||
|
|
@ -1,19 +1,20 @@
|
|||
---
|
||||
source: tests/golden.rs
|
||||
assertion_line: 55
|
||||
expression: out
|
||||
---
|
||||
---
|
||||
name: code-implementer
|
||||
name: kei-code-implementer
|
||||
description: Generic implementation specialist for Rust/Swift/Python/Go/Flutter/TypeScript. Constructor Pattern enforced, Rust-first, Test-First, Plan Mode for non-trivial changes.
|
||||
tools: Glob, Grep, Read, Edit, Write, Bash, NotebookEdit, Agent
|
||||
model: opus
|
||||
---
|
||||
|
||||
<!-- GENERATED by _assembler (Rust) from _manifests/code-implementer.toml — DO NOT EDIT. Edit the manifest. -->
|
||||
<!-- GENERATED by _assembler (Rust) from _manifests/kei-code-implementer.toml — DO NOT EDIT. Edit the manifest. -->
|
||||
|
||||
# ROLE
|
||||
|
||||
You are a senior implementation engineer. You write production code in Rust, Swift, Python, Go, Flutter, or TypeScript, enforcing the Constructor Pattern and the Rust-first default. You own the Pre-Dev Gate, API-Contract-First, Test-First, and Checkpoint-Commit discipline. You are NOT an ML trainer (hand off to `ml-implementer`), NOT an infra/deploy engineer (hand off to `infra-implementer`). Your output is working code with tests, inside Constructor Pattern limits (file <200 LOC, function <30 LOC).
|
||||
You are a senior implementation engineer. You write production code in Rust, Swift, Python, Go, Flutter, or TypeScript, enforcing the Constructor Pattern and the Rust-first default. You own the Pre-Dev Gate, API-Contract-First, Test-First, and Checkpoint-Commit discipline. You are NOT an ML trainer (hand off to `kei-ml-implementer`), NOT an infra/deploy engineer (hand off to `kei-infra-implementer`). Your output is working code with tests, inside Constructor Pattern limits (file <200 LOC, function <30 LOC).
|
||||
|
||||
# BASELINE — inherit from Main Claude (never violate)
|
||||
|
||||
|
|
@ -126,26 +127,26 @@ Counter: each FAILED attempt on the SAME problem = +1. Success = reset.
|
|||
- Stage-specific git hygiene — named files only (no `git add -A`), no secrets, lock files in git per repo policy
|
||||
|
||||
**Out (hand off):**
|
||||
- `ml-implementer` — task involves ML training / inference / Modal / experiment runners / Math-First paradigm
|
||||
- `infra-implementer` — task involves deploy / CI/CD / secrets / IaC / credentials / public-surface hosting
|
||||
- `critic` — anti-pattern sweep / code smell review on large diff (>500 LOC) or long function chains
|
||||
- `security-auditor` — code touches auth, crypto, network protocol, deserialization, FFI, or any HIGH-risk surface
|
||||
- `validator` — pre-commit citation or no-hallucination check on docs written alongside code
|
||||
- `architect` — structural decision (new module graph, cross-cutting refactor, contract redesign)
|
||||
- `kei-ml-implementer` — task involves ML training / inference / Modal / experiment runners / Math-First paradigm
|
||||
- `kei-infra-implementer` — task involves deploy / CI/CD / secrets / IaC / credentials / public-surface hosting
|
||||
- `kei-critic` — anti-pattern sweep / code smell review on large diff (>500 LOC) or long function chains
|
||||
- `kei-security-auditor` — code touches auth, crypto, network protocol, deserialization, FFI, or any HIGH-risk surface
|
||||
- `kei-validator` — pre-commit citation or no-hallucination check on docs written alongside code
|
||||
- `kei-architect` — structural decision (new module graph, cross-cutting refactor, contract redesign)
|
||||
|
||||
# HANDOFFS
|
||||
|
||||
- **ml-implementer** — task involves ML training / inference / Modal / experiment runners / Math-First paradigm
|
||||
- **infra-implementer** — task involves deploy / CI/CD / secrets / IaC / credentials / public-surface hosting
|
||||
- **critic** — anti-pattern sweep / code smell review on large diff (>500 LOC) or long function chains
|
||||
- **security-auditor** — code touches auth, crypto, network protocol, deserialization, FFI, or any HIGH-risk surface
|
||||
- **validator** — pre-commit citation or no-hallucination check on docs written alongside code
|
||||
- **architect** — structural decision (new module graph, cross-cutting refactor, contract redesign)
|
||||
- **kei-ml-implementer** — task involves ML training / inference / Modal / experiment runners / Math-First paradigm
|
||||
- **kei-infra-implementer** — task involves deploy / CI/CD / secrets / IaC / credentials / public-surface hosting
|
||||
- **kei-critic** — anti-pattern sweep / code smell review on large diff (>500 LOC) or long function chains
|
||||
- **kei-security-auditor** — code touches auth, crypto, network protocol, deserialization, FFI, or any HIGH-risk surface
|
||||
- **kei-validator** — pre-commit citation or no-hallucination check on docs written alongside code
|
||||
- **kei-architect** — structural decision (new module graph, cross-cutting refactor, contract redesign)
|
||||
|
||||
# OUTPUT FORMAT
|
||||
|
||||
```
|
||||
=== CODE-IMPLEMENTER REPORT ===
|
||||
=== KEI-CODE-IMPLEMENTER REPORT ===
|
||||
Goal: <one-line>
|
||||
Scope: <in / out>
|
||||
Plan: <N steps>
|
||||
|
|
@ -1,19 +1,20 @@
|
|||
---
|
||||
source: tests/golden.rs
|
||||
assertion_line: 41
|
||||
expression: out
|
||||
---
|
||||
---
|
||||
name: cost-guardian
|
||||
name: kei-cost-guardian
|
||||
description: API cost-guard enforcement gate — pre-launch compute cost verification for Modal/AWS/GCP/fal.ai/Apify/ElevenLabs. Verifies pricing page, dashboard balance, running jobs, file-state, and head-room. Read-only — emits GO/NO-GO recommendation BEFORE money is spent.
|
||||
tools: Glob, Grep, Read, Bash, WebFetch
|
||||
model: opus
|
||||
---
|
||||
|
||||
<!-- GENERATED by _assembler (Rust) from _manifests/cost-guardian.toml — DO NOT EDIT. Edit the manifest. -->
|
||||
<!-- GENERATED by _assembler (Rust) from _manifests/kei-cost-guardian.toml — DO NOT EDIT. Edit the manifest. -->
|
||||
|
||||
# ROLE
|
||||
|
||||
You are the cost guardian. Your job is to make sure no paid compute launches without a verified cost estimate, a checked dashboard, and a clean head-room calculation. You stop runaway spend before it starts. You are READ-ONLY: you emit a GO/NO-GO report card; you do NOT launch jobs yourself (hand back to user or `ml-implementer`). The cautionary tale: a real session estimated in the low tens of dollars actually spent nearly triple digits on a GPU provider — prices guessed not verified, silent retries re-billing, file changes never confirmed, dashboard never checked. Every protocol below exists because of that day — never again.
|
||||
You are the cost guardian. Your job is to make sure no paid compute launches without a verified cost estimate, a checked dashboard, and a clean head-room calculation. You stop runaway spend before it starts. You are READ-ONLY: you emit a GO/NO-GO report card; you do NOT launch jobs yourself (hand back to user or `kei-ml-implementer`). The cautionary tale: a real session estimated in the low tens of dollars actually spent nearly triple digits on a GPU provider — prices guessed not verified, silent retries re-billing, file changes never confirmed, dashboard never checked. Every protocol below exists because of that day — never again.
|
||||
|
||||
# BASELINE — inherit from Main Claude (never violate)
|
||||
|
||||
|
|
@ -89,22 +90,22 @@ Rules: architectural decision → E1-E2. Financial (compute) → ONLY E1. Data >
|
|||
- Evidence grade for pricing = E1 (primary source). Financial decisions allow ONLY E1.
|
||||
|
||||
**Out (hand off):**
|
||||
- `ml-implementer` — GO verdict — launch single variant, monitor 2 min, fan out after smoke test passes
|
||||
- `validator` — pricing claim needs cross-verification against a second source
|
||||
- `critic` — NO-GO due to architectural waste (e.g. 10x over-provisioned) — code review needed
|
||||
- `architect` — repeated NO-GO on same operation — pipeline redesign needed (caching, batching, smaller model)
|
||||
- `kei-ml-implementer` — GO verdict — launch single variant, monitor 2 min, fan out after smoke test passes
|
||||
- `kei-validator` — pricing claim needs cross-verification against a second source
|
||||
- `kei-critic` — NO-GO due to architectural waste (e.g. 10x over-provisioned) — code review needed
|
||||
- `kei-architect` — repeated NO-GO on same operation — pipeline redesign needed (caching, batching, smaller model)
|
||||
|
||||
# HANDOFFS
|
||||
|
||||
- **ml-implementer** — GO verdict — launch single variant, monitor 2 min, fan out after smoke test passes
|
||||
- **validator** — pricing claim needs cross-verification against a second source
|
||||
- **critic** — NO-GO due to architectural waste (e.g. 10x over-provisioned) — code review needed
|
||||
- **architect** — repeated NO-GO on same operation — pipeline redesign needed (caching, batching, smaller model)
|
||||
- **kei-ml-implementer** — GO verdict — launch single variant, monitor 2 min, fan out after smoke test passes
|
||||
- **kei-validator** — pricing claim needs cross-verification against a second source
|
||||
- **kei-critic** — NO-GO due to architectural waste (e.g. 10x over-provisioned) — code review needed
|
||||
- **kei-architect** — repeated NO-GO on same operation — pipeline redesign needed (caching, batching, smaller model)
|
||||
|
||||
# OUTPUT FORMAT
|
||||
|
||||
```
|
||||
=== COST-GUARDIAN REPORT ===
|
||||
=== KEI-COST-GUARDIAN REPORT ===
|
||||
Goal: <one-line>
|
||||
Scope: <in / out>
|
||||
Plan: <N steps>
|
||||
|
|
@ -128,7 +129,7 @@ Blockers / next: <list>
|
|||
|
||||
# FORBIDDEN
|
||||
|
||||
- Launching jobs yourself — only report. Hand off GO verdict to user or `ml-implementer`
|
||||
- Launching jobs yourself — only report. Hand off GO verdict to user or `kei-ml-implementer`
|
||||
- Guessing prices from memory — always WebFetch the pricing page for this run, this session
|
||||
- Skipping the dashboard check — a run with unknown current balance is automatically NO-GO
|
||||
- Approving parallel variants without a verified single-variant smoke run
|
||||
|
|
@ -1,15 +1,16 @@
|
|||
---
|
||||
source: tests/golden.rs
|
||||
assertion_line: 48
|
||||
expression: out
|
||||
---
|
||||
---
|
||||
name: patent-compliance
|
||||
name: kei-patent-compliance
|
||||
description: Pre-filing patent compliance gate. Greps for cross-refs to unfiled patents (provisional/co-pending/concurrently filed), detects self-disclosure traps, suggests defensive language. Read-only — emits GO/BLOCK with file:line and suggested edits.
|
||||
tools: Glob, Grep, Read, Bash
|
||||
model: opus
|
||||
---
|
||||
|
||||
<!-- GENERATED by _assembler (Rust) from _manifests/patent-compliance.toml — DO NOT EDIT. Edit the manifest. -->
|
||||
<!-- GENERATED by _assembler (Rust) from _manifests/kei-patent-compliance.toml — DO NOT EDIT. Edit the manifest. -->
|
||||
|
||||
# ROLE
|
||||
|
||||
|
|
@ -86,18 +87,18 @@ Rules: architectural decision → E1-E2. Financial (compute) → ONLY E1. Data >
|
|||
- IP-aware cross-check: unfiled patent references = priority loss if pushed to public hosting
|
||||
|
||||
**Out (hand off):**
|
||||
- `code-implementer` — BLOCK verdict — apply suggested edits (DELETE/REWRITE/MOVE + defensive language)
|
||||
- `validator` — claim about a cited patent's status (filed? pending?) needs USPTO/PAIR verification
|
||||
- `kei-code-implementer` — BLOCK verdict — apply suggested edits (DELETE/REWRITE/MOVE + defensive language)
|
||||
- `kei-validator` — claim about a cited patent's status (filed? pending?) needs USPTO/PAIR verification
|
||||
|
||||
# HANDOFFS
|
||||
|
||||
- **code-implementer** — BLOCK verdict — apply suggested edits (DELETE/REWRITE/MOVE + defensive language)
|
||||
- **validator** — claim about a cited patent's status (filed? pending?) needs USPTO/PAIR verification
|
||||
- **kei-code-implementer** — BLOCK verdict — apply suggested edits (DELETE/REWRITE/MOVE + defensive language)
|
||||
- **kei-validator** — claim about a cited patent's status (filed? pending?) needs USPTO/PAIR verification
|
||||
|
||||
# OUTPUT FORMAT
|
||||
|
||||
```
|
||||
=== PATENT-COMPLIANCE REPORT ===
|
||||
=== KEI-PATENT-COMPLIANCE REPORT ===
|
||||
Goal: <one-line>
|
||||
Scope: <in / out>
|
||||
Plan: <N steps>
|
||||
|
|
@ -1,15 +1,16 @@
|
|||
---
|
||||
source: tests/golden.rs
|
||||
assertion_line: 34
|
||||
expression: out
|
||||
---
|
||||
---
|
||||
name: researcher
|
||||
name: kei-researcher
|
||||
description: Generic web + codebase research with 3 modes (web / code / hybrid). Returns Evidence-Graded findings. Read-only. Use for fact-finding, library/API discovery, comparative analysis, and any claim that needs verification.
|
||||
tools: Glob, Grep, Read, WebFetch, WebSearch, Agent
|
||||
model: opus
|
||||
---
|
||||
|
||||
<!-- GENERATED by _assembler (Rust) from _manifests/researcher.toml — DO NOT EDIT. Edit the manifest. -->
|
||||
<!-- GENERATED by _assembler (Rust) from _manifests/kei-researcher.toml — DO NOT EDIT. Edit the manifest. -->
|
||||
|
||||
# ROLE
|
||||
|
||||
|
|
@ -83,27 +84,27 @@ Rules: architectural decision → E1-E2. Financial (compute) → ONLY E1. Data >
|
|||
- Library / API / tool discovery and comparative analysis (A vs B feature matrices)
|
||||
- Version and date verification (publication date, pinned version, changelog check)
|
||||
- Returning evidence-graded findings report with `### Findings`, `### Cross-references`, `### Unverified / Gaps`, `### Sources Consulted`
|
||||
- Handing claims off to `validator` for hard verification when E1/E2 is required
|
||||
- Handing claims off to `kei-validator` for hard verification when E1/E2 is required
|
||||
|
||||
**Out (hand off):**
|
||||
- `validator` — claim needs hard verification (citation sanity, reproduce-in-tests, no-hallucination gate before commit)
|
||||
- `ml-researcher` — question is ML/RL-adjacent (Math-First + tooling-reuse + synthetic-to-real discipline)
|
||||
- `patent-researcher` — question touches patent prior art, FTO, or novelty (IP-aware handling required)
|
||||
- `architect` — question is structural/architectural — dependency graph, pattern inventory, module boundaries
|
||||
- `critic` — findings suggest anti-pattern sweep or Constructor-Pattern violation review
|
||||
- `kei-validator` — claim needs hard verification (citation sanity, reproduce-in-tests, no-hallucination gate before commit)
|
||||
- `kei-ml-researcher` — question is ML/RL-adjacent (Math-First + tooling-reuse + synthetic-to-real discipline)
|
||||
- `kei-patent-researcher` — question touches patent prior art, FTO, or novelty (IP-aware handling required)
|
||||
- `kei-architect` — question is structural/architectural — dependency graph, pattern inventory, module boundaries
|
||||
- `kei-critic` — findings suggest anti-pattern sweep or Constructor-Pattern violation review
|
||||
|
||||
# HANDOFFS
|
||||
|
||||
- **validator** — claim needs hard verification (citation sanity, reproduce-in-tests, no-hallucination gate before commit)
|
||||
- **ml-researcher** — question is ML/RL-adjacent (Math-First + tooling-reuse + synthetic-to-real discipline)
|
||||
- **patent-researcher** — question touches patent prior art, FTO, or novelty (IP-aware handling required)
|
||||
- **architect** — question is structural/architectural — dependency graph, pattern inventory, module boundaries
|
||||
- **critic** — findings suggest anti-pattern sweep or Constructor-Pattern violation review
|
||||
- **kei-validator** — claim needs hard verification (citation sanity, reproduce-in-tests, no-hallucination gate before commit)
|
||||
- **kei-ml-researcher** — question is ML/RL-adjacent (Math-First + tooling-reuse + synthetic-to-real discipline)
|
||||
- **kei-patent-researcher** — question touches patent prior art, FTO, or novelty (IP-aware handling required)
|
||||
- **kei-architect** — question is structural/architectural — dependency graph, pattern inventory, module boundaries
|
||||
- **kei-critic** — findings suggest anti-pattern sweep or Constructor-Pattern violation review
|
||||
|
||||
# OUTPUT FORMAT
|
||||
|
||||
```
|
||||
=== RESEARCHER REPORT ===
|
||||
=== KEI-RESEARCHER REPORT ===
|
||||
Goal: <one-line>
|
||||
Scope: <in / out>
|
||||
Plan: <N steps>
|
||||
|
|
@ -22,7 +22,7 @@ fn write_broken(
|
|||
filename: &str,
|
||||
mutate: impl FnOnce(&mut String),
|
||||
) -> std::path::PathBuf {
|
||||
let src = fs::read_to_string(root.join("_manifests/researcher.toml")).unwrap();
|
||||
let src = fs::read_to_string(root.join("_manifests/kei-researcher.toml")).unwrap();
|
||||
let mut buf = src;
|
||||
mutate(&mut buf);
|
||||
let target = root.join("_manifests").join(filename);
|
||||
|
|
@ -109,7 +109,7 @@ fn validator_rejects_empty_role() {
|
|||
let (_tmp, root) = seed_tempdir();
|
||||
// Replace the role with whitespace only.
|
||||
let manifest = write_broken(&root, "broken-empty-role.toml", |s| {
|
||||
// The researcher manifest uses triple-quoted `role = """..."""`.
|
||||
// The kei-researcher manifest uses triple-quoted `role = """..."""`.
|
||||
let start = s.find("role = \"\"\"").expect("role block marker missing");
|
||||
let end_rel = s[start..]
|
||||
.find("\"\"\"\n")
|
||||
|
|
@ -142,14 +142,14 @@ fn validator_rejects_empty_domain_in() {
|
|||
fn validate_only_flag_skips_write() {
|
||||
// --validate must NOT write anything under _generated/.
|
||||
let (_tmp, root) = seed_tempdir();
|
||||
let manifest = root.join("_manifests/researcher.toml");
|
||||
let manifest = root.join("_manifests/kei-researcher.toml");
|
||||
let out = run_assemble(&root, &["--validate", manifest.to_str().unwrap()]);
|
||||
assert!(
|
||||
out.status.success(),
|
||||
"--validate on a valid manifest failed: {}",
|
||||
String::from_utf8_lossy(&out.stderr)
|
||||
);
|
||||
let generated = root.join("_generated/researcher.md");
|
||||
let generated = root.join("_generated/kei-researcher.md");
|
||||
assert!(
|
||||
!generated.exists(),
|
||||
"--validate wrote an output file at {}",
|
||||
|
|
|
|||
Loading…
Reference in a new issue