/codex:codebase-analysisfrom codex
Analyzes codebase architecture via the Codex MCP server with a read-only sandbox. Useful for onboarding, understanding legacy systems, mapping dependencies, and identifying technical debt.
Ships in codex. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Use Codex to get a second-opinion architectural read of the current project, with the sandbox locked to read-only. Codex consults; Claude writes.
Always use the MCP tool. The plugin's MCP server (scripts/codex-mcp-server.mjs, started from .mcp.json) runs codex exec for each call. Tool name: mcp__plugin_codex_cli__codex. If the example below errors with an unknown-tool error, run /mcp and substitute the actual prefix (e.g., mcp__codex_cli__codex). Shell fallback is a last resort (see ../references/commands.md).
Pin model: "gpt-6.2-sol" with config: { "model_reasoning_effort": "medium" } on the opening call. Codebase analysis benefits from the flagship's reasoning across many files — don't downgrade to gpt-6-luna here. Set both on the first codex call only; codex-reply reuses them unless you escalate. Honor an explicit user-named model if given. See ../references/patterns.md → Models and Reasoning effort. Escalate to gpt-6.2-astra (pass model + config on the codex-reply) from round 3, when a disagreement survives a round, or when re-reviewing the same area in a fresh thread — see ../references/patterns.md → Escalating to Astra.
mcp__plugin_codex_cli__codex({
"prompt": "<task>\nAnalyze this project's architecture: entry points, major modules, component relationships, and notable dependencies.\n</task>\n\n<compact_output_contract>\nStructured sections, one per topic. Cite the files each claim is based on.\n</compact_output_contract>\n\n<grounding_rules>\nGround claims in files you read. Label inferences, and list what you could not determine.\n</grounding_rules>",
"sandbox": "read-only",
"model": "gpt-6.2-sol",
"config": { "model_reasoning_effort": "medium" }
})
The response includes a threadId. Use mcp__plugin_codex_cli__codex-reply with that id to drill in without re-establishing context.
Full project analysis:
mcp__plugin_codex_cli__codex({
"prompt": "Analyze this project. Report on:\n- Overall architecture\n- Key dependencies\n- Component relationships\n- Potential issues",
"sandbox": "read-only",
"model": "gpt-6.2-sol",
"config": { "model_reasoning_effort": "medium" }
})
Flow mapping:
mcp__plugin_codex_cli__codex({
"prompt": "Map the authentication flow. Identify every component involved from request to session creation.",
"sandbox": "read-only",
"model": "gpt-6.2-sol",
"config": { "model_reasoning_effort": "medium" }
})
Dependency analysis:
mcp__plugin_codex_cli__codex({
"prompt": "Analyze dependencies: direct vs transitive, outdated packages, circular dependencies, bundle-size impact.",
"sandbox": "read-only",
"model": "gpt-6.2-sol",
"config": { "model_reasoning_effort": "medium" }
})
codex-reply)When you're still working on the same area of the codebase, continue the existing thread rather than starting a new codex call. Codex retains context between rounds; fresh calls force it to re-read files and drift from its prior reasoning.
Typical loop:
threadId from the response.codex-reply with new findings or a follow-up question.gpt-6.2-astra. If the thread isn't converging, stop and bring the current state back to the user.threadId is an MCP argument — pass it as the threadId field of codex-reply, not in the prompt text. See ../references/mcp-schema.md for wrong-vs-right examples.
Example — three rounds on the same architecture thread:
# Round 1 — initial map (opening call pins model + effort)
mcp__plugin_codex_cli__codex({
"prompt": "Map the auth flow end-to-end.",
"sandbox": "read-only",
"model": "gpt-6.2-sol",
"config": { "model_reasoning_effort": "medium" }
})
# → threadId: "019da14b-..." / flags: uncertainty about session rotation
# Round 2 — Claude reads src/session/ and reports back
mcp__plugin_codex_cli__codex-reply({
"threadId": "019da14b-...",
"prompt": "src/session/rotate.ts shows a 15m rotation window, not the 1h you assumed. Does that change anything in your flow map?"
})
# Round 3 — drill into a specific layer; escalate to gpt-6.2-astra (the thread keeps its history)
mcp__plugin_codex_cli__codex-reply({
"threadId": "019da14b-...",
"prompt": "Focus on the data layer. What invariants does this flow depend on and where are they enforced?",
"model": "gpt-6.2-astra",
"config": { "model_reasoning_effort": "medium" }
})
Start a fresh thread when: the user switches topic, the threadId is no longer in context, or Claude has made substantial code changes that would be cleaner to re-prime than to patch incrementally. See ../references/patterns.md.
Codex's read is a second opinion, not authoritative — it can misread structure or miss context it never saw.
../references/patterns.md → Validation) — especially dependency, impact, and "nothing else uses this" claims.codex:consult agent in the background. For prompt blocks and recipes, see ../references/prompting.md.sandbox: "read-only". Codex must not modify files.workspace-write or danger-full-access.--dangerously-bypass-approvals-and-sandbox.If the MCP server is unavailable (plugin disabled, server crashed), see ../references/commands.md for the Bash equivalent. Requires dangerouslyDisableSandbox: true because Codex writes its own session state.
What SKILL.md sets; muted values are Claude Code's defaults
4 skills in this plugin
/adversarial-reviewHave Codex try to break a change before it ships — a skeptical review that challenges the design, assumptions, and failure modes of a diff or branch and returns structured findings (verdict, severity, file:line, confidence). Trigger on "adversarial review", "challenge this change/design with Codex", "pressure-test this before I ship", "have Codex try to break this", "is this safe to merge", or a review focused on a risk area (auth, data loss, rollback, race conditions, retries). Do NOT use for a routine bug/style pass over a diff (that's diff-review), for critiquing a plan before code exists (plan-review), or for mapping architecture (codebase-analysis)./diff-reviewGet Codex's code review of git changes via the Codex MCP server. Trigger when user wants a second opinion on code changes ("have Codex review my changes", "get code review from Codex", "review this diff with Codex"), or as a final check before committing./plan-reviewnpx claudepluginhub robbyt/claude-skills --plugin codexOther plugins' skills for the same job