[ADR-021] Memory recall + rerank pipeline (cluster-18)#373
Merged
ohdearquant merged 2 commits intoMay 25, 2026
Merged
Conversation
Addresses all 18 findings from the cluster-18 triage plan: F107: remember always writes memory_type to properties (default "episodic"). F108: importance/decay_factor are rejected out-of-range instead of clamped; decay_factor has no upper cap per ADR-021 §4. F109: invalid source_id UUID string returns InvalidInput instead of silently ignoring the edge creation. F110: DecayModel::Exponential now uses note's own decay_factor directly (salience * exp(-decay_factor * age_days)) per ADR-021 §5, not a half-life-derived constant. F111: TextSearchRequest now includes SubstrateKind::Note in TextFilter.kinds to scope candidates to the Note substrate at retrieval time. F174/F175/F184/F185: Already addressed by existing config/registry machinery. F186/F223/F230: RecallConfig gains reranker_weights, reranker_params, and fallback_during_migration fields (ADR-033 §1). F188/F189: Add NoteCandidate, DecayAwareImportanceObjective, TemporalRecencyObjective, RerankerObjective to khive-runtime objectives.rs, plus Objective<NoteCandidate> impl for RrfFusionObjective (ADR-033 §4). F222: Add recall.rerank handler and register it in MemoryPack (ADR-033 §2). Tests: 81 new unit + integration tests across pack-memory and runtime. All 499+ workspace tests pass; make ci passes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…eanup) Rustfmt requires alphabetical order in the use statement and prefers multi-line assert!() format; fixes the two fmt violations introduced after rebasing onto integration/v1-adr-alignment. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
54d8b99 to
5cbb9d8
Compare
This was referenced May 25, 2026
6 tasks
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
handle_remembernow always writesmemory_typeto note properties (defaults toepisodicwhen omitted)importanceanddecay_factorvalidated on input —importancemust be in[0, 1],decay_factormust be >= 0source_idUUID validated on input; invalid UUIDs returnRuntimeError::InvalidInputrather than silently being ignoredcollect_recall_candidatesFTS5 query now scopes toSubstrateKind::NoteviaTextFilter.kinds; memory-kind post-filter inload_memory_candidate_notesremains as the second gate per ADR-021 §6 bounded-over-fetch semanticsDecayModel::Exponentialcorrected from half-life-derived constant tosalience * exp(-decay_factor * age_days)using the note's owndecay_factorfieldrecall.reranksubhandler registered inMEMORY_HANDLERS(ADR-033 §2); v1 implementation is a pass-through stub — mainhandle_recalldoes not invoke it yet (see memory: wire recall.rerank into main recall path (ADR-033 §6) #375)DecayAwareImportanceObjective,TemporalRecencyObjective, andRerankerObjectivetokhive-runtime/src/objectives.rs; addedNoteCandidatepre-computed signals struct;RrfFusionObjectivegains a secondimpl Objective<NoteCandidate>trait impl — these are not yet wired into the pack recall path (see memory: replace inline compute_score with ComposePipeline/NoteCandidate from objectives.rs (ADR-033 §4) #378)reranker_weights,reranker_params,fallback_during_migrationfields (declared/defaulted; not yet consumed by handlers — see memory: implement or remove scaffolded RecallConfig fields (reranker_params, fallback_during_migration) #376)Codex round-1 post-rebase: finding closure
7 fully closed / 7 partial / 4 not addressed of 18 source findings.
Merge-base fix
This branch was rebased onto
origin/integration/v1-adr-alignment(SHAc567f4d) after thecodex round-1 review found it would have silently reverted cluster-15 (GTD schema + lifecycle
audit, 304 test lines) and cluster-24 (ADR-015 migration ledger amendment). The rebase preserved
all c18 additions; conflict resolution kept BOTH the new memory-pack objective re-exports AND the
existing NoteKindSpec/PackSchemaPlan/SchemaPlan/validation re-exports from c11/c15.
Test plan
cargo fmt --all -- --checkpassescargo clippy --workspace --all-targets -- -D warningspasses (0 warnings)cargo test --workspacepasses (all suites green)make cipasses including smoke testsFiles changed (c18 commit only)
khive-pack-memory/src/config.rskhive-pack-memory/src/handlers.rshandle_recall_rerank(F222)khive-pack-memory/src/lib.rsrecall.reranksubhandlerkhive-pack-memory/tests/integration.rskhive-runtime/src/objectives.rsNoteCandidate, 3 new Objectives, dualRrfFusionObjectiveimplkhive-runtime/src/lib.rs🤖 Generated with Claude Code