CLI (headless/exec): synchronously generate memories for a specific session

Open 💬 3 comments Opened Jun 22, 2026 by mstrap

What variant of Codex are you using?

CLI / headless (codex exec)

What feature would you like to see?

A headless/non-interactive way to generate memories for a specific saved session and return only after the memory has been written locally.

Examples:

  • codex memory generate <SESSION_ID>
  • codex memory generate --last
  • codex exec resume <SESSION_ID> --generate-memories --wait

This is not a request for arbitrary memory writes. It is a request for a CLI/headless surface over the existing memory-generation pipeline,
targeted at one known session.

### What problem is this solving?

Today I can make sessions memory-eligible, but in headless/exec workflows I cannot tell Codex: "generate memories from this exact session now,
and do not return until they are written."

For automation, background or deferred generation is not sufficient. I need a deterministic completion point where the session has been processed
and the memory files are already on disk. For example, after a headless run I may want to archive or copy the full Codex state/config area and know
that the generated memories are included.

### What would make this usable?

At minimum:

  • accept a session ID, plus --last
  • work in headless / codex exec workflows
  • execute extraction immediately, not just enqueue it
  • return only after memory files are written locally
  • exit non-zero on failure
  • report generated or skipped
  • include skip reasons such as session still active, memories disabled, external context excluded, rate limit, or already processed

Additional information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