Skip to content
Back to skills

Rule Codex Adapter

ASecurity

The codex CLI adapter — app-server per conversation, steering, stop grace, turn fencing. A repository rule for apps/daemon/src/v1/agents/adapters/codex/**; read it before editing a file there.

  • 8 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added November 9, 2026
ai-agentsgoshellnode

Works with

  • terminal
  • cli
  • mcp

Security analysis

A100/100

Scanned November 26, 2026

npx -y skills add geniro-io/geniro-app --skill rule-codex-adapter --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Rule Codex Adapter?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Rule Codex Adapter
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/geniro-io-rule-codex-adapter/badge)](https://www.skillsdirectory.com/skills/geniro-io-rule-codex-adapter)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: rule-codex-adapter
description: "The codex CLI adapter — app-server per conversation, steering, stop grace, turn fencing. A repository rule for apps/daemon/src/v1/agents/adapters/codex/**; read it before editing a file there."
---
<!-- GENERATED by scripts/sync-agent-rules.mjs from .claude/rules/codex-adapter.md. DO NOT EDIT: edit the source, then run `pnpm sync:agent-rules`. -->

# The codex adapter

codex (`codex app-server`, one process per conversation):

- Every turn sends its full approval, sandbox, model and effort (codex keeps overrides).
- A refused `turn/steer` of a message with a row (`deliveryId`) is `follow_up_dropped` carrying codex's words as `reason` (`unsentReason` on the row), so the row reads not sent and says why. codex can answer a steer after `turn/completed`, so the turn's ending is HELD while a steer is unanswered (`CODEX_STEER_ANSWER_GRACE_MS`, released early by the answer or a Stop): the drop then lands ahead of the terminal, as every owner's matching needs. A refusal past the grace, or of a message with no row, posts a notice quoting the message.
- An ACCEPTED steer is only queued: codex takes it as a `userMessage` item at its next step, and an interrupt that lands first discards it with no item and no trace in the thread (probed on 0.162.0). So a steer counts as delivered only once that item arrives; a turn that ends `interrupted` or `failed` without it reports `follow_up_dropped`, and so does the process ending (`onProcessEnded`). Because a chat's Stop closes the session in the same tick, the driver asks for `closeGraceMs` (`CODEX_STOP_CLOSE_GRACE_MS`) while a steer's fate is unknown: `spawn-cli`'s `close()` lets the stopped turn finish first (~15 ms) and signals the group at its settle or the deadline.
- geniro's MCP endpoint rides the thread config as ONE dotted key `mcp_servers.<name>` (keeps the user's servers), token in `http_headers`.
- Every thread config switches codex's own question tools off (`CODEX_USER_INPUT_TOOLS_KEY`), so a question goes through geniro's `ask_user_question` card. From 0.169.0 a model whose catalog lists `send_user_message_async` also gets `request_user_input_async` outside plan mode: it answers `{"accepted":true}`, raises no server request and waits for a later user message, so a question asked with it reaches no card. The one key also removes the plan-mode `request_user_input`; no `features.*` toggle reaches either.
- codex runs the user's own `PermissionRequest` hooks BEFORE it raises an approval, however long they take (a blocking one held every MCP call 65 s, measured on 0.165.0). So a turn with an approval mode (`auto` included: a live process is re-moded, never respawned) asks `hooks/list` before `thread/start` / `thread/resume`, after `config/read` when that runs, and switches off each enabled `permissionRequest` hook in the thread config (`hooks.state` → `<key>.enabled = false`, `utils/codex-hooks.utils.ts`); an administrator's managed hook (`isManaged`) stays on, the user's other hooks still run, and their files are not written. geniro's card is the one approver, so an `acceptEdits` file change inside `cwd`, which the driver accepts with no card, passes no PermissionRequest hook either (the thread's config is fixed at its opening, so the hooks cannot stay on for that mode alone). A refused listing opens the thread without it and says so in a notice.
- `acceptEdits` auto-accepts a file change only if every path and move target is inside `cwd` by `utils/write-containment.ts` (both readings) and has no other hard links; anything else is a card.
- Context window joins `sessionKey`.
- Fast mode is the model parameter `service_tier`, listed per model from `model/list`'s `serviceTiers` and sent as `turn/start`'s `serviceTierForTurn` (`utils/codex-service-tier.utils.ts`), a `-c` override on `codex exec`. Never `serviceTier` on the thread: it sticks, across a `thread/resume` too, so a thread would stay Fast after the setting is cleared and in the user's own `codex resume` (measured on 0.166.0). A turn at Fast is priced at `CODEX_FAST_PRICE_FACTOR` × list; the sub-agents' spend stays at list, since nothing says which tier they ran on.
- One process holds a thread: a refused resume (`active writer`) retries ~2.5s, then FAILS naming the holder. Never start a fresh thread there (it would replace the run's session).
- MCP listing is a dialogue over an ephemeral thread. Never `codex mcp list --json`. Only servers in the user `config.toml` get a switch, and the built-in `codex_apps`, switched by `features.apps`.
- While a `wait` collab call (codex's own wait on its sub-agents) is open the driver announces the turn held (`turn_held` with the receivers' count), so the composer sends straight in and a team root stops counting in `rootsWorking`; `open: 0` follows `CODEX_WAIT_GAP_GRACE_MS` after the last wait returns, or at once when the agent writes reply text, takes a message, or the turn ends; a next wait keeps the hold.
- Sub-agent spend (`CodexSubagentSpend`) is folded into the turn that ends and marked billed; stopped/failed turns carry usage on `turn_cancelled` / `error`.
- Every command codex runs is a unit of work keyed by its item id (`CodexSession.commandUnits`): from `item/started` one the agent waits on (`background_work` started, `foreground`), so it is recorded from its first moment. One codex holds in its process store (its item carries `processId`) is moved to the background (`backgrounded`: shell rows, `shellsOpen`) only when its turn ends `completed` or `failed` with it still running, since codex ends a turn without waiting on it, and settled when codex completes its item, under the old turn's id and usually with no turn open (measured on 0.162.0); a one-shot one (no `processId`) is settled with a stopped or failed turn, and one still open at a completed ending (waiting on its card) runs on as late work. A failed turn leaves such a command's call open, and its real result is written when it ends. That late result carries `endsBackgroundWork`, so it never restates a settled run: read as work, it latched a finished chat on `running` (measured). A Stop ends the turn's own (below), each staying a unit until its completion. A sub-agent's command is its delegate's own (`ownedByDelegate`: recorded, no shell row, keeps the process from being reaped); one in the process store is moved to the background when the sub-agent's turn ends, on any ending, and only then counts as left running in a close's note. Only events, as codex's own TUI does; the background-terminal listing is not polled.
- A COMPLETED turn is not fenced (`endedTurns` holds stopped and failed ones), so the result of a call still open when it completed, or of one codex starts after it, arrives as ordinary work on a settled run — measured on 0.162.0 with a call held past `turn/completed`, which left the chat `running` until Stop. The session records those calls (`CodexSession.lateToolItems`, from `turn/completed` on, held ending included) and emits `late_work_ended` after the last one's result, on whichever driver it reaches. codex reports nothing while a command keeps running, and under unified exec (on by default in 0.162.0) every command carries a `processId` from its start, one-shot or not (measured), so only time tells a dev server from a `touch`: a late command still running `CODEX_LATE_COMMAND_BACKGROUND_MS` (30 s, codex's maximum exec yield) after it began is moved to the background (`leftRunning`, a `backgrounded` unit) and stops holding the late work open. The window runs on awake time, does not count while the command's approval card waits (stopped when its request is parked, restarted by an allow), and is dropped when the process ends.
- `turn/interrupt` does not end a running command (by design since codex PR #14602): it reports later under the stopped turn's id, often after the next turn opened on the kept process (team nodes and callees; a chat's Stop closes the process). So a stopped turn ends its OWN still-running `commandExecution` items through the experimental `thread/backgroundTerminals/list` + `terminate` (matched by `itemId`; never an earlier turn's background terminal, never `clean`), and says so in a warning notice when one could not be ended. This applies to every interrupt of a kept codex process — the user's Stop and a caller's `cancel_agent` alike — and to any step still running at that moment, a server the turn itself launched included. A stopped or failed turn closes its open tool calls at `turn/completed` and joins `CodexSession.endedTurns`; an item, delta or plan frame naming such a turn does session bookkeeping only (items map, sub-agent tracking and its open/close rows), never text, tool or plan rows. Usage readings, errors and reroutes still pass.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.