Stop Codex saving conversation history to disk: history.persistence and where credentials are stored

Codex Published:

Keep Codex CLI from writing conversation history with history.persistence = "none", cap it with max_bytes, and choose where login credentials live with cli_auth_credentials_store.

Verified on Sep 10, 2026 These tools change quickly. Please also check the latest official documentation.
Contents
  1. Turning off history
  2. Where credentials are stored
  3. Not the same as telemetry
  4. Summary

On a shared machine or a throwaway test environment, two requirements come up: do not leave conversation contents on disk, and do not write login credentials to a file. Codex CLI has a setting for each.

In short: persistence = "none" under [history] stops history being saved, max_bytes caps it, and cli_auth_credentials_store picks file, keyring, or ephemeral for credentials.

KEY POINT

What you will learn

  • The two history.persistence values, the default, and how max_bytes behaves
  • The four values of cli_auth_credentials_store
  • What you give up when you choose not to persist

Turning off history

In ~/.codex/config.toml:

[history]
persistence = "none"
KeyValuesDefaultMeaning
persistencesave-all / nonesave-allnone saves no history
max_bytesbytesunsetover the limit, drop the oldest entries and compact the file

To limit size rather than disable, use max_bytes. The sample configuration shows 5242880 (5 MiB) as a commented example.

[history]
persistence = "save-all"
max_bytes = 104857600 # 100 MiB

When the file exceeds the cap, Codex drops the oldest entries and keeps recent records.

用語解説

History: the local data Codex keeps so past conversations can be reviewed or resumed. With persistence = "none", new conversations are not recorded, so features that recall earlier sessions have nothing to work with.

Where credentials are stored

cli_auth_credentials_store decides where the credentials from a ChatGPT or API-key login are kept.

cli_auth_credentials_store = "keyring"
ValueLocation
auto (default)chosen automatically for the environment
filea file under $CODEX_HOME
keyringthe OS keychain or secret store
ephemeralin process only; gone when Codex exits

On a shared machine, keyring protects credentials per OS account; in disposable environments such as CI, ephemeral leaves nothing behind. MCP server OAuth credentials have their own key, mcp_oauth_credentials_store (auto / file / keyring).

Not persisting means no resume and no auto-login

With persistence = "none" you cannot resume past conversations, and with ephemeral you log in on every launch. Both are trade-offs against convenience, so reserve them for shared machines and test environments where they are really needed.

Not the same as telemetry

History persistence is about what stays on the local disk; whether data is sent to OpenAI is governed by other keys.

KeyDefaultMeaning
analytics.enabledunsetenable or disable analytics
feedback.enabledtrueallow feedback submission via /feedback
otel.exporternoneOpenTelemetry exporter (otlp-http / otlp-grpc)
otel.log_user_promptunsetinclude raw user prompts in OTEL export

How data is used for training is outside the scope of the config file reference used for this article and could not be confirmed here; check the data usage sections of the official Codex documentation.

The overall structure of the config file is covered in the hub article Configuring Codex with config.toml. Keeping secrets out of the commands Codex runs is covered in The shell_environment_policy setting.

Summary

  • [history] persistence = "none" stops history being written; the default is save-all
  • max_bytes caps the file, dropping the oldest entries first
  • cli_auth_credentials_store chooses auto, file, keyring, or ephemeral for credentials
  • none and ephemeral cost you resume and automatic login
  • Local persistence and data sent to OpenAI (analytics, feedback, otel) are separate keys

FAQ

What is the default for history.persistence?
save-all. Set it to none to stop saving history.
Can I keep the history file from growing forever?
Yes. Set history.max_bytes; when the file exceeds it, Codex drops the oldest entries and compacts the file.
Can I avoid writing login credentials to a file?
Set cli_auth_credentials_store to keyring for the OS keychain, or ephemeral to keep them in memory only. The default is auto.

Primary sources

This article was drafted by AI from official documentation and reviewed by the site operator before publishing. Found a mistake? Let us know via the contact page.