OpenAI Codex Platform Output
Takes a generated GA entity (.agents/) and produces the Codex equivalent (.codex/), applying all platform-specific transformations.
Input / Output
Input:
entity_type: workflow | agent | command | skill | rule | knowledge-base | resources | script | hookentity_name: the entity filename (e.g.age-spe-email-classifier.md)source_content: the full content of the generated GA entityexport_path: base export path (e.g.exports/{name})model_ga: the GA model value from frontmatter (e.g.gemini-3.1)
Output:
- Entity file(s) written to the correct
.codex/path - Hook JSON fragment if entity is a Hook
- Summary of what was generated
Procedure
1. Determine transformation type
Read the directory mapping from ../resources/res-entity-templates-codex.md §3:
| Entity prefix | Transformation | Destination |
|---|---|---|
wor-*, age-*, com-* |
MD → TOML agent | .codex/agents/ |
ski-* |
Direct copy | .codex/skills/ |
rul-* |
Direct copy | .codex/rules/ |
kno-* |
Direct copy | .codex/knowledge-base/ |
res-* |
Direct copy | .codex/resources/ |
scp-* |
MD → executable | .codex/scripts/ |
hok-* |
Copy MD + generate JSON fragment | .codex/hooks/ |
2. Transform content based on entity type
For Workflows, Agents, Commands → TOML conversion
Follow the conversion rules in ../resources/res-entity-templates-codex.md §1:
- Parse frontmatter: Extract
name,description,modelfrom YAML frontmatter - Map model: Apply model mapping from §2:
gemini-3-flash/haiku→gpt-5.4-mini, effort"low"gemini-3.1/sonnet→gpt-5.4, effort"medium"opus→gpt-5.4, effort"high"
- Extract body: Everything after the closing
---of frontmatter becomesdeveloper_instructions - Escape for TOML: Wrap in
'''(single-quoted literal). If body contains''', replace with``` - Transform agent references: Replace
./age-spe-*.mdand../agents/age-spe-*.mdwith descriptive subagent invocation text - Parse Skills table: Extract skill names and generate
[[skills.config]]entries with.codex/skills/paths - Generate nickname: Convert entity name from kebab-case to Title Case, strip prefix
- Set defaults:
sandbox_mode = true - Prepend header:
# AUTO-GENERATED from .agents/ — Do not edit directly.
Output file: {export_path}/.codex/agents/{entity-name-without-extension}.toml
For Skills
- Direct copy to
.codex/skills/ski-[name]/SKILL.md - Preserve subdirectory structure
For Rules, Knowledge-base, Resources
- Direct copy to corresponding
.codex/directory
For Scripts
- Same as Claude Code: extract executable logic from GA
.md→ generate.shor.py - Write to
.codex/scripts/
For Hooks
Generate TWO files:
- Documentation: Copy
.mdto.codex/hooks/hok-[name].md - JSON fragment: Generate
.codex/hooks/hok-[name].json:
{
"event": "[from frontmatter event field]",
"matcher": "[from frontmatter matcher field]",
"hook": {
"type": "[from frontmatter type field]",
"command": ".codex/scripts/scp-[related-script].sh",
"timeout": 600
}
}
If the hook event has no Codex equivalent (see ../resources/res-codex-conventions.md §2), generate only the .md and skip the .json fragment. Add a note in the .md:
> **Codex note:** This hook event ([event]) has no direct Codex equivalent. The behavioral rule is documented here for reference but cannot be automated via hooks.json.
3. Write the output file(s)
Write to {export_path}/.codex/{destination_path}.
4. Return summary
Codex output: {entity_name} → .codex/{destination_path}
Type: [TOML agent | direct copy | executable | hook fragment]
Transforms: [list, e.g. "MD→TOML", "model mapping", "JSON fragment"]
Error Handling
- Destination file already exists: Overwrite silently (GA is source of truth).
- Unknown entity type: Skip and warn — do not block the pipeline.
- Model value not in mapping table: Use
gpt-5.4with"medium"as default, warn. - Hook event not supported in Codex: Generate
.mdonly, skip.json, add note. - TOML escaping failure (body contains
'''): Replace with backtick code fences and warn.