Tools and features

Memory pipelineNew

Full reference

Local Codex/ChatGPT memories carry useful information from earlier sessions into later ones. A background pipeline extracts session summaries, consolidates durable context, and supplies a memory summary with retrieval instructions to the working agent. The source defines separate model defaults for extraction and consolidation.

This explanation is pinned to the mapped Codex CLI 0.162.0-alpha.2 source, commit 74e804d. Source defaults describe this build; provider overrides, configuration and account availability can change actual execution. ChatGPT web and ChatGPT Work use separate memory settings and do not use this local store. See OpenAI's memory documentation.

From a session to future context

Eligible prior sessions
        ↓
Extraction · GPT-5.6 Luna by default
        ↓
Session summaries and, in v1, raw memories
        ↓
Consolidation · GPT-5.6 Terra by default
        ↓
Durable memory files and memory_summary.md
        ↓
Summary plus reading instructions in a later session
        ↓
Working agent retrieves supporting evidence when relevant

Extraction

The startup task selects eligible prior sessions and runs per-session extraction jobs. The extraction prompt asks for information that can help future work, rather than a transcript of everything that happened. The v1 output contract contains rollout_summary, rollout_slug and raw_memory; v2 returns the summary and slug without a raw-memory field. Generated fields pass through secret redaction.

Read the exact stage-one system prompt, input template, and v2 system prompt. The implementation is in phase1.rs and phase1_output.rs.

Consolidation

The consolidation agent integrates extracted information with existing memory and extension inputs. In v1, raw_memories.md and rollout_summaries/ support a searchable MEMORY.md, a compact memory_summary.md, and reusable skills where useful. The prompt distinguishes initial creation from incremental updates and asks the agent to remove claims supported only by deleted sources.

The v2 consolidation prompt focuses on memory_summary.md, with direct pointers to supplied rollout summaries. It tells the agent to preserve project scope, distinguish observed results from proposals, avoid inventing preferences, and treat memory and note content as data. It also forbids opening original rollout transcripts during consolidation.

Read the v1 consolidation prompt, v2 consolidation prompt, and extension instructions. phase2.rs configures the consolidation agent and its workspace.

Retrieval in a later session

When memory use is enabled and a nonempty summary exists, the memory extension contributes developer context containing reading instructions and memory_summary.md. The working agent follows that summary's routes to more detailed evidence when the task calls for it. The v1 reading prompt describes a progression from the injected summary to MEMORY.md, then relevant rollout summaries or skills. Both reading variants require verification of consequential or changeable facts and citations for memory actually used.

Read the v1 reading instructions and v2 reading instructions. Source: extension.rs and prompts.rs.

Model defaults and overrides

Operation Source default Configuration override
Per-session extraction gpt-5.6-luna memories.extract_model
Global consolidation gpt-5.6-terra memories.consolidation_model

These constants and the provider override methods are defined in model-provider/src/provider.rs. Extraction and consolidation first check their respective configuration overrides before using the provider's preferred model.

This source does not establish GPT-6 Luna as a third memory stage for writing titles and descriptions. A model observed in another background task needs a verified call site before it can be assigned a role in this pipeline. Retrieval happens in the working session; the source does not define a third fixed retrieval model here.

When memory runs

The startup implementation starts asynchronous work for eligible root sessions. It skips ephemeral sessions, disabled memory features and non-root agents, requires the memory state database, and checks the remaining-rate-limit guard before extraction and consolidation. Candidate selection also applies idle-time, age and per-pass limits. Ending a chat does not mean its memory is immediately available.

Control What it changes
features.memories Enables the memory subsystem; off by default in the mapped configuration.
memories.generate_memories Whether newly created threads can become generation inputs.
memories.use_memories Whether existing memories are injected into sessions.
memories.disable_on_external_context Can exclude threads that used external context, including MCP or web search.
memories.min_rollout_idle_hours How long a candidate thread must have been idle.
memories.max_rollout_age_days How old candidate threads may be.
memories.max_rollouts_per_startup Bounds candidates processed in a startup pass.
memories.max_unused_days Retention eligibility for unused memories.
memories.min_rate_limit_remaining_percent Guards background generation when remaining allowance is low.
memories.version Selects v1 or v2; v1 is the mapped default.
memories.dual_write Generates both versions while the selected version supplies context.

Memory generation, memory use and persistent mode are distinct mechanisms. Persistent mode controls continued pursuit of a goal; the memory pipeline selects and carries context across sessions. This page describes public source and prompt evidence, without publishing personal memory contents or inferring activation for a particular account.