Skip to content

feat(memory): isolate curated entries by project - #115438

Merged
steipete merged 15 commits into
mainfrom
feat/memory-project-scope
Jul 29, 2026
Merged

steipete merged 15 commits into
mainfrom
feat/memory-project-scope

Conversation

@steipete

@steipete steipete commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where curated MEMORY.md and USER.md entries from different projects were indexed into one shared chunk. A trigger hit could inject neighboring entries from another project, while the fail-closed all-project-key check could also suppress valid global and active-project memories.

Why This Change Was Made

Curated files now chunk per top-level entry, preserving entry annotations across oversized fragments and forcing a cache-class shadow reindex through a chunking-version bump. Project annotations flow through recall, ranking, trigger injection, bootstrap context, short-term claims, and promotion; active-project comparisons preserve remote path casing and fail closed for foreign or partially active multi-project entries. Annotation comments are excluded from derived concept tags.

The implementation is AI-assisted and was reviewed with the repository autoreview workflow. Maintainer decisions for additive project annotations and the nullable index column follow the same additive-contract policy recorded on #114819. Digest and lane-1 scoping remain fail-closed under the recorded injection-isolation rulings.

User Impact

Operators can keep project-specific durable memory without a trigger leaking neighboring curated entries. Active-project and global memories remain available, foreign-project memories are excluded, existing indexes rebuild automatically after upgrade, and promoted entries retain their project, trigger, and importance annotations.

Evidence

Coordinator live validation used a development Gateway, two fake remote repositories, and real OpenAI model turns. The old index was upgraded through a live shadow reindex, then lane-1, claim convergence, and promotion were exercised end to end.

per-entry chunks after upgrade
MEMORY.md  1-2  header                          triggers=null                       project_key=null
MEMORY.md  3-3  "kraken deploy ritual"          triggers="kraken deploy ritual"    project_key=github.com/acme/alpha
MEMORY.md  4-4  "kraken certify ritual"         triggers="kraken certify ritual"   project_key=github.com/acme/beta
MEMORY.md  5-6  "measurement units preference"  triggers="measurement units preference" project_key=null
lane-1 gating
active-project trigger: injected 1
global trigger:         injected 1
foreign-project trigger: no injection log line
short-term claim convergence
memory:claim:6b8ec15fb50d dailyCount=3 uniq=3 across 3 days
promotion annotation round-trip
<!-- project: github.com/acme/alpha -->
trigger and importance annotations retained on the promoted entry

Validation:

  • Earlier branch proof: 80 + 104 + 1,345 Testbox tests passed; 1,216 memory-core tests passed; changed gates passed.
  • Rebased branch proof: project-memory agent tests 14/14; memory-host SDK 117/117; active-memory 235/235.
  • Rebased memory-core proof: 1,219/1,220 passed in the broad run; the sole load-sensitive legacy migration cleanup timeout passed immediately when isolated on the same Testbox head.
  • Full changed gate passed: formatting, dead exports, core and extension typechecks, core and extension lint, SDK contracts, schema guards, architecture/import-cycle guards, and database-first guards.
  • Exact-head focused project/prompt proof: 31 agent tests, 11 system-prompt tests, and 6 attempt-prompt tests passed.
  • Exact-head project/search proof: 223/225 memory tests passed before the final lifecycle fix; the two provider-fallback regressions then passed 2/2 locally and on Blacksmith Testbox run https://github.com/openclaw/openclaw/actions/runs/30418513318.
  • Exact-head path gate passed after the lifecycle fix: formatting, dead exports, extension and extension-test typechecks, extension lint, SDK/boundary guards, database-first guards, and runtime cycle checks.
  • Final autoreview passed with no actionable findings (0.98 confidence).

Follow-ups:

  • Recency-weighted multi-project active set; this change ships the single-key active repository path.
  • Consolidation prompt grouping by project.
  • Sweep-gate calibration for the observed 0.747 three-day fact versus the current 0.8 threshold.
  • SSH userinfo remains deliberately folded out so SSH and HTTPS clones converge; the accepted tradeoff is a rare same-host, same-relative-path collision across distinct SSH accounts in one operator's memory store.
  • QMD remains neutral for project ranking because that backend does not carry authoritative project metadata; presentation snippets are intentionally never parsed to infer scope.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: memory-core Extension: memory-core agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Jul 28, 2026
@steipete steipete self-assigned this Jul 28, 2026
@steipete
steipete marked this pull request as ready for review July 28, 2026 23:36
@openclaw-barnacle openclaw-barnacle Bot added the commands Command implementations label Jul 28, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@steipete
steipete force-pushed the feat/memory-project-scope branch from 1794afc to 0bf4be5 Compare July 29, 2026 03:11
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@steipete

Copy link
Copy Markdown
Contributor Author

ClawSweeper re-review was skipped at operator direction after the 10-minute cap expired with only the queue acknowledgement and no verdict (queue backlog).

Pre-land gates used instead: exact-head CI is green for 4d2345be51ecaf025ed601931a3883d68597bc2e after the unrelated Windows SQLite snapshot flake passed on rerun, and the final autoreview reported no accepted/actionable findings (0.98 confidence).

@steipete
steipete merged commit d41a56f into main Jul 29, 2026
190 of 192 checks passed
@steipete
steipete deleted the feat/memory-project-scope branch July 29, 2026 03:55
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 29, 2026
* feat(memory): scope recall to active projects

* feat(memory): preserve project scope in promotion

* docs(memory): explain project-scoped recall

* fix(memory): chunk curated files per entry

* refactor(memory): narrow project scope internals

* fix(memory): exclude annotations from concept tags

* fix(memory): tighten project isolation boundaries

* fix(memory): preserve project path casing

* fix(memory): prioritize project bootstrap candidates

* docs: refresh memory architecture map

* test(memory): cover project scope schema repair

* fix(memory): complete project isolation paths

* fix(memory): close project ranking checks

* fix(memory): reinitialize search provider before ranking

* fix(memory): tolerate missing bootstrap paths
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling commands Command implementations docs Improvements or additions to documentation extensions: memory-core Extension: memory-core maintainer Maintainer-authored PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant