GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — V2: relevance recall finds matches but project memories are never injected into context (recall=relevant) · Issue #524 · tickernelz/opencode-mem

V2: relevance recall finds matches but project memories are never injected into context (recall=relevant) #524

New issue
Copy link
New issue
Copy link
Backlog
#528
Backlog
V2: relevance recall finds matches but project memories are never injected into context (recall=relevant)#524
#528
Copy link

Description

@junior-xj97-chan
junior-xj97-chan
opened on Nov 26, 2026
Issue body actions

Summary

With chatMessage.recall = "relevant" and injectProfile = true, the injected <memory_context> contains only <user_profile> — no <project_knowledge> and no project memories at all. The same query returns plenty of relevant memories through both the Web UI search API and the memory MCP tool, so the retrieval side is working; the results just never reach the injected context.

This is reproducible on the current versions and was not fixed by either OpenCode v2.4.2 or opencode-mem v2.44.0.

Environment

  • OpenCode Desktop v2.4.2 (Windows), restarted after the update
  • opencode-mem v2.44.0, Node v24.22.3
  • memoryBackend: "database"

Relevant config:

"injectProfile": true,
"chatMessage": {
  "enabled": true,
  "maxMemories": 5,
  "excludeCurrentSession": true,
  "injectOn": "first",
  "recall": "relevant",
  "recallScope": "project",
  "similarityThreshold": 0.45,
  "filterInjectedPrompts": true,
  "captureChildSessions": false
},
"memory": { "defaultScope": "project" }

Observed

  • Web UI → Daily activity → last 14 days: profileInjections roughly equals captures + skipped every day, while compactionInjections is 0 except one day (2). There is no counter for per-message project-memory injection.
  • The actual injected block for the session contains only <user_profile>. It also lacks the Retrieval scores are ranking signals... sentence that formatContextForPrompt adds only when at least one scored memory is present (dist/services/context.js:40-42), so the injected memory array is empty.

Diagnostics performed (read-only, no source changes)

  1. The query text is correct. The first prompt of the session was saved to user_prompts at 08:21:42.556 with content 目前mem 跳过捕获的原因是否正常; the profile inject log line is at 08:21:42.775. getLatestPromptTextForSession therefore had the real user text.
  2. No fallback/error path was taken. There are no memory recall: no query text or memory recall: semantic search failed, falling back to recent entries in opencode-mem.log, and log() writes unconditionally (dist/services/logger.js:143-161). So loadRecallMemories ran a real semantic search successfully.
  3. Session exclusion is not the cause. The relevant old memories have session_id values of old sessions or NULL (verified directly in the shard), so filterRecallResults cannot drop them via excludeCurrentSession.
  4. The threshold is not the cause. I re-implemented searchInShard exactly (content vector + tags vector + keyword hybrid scoring from dist/services/turso/vector-search.js:84-173) against a hot copy of the shard (.db + -wal + -shm), using the same query, threshold 0.45, and the same excludeCurrentSession rule. Result: 12 results above threshold, 9 remaining after excluding the current session. Top old matches:
    • mem_1793420343984_rk1qeia44 — 0.490 (session_not_found root cause)
    • mem_1793680512540_ukly5qpvd — 0.488 (capture quality diagnosis)
    • mem_1791434811585_c54d6xom9 — 0.471 (version upgrade notes)
  5. The V2 injection hook itself appears functional. dist/v2/adapter.js:125-179 calls memoryContext.load() on prompt, caches it, and pushes it into event.system on context. The profile block arrives through that exact same push, so the hook pipeline is delivering content — the payload itself contains no project memories.

Expected

At least some of the 9 relevant memories should appear in <project_knowledge> for that turn.

What upstream may need to check

I could not determine, without instrumenting the plugin, whether loadRecallMemoriesForSession is returning an empty array or whether the non-empty result is lost before formatContextForPrompt receives it. A debug log inside loadRecallMemories printing queryText, similarityThreshold, scope, raw result count and post-filter count would settle it. I deliberately did not patch dist, per the project's no-local-source-change policy.

Note: the manual memory tool path works fine — with technical keywords it returns 8 relevant results — so this appears specific to the automatic injection path.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.