Skip to content

fix(memory): keep short pattern terms out of raw JSON metadata columns - #152

Open
DevMello wants to merge 38 commits into
MemTensor:mainfrom
DevMello:fix/pattern-terms-json-noise
Open

fix(memory): keep short pattern terms out of raw JSON metadata columns#152
DevMello wants to merge 38 commits into
MemTensor:mainfrom
DevMello:fix/pattern-terms-json-noise

Conversation

@DevMello

@DevMello DevMello commented Aug 5, 2026

Copy link
Copy Markdown

Any query with a two-char token ("ts", "js", "id") matches almost every memory. FTS only indexes terms of 3+ chars, so short tokens go to the pattern channel, which LIKE-matches them against raw properties_json/info_json. Every trace row carries the JSON key "ts", so "fix ts build error" matched every trace, and the rank rewrite put the newest one at score 1.0, above the real hits.

Fix: short ASCII terms now only match id, memory_key, memory_value and tags. Longer terms and CJK bigrams can't collide with JSON keys and still match metadata values.

Verify: cd Memory && npx vitest run tests/repository/memory-retrieval-index.test.ts. The test fails on v1.0.5 and passes with this change.

Wang-Daoji and others added 30 commits July 30, 2026 01:10
fix: unify cross-agent action backgrounds
fix: simplify memory tool call headings
feat(memory): commit episode routing on turn complete
fix(memory): separate retrieval content and validate L3 evidence
fix(memory): finalize episode rewards and processing
feat(memory): link related memory details
…emTensor#139)

Co-authored-by: antalike <>
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat: merge pkg shell

* feat: merge pkg shell

* feat: merge pkg shell

* feat: merge pkg shell
fix(backend): share scan permission per installation
fix(backend): refine onboarding permissions and actions
fix: surface structured quota exhaustion errors
feat(memory): add time-filtered trace recall
jiang and others added 8 commits August 4, 2026 16:10
feat: trust Codex hooks and reveal account identifiers
…faults (MemTensor#7)

loadConfig() caught YAML parse and schema validation errors, logged a
console.warn, and returned a fresh default Config. Any onboarded settings
(including BYOK provider credentials) were silently discarded and the CLI
kept running against defaults with no non-zero exit, contradicting the
project's fail-loud philosophy.

Throw a new ConfigError (ConfigLoadError for bad YAML/schema, EnvValueError
for missing env var references, both now exported) when the config file
exists but is invalid. A missing config file still returns the defaults
unchanged, since first-run `memmy onboard` depends on that path. The CLI
entrypoint (main.ts) catches ConfigError specifically and prints a concise
`memmy: <reason>` message with a non-zero exit code instead of an unhandled
stack trace; other entrypoints (serve/gateway route through the same CLI
main(), and the frontend-bridge/websocket HTTP layer already has generic
catch blocks that turn thrown errors into clean error responses).
…allback (MemTensor#9)

MemmyMemoryHook.beforeRun/afterRun/sessionStart/sessionEnd caught every
connection error from the memory service and only recorded it on an
unread `lastError` field, so an unreachable service (e.g. default
http://127.0.0.1:18960 down) degraded completely silently: no CLI/log
warning, and the LLM turn context received neither a recall block nor
any notice, indistinguishable from "memory checked, found nothing".
This contradicted the README's fail-loud promise and drove agents to
silently fall back to the local MEMORY.md/history.jsonl store.

- Replace the blanket try/catch with per-phase handling that emits a
  deduped console.warn (once per session, reset on recovery) and
  injects an honest <memmy_memory_status status="unavailable"> notice
  into the user message so the model is told memory wasn't checked,
  instead of implying nothing relevant was found.
- Drop the stale in-flight turn entry on a failed beforeRun so afterRun
  doesn't try to complete a turn that was never opened server-side.
- Document the new status tag in the memory context protocol prompt.

Failures still never crash the turn (fail-loud, not fail-crash).
MemTensor#148)

Keep params.user_id for event dimensions while also exposing userId alongside clientId so the cloud proxy can filter and map GA4 user identity.

Co-authored-by: antalike <>
Co-authored-by: Cursor <cursoragent@cursor.com>
Two-char tokens like "ts" skip FTS and hit the pattern channel, which
LIKE-matched them against raw properties_json/info_json. Every trace
carries the JSON key "ts", so unrelated recent memories outranked real
hits. Short ASCII terms now only match id, key, value and tags; longer
terms and CJK bigrams keep their metadata reach.
@syzsunshine219
syzsunshine219 changed the base branch from v1.0.5 to main August 6, 2026 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants