fix(memory): make evidence and corrections durable across replay - #22
Draft
jessekemp1 wants to merge 2 commits into
Draft
fix(memory): make evidence and corrections durable across replay#22jessekemp1 wants to merge 2 commits into
jessekemp1 wants to merge 2 commits into
Conversation
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.
Cortex could credit another session's activity to a prompt, ignore late evidence after the first write, and continue recalling advice after a partial correction. Passing synthetic linkage tests did not establish reliable learning.
This PR scopes evidence by session/project, uses stable prompt identities, supports late explicit references, and merges evidence under a lock with atomic snapshot replacement. Replays preserve newer evidence; conflicting IDs fail. Scores remain advisory and every row stays unverified and ineligible for learning.
Decision writes commit replacements and compatibility tombstones together. Spool replay and importance backfill share the writer lock. Both decision indexing and hybrid recall honor configured state and supersession, including historical partial corrections. Cached decision patterns cannot override the current journal.
Validation:
Stacked on #21; review/land that dependency first. Nothing deployed or migrated.
Limits: POSIX local cooperating writers, O(file size) snapshots; old writers must be drained before cutover. Live retrievers refresh decisions and invalidate stale vectors; graph query/traversal reconciles against the journal. Raw graph storage remains audit history. Legacy position-based links need reviewed migration, and producer references do not prove causality. See docs/design/durable-evidence-memory.md.
Reassessment and completed acceptance path:
Prioritize one installed artifact, one state owner and one real accepted task before expanding general-purpose autonomy. Graph files remain legacy separate snapshots; journal-based reconciliation protects this correction contract, not every graph concurrency case. Nothing merged, deployed or migrated.