@claude-flow/codex 3.0.0-alpha.1

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 (46) hide show
  1. package/README.md +301 -0
  2. package/dist/cli.d.ts +9 -0
  3. package/dist/cli.d.ts.map +1 -0
  4. package/dist/cli.js +649 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/generators/agents-md.d.ts +12 -0
  7. package/dist/generators/agents-md.d.ts.map +1 -0
  8. package/dist/generators/agents-md.js +641 -0
  9. package/dist/generators/agents-md.js.map +1 -0
  10. package/dist/generators/config-toml.d.ts +74 -0
  11. package/dist/generators/config-toml.d.ts.map +1 -0
  12. package/dist/generators/config-toml.js +910 -0
  13. package/dist/generators/config-toml.js.map +1 -0
  14. package/dist/generators/index.d.ts +9 -0
  15. package/dist/generators/index.d.ts.map +1 -0
  16. package/dist/generators/index.js +9 -0
  17. package/dist/generators/index.js.map +1 -0
  18. package/dist/generators/skill-md.d.ts +20 -0
  19. package/dist/generators/skill-md.d.ts.map +1 -0
  20. package/dist/generators/skill-md.js +946 -0
  21. package/dist/generators/skill-md.js.map +1 -0
  22. package/dist/index.d.ts +45 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +46 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/initializer.d.ts +87 -0
  27. package/dist/initializer.d.ts.map +1 -0
  28. package/dist/initializer.js +666 -0
  29. package/dist/initializer.js.map +1 -0
  30. package/dist/migrations/index.d.ts +114 -0
  31. package/dist/migrations/index.d.ts.map +1 -0
  32. package/dist/migrations/index.js +856 -0
  33. package/dist/migrations/index.js.map +1 -0
  34. package/dist/templates/index.d.ts +92 -0
  35. package/dist/templates/index.d.ts.map +1 -0
  36. package/dist/templates/index.js +284 -0
  37. package/dist/templates/index.js.map +1 -0
  38. package/dist/types.d.ts +218 -0
  39. package/dist/types.d.ts.map +1 -0
  40. package/dist/types.js +8 -0
  41. package/dist/types.js.map +1 -0
  42. package/dist/validators/index.d.ts +42 -0
  43. package/dist/validators/index.d.ts.map +1 -0
  44. package/dist/validators/index.js +929 -0
  45. package/dist/validators/index.js.map +1 -0
  46. package/package.json +88 -0
