Repository navigation
Conversation
Add opt-in memory.search.excludePaths: workspace-relative globs that keep matching files out of memory search discovery, file watching, and index scope identity. When unset, the index scope hash is unchanged, so existing indexes are not rebuilt. Ported from openclaw#177868 (head a2008ab) onto current main. Conflict resolution: the scope hash goes through the single resolveConfiguredMemoryScopeHash owner, and the watch policy imports the new matcher from the filesystem-worker SDK subpath (engine-fs), keeping the narrow worker imports from openclaw#181891. Co-authored-by: CheekyHobson <[email protected]>
Move shouldSkipConfiguredMemorySearchPath next to the extraPaths glob matcher in the memory host SDK, so core root-memory files stay unchanged, and add the config field label. Drop three tests: one indexed an excluded file through a private method (the CLI e2e covers the real config-change removal), one asserted selectionKeys shape (the lifecycle join/leave test proves the behavior and fails without the fix), and a worker integration test that still passed without the shared-watcher fix.
A scope change pauses vector search until an explicit rebuild, so say that instead of "next full sync". Point the dreaming docs at the setting where they describe report files.
Replace the 13 s CLI e2e case with a manager test that mirrors two unforced `openclaw memory index` runs: the first drops excluded rows after the scope change, the second refreshes an edited curated note. It fails when the config resolver drops excludePaths. Drop a redundant skip check for extra file roots (the loop already skips excluded roots) and keep the original selectionKeys rationale.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. What this changesAdds optional workspace-relative exclusions to memory search discovery, watching, and index scope. Example: Set memory.search.excludePaths to ["memory/dreaming/**"] and rebuild the index.
Review scores
ProductKind: Feature · Worth it: Needs a maintainer decision · Fix scope: Partial Merge readiness⛔ Blocked before merge - 1 item remains Keep this PR open: it provides a coherent implementation of a maintainer-consolidated need that current main still lacks, with no actionable correctness findings. Priority: P2 Decision needed
Before merge
FindingsNone. Agent review detailsHow this fits togetherMemory configuration feeds local and remote file discovery, shared filesystem watchers, and index identity; eligible files become searchable chunks in the Gateway-owned index. flowchart TD
A[Memory configuration] --> B[Normalized exclusion patterns]
B --> C[Local and remote discovery]
B --> D[Shared watcher policy]
B --> E[Index scope identity]
C --> F[Memory index]
D --> F
E --> F
F --> G[Memory search results]
Technical reviewBest possible solution: Approve the narrow search-only setting while retaining the canonical issue for recall eligibility and diagnostics. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the missing exclusion capability, and the discussion supplies official-release observations; this read-only review executed no product code. Is this the best way to solve the issue? The patch is a focused search-only implementation using existing discovery, watcher, and index-identity owners; it intentionally leaves the broader recall request incomplete. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 895c50368fee. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +81, Tests +154, Docs +14, Generated 0, Other +2. Total +251 across 27 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (6 earlier review cycles)
Reviewed November 22, 2026, 1:25 PM ET / 18:25 UTC (Revision 7). |
It only asserted that a mock worker command carried the copied setting. The Gateway watcher run in the PR evidence covers the behavior.
The change adds 145 net test lines for default scope-hash compatibility, shared-watcher rebaseline, discovery and glob matching, and the exclusion rebuild regressions.
|
Thanks @serg0x for carrying this forward and adding the CLI, watcher and upgrade evidence, and @CheekyHobson for the original implementation. From the operator side of #101422, this search-only scope addresses our immediate need: keep generated dream reports out of memory search, including newly written reports, while curated notes remain searchable and continue updating. Our earlier workaround on 2026.9.5 was to move about 165 reports per agent out of the indexed tree and reindex. An opt-in I checked the relevant diff and docs at For the maintainer's scope decision, I support shipping these search exclusions as the first stage, with #101422 retained for its broader scope. Selecting which sessions enter dreaming is the separate request in #183574; this PR does not need to solve that to be useful to us. My existing offer stands: once the scope is agreed, I can test against a copy of a real workspace and report indexed file counts before and after. |
excludePaths called path.posix.matchesGlob, which Bun implements with Bun.Glob: extglobs never match and wildcards match dotfiles. The same setting then excluded different files on Node and Bun. Reuse the minimatch options main adopted for extraPaths patterns (openclaw#194912) so both pattern kinds share one glob contract on every runtime.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Gitignore-style spellings such as "memory/dreaming/", "./memory/dreaming/**" or "/memory/dreaming/**" silently excluded nothing. Resolve each memory.search.excludePaths entry once where the config is read: trim it, drop empty entries, use "/" separators, strip a leading "./" or "/", treat a trailing "/" as "/**", and dedupe in order. The docs and help example drop "memory/.dreams/**": that directory only holds .txt and .json dreaming state, which memory search never indexes.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Related: #101422
Supersedes #177868 by @CheekyHobson (closed for inactivity on 2026-11-18): their reviewed head
a2008ab09, ported onto current main with co-author credit on the commit, plus the proof ClawSweeper asked for.What Problem This Solves
Generated dreaming reports under
memory/dreaming/are indexed like curated notes and crowd them out of memory search, and there is no setting to exclude paths inside the default memory folders.User Impact
User impact: operators can set
memory.search.excludePaths(globally or per agent), for example["memory/dreaming/**"], to keep matching workspace files out of memory search and file watching.extraPaths:openclaw memory statusreports it, vector search pauses, andopenclaw memory indexrebuilds and drops the excluded rows.memory_getcan still read them,memory forgetstill scrubs them, and short-term recall/promotion eligibility is unchanged../or/and a trailing/are accepted (memory/dreaming/is the same asmemory/dreaming/**), and per-agent lists add to the global list.Why This Change Was Made
One workspace-relative glob check, using the same minimatch options as the
extraPathsmatcher beside it in the memory host SDK (so patterns behave the same on Node and Bun), is applied where search scope is decided: file discovery (local and remote workspace providers), watcher eligibility, and the index scope hash. Shared watchers include the exclusions in their selection keys, so agents with different exclusions on one workspace rebaseline when one joins or leaves (the P2 ClawSweeper found on #177868).Portable glob matching (ClawSweeper's 2026-11-09 review on
05585b7): the exclusion matcher calledpath.posix.matchesGlob, which Bun implements withBun.Glob: extglobs never match and wildcards match dotfiles, so["memory/dreaming/**/!(*.keep).md"]excluded a report on Node but not on Bun. Main's #194912 had just moved theextraPathsmatcher to minimatch for the same reason.1463f6emoves those minimatch options into one shared constant and uses it forexcludePathstoo, with compiled matchers cached per configured list. Results on Node are unchanged; on Bun they now match Node.Pattern spellings (
2b7dc7f): gitignore-style spellings such asmemory/dreaming/,./memory/dreaming/**or/memory/dreaming/**excluded nothing.resolveMemorySearchIndexConfig, which every reader (scan, watcher, scope hash, remote file worker) gets its settings from, now normalizes each entry once: trim, drop empty entries, use/separators, strip one leading./or/, turn a trailing/into/**, and dedupe in order. The matcher is unchanged. The docs and help example dropmemory/.dreams/**: that folder only holds.txtand.jsondreaming state, which memory search never indexes.Changes compared with #177868 at
a2008ab09:resolveConfiguredMemoryScopeHash()owner, and the matcher is exported fromplugin-sdk/memory-core-host-engine-fs, the subpath perf(memory): narrow workspace file worker imports #181891 narrowed the file worker to, instead ofengine-storage. Both are private local-only subpaths, so this adds no third-party SDK contract.packages/memory-host-sdk/src/host/internal.tsbesidematchesExtraMemoryPathEntryinstead of coresrc/memory/root-memory-files.ts.openclaw memory indexruns (the real CLI run is below). Dropped a test that indexed an excluded file through a private method, aselectionKeysshape test covered by the join/leave behavior test, a worker integration test that still passed with the P2 fix reverted, and (after ClawSweeper's review) a test that only checked the worker request shape.Size against main
a2f7aa9: production +102/-21 in 15 files (including moving main's glob options into the shared constant); tests +159/-3; docs +18/-4; generated baselines +3/-3. (#177868 was +439/-18 in 33 files.)Maintainer decision needed
#101422 asks for both search exclusion and recall/promotion eligibility control. This PR is the narrow first stage: search discovery, watching, and index scope only, with defaults and promotion safeguards unchanged. ClawSweeper's review of #177868 recommended approving that narrow search stage and leaving recall inclusion and diagnostics to follow-up work; the alternative is one combined search+recall include/exclude design. An operator on #101422 said the search-only step covers their need.
Config surface:
pnpm config:docs:genraises the core count by 4 (2668 -> 2672 on maina2f7aa9) formemory.search.excludePathsandagents.entries.*.memory.search.excludePaths, each with its.*item path. That is the new setting itself.Evidence
Real runs on
78d4f9f(on main431392a), starting from the latest stable release,[email protected]from npm (installed with--ignore-scripts; the CLI runs without the package's install scripts). The current headfa31efcadds only a merge of maina2f7aa9. Earlier runs from 2026.11.5 on59298b8, from 2026.11.4 onddb2348, from 2026.11.3 onc210875, from 2026.11.2 on1463f6eand on05585b7(before the portable-matcher change), from 2026.11.1 on6d9ace7and from 2026.10.10 onb607675showed the same behavior. Synthetic workspace: 3 curated files (MEMORY.md,memory/backups.md,memory/garden.md) and 7 generated reports (5 light, 2 REM, one REM report containing only "No strong patterns surfaced."). IsolatedOPENCLAW_HOMEunderenv -i, Node 26.12.1, and a local OpenAI-compatible embeddings stub on 127.0.0.1 (deterministic vectors, no provider calls).Upgrade from 2026.11.6 and existing data: 2026.11.6 builds the index (10 files, 10 chunks). After this branch's
doctor --fix(main's agent-database migrations since 2026.11.6, v38 -> v43), the existing index loads clean (Dirty: no) and returns the same results and scores as 2026.11.6, before any re-index. WithexcludePathsunset,memory indexkeeps the stored scope hash, the chunking version and every stored chunk row (same count and same fingerprint overid,path,hash). This PR adds no database schema or stored fields; the scope hash changes only whenexcludePathsis set. The branch build prints main's version string, 2026.11.5, because 2026.11.6 shipped from a release branch.Opting in: setting
excludePathsmarks the index dirty with a scope change and pauses vector search until a rebuild, both shown inmemory status.memory indexthen drops the 7 reports and keeps the 3 curated files; the curated note ranks first, and an edit refreshes it.Terminal output (paths redacted to
$OPENCLAW_HOME)Pattern spelling on
2b7dc7f: the same synthetic workspace with a trailing-slash pattern,["memory/dreaming/"], which matched nothing before2b7dc7f.Terminal output
Gateway watcher: a throwaway loopback Gateway with
excludePathsset. One agent turn opens the Gateway's default memory manager and its watcher: a local chat-completions stub callsmemory_searchonce, throughdispatch_action, because current main keepsmemory_searchbehind Tool Search for this model. Then, with no further CLI calls, a new dreaming report is written and the curated note edited: the watcher refreshes the note within about 2 s and never indexes the report.Terminal output
Regressions fail without the fix:
file-watcher.lifecycle.test.ts"rebaselines shared exclusions when a differently scoped agent joins and leaves" fails withexcludePathsremoved fromselectionKeys("expected setScopes to be called once, but got 0 times").manager-workspace-files.test.ts"drops generated Dream reports once excluded and keeps curated edits fresh" fails when the config resolver dropsexcludePaths(the report is still found).internal.test.ts"keeps generated dreaming reports out of default and overlapping extra paths" also lists files withmemory/dreaming/**/!(*.keep).md. With the oldpath.posix.matchesGlobmatcher,listMemoryFilesunder Bun still returns the report: on stock Bun 1.3.14 it listsmemory/current.md, memory/dreaming/light/pinned.keep.md, memory/dreaming/light/report.md, and with1463f6eonlymemory/current.md, memory/dreaming/light/pinned.keep.md. On Node both matchers agree, so the Node run passes either way; the CI shard that runs this test (checks-node-changed-compact-large-6) sets up the pinned Bun 1.4.4 test runtime.Changed test files (
pnpm test <file> --maxWorkers=1on685db0c, same test code as8eb4b7b):file-watcher.lifecycle.test.tsmanager-reindex-state.test.tsmanager-workspace-files.test.tswatch-policy.test.tsinternal.test.tsmemory-search.test.tsVitest time is mostly cold transform; the new manager case takes about 4 s and the other new cases take 1-24 ms.
Checks:
node scripts/check-changed.mjs --base upstream/mainon83eb31b(main200afde, same code) passes typecheck (core, core tests, extensions, extension tests), lint, format, config docs baseline, Plugin SDK package exports, plugin boundaries and the other changed-file guards. Three lanes fail outside this PR: wrapper shadowing (buildSkillWorkshopPromptSection) and the public Plugin SDK surface budget (agent-harness-runtime) fail identically on clean main200afde, and the dead-export scan lists only auto-reply, gateway and UI exports this PR does not touch. Thepnpm check:docscontent checks pass. Test lines grow by a net +154, covered byconfig/test-lines-allocations/memory-search-exclude-paths-188294.txt: default scope-hash compatibility, the shared-watcher rebaseline, discovery and portable (Node/Bun) glob matching, and the exclusion rebuild.PR CI: CI has not run on the current head
fa31efc(merging maina2f7aa9) or on the seven heads before it: GitHub holds this fork PR's workflows until a maintainer clicks "Approve and run" (action_required), soopenclaw/ci-gateshows failure until CI completes. The last completed run, onfc2ef72, passed 72 checks; its three failing memory-core tests are in files this PR does not touch, failed the same way on main without this PR, and main fixed them in #197543. Earlier red runs also came from main and were fixed there. Merges of main conflicted only on the generated config baseline, which was regenerated each time. The full CI history is in this description's edit history.Local review: autoreview, Codex
gpt-6.1-sol, branch mode againstupstream/main, P0–P2: scoped-clean, "patch is correct" (0.87). It ran on685db0c, before the rebases onto200afdeandf980e01, which changed only the base and the generated baseline files. For2b7dc7f: autoreview with the Claude engine, local mode, P0–P2: scoped-clean, "patch is correct" (0.8). On2b7dc7f,memory-search.test.ts(39/39; the updated case fails one768746),schema.help.quality.test.ts,internal.test.tsandworkspace-memory-client.test.tspass, as dotsgo:core, oxlint, oxfmt,check:docs,config:docs:checkand the test-line ratchet. Onfa31efc(maina2f7aa9),tsgo:core,tsgo:extensions,config:docs:check,prompt:snapshots:check, oxfmt on this PR's files,check:docsand the test-line ratchet (net +154, covered by the allocation) pass, and so do the touched tests plus neighboring memory tests (18 files). Locally, onecli.test.tstest from main's #197543 (fails index --force after full verification records orphaned provenance) fails; it fails the same way on maina2f7aa9without this PR.Not covered: Windows paths (the matcher normalizes
path.sep) and a live remote node workspace (the harness test checks that list and watch requests carryexcludePaths).