# Codex Adapter

> OpenAI Codex platform adapter for Claude Flow with dual-mode execution and migration tools

- Skill: `jrennie99-glitch/codex-adapter` (Agent Skill)
- Install (CLI): `npx skillmds add jrennie99-glitch/codex-adapter`
- Raw SKILL.md: https://api.skillmd.com/api/skills/jrennie99-glitch/codex-adapter/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: jrennie99-glitch (https://skillmd.com/u/jrennie99-glitch)
- Updated: 2026-08-19
- Page: https://skillmd.com/skills/jrennie99-glitch/codex-adapter

---


# Codex Adapter — OpenAI Codex Platform Integration

## Purpose

The `@claude-flow/codex` module is the OpenAI Codex platform adapter for Claude Flow, part of the coflow rebranding initiative. It provides project initialization with AGENTS.md, SKILL.md, and config.toml generation, migration from Claude Code configurations, validation tooling, and dual-mode collaborative execution between Claude Code and Codex CLI.

## CLI Commands

### Initialize a Codex Project

```bash
claude-flow-codex init \
  --template default \       # minimal | default | full | enterprise
  --skills "swarm-orchestration,memory-management" \
  --force \                  # Overwrite existing files
  --dual \                   # Generate both Codex + Claude Code configs
  --path ./my-project
```

Templates: `minimal`, `default`, `full`, `enterprise`

### Generate a Skill

```bash
claude-flow-codex generate-skill \
  --name my-skill \
  --description "My custom skill" \
  --triggers "user requests X,code imports Y" \
  --skip "already handled,not applicable" \
  --path ./my-project \
  --dry-run
```

Skill names must be kebab-case (lowercase letters, numbers, hyphens).

### Validate Configuration

```bash
claude-flow-codex validate \
  --file AGENTS.md \         # Or SKILL.md, config.toml
  --path ./my-project \
  --strict                   # Treat warnings as errors
```

### Migrate from Claude Code

```bash
claude-flow-codex migrate \
  --source ./CLAUDE.md \
  --target ./my-project \
  --generate-skills          # Auto-generate skills from CLAUDE.md sections
```

## Configuration Types

### AGENTS.md Options

```typescript
interface AgentsMdOptions {
  projectName: string;
  description?: string;
  techStack?: string;
  buildCommand?: string;
  testCommand?: string;
  devCommand?: string;
  template?: 'default' | 'minimal' | 'full' | 'enterprise';
  skills?: string[];
  customSections?: Record<string, string>;
}
```

### config.toml Options

```typescript
interface ConfigTomlOptions {
  model?: string;
  approvalPolicy?: 'untrusted' | 'on-failure' | 'on-request' | 'never';
  sandboxMode?: 'read-only' | 'workspace-write' | 'danger-full-access';
  webSearch?: 'disabled' | 'cached' | 'live';
  projectDocMaxBytes?: number;
  mcpServers?: McpServerConfig[];
  skills?: SkillConfig[];
  profiles?: Record<string, ConfigProfile>;
}
```

### SKILL.md Options

```typescript
interface SkillMdOptions {
  name: string;
  description: string;
  triggers?: string[];
  skipWhen?: string[];
  scripts?: SkillScript[];
  references?: SkillReference[];
  commands?: SkillCommand[];
}
```

## Built-In Skills

- `swarm-orchestration` — Multi-agent swarm management
- `memory-management` — Memory and vector search
- `sparc-methodology` — SPARC development methodology
- `security-audit` — Security scanning and compliance
- `performance-analysis` — Performance profiling
- `github-automation` — GitHub workflow integration

## Dual-Mode Execution

The `DualModeOrchestrator` enables collaborative execution between Claude Code and Codex CLI:

```typescript
import { DualModeOrchestrator, CollaborationTemplates } from '@claude-flow/codex';

const orchestrator = new DualModeOrchestrator({
  // Workers can target either Claude Code or Codex CLI
});

const result = await orchestrator.execute(CollaborationTemplates.codeReview);
```

## Migration System

Migrate from Claude Code's CLAUDE.md to Codex AGENTS.md:

```typescript
import { migrateFromClaudeCode, analyzeClaudeMd, generateMigrationReport } from '@claude-flow/codex';

// Analyze existing CLAUDE.md
const analysis = analyzeClaudeMd(claudeMdContent);

// Perform migration
const result = await migrateFromClaudeCode({
  sourcePath: './CLAUDE.md',
  targetPath: './my-project',
  preserveComments: true,
  generateSkills: true,
});

// Generate report
const report = generateMigrationReport(result);
```

### Feature Mappings

The migration system maps Claude Code features to Codex equivalents:

```typescript
import { FEATURE_MAPPINGS } from '@claude-flow/codex';
// Maps: claude.md sections -> AGENTS.md sections
// Status: 'mapped' | 'partial' | 'unsupported'
```

## Codex Hidden Features

Discovered via binary analysis:

```typescript
interface CodexHiddenFeatures {
  envVars: {
    CODEX_LOG_LEVEL?: 'debug' | 'info' | 'warn' | 'error';
    CODEX_GHOST_MODE?: 'enabled' | 'disabled';
    CODEX_SANDBOX_NETWORK_DISABLED?: 'true' | 'false';
    CODEX_EXEC_TIMEOUT?: string;
    CODEX_MULTI_TURN_MAX_TURNS?: string;
    CODEX_REMOTE_SYNC?: 'true' | 'false';
  };
}
```

## Generators

```typescript
import { generateAgentsMd, generateSkillMd, generateConfigToml } from '@claude-flow/codex';

const agentsMd = generateAgentsMd({ projectName: 'my-app', template: 'full' });
const skillMd = generateSkillMd({ name: 'my-skill', description: '...' });
const configToml = generateConfigToml({ model: 'claude-sonnet-4', approvalPolicy: 'on-failure' });
```

## Validators

```typescript
import { validateAgentsMd, validateSkillMd, validateConfigToml } from '@claude-flow/codex';

const result = validateAgentsMd(content);
// { valid: boolean, errors: ValidationError[], warnings: ValidationWarning[] }
```

## Directory Structure

Generated project layout:
```
.agents/
  config.toml
  skills/
    swarm-orchestration/SKILL.md
    memory-management/SKILL.md
AGENTS.md
```

Current version: `3.0.0-alpha.8`

