Skip to content

feat(recall): decision-store curation — importance filter + supersession - #18

Open
jessekemp1 wants to merge 2 commits into
mainfrom
feat/decision-store-curation
Open

feat(recall): decision-store curation — importance filter + supersession#18
jessekemp1 wants to merge 2 commits into
mainfrom
feat/decision-store-curation

Conversation

@jessekemp1

Copy link
Copy Markdown
Owner

What

Curation for the decision store so recall favors signal over accumulation. Research (STORM-Opus + /deep-research, cortex dec_824f8f0f2bd4) independently concluded that a decision store which only grows recalls worse — curation, not capacity, separates useful memory from noise. Cortex was appending every decision unconditionally and indexing every line; this addresses the recall-precision limitation called out in the v1.2.0-beta.1 release notes.

Changes

Write path (mcp_handlers.record_learning_decision)

  • Score each decision 1–10 via a pure heuristic (intelligence/memory/importance.py, no model call); annotate importance + low_signal. Never drops — spool path and never-lose-a-decision guarantee intact.
  • Optional supersedes=<dec_id>: append-only tombstone stamps superseded_by on the old id; original line never mutated (RDF-triple pattern). Threaded through the MCP tool + POST /decisions/learning.

Read path (hybrid_retriever)

  • Drop superseded decisions/tombstones from recall.
  • Multiply RRF score by importance × recency-decay (exp(-age/HALF_LIFE), default 120d), applied beside the existing outcome boosts. Un-scored legacy entries get a neutral default, so history is unaffected until backfilled.
  • Promote top retrieved decisions into similar_work when the knowledge graph has no lessons/patterns for the project (_fill_similar_work_from_related) — fixes similar_work reporting empty despite relevant prior work existing.

Backfillscripts/memory_maintenance.py --backfill-importance (idempotent, .bak + atomic rewrite, skips tombstones/scored).

Tests

New: importance (7), supersession (3), retriever curation (3), write annotation (3), similar_work promotion. Full suite 1716 pass; the 3 failures are the pre-existing test_doctor_json_reset trio (unrelated, fail on clean main).

Verified live

Backfilled the live store (291 scored, 24 low_signal). cortex_intelligence(project="clio") now returns ranked real decisions with a populated similar_work — previously empty / confidence 0.0. Superseded decisions drop from recall; high-signal outranks low-signal ~1.9×.

This pull request and its description were written by Isaac.

Research (dec_824f8f0f2bd4) found a decision store that only grows recalls
worse; curation, not capacity, separates useful memory from noise. Cortex was
appending every decision unconditionally and indexing every line.

Write path (mcp_handlers.record_learning_decision):
- score each decision 1-10 (intelligence/memory/importance.py, pure heuristic,
  no model call); annotate importance + low_signal — never drop, spool path
  and never-lose-a-decision guarantee intact.
- optional supersedes=<dec_id>: append-only tombstone stamps superseded_by on
  the old id; original line never mutated. Threaded through cortex_record_decision
  (MCP) + POST /decisions/learning.

Read path (hybrid_retriever):
- drop superseded decisions and tombstones from recall.
- multiply RRF score by importance x recency-decay (exp(-age/HALF_LIFE), default
  120d), applied beside the existing outcome boosts. Un-scored legacy entries get
  a neutral default, so history is unaffected until backfilled.

Backfill: memory_maintenance.py --backfill-importance (idempotent, .bak + atomic
rewrite, skips tombstones/scored).

Tests: importance (7), supersession (3), retriever curation (3), write annotation
(3). Full suite 1716 pass; the 3 failures are the pre-existing test_doctor_json_reset
trio (unrelated). End-to-end: superseded dropped, high-signal outranks noise ~1.9x.
…empty

Fill similar_work from hybrid-retrieved related_patterns when the knowledge
graph has no similar_work entries — decisions live in the retriever, not the graph.
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