CLI (headless/exec): synchronously generate memories for a specific session
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 --lastcodex 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 execworkflows - execute extraction immediately, not just enqueue it
- return only after memory files are written locally
- exit non-zero on failure
- report
generatedorskipped - include skip reasons such as
session still active,memories disabled,external context excluded,rate limit, oralready processed
Additional information
_No response_
3 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I think this is related to #29318, but not a duplicate.
#29318 is asking for a broader centralized memory consolidation flow, including collecting session data from many temporary/headless machines and consolidating/distributing memory centrally.
This issue is narrower: a CLI/headless way to target one specific saved session (or
--last) and block until that session's memories have been written locally.So the key requirement here is session-scoped synchronous local completion semantics, not a centralized memory service.
This looks like a useful primitive not only for headless automation, but also for reliable cross-session memory workflows.
One possible addition would be a structured, session-scoped
MemoryGenerationReceiptinstead of relying only on human-readable stdout:session_idgenerated | skipped | failedreason_codeThis would provide:
--waitSuggested acceptance cases:
I would be happy to help refine the data model and test matrix, and contribute an implementation if the maintainers invite a PR.