Skip to content

Add official OpenAI Codex support #406

Closed

Description

@Krzysztof318

Problem

Remember currently targets Claude Code only. The plugin exposes only a
.claude-plugin manifest, its hooks rely on Claude-specific environment and
session metadata, and the summarization path invokes claude -p.

OpenAI Codex now supports plugins, hooks, persistent interactive sessions,
resuming sessions by ID, and repository/user-scoped skills. Codex users cannot
install Remember as a working Codex plugin or use the same layered daily-log,
handoff, consolidation, worktree-sharing, and optional backup workflow.

Proposed solution

Add official Codex support while keeping the existing memory format and
pipeline host-neutral:

  • provide a .codex-plugin/plugin.json manifest and make the DPT marketplace
    expose remember@dpt-plugins to codex plugin add;
  • map Codex lifecycle events to the existing session-start, prompt/turn, tool,
    and session-end pipeline boundaries;
  • derive project, worktree, session, and transcript identity from Codex-native
    metadata rather than CLAUDE_* variables;
  • summarize without requiring an authenticated Claude CLI, using a Codex-native
    execution path or a documented provider adapter;
  • preserve the current git-common-dir behavior so all worktrees of one
    repository share one memory store;
  • add contract tests covering install, recall, save, resume, worktrees, and
    concurrent Codex sessions.

The same installed plugin should remain safe when Claude Code and Codex use the
same external Remember store on one machine.

Alternatives considered

  • Codex native memories: useful and already available, but they do not
    expose Remember's layered daily logs, explicit /remember workflow,
    consolidation pipeline, worktree identity, or optional Git backup contract.
  • A local compatibility wrapper: could translate Codex sessions into the
    current scripts, but it would duplicate host integration outside the project
    and drift from Remember releases.
  • Installing the current Claude plugin in Codex: the Codex marketplace does
    not currently discover it as an available plugin, and the implementation
    still depends on Claude-specific hooks, environment variables, transcript
    assumptions, and claude -p.

Additional context

Codex documents stable plugin marketplace commands and stable interactive
session resume support. Its local session JSONL includes a durable session ID,
working directory, and turn lifecycle events, which appear sufficient for an
adapter without changing Remember's stored memory schema.