package/README.md ADDED
@@ -0,0 +1,301 @@
1
+ # @claude-flow/codex
2
+
3
+ OpenAI Codex CLI adapter for Claude Flow V3. Enables multi-agent orchestration with **self-learning capabilities** for OpenAI Codex CLI following the [Agentic AI Foundation](https://agenticfoundation.org) standard.
4
+
5
+ ## Key Concept: Execution Model
6
+
7
+ ```
8
+ ┌─────────────────────────────────────────────────────────────────┐
9
+ │ CLAUDE-FLOW = ORCHESTRATOR (tracks state, stores memory) │
10
+ │ CODEX = EXECUTOR (writes code, runs commands, implements) │
11
+ └─────────────────────────────────────────────────────────────────┘
12
+ ```
13
+
14
+ **Codex does the work. Claude-flow coordinates and learns.**
15
+
16
+ ## Features
17
+
18
+ - **AGENTS.md Generation** - Creates project instructions for Codex
19
+ - **MCP Integration** - Self-learning via memory and vector search
20
+ - **137+ Skills** - Invoke with `$skill-name` syntax
21
+ - **Vector Memory** - Semantic pattern search (384-dim embeddings)
22
+ - **Dual Platform** - Supports both Claude Code and Codex
23
+ - **Auto-Registration** - MCP server registered during init
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ # Via claude-flow CLI (recommended)
29
+ npx claude-flow@alpha init --codex
30
+
31
+ # Full setup with all 137+ skills
32
+ npx claude-flow@alpha init --codex --full
33
+
34
+ # Dual mode (both Claude Code and Codex)
35
+ npx claude-flow@alpha init --dual
36
+ ```
37
+
38
+ ## MCP Integration (Self-Learning)
39
+
40
+ When you run `init --codex`, the MCP server is **automatically registered** with Codex:
41
+
42
+ ```bash
43
+ # Verify MCP is registered
44
+ codex mcp list
45
+
46
+ # Expected:
47
+ # Name Command Args Status
48
+ # claude-flow npx claude-flow mcp start enabled
49
+
50
+ # If not present, add manually:
51
+ codex mcp add claude-flow -- npx claude-flow mcp start
52
+ ```
53
+
54
+ ### MCP Tools for Learning
55
+
56
+ | Tool | Purpose | When to Use |
57
+ |------|---------|-------------|
58
+ | `memory_search` | Semantic vector search | BEFORE starting any task |
59
+ | `memory_store` | Save patterns with embeddings | AFTER completing successfully |
60
+ | `swarm_init` | Initialize coordination | Start of complex tasks |
61
+ | `agent_spawn` | Register agent roles | Multi-agent workflows |
62
+ | `neural_train` | Train on patterns | Periodic improvement |
63
+
64
+ ## Self-Learning Workflow
65
+
66
+ ```
67
+ 1. LEARN: memory_search(query="task keywords") → Find similar patterns
68
+ 2. COORD: swarm_init(topology="hierarchical") → Set up coordination
69
+ 3. EXECUTE: YOU write code, run commands → Codex does real work
70
+ 4. REMEMBER: memory_store(key, value, namespace="patterns") → Save for future
71
+ ```
72
+
73
+ ### Example Prompt for Codex
74
+
75
+ ```
76
+ Build an email validator using a learning-enabled swarm.
77
+
78
+ STEP 1 - LEARN (use MCP tool):
79
+ Use tool: memory_search
80
+ query: "validation utility function patterns"
81
+ namespace: "patterns"
82
+ If score > 0.7, use that pattern as reference.
83
+
84
+ STEP 2 - COORDINATE (use MCP tools):
85
+ Use tool: swarm_init with topology="hierarchical", maxAgents=3
86
+ Use tool: agent_spawn with type="coder", name="validator"
87
+
88
+ STEP 3 - EXECUTE (YOU do this):
89
+ Create /tmp/validator/email.js with validateEmail() function
90
+ Create /tmp/validator/test.js with test cases
91
+ Run the tests
92
+
93
+ STEP 4 - REMEMBER (use MCP tool):
94
+ Use tool: memory_store
95
+ key: "pattern-email-validator"
96
+ value: "Email validation: regex, returns boolean, test cases"
97
+ namespace: "patterns"
98
+
99
+ YOU execute all code. Use MCP tools for learning.
100
+ ```
101
+
102
+ ## Directory Structure
103
+
104
+ ```
105
+ project/
106
+ ├── AGENTS.md # Main project instructions (Codex format)
107
+ ├── .agents/
108
+ │ ├── config.toml # Project configuration
109
+ │ ├── skills/ # 137+ skills
110
+ │ │ ├── swarm-orchestration/
111
+ │ │ │ └── SKILL.md
112
+ │ │ ├── memory-management/
113
+ │ │ │ └── SKILL.md
114
+ │ │ └── ...
115
+ │ └── README.md # Directory documentation
116
+ ├── .codex/
117
+ │ ├── config.toml # Local overrides (gitignored)
118
+ │ └── AGENTS.override.md # Local instruction overrides
119
+ └── .claude-flow/
120
+ ├── config.yaml # Runtime configuration
121
+ ├── data/ # Memory and cache
122
+ └── logs/ # Log files
123
+ ```
124
+
125
+ ## Templates
126
+
127
+ | Template | Skills | Learning | Description |
128
+ |----------|--------|----------|-------------|
129
+ | `minimal` | 2 | Basic | Core skills only |
130
+ | `default` | 4 | Yes | Standard setup |
131
+ | `full` | 137+ | Yes | All available skills |
132
+ | `enterprise` | 137+ | Advanced | Full + governance |
133
+
134
+ ## Platform Comparison
135
+
136
+ | Feature | Claude Code | OpenAI Codex |
137
+ |---------|-------------|--------------|
138
+ | Config File | CLAUDE.md | AGENTS.md |
139
+ | Skills Dir | .claude/skills/ | .agents/skills/ |
140
+ | Skill Syntax | `/skill-name` | `$skill-name` |
141
+ | Settings | settings.json | config.toml |
142
+ | MCP | Native | Via `codex mcp add` |
143
+
144
+ ## Skill Invocation
145
+
146
+ In OpenAI Codex CLI, invoke skills with `$` prefix:
147
+
148
+ ```
149
+ $swarm-orchestration
150
+ $memory-management
151
+ $sparc-methodology
152
+ $security-audit
153
+ $agent-coder
154
+ $agent-tester
155
+ ```
156
+
157
+ ## Configuration
158
+
159
+ ### .agents/config.toml
160
+
161
+ ```toml
162
+ # Model configuration
163
+ model = "gpt-4"
164
+
165
+ # Approval policy
166
+ approval_policy = "on-request"
167
+
168
+ # Sandbox mode
169
+ sandbox_mode = "workspace-write"
170
+
171
+ # MCP Servers
172
+ [mcp_servers.claude-flow]
173
+ command = "npx"
174
+ args = ["claude-flow", "mcp", "start"]
175
+ enabled = true
176
+
177
+ # Skills
178
+ [[skills]]
179
+ path = ".agents/skills/swarm-orchestration"
180
+ enabled = true
181
+
182
+ [[skills]]
183
+ path = ".agents/skills/memory-management"
184
+ enabled = true
185
+ ```
186
+
187
+ ### .codex/config.toml (Local)
188
+
189
+ ```toml
190
+ # Local development overrides (gitignored)
191
+ approval_policy = "never"
192
+ sandbox_mode = "danger-full-access"
193
+ web_search = "live"
194
+ ```
195
+
196
+ ## API Reference
197
+
198
+ ### CodexInitializer
199
+
200
+ ```typescript
201
+ class CodexInitializer {
202
+ async initialize(options: CodexInitOptions): Promise<CodexInitResult>;
203
+ async dryRun(options: CodexInitOptions): Promise<string[]>;
204
+ }
205
+ ```
206
+
207
+ ### initializeCodexProject
208
+
209
+ ```typescript
210
+ async function initializeCodexProject(
211
+ projectPath: string,
212
+ options?: Partial<CodexInitOptions>
213
+ ): Promise<CodexInitResult>;
214
+ ```
215
+
216
+ ### Types
217
+
218
+ ```typescript
219
+ interface CodexInitOptions {
220
+ projectPath: string;
221
+ template?: 'minimal' | 'default' | 'full' | 'enterprise';
222
+ skills?: string[];
223
+ force?: boolean;
224
+ dual?: boolean;
225
+ }
226
+
227
+ interface CodexInitResult {
228
+ success: boolean;
229
+ filesCreated: string[];
230
+ skillsGenerated: string[];
231
+ mcpRegistered?: boolean;
232
+ warnings?: string[];
233
+ errors?: string[];
234
+ }
235
+ ```
236
+
237
+ ## Programmatic Usage
238
+
239
+ ```typescript
240
+ import { CodexInitializer, initializeCodexProject } from '@claude-flow/codex';
241
+
242
+ // Quick initialization
243
+ const result = await initializeCodexProject('/path/to/project', {
244
+ template: 'full',
245
+ force: true,
246
+ dual: false,
247
+ });
248
+
249
+ // Or use the class directly
250
+ const initializer = new CodexInitializer();
251
+ const result = await initializer.initialize({
252
+ projectPath: '/path/to/project',
253
+ template: 'enterprise',
254
+ skills: ['swarm-orchestration', 'memory-management'],
255
+ force: false,
256
+ dual: true,
257
+ });
258
+
259
+ console.log(`MCP registered: ${result.mcpRegistered}`);
260
+ console.log(`Skills created: ${result.skillsGenerated.length}`);
261
+ ```
262
+
263
+ ## Vector Search Details
264
+
265
+ - **Embedding Dimensions**: 384
266
+ - **Search Algorithm**: HNSW (150x-12,500x faster)
267
+ - **Similarity Scoring**: 0-1 (higher = better match)
268
+ - Score > 0.7: Strong match, use pattern
269
+ - Score 0.5-0.7: Partial match, adapt
270
+ - Score < 0.5: Weak match, create new
271
+
272
+ ## Migration
273
+
274
+ Convert an existing CLAUDE.md project to Codex format:
275
+
276
+ ```typescript
277
+ import { migrate } from '@claude-flow/codex';
278
+
279
+ const result = await migrate({
280
+ sourcePath: './CLAUDE.md',
281
+ targetPath: './AGENTS.md',
282
+ preserveComments: true,
283
+ generateSkills: true,
284
+ });
285
+ ```
286
+
287
+ ## Related Packages
288
+
289
+ - [@claude-flow/cli](https://www.npmjs.com/package/@claude-flow/cli) - Main CLI
290
+ - [claude-flow](https://www.npmjs.com/package/claude-flow) - Umbrella package
291
+ - [@claude-flow/memory](https://www.npmjs.com/package/@claude-flow/memory) - AgentDB memory with vector search
292
+ - [@claude-flow/security](https://www.npmjs.com/package/@claude-flow/security) - Security module
293
+
294
+ ## License
295
+
296
+ MIT
297
+
298
+ ## Support
299
+
300
+ - Documentation: https://github.com/ruvnet/claude-flow
301
+ - Issues: https://github.com/ruvnet/claude-flow/issues
package/dist/cli.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @claude-flow/codex - CLI
4
+ *
5
+ * Command-line interface for Codex integration
6
+ * Part of the coflow rebranding initiative
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;GAKG"}