Skip to content

fix(memory): make evidence and corrections durable across replay - #22

Draft
jessekemp1 wants to merge 2 commits into
fix/truthful-dispatch-outcomesfrom
fix/durable-evidence-memory
Draft

fix(memory): make evidence and corrections durable across replay#22
jessekemp1 wants to merge 2 commits into
fix/truthful-dispatch-outcomesfrom
fix/durable-evidence-memory

Conversation

@jessekemp1

@jessekemp1 jessekemp1 commented Sep 7, 2026

Copy link
Copy Markdown
Owner

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:

  • Full credential-free, guarded suite: 2,165 passed, 38 skipped, 2 xfailed (15 deselected).
  • 14 integrity tests cover attribution, late/stale replay, concurrent writes, conflicts, interrupted commits, spool failure and fresh-process correction/recall.
  • Offline wheel built and installed; imports, recording, correction and real BM25 recall passed outside the checkout.
  • Ruff and diff checks passed. Published tree matches the tested local tree.

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:

  • Corrected advice is excluded from live recall and every graph query/traversal entrypoint, including after restarting from a stale or partially saved graph.
  • Failed decision synchronization and edge persistence now fail maintenance.
  • Installed-wheel testing found scripts-only maintenance missing from the wheel. The implementation now ships under intelligence.memory.maintenance; the old script remains compatible.
  • The installed --graph-only command and correction/recall/restart proof are now a blocking wheel CI step.
  • Nine new correction acceptance tests passed, alongside the prior fourteen integrity tests. A separate installed-wheel multi-process proof passed outside the checkout.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant