Status: normative Authority: process Canonical: no Last verified: 2026-04-15
Codex Workflow for ICN
This guide aligns Codex usage with existing ICN agent guidance from CLAUDE.md and the
constitutional core (docs/ai/ICN_CONSTITUTIONAL_CORE.md).
Goals
- Keep Codex behavior consistent with ICN invariants and change-routing rules.
- Reuse existing specialization model from
.github/agents/. - Provide a repeatable workflow for planning, implementation, verification, and shipping.
Required Inputs for Every Task
Before coding, load in this order:
docs/ai/ICN_CONSTITUTIONAL_CORE.md(reasoning foundation)AGENTS.md(operating mode and change routing)CLAUDE.md(repo architecture and workflows)- Latest handoff in
docs/dev/(execution state) docs/ai/ICN_SESSION_FRAME_TEMPLATE.md(fill before non-trivial work)- Relevant path instruction from
.github/instructions/(if applicable)
See docs/ai/WORKFLOW_ARCHITECTURE.md for the full four-doc architecture.
Codex Task Flow
- Classify scope:
- Single-scope: one subsystem (for example, only Rust crate changes).
- Multi-scope: multiple subsystems (for example, Rust + gateway + docs).
- Plan first:
- Goal and success criteria.
- Files/crates to touch.
- Verification commands by change-routing rules.
- Execute with small diffs:
- Preserve invariants: adversarial-by-default, determinism, canonical encodings, no protocol panics, clean layering.
- Verify:
- Run only the checks required by touched areas.
- Never claim success without command output.
- Ship:
- Update docs/specs when semantics change.
- Ensure branch is clean, commit, push, and open/update PR.
Skill Mapping (Codex)
If .codex/skills/ exists in the repo, use those skills. Otherwise, fall back to
.claude/skills/ which provide equivalent functionality for Claude Code sessions.
MCP Server Configuration
Use .codex/mcp/servers.example.json as the baseline template.
Recommended baseline servers:
filesystemfor code/docs access in this repository.gitfor history and diffs.githubfor PR/issue context.ripgrepfor fast indexed search across the workspace.
Copy the template into your local Codex MCP config path and fill in tokens/paths specific to your environment.
Routing Rules (Practical)
- Rust crates (
icn/crates/**): runcargo fmt --all --check,cargo clippy --workspace --all-targets --all-features -- -D warnings, and targeted tests. - Gateway API (
icn-gateway): runcargo test -p icn-gateway --features sled-storage; regenerate OpenAPI and TS types if API changed. - TypeScript SDK (
sdk/typescript/):npm ci && npm run build && npm test && npm run lint. - React Native SDK (
sdk/react-native/):npm test && npm run build. - Pilot UI (
web/pilot-ui/):npm run test && npm run test:e2e && npm run test:a11y. - Docs-only changes: validate links and terminology consistency.
Non-Negotiables
- Do not weaken security, trust gates, signatures, or encoding requirements to make tests pass.
- Do not add new tooling unless explicitly requested.
- Keep docs in
docs/(never repo root). - Prefer multiple focused PRs over large mixed diffs.