Skip to content

feat(memory): Pillar B — cross-project recall + opt-in proactive injection (0.16.0)#33

Merged
Shahinyanm merged 2 commits into
mainfrom
feat/memory-p2-global-recall
Jun 12, 2026
Merged

feat(memory): Pillar B — cross-project recall + opt-in proactive injection (0.16.0)#33
Shahinyanm merged 2 commits into
mainfrom
feat/memory-p2-global-recall

Conversation

@Shahinyanm

Copy link
Copy Markdown
Member

What

Pillar B of the memory epic (claude-memory-9z9): the journal recalls relevant prior reasoning across your entire history, not just the current repo — the thing single-project memory tools can't do.

  • Global index (data_dir/memory.sqlite): mirrors high-signal events (decisions, rejections, constraints) + embeddings + an FTS5 index from every project. ask/embed keep it current (best-effort). Superseded decisions down-ranked.
  • task-journal recall "<query>": cross-project semantic search of prior decisions/rejections/constraints.
  • Opt-in proactive injection (install-hooks --proactive-recall): a UserPromptSubmit hook that injects a budgeted block of relevant priors before you act — a guardrail against re-deciding or repeating a dead-end. Off by default. Fast keyword path (no model load on the prompt path, so no latency regression); gated by TJ_PROACTIVE_RECALL=0, budgeted by TJ_RECALL_BUDGET_CHARS/TJ_RECALL_K; reuses the recursion guard; silent on miss/error.

Why two retrieval paths

recall (on-demand) uses the model2vec semantic backend. The per-prompt hook uses keyword/FTS5 — loading a model on every prompt would be too slow, and we just removed spam from that exact hook in 0.14.4, so the proactive path is deliberately cheap and opt-in.

Tests

keyword_search match/no-match (core), recall surfacing a decision from a different project (CLI), recall-hook injects + is gated by TJ_PROACTIVE_RECALL=0 (CLI), install-hooks --proactive-recall wires it and the default does not (CLI). fmt/clippy clean on default and --no-default-features.

🤖 Generated with Claude Code

Shahinyanm and others added 2 commits June 12, 2026 19:10
Pillar B foundation (bd claude-memory-9z9): recall reasoning across ALL
projects, not just the current repo.

- tj-core::memory: a global SQLite index (data_dir/memory.sqlite) mirroring
  high-signal events (decisions, rejections, constraints) with their
  embeddings from every project. sync_from_project (idempotent, flags
  superseded decisions), search (cosine top-k, down-ranks contradicted),
  count. paths::memory_db().
- tj-cli: `task-journal recall "<query>"` — cross-project semantic search of
  prior decisions/rejections/constraints. embed/ask now sync the project into
  the global index (best-effort, never fails the command).

Tests: sync+search across a project (core, ranks the right decision +
model-scoped), CLI recall surfacing a decision from a *different* project via
the shared index. Green on default and --no-default-features.

Next (P2.2): opt-in proactive injection on UserPromptSubmit — fast keyword
path, hard token budget, dedup, gated; default stays quiet.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…(P2.2, 0.16.0)

Completes Pillar B (bd claude-memory-9z9).

- tj-core::memory: FTS5 mirror on the global index + keyword_search — a fast,
  embedding-free lookup cheap enough to run on every prompt.
- tj-cli `recall-hook`: opt-in UserPromptSubmit injector. Reads the prompt,
  keyword-searches the global index for relevant prior decisions/rejections/
  constraints across all projects, and emits a budgeted additionalContext
  block — a guardrail before the agent re-decides or repeats a dead-end.
  Never blocks the prompt (silent on miss/error). Gated by
  TJ_PROACTIVE_RECALL=0; budget via TJ_RECALL_BUDGET_CHARS / TJ_RECALL_K;
  reuses the classifier recursion guard.
- install-hooks --proactive-recall wires it into UserPromptSubmit alongside
  the nudge; OFF by default (no behaviour change unless opted in). is_tj
  uninstall filter updated so re-install stays idempotent.

Tests: keyword_search match/no-match (core), recall-hook injects + is gated
(CLI), install-hooks --proactive-recall wires it and default does not (CLI).
Green on default and --no-default-features.

Version 0.16.0; inter-crate version reqs bumped to resolve the release.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Shahinyanm Shahinyanm merged commit 618f799 into main Jun 12, 2026
7 checks passed
@Shahinyanm Shahinyanm deleted the feat/memory-p2-global-recall branch June 12, 2026 15:25
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