CLAUDE_CODE_POST_TURN_MEMORY_CONFIG
Updated by Alex Sorokoletov
CLAUDE_CODE_POST_TURN_MEMORY_CONFIG is a Claude Code environment variable: Holds the JSON configuration for the post-turn memory pass, including the instruction, how many turns between runs, maximum turns, idle-flush timing and prose gating; the pass is off when it is missing or invalid. Added between v2.1.266 and v2.1.269 and still present in v2.1.332. It is not in the official reference.
| Status | Present in v2.1.332 |
|---|---|
| Added | Added between v2.1.266 and v2.1.269 |
| Category | Memory and CLAUDE.md |
| Official docs | Not listed |
How to set it
For one session, export it in the shell that starts Claude Code:
export CLAUDE_CODE_POST_TURN_MEMORY_CONFIG=<value>
claudeTo apply it to every session, add it to the env object of a settings file:
// ~/.claude/settings.json
{
"env": {
"CLAUDE_CODE_POST_TURN_MEMORY_CONFIG": "<value>"
}
}Related variables
CLAUDE_CODE_POST_TURN_MEMORY_SYNC: When set, runs the post-turn memory pass synchronously: once every turn and with no idle-flush delay, overriding the interval and idle timing from the config.CLAUDE_CODE_POST_TURN_MEMORYCLAUDE_BG_MEMORY_TOGGLED_OFF: When set to 1 in a background session, turns memory off for that session.CLAUDE_CODE_DISABLE_AUTO_MEMORY: Disable automatic memory (MEMORY.md).CLAUDE_CODE_DISABLE_MEMORY_BULK_INFLATE: When set, skips the bulk inflate that exports the whole memory store at once, so it is not attempted.CLAUDE_CODE_DISABLE_MEMORY_MASS_DELETE_HOLD: When set, disables the hold that guards against deleting a large share of memory entries at once; the deletion threshold becomes unbounded instead of max(50, 10% of entries).CLAUDE_CODE_DISABLE_MEMORY_PERIODIC_RESYNC: When set, disables the periodic memory store resync by returning a zero interval; otherwise it defaults to 60 minutes, minimum 1.CLAUDE_CODE_DISABLE_MEMORY_RO_UNSAVED_NOTICE: Set to skip the scan that warns about unsaved writes in read-only memory mounts; read until v2.1.307.
Frequently asked questions
What does CLAUDE_CODE_POST_TURN_MEMORY_CONFIG do?
Holds the JSON configuration for the post-turn memory pass, including the instruction, how many turns between runs, maximum turns, idle-flush timing and prose gating; the pass is off when it is missing or invalid.
Which Claude Code version has CLAUDE_CODE_POST_TURN_MEMORY_CONFIG?
Added between v2.1.266 and v2.1.269 and still present in v2.1.332.
How do I set CLAUDE_CODE_POST_TURN_MEMORY_CONFIG?
Export it before starting Claude Code (export CLAUDE_CODE_POST_TURN_MEMORY_CONFIG=value), or add it to the "env" object in ~/.claude/settings.json to apply it to every session.
All variables, searchable: Claude Code environment variables.