mirror of
https://github.com/Pasta-Devs/Marinara-Agents.git
synced 2026-12-03 18:55:07 +07:00
[GH-ISSUE #1302] [Issue]: Long-Term Memory embeds recall queries as documents #662
Labels
No labels
agent: chess
agent: conversation-calls
agent: eightball
agent: haptic
agent: hierarchical-maps
agent: hierarchical-maps
agent: illustrator
agent: poker
agent: rock-paper-scissors
agent: tic-tac-toe
agent: uno
artifacts
bug
bugfix
build
catalog
ci
client
dependencies
docs
documentation
enhancement
feature
fixed-in-staging
in-pr
normal-scope
packages
pull-request
qol
regression
roadmap
scope-risk
server
soup
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Agents#662
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Promansis on GitHub (Oct 11, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1302
Originally assigned to: @Promansis on GitHub.
Summary
Long-Term Memory embeds the recall search query through the same path as indexed chunks and never marks it as a query. With E5, nomic-embed-text or Snowflake Arctic Embed v2 models, the query gets the document prefix, which weakens semantic recall in every language. This is the package half of Pasta-Devs/Marinara-Engine#7429.
Affected package
long-term-memory(Long-Term Memory) 1.4.23Expected behavior
The recall query is embedded with input type
"query"and indexed chunks with"document", so the Engine applies the right prefix for the model.Actual behavior
PackageEmbeddingAdapter.embed(texts, signal?)has no input-type parameter ([package-runtime.ts L109-L113](https://github.com/Pasta-Devs/Marinara-Agents/blob/11c8a563e7ef33b03442909814366f11330e1aad/packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/package-runtime.ts#L109-L113)).embedLongTermMemoryTextscallsadapter.embed(batch, options.signal)([embedding-adapter.ts L24 and L35](https://github.com/Pasta-Devs/Marinara-Agents/blob/11c8a563e7ef33b03442909814366f11330e1aad/packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/embedding-adapter.ts#L24-L35)).[query]through that same function (retrieval.ts L213),```` exactly as rebuild does for chunks (rebuild.ts L135).`````Steps to reproduce
intfloat/multilingual-e5-large, ornomic-embed-texton Ollama. LTM uses the default connection, or the one set with Connections → apply to all agents.passage:(search_document:for nomic) instead ofquery:(search_query:).Environment
stagingatecd62a2e4678d82fae753dd19f0f15cfbe48bba0)stagingat11c8a563e7ef33b03442909814366f11330e1aad)Logs, screenshots, or video
No logs, because the wrong prefix fails silently. Code references are above.
Additional context
Minimal fix
package-runtime.ts:embed(texts: string[], signal?: AbortSignal, inputType?: "query" | "document"): Promise<number[][] | null>;embedding-adapter.ts: addinputType?: "query" | "document"toMemoryRecallEmbeddingOptions, and calladapter.embed(batch, options.signal, options.inputType)at both call sites.retrieval.tsL213:embedLongTermMemoryTexts([query], { ...input, embeddingAdapter, inputType: "query" }).rebuild.tsL135 can stay as it is, since the default is document, or passinputType: "document"explicitly.spaceIdchange and no reindex. Stored vectors are already document embeddings.capabilityApibump. Older Engines ignore the third positional argument. The fix takes effect on Engines that include Pasta-Devs/Marinara-Engine#7429. Keep it positional, not an options object: older Engines hand the second argument toAbortSignal.any, so an object there would throw.tests/long-term-memory-runtime.regression.ts: a fake adapter records its third argument. Recall should send"query", rebuild should send"document"(orundefined), andspaceIdshould stay unchanged.Who is affected
snowflake-arctic-embedv2 model IDs.Related
Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked: