Reflective Engine¶
The reflective engine is the maintained SkillOpt and GEPA inspired optimizer
inside CodexOpt.
Use it when you want CodexOpt to improve SKILL.md or AGENTS.md from task
feedback instead of only applying static cleanup rules.
Recommended Command¶
Start with a safe preview:
Run the live Codex loop:
Apply only after you review the preview:
What Happens¶
For each target file, CodexOpt:
- builds or loads task evidence
- splits tasks into train and validation sets
- evaluates the current instruction file
- collects textual feedback from verifier, judge, or static analysis
- proposes a focused rewrite
- rejects rewrites that exceed the edit budget
- keeps a rewrite only when it improves validation score
- writes artifacts and a report you can review
Reward Tiers¶
CodexOpt uses the strongest signal available:
verifier: run a deterministic command or assertion in a temporary repo copyjudge: run Codex and ask a judge model to score the trajectorystatic: use CodexOpt quality checks when no rollout signal is available
Default runs stay offline. Use --live or configure models when you want Codex
or API calls.
Configuration¶
reflective:
optimizer_model: null
judge_model: null
reward_mode: "tiered"
minibatch_size: 3
max_iterations: 6
edit_budget: 12
valset_ratio: 0.34
max_rollouts: 60
seed: 0
codex_binary: "codex"
Useful model values:
null: disable this rolecodex: usecodex execopenai/<model>: use an OpenAI-compatible model
Safety Defaults¶
codexopt improvepreviews by default.--applywrites files through the backup path.max_rolloutscaps live Codex and verifier executions.edit_budgetlimits how much a single mutation can change.- the validation gate keeps the original when the candidate does not improve.
Relation To SkillOpt And GEPA¶
CodexOpt implements the practical pieces Codex users need:
- SkillOpt-style train and validation discipline
- bounded edits
- held-out validation acceptance
- GEPA-style textual feedback
- reflective mutation from rollout feedback
- Pareto-style parent selection across validation tasks
The implementation is in-house. It does not require a gepa package dependency.