What
Auto-memory is the notes Claude Code writes for itself to remember things between sessions. Pinned memory is memory marked to always be included. Both are now cleaned before Claude sees them.
- When memory files of type
AutoMemandAutoMemPinnedare loaded, line endings are normalised:\r\n,\u2028and\u2029all become\n. Control and formatting characters also appear to be removed. Before, onlyAutoMemgot this treatment, and pinned content was used exactly as read. - If cleaning changes a file, Claude Code notes that the content differs from what is on disk and keeps the original text alongside it.
AutoMementries and<pinned-memory>blocks are now escaped before they go into the prompt. A backslash is placed after the<of anything that looks like an opening tag, so memory text cannot open or close the tags Claude Code uses to structure the prompt. Before, the content was only trimmed.
Why
Memory written automatically can pick up hidden characters or text that looks like instructions or tags. Cleaning and escaping it keeps such content from changing how the rest of the prompt is read.
Something disagreesSomething we can check disagrees with this entry, or the writer said they could not settle it.
The writer flagged doubt
Exactly which characters are removed is not settled.