Skip to content

feat(core): count recall/search hits in recall_count, apart from explicit gets (#1337) - #1397

Merged
ajianaz merged 1 commit into
developfrom
feat/recall-count-1337
Oct 9, 2026
Merged

ajianaz merged 1 commit into
developfrom
feat/recall-count-1337

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

What

  • Schema v21: memories.recall_count INTEGER NOT NULL DEFAULT 0 (in-place ALTER TABLE migration, existing rows start at 0).
  • recall, recall_context and search now bump recall_count; only get bumps access_count (touch_recall_batch vs touch_access/touch_access_batch).
  • Salience, aging (recompute_importance) and orphan scoring use access_signal() = access_count + 0.5 * recall_count (RECALL_ACCESS_WEIGHT).
  • Memory gets a recall_count field (#[serde(default)], so old exports still import); row_to_memory reads it as column 22 via the shared column macros.

Why

Closes #1337 together with the contract issue codecoradev/uteke-cloud#135. Automated recalls (session hooks, agents repeating a query) reinforced the same memories through access_count, a rich-get-richer effect that can also push a wrong memory up. An explicit get is stronger evidence of use than a hit in a result list. Historical access_count cannot be split retroactively and is left as it is.

Testing

  • fmt, clippy -D warnings, cargo test --workspace, vecq-only core lib tests green (661)
  • New tests: counters are separate and access_signal weights correctly; a v20 store upgrades in place keeping its data; recall_count survives every row reader
  • Benchmark gate passed: LongMemEval fast50 on Modal, develop c4fceaa vs this branch 62ffe13 (same image recipe, default strategy, 10 shards). Aggregates identical: overall mean R@5 0.9800 vs 0.9800 (+0.0000), 0 questions improved, 0 regressed (compare_fast50.py); on the 43 scored questions recall_all@5 0.9767 and recall_all@10 1.0000 in both runs. The script's own "GATE (+3pp)" line is a leftover from the rerank experiment and does not apply here. fast50 does not exercise long-lived access counters, so this shows no retrieval regression, not an improvement.
  • Not tested: operation-level recall in CI (no ONNX runtime); the counter split is covered at store level and the call-site swap is a four-line rename

Behaviour notes: access_count values returned by get/list change over time (they now only grow on get); no response field for recall_count is added.

🤖 Generated with Claude Code

…icit gets (#1337)

Schema v21 adds memories.recall_count. recall, recall_context and search now
bump recall_count; only get bumps access_count. Salience, aging and orphan
scores use access_count + 0.5 * recall_count, so automated recalls reinforce a
memory less than real use. Existing rows start at recall_count 0; historical
access_count is left untouched.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz marked this pull request as ready for review October 9, 2026 03:39
@ajianaz
ajianaz merged commit 22314a2 into develop Oct 9, 2026
19 checks passed
@ajianaz
ajianaz deleted the feat/recall-count-1337 branch October 9, 2026 03:42
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.

feat(recall): option to recall without bumping access_count (read-only recall)

1 participant