agentic-flow 1.1.13 → 1.1.14
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/CHANGELOG.md +138 -0
- package/README.md +192 -2
- package/dist/cli/claude-code-wrapper.js +278 -0
- package/dist/cli-proxy.js +26 -0
- package/dist/proxy/anthropic-to-openrouter.js +209 -47
- package/dist/proxy/provider-instructions.js +19 -7
- package/dist/utils/cli.js +5 -0
- package/docs/.claude-flow/metrics/performance.json +1 -1
- package/docs/.claude-flow/metrics/task-metrics.json +3 -3
- package/docs/INDEX.md +44 -31
- package/docs/archived/FIXES-APPLIED-STATUS.md +331 -0
- package/docs/archived/OPENROUTER-FIX-VALIDATION.md +333 -0
- package/docs/archived/OPENROUTER-SUCCESS-REPORT.md +520 -0
- package/docs/archived/OPENROUTER_ISSUES_AND_FIXES.md +277 -0
- package/docs/archived/README.md +13 -20
- package/docs/archived/README_V1.1.11.md +280 -0
- package/docs/archived/RELEASE-NOTES-v1.1.13.md +392 -0
- package/docs/archived/VALIDATION-RESULTS.md +279 -0
- package/docs/archived/claude-flow-integration.md +463 -0
- package/docs/archived/docker-cli-validation.md +289 -0
- package/docs/archived/docker-memory-coordination-status.md +261 -0
- package/docs/archived/mcp-validation-summary.md +264 -0
- package/docs/archived/quick-wins-validation.md +377 -0
- package/docs/guides/.claude-flow/metrics/agent-metrics.json +1 -0
- package/docs/guides/.claude-flow/metrics/performance.json +9 -0
- package/docs/guides/.claude-flow/metrics/task-metrics.json +10 -0
- package/docs/guides/CLAUDE-CODE-INTEGRATION.md +403 -0
- package/docs/router/.claude-flow/metrics/agent-metrics.json +1 -0
- package/docs/router/.claude-flow/metrics/performance.json +9 -0
- package/docs/router/.claude-flow/metrics/task-metrics.json +10 -0
- package/docs/validation/README.md +14 -14
- package/package.json +8 -3
- package/scripts/build.sh +30 -0
- package/scripts/claude-code +56 -0
- package/scripts/claude-flow +81 -0
- package/scripts/claude-flow.bat +18 -0
- package/scripts/claude-flow.ps1 +24 -0
- package/scripts/test-all-commands.sh +46 -0
- package/scripts/test-claude-flow-sdk.sh +46 -0
- package/scripts/test-fastmcp-docker.sh +132 -0
- package/scripts/test-fastmcp-poc.sh +26 -0
- package/scripts/test-functionality.sh +50 -0
- package/scripts/test-onnx-docker.sh +176 -0
- package/scripts/test-router-docker.sh +105 -0
- package/scripts/validate-mcp-cli-tools.sh +104 -0
- package/scripts/validate-providers.sh +50 -0
- /package/docs/{validation → archived}/COMPLETE_VALIDATION_SUMMARY.md +0 -0
- /package/docs/{validation → archived}/DOCKER_MCP_VALIDATION.md +0 -0
- /package/docs/{validation → archived}/DOCKER_OPENROUTER_VALIDATION.md +0 -0
- /package/docs/{validation → archived}/FINAL_SDK_VALIDATION.md +0 -0
- /package/docs/{validation → archived}/FINAL_SYSTEM_VALIDATION.md +0 -0
- /package/docs/{validation → archived}/FINAL_VALIDATION_SUMMARY.md +0 -0
- /package/docs/{validation → archived}/MCP_CLI_TOOLS_VALIDATION.md +0 -0
- /package/docs/{validation → archived}/MCP_INTEGRATION_SUCCESS.md +0 -0
- /package/docs/{MCP_PROXY_VALIDATION.md → archived/MCP_PROXY_VALIDATION.md} +0 -0
- /package/docs/{validation → archived}/MODEL_VALIDATION_REPORT.md +0 -0
- /package/docs/{guides → archived}/ONNX_ENV_VARS.md +0 -0
- /package/docs/{guides → archived}/ONNX_INTEGRATION.md +0 -0
- /package/docs/{guides → archived}/ONNX_OPTIMIZATION_SUMMARY.md +0 -0
- /package/docs/{router → archived}/ONNX_PHI4_RESEARCH.md +0 -0
- /package/docs/{router → archived}/ONNX_RUNTIME_INTEGRATION_PLAN.md +0 -0
- /package/docs/{guides → archived}/ONNX_VS_CLAUDE_QUALITY.md +0 -0
- /package/docs/{validation → archived}/OPENROUTER_VALIDATION_COMPLETE.md +0 -0
- /package/docs/{guides → archived}/OPTIMIZATION_SUMMARY.md +0 -0
- /package/docs/{router → archived}/PHI4_HYPEROPTIMIZATION_PLAN.md +0 -0
- /package/docs/{guides → archived}/PROVIDER_INSTRUCTION_OPTIMIZATION.md +0 -0
- /package/docs/{validation → archived}/PROXY_VALIDATION.md +0 -0
- /package/docs/{validation → archived}/README_SDK_VALIDATION.md +0 -0
- /package/docs/{validation → archived}/ROUTER_VALIDATION.md +0 -0
- /package/docs/{validation → archived}/SDK_INTEGRATION_COMPLETE.md +0 -0
- /package/docs/{guides → archived}/TOOL_INSTRUCTION_ENHANCEMENT.md +0 -0
- /package/docs/{V1.1.10_VALIDATION.md → archived/V1.1.10_VALIDATION.md} +0 -0
- /package/docs/{V1.1.11_COMPLETE_VALIDATION.md → archived/V1.1.11_COMPLETE_VALIDATION.md} +0 -0
- /package/docs/{V1.1.11_MCP_PROXY_FIX.md → archived/V1.1.11_MCP_PROXY_FIX.md} +0 -0
- /package/docs/{validation → archived}/VALIDATION_COMPLETE.md +0 -0
- /package/docs/{validation → archived}/VALIDATION_SUMMARY.md +0 -0
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
# Claude Code Integration with Agentic Flow
|
|
2
|
+
|
|
3
|
+
Use Claude Code with OpenRouter, Gemini, or ONNX providers through agentic-flow proxy.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
### Option 1: Auto-Start Proxy + Spawn Claude Code
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# OpenRouter (99% cost savings)
|
|
11
|
+
npx agentic-flow claude-code --provider openrouter "Write a Python function"
|
|
12
|
+
|
|
13
|
+
# Gemini (FREE tier available)
|
|
14
|
+
npx agentic-flow claude-code --provider gemini "Create a REST API"
|
|
15
|
+
|
|
16
|
+
# Anthropic (direct, no proxy)
|
|
17
|
+
npx agentic-flow claude-code --provider anthropic "Help me debug"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
This command:
|
|
21
|
+
1. ✅ Checks if proxy is running
|
|
22
|
+
2. ✅ Auto-starts proxy if needed (background)
|
|
23
|
+
3. ✅ Sets `ANTHROPIC_BASE_URL` to proxy endpoint
|
|
24
|
+
4. ✅ Configures provider-specific API keys
|
|
25
|
+
5. ✅ Spawns Claude Code with environment configured
|
|
26
|
+
6. ✅ Cleans up proxy on exit (optional with `--keep-proxy`)
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
### Option 2: Manual Proxy + Inline Environment Variables
|
|
31
|
+
|
|
32
|
+
**Terminal 1 - Start Proxy:**
|
|
33
|
+
```bash
|
|
34
|
+
npx agentic-flow proxy --provider openrouter --port 3000
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Terminal 2 - Use Claude Code:**
|
|
38
|
+
```bash
|
|
39
|
+
# Inline environment variables (cleanest native approach)
|
|
40
|
+
ANTHROPIC_BASE_URL=http://localhost:3000 \
|
|
41
|
+
ANTHROPIC_API_KEY=sk-ant-proxy-dummy \
|
|
42
|
+
OPENROUTER_API_KEY=$OPENROUTER_API_KEY \
|
|
43
|
+
claude "Write a Python function to sort a list"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
### Option 3: Bash Wrapper Script
|
|
49
|
+
|
|
50
|
+
Copy `scripts/claude-code` to your PATH:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# Install script
|
|
54
|
+
cp node_modules/agentic-flow/scripts/claude-code ~/bin/
|
|
55
|
+
chmod +x ~/bin/claude-code
|
|
56
|
+
|
|
57
|
+
# Usage
|
|
58
|
+
claude-code openrouter "Write a Python function"
|
|
59
|
+
claude-code gemini "Create a REST API"
|
|
60
|
+
claude-code anthropic "Help me debug"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Script Features:**
|
|
64
|
+
- Automatically sets `ANTHROPIC_BASE_URL` based on provider
|
|
65
|
+
- Validates API keys before running
|
|
66
|
+
- Supports custom proxy port via `AGENTIC_FLOW_PORT` env var
|
|
67
|
+
- Clean one-liner interface
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## CLI Options
|
|
72
|
+
|
|
73
|
+
### `npx agentic-flow claude-code [OPTIONS] [prompt]`
|
|
74
|
+
|
|
75
|
+
**Options:**
|
|
76
|
+
- `--provider <provider>` - Provider to use (`anthropic`, `openrouter`, `gemini`, `onnx`) [default: `anthropic`]
|
|
77
|
+
- `--port <port>` - Proxy server port [default: `3000`]
|
|
78
|
+
- `--model <model>` - Override default model for provider
|
|
79
|
+
- `--keep-proxy` - Keep proxy running after Claude Code exits
|
|
80
|
+
- `--no-auto-start` - Don't auto-start proxy (assumes already running)
|
|
81
|
+
|
|
82
|
+
**All other arguments are passed directly to Claude Code.**
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Examples
|
|
87
|
+
|
|
88
|
+
### Simple Code Generation
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# OpenRouter GPT-4o-mini (fast + cheap)
|
|
92
|
+
npx agentic-flow claude-code --provider openrouter \
|
|
93
|
+
"Write a Python function to reverse a string"
|
|
94
|
+
|
|
95
|
+
# Gemini 2.0 Flash (FREE + fast)
|
|
96
|
+
npx agentic-flow claude-code --provider gemini \
|
|
97
|
+
"Create a simple REST API with Flask"
|
|
98
|
+
|
|
99
|
+
# Direct Anthropic Claude Sonnet 4.5
|
|
100
|
+
npx agentic-flow claude-code --provider anthropic \
|
|
101
|
+
"Help me implement OAuth2 authentication"
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### With Custom Model
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Use specific OpenRouter model
|
|
108
|
+
npx agentic-flow claude-code \
|
|
109
|
+
--provider openrouter \
|
|
110
|
+
--model "meta-llama/llama-3.3-70b-instruct" \
|
|
111
|
+
"Write a complex sorting algorithm"
|
|
112
|
+
|
|
113
|
+
# Use specific Gemini model
|
|
114
|
+
npx agentic-flow claude-code \
|
|
115
|
+
--provider gemini \
|
|
116
|
+
--model "gemini-2.5-flash-thinking-exp-01-21" \
|
|
117
|
+
"Solve this algorithm problem"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### With Custom Port
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Start proxy on custom port
|
|
124
|
+
npx agentic-flow proxy --provider openrouter --port 8080
|
|
125
|
+
|
|
126
|
+
# Use Claude Code with custom port
|
|
127
|
+
npx agentic-flow claude-code \
|
|
128
|
+
--provider openrouter \
|
|
129
|
+
--port 8080 \
|
|
130
|
+
--no-auto-start \
|
|
131
|
+
"Write code"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Keep Proxy Running
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Useful for multiple Claude Code sessions
|
|
138
|
+
npx agentic-flow claude-code \
|
|
139
|
+
--provider openrouter \
|
|
140
|
+
--keep-proxy \
|
|
141
|
+
"First task"
|
|
142
|
+
|
|
143
|
+
# Proxy still running, no auto-start needed
|
|
144
|
+
npx agentic-flow claude-code \
|
|
145
|
+
--provider openrouter \
|
|
146
|
+
--no-auto-start \
|
|
147
|
+
"Second task"
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Provider Configuration
|
|
153
|
+
|
|
154
|
+
### OpenRouter
|
|
155
|
+
|
|
156
|
+
**Requirements:**
|
|
157
|
+
- `OPENROUTER_API_KEY` environment variable
|
|
158
|
+
|
|
159
|
+
**Default Model:** `meta-llama/llama-3.1-8b-instruct`
|
|
160
|
+
|
|
161
|
+
**Popular Models:**
|
|
162
|
+
- `openai/gpt-4o-mini` - Fast, cheap, high quality
|
|
163
|
+
- `deepseek/deepseek-chat` - Great for coding
|
|
164
|
+
- `meta-llama/llama-3.3-70b-instruct` - Open source
|
|
165
|
+
- `anthropic/claude-3.5-sonnet` - Via OpenRouter
|
|
166
|
+
|
|
167
|
+
**Cost Savings:** ~90-99% vs direct Anthropic API
|
|
168
|
+
|
|
169
|
+
### Gemini
|
|
170
|
+
|
|
171
|
+
**Requirements:**
|
|
172
|
+
- `GOOGLE_GEMINI_API_KEY` environment variable
|
|
173
|
+
|
|
174
|
+
**Default Model:** `gemini-2.0-flash-exp`
|
|
175
|
+
|
|
176
|
+
**Available Models:**
|
|
177
|
+
- `gemini-2.0-flash-exp` - FREE tier, fast
|
|
178
|
+
- `gemini-2.5-flash-thinking-exp-01-21` - Advanced reasoning
|
|
179
|
+
|
|
180
|
+
**Cost Savings:** FREE tier available!
|
|
181
|
+
|
|
182
|
+
### Anthropic (Direct)
|
|
183
|
+
|
|
184
|
+
**Requirements:**
|
|
185
|
+
- `ANTHROPIC_API_KEY` environment variable
|
|
186
|
+
|
|
187
|
+
**Models:** All Claude models (Opus, Sonnet, Haiku)
|
|
188
|
+
|
|
189
|
+
**No proxy needed** - Direct API communication
|
|
190
|
+
|
|
191
|
+
### ONNX (Local)
|
|
192
|
+
|
|
193
|
+
**Requirements:**
|
|
194
|
+
- None (runs locally)
|
|
195
|
+
|
|
196
|
+
**Models:** Local ONNX models (Phi-4, etc.)
|
|
197
|
+
|
|
198
|
+
**Privacy:** 100% offline, no API calls
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## How It Works
|
|
203
|
+
|
|
204
|
+
### Architecture
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
┌──────────────┐ ┌─────────────────┐ ┌──────────────┐
|
|
208
|
+
│ Claude Code │────────>│ Agentic Flow │────────>│ OpenRouter/ │
|
|
209
|
+
│ │ │ Proxy Server │ │ Gemini API │
|
|
210
|
+
│ (client) │ │ (localhost:3000)│ │ │
|
|
211
|
+
└──────────────┘ └─────────────────┘ └──────────────┘
|
|
212
|
+
│ │ │
|
|
213
|
+
│ ANTHROPIC_BASE_URL │ API Translation │
|
|
214
|
+
│ = http://localhost:3000 │ Format Conversion │
|
|
215
|
+
│ │ Tool Calling │
|
|
216
|
+
└───────────────────────────┴──────────────────────────┘
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Request Flow
|
|
220
|
+
|
|
221
|
+
1. **User runs:** `npx agentic-flow claude-code --provider openrouter "task"`
|
|
222
|
+
|
|
223
|
+
2. **Wrapper checks:**
|
|
224
|
+
- Is proxy running on port 3000?
|
|
225
|
+
- Is `OPENROUTER_API_KEY` set?
|
|
226
|
+
|
|
227
|
+
3. **Wrapper starts proxy (if needed):**
|
|
228
|
+
```bash
|
|
229
|
+
node dist/proxy/anthropic-to-openrouter.js
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
4. **Wrapper spawns Claude Code with env:**
|
|
233
|
+
```bash
|
|
234
|
+
ANTHROPIC_BASE_URL=http://localhost:3000
|
|
235
|
+
ANTHROPIC_API_KEY=sk-ant-proxy-dummy
|
|
236
|
+
OPENROUTER_API_KEY=sk-or-v1-xxxxx
|
|
237
|
+
claude "task"
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
5. **Claude Code sends request to proxy:**
|
|
241
|
+
- Uses Anthropic Messages API format
|
|
242
|
+
- Sends to `http://localhost:3000/v1/messages`
|
|
243
|
+
|
|
244
|
+
6. **Proxy translates request:**
|
|
245
|
+
- Converts Anthropic format → OpenAI format
|
|
246
|
+
- Injects provider-specific instructions
|
|
247
|
+
- Applies model-specific max_tokens
|
|
248
|
+
- Forwards to OpenRouter/Gemini API
|
|
249
|
+
|
|
250
|
+
7. **Provider responds:**
|
|
251
|
+
- OpenRouter/Gemini returns response
|
|
252
|
+
- Proxy converts back to Anthropic format
|
|
253
|
+
- Claude Code displays result
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Troubleshooting
|
|
258
|
+
|
|
259
|
+
### Proxy Won't Start
|
|
260
|
+
|
|
261
|
+
**Error:** `Proxy startup timeout`
|
|
262
|
+
|
|
263
|
+
**Solution:**
|
|
264
|
+
```bash
|
|
265
|
+
# Check if port is in use
|
|
266
|
+
lsof -i :3000
|
|
267
|
+
|
|
268
|
+
# Kill process if needed
|
|
269
|
+
kill -9 <PID>
|
|
270
|
+
|
|
271
|
+
# Use custom port
|
|
272
|
+
npx agentic-flow claude-code --provider openrouter --port 3001 "task"
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### API Key Not Found
|
|
276
|
+
|
|
277
|
+
**Error:** `❌ Error: Missing API key for openrouter`
|
|
278
|
+
|
|
279
|
+
**Solution:**
|
|
280
|
+
```bash
|
|
281
|
+
# Set API key
|
|
282
|
+
export OPENROUTER_API_KEY=sk-or-v1-xxxxx
|
|
283
|
+
|
|
284
|
+
# Or use inline
|
|
285
|
+
OPENROUTER_API_KEY=sk-or-v1-xxxxx \
|
|
286
|
+
npx agentic-flow claude-code --provider openrouter "task"
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Claude Code Not Found
|
|
290
|
+
|
|
291
|
+
**Error:** `claude: command not found`
|
|
292
|
+
|
|
293
|
+
**Solution:**
|
|
294
|
+
```bash
|
|
295
|
+
# Install Claude Code CLI
|
|
296
|
+
npm install -g @anthropic-ai/claude-code
|
|
297
|
+
|
|
298
|
+
# Or use npx
|
|
299
|
+
npx @anthropic-ai/claude-code --version
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### Proxy Returns Errors
|
|
303
|
+
|
|
304
|
+
**Check proxy logs:**
|
|
305
|
+
```bash
|
|
306
|
+
# Start proxy manually with verbose logging
|
|
307
|
+
VERBOSE=true npx agentic-flow proxy --provider openrouter
|
|
308
|
+
|
|
309
|
+
# In another terminal, test with curl
|
|
310
|
+
curl -X POST http://localhost:3000/v1/messages \
|
|
311
|
+
-H "Content-Type: application/json" \
|
|
312
|
+
-H "x-api-key: sk-ant-proxy-dummy" \
|
|
313
|
+
-d '{"model":"claude-3-5-sonnet-20241022","messages":[{"role":"user","content":"hello"}],"max_tokens":100}'
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## Validation
|
|
319
|
+
|
|
320
|
+
### Test All Providers
|
|
321
|
+
|
|
322
|
+
```bash
|
|
323
|
+
# Test OpenRouter
|
|
324
|
+
npx agentic-flow claude-code --provider openrouter "print hello world in python"
|
|
325
|
+
|
|
326
|
+
# Test Gemini
|
|
327
|
+
npx agentic-flow claude-code --provider gemini "print hello world in python"
|
|
328
|
+
|
|
329
|
+
# Test Anthropic
|
|
330
|
+
npx agentic-flow claude-code --provider anthropic "print hello world in python"
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### Expected Results
|
|
334
|
+
|
|
335
|
+
All providers should return clean Python code:
|
|
336
|
+
|
|
337
|
+
```python
|
|
338
|
+
print("Hello, World!")
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
**No XML tags** like `<file_write>` should appear in simple code generation tasks.
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
## Advanced Usage
|
|
346
|
+
|
|
347
|
+
### Custom Proxy Configuration
|
|
348
|
+
|
|
349
|
+
```typescript
|
|
350
|
+
// Start programmatic proxy
|
|
351
|
+
import { AnthropicToOpenRouterProxy } from 'agentic-flow/dist/proxy/anthropic-to-openrouter.js';
|
|
352
|
+
|
|
353
|
+
const proxy = new AnthropicToOpenRouterProxy({
|
|
354
|
+
openrouterApiKey: process.env.OPENROUTER_API_KEY,
|
|
355
|
+
openrouterBaseUrl: 'https://openrouter.ai/api/v1',
|
|
356
|
+
defaultModel: 'openai/gpt-4o-mini'
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
proxy.start(3000);
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
### Environment Variable Presets
|
|
363
|
+
|
|
364
|
+
Create `~/.agentic-flow-presets`:
|
|
365
|
+
|
|
366
|
+
```bash
|
|
367
|
+
# OpenRouter preset
|
|
368
|
+
alias claude-openrouter='ANTHROPIC_BASE_URL=http://localhost:3000 ANTHROPIC_API_KEY=dummy claude'
|
|
369
|
+
|
|
370
|
+
# Gemini preset
|
|
371
|
+
alias claude-gemini='ANTHROPIC_BASE_URL=http://localhost:3001 ANTHROPIC_API_KEY=dummy claude'
|
|
372
|
+
|
|
373
|
+
# Usage
|
|
374
|
+
claude-openrouter "Write code"
|
|
375
|
+
claude-gemini "Write code"
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
---
|
|
379
|
+
|
|
380
|
+
## Related Documentation
|
|
381
|
+
|
|
382
|
+
- [Provider Instruction Optimization](./PROVIDER_INSTRUCTION_OPTIMIZATION.md)
|
|
383
|
+
- [OpenRouter Deployment Guide](./OPENROUTER_DEPLOYMENT.md)
|
|
384
|
+
- [Validation Results](../../VALIDATION-RESULTS.md)
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
## Changelog
|
|
389
|
+
|
|
390
|
+
**v1.1.13** - Initial claude-code integration
|
|
391
|
+
- Added `npx agentic-flow claude-code` command
|
|
392
|
+
- Auto-start proxy functionality
|
|
393
|
+
- Provider detection and baseURL export
|
|
394
|
+
- Bash wrapper script for convenience
|
|
395
|
+
- 100% success rate across all providers
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
## Support
|
|
400
|
+
|
|
401
|
+
**GitHub Issues:** https://github.com/ruvnet/agentic-flow/issues
|
|
402
|
+
|
|
403
|
+
**Documentation:** https://github.com/ruvnet/agentic-flow#readme
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
# Validation & Testing
|
|
1
|
+
# Validation & Testing
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This directory contains validation reports and testing documentation for agentic-flow.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Current Status
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
-
|
|
7
|
+
All validation files have been archived. The current validation status can be found in:
|
|
8
|
+
- Main project README.md
|
|
9
|
+
- CHANGELOG.md for version-specific validation notes
|
|
9
10
|
|
|
10
|
-
##
|
|
11
|
+
## Archived Reports
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
13
|
+
Historical validation reports have been moved to `../archived/` including:
|
|
14
|
+
- Version-specific validation reports (v1.1.10, v1.1.11)
|
|
15
|
+
- MCP proxy validation
|
|
16
|
+
- OpenRouter integration validation
|
|
17
|
+
- Docker deployment validation
|
|
18
|
+
- SDK integration reports
|
|
16
19
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- [OpenRouter Validation Complete](OPENROUTER_VALIDATION_COMPLETE.md) - OpenRouter integration validation
|
|
20
|
-
- [Router Validation](ROUTER_VALIDATION.md) - Multi-model router validation tests
|
|
20
|
+
For historical context, see the archived directory.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentic-flow",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "Production-ready AI agent orchestration platform with 66 specialized agents, 111 MCP tools, and autonomous multi-agent swarms. Built by @ruvnet with Claude Agent SDK, neural networks, memory persistence, GitHub integration, and distributed consensus protocols. v1.1.
|
|
3
|
+
"version": "1.1.14",
|
|
4
|
+
"description": "Production-ready AI agent orchestration platform with 66 specialized agents, 111 MCP tools, and autonomous multi-agent swarms. Built by @ruvnet with Claude Agent SDK, neural networks, memory persistence, GitHub integration, and distributed consensus protocols. v1.1.14: Fixed critical OpenRouter proxy bug - 80% model success rate including Grok 4 Fast (#1 most popular)!",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"bin": {
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"mcp:fastmcp-poc": "node dist/mcp/fastmcp/servers/poc-stdio.js",
|
|
28
28
|
"mcp:http": "node dist/mcp/fastmcp/servers/http-sse.js",
|
|
29
29
|
"mcp:stdio": "node dist/mcp/standalone-stdio.js",
|
|
30
|
+
"claude-code": "node dist/cli/claude-code-wrapper.js",
|
|
30
31
|
"example:goal-planner": "tsx src/examples/use-goal-planner.ts",
|
|
31
32
|
"example:multi-agent": "tsx src/examples/multi-agent-orchestration.ts",
|
|
32
33
|
"proxy": "node dist/proxy/anthropic-to-openrouter.js",
|
|
@@ -141,7 +142,11 @@
|
|
|
141
142
|
"dist",
|
|
142
143
|
"docs",
|
|
143
144
|
".claude",
|
|
145
|
+
"validation",
|
|
146
|
+
"scripts",
|
|
144
147
|
"README.md",
|
|
145
|
-
"LICENSE"
|
|
148
|
+
"LICENSE",
|
|
149
|
+
"VALIDATION-RESULTS.md",
|
|
150
|
+
"CHANGELOG.md"
|
|
146
151
|
]
|
|
147
152
|
}
|
package/scripts/build.sh
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Build script for Claude Agent SDK Docker container
|
|
3
|
+
# This ensures the correct build context is used
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
# Get the script directory
|
|
8
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
9
|
+
ROOT_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
10
|
+
|
|
11
|
+
echo "Building Claude Agent SDK Docker image..."
|
|
12
|
+
echo "Root directory: $ROOT_DIR"
|
|
13
|
+
echo "Docker context: $ROOT_DIR"
|
|
14
|
+
echo "Dockerfile: docker/claude-agent-sdk/Dockerfile"
|
|
15
|
+
|
|
16
|
+
cd "$ROOT_DIR"
|
|
17
|
+
|
|
18
|
+
docker build \
|
|
19
|
+
-f docker/claude-agent-sdk/Dockerfile \
|
|
20
|
+
-t claude-agents:latest \
|
|
21
|
+
-t claude-agents:cli \
|
|
22
|
+
.
|
|
23
|
+
|
|
24
|
+
echo ""
|
|
25
|
+
echo "✅ Build complete!"
|
|
26
|
+
echo ""
|
|
27
|
+
echo "Usage examples:"
|
|
28
|
+
echo " docker run claude-agents:cli --list"
|
|
29
|
+
echo " docker run --env-file .env claude-agents:cli --agent goal-planner --task \"Plan feature\""
|
|
30
|
+
echo " docker-compose -f docker/claude-agent-sdk/docker-compose.agent.yml --profile goal-planner up"
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Claude Code Wrapper for Agentic Flow
|
|
3
|
+
# Simplified bash version for quick usage
|
|
4
|
+
#
|
|
5
|
+
# Usage:
|
|
6
|
+
# claude-code openrouter "Write a Python function"
|
|
7
|
+
# claude-code gemini "Create a REST API"
|
|
8
|
+
# claude-code anthropic "Help me debug this code"
|
|
9
|
+
|
|
10
|
+
PROVIDER=${1:-anthropic}
|
|
11
|
+
shift
|
|
12
|
+
PROMPT="$@"
|
|
13
|
+
|
|
14
|
+
# Default proxy port
|
|
15
|
+
PORT=${AGENTIC_FLOW_PORT:-3000}
|
|
16
|
+
|
|
17
|
+
case "$PROVIDER" in
|
|
18
|
+
openrouter)
|
|
19
|
+
if [ -z "$OPENROUTER_API_KEY" ]; then
|
|
20
|
+
echo "❌ Error: OPENROUTER_API_KEY not set"
|
|
21
|
+
exit 1
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
ANTHROPIC_BASE_URL="http://localhost:$PORT" \
|
|
25
|
+
ANTHROPIC_API_KEY="sk-ant-proxy-dummy" \
|
|
26
|
+
OPENROUTER_API_KEY="$OPENROUTER_API_KEY" \
|
|
27
|
+
claude $PROMPT
|
|
28
|
+
;;
|
|
29
|
+
|
|
30
|
+
gemini)
|
|
31
|
+
if [ -z "$GOOGLE_GEMINI_API_KEY" ]; then
|
|
32
|
+
echo "❌ Error: GOOGLE_GEMINI_API_KEY not set"
|
|
33
|
+
exit 1
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
ANTHROPIC_BASE_URL="http://localhost:$PORT" \
|
|
37
|
+
ANTHROPIC_API_KEY="sk-ant-proxy-dummy" \
|
|
38
|
+
GOOGLE_GEMINI_API_KEY="$GOOGLE_GEMINI_API_KEY" \
|
|
39
|
+
claude $PROMPT
|
|
40
|
+
;;
|
|
41
|
+
|
|
42
|
+
onnx)
|
|
43
|
+
ANTHROPIC_BASE_URL="http://localhost:$PORT" \
|
|
44
|
+
ANTHROPIC_API_KEY="sk-ant-proxy-dummy" \
|
|
45
|
+
claude $PROMPT
|
|
46
|
+
;;
|
|
47
|
+
|
|
48
|
+
anthropic|*)
|
|
49
|
+
if [ -z "$ANTHROPIC_API_KEY" ]; then
|
|
50
|
+
echo "❌ Error: ANTHROPIC_API_KEY not set"
|
|
51
|
+
exit 1
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
claude $PROMPT
|
|
55
|
+
;;
|
|
56
|
+
esac
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Claude Flow CLI - Universal Wrapper
|
|
5
|
+
* Works in both CommonJS and ES Module projects
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// Use dynamic import to work in both CommonJS and ES modules
|
|
9
|
+
(async () => {
|
|
10
|
+
const { spawn } = await import('child_process');
|
|
11
|
+
const { resolve } = await import('path');
|
|
12
|
+
const { fileURLToPath } = await import('url');
|
|
13
|
+
|
|
14
|
+
// Detect if we're running in ES module context
|
|
15
|
+
let __dirname;
|
|
16
|
+
try {
|
|
17
|
+
// Check if import.meta is available (ES modules)
|
|
18
|
+
if (typeof import.meta !== 'undefined' && import.meta.url) {
|
|
19
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
20
|
+
__dirname = resolve(__filename, '..');
|
|
21
|
+
} else {
|
|
22
|
+
// Fallback for CommonJS
|
|
23
|
+
__dirname = process.cwd();
|
|
24
|
+
}
|
|
25
|
+
} catch {
|
|
26
|
+
// Fallback for CommonJS
|
|
27
|
+
__dirname = process.cwd();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Try multiple strategies to find claude-flow
|
|
31
|
+
const strategies = [
|
|
32
|
+
// 1. Local node_modules
|
|
33
|
+
async () => {
|
|
34
|
+
try {
|
|
35
|
+
const localPath = resolve(process.cwd(), 'node_modules/.bin/claude-flow');
|
|
36
|
+
const { existsSync } = await import('fs');
|
|
37
|
+
if (existsSync(localPath)) {
|
|
38
|
+
return spawn(localPath, process.argv.slice(2), { stdio: 'inherit' });
|
|
39
|
+
}
|
|
40
|
+
} catch {}
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
// 2. Parent node_modules (monorepo)
|
|
44
|
+
async () => {
|
|
45
|
+
try {
|
|
46
|
+
const parentPath = resolve(process.cwd(), '../node_modules/.bin/claude-flow');
|
|
47
|
+
const { existsSync } = await import('fs');
|
|
48
|
+
if (existsSync(parentPath)) {
|
|
49
|
+
return spawn(parentPath, process.argv.slice(2), { stdio: 'inherit' });
|
|
50
|
+
}
|
|
51
|
+
} catch {}
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
// 3. NPX with latest alpha version (prioritized over global)
|
|
55
|
+
async () => {
|
|
56
|
+
return spawn('npx', ['claude-flow@alpha', ...process.argv.slice(2)], {
|
|
57
|
+
stdio: 'inherit',
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
];
|
|
61
|
+
|
|
62
|
+
// Try each strategy
|
|
63
|
+
for (const strategy of strategies) {
|
|
64
|
+
try {
|
|
65
|
+
const child = await strategy();
|
|
66
|
+
if (child) {
|
|
67
|
+
child.on('exit', (code) => process.exit(code || 0));
|
|
68
|
+
child.on('error', (err) => {
|
|
69
|
+
if (err.code !== 'ENOENT') {
|
|
70
|
+
console.error('Error:', err);
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
} catch {}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
console.error('Could not find claude-flow. Please install it with: npm install claude-flow');
|
|
80
|
+
process.exit(1);
|
|
81
|
+
})();
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
@echo off
|
|
2
|
+
:: Claude Flow CLI for Windows
|
|
3
|
+
:: AI-Driven Development Toolkit
|
|
4
|
+
|
|
5
|
+
setlocal
|
|
6
|
+
|
|
7
|
+
:: Check if Node.js is installed
|
|
8
|
+
where node >nul 2>nul
|
|
9
|
+
if %errorlevel% neq 0 (
|
|
10
|
+
echo Error: Node.js is not installed or not in PATH
|
|
11
|
+
echo Please install Node.js from https://nodejs.org/
|
|
12
|
+
exit /b 1
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
:: Run Claude Flow CLI
|
|
16
|
+
node "%~dp0claude-flow" %*
|
|
17
|
+
|
|
18
|
+
endlocal
|