CodeVetter · Repo Unpack · Extension points
openai/codex
Codex is extended by adding a tool spec and handler, an MCP server entry, a feature flag, a slash command, a CLI subcommand, or an app-server v2 method. Model providers plug in through `WireApi` and config `model_providers`. Skills, execpolicy rules, and sandbox policies are user-level extension points that do not require a fork. New crates are preferred over new modules in `codex-core`. Protocol extensions must update serde and ts-rs annotations together and regenerate schema fixtures.
- TUI slash commands are the `SlashCommand` enum and its parse table in `tui/src/slash_command.rs`. Adding a command means a variant, a description, a dispatch arm in the composer/chat widget path, and an insta snapshot.
- CLI subcommands are the `Subcommand` enum in `cli/src/main.rs` (clap). New top-level commands belong there only if they are user-facing binaries; library behavior belongs in a crate the CLI calls.
- Model providers extend via config `[model_providers.<id>]` (base_url, wire_api `responses` or `chat`, env_key). `ModelClient` switches on `WireApi`. A new HTTP shape requires a client arm, not a TUI change.
- Execpolicy is a user-authored policy language (`prefix_rule`, pattern rules) interpreted by the `codex-execpolicy` crate. New rule kinds are crate changes; new rules of existing kinds are config-only.
- Context injection extends through `ContextualUserFragment` implementors under `core/src/context`. New fragments must be bounded structs. This is the only supported way to add text the model sees every turn.
- Sandbox policies extend by adding a `SandboxPolicy` variant or a platform executor. macOS profiles are strings in `seatbelt.rs`; Linux uses the `linux-sandbox` crate; Windows uses the Windows sandbox crate. All three must stay behaviorally aligned.
- Internal agent roles and graphs (`codex-agent-roles`, `codex-agent-identity`, `codex-agent-graph-store`) are separate workspace crates for multi-agent structure, not part of the CLI multitool match. They are the intended home for new agent-graph concepts instead of `codex-core`.
- Config schema is generated. After any `ConfigToml` or nested config type change, `just write-config-schema` rewrites `codex-rs/core/config.schema.json`. Docs that mirror keys live in `docs/config.md` and `docs/example-config.md`.