@claude-flow/codex 3.0.0-alpha.2 → 3.0.0-alpha.3
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.
- package/README.md +444 -73
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,19 +13,10 @@ OpenAI Codex CLI adapter for Claude Flow V3. Enables multi-agent orchestration w
|
|
|
13
13
|
|
|
14
14
|
**Codex does the work. Claude-flow coordinates and learns.**
|
|
15
15
|
|
|
16
|
-
##
|
|
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
|
|
16
|
+
## Quick Start
|
|
26
17
|
|
|
27
18
|
```bash
|
|
28
|
-
#
|
|
19
|
+
# Initialize for Codex (recommended)
|
|
29
20
|
npx claude-flow@alpha init --codex
|
|
30
21
|
|
|
31
22
|
# Full setup with all 137+ skills
|
|
@@ -35,7 +26,30 @@ npx claude-flow@alpha init --codex --full
|
|
|
35
26
|
npx claude-flow@alpha init --dual
|
|
36
27
|
```
|
|
37
28
|
|
|
38
|
-
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
<details>
|
|
32
|
+
<summary><b>Features</b></summary>
|
|
33
|
+
|
|
34
|
+
| Feature | Description |
|
|
35
|
+
|---------|-------------|
|
|
36
|
+
| **AGENTS.md Generation** | Creates project instructions for Codex |
|
|
37
|
+
| **MCP Integration** | Self-learning via memory and vector search |
|
|
38
|
+
| **137+ Skills** | Invoke with `$skill-name` syntax |
|
|
39
|
+
| **Vector Memory** | Semantic pattern search (384-dim embeddings) |
|
|
40
|
+
| **Dual Platform** | Supports both Claude Code and Codex |
|
|
41
|
+
| **Auto-Registration** | MCP server registered during init |
|
|
42
|
+
| **HNSW Search** | 150x-12,500x faster pattern matching |
|
|
43
|
+
| **Self-Learning** | Learn from successes, remember patterns |
|
|
44
|
+
|
|
45
|
+
</details>
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
<details>
|
|
50
|
+
<summary><b>MCP Integration (Self-Learning)</b></summary>
|
|
51
|
+
|
|
52
|
+
### Automatic Registration
|
|
39
53
|
|
|
40
54
|
When you run `init --codex`, the MCP server is **automatically registered** with Codex:
|
|
41
55
|
|
|
@@ -43,34 +57,76 @@ When you run `init --codex`, the MCP server is **automatically registered** with
|
|
|
43
57
|
# Verify MCP is registered
|
|
44
58
|
codex mcp list
|
|
45
59
|
|
|
46
|
-
# Expected:
|
|
60
|
+
# Expected output:
|
|
47
61
|
# Name Command Args Status
|
|
48
62
|
# claude-flow npx claude-flow mcp start enabled
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Manual Registration
|
|
49
66
|
|
|
50
|
-
|
|
67
|
+
If MCP is not present, add manually:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
51
70
|
codex mcp add claude-flow -- npx claude-flow mcp start
|
|
52
71
|
```
|
|
53
72
|
|
|
54
|
-
### MCP Tools
|
|
73
|
+
### MCP Tools Reference
|
|
55
74
|
|
|
56
75
|
| Tool | Purpose | When to Use |
|
|
57
76
|
|------|---------|-------------|
|
|
58
|
-
| `memory_search` | Semantic vector search | BEFORE starting any task |
|
|
59
|
-
| `memory_store` | Save patterns with embeddings | AFTER completing successfully |
|
|
77
|
+
| `memory_search` | Semantic vector search | **BEFORE** starting any task |
|
|
78
|
+
| `memory_store` | Save patterns with embeddings | **AFTER** completing successfully |
|
|
60
79
|
| `swarm_init` | Initialize coordination | Start of complex tasks |
|
|
61
80
|
| `agent_spawn` | Register agent roles | Multi-agent workflows |
|
|
62
81
|
| `neural_train` | Train on patterns | Periodic improvement |
|
|
63
82
|
|
|
64
|
-
|
|
83
|
+
### Tool Parameters
|
|
65
84
|
|
|
85
|
+
**memory_search**
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"query": "search terms",
|
|
89
|
+
"namespace": "patterns",
|
|
90
|
+
"limit": 5
|
|
91
|
+
}
|
|
66
92
|
```
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
93
|
+
|
|
94
|
+
**memory_store**
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"key": "pattern-name",
|
|
98
|
+
"value": "what worked",
|
|
99
|
+
"namespace": "patterns",
|
|
100
|
+
"upsert": true
|
|
101
|
+
}
|
|
71
102
|
```
|
|
72
103
|
|
|
73
|
-
|
|
104
|
+
**swarm_init**
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"topology": "hierarchical",
|
|
108
|
+
"maxAgents": 5,
|
|
109
|
+
"strategy": "specialized"
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
</details>
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
<details>
|
|
118
|
+
<summary><b>Self-Learning Workflow</b></summary>
|
|
119
|
+
|
|
120
|
+
### The 4-Step Pattern
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
1. LEARN: memory_search(query="task keywords") → Find similar patterns
|
|
124
|
+
2. COORD: swarm_init(topology="hierarchical") → Set up coordination
|
|
125
|
+
3. EXECUTE: YOU write code, run commands → Codex does real work
|
|
126
|
+
4. REMEMBER: memory_store(key, value, upsert=true) → Save for future
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Complete Example Prompt
|
|
74
130
|
|
|
75
131
|
```
|
|
76
132
|
Build an email validator using a learning-enabled swarm.
|
|
@@ -85,7 +141,7 @@ STEP 2 - COORDINATE (use MCP tools):
|
|
|
85
141
|
Use tool: swarm_init with topology="hierarchical", maxAgents=3
|
|
86
142
|
Use tool: agent_spawn with type="coder", name="validator"
|
|
87
143
|
|
|
88
|
-
STEP 3 - EXECUTE (YOU do this):
|
|
144
|
+
STEP 3 - EXECUTE (YOU do this - DON'T STOP HERE):
|
|
89
145
|
Create /tmp/validator/email.js with validateEmail() function
|
|
90
146
|
Create /tmp/validator/test.js with test cases
|
|
91
147
|
Run the tests
|
|
@@ -95,53 +151,146 @@ Use tool: memory_store
|
|
|
95
151
|
key: "pattern-email-validator"
|
|
96
152
|
value: "Email validation: regex, returns boolean, test cases"
|
|
97
153
|
namespace: "patterns"
|
|
154
|
+
upsert: true
|
|
98
155
|
|
|
99
|
-
YOU execute all code.
|
|
156
|
+
YOU execute all code. MCP tools are for learning only.
|
|
100
157
|
```
|
|
101
158
|
|
|
102
|
-
|
|
159
|
+
### Similarity Score Guide
|
|
160
|
+
|
|
161
|
+
| Score | Meaning | Action |
|
|
162
|
+
|-------|---------|--------|
|
|
163
|
+
| > 0.7 | Strong match | Use the pattern directly |
|
|
164
|
+
| 0.5 - 0.7 | Partial match | Adapt and modify |
|
|
165
|
+
| < 0.5 | Weak match | Create new approach |
|
|
166
|
+
|
|
167
|
+
</details>
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
<details>
|
|
172
|
+
<summary><b>Directory Structure</b></summary>
|
|
103
173
|
|
|
104
174
|
```
|
|
105
175
|
project/
|
|
106
|
-
├── AGENTS.md
|
|
176
|
+
├── AGENTS.md # Main project instructions (Codex format)
|
|
107
177
|
├── .agents/
|
|
108
|
-
│ ├── config.toml
|
|
109
|
-
│ ├── skills/
|
|
178
|
+
│ ├── config.toml # Project configuration
|
|
179
|
+
│ ├── skills/ # 137+ skills
|
|
110
180
|
│ │ ├── swarm-orchestration/
|
|
111
181
|
│ │ │ └── SKILL.md
|
|
112
182
|
│ │ ├── memory-management/
|
|
113
183
|
│ │ │ └── SKILL.md
|
|
184
|
+
│ │ ├── sparc-methodology/
|
|
185
|
+
│ │ │ └── SKILL.md
|
|
114
186
|
│ │ └── ...
|
|
115
|
-
│ └── README.md
|
|
116
|
-
├── .codex/
|
|
117
|
-
│ ├── config.toml
|
|
118
|
-
│ └── AGENTS.override.md
|
|
119
|
-
└── .claude-flow/
|
|
120
|
-
├── config.yaml
|
|
121
|
-
├── data/
|
|
122
|
-
└──
|
|
187
|
+
│ └── README.md # Directory documentation
|
|
188
|
+
├── .codex/ # Local overrides (gitignored)
|
|
189
|
+
│ ├── config.toml # Local development settings
|
|
190
|
+
│ └── AGENTS.override.md # Local instruction overrides
|
|
191
|
+
└── .claude-flow/ # Runtime data
|
|
192
|
+
├── config.yaml # Runtime configuration
|
|
193
|
+
├── data/ # Memory and cache
|
|
194
|
+
│ └── memory.db # SQLite with vector embeddings
|
|
195
|
+
└── logs/ # Log files
|
|
123
196
|
```
|
|
124
197
|
|
|
125
|
-
|
|
198
|
+
### Key Files
|
|
199
|
+
|
|
200
|
+
| File | Purpose |
|
|
201
|
+
|------|---------|
|
|
202
|
+
| `AGENTS.md` | Main instructions for Codex (required) |
|
|
203
|
+
| `.agents/config.toml` | Project-wide configuration |
|
|
204
|
+
| `.codex/config.toml` | Local overrides (gitignored) |
|
|
205
|
+
| `.claude-flow/data/memory.db` | Vector memory database |
|
|
206
|
+
|
|
207
|
+
</details>
|
|
208
|
+
|
|
209
|
+
---
|
|
126
210
|
|
|
127
|
-
|
|
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 |
|
|
211
|
+
<details>
|
|
212
|
+
<summary><b>Templates</b></summary>
|
|
133
213
|
|
|
134
|
-
|
|
214
|
+
### Available Templates
|
|
215
|
+
|
|
216
|
+
| Template | Skills | Learning | Best For |
|
|
217
|
+
|----------|--------|----------|----------|
|
|
218
|
+
| `minimal` | 2 | Basic | Quick prototypes |
|
|
219
|
+
| `default` | 4 | Yes | Standard projects |
|
|
220
|
+
| `full` | 137+ | Yes | Full-featured development |
|
|
221
|
+
| `enterprise` | 137+ | Advanced | Team environments |
|
|
222
|
+
|
|
223
|
+
### Usage
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
# Minimal (fastest init)
|
|
227
|
+
npx claude-flow@alpha init --codex --minimal
|
|
228
|
+
|
|
229
|
+
# Default
|
|
230
|
+
npx claude-flow@alpha init --codex
|
|
231
|
+
|
|
232
|
+
# Full (all skills)
|
|
233
|
+
npx claude-flow@alpha init --codex --full
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Template Contents
|
|
237
|
+
|
|
238
|
+
**Minimal:**
|
|
239
|
+
- Core swarm orchestration
|
|
240
|
+
- Basic memory management
|
|
241
|
+
|
|
242
|
+
**Default:**
|
|
243
|
+
- Swarm orchestration
|
|
244
|
+
- Memory management
|
|
245
|
+
- SPARC methodology
|
|
246
|
+
- Basic coding patterns
|
|
247
|
+
|
|
248
|
+
**Full:**
|
|
249
|
+
- All 137+ skills
|
|
250
|
+
- GitHub integration
|
|
251
|
+
- Security scanning
|
|
252
|
+
- Performance optimization
|
|
253
|
+
- AgentDB vector search
|
|
254
|
+
- Neural pattern training
|
|
255
|
+
|
|
256
|
+
</details>
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
<details>
|
|
261
|
+
<summary><b>Platform Comparison (Claude Code vs Codex)</b></summary>
|
|
135
262
|
|
|
136
263
|
| Feature | Claude Code | OpenAI Codex |
|
|
137
264
|
|---------|-------------|--------------|
|
|
138
|
-
| Config File | CLAUDE.md | AGENTS.md |
|
|
139
|
-
| Skills Dir |
|
|
265
|
+
| Config File | `CLAUDE.md` | `AGENTS.md` |
|
|
266
|
+
| Skills Dir | `.claude/skills/` | `.agents/skills/` |
|
|
140
267
|
| Skill Syntax | `/skill-name` | `$skill-name` |
|
|
141
|
-
| Settings | settings.json | config.toml |
|
|
268
|
+
| Settings | `settings.json` | `config.toml` |
|
|
142
269
|
| MCP | Native | Via `codex mcp add` |
|
|
270
|
+
| Overrides | `.claude.local.md` | `.codex/config.toml` |
|
|
271
|
+
|
|
272
|
+
### Dual Mode
|
|
273
|
+
|
|
274
|
+
Run `init --dual` to set up both platforms:
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
npx claude-flow@alpha init --dual
|
|
278
|
+
```
|
|
143
279
|
|
|
144
|
-
|
|
280
|
+
This creates:
|
|
281
|
+
- `CLAUDE.md` for Claude Code users
|
|
282
|
+
- `AGENTS.md` for Codex users
|
|
283
|
+
- Shared `.claude-flow/` runtime
|
|
284
|
+
- Cross-compatible skills
|
|
285
|
+
|
|
286
|
+
</details>
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
<details>
|
|
291
|
+
<summary><b>Skill Invocation</b></summary>
|
|
292
|
+
|
|
293
|
+
### Syntax
|
|
145
294
|
|
|
146
295
|
In OpenAI Codex CLI, invoke skills with `$` prefix:
|
|
147
296
|
|
|
@@ -152,9 +301,46 @@ $sparc-methodology
|
|
|
152
301
|
$security-audit
|
|
153
302
|
$agent-coder
|
|
154
303
|
$agent-tester
|
|
304
|
+
$github-workflow
|
|
305
|
+
$performance-optimization
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### Skill Categories
|
|
309
|
+
|
|
310
|
+
| Category | Examples |
|
|
311
|
+
|----------|----------|
|
|
312
|
+
| **Swarm** | `$swarm-orchestration`, `$swarm-advanced` |
|
|
313
|
+
| **Memory** | `$memory-management`, `$agentdb-vector-search` |
|
|
314
|
+
| **SPARC** | `$sparc-methodology`, `$specification`, `$architecture` |
|
|
315
|
+
| **GitHub** | `$github-code-review`, `$github-workflow-automation` |
|
|
316
|
+
| **Security** | `$security-audit`, `$security-overhaul` |
|
|
317
|
+
| **Testing** | `$tdd-london-swarm`, `$production-validator` |
|
|
318
|
+
|
|
319
|
+
### Custom Skills
|
|
320
|
+
|
|
321
|
+
Create custom skills in `.agents/skills/`:
|
|
322
|
+
|
|
323
|
+
```
|
|
324
|
+
.agents/skills/my-skill/
|
|
325
|
+
└── SKILL.md
|
|
155
326
|
```
|
|
156
327
|
|
|
157
|
-
|
|
328
|
+
**SKILL.md format:**
|
|
329
|
+
```markdown
|
|
330
|
+
# My Custom Skill
|
|
331
|
+
|
|
332
|
+
Instructions for what this skill does...
|
|
333
|
+
|
|
334
|
+
## Usage
|
|
335
|
+
Invoke with `$my-skill`
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
</details>
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
<details>
|
|
343
|
+
<summary><b>Configuration</b></summary>
|
|
158
344
|
|
|
159
345
|
### .agents/config.toml
|
|
160
346
|
|
|
@@ -162,12 +348,15 @@ $agent-tester
|
|
|
162
348
|
# Model configuration
|
|
163
349
|
model = "gpt-4"
|
|
164
350
|
|
|
165
|
-
# Approval policy
|
|
351
|
+
# Approval policy: "always" | "on-request" | "never"
|
|
166
352
|
approval_policy = "on-request"
|
|
167
353
|
|
|
168
|
-
# Sandbox mode
|
|
354
|
+
# Sandbox mode: "read-only" | "workspace-write" | "danger-full-access"
|
|
169
355
|
sandbox_mode = "workspace-write"
|
|
170
356
|
|
|
357
|
+
# Web search: "off" | "cached" | "live"
|
|
358
|
+
web_search = "cached"
|
|
359
|
+
|
|
171
360
|
# MCP Servers
|
|
172
361
|
[mcp_servers.claude-flow]
|
|
173
362
|
command = "npx"
|
|
@@ -182,31 +371,117 @@ enabled = true
|
|
|
182
371
|
[[skills]]
|
|
183
372
|
path = ".agents/skills/memory-management"
|
|
184
373
|
enabled = true
|
|
374
|
+
|
|
375
|
+
[[skills]]
|
|
376
|
+
path = ".agents/skills/sparc-methodology"
|
|
377
|
+
enabled = true
|
|
185
378
|
```
|
|
186
379
|
|
|
187
|
-
### .codex/config.toml (Local)
|
|
380
|
+
### .codex/config.toml (Local Overrides)
|
|
188
381
|
|
|
189
382
|
```toml
|
|
190
383
|
# Local development overrides (gitignored)
|
|
384
|
+
# These settings override .agents/config.toml
|
|
385
|
+
|
|
191
386
|
approval_policy = "never"
|
|
192
387
|
sandbox_mode = "danger-full-access"
|
|
193
388
|
web_search = "live"
|
|
389
|
+
|
|
390
|
+
# Disable MCP in local if needed
|
|
391
|
+
[mcp_servers.claude-flow]
|
|
392
|
+
enabled = false
|
|
194
393
|
```
|
|
195
394
|
|
|
196
|
-
|
|
395
|
+
### Environment Variables
|
|
396
|
+
|
|
397
|
+
```bash
|
|
398
|
+
# Configuration paths
|
|
399
|
+
CLAUDE_FLOW_CONFIG=./claude-flow.config.json
|
|
400
|
+
CLAUDE_FLOW_MEMORY_PATH=./.claude-flow/data
|
|
401
|
+
|
|
402
|
+
# Provider keys
|
|
403
|
+
ANTHROPIC_API_KEY=sk-ant-...
|
|
404
|
+
OPENAI_API_KEY=sk-...
|
|
405
|
+
|
|
406
|
+
# MCP settings
|
|
407
|
+
CLAUDE_FLOW_MCP_PORT=3000
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
</details>
|
|
411
|
+
|
|
412
|
+
---
|
|
413
|
+
|
|
414
|
+
<details>
|
|
415
|
+
<summary><b>Vector Search Details</b></summary>
|
|
416
|
+
|
|
417
|
+
### Specifications
|
|
418
|
+
|
|
419
|
+
| Property | Value |
|
|
420
|
+
|----------|-------|
|
|
421
|
+
| Embedding Dimensions | 384 |
|
|
422
|
+
| Search Algorithm | HNSW |
|
|
423
|
+
| Speed Improvement | 150x-12,500x faster |
|
|
424
|
+
| Similarity Range | 0.0 - 1.0 |
|
|
425
|
+
| Storage | SQLite with vector extension |
|
|
426
|
+
| Model | all-MiniLM-L6-v2 |
|
|
427
|
+
|
|
428
|
+
### Namespaces
|
|
429
|
+
|
|
430
|
+
| Namespace | Purpose |
|
|
431
|
+
|-----------|---------|
|
|
432
|
+
| `patterns` | Successful code patterns |
|
|
433
|
+
| `solutions` | Bug fixes and solutions |
|
|
434
|
+
| `tasks` | Task completion records |
|
|
435
|
+
| `coordination` | Swarm state |
|
|
436
|
+
| `results` | Worker results |
|
|
437
|
+
| `default` | General storage |
|
|
438
|
+
|
|
439
|
+
### Example Searches
|
|
197
440
|
|
|
198
|
-
|
|
441
|
+
```javascript
|
|
442
|
+
// Find auth patterns
|
|
443
|
+
memory_search({ query: "authentication JWT patterns", namespace: "patterns" })
|
|
444
|
+
|
|
445
|
+
// Find bug solutions
|
|
446
|
+
memory_search({ query: "null pointer fix", namespace: "solutions" })
|
|
447
|
+
|
|
448
|
+
// Find past tasks
|
|
449
|
+
memory_search({ query: "user profile API", namespace: "tasks" })
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
</details>
|
|
453
|
+
|
|
454
|
+
---
|
|
455
|
+
|
|
456
|
+
<details>
|
|
457
|
+
<summary><b>API Reference</b></summary>
|
|
458
|
+
|
|
459
|
+
### CodexInitializer Class
|
|
199
460
|
|
|
200
461
|
```typescript
|
|
462
|
+
import { CodexInitializer } from '@claude-flow/codex';
|
|
463
|
+
|
|
201
464
|
class CodexInitializer {
|
|
465
|
+
/**
|
|
466
|
+
* Initialize a Codex project
|
|
467
|
+
*/
|
|
202
468
|
async initialize(options: CodexInitOptions): Promise<CodexInitResult>;
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* Preview what would be created without writing files
|
|
472
|
+
*/
|
|
203
473
|
async dryRun(options: CodexInitOptions): Promise<string[]>;
|
|
204
474
|
}
|
|
205
475
|
```
|
|
206
476
|
|
|
207
|
-
### initializeCodexProject
|
|
477
|
+
### initializeCodexProject Function
|
|
208
478
|
|
|
209
479
|
```typescript
|
|
480
|
+
import { initializeCodexProject } from '@claude-flow/codex';
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Quick initialization helper
|
|
484
|
+
*/
|
|
210
485
|
async function initializeCodexProject(
|
|
211
486
|
projectPath: string,
|
|
212
487
|
options?: Partial<CodexInitOptions>
|
|
@@ -217,24 +492,35 @@ async function initializeCodexProject(
|
|
|
217
492
|
|
|
218
493
|
```typescript
|
|
219
494
|
interface CodexInitOptions {
|
|
495
|
+
/** Project directory path */
|
|
220
496
|
projectPath: string;
|
|
497
|
+
/** Template to use */
|
|
221
498
|
template?: 'minimal' | 'default' | 'full' | 'enterprise';
|
|
499
|
+
/** Specific skills to include */
|
|
222
500
|
skills?: string[];
|
|
501
|
+
/** Overwrite existing files */
|
|
223
502
|
force?: boolean;
|
|
503
|
+
/** Enable dual mode (Claude Code + Codex) */
|
|
224
504
|
dual?: boolean;
|
|
225
505
|
}
|
|
226
506
|
|
|
227
507
|
interface CodexInitResult {
|
|
508
|
+
/** Whether initialization succeeded */
|
|
228
509
|
success: boolean;
|
|
510
|
+
/** List of files created */
|
|
229
511
|
filesCreated: string[];
|
|
512
|
+
/** List of skills generated */
|
|
230
513
|
skillsGenerated: string[];
|
|
514
|
+
/** Whether MCP was registered */
|
|
231
515
|
mcpRegistered?: boolean;
|
|
516
|
+
/** Non-fatal warnings */
|
|
232
517
|
warnings?: string[];
|
|
518
|
+
/** Fatal errors */
|
|
233
519
|
errors?: string[];
|
|
234
520
|
}
|
|
235
521
|
```
|
|
236
522
|
|
|
237
|
-
|
|
523
|
+
### Programmatic Usage
|
|
238
524
|
|
|
239
525
|
```typescript
|
|
240
526
|
import { CodexInitializer, initializeCodexProject } from '@claude-flow/codex';
|
|
@@ -246,32 +532,33 @@ const result = await initializeCodexProject('/path/to/project', {
|
|
|
246
532
|
dual: false,
|
|
247
533
|
});
|
|
248
534
|
|
|
535
|
+
console.log(`Files created: ${result.filesCreated.length}`);
|
|
536
|
+
console.log(`Skills: ${result.skillsGenerated.length}`);
|
|
537
|
+
console.log(`MCP registered: ${result.mcpRegistered}`);
|
|
538
|
+
|
|
249
539
|
// Or use the class directly
|
|
250
540
|
const initializer = new CodexInitializer();
|
|
251
541
|
const result = await initializer.initialize({
|
|
252
542
|
projectPath: '/path/to/project',
|
|
253
543
|
template: 'enterprise',
|
|
254
|
-
skills: ['swarm-orchestration', 'memory-management'],
|
|
544
|
+
skills: ['swarm-orchestration', 'memory-management', 'security-audit'],
|
|
255
545
|
force: false,
|
|
256
546
|
dual: true,
|
|
257
547
|
});
|
|
258
548
|
|
|
259
|
-
|
|
260
|
-
console.
|
|
549
|
+
if (result.warnings?.length) {
|
|
550
|
+
console.warn('Warnings:', result.warnings);
|
|
551
|
+
}
|
|
261
552
|
```
|
|
262
553
|
|
|
263
|
-
|
|
554
|
+
</details>
|
|
264
555
|
|
|
265
|
-
|
|
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
|
|
556
|
+
---
|
|
271
557
|
|
|
272
|
-
|
|
558
|
+
<details>
|
|
559
|
+
<summary><b>Migration from Claude Code</b></summary>
|
|
273
560
|
|
|
274
|
-
Convert
|
|
561
|
+
### Convert CLAUDE.md to AGENTS.md
|
|
275
562
|
|
|
276
563
|
```typescript
|
|
277
564
|
import { migrate } from '@claude-flow/codex';
|
|
@@ -282,14 +569,98 @@ const result = await migrate({
|
|
|
282
569
|
preserveComments: true,
|
|
283
570
|
generateSkills: true,
|
|
284
571
|
});
|
|
572
|
+
|
|
573
|
+
console.log(`Migrated: ${result.success}`);
|
|
574
|
+
console.log(`Skills generated: ${result.skillsGenerated.length}`);
|
|
285
575
|
```
|
|
286
576
|
|
|
577
|
+
### Manual Migration Checklist
|
|
578
|
+
|
|
579
|
+
1. **Rename config file**: `CLAUDE.md` → `AGENTS.md`
|
|
580
|
+
2. **Move skills**: `.claude/skills/` → `.agents/skills/`
|
|
581
|
+
3. **Update syntax**: `/skill-name` → `$skill-name`
|
|
582
|
+
4. **Convert settings**: `settings.json` → `config.toml`
|
|
583
|
+
5. **Register MCP**: `codex mcp add claude-flow -- npx claude-flow mcp start`
|
|
584
|
+
|
|
585
|
+
### Dual Mode Alternative
|
|
586
|
+
|
|
587
|
+
Instead of migrating, use dual mode to support both:
|
|
588
|
+
|
|
589
|
+
```bash
|
|
590
|
+
npx claude-flow@alpha init --dual
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
This keeps both `CLAUDE.md` and `AGENTS.md` in sync.
|
|
594
|
+
|
|
595
|
+
</details>
|
|
596
|
+
|
|
597
|
+
---
|
|
598
|
+
|
|
599
|
+
<details>
|
|
600
|
+
<summary><b>Troubleshooting</b></summary>
|
|
601
|
+
|
|
602
|
+
### MCP Not Working
|
|
603
|
+
|
|
604
|
+
```bash
|
|
605
|
+
# Check if registered
|
|
606
|
+
codex mcp list
|
|
607
|
+
|
|
608
|
+
# Re-register
|
|
609
|
+
codex mcp remove claude-flow
|
|
610
|
+
codex mcp add claude-flow -- npx claude-flow mcp start
|
|
611
|
+
|
|
612
|
+
# Test connection
|
|
613
|
+
npx claude-flow mcp test
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
### Memory Search Returns Empty
|
|
617
|
+
|
|
618
|
+
```bash
|
|
619
|
+
# Initialize memory database
|
|
620
|
+
npx claude-flow memory init --force
|
|
621
|
+
|
|
622
|
+
# Check if entries exist
|
|
623
|
+
npx claude-flow memory list
|
|
624
|
+
|
|
625
|
+
# Manually add a test pattern
|
|
626
|
+
npx claude-flow memory store --key "test" --value "test pattern" --namespace patterns
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
### Skills Not Loading
|
|
630
|
+
|
|
631
|
+
```bash
|
|
632
|
+
# Verify skill directory
|
|
633
|
+
ls -la .agents/skills/
|
|
634
|
+
|
|
635
|
+
# Check config.toml for skill registration
|
|
636
|
+
cat .agents/config.toml | grep skills
|
|
637
|
+
|
|
638
|
+
# Rebuild skills
|
|
639
|
+
npx claude-flow@alpha init --codex --force
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
### Vector Search Slow
|
|
643
|
+
|
|
644
|
+
```bash
|
|
645
|
+
# Check HNSW index
|
|
646
|
+
npx claude-flow memory stats
|
|
647
|
+
|
|
648
|
+
# Rebuild index
|
|
649
|
+
npx claude-flow memory optimize --rebuild-index
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
</details>
|
|
653
|
+
|
|
654
|
+
---
|
|
655
|
+
|
|
287
656
|
## Related Packages
|
|
288
657
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
658
|
+
| Package | Description |
|
|
659
|
+
|---------|-------------|
|
|
660
|
+
| [@claude-flow/cli](https://www.npmjs.com/package/@claude-flow/cli) | Main CLI (26 commands, 140+ subcommands) |
|
|
661
|
+
| [claude-flow](https://www.npmjs.com/package/claude-flow) | Umbrella package |
|
|
662
|
+
| [@claude-flow/memory](https://www.npmjs.com/package/@claude-flow/memory) | AgentDB with HNSW vector search |
|
|
663
|
+
| [@claude-flow/security](https://www.npmjs.com/package/@claude-flow/security) | Security module |
|
|
293
664
|
|
|
294
665
|
## License
|
|
295
666
|
|