This program builds AGENTS.md for Codex from a fixed base instruction set plus optional extra instruction files. It also keeps the selected Codex model and multi-agent setting in sync with your Codex config.toml, and can optionally sync selected skills into your Codex skills directory.
Note: This tool is specifically designed to work with jamestut's customised Codex agent and will cause issues with the standard Codex CLI distribution.
Interactive mode:
python3 config_codex.pyControls:
- Up/down: move between rows
- Space: toggle options
- Enter: toggle options or open submenu
s: confirm and saveqorEsc: cancela: select all (extra instructions and System skills)n: clear all (extra instructions and System skills)
config_codex.py: interactive builder scriptconfig.json: local configuration for available models and optional Codex directoryconfig.example.json: example configurationbase_instructions/: built-in instruction fragmentsextra_instructions/: optional user-selectable markdown instruction files<codex_dir_path>/skills: symlinked Codex skills managed from the optional skills selector
The generated output is always written to:
<codex_dir_path>/AGENTS.md
If codex_dir_path is omitted from config.json, the script uses ~/.codex.
Create config.json from config.example.json and edit it as needed:
{
"codex_dir_path": "~/.codex",
"skills_path": "/home/jamesn/repo/ai-tools/ai-agents-helper/codex/skills",
"models": [
{
"name": "gpt-5.4",
"support_apply_patch": true,
"base_url": "https://litellm-proxy.example.net",
"bearer_token": "sk-api-key-here"
},
{
"name": "gemini-3.1-pro-preview",
"support_apply_patch": false,
"context_window": 256000,
"base_url": "https://litellm-proxy.example.net"
}
]
}Rules:
modelsmust contain at least one model.skills_pathis optional.nameandbase_urlare required for each model.support_apply_patchis required for each model (set totruefor GPT models,falseotherwise).context_windowis optional.bearer_tokenis optional.
When skills_path is configured, the script scans its immediate child directories and treats a folder as a valid skill only when it contains SKILL.md.
Only .md files inside extra_instructions/ are shown in the selector.
Each extra instruction file must start with a heading subject line on the first line:
# My Subject LineThat heading text is what appears in the checklist. Files are listed in filename order.
The main screen shows a Features row between Model and Skills.
Press Enter on that row to open the features dialog. Inside the dialog:
- "Enable multi agent" is the first item
- "Enable memories" is the second item
- Enter / Space: toggle the highlighted feature
s: save the feature selection and returnqorEsc: cancel changes and return
When enabled, "Enable multi agent" adds base_instructions/multi_agent.md to the output and sets [features].multi_agent = true in config.toml.
When enabled, "Enable memories" sets three TOML settings to true in unison: memories.use_memories, memories.generate_memories, and features.memories. The initial state is true only if all three settings exist and are true in the existing config.toml; otherwise it defaults to false.
The main screen always shows a Skills row after the Features row.
Press Enter on that row to open the skills dialog. Inside the dialog:
- "System skills" is always the first item at the top of the dialog
- Enter / Space: toggle the highlighted skill
s: save the skill selection and returnqorEsc: cancel changes and returna: enable System skills and select all valid skillsn: disable System skills and clear all skills
When skills_path is configured, skills from source directories are listed below System skills in filename order. Existing enabled skills are preselected by reading symlinks from <codex_dir_path>/skills.
After confirmation, the script reconciles <codex_dir_path>/skills:
- selected skills are symlinked to the configured source directories
- stale or unselected symlinks are removed, even if they point somewhere else
- existing non-symlink files or directories are left alone
- if a selected skill path already exists as a non-symlink, the script stops with an error instead of deleting it
The generated AGENTS.md always uses this order:
base_instructions/general.mdbase_instructions/apply_patch.mdonly when the model hassupport_apply_patch: falsebase_instructions/multi_agent.mdonly when multi-agent is enabled in the Features dialog- Checked files from
extra_instructions/
After confirmation, the script updates <codex_dir_path>/config.toml:
When config.toml does not exist yet, the script creates a minimal one with those settings.
The initial UI defaults are loaded from <codex_dir_path>/config.toml.