| phase | requirements |
|---|---|
| title | Codex Adapter in @ai-devkit/agent-manager - Requirements |
| feature | codex-adapter-agent-manager-package |
| description | Add a Codex adapter to the shared agent-manager package and wire CLI consumption through package exports |
@ai-devkit/agent-manager currently ships ClaudeCodeAdapter as the only concrete adapter, while AgentType already includes codex. As a result, Codex sessions are not detected/listed/opened through the shared package flow used by CLI agent commands.
Who is affected:
- Users running Codex alongside other supported agents who expect
ai-devkit agent list/opento include Codex - CLI maintainers who want adapter support centralized in
@ai-devkit/agent-manager - Contributors who need a reference implementation for adding new adapters
- Implement a package-level
CodexAdapterunderpackages/agent-manager - Export
CodexAdapterfrom package public entry points - Update CLI agent command wiring to register
CodexAdapterthrough package imports - Preserve existing behavior for Claude and existing output/error contracts
- Reuse shared process/file utilities and adapter contract patterns
- Add tests for Codex adapter discovery, status mapping, and command metadata
- Establish a clean extension path for future adapters (Gemini/others)
- Keep Codex adapter internals maintainable via small helper functions without changing runtime behavior
- Reworking overall
ai-devkit agentUX - Refactoring unrelated CLI command modules
- Introducing a new plugin system for adapters in this phase
- As a Codex user, I want running Codex sessions to appear in
ai-devkit agent listso I can inspect active work quickly. - As a CLI user, I want
ai-devkit agent open <id>to support Codex agents with the same behavior guarantees as existing agents. - As a maintainer, I want Codex detection logic in
@ai-devkit/agent-managerso package/CLI behavior does not drift. - As an adapter author, I want Codex adapter tests to act as a template for future adapter implementations.
packages/agent-manager/src/adapters/CodexAdapter.tsexists and implementsAgentAdapter@ai-devkit/agent-managerpublic exports includeCodexAdapterpackages/cli/src/commands/agent.tsregistersCodexAdapterfrom package exports- Unit tests cover Codex adapter happy path, empty/no-session path, and invalid data handling
- Existing agent command tests continue to pass without regressions
- Implementation remains readable enough for future adapter extension work (clear matching phases/helpers)
- Must follow existing Nx TypeScript project structure and test setup
- Must keep adapter contract compatibility (
AgentAdapter,AgentInfo,AgentStatus) - Must not break JSON/table output schema consumed by users
- Codex session metadata is available in
~/.codex/sessions/YYYY/MM/DD/*.jsonlwith a stable first-linesession_metapayload TerminalFocusManagercan open Codex sessions using command metadata supplied by adapter or existing CLI flow- Codex naming and workspace path conventions are stable enough for first-pass implementation
- Resolved (2026-02-26): Canonical discovery source is
~/.codex/sessionsJSONL files. In 88/88 sampled files, line 1 istype=session_metawithpayload.id,payload.cwd, andpayload.timestamp. - Resolved (2026-02-26): Running
codexprocess list is the source of truth for whether an agent is listed.- Session tail events such as
task_completeandturn_aborteddo not hide an agent when the process is still running.
- Session tail events such as
- Resolved (2026-02-26): Session matching uses process start time (
now - etime) againstsession_meta.timestampwith a configurable tolerance window constant. - Resolved (2026-02-26): For long-lived processes, session scan includes process-start day window in addition to bounded recent-file scanning.
- Resolved (2026-02-26): Use the same status threshold values across all adapters (Codex uses existing shared/Claude-equivalent thresholds).
- Resolved (2026-02-26): If
cwdis missing, fallback display identifier iscodex-<session-id-prefix>.