Repository navigation
Add glob/auto/manual inclusion modes for memory entries - #1628
Conversation
Solenta-Message-Id: c20932fb-822f-45a9-989d-e7f6fba28d17
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: de3e96669b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (seen) { | ||
| seen.clear(); | ||
| formatMatchedNote(boot, seen); |
There was a problem hiding this comment.
Preserve unsent matches for later turns
When an initial bootstrap returns more than 12 conditional rows in one section, formatBootstrapNote injects only the first 12, but this call runs formatMatchedNote over every returned row and marks all of their IDs as seen. Any rows beyond the display cap are therefore suppressed from subsequent matchedOnly turns even though the thread never received them; only mark IDs that were actually included in the initial note.
Useful? React with 👍 / 👎.
| function autoTokens(text) { | ||
| return new Set([...contentTokens(text)].filter((t) => !AUTO_STOPWORDS.has(t))) |
There was a problem hiding this comment.
Count short keywords when matching auto entries
For auto-mode titles containing meaningful one- or two-character terms, reusing contentTokens silently discards those terms because that helper only keeps tokens of length three or more. For example, Go build should match a prompt containing Go compiler under the documented half-of-title-words rule, while the current code reduces the title to only build and misses it; tokenize auto-mode text without dropping short non-stopwords.
Useful? React with 👍 / 👎.
| ORDER BY importance DESC, created_at DESC | ||
| LIMIT 50`, | ||
| ) | ||
| .all(project, project) | ||
|
|
||
| const tasksRaw = this.db | ||
| .prepare( | ||
| `SELECT id, title, body, status, agent, source, project, created_at, updated_at, citations FROM entries | ||
| WHERE type = 'task' AND ${liveSql()} | ||
| AND COALESCE(status, 'active') = 'active' | ||
| AND (? IS NULL OR project = ?) | ||
| ORDER BY updated_at DESC, created_at DESC | ||
| LIMIT 50`, | ||
| LIMIT ${CONDITIONAL_SCAN_CAP}`, |
There was a problem hiding this comment.
Match conditional entries before applying the scan cap
Once a project has more than 500 live conditional entries, this limit is applied before any glob, auto, or manual predicate. An older or lower-importance entry beyond the first 500 can never be returned even when the prompt explicitly names its manual ID or its glob exactly matches, and deferred also omits all rows beyond the cap. The matching query needs to consider all eligible entries or provide a lookup path that cannot hide an explicit match.
Useful? React with 👍 / 👎.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
What changed
Memory entries can now set an inclusion mode that controls when bootstrap injects them (#271). Before this, every live entry rode every bootstrap.
always(default, stored asNULL)glob(needsglobs)files, or a path-like token in itsprompt, matches. A glob with no slash also matches basenamesautomanual#<first 8 chars of id>Conditional entries can still be found with search.
memory-server
inclusionandglobscolumns toentriesviaaddColumnIfMissing.memory_store/memory_supersedeacceptinclusionandglobs, checked bycleanInclusion.globneeds at least one glob, and globs are rejected on any other mode.globdrops the old globs.memory_getreturnsinclusionandglobs.bootstrap()takesprompt,filesandmatchedOnly.deferred, the count of conditional entries that didn't match.matchedOnly: truereturns only the matched entries and skips the wiki.section()helper.memory_bootstrapschema and description cover the new inputs.GET /api/bootstrapacceptsprompt,file(repeatable) andmatchedOnly=1.electron
memory-proxy.bootstrap: builds its query withURLSearchParamsand forwardsprompt(capped at 2000 chars),fileandmatchedOnly. They go in the query string so an older server simply ignores them.prefetchBootstrapNote:matchedOnlyand inject only matched entries the thread hasn't seen yet, via the newformatMatchedNote.inclusionfield are skipped, so an older server that returns the full pack injects nothing on follow-up turns.runner.jskeeps a per-threadSetof entry ids already injected. It lives in memory only, so after a restart each matched entry is sent once more.runner-ask-runs.jspasses the ask prompt or card question.formatBootstrapNoteadds a line whendeferred > 0, pointing atmemory_bootstrapwithmatchedOnly.Why
Entries that only matter for one area of the code or one topic used up bootstrap budget on every run. With these modes they load only when the current files or prompt make them relevant, and agents can still ask for them on demand.
Tests
memory-server/test/inclusion.test.jscovers validation, glob/auto/manual matching,deferredandmatchedOnly.electron/test/ask.test.jscovers matched-note formatting and the follow-up-turn path.memory-proxy.test.jsandstop-during-prepare.test.js.🤖 Generated with Claude Code