Repository navigation
Open
Description
Memory has no structured way to say which repository a memory applies to. Repo-specific facts such as commands, CI setup, file paths, and conventions can be recalled into work on a different repository, and recall has no repository signal to bias or reject them.
Current behavior
- A memory row stores visibility (
scope),subject_type(user/conversation/general), optionallocation_idandconversation_id, andcontent(packages/junior-memory/src/db/schema.ts). None of these identify a repository. Location only records where Junior learned a memory and does not grant access (packages/junior-memory/README.md). - Recall fuses vector and full-text ranks, then the relevance model sees only memory
id+contentand the request text (recall.ts,selectRelevantMemoriesinagent.ts). Its prompt already says to prefer matches on "the exact repository" (agent.ts), but it gets no structured repository for the memory or for the current turn. UserPromptContext(junior-plugin-api/src/prompt.ts) andPluginRunContext(junior-plugin-api/src/tasks.ts) expose no Conversation annotations or Location configuration. The memory plugin cannot see repository signals that core already holds: GitHub object annotations keyedowner/repo#number(junior-github/src/annotations.ts), the Locationgithub.repodefault, or the active Workspace.- feat(memory): add recall-layer relevance gate to filter low-relevance vector matches #679 recorded the production symptom: a query about CI in
getsentry/juniorrecalledgetsentry/sentryautofix memories, because repository vocabulary embeds similarly.
Gap
- Repo-specific memories cannot be biased toward their repository or kept out of work on other repositories.
- Many memories are not repo-specific: user preferences, company facts, and cross-repo procedures. A repository on every memory would be wrong for these.
Proposed direction (David Cramer)
- Add optional annotations to memories, starting with the repository a memory applies to.
- In recall, bias repo-specific memories toward their repository, and possibly disqualify them from work on other repositories.
- Memory annotations are likely not the same thing as Conversation annotations. One conversation can touch several repositories, while a memory from it applies to one or none.
- Annotation can be expensive and is not always useful, so cost must stay low.
Open questions
- Naming:
TERMINOLOGY.mddefines Annotation as attached to one Conversation. Reuse the term, or use a new one? - Source at capture time: the existing extraction / review model call, deterministic conversation signals, or both. Existing memories: backfill or leave untagged.
- Current repository at recall time: which signals are strong enough to disqualify a memory, and which only bias ranking (for example, a Location default versus a repository named in the request).
- Provider boundary: the memory plugin should not parse GitHub keys (
policies/provider-boundaries.md).
Related: #679, #1861 (moving Memory into core changes where this lives), #1784.
via David Cramer.
--
Metadata
Metadata
Assignees
Labels
No labels
Activity
sentry-junior commentedon Nov 20, 2026
Adding a related angle from #2483, a draft prototype I'm closing in favor of this issue.
Commit and file provenance for code memories. Besides the repository, a memory that came from reading code could record the commit and the files its evidence came from, at capture time. That would let a periodic check flag a memory as stale when its file changes or disappears. Lore does something like this with its reference check, lowering confidence instead of deleting.
Lessons from #2483:
owner/repoplus a path relative to the repo, not on the sandbox checkout path (repos/<name>/…). Two repos with the same name collide otherwise.bash,grepandfindFilesreads need coverage too. Agents read a lot of code throughbash.createMemorywould get no links unless they're handled separately.Gate: build the commit and file part only once data shows it matters, meaning a meaningful share of active memories cite file-read evidence, and those memories get retired as contradicted (the retirement signals from #3770). The contradiction check from #3758 already covers stale memories when a Turn's evidence shows the conflict.
After #3774, Memory lives in core, so this would be a core migration under
packages/junior/migrations/.