Appearance
Permutation Frameworks (Codex CLI)
A permutation framework in the Codex CLI context is when you design a set of repeatable feature patterns (for example, 10+ variations of an API handler or React component), then encode those rules inside AGENTS.md
so Codex can reliably generate subsequent permutations. Instead of coding each variation manually, you create a system of examples, constraints, and rules that covers the design space while protecting invariants you don't want changed.
OpenAI explicitly documents that Codex can be guided by AGENTS.md
files placed within your repository—making it a natural mechanism for structuring such frameworks.
Why this works
Codex CLI is especially effective when:
- You provide clear examples of what to do and what not to do.
- Tasks share a common structure, e.g. similar function signatures or UI elements.
- Constraints are explicit in
AGENTS.md
, leaving less room for variance.
This matches OpenAI's guidance: Codex executes reliably when given sufficient project context and guardrails (via AGENTS.md
, explicit reads, or MCP constraints).
Where Codex struggles: bespoke one-off tasks with no prior examples or constraints, which tend to produce inconsistent adherence.
From one-offs to systematic permutations
Instead of treating every new feature as a custom job, you can:
- Identify areas where similar patterns repeat (e.g. CRUD handlers, component variants).
- Encode the "skeleton" of these patterns in
AGENTS.md
with examples and invariants. - Ask Codex to generate new variations that fit within the framework.
This shifts the workload from manual implementation to designing and reviewing AI-generated permutations.
Building the framework foundation
- Start by hand-building 2-3 examples of the pattern you want to systematize
- Document the invariants (what must never change) and the variables (what can be customized)
- Create clear examples in
AGENTS.md
showing both correct and incorrect implementations - Test with Codex to ensure it can reliably reproduce the pattern
Sources
- OpenAI announcement — Codex can be guided by
AGENTS.md
files in your repo. - AGENTS.md repository — official reference and examples for agent guidance.
- Codex CLI docs — approvals, session behavior, and context handling.