fix(memory-core): match daily notes stored in memory/ subdirectories#64682
Conversation
Greptile SummaryFixes a silent data loss bug where daily memory notes stored under Confidence Score: 5/5Safe to merge — one-line targeted regex fix with no regressions, all edge cases tested. The change is minimal and correct: the No files require special attention. Reviews (1): Last reviewed commit: "fix(memory-core): match daily notes in m..." | Re-trigger Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7c7c8a4914
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
CI Failures AnalysisAll failing checks are pre-existing on main branch and unrelated to this PR's changes. PR changes: Only Failing tests (also failing on main run 24277344296):
Verification: Latest main CI runs (24277344296, 24277286260) show identical failures. Recommendation: Merge this PR. Failures are main branch issues requiring separate fixes. |
7c7c8a4 to
7515ed8
Compare
67cb36f to
c86a527
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c86a5279dc
ℹ️ 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".
| import { asRecord } from "./dreaming-shared.js"; | ||
|
|
||
| const SHORT_TERM_PATH_RE = /(?:^|\/)memory\/(\d{4})-(\d{2})-(\d{2})\.md$/; | ||
| const SHORT_TERM_PATH_RE = /(?:^|\/)memory\/(?:[\w.-]+\/)*(\d{4})-(\d{2})-(\d{2})\.md$/; |
There was a problem hiding this comment.
Accept non-ASCII and spaced subdirectory names
The new SHORT_TERM_PATH_RE only permits subdirectory segments matching [\w.-]+, so valid note paths like memory/daily notes/2026-04-03.md or memory/日记/2026-04-03.md still fail isShortTermMemoryPath() and are filtered out by recordShortTermRecalls(). That keeps short-term recall ingestion broken for users who organize dated notes under folders with spaces or Unicode names, despite the intended memory/**/YYYY-MM-DD.md support.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3baa580a13
ℹ️ 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 (normalized.startsWith("memory/dreaming/")) { | ||
| return false; |
There was a problem hiding this comment.
Block prefixed dreaming paths from short-term recall
The new dream-report exclusion only checks normalized.startsWith("memory/dreaming/"), so it misses paths where memory/dreaming/... appears after a prefix (for example ../../vault/memory/dreaming/deep/2026-04-03.md from extra memory roots resolved relative to the workspace). Fresh evidence in this revision is that the widened SHORT_TERM_PATH_RE now accepts nested subdirectories, so these prefixed dream reports will pass isShortTermMemoryPath() and be ingested into the promotion store, reintroducing self-referential recall data for users with external memory paths.
Useful? React with 👍 / 👎.
70c475e to
44f8099
Compare
…penclaw#64682) * fix(memory-core): match daily notes in memory/ subdirectories in isShortTermMemoryPath * fix(memory-core): exclude dream reports from short-term recall * fix(memory-core): widen short-term recall path matching * docs(changelog): note short-term recall fix --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
…penclaw#64682) * fix(memory-core): match daily notes in memory/ subdirectories in isShortTermMemoryPath * fix(memory-core): exclude dream reports from short-term recall * fix(memory-core): widen short-term recall path matching * docs(changelog): note short-term recall fix --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
…penclaw#64682) * fix(memory-core): match daily notes in memory/ subdirectories in isShortTermMemoryPath * fix(memory-core): exclude dream reports from short-term recall * fix(memory-core): widen short-term recall path matching * docs(changelog): note short-term recall fix --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
…penclaw#64682) * fix(memory-core): match daily notes in memory/ subdirectories in isShortTermMemoryPath * fix(memory-core): exclude dream reports from short-term recall * fix(memory-core): widen short-term recall path matching * docs(changelog): note short-term recall fix --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
…penclaw#64682) * fix(memory-core): match daily notes in memory/ subdirectories in isShortTermMemoryPath * fix(memory-core): exclude dream reports from short-term recall * fix(memory-core): widen short-term recall path matching * docs(changelog): note short-term recall fix --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
…penclaw#64682) * fix(memory-core): match daily notes in memory/ subdirectories in isShortTermMemoryPath * fix(memory-core): exclude dream reports from short-term recall * fix(memory-core): widen short-term recall path matching * docs(changelog): note short-term recall fix --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
What does this PR do?
Fixes a silent data loss bug where daily memory notes stored in
memory/subdirectories (e.g.,memory/daily/2026-04-09.md) were never recorded into the recall store, causing the dreaming system to process zero entries and produce no promotions.Fixes #64642
Root Cause
isShortTermMemoryPath()inshort-term-promotionuses three regex patterns to validate memory paths:SHORT_TERM_PATH_RE:/(?:^|\/)memory\/(\\d{4})-(\\d{2})-(\\d{2})\\.md$/- expectsmemory/YYYY-MM-DD.mdwith no subdirectorySHORT_TERM_SESSION_RE:/memory\/\\.dreams\/session-corpus\/…/- only matches session pathsSHORT_TERM_BASENAME_RE:/^(\\d{4})-(\\d{2})-(\\d{2})\\.md$/- anchored with^but tested against full pathFor
memory/daily/2026-04-09.md:SHORT_TERM_PATH_REfails - no room betweenmemory/and date for subdirectorySHORT_TERM_SESSION_REfails - wrong path shapeSHORT_TERM_BASENAME_REfails -^anchor prevents matching full pathAll three return
false→recordShortTermRecallsfilters out the result → recall store never written → dreaming cron finds 0 entries → no promotions produced.Applied Approach
Selected: Widen
SHORT_TERM_PATH_REto allow optional subdirectoriesInsert
(?:[\\w.-]+\\/)*betweenmemory\\/and the date pattern. This non-capturing group matches zero or more named path segments:Why this approach:
memory/YYYY-MM-DD.mdstill matches (backward compatible)memory/anchor preserved →notes/daily/YYYY-MM-DD.mdstill rejects (no false positives)Alternatives considered:
SHORT_TERM_BASENAME_REagainstpath.basename()- stripsmemory/scope guard, causes false positives likenotes/2026-04-09.md, breaks existing testsmemory/guard - two changes for what Option A solves in one line, over-engineeringSolution Details
extensions/memory-core/src/short-term-promotion/short-term-promotion.ts:19- UpdatedSHORT_TERM_PATH_REregex to allow optional subdirectoriesWhat Bottleneck Does This Solve?
memory/daily/,memory/notes/) without breaking the promotion pipelineCorrected Result
memory/daily/YYYY-MM-DD.mdare now recognized as short-term memoryisShortTermMemoryPath()returnstruefor subdirectory pathsrecordShortTermRecallswrites entries to recall storememory/YYYY-MM-DD.mdstructureWorkflow
Before (bug reproduction):
After (validation):
Test results:
Why This Is Safe
memory/YYYY-MM-DD.mdstill matches (zero subdirectories allowed)memory/anchor prevents matchingnotes/daily/YYYY-MM-DD.mdisShortTermMemoryPath()validation, no database migrations or API changesRelated