CppDepend AI
OpenAI Codex CLI
Codex reads AGENTS.md, so cppdepend-ai init is all the setup it needs (the Claude-specific files are ignored).
Setup
cd my-cpp-repo
cppdepend-ai init
cppdepend-ai analyze --run --project MyApp.cdproj
codex
Codex builds its instructions from AGENTS.md files from the repository root down to the working directory; files closer to the working directory take precedence. The CppDepend block written by init is in the root AGENTS.md.
Sandbox and approvals
Codex runs shell commands in a sandbox. CppDepend.AI needs:
| Need | Why |
|---|---|
| Write access to the repository | analyze writes cppdependai/ |
Permission to run cppdepend-ai and read the CppDepend folder |
cppdepend-ai runs from the CppDepend installation, which it needs to load |
The right command in AGENTS.md |
run init --exe "<full path to cppdepend-ai.exe>" so Codex never has to guess the path |
Tip: start with write access to the workspace and approval on request, run the commands once, then allow the cppdepend-ai prefix when Codex offers it.
Read-only commands (status, explain, query, gate, reading the JSON files) work without write access once a snapshot exists. If analyze --run fails inside the sandbox, run it yourself outside and let Codex read the result.
Typical requests
Using CppDepend (see AGENTS.md), review my uncommitted change and list new Critical or High issues with file:line.
Which type in cppdependai/hotspots.json should I refactor first? Show cppdepend-ai explain for it.
Fix the issues of rule <ruleId> in src/net/, then re-run cppdepend-ai analyze --run and confirm the ids are gone.
Non-interactive: codex exec "Run cppdepend-ai gate and summarize why it fails".
Review
The review procedure is in AGENTS.md (section "Reviewing a change or a pull request"), so Codex follows it as is:
Review my change using CppDepend (follow the review section of AGENTS.md).
codex exec "Review this branch against main using CppDepend, report only findings with file:line"
On every pull request, the workflow generated by cppdepend-ai init --ci github has an optional codex job (the OpenAI Codex GitHub Action, read-only sandbox) that reads the analysis results and posts one comment. Turn it on with the secret OPENAI_API_KEY and the repository variable CPPDEPEND_CODEX_REVIEW=true. See Review.
There is no Stop-hook gate for Codex: enforcement comes from the AGENTS.md rule ("run cppdepend-ai gate before declaring a task done") and from CI.
