Expand description
CADMAS-CTX delegation posteriors (arXiv:2604.17950).
§Role
Static per-agent skill scores are provably lossy when capability is
context-conditional (linear regret Ω(ε · P(z₀) · T)). CADMAS-CTX
replaces them with a hierarchy of per-(agent, skill, bucket) Beta
posteriors scored under a risk-aware LCB, achieving O(log T)
regret. This module is the Phase C scaffolding for that replacement
on codetether’s internal routing surfaces (choose_router_target,
swarm / ralph dispatch, RLM model selection, autochat persona pick).
§Scope in Phase C step 16
Types + math + sidecar-compatible serialisation, with no live
consumers yet. The go/no-go experiment in
choose_router_target lands in a
follow-up commit (Phase C step 17) once these primitives are stable.
§Invariants
- State lives only in the sidecar — never in
DerivedContext. Capability history is not chat context either. - Updates are Beta-Bernoulli conjugate; no ML-style training.
- Cold-start shrinkage is bounded by
m_z ≤ 2per the paper.
§Examples
use codetether_agent::session::delegation::{
BetaPosterior, DelegationConfig, DelegationState,
};
use codetether_agent::session::relevance::{Bucket, Dependency, Difficulty, ToolUse};
let bucket = Bucket {
difficulty: Difficulty::Easy,
dependency: Dependency::Isolated,
tool_use: ToolUse::No,
};
let mut state = DelegationState::with_config(DelegationConfig::default());
state.update("openai", "model_call", bucket, true);
state.update("openai", "model_call", bucket, true);
state.update("openai", "model_call", bucket, false);
let score = state.score("openai", "model_call", bucket);
assert!(score.is_some());Structs§
- Beta
Posterior - Per-(agent, skill, bucket) Beta-Bernoulli posterior.
- Delegation
Config - Tunable knobs for
DelegationState. - Delegation
State - Per-session CADMAS-CTX sidecar.
Constants§
- DEFAULT_
DELTA - Default delegation margin
δ. - DEFAULT_
GAMMA - Default uncertainty penalty
γfor LCB scoring. - DEFAULT_
KAPPA - Default weak-prior strength
κused to seed posteriors from self-declared confidence. - DEFAULT_
LAMBDA - Default forgetting factor
λapplied on each update.
Type Aliases§
- Belief
Key - Key for
DelegationState::beliefs. Stored as owned strings so the map serialises cleanly and survives across process boundaries.