Repository navigation
feat(memory): memory system v2 with search, metadata, and lite recall - #175
Conversation
📝 WalkthroughWalkthroughMemory System v2 adds YAML metadata, keyword/tag search with ranking, append behavior, sanitized lite-layer hints, expanded command handling, updated UI integration, tests, documentation, and token baselines. ChangesMemory System v2
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant MemoryTool
participant memory_helpers
participant MemoryFiles
Caller->>MemoryTool: invoke search or append
MemoryTool->>memory_helpers: parse input and process entries
memory_helpers->>MemoryFiles: read or update memory file
MemoryFiles-->>memory_helpers: memory content and metadata
memory_helpers-->>MemoryTool: ranked results or rendered entry
MemoryTool-->>Caller: formatted response
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
Criterion
Details
| Benchmark suite | Current: ee00c14 | Previous: c2985e6 | Ratio |
|---|---|---|---|
fib/jit_mlua_hook |
6447516 ns/iter (± 81665) |
4999316 ns/iter (± 145075) |
1.29 |
fib/jit_watchdog |
2447082 ns/iter (± 3924) |
1893452 ns/iter (± 26503) |
1.29 |
fib/jit_none |
2460041 ns/iter (± 33378) |
1894198 ns/iter (± 4439) |
1.30 |
fib/interp_mlua_hook |
7632705 ns/iter (± 75749) |
5867928 ns/iter (± 14819) |
1.30 |
fib/interp_watchdog |
3850008 ns/iter (± 13312) |
2977370 ns/iter (± 8039) |
1.29 |
fib/interp_none |
3751734 ns/iter (± 23345) |
2907536 ns/iter (± 14737) |
1.29 |
buffer_rw/jit_mlua_hook |
554431 ns/iter (± 3533) |
430103 ns/iter (± 3394) |
1.29 |
buffer_rw/jit_watchdog |
168272 ns/iter (± 241) |
130297 ns/iter (± 138) |
1.29 |
buffer_rw/jit_none |
167986 ns/iter (± 415) |
130303 ns/iter (± 134) |
1.29 |
buffer_rw/interp_mlua_hook |
1039253 ns/iter (± 3981) |
827688 ns/iter (± 3964) |
1.26 |
buffer_rw/interp_watchdog |
636521 ns/iter (± 6360) |
512252 ns/iter (± 13857) |
1.24 |
buffer_rw/interp_none |
658001 ns/iter (± 7817) |
512467 ns/iter (± 5133) |
1.28 |
splash_render_120x40 |
68227 ns/iter (± 5717) |
55866 ns/iter (± 3080) |
1.22 |
splash_render_200x60 |
161748 ns/iter (± 15894) |
129118 ns/iter (± 10787) |
1.25 |
This comment was automatically generated by workflow using github-action-benchmark.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_522c13d0-27f0-4c1e-aade-9ac43e85e136) |
|
cursor review |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_c518f952-6089-4a3e-9013-c33c15f62145) |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_97e02194-4a00-4618-8ac0-03de57e48f04) |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_bd43606a-c2aa-4441-bdca-e1154a545056) |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_e5c2ff4a-8d7a-46fe-8937-24a24f51670e) |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…call Structured persistence was the main gap: flat view/write/delete with no search, tags, append, or session-start recall. Adds frontmatter metadata, keyword search ranking, append, lite-layer prompt injection with sanitization, and speckit docs.
Filter search to keyword/phrase matches only, encode frontmatter via n00n.yaml.encode, strengthen lite-hint sanitization, fail append on read errors, and restore append from merged on-disk body.
The branch adds a default tool, raising main_tools_schemas tool_count from 27 to 28. Regenerate baselines/cold_start.json in the same PR.
c26a794 to
5a5e64b
Compare
Merge prior YAML metadata when write omits optional fields so tags, topic, layer, synopsis, and importance survive view-then-rewrite.
Validate write against the full on-disk payload including frontmatter, reserve header/newlines in the lite hint byte cap, and drop empty topic or synopsis after normalize_metadata like parse_frontmatter.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Lite hint skips valid entries
- build_lite_hint now walks the full sorted lite list until LITE_HINT_LIMIT non-empty sanitized lines are collected instead of stopping after the first five entries.
You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 4eea5d3. Configure here.
Skip empty sanitized summaries by walking the full sorted lite list until LITE_HINT_LIMIT injectable lines are filled.
This comment has been minimized.
This comment has been minimized.
|
Bugbot Autofix prepared fixes for all 3 issues found in the latest run.
You can send follow-ups to the cloud agent here. |
There was a problem hiding this comment.
Actionable comments posted: 10
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@n00n-lua/tests/plugin_host.rs`:
- Around line 5081-5118: The test memory_tool_append_preserves_frontmatter only
checks the body returned by cmd_view and does not verify metadata. Extend it
with a follow-up memory search for notes.md (or the seeded topic) and assert the
result includes the preserved topic= and layer= metadata, using the search
output path that formats entry metadata.
In `@plugins/memory/init.lua`:
- Around line 127-130: Wrap the filesystem error values with tostring before
concatenating them into tool error messages: update the read-error handling in
cmd_view at plugins/memory/init.lua lines 127-130, and the delete-error handling
in cmd_delete at plugins/memory/init.lua lines 240-253. Both sites must safely
handle nil errors without changing the existing return behavior.
- Around line 29-41: Export the existing normalize_string_list helper from
memory_helpers.lua, then update parse_tag_filter to reuse that shared helper
instead of duplicating comma-splitting and whitespace-trimming logic. Preserve
the current nil behavior for non-string, empty, or delimiter-only input, and
remove the redundant local parsing implementation.
- Around line 372-387: Replace the `/memory` picker’s `load_entries(dir)` call
with the lightweight `helpers.collect_file_entries(dir)` flow, since
`build_items()` only needs each entry’s path and size. Preserve sorting and
display behavior, and update the edit/delete handlers below to use the resulting
item/entry shape rather than relying on parsed `load_entries` fields.
In `@plugins/memory/memory_helpers.lua`:
- Around line 463-491: Update sanitize_hint_text to strip every injection phrase
and role prefix case-insensitively, including fully uppercase variants, using a
shared case-insensitive matching helper or equivalent approach. Replace the
first-letter-only patterns and remove the string.char obfuscation in
role_prefix_pattern usage, using clear literal patterns for ignore phrases,
developer mode, system, user, assistant, and human prefixes. Extend
sanitize_hint_strips_injection_patterns to cover uppercase or mixed-case inputs.
- Around line 434-441: Remove the unused local `meta` declaration from the loop
in the search-result formatting flow, while preserving the existing `size`,
`lines`, and `total` calculations.
- Around line 150-181: Update parse_frontmatter to preserve and propagate
n00n.yaml.decode errors instead of replacing a failed decode with an empty
metadata table. Extend its return values with the decode error, then update
parse_memory_file, cmd_write, cmd_append, and append_body to handle that error
path and abort without overwriting existing metadata; retain normal
normalization and save behavior for valid frontmatter.
In `@specs/007-memory-system-v2/spec.md`:
- Around line 58-67: Update specs/007-memory-system-v2/spec.md lines 58-67:
revise FR-003 to remove or mark the paths frontmatter field as deferred, and
mark FR-007’s discovery-index caching requirement as deferred or out of scope,
matching tasks.md T004 and contracts/memory_recall.md. Update
specs/007-memory-system-v2/plan.md lines 15-36: annotate or remove the Phase 3/4
commitments and file-map entries for memory_index.lua and memory_telemetry.lua
because neither was delivered.
- Line 15: Update the table row containing the inline code `layer: lite|deep` so
the literal pipe is escaped within the code span, preserving the intended
six-column Markdown table structure.
In `@specs/007-memory-system-v2/tasks.md`:
- Line 19: Correct the typo in the “Optional semblem/embedding search adapter”
task description by replacing “semblem” with “semantic,” leaving the rest of the
wording unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 67f02312-a8c3-43bd-94cd-589db74b6f1a
📒 Files selected for processing (12)
changelog.d/175.added.mdn00n-lua/tests/plugin_host.rsn00n-token-profile/baselines/cold_start.jsonplugins/memory/init.luaplugins/memory/memory_helpers.luaplugins/memory/tests/spec.luasite/docs/content/tools/_index.mdspecs/007-memory-system-v2/contracts/memory_recall.mdspecs/007-memory-system-v2/plan.mdspecs/007-memory-system-v2/research.mdspecs/007-memory-system-v2/spec.mdspecs/007-memory-system-v2/tasks.md
📜 Review details
⏰ Context from checks skipped due to timeout. (14)
- GitHub Check: Cursor Bugbot Autofix
- GitHub Check: Test (Windows)
- GitHub Check: Rustdoc
- GitHub Check: MSRV (1.97)
- GitHub Check: Coverage
- GitHub Check: Build (Windows)
- GitHub Check: Test (macOS)
- GitHub Check: Lint (macOS)
- GitHub Check: Test
- GitHub Check: Lint (Windows)
- GitHub Check: Build
- GitHub Check: Docs
- GitHub Check: Analyze (rust)
- GitHub Check: Criterion
🧰 Additional context used
📓 Path-based instructions (6)
**/*
📄 CodeRabbit inference engine (AGENTS.md)
**/*: Non-trivial or multi-file changes should use a dedicated git worktree and new branch; do not modify unrelated user changes, force-push, or push to main.
Ship finished work with a clear Conventional Commit message, a pushed branch, and a draft pull request; never add AI-agent attribution to authored content.
Before investigating unfamiliar failures or third-party behavior, research documented behavior first and distinguish unrelated baseline failures from regressions in the touched surface.
Use structural tools before broad searches: prefercodegraphorarborfor cross-file relationships,indexbefore reading files, targeted reads, parallel calls, andcode_executionfor filtering large outputs.
Files:
changelog.d/175.added.mdspecs/007-memory-system-v2/tasks.mdsite/docs/content/tools/_index.mdspecs/007-memory-system-v2/spec.mdn00n-token-profile/baselines/cold_start.jsonspecs/007-memory-system-v2/plan.mdspecs/007-memory-system-v2/research.mdspecs/007-memory-system-v2/contracts/memory_recall.mdn00n-lua/tests/plugin_host.rsplugins/memory/tests/spec.luaplugins/memory/init.luaplugins/memory/memory_helpers.lua
site/docs/**/*
📄 CodeRabbit inference engine (AGENTS.md)
User documentation should be warm, simple, concise, easy for non-native English speakers, story-oriented, and contain no em-dashes, emojis, or AI-like tone.
Files:
site/docs/content/tools/_index.md
**/*.{rs,ron,json,toml,yaml,yml}
📄 CodeRabbit inference engine (AGENTS.md)
Treat LLM and provider output as untrusted input; validate it against schemas, domain constraints, and source evidence before persistence or action.
Files:
n00n-token-profile/baselines/cold_start.jsonn00n-lua/tests/plugin_host.rs
**/*.rs
📄 CodeRabbit inference engine (AGENTS.md)
**/*.rs: Workspace Rust lint rules are mandatory: deny unsafe code, productionunwrap_used,expect_used,panic,todo!,unimplemented!,dbg!, wildcard imports, and silent-default error handling.
Do not add unsafe code, FFI, global mutable state,static mut, or unchecked transmute-like behavior without written review and an explicit crate-level lint exception.
Use explicit error handling withResult<T, E>rather than panics; propagate typed errors with?,ok_or_else, andmap_err.
Usethiserrorfor library and domain-specific errors, andcolor-eyreat binary edges.
Do not silently discard errors with.ok(),unwrap_or,unwrap_or_default, or equivalent defaults; return an error, reject the operation, or use an explicitly named fallback with sanitized structured logging.
Follow Rust idioms, use descriptive variable and function names, avoid unnecessary state and bloat, and keep each line justified.
Import types at the top of the file, use short imported names instead of inline qualified paths, and place constants immediately after imports.
Do not use inline magic numbers or strings; deriveCopyonly for structs with one primitive field.
Use structured logging with useful fields and provide helpful, sanitized error messages.
Do not commit credentials, API keys, tokens, cookies, authorization headers, or user data, and do not log raw provider payloads, prompts, credentials, or session data.
Validate and authorize HTTP, file, queue, configuration/environment, LLM output, and provider callbacks before mutation or persistence.
Tool execution requires allowlisted tools, scoped credentials, explicit user context, audit events, and refusal or denial tests.
Write meaningful, non-tautological, non-flaky tests; avoid arbitrary sleeps, and define shared constant error/status messages for assertions.
Files:
n00n-lua/tests/plugin_host.rs
**/*.{rs,toml}
📄 CodeRabbit inference engine (AGENTS.md)
All crates must opt into the workspace lint configuration with
[lints] workspace = true; the root workspace lint configuration is authoritative.
Files:
n00n-lua/tests/plugin_host.rs
plugins/**/*.lua
📄 CodeRabbit inference engine (AGENTS.md)
Built-in Lua plugins belong under
./pluginsand should use the repository's plugin tooling and conventions.
Files:
plugins/memory/tests/spec.luaplugins/memory/init.luaplugins/memory/memory_helpers.lua
🪛 LanguageTool
specs/007-memory-system-v2/spec.md
[grammar] ~39-~39: Ensure spelling is correct
Context: ...rontmatter, When view loads file, Then body excludes frontmatter. 3. Given...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
specs/007-memory-system-v2/contracts/memory_recall.md
[uncategorized] ~14-~14: Did you mean the formatting language “Markdown” (= proper noun)?
Context: ...t is sanitized: control chars stripped, markdown heading/list prefixes removed, `ignore ...
(MARKDOWN_NNP)
🪛 Luacheck (1.2.0)
plugins/memory/memory_helpers.lua
[warning] 437-437: unused variable 'meta'
(W211)
🪛 markdownlint-cli2 (0.23.1)
changelog.d/175.added.md
[warning] 1-1: First line in a file should be a top-level heading
(MD041, first-line-heading, first-line-h1)
specs/007-memory-system-v2/spec.md
[warning] 15-15: Table column count
Expected: 6; Actual: 7; Too many cells, extra data will be missing
(MD056, table-column-count)
🔇 Additional comments (9)
specs/007-memory-system-v2/contracts/memory_recall.md (1)
1-29: LGTM!specs/007-memory-system-v2/research.md (1)
1-40: LGTM!plugins/memory/tests/spec.lua (2)
162-277: LGTM!
278-282: 📐 Maintainability & Code QualityTest only covers the casing that already passes; doesn't catch the bypass.
See consolidated comment shared with
memory_helpers.lua's sanitization case-sensitivity gap — this test's input phrasing happens to match the only casing the current patterns strip.n00n-lua/tests/plugin_host.rs (1)
5039-5079: LGTM!Also applies to: 5120-5147
site/docs/content/tools/_index.md (1)
285-302: LGTM!changelog.d/175.added.md (1)
1-1: LGTM!n00n-token-profile/baselines/cold_start.json (1)
7-20: LGTM!plugins/memory/init.lua (1)
78-86: 🚀 Performance & ScalabilityManual verification needed for
register_prompt_hintinvocation frequency.
plugins/memory/init.luaunconditionally reads and parses every memory entry in itssystemprompt-hintcontentfunction. The current repo search did not find theregister_prompt_hintimplementation/call site, so this cannot be classified as per-turn disk I/O without determining whether this content callback is re-evaluated each turn or only at session start.
Harden lite-hint sanitization to be fully case-insensitive, surface invalid frontmatter YAML instead of silent wipe, share tag parsing, and align deferred-index/spec docs with what shipped.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_b6ad18c6-5223-4f11-af65-94314f1b2d76) |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_c0ba12f0-e29f-4f6d-9bae-bf0c56a6fbb5) |
Refresh cold_start baseline and start the cursor pace timer before the first frame read to avoid flaky FIRST_FRAME_PACE assertions.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_c652103a-a916-4f6b-9141-b1e6de067191) |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
site/docs/content/tools/_index.md (1)
317-317: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winDocument
tagsas write metadata too.
writeaccepts tags for frontmatter, but this says they are only asearchfilter.Proposed fix
-| `tags` | string | no | | Comma-separated tags filter for 'search' | +| `tags` | string | no | | Comma-separated tags metadata for 'write' and filter for 'search' |🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@site/docs/content/tools/_index.md` at line 317, Update the `tags` entry in the tools parameter table to document that tags are accepted as write frontmatter metadata as well as used for the `search` filter; preserve the existing type and optionality details.n00n-providers/src/providers/cursor/run.rs (1)
614-656: 🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy liftRemove raw provider-payload diagnostics.
The global dump retains every decoded provider frame without a bound, then Line 553 writes it to a fixed
/tmppath and Lines 560-566 return a payload-derived sample in an API error. This can persist or expose prompts, model output, checkpoint data, or session content.
n00n-providers/src/providers/cursor/run.rs#L614-L656: retain only bounded, sanitized counters or protocol metadata; do not clone raw frame payloads or derive textual previews.n00n-providers/src/providers/cursor/run.rs#L546-L566: remove the raw frame dump and payload sample from timeout diagnostics; return non-sensitive frame/count metadata only.As per coding guidelines, “Do not log raw provider payloads, prompts, credentials, or session data.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@n00n-providers/src/providers/cursor/run.rs` around lines 614 - 656, Remove raw payload retention and textual preview generation from the frame-processing logic around iter_fields in n00n-providers/src/providers/cursor/run.rs lines 614-656; keep only bounded, sanitized counters or protocol metadata and do not clone payloads. Update the timeout diagnostics around lines 546-566 to remove the global raw-frame dump and payload-derived sample, returning only non-sensitive frame/count metadata.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@n00n-lua/tests/plugin_host.rs`:
- Around line 5923-5927: Update the search assertion in the test around the
existing auth.md and score checks to verify ordering, not merely inclusion:
capture the positions of both auth.md and lua.md in out and assert that auth.md
appears before lua.md. Retain the score assertion and make the position checks
fail clearly if either result is missing.
---
Outside diff comments:
In `@n00n-providers/src/providers/cursor/run.rs`:
- Around line 614-656: Remove raw payload retention and textual preview
generation from the frame-processing logic around iter_fields in
n00n-providers/src/providers/cursor/run.rs lines 614-656; keep only bounded,
sanitized counters or protocol metadata and do not clone payloads. Update the
timeout diagnostics around lines 546-566 to remove the global raw-frame dump and
payload-derived sample, returning only non-sensitive frame/count metadata.
In `@site/docs/content/tools/_index.md`:
- Line 317: Update the `tags` entry in the tools parameter table to document
that tags are accepted as write frontmatter metadata as well as used for the
`search` filter; preserve the existing type and optionality details.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 1afd8fc8-a909-437f-a36c-4fd5af835787
📒 Files selected for processing (10)
n00n-lua/tests/plugin_host.rsn00n-providers/src/providers/cursor/run.rsn00n-token-profile/baselines/cold_start.jsonplugins/memory/init.luaplugins/memory/memory_helpers.luaplugins/memory/tests/spec.luasite/docs/content/tools/_index.mdspecs/007-memory-system-v2/plan.mdspecs/007-memory-system-v2/spec.mdspecs/007-memory-system-v2/tasks.md
📜 Review details
⏰ Context from checks skipped due to timeout. (10)
- GitHub Check: Test (Windows)
- GitHub Check: Docs
- GitHub Check: Test (macOS)
- GitHub Check: Test
- GitHub Check: Build
- GitHub Check: Build (Windows)
- GitHub Check: Lint (Windows)
- GitHub Check: Lint
- GitHub Check: Criterion
- GitHub Check: Analyze (rust)
🧰 Additional context used
📓 Path-based instructions (6)
**/*
📄 CodeRabbit inference engine (AGENTS.md)
**/*: Non-trivial or multi-file changes should use a dedicated git worktree and new branch; do not modify unrelated user changes, force-push, or push to main.
Ship finished work with a clear Conventional Commit message, a pushed branch, and a draft pull request; never add AI-agent attribution to authored content.
Before investigating unfamiliar failures or third-party behavior, research documented behavior first and distinguish unrelated baseline failures from regressions in the touched surface.
Use structural tools before broad searches: prefercodegraphorarborfor cross-file relationships,indexbefore reading files, targeted reads, parallel calls, andcode_executionfor filtering large outputs.
Files:
specs/007-memory-system-v2/tasks.mdspecs/007-memory-system-v2/plan.mdspecs/007-memory-system-v2/spec.mdsite/docs/content/tools/_index.mdn00n-providers/src/providers/cursor/run.rsn00n-token-profile/baselines/cold_start.jsonn00n-lua/tests/plugin_host.rsplugins/memory/tests/spec.luaplugins/memory/init.luaplugins/memory/memory_helpers.lua
site/docs/**/*
📄 CodeRabbit inference engine (AGENTS.md)
User documentation should be warm, simple, concise, easy for non-native English speakers, story-oriented, and contain no em-dashes, emojis, or AI-like tone.
Files:
site/docs/content/tools/_index.md
**/*.rs
📄 CodeRabbit inference engine (AGENTS.md)
**/*.rs: Workspace Rust lint rules are mandatory: deny unsafe code, productionunwrap_used,expect_used,panic,todo!,unimplemented!,dbg!, wildcard imports, and silent-default error handling.
Do not add unsafe code, FFI, global mutable state,static mut, or unchecked transmute-like behavior without written review and an explicit crate-level lint exception.
Use explicit error handling withResult<T, E>rather than panics; propagate typed errors with?,ok_or_else, andmap_err.
Usethiserrorfor library and domain-specific errors, andcolor-eyreat binary edges.
Do not silently discard errors with.ok(),unwrap_or,unwrap_or_default, or equivalent defaults; return an error, reject the operation, or use an explicitly named fallback with sanitized structured logging.
Follow Rust idioms, use descriptive variable and function names, avoid unnecessary state and bloat, and keep each line justified.
Import types at the top of the file, use short imported names instead of inline qualified paths, and place constants immediately after imports.
Do not use inline magic numbers or strings; deriveCopyonly for structs with one primitive field.
Use structured logging with useful fields and provide helpful, sanitized error messages.
Do not commit credentials, API keys, tokens, cookies, authorization headers, or user data, and do not log raw provider payloads, prompts, credentials, or session data.
Validate and authorize HTTP, file, queue, configuration/environment, LLM output, and provider callbacks before mutation or persistence.
Tool execution requires allowlisted tools, scoped credentials, explicit user context, audit events, and refusal or denial tests.
Write meaningful, non-tautological, non-flaky tests; avoid arbitrary sleeps, and define shared constant error/status messages for assertions.
Files:
n00n-providers/src/providers/cursor/run.rsn00n-lua/tests/plugin_host.rs
**/*.{rs,toml}
📄 CodeRabbit inference engine (AGENTS.md)
All crates must opt into the workspace lint configuration with
[lints] workspace = true; the root workspace lint configuration is authoritative.
Files:
n00n-providers/src/providers/cursor/run.rsn00n-lua/tests/plugin_host.rs
**/*.{rs,ron,json,toml,yaml,yml}
📄 CodeRabbit inference engine (AGENTS.md)
Treat LLM and provider output as untrusted input; validate it against schemas, domain constraints, and source evidence before persistence or action.
Files:
n00n-providers/src/providers/cursor/run.rsn00n-token-profile/baselines/cold_start.jsonn00n-lua/tests/plugin_host.rs
plugins/**/*.lua
📄 CodeRabbit inference engine (AGENTS.md)
Built-in Lua plugins belong under
./pluginsand should use the repository's plugin tooling and conventions.
Files:
plugins/memory/tests/spec.luaplugins/memory/init.luaplugins/memory/memory_helpers.lua
🔇 Additional comments (8)
specs/007-memory-system-v2/plan.md (1)
12-35: LGTM!specs/007-memory-system-v2/spec.md (1)
15-15: LGTM!Also applies to: 50-76
specs/007-memory-system-v2/tasks.md (1)
19-19: LGTM!plugins/memory/memory_helpers.lua (1)
10-36: LGTM!Also applies to: 161-170, 200-200, 261-265, 472-515, 582-586
plugins/memory/init.lua (1)
33-33: LGTM!Also applies to: 122-126, 167-170, 233-235, 252-252, 374-425
plugins/memory/tests/spec.lua (1)
281-303: LGTM!n00n-lua/tests/plugin_host.rs (1)
5931-5984: LGTM!Also applies to: 5986-6013
n00n-token-profile/baselines/cold_start.json (1)
7-25: LGTM!
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_2f6869f8-595c-47a2-b88f-665f55435c38) |
Memory system v2 pushes definitions to ~39.4k; raise the ceiling to 40k so CI's tool_definitions_fit_byte_budget stays green.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_8db3dca4-6f58-473f-8cd8-fc0bd6e5f2b8) |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_df84799f-e3ff-4b8d-81ec-3034bc544224) |
- Update search test to verify ordering with position checks - Document tags as write metadata and search filter in docs - Skip cursor provider security comment (out of scope for memory PR)
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_c206b9bc-11c1-4b82-8b00-f63b348ea878) |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_e01b16e4-f59f-45ed-82cf-f62155bccf41) |
CodeRabbit's docs edit drifted from the memory tool schema source; update the schema description so gen-docs-check stays green.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_6f65d3b3-074e-4a16-b2de-0f953012584a) |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_4c6b6625-a6d7-485e-adc5-bd17e3510d24) |

Summary
searchwith keyword/tag ranking,append, enrichedwrite, and lite-layer session prompt injection with sanitization.specs/007-memory-system-v2/including adversarial review notes and trimmed scope (no paths frontmatter, no telemetry/index cache in v2).Research workflow
Test plan
cargo test -p n00n-lua spec(34 passed, +5 memory cases)cargo test -p n00n-lua memory_tool_(2 integration tests)just gen-docsDeferred (v2.1)
Note
Medium Risk
Untrusted memory content is injected into system prompts after sanitization, and write/merge semantics changed; risk is moderate but bounded by caps and existing path sandboxing.
Overview
Memory tool v2 expands the project scratchpad from view/write/delete into searchable, metadata-rich notes with safer session hints.
New commands and behavior:
searchranks memories by keyword/token overlap and optional tag filters (explicitly not semantic search);appendadds body text while preserving YAML frontmatter.writeaccepts tags, topic, importance, layer (lite/deep), and synopsis; updates merge metadata without wiping omitted fields.viewwithout a path can rank listings via an optionalquery.Helpers and injection:
memory_helpers.luagains frontmatter parse/build, ranking/scoring, lite-hint building with sanitization (caps, injection-pattern stripping), and path-safe listing. Session prompt hints inject capped lite-layer summaries instead of only a file count.Tests and docs: Lua unit tests,
plugin_hostintegration tests for search ranking and append, updated tool docs and cold-start token baselines, and a raised tool-definition byte budget in docgen. Spec artifacts underspecs/007-memory-system-v2/document contracts and deferred v2.1 items (index cache, telemetry).Reviewed by Cursor Bugbot for commit ee00c14. Bugbot is set up for automated code reviews on this repo. Configure here.