Codex
Run checks on Ciresk CI from Codex: an AGENTS.md snippet, the MCP entry in ~/.codex/config.toml, a PreToolUse hook and codex exec recipes.
The contract is the same as for Claude Code: the CLI from the shell, the MCP tools through the cell's endpoint. See How it works.
Instructions
Append this to the repository's AGENTS.md. The nearest AGENTS.md wins in a monorepo, the same rule the manifest follows.
## Build and test commands (Ciresk CI)
ciresk ci check # the repository's check, remote, the exit code is the result
ciresk ci test -p <crate> # tests for one crate or package, remote, failing tests listed first
ciresk ci tests <job> # failing tests with file:line and the first message lines
ciresk ci summary $CIRESK_JOB --json # structured verdict for the last job
## Testing instructions
Run `ciresk ci check` before finishing and before any `git push`; a non-zero exit is a failure. Read the
summary, then the `next` command it prints; never ask for a whole log. Exit 3 (auth), 4 (policy) and
5 (budget) are not code failures: stop and report them. Quote the job id and the summary as evidence.MCP
Merge this into ~/.codex/config.toml: OAuth, a prompt before run and job_cancel, and the 8,000-token output cap on the tools that return a summary. Log in once with codex mcp login ciresk; no key or token goes into the file.
[mcp_servers.ciresk]
url = "https://ci.eu.ciresk.com/v1/ci/mcp"
auth = "oauth"
oauth_resource = "https://ci.eu.ciresk.com/v1/ci/mcp"
startup_timeout_sec = 10
tool_timeout_sec = 60
default_tools_approval_mode = "writes"
[mcp_servers.ciresk.tools.run]
approval_mode = "prompt"
output_token_limit = 8000
[mcp_servers.ciresk.tools.job_cancel]
approval_mode = "prompt"
[mcp_servers.ciresk.tools.job_wait]
approval_mode = "auto"
output_token_limit = 8000
[mcp_servers.ciresk.tools.job_summary]
approval_mode = "auto"
output_token_limit = 8000
[mcp_servers.ciresk.tools.job_logs]
approval_mode = "auto"
output_token_limit = 8000The tools are run, job_summary, job_logs, job_tests, job_warnings, job_artifacts, job_wait, job_cancel and jobs_list; job_wait blocks up to 45 s per call by default and 55 s at most, so tool_timeout_sec stays above it. See How it works. Codex detects as agent:codex in the job's actor; set CIRESK_SESSION to attribute a session.
codex exec
Non-interactive runs get the same exit codes and the same bounded output, so one prompt is enough:
codex exec "Run 'ciresk ci check'. If the exit code is not 0, read the summary, run the 'next' command it
prints, make the minimal fix, re-run 'ciresk ci check' and stop when it exits 0. Quote the job id."Wrap a long job in two commands rather than one shell call that outlives the tool timeout: ciresk ci run test --json (prints the job id, exits 0 when queued), then ciresk ci wait <job>.
In a GitHub Actions follow-up, the summary-path artifact of the GitHub Action is the input:
codex exec --json "The file ciresk-summary.json is the Ciresk CI result of the failing run. Read
data.failing_tests and data.tail, fix the cause, verify with 'ciresk ci test' and leave the diff uncommitted."codex exec --json emits one JSONL event per tool call, including item.mcp_tool_call for the Ciresk tools.
Gating a push
Codex hooks read the same PreToolUse payload as Claude Code, so the Claude Code hook script serves both: it denies cargo test, cargo clippy, workspace-wide builds and pnpm test with the ciresk ci command that replaces them, and makes git push and gh pr create wait for a green ciresk ci check. Copy tools/ci/integrations/claude-code/hooks/ciresk-check.sh to .codex/hooks/ and tools/ci/integrations/codex/hooks.json to .codex/hooks.json in your repository, then run /hooks once in Codex to trust it. Both files are in the Ciresk source repository, which is not public yet, and the installer does not ship them, so outside Ciresk they are not available today; the git pre-push hook below is printed in full on its page. The script needs jq and bash (Git Bash on Windows); CIRESK_CI_SKIP=1 skips it while set. The git pre-push hook in Hooks that gate a push works as well.
Start the watcher for the session
Run ciresk ci watch in a background shell at session start so every check is one request to queued; a script that cannot keep a process runs ciresk ci watch --once --json right before the check.