@sparkleideas/codex 3.0.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +1024 -0
  2. package/package.json +98 -0
package/README.md ADDED
@@ -0,0 +1,1024 @@
1
+ # @claude-flow/codex
2
+
3
+ <p align="center">
4
+ <strong>OpenAI Codex CLI Adapter for Claude Flow V3</strong><br/>
5
+ <em>Self-learning multi-agent orchestration following the <a href="https://agentics.org">Agentics Foundation</a> standard</em>
6
+ </p>
7
+
8
+ <p align="center">
9
+ <a href="https://www.npmjs.com/package/@claude-flow/codex"><img src="https://img.shields.io/npm/v/@claude-flow/codex?label=npm&color=blue" alt="npm version"></a>
10
+ <a href="https://github.com/ruvnet/claude-flow"><img src="https://img.shields.io/badge/license-MIT-green" alt="license"></a>
11
+ <a href="https://agentics.org"><img src="https://img.shields.io/badge/standard-Agentics-purple" alt="Agentics Standard"></a>
12
+ </p>
13
+
14
+ ---
15
+
16
+ ## Why @claude-flow/codex?
17
+
18
+ Transform OpenAI Codex CLI into a **self-improving AI development system**. While Codex executes code, claude-flow orchestrates, coordinates, and **learns from every interaction**.
19
+
20
+ | Traditional Codex | With Claude-Flow |
21
+ |-------------------|------------------|
22
+ | Stateless execution | Persistent vector memory |
23
+ | Single-agent | Multi-agent swarms (up to 15) |
24
+ | Manual coordination | Automatic orchestration |
25
+ | No learning | Self-learning patterns (HNSW) |
26
+ | One platform | Dual-mode (Claude Code + Codex) |
27
+
28
+ ## Key Concept: Execution Model
29
+
30
+ ```
31
+ ┌─────────────────────────────────────────────────────────────────┐
32
+ │ CLAUDE-FLOW = ORCHESTRATOR (tracks state, stores memory) │
33
+ │ CODEX = EXECUTOR (writes code, runs commands, implements) │
34
+ └─────────────────────────────────────────────────────────────────┘
35
+ ```
36
+
37
+ **Codex does the work. Claude-flow coordinates and learns.**
38
+
39
+ ### The Self-Learning Loop
40
+
41
+ ```
42
+ ┌──────────────┐
43
+ │ SEARCH │ ──→ Find relevant patterns from past successes
44
+ │ memory │
45
+ └──────┬───────┘
46
+
47
+ ┌──────▼───────┐
48
+ │ COORDINATE │ ──→ Initialize swarm, spawn specialized agents
49
+ │ swarm │
50
+ └──────┬───────┘
51
+
52
+ ┌──────▼───────┐
53
+ │ EXECUTE │ ──→ Codex writes code, runs commands
54
+ │ codex │
55
+ └──────┬───────┘
56
+
57
+ ┌──────▼───────┐
58
+ │ STORE │ ──→ Save successful patterns for future use
59
+ │ memory │
60
+ └──────────────┘
61
+ ```
62
+
63
+ ## Quick Start
64
+
65
+ ```bash
66
+ # Initialize for Codex (recommended)
67
+ npx claude-flow@alpha init --codex
68
+
69
+ # Full setup with all 137+ skills
70
+ npx claude-flow@alpha init --codex --full
71
+
72
+ # Dual mode (both Claude Code and Codex)
73
+ npx claude-flow@alpha init --dual
74
+ ```
75
+
76
+ **That's it!** The MCP server is auto-registered, skills are installed, and your project is ready for self-learning development.
77
+
78
+ ---
79
+
80
+ <details>
81
+ <summary><b>Features</b></summary>
82
+
83
+ | Feature | Description |
84
+ |---------|-------------|
85
+ | **AGENTS.md Generation** | Creates project instructions for Codex |
86
+ | **MCP Integration** | Self-learning via memory and vector search |
87
+ | **137+ Skills** | Invoke with `$skill-name` syntax |
88
+ | **Vector Memory** | Semantic pattern search (384-dim embeddings) |
89
+ | **Dual Platform** | Supports both Claude Code and Codex |
90
+ | **Auto-Registration** | MCP server registered during init |
91
+ | **HNSW Search** | 150x-12,500x faster pattern matching |
92
+ | **Self-Learning** | Learn from successes, remember patterns |
93
+ | **GPT-5.3 Support** | Optimized for latest OpenAI models |
94
+ | **Neural Training** | Train patterns with SONA architecture |
95
+
96
+ </details>
97
+
98
+ ---
99
+
100
+ <details>
101
+ <summary><b>MCP Integration (Self-Learning)</b></summary>
102
+
103
+ ### Automatic Registration
104
+
105
+ When you run `init --codex`, the MCP server is **automatically registered** with Codex:
106
+
107
+ ```bash
108
+ # Verify MCP is registered
109
+ codex mcp list
110
+
111
+ # Expected output:
112
+ # Name Command Args Status
113
+ # claude-flow npx claude-flow mcp start enabled
114
+ ```
115
+
116
+ ### Manual Registration
117
+
118
+ If MCP is not present, add manually:
119
+
120
+ ```bash
121
+ codex mcp add claude-flow -- npx claude-flow mcp start
122
+ ```
123
+
124
+ ### MCP Tools Reference
125
+
126
+ | Tool | Purpose | When to Use |
127
+ |------|---------|-------------|
128
+ | `memory_search` | Semantic vector search | **BEFORE** starting any task |
129
+ | `memory_store` | Save patterns with embeddings | **AFTER** completing successfully |
130
+ | `swarm_init` | Initialize coordination | Start of complex tasks |
131
+ | `agent_spawn` | Register agent roles | Multi-agent workflows |
132
+ | `neural_train` | Train on patterns | Periodic improvement |
133
+
134
+ ### Tool Parameters
135
+
136
+ **memory_search**
137
+ ```json
138
+ {
139
+ "query": "search terms",
140
+ "namespace": "patterns",
141
+ "limit": 5
142
+ }
143
+ ```
144
+
145
+ **memory_store**
146
+ ```json
147
+ {
148
+ "key": "pattern-name",
149
+ "value": "what worked",
150
+ "namespace": "patterns",
151
+ "upsert": true
152
+ }
153
+ ```
154
+
155
+ **swarm_init**
156
+ ```json
157
+ {
158
+ "topology": "hierarchical",
159
+ "maxAgents": 5,
160
+ "strategy": "specialized"
161
+ }
162
+ ```
163
+
164
+ </details>
165
+
166
+ ---
167
+
168
+ <details>
169
+ <summary><b>Self-Learning Workflow</b></summary>
170
+
171
+ ### The 4-Step Pattern
172
+
173
+ ```
174
+ 1. LEARN: memory_search(query="task keywords") → Find similar patterns
175
+ 2. COORD: swarm_init(topology="hierarchical") → Set up coordination
176
+ 3. EXECUTE: YOU write code, run commands → Codex does real work
177
+ 4. REMEMBER: memory_store(key, value, upsert=true) → Save for future
178
+ ```
179
+
180
+ ### Complete Example Prompt
181
+
182
+ ```
183
+ Build an email validator using a learning-enabled swarm.
184
+
185
+ STEP 1 - LEARN (use MCP tool):
186
+ Use tool: memory_search
187
+ query: "validation utility function patterns"
188
+ namespace: "patterns"
189
+ If score > 0.7, use that pattern as reference.
190
+
191
+ STEP 2 - COORDINATE (use MCP tools):
192
+ Use tool: swarm_init with topology="hierarchical", maxAgents=3
193
+ Use tool: agent_spawn with type="coder", name="validator"
194
+
195
+ STEP 3 - EXECUTE (YOU do this - DON'T STOP HERE):
196
+ Create /tmp/validator/email.js with validateEmail() function
197
+ Create /tmp/validator/test.js with test cases
198
+ Run the tests
199
+
200
+ STEP 4 - REMEMBER (use MCP tool):
201
+ Use tool: memory_store
202
+ key: "pattern-email-validator"
203
+ value: "Email validation: regex, returns boolean, test cases"
204
+ namespace: "patterns"
205
+ upsert: true
206
+
207
+ YOU execute all code. MCP tools are for learning only.
208
+ ```
209
+
210
+ ### Similarity Score Guide
211
+
212
+ | Score | Meaning | Action |
213
+ |-------|---------|--------|
214
+ | > 0.7 | Strong match | Use the pattern directly |
215
+ | 0.5 - 0.7 | Partial match | Adapt and modify |
216
+ | < 0.5 | Weak match | Create new approach |
217
+
218
+ </details>
219
+
220
+ ---
221
+
222
+ <details>
223
+ <summary><b>Directory Structure</b></summary>
224
+
225
+ ```
226
+ project/
227
+ ├── AGENTS.md # Main project instructions (Codex format)
228
+ ├── .agents/
229
+ │ ├── config.toml # Project configuration
230
+ │ ├── skills/ # 137+ skills
231
+ │ │ ├── swarm-orchestration/
232
+ │ │ │ └── SKILL.md
233
+ │ │ ├── memory-management/
234
+ │ │ │ └── SKILL.md
235
+ │ │ ├── sparc-methodology/
236
+ │ │ │ └── SKILL.md
237
+ │ │ └── ...
238
+ │ └── README.md # Directory documentation
239
+ ├── .codex/ # Local overrides (gitignored)
240
+ │ ├── config.toml # Local development settings
241
+ │ └── AGENTS.override.md # Local instruction overrides
242
+ └── .claude-flow/ # Runtime data
243
+ ├── config.yaml # Runtime configuration
244
+ ├── data/ # Memory and cache
245
+ │ └── memory.db # SQLite with vector embeddings
246
+ └── logs/ # Log files
247
+ ```
248
+
249
+ ### Key Files
250
+
251
+ | File | Purpose |
252
+ |------|---------|
253
+ | `AGENTS.md` | Main instructions for Codex (required) |
254
+ | `.agents/config.toml` | Project-wide configuration |
255
+ | `.codex/config.toml` | Local overrides (gitignored) |
256
+ | `.claude-flow/data/memory.db` | Vector memory database |
257
+
258
+ </details>
259
+
260
+ ---
261
+
262
+ <details>
263
+ <summary><b>Templates</b></summary>
264
+
265
+ ### Available Templates
266
+
267
+ | Template | Skills | Learning | Best For |
268
+ |----------|--------|----------|----------|
269
+ | `minimal` | 2 | Basic | Quick prototypes |
270
+ | `default` | 4 | Yes | Standard projects |
271
+ | `full` | 137+ | Yes | Full-featured development |
272
+ | `enterprise` | 137+ | Advanced | Team environments |
273
+
274
+ ### Usage
275
+
276
+ ```bash
277
+ # Minimal (fastest init)
278
+ npx claude-flow@alpha init --codex --minimal
279
+
280
+ # Default
281
+ npx claude-flow@alpha init --codex
282
+
283
+ # Full (all skills)
284
+ npx claude-flow@alpha init --codex --full
285
+ ```
286
+
287
+ ### Template Contents
288
+
289
+ **Minimal:**
290
+ - Core swarm orchestration
291
+ - Basic memory management
292
+
293
+ **Default:**
294
+ - Swarm orchestration
295
+ - Memory management
296
+ - SPARC methodology
297
+ - Basic coding patterns
298
+
299
+ **Full:**
300
+ - All 137+ skills
301
+ - GitHub integration
302
+ - Security scanning
303
+ - Performance optimization
304
+ - AgentDB vector search
305
+ - Neural pattern training
306
+
307
+ </details>
308
+
309
+ ---
310
+
311
+ <details>
312
+ <summary><b>Platform Comparison (Claude Code vs Codex)</b></summary>
313
+
314
+ | Feature | Claude Code | OpenAI Codex |
315
+ |---------|-------------|--------------|
316
+ | Config File | `CLAUDE.md` | `AGENTS.md` |
317
+ | Skills Dir | `.claude/skills/` | `.agents/skills/` |
318
+ | Skill Syntax | `/skill-name` | `$skill-name` |
319
+ | Settings | `settings.json` | `config.toml` |
320
+ | MCP | Native | Via `codex mcp add` |
321
+ | Overrides | `.claude.local.md` | `.codex/config.toml` |
322
+
323
+ ### Dual Mode
324
+
325
+ Run `init --dual` to set up both platforms:
326
+
327
+ ```bash
328
+ npx claude-flow@alpha init --dual
329
+ ```
330
+
331
+ This creates:
332
+ - `CLAUDE.md` for Claude Code users
333
+ - `AGENTS.md` for Codex users
334
+ - Shared `.claude-flow/` runtime
335
+ - Cross-compatible skills
336
+
337
+ </details>
338
+
339
+ ---
340
+
341
+ <details>
342
+ <summary><b>Skill Invocation</b></summary>
343
+
344
+ ### Syntax
345
+
346
+ In OpenAI Codex CLI, invoke skills with `$` prefix:
347
+
348
+ ```
349
+ $swarm-orchestration
350
+ $memory-management
351
+ $sparc-methodology
352
+ $security-audit
353
+ $agent-coder
354
+ $agent-tester
355
+ $github-workflow
356
+ $performance-optimization
357
+ ```
358
+
359
+ ### Complete Skills Table (137+ Skills)
360
+
361
+ #### V3 Core Skills
362
+
363
+ | Skill | Syntax | Description |
364
+ |-------|--------|-------------|
365
+ | V3 Security Overhaul | `$v3-security-overhaul` | Complete security architecture with CVE remediation |
366
+ | V3 Memory Unification | `$v3-memory-unification` | Unify 6+ memory systems into AgentDB with HNSW |
367
+ | V3 Integration Deep | `$v3-integration-deep` | Deep agentic-flow@alpha integration (ADR-001) |
368
+ | V3 Performance Optimization | `$v3-performance-optimization` | Achieve 2.49x-7.47x speedup targets |
369
+ | V3 Swarm Coordination | `$v3-swarm-coordination` | 15-agent hierarchical mesh coordination |
370
+ | V3 DDD Architecture | `$v3-ddd-architecture` | Domain-Driven Design architecture |
371
+ | V3 Core Implementation | `$v3-core-implementation` | Core module implementation |
372
+ | V3 MCP Optimization | `$v3-mcp-optimization` | MCP server optimization and transport |
373
+ | V3 CLI Modernization | `$v3-cli-modernization` | CLI modernization and hooks enhancement |
374
+
375
+ #### AgentDB & Memory Skills
376
+
377
+ | Skill | Syntax | Description |
378
+ |-------|--------|-------------|
379
+ | AgentDB Advanced | `$agentdb-advanced` | Advanced QUIC sync, distributed coordination |
380
+ | AgentDB Memory Patterns | `$agentdb-memory-patterns` | Persistent memory patterns for AI agents |
381
+ | AgentDB Learning | `$agentdb-learning` | AI learning plugins with AgentDB |
382
+ | AgentDB Optimization | `$agentdb-optimization` | Quantization (4-32bit), performance tuning |
383
+ | AgentDB Vector Search | `$agentdb-vector-search` | Semantic vector search with HNSW |
384
+ | ReasoningBank AgentDB | `$reasoningbank-agentdb` | ReasoningBank with AgentDB integration |
385
+ | ReasoningBank Intelligence | `$reasoningbank-intelligence` | Adaptive learning with ReasoningBank |
386
+
387
+ #### Swarm & Coordination Skills
388
+
389
+ | Skill | Syntax | Description |
390
+ |-------|--------|-------------|
391
+ | Swarm Orchestration | `$swarm-orchestration` | Multi-agent swarms with agentic-flow |
392
+ | Swarm Advanced | `$swarm-advanced` | Advanced swarm patterns for research/analysis |
393
+ | Hive Mind Advanced | `$hive-mind-advanced` | Collective intelligence system |
394
+ | Stream Chain | `$stream-chain` | Stream-JSON chaining for multi-agent pipelines |
395
+ | Worker Integration | `$worker-integration` | Background worker integration |
396
+ | Worker Benchmarks | `$worker-benchmarks` | Worker performance benchmarks |
397
+
398
+ #### GitHub Integration Skills
399
+
400
+ | Skill | Syntax | Description |
401
+ |-------|--------|-------------|
402
+ | GitHub Code Review | `$github-code-review` | AI-powered code review swarms |
403
+ | GitHub Project Management | `$github-project-management` | Swarm-coordinated project management |
404
+ | GitHub Multi-Repo | `$github-multi-repo` | Multi-repository coordination |
405
+ | GitHub Release Management | `$github-release-management` | Release orchestration with AI swarms |
406
+ | GitHub Workflow Automation | `$github-workflow-automation` | GitHub Actions automation |
407
+
408
+ #### SPARC Methodology Skills (30+)
409
+
410
+ | Skill | Syntax | Description |
411
+ |-------|--------|-------------|
412
+ | SPARC Methodology | `$sparc-methodology` | Full SPARC workflow orchestration |
413
+ | SPARC Specification | `$sparc:spec-pseudocode` | Capture full project context |
414
+ | SPARC Architecture | `$sparc:architect` | System architecture design |
415
+ | SPARC Coder | `$sparc:coder` | Clean, efficient code generation |
416
+ | SPARC Tester | `$sparc:tester` | Comprehensive testing |
417
+ | SPARC Reviewer | `$sparc:reviewer` | Code review and quality |
418
+ | SPARC Debugger | `$sparc:debugger` | Runtime bug troubleshooting |
419
+ | SPARC Optimizer | `$sparc:optimizer` | Refactor and modularize |
420
+ | SPARC Documenter | `$sparc:documenter` | Documentation generation |
421
+ | SPARC DevOps | `$sparc:devops` | DevOps automation |
422
+ | SPARC Security Review | `$sparc:security-review` | Static/dynamic security analysis |
423
+ | SPARC Integration | `$sparc:integration` | System integration |
424
+ | SPARC MCP | `$sparc:mcp` | MCP integration management |
425
+
426
+ #### Flow Nexus Skills
427
+
428
+ | Skill | Syntax | Description |
429
+ |-------|--------|-------------|
430
+ | Flow Nexus Neural | `$flow-nexus-neural` | Neural network training in E2B sandboxes |
431
+ | Flow Nexus Platform | `$flow-nexus-platform` | Platform management and authentication |
432
+ | Flow Nexus Swarm | `$flow-nexus-swarm` | Cloud-based AI swarm deployment |
433
+ | Flow Nexus Payments | `$flow-nexus:payments` | Credit management and billing |
434
+ | Flow Nexus Challenges | `$flow-nexus:challenges` | Coding challenges and achievements |
435
+ | Flow Nexus Sandbox | `$flow-nexus:sandbox` | E2B sandbox management |
436
+ | Flow Nexus App Store | `$flow-nexus:app-store` | App publishing and deployment |
437
+ | Flow Nexus Workflow | `$flow-nexus:workflow` | Event-driven workflow automation |
438
+
439
+ #### Development Skills
440
+
441
+ | Skill | Syntax | Description |
442
+ |-------|--------|-------------|
443
+ | Pair Programming | `$pair-programming` | AI-assisted pair programming |
444
+ | Skill Builder | `$skill-builder` | Create new Claude Code Skills |
445
+ | Verification Quality | `$verification-quality` | Truth scoring and quality verification |
446
+ | Performance Analysis | `$performance-analysis` | Bottleneck detection and optimization |
447
+ | Agentic Jujutsu | `$agentic-jujutsu` | Quantum-resistant version control |
448
+ | Hooks Automation | `$hooks-automation` | Automated coordination and learning |
449
+
450
+ #### Memory Management Skills
451
+
452
+ | Skill | Syntax | Description |
453
+ |-------|--------|-------------|
454
+ | Memory Neural | `$memory:neural` | Neural pattern training |
455
+ | Memory Usage | `$memory:memory-usage` | Memory usage analysis |
456
+ | Memory Search | `$memory:memory-search` | Semantic memory search |
457
+ | Memory Persist | `$memory:memory-persist` | Memory persistence |
458
+
459
+ #### Monitoring & Analysis Skills
460
+
461
+ | Skill | Syntax | Description |
462
+ |-------|--------|-------------|
463
+ | Real-Time View | `$monitoring:real-time-view` | Real-time monitoring |
464
+ | Agent Metrics | `$monitoring:agent-metrics` | Agent performance metrics |
465
+ | Swarm Monitor | `$monitoring:swarm-monitor` | Swarm activity monitoring |
466
+ | Token Usage | `$analysis:token-usage` | Token usage optimization |
467
+ | Performance Report | `$analysis:performance-report` | Performance reporting |
468
+ | Bottleneck Detect | `$analysis:bottleneck-detect` | Bottleneck detection |
469
+
470
+ #### Training Skills
471
+
472
+ | Skill | Syntax | Description |
473
+ |-------|--------|-------------|
474
+ | Specialization | `$training:specialization` | Agent specialization training |
475
+ | Neural Patterns | `$training:neural-patterns` | Neural pattern training |
476
+ | Pattern Learn | `$training:pattern-learn` | Pattern learning |
477
+ | Model Update | `$training:model-update` | Model updates |
478
+
479
+ #### Automation & Optimization Skills
480
+
481
+ | Skill | Syntax | Description |
482
+ |-------|--------|-------------|
483
+ | Self-Healing | `$automation:self-healing` | Self-healing workflows |
484
+ | Smart Agents | `$automation:smart-agents` | Smart agent auto-spawning |
485
+ | Session Memory | `$automation:session-memory` | Cross-session memory |
486
+ | Cache Manage | `$optimization:cache-manage` | Cache management |
487
+ | Parallel Execute | `$optimization:parallel-execute` | Parallel task execution |
488
+ | Topology Optimize | `$optimization:topology-optimize` | Automatic topology selection |
489
+
490
+ #### Hooks Skills (17 Hooks + 12 Workers)
491
+
492
+ | Skill | Syntax | Description |
493
+ |-------|--------|-------------|
494
+ | Pre-Edit | `$hooks:pre-edit` | Context before editing |
495
+ | Post-Edit | `$hooks:post-edit` | Record editing outcome |
496
+ | Pre-Task | `$hooks:pre-task` | Record task start |
497
+ | Post-Task | `$hooks:post-task` | Record task completion |
498
+ | Session End | `$hooks:session-end` | End session and persist |
499
+
500
+ #### Dual-Mode Skills (NEW)
501
+
502
+ | Skill | Syntax | Description |
503
+ |-------|--------|-------------|
504
+ | Dual Spawn | `$dual-spawn` | Spawn parallel Codex workers from Claude Code |
505
+ | Dual Coordinate | `$dual-coordinate` | Coordinate Claude Code + Codex execution |
506
+ | Dual Collect | `$dual-collect` | Collect results from parallel Codex instances |
507
+
508
+ ### Custom Skills
509
+
510
+ Create custom skills in `.agents/skills/`:
511
+
512
+ ```
513
+ .agents/skills/my-skill/
514
+ └── SKILL.md
515
+ ```
516
+
517
+ **SKILL.md format:**
518
+ ```markdown
519
+ # My Custom Skill
520
+
521
+ Instructions for what this skill does...
522
+
523
+ ## Usage
524
+ Invoke with `$my-skill`
525
+ ```
526
+
527
+ </details>
528
+
529
+ ---
530
+
531
+ <details>
532
+ <summary><b>Dual-Mode Integration (Claude Code + Codex)</b></summary>
533
+
534
+ ### Hybrid Execution Model
535
+
536
+ Run Claude Code for interactive development and spawn headless Codex workers for parallel background tasks:
537
+
538
+ ```
539
+ ┌─────────────────────────────────────────────────────────────────┐
540
+ │ CLAUDE CODE (interactive) ←→ CODEX WORKERS (headless) │
541
+ │ - Main conversation - Parallel background execution │
542
+ │ - Complex reasoning - Bulk code generation │
543
+ │ - Architecture decisions - Test execution │
544
+ │ - Final integration - File processing │
545
+ └─────────────────────────────────────────────────────────────────┘
546
+ ```
547
+
548
+ ### Setup
549
+
550
+ ```bash
551
+ # Initialize dual-mode
552
+ npx claude-flow@alpha init --dual
553
+
554
+ # Creates both:
555
+ # - CLAUDE.md (Claude Code configuration)
556
+ # - AGENTS.md (Codex configuration)
557
+ # - Shared .claude-flow/ runtime
558
+ ```
559
+
560
+ ### Spawning Parallel Codex Workers
561
+
562
+ From Claude Code, spawn headless Codex instances:
563
+
564
+ ```bash
565
+ # Spawn workers in parallel (each runs independently)
566
+ claude -p "Analyze src/auth/ for security issues" --session-id "task-1" &
567
+ claude -p "Write unit tests for src/api/" --session-id "task-2" &
568
+ claude -p "Optimize database queries in src/db/" --session-id "task-3" &
569
+ wait # Wait for all to complete
570
+ ```
571
+
572
+ ### Dual-Mode Skills
573
+
574
+ | Skill | Platform | Description |
575
+ |-------|----------|-------------|
576
+ | `$dual-spawn` | Codex | Spawn parallel workers from orchestrator |
577
+ | `$dual-coordinate` | Both | Coordinate cross-platform execution |
578
+ | `$dual-collect` | Claude Code | Collect results from Codex workers |
579
+
580
+ ### Dual-Mode Agents
581
+
582
+ | Agent | Type | Execution |
583
+ |-------|------|-----------|
584
+ | `codex-worker` | Worker | Headless background execution |
585
+ | `codex-coordinator` | Coordinator | Manage parallel worker pool |
586
+ | `dual-orchestrator` | Orchestrator | Route tasks to appropriate platform |
587
+
588
+ ### Task Routing Rules
589
+
590
+ | Task Complexity | Platform | Reason |
591
+ |----------------|----------|--------|
592
+ | Simple (1-2 files) | Codex Headless | Fast, parallel |
593
+ | Medium (3-5 files) | Claude Code | Needs context |
594
+ | Complex (architecture) | Claude Code | Reasoning required |
595
+ | Bulk operations | Codex Workers | Parallelize |
596
+ | Final review | Claude Code | Integration |
597
+
598
+ ### Example Workflow
599
+
600
+ ```
601
+ 1. Claude Code receives complex feature request
602
+ 2. Designs architecture and creates plan
603
+ 3. Spawns 4 Codex workers:
604
+ - Worker 1: Implement data models
605
+ - Worker 2: Create API endpoints
606
+ - Worker 3: Write unit tests
607
+ - Worker 4: Generate documentation
608
+ 4. Workers execute in parallel (headless)
609
+ 5. Claude Code collects and integrates results
610
+ 6. Final review and refinement in Claude Code
611
+ ```
612
+
613
+ ### Memory Sharing
614
+
615
+ Both platforms share the same `.claude-flow/` runtime:
616
+
617
+ ```
618
+ .claude-flow/
619
+ ├── data/
620
+ │ └── memory.db # Shared vector memory
621
+ ├── config.yaml # Shared configuration
622
+ └── sessions/ # Cross-platform sessions
623
+ ```
624
+
625
+ ### Benefits
626
+
627
+ | Feature | Benefit |
628
+ |---------|---------|
629
+ | **Parallel Execution** | 4-8x faster for bulk tasks |
630
+ | **Cost Optimization** | Route simple tasks to cheaper workers |
631
+ | **Context Preservation** | Shared memory across platforms |
632
+ | **Best of Both** | Interactive + batch processing |
633
+ | **Unified Learning** | Patterns learned by both platforms |
634
+
635
+ ### CLI Commands (NEW in v3.0.0-alpha.8)
636
+
637
+ The `@claude-flow/codex` package now includes built-in dual-mode orchestration:
638
+
639
+ ```bash
640
+ # List available collaboration templates
641
+ npx claude-flow-codex dual templates
642
+
643
+ # Run a feature development swarm
644
+ npx claude-flow-codex dual run --template feature --task "Add user authentication"
645
+
646
+ # Run a security audit swarm
647
+ npx claude-flow-codex dual run --template security --task "src/auth/"
648
+
649
+ # Run a refactoring swarm
650
+ npx claude-flow-codex dual run --template refactor --task "src/legacy/"
651
+
652
+ # Check collaboration status
653
+ npx claude-flow-codex dual status
654
+ ```
655
+
656
+ ### Pre-Built Templates
657
+
658
+ | Template | Pipeline | Platforms |
659
+ |----------|----------|-----------|
660
+ | **feature** | architect → coder → tester → reviewer | Claude (architect, reviewer) + Codex (coder, tester) |
661
+ | **security** | scanner → analyzer → fixer | Codex (scanner, fixer) + Claude (analyzer) |
662
+ | **refactor** | analyzer → planner → refactorer → validator | Claude (analyzer, planner) + Codex (refactorer, validator) |
663
+
664
+ ### Programmatic API
665
+
666
+ ```typescript
667
+ import { DualModeOrchestrator, CollaborationTemplates } from '@claude-flow/codex';
668
+
669
+ // Create orchestrator
670
+ const orchestrator = new DualModeOrchestrator({
671
+ projectPath: process.cwd(),
672
+ maxConcurrent: 4,
673
+ sharedNamespace: 'collaboration',
674
+ timeout: 300000,
675
+ });
676
+
677
+ // Listen to events
678
+ orchestrator.on('worker:started', ({ id, role }) => console.log(`Started: ${role}`));
679
+ orchestrator.on('worker:completed', ({ id }) => console.log(`Completed: ${id}`));
680
+
681
+ // Run collaboration with a template
682
+ const workers = CollaborationTemplates.featureDevelopment('Add OAuth2 login');
683
+ const result = await orchestrator.runCollaboration(workers, 'Feature: OAuth2');
684
+
685
+ console.log(`Success: ${result.success}`);
686
+ console.log(`Duration: ${result.totalDuration}ms`);
687
+ console.log(`Workers: ${result.workers.length}`);
688
+ ```
689
+
690
+ </details>
691
+
692
+ ---
693
+
694
+ <details>
695
+ <summary><b>Configuration</b></summary>
696
+
697
+ ### .agents/config.toml
698
+
699
+ ```toml
700
+ # Model configuration
701
+ model = "gpt-5.3"
702
+
703
+ # Approval policy: "always" | "on-request" | "never"
704
+ approval_policy = "on-request"
705
+
706
+ # Sandbox mode: "read-only" | "workspace-write" | "danger-full-access"
707
+ sandbox_mode = "workspace-write"
708
+
709
+ # Web search: "off" | "cached" | "live"
710
+ web_search = "cached"
711
+
712
+ # MCP Servers
713
+ [mcp_servers.claude-flow]
714
+ command = "npx"
715
+ args = ["claude-flow", "mcp", "start"]
716
+ enabled = true
717
+
718
+ # Skills
719
+ [[skills]]
720
+ path = ".agents/skills/swarm-orchestration"
721
+ enabled = true
722
+
723
+ [[skills]]
724
+ path = ".agents/skills/memory-management"
725
+ enabled = true
726
+
727
+ [[skills]]
728
+ path = ".agents/skills/sparc-methodology"
729
+ enabled = true
730
+ ```
731
+
732
+ ### .codex/config.toml (Local Overrides)
733
+
734
+ ```toml
735
+ # Local development overrides (gitignored)
736
+ # These settings override .agents/config.toml
737
+
738
+ approval_policy = "never"
739
+ sandbox_mode = "danger-full-access"
740
+ web_search = "live"
741
+
742
+ # Disable MCP in local if needed
743
+ [mcp_servers.claude-flow]
744
+ enabled = false
745
+ ```
746
+
747
+ ### Environment Variables
748
+
749
+ ```bash
750
+ # Configuration paths
751
+ CLAUDE_FLOW_CONFIG=./claude-flow.config.json
752
+ CLAUDE_FLOW_MEMORY_PATH=./.claude-flow/data
753
+
754
+ # Provider keys
755
+ ANTHROPIC_API_KEY=sk-ant-...
756
+ OPENAI_API_KEY=sk-...
757
+
758
+ # MCP settings
759
+ CLAUDE_FLOW_MCP_PORT=3000
760
+ ```
761
+
762
+ </details>
763
+
764
+ ---
765
+
766
+ <details>
767
+ <summary><b>Vector Search Details</b></summary>
768
+
769
+ ### Specifications
770
+
771
+ | Property | Value |
772
+ |----------|-------|
773
+ | Embedding Dimensions | 384 |
774
+ | Search Algorithm | HNSW |
775
+ | Speed Improvement | 150x-12,500x faster |
776
+ | Similarity Range | 0.0 - 1.0 |
777
+ | Storage | SQLite with vector extension |
778
+ | Model | all-MiniLM-L6-v2 |
779
+
780
+ ### Namespaces
781
+
782
+ | Namespace | Purpose |
783
+ |-----------|---------|
784
+ | `patterns` | Successful code patterns |
785
+ | `solutions` | Bug fixes and solutions |
786
+ | `tasks` | Task completion records |
787
+ | `coordination` | Swarm state |
788
+ | `results` | Worker results |
789
+ | `default` | General storage |
790
+
791
+ ### Example Searches
792
+
793
+ ```javascript
794
+ // Find auth patterns
795
+ memory_search({ query: "authentication JWT patterns", namespace: "patterns" })
796
+
797
+ // Find bug solutions
798
+ memory_search({ query: "null pointer fix", namespace: "solutions" })
799
+
800
+ // Find past tasks
801
+ memory_search({ query: "user profile API", namespace: "tasks" })
802
+ ```
803
+
804
+ </details>
805
+
806
+ ---
807
+
808
+ <details>
809
+ <summary><b>API Reference</b></summary>
810
+
811
+ ### CodexInitializer Class
812
+
813
+ ```typescript
814
+ import { CodexInitializer } from '@claude-flow/codex';
815
+
816
+ class CodexInitializer {
817
+ /**
818
+ * Initialize a Codex project
819
+ */
820
+ async initialize(options: CodexInitOptions): Promise<CodexInitResult>;
821
+
822
+ /**
823
+ * Preview what would be created without writing files
824
+ */
825
+ async dryRun(options: CodexInitOptions): Promise<string[]>;
826
+ }
827
+ ```
828
+
829
+ ### initializeCodexProject Function
830
+
831
+ ```typescript
832
+ import { initializeCodexProject } from '@claude-flow/codex';
833
+
834
+ /**
835
+ * Quick initialization helper
836
+ */
837
+ async function initializeCodexProject(
838
+ projectPath: string,
839
+ options?: Partial<CodexInitOptions>
840
+ ): Promise<CodexInitResult>;
841
+ ```
842
+
843
+ ### Types
844
+
845
+ ```typescript
846
+ interface CodexInitOptions {
847
+ /** Project directory path */
848
+ projectPath: string;
849
+ /** Template to use */
850
+ template?: 'minimal' | 'default' | 'full' | 'enterprise';
851
+ /** Specific skills to include */
852
+ skills?: string[];
853
+ /** Overwrite existing files */
854
+ force?: boolean;
855
+ /** Enable dual mode (Claude Code + Codex) */
856
+ dual?: boolean;
857
+ }
858
+
859
+ interface CodexInitResult {
860
+ /** Whether initialization succeeded */
861
+ success: boolean;
862
+ /** List of files created */
863
+ filesCreated: string[];
864
+ /** List of skills generated */
865
+ skillsGenerated: string[];
866
+ /** Whether MCP was registered */
867
+ mcpRegistered?: boolean;
868
+ /** Non-fatal warnings */
869
+ warnings?: string[];
870
+ /** Fatal errors */
871
+ errors?: string[];
872
+ }
873
+ ```
874
+
875
+ ### Programmatic Usage
876
+
877
+ ```typescript
878
+ import { CodexInitializer, initializeCodexProject } from '@claude-flow/codex';
879
+
880
+ // Quick initialization
881
+ const result = await initializeCodexProject('/path/to/project', {
882
+ template: 'full',
883
+ force: true,
884
+ dual: false,
885
+ });
886
+
887
+ console.log(`Files created: ${result.filesCreated.length}`);
888
+ console.log(`Skills: ${result.skillsGenerated.length}`);
889
+ console.log(`MCP registered: ${result.mcpRegistered}`);
890
+
891
+ // Or use the class directly
892
+ const initializer = new CodexInitializer();
893
+ const result = await initializer.initialize({
894
+ projectPath: '/path/to/project',
895
+ template: 'enterprise',
896
+ skills: ['swarm-orchestration', 'memory-management', 'security-audit'],
897
+ force: false,
898
+ dual: true,
899
+ });
900
+
901
+ if (result.warnings?.length) {
902
+ console.warn('Warnings:', result.warnings);
903
+ }
904
+ ```
905
+
906
+ </details>
907
+
908
+ ---
909
+
910
+ <details>
911
+ <summary><b>Migration from Claude Code</b></summary>
912
+
913
+ ### Convert CLAUDE.md to AGENTS.md
914
+
915
+ ```typescript
916
+ import { migrate } from '@claude-flow/codex';
917
+
918
+ const result = await migrate({
919
+ sourcePath: './CLAUDE.md',
920
+ targetPath: './AGENTS.md',
921
+ preserveComments: true,
922
+ generateSkills: true,
923
+ });
924
+
925
+ console.log(`Migrated: ${result.success}`);
926
+ console.log(`Skills generated: ${result.skillsGenerated.length}`);
927
+ ```
928
+
929
+ ### Manual Migration Checklist
930
+
931
+ 1. **Rename config file**: `CLAUDE.md` → `AGENTS.md`
932
+ 2. **Move skills**: `.claude/skills/` → `.agents/skills/`
933
+ 3. **Update syntax**: `/skill-name` → `$skill-name`
934
+ 4. **Convert settings**: `settings.json` → `config.toml`
935
+ 5. **Register MCP**: `codex mcp add claude-flow -- npx claude-flow mcp start`
936
+
937
+ ### Dual Mode Alternative
938
+
939
+ Instead of migrating, use dual mode to support both:
940
+
941
+ ```bash
942
+ npx claude-flow@alpha init --dual
943
+ ```
944
+
945
+ This keeps both `CLAUDE.md` and `AGENTS.md` in sync.
946
+
947
+ </details>
948
+
949
+ ---
950
+
951
+ <details>
952
+ <summary><b>Troubleshooting</b></summary>
953
+
954
+ ### MCP Not Working
955
+
956
+ ```bash
957
+ # Check if registered
958
+ codex mcp list
959
+
960
+ # Re-register
961
+ codex mcp remove claude-flow
962
+ codex mcp add claude-flow -- npx claude-flow mcp start
963
+
964
+ # Test connection
965
+ npx claude-flow mcp test
966
+ ```
967
+
968
+ ### Memory Search Returns Empty
969
+
970
+ ```bash
971
+ # Initialize memory database
972
+ npx claude-flow memory init --force
973
+
974
+ # Check if entries exist
975
+ npx claude-flow memory list
976
+
977
+ # Manually add a test pattern
978
+ npx claude-flow memory store --key "test" --value "test pattern" --namespace patterns
979
+ ```
980
+
981
+ ### Skills Not Loading
982
+
983
+ ```bash
984
+ # Verify skill directory
985
+ ls -la .agents/skills/
986
+
987
+ # Check config.toml for skill registration
988
+ cat .agents/config.toml | grep skills
989
+
990
+ # Rebuild skills
991
+ npx claude-flow@alpha init --codex --force
992
+ ```
993
+
994
+ ### Vector Search Slow
995
+
996
+ ```bash
997
+ # Check HNSW index
998
+ npx claude-flow memory stats
999
+
1000
+ # Rebuild index
1001
+ npx claude-flow memory optimize --rebuild-index
1002
+ ```
1003
+
1004
+ </details>
1005
+
1006
+ ---
1007
+
1008
+ ## Related Packages
1009
+
1010
+ | Package | Description |
1011
+ |---------|-------------|
1012
+ | [@claude-flow/cli](https://www.npmjs.com/package/@claude-flow/cli) | Main CLI (26 commands, 140+ subcommands) |
1013
+ | [claude-flow](https://www.npmjs.com/package/claude-flow) | Umbrella package |
1014
+ | [@claude-flow/memory](https://www.npmjs.com/package/@claude-flow/memory) | AgentDB with HNSW vector search |
1015
+ | [@claude-flow/security](https://www.npmjs.com/package/@claude-flow/security) | Security module |
1016
+
1017
+ ## License
1018
+
1019
+ MIT
1020
+
1021
+ ## Support
1022
+
1023
+ - Documentation: https://github.com/ruvnet/claude-flow
1024
+ - Issues: https://github.com/ruvnet/claude-flow/issues
package/package.json ADDED
@@ -0,0 +1,98 @@
1
+ {
2
+ "name": "@sparkleideas/codex",
3
+ "version": "3.0.0-alpha.10",
4
+ "description": "Codex CLI integration for Claude Flow - OpenAI Codex platform adapter",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "bin": {
9
+ "claude-flow-codex": "./dist/cli.js"
10
+ },
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js",
15
+ "require": "./dist/index.js",
16
+ "default": "./dist/index.js"
17
+ },
18
+ "./generators": {
19
+ "types": "./dist/generators/index.d.ts",
20
+ "import": "./dist/generators/index.js",
21
+ "require": "./dist/generators/index.js"
22
+ },
23
+ "./templates": {
24
+ "types": "./dist/templates/index.d.ts",
25
+ "import": "./dist/templates/index.js",
26
+ "require": "./dist/templates/index.js"
27
+ },
28
+ "./migrations": {
29
+ "types": "./dist/migrations/index.d.ts",
30
+ "import": "./dist/migrations/index.js",
31
+ "require": "./dist/migrations/index.js"
32
+ },
33
+ "./dual-mode": {
34
+ "types": "./dist/dual-mode/index.d.ts",
35
+ "import": "./dist/dual-mode/index.js",
36
+ "require": "./dist/dual-mode/index.js"
37
+ }
38
+ },
39
+ "files": [
40
+ "dist",
41
+ "templates"
42
+ ],
43
+ "scripts": {
44
+ "build": "tsc",
45
+ "dev": "tsc --watch",
46
+ "lint": "eslint src --ext .ts",
47
+ "test": "vitest",
48
+ "prepublishOnly": "npm run build"
49
+ },
50
+ "keywords": [
51
+ "codex",
52
+ "openai",
53
+ "claude-flow",
54
+ "coflow",
55
+ "agents",
56
+ "skills",
57
+ "AGENTS.md",
58
+ "agentic-ai"
59
+ ],
60
+ "author": "rUv",
61
+ "license": "MIT",
62
+ "repository": {
63
+ "type": "git",
64
+ "url": "https://github.com/ruvnet/claude-flow.git",
65
+ "directory": "v3/@claude-flow/codex"
66
+ },
67
+ "homepage": "https://github.com/ruvnet/claude-flow#readme",
68
+ "bugs": {
69
+ "url": "https://github.com/ruvnet/claude-flow/issues"
70
+ },
71
+ "engines": {
72
+ "node": ">=18"
73
+ },
74
+ "peerDependencies": {
75
+ "@sparkleideas/cli": "^3.0.0-alpha.1"
76
+ },
77
+ "peerDependenciesMeta": {
78
+ "@claude-flow/cli": {
79
+ "optional": true
80
+ }
81
+ },
82
+ "dependencies": {
83
+ "commander": "^12.0.0",
84
+ "fs-extra": "^11.2.0",
85
+ "chalk": "^5.3.0",
86
+ "inquirer": "^9.2.0",
87
+ "yaml": "^2.4.0",
88
+ "toml": "^3.0.0",
89
+ "@iarna/toml": "^2.2.5"
90
+ },
91
+ "devDependencies": {
92
+ "@types/fs-extra": "^11.0.4",
93
+ "@types/node": "^20.0.0",
94
+ "typescript": "^5.4.0",
95
+ "vitest": "^1.4.0",
96
+ "eslint": "^8.57.0"
97
+ }
98
+ }