agentic-flow 1.4.2 β 1.4.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.
|
@@ -322,8 +322,8 @@ server.addTool({
|
|
|
322
322
|
};
|
|
323
323
|
language = langMap[ext] || 'javascript';
|
|
324
324
|
}
|
|
325
|
-
// Apply edit using agent-booster CLI (automatically installs from npm if not available)
|
|
326
|
-
const cmd = `npx --yes agent-booster apply --language ${language}`;
|
|
325
|
+
// Apply edit using agent-booster@0.2.2 CLI (automatically installs from npm if not available)
|
|
326
|
+
const cmd = `npx --yes agent-booster@0.2.2 apply --language ${language}`;
|
|
327
327
|
const result = execSync(cmd, {
|
|
328
328
|
encoding: 'utf-8',
|
|
329
329
|
input: JSON.stringify({ code: originalCode, edit: code_edit }),
|
|
@@ -404,7 +404,7 @@ server.addTool({
|
|
|
404
404
|
language = langMap[ext] || 'javascript';
|
|
405
405
|
}
|
|
406
406
|
// Apply edit
|
|
407
|
-
const cmd = `npx --yes agent-booster apply --language ${language}`;
|
|
407
|
+
const cmd = `npx --yes agent-booster@0.2.2 apply --language ${language}`;
|
|
408
408
|
const result = execSync(cmd, {
|
|
409
409
|
encoding: 'utf-8',
|
|
410
410
|
input: JSON.stringify({ code: originalCode, edit: edit.code_edit }),
|
|
@@ -492,7 +492,7 @@ server.addTool({
|
|
|
492
492
|
};
|
|
493
493
|
language = langMap[ext] || 'javascript';
|
|
494
494
|
}
|
|
495
|
-
const cmd = `npx --yes agent-booster apply --language ${language}`;
|
|
495
|
+
const cmd = `npx --yes agent-booster@0.2.2 apply --language ${language}`;
|
|
496
496
|
const result = execSync(cmd, {
|
|
497
497
|
encoding: 'utf-8',
|
|
498
498
|
input: JSON.stringify({ code: originalCode, edit: edit.code_edit }),
|
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
# Agent Booster Integration Guide
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Agent Booster (v0.2.1) integrates with agentic-flow at **three levels**:
|
|
6
|
+
|
|
7
|
+
1. **MCP Tools** (β
Current): Available via Claude Desktop/Cursor MCP server
|
|
8
|
+
2. **Anthropic Proxy** (π§ Proposed): Intercept tool calls to use Agent Booster
|
|
9
|
+
3. **CLI Agents** (π§ Proposed): Pre-process agent tasks with Agent Booster
|
|
10
|
+
|
|
11
|
+
## Current Status
|
|
12
|
+
|
|
13
|
+
### β
MCP Integration (v1.4.2)
|
|
14
|
+
|
|
15
|
+
**Location**: `src/mcp/standalone-stdio.ts`
|
|
16
|
+
|
|
17
|
+
**Tools Available**:
|
|
18
|
+
- `agent_booster_edit_file` - Single file editing
|
|
19
|
+
- `agent_booster_batch_edit` - Multi-file refactoring
|
|
20
|
+
- `agent_booster_parse_markdown` - Parse LLM markdown outputs
|
|
21
|
+
|
|
22
|
+
**Usage** (Claude Desktop):
|
|
23
|
+
```
|
|
24
|
+
User: Use agent_booster_edit_file to convert var to const in utils.js
|
|
25
|
+
Claude: [Calls MCP tool] β
Edited in 10ms with 64% confidence
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**Version**: Uses `npx agent-booster@0.2.1` for strategy fix (fuzzy_replace)
|
|
29
|
+
|
|
30
|
+
**Performance**:
|
|
31
|
+
- varβconst: 10ms (was creating duplicates in v0.1.2, fixed in v0.2.1)
|
|
32
|
+
- Add types: 11ms with fuzzy_replace
|
|
33
|
+
- Confidence threshold: 70% (auto-fallback to LLM below this)
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## π§ Proposed: Anthropic Proxy Integration
|
|
38
|
+
|
|
39
|
+
### Goal
|
|
40
|
+
Intercept Anthropic SDK tool calls and use Agent Booster for code editing tools.
|
|
41
|
+
|
|
42
|
+
### Implementation
|
|
43
|
+
|
|
44
|
+
**Location**: `src/proxy/anthropic-to-openrouter.ts` or new `anthropic-to-requesty.ts`
|
|
45
|
+
|
|
46
|
+
#### Step 1: Tool Call Interception
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
// In AnthropicToOpenRouterProxy or AnthropicToRequestyProxy
|
|
50
|
+
class ProxyWithAgentBooster {
|
|
51
|
+
async handleToolCall(toolCall: any) {
|
|
52
|
+
// Detect code editing tools
|
|
53
|
+
if (this.isCodeEditingTool(toolCall)) {
|
|
54
|
+
return await this.tryAgentBooster(toolCall);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Pass through to original handler
|
|
58
|
+
return await this.originalToolHandler(toolCall);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
private isCodeEditingTool(toolCall: any): boolean {
|
|
62
|
+
const codeEditTools = [
|
|
63
|
+
'str_replace_editor', // Cursor
|
|
64
|
+
'apply_diff', // Aider
|
|
65
|
+
'edit_file', // Generic
|
|
66
|
+
'replace_in_file' // Generic
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
return codeEditTools.includes(toolCall.name);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private async tryAgentBooster(toolCall: any): Promise<any> {
|
|
73
|
+
try {
|
|
74
|
+
const { file_path, old_string, new_string, language } = this.extractEditParams(toolCall);
|
|
75
|
+
|
|
76
|
+
// Call Agent Booster
|
|
77
|
+
const result = await this.callAgentBooster(file_path, old_string, new_string, language);
|
|
78
|
+
|
|
79
|
+
if (result.success && result.confidence >= 0.7) {
|
|
80
|
+
// High confidence - use Agent Booster result
|
|
81
|
+
return {
|
|
82
|
+
success: true,
|
|
83
|
+
method: 'agent_booster',
|
|
84
|
+
latency_ms: result.latency,
|
|
85
|
+
confidence: result.confidence,
|
|
86
|
+
output: result.output
|
|
87
|
+
};
|
|
88
|
+
} else {
|
|
89
|
+
// Low confidence - fall back to LLM
|
|
90
|
+
logger.warn(`Agent Booster confidence too low (${result.confidence}), using LLM fallback`);
|
|
91
|
+
return await this.originalToolHandler(toolCall);
|
|
92
|
+
}
|
|
93
|
+
} catch (error) {
|
|
94
|
+
// Error - fall back to LLM
|
|
95
|
+
logger.error('Agent Booster failed, using LLM fallback:', error);
|
|
96
|
+
return await this.originalToolHandler(toolCall);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
private async callAgentBooster(filePath: string, oldCode: string, newCode: string, language?: string): Promise<any> {
|
|
101
|
+
const { execSync } = await import('child_process');
|
|
102
|
+
const fs = await import('fs');
|
|
103
|
+
|
|
104
|
+
const originalCode = fs.readFileSync(filePath, 'utf-8');
|
|
105
|
+
|
|
106
|
+
const cmd = `npx --yes agent-booster@0.2.1 apply --language ${language || 'javascript'}`;
|
|
107
|
+
const result = execSync(cmd, {
|
|
108
|
+
encoding: 'utf-8',
|
|
109
|
+
input: JSON.stringify({ code: originalCode, edit: newCode }),
|
|
110
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
111
|
+
timeout: 5000
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
return JSON.parse(result);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
#### Step 2: Enable in CLI
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
// In cli-proxy.ts
|
|
123
|
+
if (options.agentBooster) {
|
|
124
|
+
// Use proxy with Agent Booster interception
|
|
125
|
+
const proxy = new AnthropicToRequestyProxy({
|
|
126
|
+
anthropicApiKey: apiKey,
|
|
127
|
+
enableAgentBooster: true,
|
|
128
|
+
agentBoosterConfidenceThreshold: 0.7
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**CLI Usage**:
|
|
134
|
+
```bash
|
|
135
|
+
npx agentic-flow --agent coder --task "Convert var to const" --agent-booster
|
|
136
|
+
# Agent Booster intercepts str_replace_editor calls
|
|
137
|
+
# Falls back to LLM if confidence < 70%
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Benefits**:
|
|
141
|
+
- Transparent to agents (no code changes needed)
|
|
142
|
+
- Automatic fallback to LLM
|
|
143
|
+
- 200x faster for simple edits
|
|
144
|
+
- $0 cost for pattern matching
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## π§ Proposed: CLI Agent Integration
|
|
149
|
+
|
|
150
|
+
### Goal
|
|
151
|
+
Pre-process agent tasks with Agent Booster before invoking LLM.
|
|
152
|
+
|
|
153
|
+
### Implementation
|
|
154
|
+
|
|
155
|
+
**Location**: `src/agents/claudeAgent.ts` or `src/utils/agentLoader.ts`
|
|
156
|
+
|
|
157
|
+
#### Step 1: Task Analysis
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
// In claudeAgent.ts
|
|
161
|
+
class AgentWithBooster {
|
|
162
|
+
async execute(task: string, options: any) {
|
|
163
|
+
// Analyze task to detect code editing intent
|
|
164
|
+
const editIntent = this.detectCodeEditIntent(task);
|
|
165
|
+
|
|
166
|
+
if (editIntent && options.enableAgentBooster) {
|
|
167
|
+
// Try Agent Booster first
|
|
168
|
+
const boosterResult = await this.tryAgentBooster(editIntent);
|
|
169
|
+
|
|
170
|
+
if (boosterResult.success) {
|
|
171
|
+
return boosterResult; // Done in 10ms!
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Fall back to LLM agent
|
|
176
|
+
return await this.executeLLMAgent(task, options);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
private detectCodeEditIntent(task: string): EditIntent | null {
|
|
180
|
+
// Pattern matching for common edits
|
|
181
|
+
const patterns = [
|
|
182
|
+
{ regex: /convert\s+var\s+to\s+const/i, type: 'var_to_const' },
|
|
183
|
+
{ regex: /add\s+type\s+annotations/i, type: 'add_types' },
|
|
184
|
+
{ regex: /add\s+error\s+handling/i, type: 'add_error_handling' },
|
|
185
|
+
{ regex: /convert\s+to\s+async\/await/i, type: 'async_await' }
|
|
186
|
+
];
|
|
187
|
+
|
|
188
|
+
for (const pattern of patterns) {
|
|
189
|
+
if (pattern.regex.test(task)) {
|
|
190
|
+
return {
|
|
191
|
+
type: pattern.type,
|
|
192
|
+
task,
|
|
193
|
+
filePath: this.extractFilePath(task)
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
private async tryAgentBooster(intent: EditIntent): Promise<any> {
|
|
202
|
+
const { execSync } = await import('child_process');
|
|
203
|
+
const fs = await import('fs');
|
|
204
|
+
|
|
205
|
+
if (!fs.existsSync(intent.filePath)) {
|
|
206
|
+
return { success: false, reason: 'File not found' };
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const originalCode = fs.readFileSync(intent.filePath, 'utf-8');
|
|
210
|
+
const editedCode = this.generateEditFromIntent(intent, originalCode);
|
|
211
|
+
|
|
212
|
+
const cmd = `npx --yes agent-booster@0.2.1 apply --language javascript`;
|
|
213
|
+
const result = execSync(cmd, {
|
|
214
|
+
encoding: 'utf-8',
|
|
215
|
+
input: JSON.stringify({ code: originalCode, edit: editedCode }),
|
|
216
|
+
timeout: 5000
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
const parsed = JSON.parse(result);
|
|
220
|
+
|
|
221
|
+
if (parsed.success && parsed.confidence >= 0.7) {
|
|
222
|
+
fs.writeFileSync(intent.filePath, parsed.output);
|
|
223
|
+
return {
|
|
224
|
+
success: true,
|
|
225
|
+
method: 'agent_booster',
|
|
226
|
+
latency_ms: parsed.latency,
|
|
227
|
+
confidence: parsed.confidence
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return { success: false, confidence: parsed.confidence };
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
#### Step 2: Enable in CLI Options
|
|
237
|
+
|
|
238
|
+
```typescript
|
|
239
|
+
// In cli-proxy.ts options parsing
|
|
240
|
+
const options = parseArgs();
|
|
241
|
+
|
|
242
|
+
if (options.agentBooster || process.env.AGENTIC_FLOW_AGENT_BOOSTER === 'true') {
|
|
243
|
+
// Enable Agent Booster pre-processing
|
|
244
|
+
agentOptions.enableAgentBooster = true;
|
|
245
|
+
agentOptions.agentBoosterConfidenceThreshold = options.boosterThreshold || 0.7;
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
**CLI Usage**:
|
|
250
|
+
```bash
|
|
251
|
+
# Explicit flag
|
|
252
|
+
npx agentic-flow --agent coder --task "Convert var to const in utils.js" --agent-booster
|
|
253
|
+
|
|
254
|
+
# Environment variable
|
|
255
|
+
export AGENTIC_FLOW_AGENT_BOOSTER=true
|
|
256
|
+
npx agentic-flow --agent coder --task "Add types to api.ts"
|
|
257
|
+
|
|
258
|
+
# With confidence threshold
|
|
259
|
+
npx agentic-flow --agent coder --task "Refactor" --agent-booster --booster-threshold 0.8
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
**Benefits**:
|
|
263
|
+
- Avoids LLM call entirely for simple edits
|
|
264
|
+
- Saves ~$0.001 per edit
|
|
265
|
+
- 200x faster (10ms vs 2000ms)
|
|
266
|
+
- Automatic fallback to LLM
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Integration Levels Comparison
|
|
271
|
+
|
|
272
|
+
| Level | Speed | Cost | Use Case | Status |
|
|
273
|
+
|-------|-------|------|----------|--------|
|
|
274
|
+
| **MCP Tools** | 10ms | $0 | User explicitly requests Agent Booster | β
Live (v1.4.2) |
|
|
275
|
+
| **Proxy Intercept** | 10ms | $0 | Transparent to agents | π§ Proposed |
|
|
276
|
+
| **CLI Pre-Process** | 10ms | $0 | Direct agentic-flow usage | π§ Proposed |
|
|
277
|
+
|
|
278
|
+
## Strategy Fix (v0.2.1)
|
|
279
|
+
|
|
280
|
+
**Critical fix**: varβconst now uses `fuzzy_replace` instead of `insert_after`
|
|
281
|
+
|
|
282
|
+
**Before (v0.1.2)**:
|
|
283
|
+
```javascript
|
|
284
|
+
var x = 1;
|
|
285
|
+
|
|
286
|
+
const x = 1; // Duplicate!
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
**After (v0.2.1)**:
|
|
290
|
+
```javascript
|
|
291
|
+
const x = 1; // Replaced correctly
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
**Thresholds Updated**:
|
|
295
|
+
- ExactReplace: 95% β 90%
|
|
296
|
+
- FuzzyReplace: 80% β 50% (fixes duplicates)
|
|
297
|
+
- InsertAfter: 60% β 30%
|
|
298
|
+
|
|
299
|
+
**Confidence Improvement**: 57% β 64% for simple substitutions
|
|
300
|
+
|
|
301
|
+
## Recommended Implementation Order
|
|
302
|
+
|
|
303
|
+
1. β
**MCP Tools** (Done) - Already works in Claude Desktop/Cursor
|
|
304
|
+
2. **Proxy Integration** - Highest value, transparent to agents
|
|
305
|
+
3. **CLI Integration** - Lower priority, requires task pattern matching
|
|
306
|
+
|
|
307
|
+
## Environment Variables
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
# Enable Agent Booster in all modes
|
|
311
|
+
export AGENTIC_FLOW_AGENT_BOOSTER=true
|
|
312
|
+
|
|
313
|
+
# Set confidence threshold (default: 0.7)
|
|
314
|
+
export AGENTIC_FLOW_BOOSTER_THRESHOLD=0.8
|
|
315
|
+
|
|
316
|
+
# Disable fallback to LLM (fail on low confidence)
|
|
317
|
+
export AGENTIC_FLOW_BOOSTER_NO_FALLBACK=false
|
|
318
|
+
|
|
319
|
+
# Force specific version
|
|
320
|
+
export AGENTIC_FLOW_BOOSTER_VERSION=0.2.1
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
## Testing
|
|
324
|
+
|
|
325
|
+
### MCP Integration Test
|
|
326
|
+
```bash
|
|
327
|
+
# Claude Desktop: "Use agent_booster_edit_file to convert var to const in test.js"
|
|
328
|
+
# Expected: 10ms with fuzzy_replace strategy
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### Proxy Integration Test (when implemented)
|
|
332
|
+
```bash
|
|
333
|
+
npx agentic-flow --agent coder --task "Convert var to const" --agent-booster --openrouter
|
|
334
|
+
# Should intercept str_replace_editor and use Agent Booster
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### CLI Integration Test (when implemented)
|
|
338
|
+
```bash
|
|
339
|
+
npx agentic-flow --agent coder --task "Add types to utils.js" --agent-booster
|
|
340
|
+
# Should pre-process with Agent Booster before LLM
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
## Performance Metrics
|
|
344
|
+
|
|
345
|
+
| Operation | LLM (Anthropic) | Agent Booster v0.2.1 | Speedup |
|
|
346
|
+
|-----------|----------------|----------------------|---------|
|
|
347
|
+
| var β const | 2,000ms | 10ms | 200x |
|
|
348
|
+
| Add types | 2,500ms | 11ms | 227x |
|
|
349
|
+
| Error handling | 3,000ms | 1ms (template) | 3000x |
|
|
350
|
+
| Cost per edit | $0.001 | $0.00 | 100% savings |
|
|
351
|
+
|
|
352
|
+
## Next Steps
|
|
353
|
+
|
|
354
|
+
- [ ] Implement proxy interception (highest value)
|
|
355
|
+
- [ ] Add task pattern detection for CLI
|
|
356
|
+
- [ ] Create comprehensive test suite
|
|
357
|
+
- [ ] Document agent configuration
|
|
358
|
+
- [ ] Add telemetry for Agent Booster usage
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
**Last Updated**: 2025-10-08
|
|
363
|
+
**Agent Booster Version**: 0.2.1
|
|
364
|
+
**Agentic-Flow Version**: 1.4.2+
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
# Agent Booster CLI Integration Plan
|
|
2
|
+
|
|
3
|
+
## Current State
|
|
4
|
+
|
|
5
|
+
### What Works β
|
|
6
|
+
- **MCP Server**: 3 Agent Booster tools available via `standalone-stdio.js`
|
|
7
|
+
- **Standalone CLI**: `agent-booster` package works with JSON stdin
|
|
8
|
+
- **Integration**: Uses `npx --yes agent-booster` (no dependency needed)
|
|
9
|
+
|
|
10
|
+
### What Doesn't Work β
|
|
11
|
+
- **CLI `--agent` mode**: `npx agentic-flow --agent coder` doesn't use Agent Booster
|
|
12
|
+
- **Flag is cosmetic**: `--agent-booster` just prints info, doesn't integrate
|
|
13
|
+
- **Performance**: Takes 26s instead of <1s for simple varβconst edits
|
|
14
|
+
|
|
15
|
+
## Problem Analysis
|
|
16
|
+
|
|
17
|
+
### Current Flow (CLI Mode)
|
|
18
|
+
```
|
|
19
|
+
User: npx agentic-flow --agent coder --task "convert var to const"
|
|
20
|
+
β
|
|
21
|
+
CLI Wrapper (claude-code-wrapper.ts)
|
|
22
|
+
β Prints Agent Booster info (but doesn't integrate)
|
|
23
|
+
β
|
|
24
|
+
Agent Executor (directApiAgent.ts)
|
|
25
|
+
β Calls LLM with Edit tool
|
|
26
|
+
β
|
|
27
|
+
LLM Response (26 seconds)
|
|
28
|
+
β
|
|
29
|
+
File modified using LLM-generated edit
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Desired Flow (with Agent Booster)
|
|
33
|
+
```
|
|
34
|
+
User: npx agentic-flow --agent coder --task "convert var to const" --agent-booster
|
|
35
|
+
β
|
|
36
|
+
CLI Wrapper
|
|
37
|
+
β Pass agent-booster flag to agent
|
|
38
|
+
β
|
|
39
|
+
Agent Executor
|
|
40
|
+
β Detect if task is code edit
|
|
41
|
+
β
|
|
42
|
+
Try Agent Booster first
|
|
43
|
+
ββ High confidence (β₯70%) β Apply edit (85ms)
|
|
44
|
+
ββ Low confidence (<70%) β Fallback to LLM (26s)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Implementation Challenges
|
|
48
|
+
|
|
49
|
+
### Challenge 1: CLI vs MCP Architecture
|
|
50
|
+
|
|
51
|
+
**Problem**: Agent Booster is designed for **exact code replacements**, but CLI agents receive **vague natural language** tasks.
|
|
52
|
+
|
|
53
|
+
Example:
|
|
54
|
+
```bash
|
|
55
|
+
# User input (vague)
|
|
56
|
+
npx agentic-flow --agent coder --task "convert var to const in utils.js"
|
|
57
|
+
|
|
58
|
+
# What Agent Booster needs (exact)
|
|
59
|
+
{"code":"var x = 1;","edit":"const x = 1;"}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Solution**: We need an intermediary step that:
|
|
63
|
+
1. Reads the file
|
|
64
|
+
2. Uses LLM to generate exact code replacement
|
|
65
|
+
3. Passes to Agent Booster for fast application
|
|
66
|
+
|
|
67
|
+
But this doesn't save time! We still need the LLM to generate the exact edit.
|
|
68
|
+
|
|
69
|
+
### Challenge 2: When Agent Booster Actually Helps
|
|
70
|
+
|
|
71
|
+
Agent Booster is fast **only** when you already have the exact code replacement:
|
|
72
|
+
|
|
73
|
+
| Scenario | Agent Booster Helps? | Why |
|
|
74
|
+
|----------|---------------------|-----|
|
|
75
|
+
| User provides exact code | β
Yes | Skip LLM entirely (85ms vs 26s) |
|
|
76
|
+
| User provides file + vague task | β No | Still need LLM to generate edit |
|
|
77
|
+
| Batch edits with pattern | β οΈ Maybe | Need pattern detection first |
|
|
78
|
+
|
|
79
|
+
### Challenge 3: Remote Package Installation
|
|
80
|
+
|
|
81
|
+
**Current approach**: `npx --yes agent-booster` downloads on first use
|
|
82
|
+
|
|
83
|
+
**Issues**:
|
|
84
|
+
- 30s timeout for download
|
|
85
|
+
- Network dependency
|
|
86
|
+
- User doesn't know it's downloading
|
|
87
|
+
- Fails in air-gapped environments
|
|
88
|
+
|
|
89
|
+
**Better approach**: Add `agent-booster` as optional dependency
|
|
90
|
+
|
|
91
|
+
## Proposed Solutions
|
|
92
|
+
|
|
93
|
+
### Option 1: Add Pre-Processing Step (Hybrid)
|
|
94
|
+
|
|
95
|
+
**Pros:**
|
|
96
|
+
- Works with vague natural language
|
|
97
|
+
- Can leverage Agent Booster when applicable
|
|
98
|
+
- Graceful fallback to LLM
|
|
99
|
+
|
|
100
|
+
**Cons:**
|
|
101
|
+
- Complex flow
|
|
102
|
+
- LLM still needed for generating edits
|
|
103
|
+
- Minimal time savings (only skips LLM execution phase)
|
|
104
|
+
|
|
105
|
+
**Implementation:**
|
|
106
|
+
```typescript
|
|
107
|
+
async function executeWithAgentBooster(task: string, file: string) {
|
|
108
|
+
// Step 1: Use fast LLM to generate exact edit
|
|
109
|
+
const edit = await generateExactEdit(task, file); // 5-10s
|
|
110
|
+
|
|
111
|
+
// Step 2: Try Agent Booster
|
|
112
|
+
const result = await tryAgentBooster(edit);
|
|
113
|
+
|
|
114
|
+
if (result.confidence >= 0.7) {
|
|
115
|
+
return result; // 85ms for applying
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Step 3: Fallback to full LLM
|
|
119
|
+
return await executeLLMAgent(task, file); // 26s
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Time saved**: ~1-2s (only application phase)
|
|
124
|
+
|
|
125
|
+
### Option 2: Add Dependency (Simple)
|
|
126
|
+
|
|
127
|
+
**Pros:**
|
|
128
|
+
- No network delays
|
|
129
|
+
- Works offline
|
|
130
|
+
- Predictable behavior
|
|
131
|
+
|
|
132
|
+
**Cons:**
|
|
133
|
+
- Increases package size (1.4MB for WASM)
|
|
134
|
+
- Installation time increased
|
|
135
|
+
- Makes agent-booster non-optional
|
|
136
|
+
|
|
137
|
+
**Implementation:**
|
|
138
|
+
```json
|
|
139
|
+
{
|
|
140
|
+
"dependencies": {
|
|
141
|
+
"agent-booster": "^0.1.1"
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Option 3: Keep MCP-Only (Current State)
|
|
147
|
+
|
|
148
|
+
**Pros:**
|
|
149
|
+
- Clean separation of concerns
|
|
150
|
+
- MCP tools work perfectly for exact edits
|
|
151
|
+
- CLI agents work perfectly for reasoning
|
|
152
|
+
- No complexity added
|
|
153
|
+
|
|
154
|
+
**Cons:**
|
|
155
|
+
- CLI users don't get Agent Booster performance
|
|
156
|
+
- `--agent-booster` flag is misleading
|
|
157
|
+
|
|
158
|
+
**Implementation:**
|
|
159
|
+
- Remove `--agent-booster` flag from CLI
|
|
160
|
+
- Update docs to clarify MCP-only
|
|
161
|
+
- Focus on MCP integration quality
|
|
162
|
+
|
|
163
|
+
### Option 4: Smart Pattern Detection
|
|
164
|
+
|
|
165
|
+
**Pros:**
|
|
166
|
+
- Detects simple patterns (varβconst, add types)
|
|
167
|
+
- Can use Agent Booster without LLM
|
|
168
|
+
- Significant time savings for common tasks
|
|
169
|
+
|
|
170
|
+
**Cons:**
|
|
171
|
+
- Limited to known patterns
|
|
172
|
+
- Complex pattern detection logic
|
|
173
|
+
- May miss edge cases
|
|
174
|
+
|
|
175
|
+
**Implementation:**
|
|
176
|
+
```typescript
|
|
177
|
+
async function detectPatternAndApply(task: string, file: string) {
|
|
178
|
+
// Detect common patterns
|
|
179
|
+
if (task.includes('var') && task.includes('const')) {
|
|
180
|
+
return await applyVarToConstPattern(file); // 85ms
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (task.includes('add types') || task.includes('TypeScript')) {
|
|
184
|
+
return await applyTypeAnnotationPattern(file); // 85ms + pattern detection
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// Fall back to full LLM
|
|
188
|
+
return await executeLLMAgent(task, file); // 26s
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Recommendation
|
|
193
|
+
|
|
194
|
+
**Choose Option 3: Keep MCP-Only**
|
|
195
|
+
|
|
196
|
+
**Reasoning:**
|
|
197
|
+
|
|
198
|
+
1. **Agent Booster's strength**: Exact code replacements
|
|
199
|
+
- Perfect for MCP tools (Claude generates exact code)
|
|
200
|
+
- Poor fit for CLI (user provides vague natural language)
|
|
201
|
+
|
|
202
|
+
2. **Time savings reality**:
|
|
203
|
+
- MCP: 85ms (skip LLM entirely) β
|
|
204
|
+
- CLI: Still need LLM for edit generation = minimal savings β
|
|
205
|
+
|
|
206
|
+
3. **User experience**:
|
|
207
|
+
- MCP users get 728x speedup for exact edits
|
|
208
|
+
- CLI users get full LLM reasoning for complex tasks
|
|
209
|
+
- Each mode uses the right tool for the job
|
|
210
|
+
|
|
211
|
+
4. **Maintenance**:
|
|
212
|
+
- Simple, clean architecture
|
|
213
|
+
- No complex hybrid flows
|
|
214
|
+
- Focus on quality, not gimmicks
|
|
215
|
+
|
|
216
|
+
### What to Change
|
|
217
|
+
|
|
218
|
+
1. **Remove misleading flag**:
|
|
219
|
+
```typescript
|
|
220
|
+
// DELETE: .option('--agent-booster', ...)
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
2. **Update README**:
|
|
224
|
+
```markdown
|
|
225
|
+
## Agent Booster
|
|
226
|
+
|
|
227
|
+
Agent Booster provides 728x faster code edits through the **MCP server** (for Claude Desktop/Cursor).
|
|
228
|
+
|
|
229
|
+
β οΈ **CLI users**: The `--agent` mode uses standard LLM reasoning and does NOT use Agent Booster. This is by design - use Claude Desktop/Cursor for Agent Booster performance.
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
3. **Focus on MCP quality**:
|
|
233
|
+
- Improve MCP tool descriptions
|
|
234
|
+
- Add more examples
|
|
235
|
+
- Better error messages
|
|
236
|
+
|
|
237
|
+
## Alternative: Limited CLI Integration
|
|
238
|
+
|
|
239
|
+
If we **must** have CLI integration, here's the minimal viable approach:
|
|
240
|
+
|
|
241
|
+
### Pattern-Based CLI (Limited Scope)
|
|
242
|
+
|
|
243
|
+
Only support explicit patterns with `--pattern` flag:
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
# Explicit pattern (works with Agent Booster)
|
|
247
|
+
npx agentic-flow --agent coder --pattern var-to-const --file utils.js
|
|
248
|
+
# Result: 85ms
|
|
249
|
+
|
|
250
|
+
# Vague task (uses LLM)
|
|
251
|
+
npx agentic-flow --agent coder --task "improve error handling" --file utils.js
|
|
252
|
+
# Result: 26s
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
**Supported patterns**:
|
|
256
|
+
- `var-to-const`: Convert var to const/let
|
|
257
|
+
- `add-types`: Add TypeScript type annotations
|
|
258
|
+
- `arrow-functions`: Convert function() to () =>
|
|
259
|
+
- `async-await`: Convert callbacks to async/await
|
|
260
|
+
|
|
261
|
+
**Implementation**:
|
|
262
|
+
```typescript
|
|
263
|
+
const patterns = {
|
|
264
|
+
'var-to-const': async (file: string) => {
|
|
265
|
+
const code = fs.readFileSync(file, 'utf-8');
|
|
266
|
+
const edit = code.replace(/\bvar\b/g, 'const'); // Simplified
|
|
267
|
+
return await applyAgentBooster(code, edit);
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
if (options.pattern && patterns[options.pattern]) {
|
|
272
|
+
return await patterns[options.pattern](options.file);
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
**Pros**:
|
|
277
|
+
- Clear what works with Agent Booster
|
|
278
|
+
- Fast for supported patterns
|
|
279
|
+
- No false expectations
|
|
280
|
+
|
|
281
|
+
**Cons**:
|
|
282
|
+
- Limited pattern support
|
|
283
|
+
- Requires pattern knowledge
|
|
284
|
+
- Not natural language
|
|
285
|
+
|
|
286
|
+
## Validation Strategy
|
|
287
|
+
|
|
288
|
+
Before implementing ANY solution:
|
|
289
|
+
|
|
290
|
+
1. **Test locally** with exact use cases
|
|
291
|
+
2. **Publish to test npm registry** or local registry
|
|
292
|
+
3. **Install from npm** (not local files)
|
|
293
|
+
4. **Test in clean environment** (Docker container)
|
|
294
|
+
5. **Verify performance claims** with real benchmarks
|
|
295
|
+
|
|
296
|
+
### Test Checklist
|
|
297
|
+
|
|
298
|
+
- [ ] MCP server tools work remotely (Claude Desktop)
|
|
299
|
+
- [ ] CLI `--agent` mode works as expected
|
|
300
|
+
- [ ] `npx agent-booster` CLI works standalone
|
|
301
|
+
- [ ] No network timeouts or failures
|
|
302
|
+
- [ ] Performance matches claims
|
|
303
|
+
- [ ] Works in air-gapped environment (if dependency)
|
|
304
|
+
|
|
305
|
+
## Conclusion
|
|
306
|
+
|
|
307
|
+
**Recommended approach**: Keep Agent Booster as **MCP-only** (Option 3)
|
|
308
|
+
|
|
309
|
+
**Why**: Agent Booster is designed for exact code replacements, which works perfectly with MCP tools but poorly with CLI natural language tasks. Trying to force CLI integration would add complexity without significant benefit.
|
|
310
|
+
|
|
311
|
+
**Action items**:
|
|
312
|
+
1. Remove misleading `--agent-booster` CLI flag
|
|
313
|
+
2. Update documentation to clarify MCP-only
|
|
314
|
+
3. Focus on making MCP integration excellent
|
|
315
|
+
4. Let CLI mode use standard LLM reasoning (what it's good at)
|
|
316
|
+
|
|
317
|
+
This keeps the architecture clean, user expectations clear, and each mode focused on what it does best.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentic-flow",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3",
|
|
4
4
|
"description": "Production-ready AI agent orchestration platform with 66 specialized agents, 213 MCP tools, and autonomous multi-agent swarms. Built by @ruvnet with Claude Agent SDK, neural networks, memory persistence, GitHub integration, and distributed consensus protocols.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|