{"version":"2.1.269","anchor":"new-cli-env-var-and-control-for-post-turn-memory","canonical_anchor":"new-cli-env-var-and-control-for-post-turn-memory","heading":"New post-turn memory feature with configurable extraction","tier":"use","area":"Memory","scope":null,"heads_up":null,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.269\/e\/new-cli-env-var-and-control-for-post-turn-memory","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.269","markdown":"### New post-turn memory feature with configurable extraction\n\nA new post-turn memory feature can extract memories via an MCP server instead of writing files, controlled by new env vars\n\n**Unclear.** What post-turn memory actually does when triggered (what it writes or where) is not described in the finding.\n\n**What**\n\n- Three new environment variables control a new \"post-turn memory\" feature: `CLAUDE_CODE_POST_TURN_MEMORY` turns it on, `CLAUDE_CODE_POST_TURN_MEMORY_CONFIG` carries a JSON config (`instruction`, `every_n_turns` from 1-100 default 5, `max_turns` from 1-8 default 4, `idle_flush_s` from 0-86400 default 120), and `CLAUDE_CODE_POST_TURN_MEMORY_SYNC` forces synchronous flushing (`everyNTurns=1`, `idleFlushSeconds=0`).\n\n- The background memory-extraction task now supports a second mode, `mcp`, driven by these same env vars: instead of writing memory files, it calls a query using the configured instruction and supports idle-flush timers.\n\n- Extraction activity is now logged to a new `ccr_memory_extract` event set that records the mode (`mcp` vs `file`), instead of only the previous `memory_extract` event.\n\n**Why** This lets memory extraction run through an MCP-based memory server rather than always writing local memory files, with configurable frequency, turn limits, and idle-flush timing, and gives clearer telemetry on which mode was used.\n\n- Area: Memory\n- Tier: Use it now\n- Useful: 5\/5\n- Signal: 4\/5"}