Minion Task: Implement the issue You are a coding agent executing a task autonomously.…
- User
Minion Task: Implement the issue
You are a coding agent executing a task autonomously. Complete the task in a single session without human interaction.
Issue
Add Codex CLI agent integration
Description
Extend Partio's agent detection to recognise OpenAI Codex CLI (
codex) as a supported AI agent alongside the existing Claude Code integration.Partio currently only detects Claude Code via process inspection (
internal/agent/claude/). Theagent.Detectorinterface is already designed to be pluggable, so adding Codex CLI follows the same pattern.What to implement
- Add a
codexpackage underinternal/agent/codex/with process detection and aDetectorimplementation - Register the detector in the detection chain alongside Claude Code
- Update
partio statusto reportcodexas the agent name when detected - Table-driven unit tests for process detection
Why this matters
Codex CLI is a widely used AI coding agent. Users who run Codex to write code and then commit should have those sessions captured by Partio. Without this, Codex-assisted commits are attributed as 100% human work and no session context is preserved.
Source
Inspired by entireio/cli PR#772 and changelog 0.5.2 which added Codex CLI agent integration.
Task
Read the issue provided as context and implement exactly what it describes.
Follow existing code patterns and conventions. Read the relevant code before making changes. Keep changes minimal — implement what the issue asks for, nothing more.
After implementation, run the appropriate checks (
make test,make lint) and fix any failures.Target Repos
You are working in a multi-repo workspace:
cli/— Go CLI (build:make lint && make test)
Your working directory is the repo root.
Acceptance Criteria
You MUST satisfy ALL of the following before finishing:
- All changes match what the issue describes
- make test passes
- make lint passes
- PR description clearly explains what changed and why
- Commit messages are meaningful and describe the change
cli/CLAUDE.md
code - Add a
Assistant
I'll start by understanding the existing code structure, particularly the agent detection interface and Claude Code implementation.
Assistant
Now let me read the key files directly to understand the exact code patterns.
Assistant
Let me also read the hooks runner and config files to understand how config flows to detection.
Assistant
Let me check the Claude test files for patterns, and see what files exist under internal/agent/claude/.
Assistant
Let me read the remaining Claude-specific files to understand what methods I need on the codex detector.
Assistant
Now I have a complete understanding of the codebase. Let me implement the codex integration.
Assistant
Now create the tests.
Assistant
Now add the detector resolver and update the hooks.
Assistant
Now update the hooks to use the resolver. First precommit.go:
Assistant
Now update postcommit.go:
Assistant
Need to add the
agentimport to postcommit.go:Assistant
Now update the config env.go to support
PARTIO_AGENT:Assistant
Now let me run the tests and lint:
Assistant
All tests pass. Now run lint:
Assistant
All tests pass and lint is clean. Let me verify the final state of the changed files:
Assistant
Everything passes. Let me now commit and create the PR.
Assistant
All done. PR created at partio-io/cli#153.
What changed
-
internal/agent/codex/— New package withDetectorimplementation mirroring the Claude pattern:codex.go: struct +Name()returning"codex"process.go:IsRunning()viapgrep -f codexfind_session_dir.go:FindSessionDir()looking for~/.codex/- Tests: interface compliance, pgrep output parsing, session dir discovery
-
internal/hooks/resolve.go—resolveDetector(name)factory that returns the appropriate detector based on config -
internal/hooks/precommit.go— Uses resolver; Claude-specific JSONL session checks guarded behind type assertions; non-Claude agents (codex) are marked active when the process is running -
internal/hooks/postcommit.go— Uses resolver; Claude-specific session parsing only runs for Claude detectors -
internal/config/env.go— AddedPARTIO_AGENTenv var support (was documented but not implemented)
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.