Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

Memory reviewer loses what the principal typed when a pasted image or skill body sits between it and the reply

Open IvanLeontev-stack opened this issue 2 months ago • 1 comments

What happens. extractRecentExchanges in LIFEOS/TOOLS/MemoryReviewer.ts pairs a user event with the assistant event right after it and skips every earlier user event. When the principal types a message and pastes a screenshot, the transcript holds two user events: the typed text (promptSource: "typed"), then a harness line [Image: source: /path/to/image.png]. Only the second one is paired, so the reviewer prompt shows the image path labelled as the principal and never sees what he typed. The same happens when a skill body (Base directory for this skill: ...) or a second queued message sits between his words and the reply.

Measured on one install's local transcripts (186 interactive sessions, all exchanges): 1143 exchanges carry the principal's own words; 76 of them (6.6%) never reach the reviewer prompt. 51 are lost to a pasted-image path, 23 to a skill body. Version 7.40.4 and main today behave the same.

Repro (three transcript lines):

{"type":"user","promptSource":"typed","message":{"role":"user","content":"I moved to Lisbon last week, remember that."}}
{"type":"user","message":{"role":"user","content":[{"type":"text","text":"[Image: source: /tmp/screenshot.png]"}]}}
{"type":"assistant","message":{"role":"assistant","content":[{"type":"text","text":"Noted."}]}}

buildReviewerUserPrompt(extractRecentExchanges(path, 5)) contains the image path and not "Lisbon".

One possible fix (what I run locally): while walking forward, keep the principal's own words from every user event since the last pair (promptSource typed / queued / suggestion_accepted, or the args of a slash command), and render those when the paired user text does not contain them. Every other exchange renders byte for byte as today; locally 95 of 1143 exchanges change, all of them ones with carried words.

IvanLeontev-stack avatar Sep 25 '26 16:09 IvanLeontev-stack

Thanks @IvanLeontev-stack, and for measuring the loss rate. Confirmed: only the user event right before the reply was paired, so a pasted image or skill body hid what the principal typed. Every user event since the last reply now belongs to the exchange (LIFEOS/TOOLS/MemoryReviewer.ts), with your repro as a test. Next release carries it.

danielmiessler avatar Oct 03 '26 04:10 danielmiessler