-
Notifications
You must be signed in to change notification settings - Fork 3k
fix(memory): recall relevant topics beyond scan cap #8803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
yiliang114
merged 6 commits into
codex/7040-memory-recall
from
codex/7040-memory-recall-candidates
Aug 11, 2026
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
62ab4a9
fix(memory): bound recall candidates after full scan
yiliang114 f6ba0aa
test(memory): pin bounded selector inputs
yiliang114 59c7711
fix(memory): preserve bounded recall candidates
yiliang114 5a737de
fix(memory): preserve lexical recall candidates
yiliang114 58cb3b4
fix(memory): prioritize lexical model candidates
yiliang114 35a9d2d
fix(core): preserve UTF-16 manifest boundaries
yiliang114 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
docs/design/2026-08-09-bounded-memory-recall-candidates.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # Bounded Memory Recall Candidates | ||
|
|
||
| ## Problem | ||
|
|
||
| The project and user memory scanners enumerate, read, and parse every topic, | ||
| then return only the 200 most recent documents. Recall uses those shared scanner | ||
| APIs, so an older relevant document outside either 200-document window cannot | ||
| reach the heuristic or model selector even though the expensive scan work has | ||
| already happened. | ||
|
|
||
| The same capped APIs are also used by Forget, Indexer, Status, and Extraction. | ||
| Removing their limit globally would widen unrelated behavior. | ||
|
|
||
| ## Decision | ||
|
|
||
| Keep the existing scanner APIs and their 200-document limit unchanged. Add | ||
| explicit all-topic variants used only by recall. | ||
|
|
||
| Recall ranks the combined project and user pool before model selection: | ||
|
|
||
| - retain up to 180 documents with a lexical match using the existing scorer; | ||
| - fill the remaining candidate slots by recency, preserving at least 20 recent | ||
| opportunities when enough lexical matches exist; | ||
| - send at most 200 candidates to the model selector; | ||
| - append manifest entries only while their cumulative UTF-8 size remains at or | ||
| below 25,000 bytes; | ||
| - validate selector output only against documents actually present in that | ||
| bounded manifest. | ||
|
|
||
| The heuristic fallback continues to score the complete recall pool and still | ||
| returns at most five documents. Existing body and prompt limits remain | ||
| unchanged. | ||
|
|
||
| ## Failure and compatibility boundaries | ||
|
|
||
| Project scanning remains required. User scanning remains best-effort. Invalid | ||
| or unreadable files keep the existing skip behavior. Empty candidate manifests | ||
| return no model selection rather than sending an unbounded request. | ||
|
|
||
| There is no public setting, persistent index, new dependency, provider API, or | ||
| Fast/Refined state machine. Recall still performs an O(n) local pass over the | ||
| already parsed documents; a persistent catalog requires separate measurement | ||
| and evidence. | ||
|
|
||
| ## Verification | ||
|
|
||
| - A deliberately old relevant topic beyond the regular 200-document result is | ||
| recalled from a real temporary memory tree. | ||
| - The regular scanner still returns 200 documents and omits that topic. | ||
| - The model candidate set contains the lexical target and recent reserve while | ||
| remaining at 200 documents. | ||
| - A manifest built from large multibyte descriptions stays within 25,000 UTF-8 | ||
| bytes. | ||
| - The deterministic CLI E2E selects the overflow topic and exposes its unique | ||
| marker at the ToolResult delivery point after the bounded initial wait | ||
| expires. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.