Expand description
Per-entry relevance metadata and CADMAS-CTX bucket projection.
§Phase B foundation
The Liu et al. paper (arXiv:2512.22087) calls for a per-entry
sidecar of relevance signals that an incremental derivation policy
can score against the current task. The CADMAS-CTX paper
(arXiv:2604.17950) independently needs a coarse context bucket
z = (difficulty, dependency, tool_use) to key its per-(agent,
skill, bucket) posteriors.
Both consumers share ~80 % of the extraction work — file paths,
tool names, error-class markers — so this module emits a single
RelevanceMeta that projects down to a Bucket via
RelevanceMeta::project_bucket. Phase B’s DerivePolicy::Incremental
and Phase C’s DelegationState both read from the same sidecar.
§Scope in Phase B step 15
Extraction is pure and syntactic — no LLM calls, no IO. Heuristics:
files: regex over text parts for path-like tokens.tools: names ofToolCall/ToolResultcontent parts.error_classes: leading tokens of common error markers (Error:,error[E,failed,panicked,traceback).explicit_refs: left for future turns-N-reference extraction (empty in this first cut).
Keeping it syntactic means the extractor can run in the append hot
path (Session::add_message) without blocking.
§Examples
use codetether_agent::provider::{ContentPart, Message, Role};
use codetether_agent::session::relevance::{Bucket, Dependency, Difficulty, RelevanceMeta, ToolUse, extract};
let msg = Message {
role: Role::Assistant,
content: vec![ContentPart::Text {
text: "Edited src/lib.rs and tests/smoke.rs".to_string(),
}],
};
let meta: RelevanceMeta = extract(&msg);
assert_eq!(meta.files.len(), 2);
let bucket: Bucket = meta.project_bucket();
assert_eq!(bucket.tool_use, ToolUse::No);
assert_eq!(bucket.dependency, Dependency::Chained);
assert_eq!(bucket.difficulty, Difficulty::Easy);Structs§
- Bucket
- Coarse context bucket — CADMAS-CTX Section 3.1.
- Relevance
Meta - Per-entry syntactic relevance signals.
Enums§
- Dependency
- CADMAS-CTX dependency axis.
- Difficulty
- CADMAS-CTX difficulty axis.
- ToolUse
- CADMAS-CTX tool-use axis.
Functions§
- bucket_
for_ messages - Project a coarse CADMAS-CTX bucket from a recent message window.
- extract
- Extract
RelevanceMetafor a single chat-history entry.