feat: add OpenAI Codex CLI agent support#337
Open
rohithreddy1095 wants to merge 1 commit intoentireio:mainfrom
Open
feat: add OpenAI Codex CLI agent support#337rohithreddy1095 wants to merge 1 commit intoentireio:mainfrom
rohithreddy1095 wants to merge 1 commit intoentireio:mainfrom
Conversation
9712328 to
09b2822
Compare
Implement full agent plugin for OpenAI Codex CLI, including: - Agent interface implementation (codex.go) with session management - Hook support via Codex notify config in ~/.codex/config.toml - JSONL transcript parsing with user/assistant/tool extraction - Token usage calculation from cumulative token_count events - Modified file detection via exec_command heuristics - Turn-complete hook handler for checkpoint creation - Comprehensive unit tests (46 tests across 3 test files) - Exhaustive switch coverage for AgentTypeCodex in summarize - Codex hook removal in removeAgentHooks (setup.go) Codex CLI uses a single notify hook (agent-turn-complete) rather than separate before/after hooks, so the handler combines state capture and commit in one pass.
09b2822 to
44572f8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Agentinterface (13 methods) plus optionalHookSupport,HookHandler,TranscriptAnalyzer, andTranscriptChunkerinterfacesclaudecodeandgeminiclipackagesMotivation
Developers increasingly use multiple AI coding agents (Claude Code, Gemini CLI, Codex CLI) in the same repository. Currently Entire only tracks Claude Code and Gemini CLI sessions. This PR adds Codex CLI support so that all three agents' sessions are tracked with unified checkpoint creation.
Implementation Details
New Files
codexcli/types.gocodexcli/codex.goinit()self-registration, session resolution via date-based directory tree, JSONL transcript I/Ocodexcli/hooks.go~/.codex/config.toml(TOML string manipulation)codexcli/transcript.goexec_commandcalls, token usage calculationcodexcli/codex_test.gocodexcli/hooks_test.gocodexcli/transcript_test.gohooks_codexcli_handlers.gohandleCodexTurnComplete()— session dir setup, metadata extraction, strategy-based commitModified Files
registry.goAgentNameCodexandAgentTypeCodexconstantshook_registry.gohooks_cmd.gosummarize/summarize.goAgentTypeCodexto exhaustive switchsetup.goremoveAgentHooks()Key Design Decisions
notify(agent-turn-complete), so the handler combines state capture + commit in one pass (unlike Claude's 7 hooks or Gemini's 10 hooks)~/.codex/config.tomlwith anotifyarray, handled via string manipulation (no new TOML dependency)exec_commandwith shell commands instead of structured tools. Detection is heuristic-based (handlesapply_patchdiffs,cat >,sed -i, etc.)~/.codex/sessions/<year>/<month>/<day>/rollout-<date>-<uuid>.jsonlTest plan
go build ./...passesgo vet ./...passesgolangci-lintpasses (0 issues across entire project)gofmtcleanentire enable --agent codexinstalls notify hook in~/.codex/config.tomlentire enable --agent codexis idempotent (detects already installed)entire disable --uninstallremoves Codex notify hook and preserves other config