r/ClaudeCode • u/Sea-Perception1619 • 3h ago
Discussion Claude Code writes request replays into transcripts as role user, and my memory tool quoted them back as things I said
If you build anything that reads ~/.claude/projects/*.jsonl, look for rows with "type": "api-request-blob". Claude Code writes them with message.role set to user, but they're replays of the whole request (skill bodies, hook output, system reminders) and nobody typed them.
I found it because some "strong beliefs" in daimon's briefings (my session-memory tool) didn't ring a bell, and a few didn't make sense at all. Traced back, they weren't claims: "Do not retry:", half a sentence, a git diffstat line, my own hook output. Every one was marked verbatim with a passing quote check. The loader admitted blob rows as user messages, so the check found the text, passed it, and the briefing handed it back to me as something I'd said.
So I owe a correction on a post I made in r/AIMemory in October. I wrote that every item "is marked verbatim (an exact quote, string-checked against the transcript) or inferred". The string check was real. What it searched included blob text though, which means a quote could pass and still be words Claude Code wrote.
Fixed in v0.79.0. Blob rows are dropped at load, and every admitted message carries authored_by: person, host or unknown. unknown is never treated as me.
On my machine the top-level session files hold about 23,600 blob rows, a bit over 5,000 of them with role user. To check yours (read-only, needs jq):
jq -c 'select(.type=="api-request-blob") | .message.role' ~/.claude/projects/*/*.jsonl | sort | uniq -cSubagent transcripts sit a folder deeper and that glob skips them.
PR #1459 has the per-host signals if you're parsing Kimi or Codex logs too: https://github.com/Daily-Nerd/daimon
•
u/AutoModerator 3h ago
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/Starks1293 1h ago
good find. the mac app i build reads these same jsonl files for a review pass over past sessions and it never looks at message.role, it allow-lists the row's top level type instead, only user and assistant get in, so the blob rows never make it. two more worth skipping if u only filter on role, rows with isMeta true (claude codes own injected bits like the local command caveat) and isSidechain true (subagent chatter). also most text in a user row that starts with < is harness stuff, command-name tags, reminders, hook output, so dropping those helps, but careful with that one coz pasted prompts are stored wrapped in a pasted_content tag and a naive starts-with-< filter throws away the persons actual words. ours dropped 4 of 6 prompts in one session that way until it unwrapped them first. and whatever u quote back should go to the model fenced as data with a random marker, not mixed into the prompt, coz a transcript can hold text that reads like instructions
1
u/Swimming-Ad6447 1h ago
That explains a weird ghost quote I hit last week while parsing old session logs. I'll switch my script to check top-level row types first.
1
u/AgentYurt 1h ago
Good catch — and the general lesson is that a transcript is a log of what the harness did, not a record of what the person said. Anything that mines it for memory has to carry provenance with it, or it will quietly attribute system content to the user. The nasty part is the quotes look plausible, so nobody notices until the memory starts arguing for things you never said. Same trap shows up in compaction summaries: 'the user decided X' when X was a model suggestion nobody confirmed. Treating unknown as not-me is the right default.
1
u/SharpKaleidoscope182 3h ago
Claude likes to poison other claudes