Skip to content

LearnTutorials

Make Codex remember your project with Memories

Turn on Codex memories in the ChatGPT desktop app so Codex recalls your stack and habits across chats, with fixed rules in AGENTS.md, in 15 minutes.

By Recaply EditorsIntermediate15 min5 stepsUpdated

A hand slips one more card into an open card file box full of standing cards, with a pencil beside it

What you need

OpenAI lists Memories as limited availability on every plan, so the setting may not show for every account yet.

  1. Step 1: Turn on Codex memories

    2 min

    Local Codex memories are off by default, and the switch works per computer.

    1. Open the ChatGPT desktop app and press Cmd+, on a Mac or Ctrl+, on Windows to open Settings.
    2. Go to Settings > Personalization and turn on Enable Codex memories.
    3. Decide on Allow memories from tool-assisted chats. Turn it on only if chats that use MCP tools or web search should feed memories.
    4. Using the Codex CLI instead? Add the lines below to ~/.codex/config.toml.
    Your config (CLI)
    [features]
    memories = true

    You should see Enable Codex memories switched on for this computer.

    No Enable Codex memories setting?

    OpenAI lists Memories as limited availability, so your account may not have it yet. Until it does, keep your project notes in AGENTS.md, as in step 2.

  2. Step 2: Write the rules that must always apply

    4 min

    Memories help Codex recall things. OpenAI says rules that must always apply belong in AGENTS.md instead.

    1. In your project's root folder, create a file named AGENTS.md.
    2. Paste the template below and fill in your stack, your test command and your rules.
    3. For rules that cover every project, put them in ~/.codex/AGENTS.md instead.
    Your AGENTS.md
    # AGENTS.md
    
    ## Project
    - Stack: [LANGUAGE], [FRAMEWORK], tests with [TEST LIBRARY].
    - Run `[TEST COMMAND]` after every change.
    
    ## Rules
    - Use TypeScript strict mode.
    - Ask before adding a new dependency.
    - Never commit secrets or `.env` files.

    You should see an AGENTS.md file at the root of your project, with your stack and rules in it.

    Codex seems to skip the end of the file?

    Codex stops reading instruction files at 32 KiB in total by default. Keep the file short, or move folder rules into an AGENTS.md in that folder.

    Codex reads AGENTS.md before it starts any work, so these rules apply in every chat.

  3. Step 3: Do real work in the project

    5 min

    Codex builds memories from real chats. It skips short chats and ones that are still running.

    1. In the app, pick Codex, open your project's folder, and start a New chat.
    2. Paste the prompt below, with a real task from your list in place of [YOUR TASK].
    3. Correct Codex in plain words when it gets something wrong. Those corrections are useful context.
    Your prompt
    Look through this project and tell me its language, framework, test command and folder layout in 5 bullet points. Then [YOUR TASK]. Follow AGENTS.md, and run the tests when you're done.

    You should see a 5-point summary of your project, then the task done and the tests run.

    Codex doesn't follow your AGENTS.md rules?

    Check that the file sits in the folder you opened, or in a parent folder up to the Git root. Then start a new chat, since Codex reads it once per run.

    Memories don't update the moment a chat ends. Codex waits until the chat has been idle for a while.

  4. Step 4: Choose what each chat remembers

    2 min

    Some chats should stay out of memory, such as quick experiments or someone else's code.

    1. In any Codex chat, type /memories in the message box.
    2. Choose whether this chat can use the memories you have, and whether it can feed future ones.
    3. Your choice covers this chat only. Your setting in Personalization stays the same.

    You should see the memory choices for the current chat, set the way you want.

    The /memories command isn't there?

    Turn on Enable Codex memories first, as in step 1. In the Codex CLI, add the config lines from step 1 and start a new session.

  5. Step 5: Review what Codex stored

    2 min

    Memories are files on your own computer, so you can check them before you share anything.

    1. Open a terminal and run the command below to list the memory files.
    2. Open a few files and read what Codex kept about your project.
    3. To start over, go to Settings > Personalization and select Delete Codex memories.
    Run this (Mac or Linux)
    ls ~/.codex/memories*

    You should see one or two memory folders, with files that sum up your past chats.

    A memory is wrong or out of date?

    Don't edit the files by hand. Put the correct rule in AGENTS.md so it applies every time, or delete your memories and let Codex rebuild them.

    Codex removes secrets it finds, but OpenAI says to check these files before you share your ~/.codex folder.

You get

Codex that recalls your stack and habits across chats, with the rules that matter fixed in AGENTS.md

Did this guide work for you?

Sources