Activity

  1. fdaviddpt commented on Aug 28, 2026

    @fdaviddpt
    Contributor

    Thanks for the detailed write-up. I checked the premise against OpenAI's own docs rather than taking it from the issue, and it holds — with one correction that makes this considerably smaller than proposed, and two problems the issue understates.

    What I verified

    Confirmed against Package your plugin and Hooks:

    • .codex-plugin/plugin.json is the manifest, and a plugin may bundle skills/, hooks/hooks.json, and .mcp.json. Marketplaces register via codex plugin marketplace add owner/repo, catalogued in .agents/plugins/marketplace.json.
    • The hook event set is SessionStart, SessionEnd, UserPromptSubmit, PreToolUse, PostToolUse, PermissionRequest, PreCompact, PostCompact, SubagentStart, SubagentStop, Stop — the same names Remember already binds.
    • SessionStart stdin carries session_id, cwd, transcript_path, and source with values startup / resume / clear / compact. SessionEnd carries session_id, cwd, transcript_path, reason.
    • Non-interactive execution exists: codex exec, with --json emitting a JSONL event stream, and codex exec resume <SESSION_ID>.

    The correction

    Codex exposes CLAUDE_PLUGIN_ROOT and CLAUDE_PLUGIN_DATA to hook processes as explicit compatibility aliases. That retires one of the two large numbers in this repo on its own: 223 of the ~560 CLAUDE_* references are CLAUDE_PLUGIN_ROOT, and they need no change at all.

    The remaining 273 are CLAUDE_PROJECT_DIR, which is not in the compatibility list — but they are not 273 sites of work either. It is read from the environment in exactly one place, scripts/resolve-paths.sh:121, and re-exported at line 195; everything downstream consumes the already-resolved PROJECT_DIR. Codex supplies cwd on hook stdin, so this is one fallback branch in one file.

    So the host coupling is three seams, not a rewrite:

    1. Project root — scripts/resolve-paths.sh:121. Add a stdin-cwd fallback beneath the CLAUDE_PROJECT_DIR branch.
    2. Transcript location — pipeline/extract.py:_session_dir() reconstructs <config>/projects/<slug>/<session_id>.jsonl. Codex keeps flat rollout files under ~/.codex/sessions/ and, more usefully, hands the exact path over as transcript_path. Remember's hooks do not currently read that field on either host. Consuming it where it is offered and keeping reconstruction as the fallback is a strict improvement for Claude Code too, independent of this issue.
    3. Summarizer — pipeline/haiku.py shells claude -p. codex exec is the counterpart.

    What the issue understates

    The summarizer is the hard part, and contract tests will not catch it failing. Swapping claude -p for codex exec is a small diff. Validating it is not: every prompt under prompts/ was tuned against one model's behaviour, and the consolidation output is prose, not a schema. A test suite covering "install, recall, save, resume, worktrees, concurrent sessions" passes green while the summaries quietly become useless. Whatever this turns into needs a way to judge summary quality, not just pipeline liveness.

    Two hosts sharing one store is a new concurrency contract. lib-lock.sh and lib-staging-lock.sh exist, but they were written against a single host's session model and its assumptions about session-ID shape and lifecycle ordering. "Safe when Claude Code and Codex use the same store" is the sentence in this issue that carries the most unproven weight, and it deserves its own issue with its own tests rather than a bullet in a larger one.

    Suggested split

    Seams 1 and 2 are worth landing on their own merit — reading transcript_path when the host offers it is a correctness improvement for the current host. I would rather ship those as ordinary refactors than as Codex scaffolding, so they get reviewed on what they do rather than on a roadmap.

    • A. Read cwd and transcript_path from hook stdin; keep today's derivation as fallback. Host-neutral, no Codex dependency.
    • B. Extract the summarizer behind a provider interface, with claude -p as the only implementation. Pure refactor.
    • C. codex exec provider + a means of judging summary quality. The real work.
    • D. .codex-plugin/plugin.json, marketplace entry, lifecycle wiring. Small once A–C land.
    • E. Cross-host store concurrency: contract and tests. Independent, and the one I would not ship without.

    Accepted in principle, scoped as above. If you want to take any of these, A is self-contained and a good first one.

  2. fdaviddpt commented on Aug 28, 2026

    @fdaviddpt
    Contributor

    Follow-up, because a third host changes the shape of this.

    Gemini CLI

    Gemini CLI also ships hooks — default-on since v0.26.0 — with extensions declared in gemini-extension.json, hooks bundled at hooks/hooks.json, and gemini extensions install <github-url|path>. Sources: hooks, hooks reference, extension reference.

    Its event names do not follow Claude's: BeforeTool, AfterTool, BeforeAgent, AfterAgent, BeforeModel, AfterModel, BeforeToolSelection, PreCompress, Notification, alongside SessionStart and SessionEnd. Codex copying Claude's vocabulary was a deliberate compatibility choice, not an emerging industry convention.

    But the stdin payload is the same in all three:

    {"session_id", "transcript_path", "cwd", "hook_event_name", "timestamp"}

    SessionStart.source is startup|resume|clear — Codex adds compact. SessionEnd.reason is exit|clear|logout|prompt_input_exit|other, richer than Codex's always-other.

    And Gemini documents no environment variables for command hooks. No plugin root, no project dir, no compatibility alias.

    What that changes

    The CLAUDE_PLUGIN_ROOT alias I leaned on above is worth less than I implied. It is a courtesy Codex chose to extend and can withdraw in any release, and on the third host there is no equivalent to extend. The env-var route is the parochial one; the stdin contract is the part three vendors arrived at independently.

    So the portable seam is not something this project needs to invent. It already exists, and Remember already touches it: session-start-hook.sh:124 captures HOOK_STDIN and _stdin_json_string() at line 144 extracts session_id (#206) and source (#339) from it. Two fields of a payload carrying four we want.

    That is now #407, filed on its own merits rather than as Codex scaffolding — reading a path the host handed us beats reconstructing it on Claude Code today, and the Windows slug history in #263 is the evidence.

    It also sharpens what remains here. Remember is far less Claude-coupled at the hook boundary than this issue's framing suggests: the resolver reads each env var at exactly one site, and the transcript path is offered to us and ignored. The coupling that is real, and that no shared contract dissolves, is pipeline/haiku.py shelling claude -p. Three CLIs means three auth models, three output shapes, and three sets of prose behaviour that every prompt under prompts/ was tuned against. Still the hard part, and still not something to abstract from one implementation.

    Scope of this issue now

    Keeping this as the Codex epic rather than sharding it — B, C and D below have no justification that does not point back here, and E cannot be started until C lands:

    • B. Summarizer behind a provider interface. Extract during C, from two real implementations, not before from one.
    • C. codex exec provider, plus a way to judge summary quality. A green contract suite passes while summaries quietly become useless.
    • D. .codex-plugin/plugin.json, marketplace entry, lifecycle wiring.
    • E. Cross-host store concurrency contract and tests. Promote to its own issue the moment C merges — that is when it becomes both startable and the thing most likely to get skipped.

    Gemini support is not proposed here and is not planned. It is in this comment as evidence about which seam is portable, nothing more.

  3. added
    enhancement
    on Aug 28, 2026
  4. added
    cohort-3
    on Aug 29, 2026
  5. fdaviddpt commented on Sep 1, 2026

    @fdaviddpt
    Contributor

    Closing this: B, C and D landed in v0.24.0, and the two things that were left over are now on the board as their own issues rather than as unfinished bullets inside a closed epic.

    Against the split in my second comment, verified at f3232bd on 2026-09-01

    • A. Read cwd and transcript_path from hook stdin. Landed -- it was split out as Read cwd and transcript_path from hook stdin instead of deriving them #407 and shipped, with tests/test_codex_hook_transcript_465.py, tests/test_codex_transcript_path_459.py and tests/test_codex_stdin_session_id_468.py behind it.
    • B. Summarizer behind a provider interface. Landed, and extracted the way that comment asked for it -- during C, from two real implementations. pipeline/haiku.py now has _resolve_summarizer_provider / _choose_summarizer_provider over _call_codex and the Claude path, with REMEMBER_SUMMARIZER as the selector and auto deciding from the host signature.
    • C. codex exec provider. The provider half landed, verified against codex-cli 0.150.1. The other half did not -- see below.
    • D. .codex-plugin/plugin.json, marketplace entry, lifecycle wiring. Landed, pinned by tests/test_codex_manifest_410.py.
    • E. Cross-host store concurrency. Not started, and now startable.

    The two carve-outs

    #492 -- C shipped without the means of judging summary quality that this issue said had to come with it. The 10 tests in tests/test_summarizer_routing_460.py are all about routing and liveness; the only assertion made about what a summary says is that it is non-empty. That is the failure this issue predicted in as many words, so it is filed rather than left as a bullet.

    #491 -- "safe when Claude Code and Codex share one store" is still the unproven sentence. scripts/lib-lock.sh and scripts/lib-staging-lock.sh contain neither the string codex nor host, and no test puts two hosts against one store. My comment said to promote this the moment C merged, on the grounds that it is the thing most likely to get skipped; C merged, so here it is.

    Gemini CLI is still not proposed and not planned. #456 tracks it separately as its own request.

    @Krzysztof318 -- thanks for the write-up. Your premise held up against the vendor docs; what changed was the size, and the stdin contract you pointed at turned out to be the portable seam for the whole thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cohort-3enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions