Yes, but it depends on which Codex client you are using and what you mean by “retrieve.”

Codex CLI (terminal)

Codex CLI stores full conversation logs locally per workspace/session. You can:

  • Use built‑in resume commands to reopen a past session with its full scrollback:
    • codex resume to pick a session from a selector. api.xabcnews
    • codex resume --last to reopen the most recent session. inventivehq
    • codex resume <session-id> to jump to a specific session. api.xabcnews
  • Read the raw history directly from the JSONL log files:
    • Sessions are typically stored under ~/.codex/sessions/<workspace>/<session-id>.jsonl. npmjs
    • Each line is one message/entry, so you can process it with jq, cat, less, or a script to reconstruct the entire prompter ↔ model conversation. ehrigite

Within a single Codex CLI session, the TUI itself only shows as much as the terminal allows, but the JSONL log holds the complete history, including tool calls and intermediate responses. npmjs

VS Code Codex extension

The VS Code extension also persists chats, but the UI support is weaker:

  • Conversation histories are saved in a sessions directory on disk (e.g. under a .codex or similar sessions folder), and the CLI codex resume can show previous sessions even if the extension UI does not surface them well. reddit
  • There is ongoing feature work/requests to expose persistent, searchable session history directly in the extension; currently this is more limited than the CLI. github

In practice, if you want the entire history, it is more reliable to read the underlying JSONL files than to rely on the extension’s panel scrollback. reddit

Third‑party viewers and bridges

Because Codex logs are just local JSONL, several tools wrap them:

  • @nogataka/codex-viewer provides a web UI that reads from ~/.codex/sessions/... and shows full, formatted conversation history (code highlighting, tool usage, etc.). npmjs
  • “Codex Bridge” is an MCP server that exposes Codex session history so other agents/IDEs (Claude Code, Cursor, Windsurf) can search/read your past Codex conversations. mcpmarket

These do not change what Codex stores; they just give you nicer ways to retrieve and browse the complete logs. mcpmarket

Limitations and caveats

  • If Codex never wrote the transcript (e.g. crash before save or an input that failed entirely), that part of the conversation is unrecoverable. reddit
  • There is currently no official “/chat list” or fully‑featured session manager in the CLI that enumerates and manages all chats like a UI chat app; history is there on disk but management is somewhat primitive. github
  • Some setups prune or rotate older logs; if a file is gone, Codex itself cannot reconstruct it. news.ycombinator

If you tell me whether you are primarily using Codex from the CLI or from the VS Code extension, I can give you exact commands/paths to dump and reconstruct the full conversation into a single markdown or text file.

is it possible to replace the “base_instructions” in codex manually?

Yes, Codex explicitly supports replacing the built‑in base_instructions with your own, via config, and the replacement is wholesale rather than additive. github

How Codex handles base_instructions

The Codex core reads a “model instructions” file at startup and uses that as the system prompt layer (what the repo calls base_instructions). github In the Rust implementation, the config loader reads the file you point to and replaces the default base_instructions with its contents; it does not merge or append by default. github

The default instructions live in the repo at codex-rs/protocol/src/prompts/base_instructions/default.md, and they define the “you are a coding agent running in the Codex CLI…” behavior plus a bunch of guardrails and tool semantics. github

How to override with your own file

You can point Codex to a different instructions file in your .codex/config.toml:

# ~/.codex/config.toml or .codex/config.toml in a repo
model_instructions_file = "../soul.md"

This tells Codex to read ../soul.md and use it as the entire system prompt/base instructions for that profile/context. reddit Practically, this means Codex will behave as defined by your file for all sessions using that config (e.g., personal assistant, infra copilot, exploit‑dev copilot, etc.). kirill-markin

Some Codex docs and blog posts also discuss “Profiles” in config.toml, which let you associate different instruction files to different named profiles, so you can switch roles without editing the file each time. blakecrosley

Caveats and best practices

  • Because this is a full replacement, you can easily break the tight integration with Codex CLI (slash‑commands, tool calling, etc.) if you remove key behavioral instructions from the default file. reddit
  • A common pattern is to start from the official default.md, copy it into your own file, and then customize sections (e.g., emphasizing refactoring style, security posture, etc.) instead of writing from scratch. latent
  • Some authors recommend against completely discarding the defaults, as they encode assumptions the CLI relies on, especially around how the model reports actions and respects tools. latent

If you describe the kind of behavior shift you want (e.g., “security‑first codegen,” “FinOps optimization advisor”), I can sketch a minimal soul.md that preserves Codex’s operational bits but strongly biases the agent toward your domain.