init-codex-config
Apply agent-harness to a project for Codex. This is the Codex counterpart to
setup/init-agent-config/SKILL.md; read that source skill before adapting a
project, then translate only the selected pieces into Codex surfaces.
Preflight
- Locate this repository. Prefer the current plugin root; otherwise check
~/.claude/agent-harness.
- Read:
../../docs/CODEX_ADAPTATION_PLAN.md
../../INVENTORY.md
../../rules/README.md
../../setup/init-agent-config/SKILL.md
- Inspect the target project for existing
AGENTS.md, .codex/,
.agents/skills, .claude/, CLAUDE.md, package manifests, and Git
status.
- Do not edit
.claude/ or CLAUDE.md unless the user explicitly asks for
Claude Code changes too.
Decide the Codex surfaces
- Durable project guidance goes in
AGENTS.md, not CLAUDE.md.
- Codex project hooks go in
.codex/hooks.json.
- Repo-scoped Codex skills go in
.agents/skills/<skill-name>/SKILL.md.
- User-wide Codex skills go in
~/.agents/skills.
- Reusable distribution goes through
.codex-plugin/plugin.json and a
marketplace entry.
- MCP or app integrations belong in Codex MCP/app config, not in AGENTS.md.
Questions
If the user has not already provided answers, gather these decisions. In plan
mode, use the available user-input tool. Outside plan mode, ask only the
questions that affect file writes.
- Project type: Python research, static site, frontend app, or custom.
- Language policy: English, Chinese, bilingual, or leave unchanged.
- Context tags:
always, research-pkg, ui-project, static-site,
ml-research, web-perf, image-or-video-work, docs-site,
electron-or-desktop.
- Which personal rules to include: output brevity, tool proactivity,
no reread, writing style, human-readable output, autorun mode.
- Skill scope: repo
.agents/skills or user ~/.agents/skills.
- Hook scope: project
.codex/hooks.json, user ~/.codex/hooks.json, or no hooks. The tested local activation uses user hooks; do not also declare plugin hooks or the same command can run twice.
When the user says autorun, choose conservative defaults and continue unless
a file overwrite, dependency install, network call, or destructive operation
needs approval.
Compose for Codex
- Preserve any existing
AGENTS.md; merge additively or create
AGENTS.md.bak.<date> before replacing.
- Generate
AGENTS.md with concise instructions. Do not paste the full rule
library. Include references to selected source rule files, for example:
Rules source: ~/.claude/agent-harness/rules/phased-planning/RULE.md.
- If project hooks are selected, create
.codex/hooks.json from this repository's root
hooks.json, then rewrite every command to a stable absolute or git-root-based path. The root file is a source template, not an automatically discovered plugin hook.
- If repo skills are selected, copy the relevant top-level Codex wrapper
skill directories from this repository into
.agents/skills/.
- If a template is selected, use the corresponding template directory as a
source, but translate Claude-specific files:
CLAUDE.template.md -> summarized AGENTS.md
.claude/settings.template.json -> .codex/hooks.json
.claude/skills -> .agents/skills
- Add a short README note only when the project already has a README and the
user wants provenance recorded.
Verification
Run checks proportional to the files written:
jq empty on every JSON file created or changed.
python3 -c 'import tomllib; ...' for TOML files if present.
rg -n "CLAUDE|\\.claude" AGENTS.md .codex .agents to ensure Codex files do
not accidentally claim to be Claude configuration, except in provenance text.
git status --short to report changed files.
Do not claim that hooks or skills are active in the current Codex task until
they have been installed in a discovered location and a real lifecycle event
or explicit invocation proves that task picked them up. Trusting a hook definition
does not prove an already-running task rebuilt its lifecycle registry.
1---2name: init-codex-config3description: Scaffold or migrate a project to use agent-harness from Codex. Use when applying agent-harness in Codex, converting Claude Code setup to AGENTS.md/.codex/.agents, or making a project ready for Codex skills and hooks without changing the original Claude setup.4---56# init-codex-config78Apply `agent-harness` to a project for Codex. This is the Codex counterpart to9`setup/init-agent-config/SKILL.md`; read that source skill before adapting a10project, then translate only the selected pieces into Codex surfaces.1112## Preflight13141. Locate this repository. Prefer the current plugin root; otherwise check15 `~/.claude/agent-harness`.162. Read:17 - `../../docs/CODEX_ADAPTATION_PLAN.md`18 - `../../INVENTORY.md`19 - `../../rules/README.md`20 - `../../setup/init-agent-config/SKILL.md`213. Inspect the target project for existing `AGENTS.md`, `.codex/`,22 `.agents/skills`, `.claude/`, `CLAUDE.md`, package manifests, and Git23 status.244. Do not edit `.claude/` or `CLAUDE.md` unless the user explicitly asks for25 Claude Code changes too.2627## Decide the Codex surfaces2829- Durable project guidance goes in `AGENTS.md`, not `CLAUDE.md`.30- Codex project hooks go in `.codex/hooks.json`.31- Repo-scoped Codex skills go in `.agents/skills/<skill-name>/SKILL.md`.32- User-wide Codex skills go in `~/.agents/skills`.33- Reusable distribution goes through `.codex-plugin/plugin.json` and a34 marketplace entry.35- MCP or app integrations belong in Codex MCP/app config, not in AGENTS.md.3637## Questions3839If the user has not already provided answers, gather these decisions. In plan40mode, use the available user-input tool. Outside plan mode, ask only the41questions that affect file writes.42431. Project type: Python research, static site, frontend app, or custom.442. Language policy: English, Chinese, bilingual, or leave unchanged.453. Context tags: `always`, `research-pkg`, `ui-project`, `static-site`,46 `ml-research`, `web-perf`, `image-or-video-work`, `docs-site`,47 `electron-or-desktop`.484. Which personal rules to include: output brevity, tool proactivity,49 no reread, writing style, human-readable output, autorun mode.505. Skill scope: repo `.agents/skills` or user `~/.agents/skills`.516. Hook scope: project `.codex/hooks.json`, user `~/.codex/hooks.json`, or no hooks. The tested local activation uses user hooks; do not also declare plugin hooks or the same command can run twice.5253When the user says `autorun`, choose conservative defaults and continue unless54a file overwrite, dependency install, network call, or destructive operation55needs approval.5657## Compose for Codex58591. Preserve any existing `AGENTS.md`; merge additively or create60 `AGENTS.md.bak.<date>` before replacing.612. Generate `AGENTS.md` with concise instructions. Do not paste the full rule62 library. Include references to selected source rule files, for example:63 `Rules source: ~/.claude/agent-harness/rules/phased-planning/RULE.md`.643. If project hooks are selected, create `.codex/hooks.json` from this repository's root65 `hooks.json`, then rewrite every command to a stable absolute or git-root-based path. The root file is a source template, not an automatically discovered plugin hook.664. If repo skills are selected, copy the relevant top-level Codex wrapper67 skill directories from this repository into `.agents/skills/`.685. If a template is selected, use the corresponding template directory as a69 source, but translate Claude-specific files:70 - `CLAUDE.template.md` -> summarized `AGENTS.md`71 - `.claude/settings.template.json` -> `.codex/hooks.json`72 - `.claude/skills` -> `.agents/skills`736. Add a short README note only when the project already has a README and the74 user wants provenance recorded.7576## Verification7778Run checks proportional to the files written:7980- `jq empty` on every JSON file created or changed.81- `python3 -c 'import tomllib; ...'` for TOML files if present.82- `rg -n "CLAUDE|\\.claude" AGENTS.md .codex .agents` to ensure Codex files do83 not accidentally claim to be Claude configuration, except in provenance text.84- `git status --short` to report changed files.8586Do not claim that hooks or skills are active in the current Codex task until87they have been installed in a discovered location and a real lifecycle event88or explicit invocation proves that task picked them up. Trusting a hook definition89does not prove an already-running task rebuilt its lifecycle registry.