openclaw: auto-recall query keeps host markers ([media attached: <path>], inter-session and external-content wrappers), so image-only turns recall on a file path

Aperta Adatta ai principianti
#7,022 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
ai, backend

Direzione di ricerca

Inizia da extractRecallQuery() e dall’helper adiacente stripRuntimeEnvelope() in hindsight-integrations/openclaw/src/index.ts, poi segui la selezione della query nell’handler before_prompt_build. Controlla le funzioni esportate con gli esempi di contenuti multimediali, tra sessioni e di contenuti esterni presenti nell’issue. Il lavoro è terminato quando i turni composti solo da contenuti multimediali non producono query di testo e gli altri marcatori vengono rimossi o ridotti al loro testo interno.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

integration:openclaw
Bug Description

The OpenClaw integration builds the auto-recall query with extractRecallQuery(). That function strips sender metadata envelopes, the runtime envelope and inline timestamp prefixes, but not the other markers OpenClaw puts into the user message:

  • [media attached: /local/path/file.jpg (image/jpeg) | /local/path/file.jpg], and the [media attached N/M: …] / [media attached: N files] forms, added for every inbound photo, document or voice note;
  • [Inter-session message] sourceSession=… sourceTool=…, added when one session sends a message to another;
  • <<<EXTERNAL_UNTRUSTED_CONTENT id="…">>> … <<<END_EXTERNAL_UNTRUSTED_CONTENT …>>>, the wrapper around web, email and webhook content.

isEphemeralOperationalText() does not classify these either, so they go to /recall as the query, cut to recallMaxQueryChars (800 by default).

On a busy personal assistant over one week, 15% of all auto-recall queries started with a [media attached: <absolute local path> line, and about 4% more started with an inter-session or external-content wrapper. For an image-only message the whole query is a file path, so the injected memories are effectively random. With a caption, the path takes a large part of the 800-character budget and dilutes both the embedding and the keyword terms.

Those numbers were measured on 1.2.0, which built the query from the assembled prompt. 1.2.1 switched to currentUserMessage (#6515), but that does not remove the media marker: on OpenClaw 2026.11.8, currentUserMessage is the recorded user turn, and the host prepends the media note to that turn as well. The cleaning functions are byte-identical between 1.2.0 and main.

Steps to Reproduce
  1. OpenClaw 2026.11.x with @vectorize-io/hindsight-openclaw, autoRecall: true.
  2. Send the agent a photo without a caption on any channel that supports media.
  3. Check the query the API receives (server INFO log Starting recall for query: …), or call the exported functions directly:
import { extractRecallQuery, isEphemeralOperationalText } from "@vectorize-io/hindsight-openclaw";
const q = extractRecallQuery("[media attached: /home/user/.openclaw/media/inbound/abc.jpg (image/jpeg) | /home/user/.openclaw/media/inbound/abc.jpg]", undefined);
console.log(q, isEphemeralOperationalText(q)); // the full marker line, false

The same happens with "[Inter-session message] sourceSession=agent:main:other sourceTool=sessions_send\nStatus report" and with a text wrapped in <<<EXTERNAL_UNTRUSTED_CONTENT …>>> markers.

Expected Behavior
  • Media markers are removed from the query. An image-only turn has no text query and skips recall, or recalls on the caption only.
  • Inter-session and external-content wrappers are reduced to their inner text, or the turn is treated as operational, the same way the runtime envelope is handled.
Actual Behavior

The marker lines are sent verbatim as the recall query, including absolute local file paths.

Version
  • Hindsight API 1.3.0
  • @vectorize-io/hindsight-openclaw 1.2.0 when measured; the cleaning functions are unchanged in 1.2.3 (= main at c828c7e)
  • OpenClaw 2026.11.8
LLM Provider

Not relevant (client-side query construction).

Suspected code location

hindsight-integrations/openclaw/src/index.ts: extractRecallQuery() (line 1122), stripMetadataEnvelopes() (line 1041), stripRuntimeEnvelope() (line 1101), isEphemeralOperationalText() (line 1656), and the query selection in the before_prompt_build handler (lines 2907-2911). A small stripHostMarkers() step next to stripRuntimeEnvelope() would cover it.

Parity: the Hermes integration got recall_query_strip_patterns in #6886. A built-in strip for these three OpenClaw markers, or the same configurable option, would bring the OpenClaw integration in line. The retain transcript probably carries the same markers; that is a separate question and not part of this report.

Lingua principale
Python
Stelle
45.2k
Fork
5.9k
Merge medio
5h 46m
PR unite (30g)
389

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di vectorize-io/hindsight

Tutte le issue di vectorize-io/hindsight

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.