feat(memory): structured compaction probe categories (#2164)#2181
Merged
feat(memory): structured compaction probe categories (#2164)#2181
Conversation
Add four functional probe dimensions (Recall, Artifact, Continuation, Decision) to the compaction probe pipeline: - ProbeCategory enum with serde lowercase serialization - CategoryScore struct with per-category average and question count - ProbeQuestion gains a `category` field (serde default = Recall for backward compat with old persisted JSON) - CompactionProbeResult gains `category_scores` field (#[serde(default)] for backward compat) - CompactionProbeConfig: add `probe_provider` (replaces dead `model` field) and `category_weights: Option<HashMap<ProbeCategory, f32>>` - compute_category_scores(): weighted average with fallback to equal weighting when all weights are 0; tracing::warn on negative weights - run_probe(): warns per-missing-category when max_questions >= 4; empty-summary guard (< 10 chars) skips probe - Provider wiring: build_probe_provider() at startup (same pattern as build_judge_provider); probe_or_summary_provider() fallback chain - TUI: per-category Rec/Art/Con/Dec scores with threshold-based color coding using compaction_probe_threshold from MetricsSnapshot (IC-01) - MetricsSnapshot: last_probe_category_scores, compaction_probe_threshold, compaction_probe_hard_fail_threshold fields - Debug dump: category_scores array and category per question - Init wizard: probe_provider prompt replaces probe_model - All 6031 tests pass; new snapshot test for category score display
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Recall,Artifact,Continuation,Decision) to the compaction probe pipeline with per-category scoring breakdownprobe_providerconfig field in[memory.compression.probe]resolves from[[llm.providers]]at startup (followsbuild_judge_providerpattern); old deadmodelfield removedRec/Art/Con/Dec) with threshold-based color coding usingcompaction_probe_thresholdfromMetricsSnapshotChanges
crates/zeph-memory/src/compaction_probe.rsProbeCategoryenum with#[serde(rename_all = "lowercase")]CategoryScorestruct (category, score, probes_run)ProbeQuestion.categoryfield with#[serde(default = "default_probe_category")](backward compat: defaults toRecall)CompactionProbeResult.category_scoreswith#[serde(default)](backward compat with old JSON)CompactionProbeConfig:probe_provider: String,category_weights: Option<HashMap<ProbeCategory, f32>>;modelfield removed (was dead code, never read at call site)compute_category_scores(): weighted average with zero-weight fallback;tracing::warnon negative weightsrun_probe(): empty summary guard (< 10 chars), missing-category warn whenmax_questions >= 4, category-aware LLM promptcrates/zeph-core/src/metrics.rslast_probe_category_scores: Option<Vec<CategoryScore>>compaction_probe_threshold: f32,compaction_probe_hard_fail_threshold: f32crates/zeph-core/src/agent/context/summarization.rslast_probe_category_scores,compaction_probe_threshold,compaction_probe_hard_fail_thresholdin all verdict branchescrates/zeph-tui/src/widgets/memory.rsrender_probe_last_line(): appendsRec:X.XX Art:X.XX Con:X.XX Dec:X.XXwith threshold-based color; absent categories show--probe_lines_with_category_scorescrates/zeph-core/src/debug_dump/mod.rsdump_compaction_probe()includescategory_scoresarray andcategoryper questioncrates/zeph-core/src/bootstrap/mod.rsbuild_probe_provider(): resolvesprobe_providername at startup, returnsOption<AnyProvider>crates/zeph-core/src/agent/{builder,state/mod,mod}.rsProviderState.probe_provider: Option<AnyProvider>,with_probe_provider()builder,probe_or_summary_provider()fallbacksrc/{runner,daemon,acp}.rsbuild_probe_provider()in all three entry pointssrc/init.rsprobe_modelwithprobe_providerin wizard state and promptsTest plan
cargo +nightly fmt --check— cleancargo clippy -p zeph-memory -p zeph-core -p zeph-tui -- -D warnings— cleancargo nextest run --workspace --lib --bins— 6050 passed, 15 skippedProbeCategoryserde,category_weightsTOML round-trip,compute_category_scores(equal weights, custom weights, zero-weight fallback, missing category, multi-probe average), backward compat deserialization (old JSON withoutcategory_scores/categoryfields)probe_lines_with_category_scoresCloses #2164