Single-commit clean baseline after security scrub of niche-tells, project codenames, internal jargon, and contributor-email leaks. Contents: - 100 Rust crates (_primitives/_rust/) - 37 agent manifests (_manifests/) + generated specs (_generated/) - 67 user-invocable skills (skills/) - 33 hooks (hooks/) - Composition blocks (_blocks/) - Documentation (docs/, README.md) - TS adapter packages (_ts_packages/) - Assembler (_assembler/) - Roles (_roles/) - Templates (_templates/) - Forgejo CI (.forgejo/) Author: Denis Parfionovich <info@greendragon.info> License: see LICENSE.
40 lines
1.6 KiB
Rust
40 lines
1.6 KiB
Rust
//! kei-model-router — model selection for Claude Code Agent spawns.
|
||
//!
|
||
//! Concern: given an incoming Agent invocation (subagent_type, prompt,
|
||
//! task-class DNA), pick the cheapest model in {Haiku 4.5, Sonnet 4.6,
|
||
//! Opus 4.7} that meets the empirical quality bar for similar past
|
||
//! invocations. Reads from `kei-ledger` posterior, writes back outcomes.
|
||
//!
|
||
//! Constructor Pattern: each cube under 200 LOC, each function under 30.
|
||
//! Cubes assembled here:
|
||
//!
|
||
//! - `pricing` — verified per-MTok constants (RULE 0.4, 2026-04-30)
|
||
//! - `dna_class` — task-class DNA extraction (strip nonce/body suffixes)
|
||
//! - `complexity` — τ-estimator (regex+length+role heuristics)
|
||
//! - `posterior` — Beta posterior from ledger rows per (task-class, model)
|
||
//! - `kernel` — substrate similarity for unseen task classes
|
||
//! - `select` — decision rule: argmin cost s.t. P[q ≥ q*] ≥ 1−δ
|
||
//! - `escalate` — retry-ladder bookkeeping
|
||
//!
|
||
//! Distinct from `kei-router` (which handles NL→tool dispatch and
|
||
//! generic LLM provider abstraction). This crate's only job is selecting
|
||
//! WHICH Claude tier to spawn an Agent on.
|
||
|
||
pub mod calibrate;
|
||
pub mod complexity;
|
||
pub mod dna_class;
|
||
pub mod escalate;
|
||
pub mod kernel;
|
||
pub mod posterior;
|
||
pub mod pricing;
|
||
pub mod select;
|
||
|
||
pub use complexity::{ComplexityEstimate, Tier};
|
||
pub use escalate::{next_after_failure, EscalationDecision, MAX_ESCALATION_DEPTH};
|
||
pub use kernel::{similarity, KernelWeights};
|
||
pub use posterior::Posterior;
|
||
pub use pricing::{
|
||
cost_micro_cents, Model, ModelPricing, HAIKU_45, OPUS_47, OPUS_47_TOKENIZER_OVERHEAD,
|
||
SONNET_46,
|
||
};
|
||
pub use select::{select, Decision, DecisionInput};
|