@pcircle/claude-code-buddy-mcp 2.3.10 → 2.3.11
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/dist/mcp/resources/best-practices.md +67 -0
- package/dist/mcp/resources/examples.md +56 -0
- package/dist/mcp/resources/quick-reference.md +73 -0
- package/dist/mcp/resources/usage-guide.md +92 -0
- package/dist/mcp/server-bootstrap.js +0 -0
- package/package.json +3 -2
- package/dist/__benchmarks__/performance-fixes.bench.d.ts +0 -8
- package/dist/__benchmarks__/performance-fixes.bench.d.ts.map +0 -1
- package/dist/__benchmarks__/performance-fixes.bench.js +0 -213
- package/dist/__benchmarks__/performance-fixes.bench.js.map +0 -1
- package/dist/core/BackgroundExecutorConstants.d.ts +0 -8
- package/dist/core/BackgroundExecutorConstants.d.ts.map +0 -1
- package/dist/core/BackgroundExecutorConstants.js +0 -8
- package/dist/core/BackgroundExecutorConstants.js.map +0 -1
- package/dist/evolution/LearningManagerConstants.d.ts +0 -55
- package/dist/evolution/LearningManagerConstants.d.ts.map +0 -1
- package/dist/evolution/LearningManagerConstants.js +0 -55
- package/dist/evolution/LearningManagerConstants.js.map +0 -1
- package/dist/evolution/PerformanceTrackerConstants.d.ts +0 -5
- package/dist/evolution/PerformanceTrackerConstants.d.ts.map +0 -1
- package/dist/evolution/PerformanceTrackerConstants.js +0 -5
- package/dist/evolution/PerformanceTrackerConstants.js.map +0 -1
- package/dist/orchestrator/GlobalResourcePoolConstants.d.ts +0 -22
- package/dist/orchestrator/GlobalResourcePoolConstants.d.ts.map +0 -1
- package/dist/orchestrator/GlobalResourcePoolConstants.js +0 -22
- package/dist/orchestrator/GlobalResourcePoolConstants.js.map +0 -1
- package/dist/orchestrator/TaskAnalyzerConstants.d.ts +0 -16
- package/dist/orchestrator/TaskAnalyzerConstants.d.ts.map +0 -1
- package/dist/orchestrator/TaskAnalyzerConstants.js +0 -16
- package/dist/orchestrator/TaskAnalyzerConstants.js.map +0 -1
- package/dist/templates/git-education-templates.d.ts +0 -26
- package/dist/templates/git-education-templates.d.ts.map +0 -1
- package/dist/templates/git-education-templates.js +0 -455
- package/dist/templates/git-education-templates.js.map +0 -1
- package/dist/utils/SecureKeyStore.d.ts +0 -10
- package/dist/utils/SecureKeyStore.d.ts.map +0 -1
- package/dist/utils/SecureKeyStore.js +0 -32
- package/dist/utils/SecureKeyStore.js.map +0 -1
- package/dist/utils/cost-tracker.d.ts +0 -34
- package/dist/utils/cost-tracker.d.ts.map +0 -1
- package/dist/utils/cost-tracker.js +0 -92
- package/dist/utils/cost-tracker.js.map +0 -1
- package/dist/utils/validation.d.ts +0 -7
- package/dist/utils/validation.d.ts.map +0 -1
- package/dist/utils/validation.js +0 -62
- package/dist/utils/validation.js.map +0 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Claude Code Buddy Best Practices
|
|
2
|
+
|
|
3
|
+
**Version**: 2.2.0
|
|
4
|
+
|
|
5
|
+
## ✅ Write Precise Requests
|
|
6
|
+
|
|
7
|
+
- Specify files, modules, and constraints
|
|
8
|
+
- State desired behavior and edge cases
|
|
9
|
+
- Mention the tech stack when relevant
|
|
10
|
+
|
|
11
|
+
**Good**:
|
|
12
|
+
```
|
|
13
|
+
"Refactor src/auth/session.ts to remove duplication and add tests"
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
**Avoid**:
|
|
17
|
+
```
|
|
18
|
+
"Fix auth"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## ✅ Use Capability Routing (Default)
|
|
22
|
+
|
|
23
|
+
Let `buddy-do` select the best capability. You do not need to target internal roles.
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
buddy-do "review src/api/auth.ts for security issues"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## ✅ Break Down Large Features
|
|
30
|
+
|
|
31
|
+
Use `generate-smart-plan` before large changes:
|
|
32
|
+
```
|
|
33
|
+
generate-smart-plan "add email-based login with rate limiting"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Then execute tasks one by one.
|
|
37
|
+
|
|
38
|
+
## ✅ Leverage Project Memory
|
|
39
|
+
|
|
40
|
+
Use memory before large refactors or architectural changes:
|
|
41
|
+
```
|
|
42
|
+
buddy-remember "why we chose SQLite"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## ✅ Use Workflow Guidance
|
|
46
|
+
|
|
47
|
+
When you finish a phase, ask for next steps:
|
|
48
|
+
```
|
|
49
|
+
get-workflow-guidance {"phase":"test-complete"}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## ✅ Keep Sessions Healthy
|
|
53
|
+
|
|
54
|
+
Long sessions can degrade quality. Check health periodically:
|
|
55
|
+
```
|
|
56
|
+
get-session-health
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## ✅ Prefer Smaller, Testable Chunks
|
|
60
|
+
|
|
61
|
+
- Aim for 2-5 minute tasks
|
|
62
|
+
- Validate with tests before moving on
|
|
63
|
+
- Use clear commit boundaries in your VCS
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
**Remember**: Specific, focused requests yield the best outcomes.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Claude Code Buddy Examples
|
|
2
|
+
|
|
3
|
+
**Version**: 2.2.0
|
|
4
|
+
|
|
5
|
+
## Example 1: Code Review
|
|
6
|
+
|
|
7
|
+
**Request**:
|
|
8
|
+
```
|
|
9
|
+
buddy-do "review src/auth/login.ts for security issues and edge cases"
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
**Result**: A focused review with security checks, edge cases, and actionable fixes.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Example 2: Feature Planning
|
|
17
|
+
|
|
18
|
+
**Request**:
|
|
19
|
+
```
|
|
20
|
+
generate-smart-plan "add email-based login with rate limiting"
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Result**: A structured plan with TDD-friendly steps and estimated durations.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Example 3: Debugging a Failure
|
|
28
|
+
|
|
29
|
+
**Request**:
|
|
30
|
+
```
|
|
31
|
+
buddy-do "debug why login requests return 500s in production"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Result**: Root-cause analysis with likely failure paths and verification steps.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Example 4: Memory Recall
|
|
39
|
+
|
|
40
|
+
**Request**:
|
|
41
|
+
```
|
|
42
|
+
buddy-remember "why we chose SQLite for local storage"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Result**: A concise summary of the decision and its tradeoffs.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Example 5: Workflow Guidance
|
|
50
|
+
|
|
51
|
+
**Request**:
|
|
52
|
+
```
|
|
53
|
+
get-workflow-guidance {"phase":"test-complete"}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Result**: Next-step recommendations for code review and commit readiness.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Claude Code Buddy Quick Reference
|
|
2
|
+
|
|
3
|
+
**Version**: 2.2.0
|
|
4
|
+
|
|
5
|
+
## 🚀 Quick Commands
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
buddy-do "<task description>" # Smart routing (recommended)
|
|
9
|
+
buddy-remember "<query>" # Recall project memory
|
|
10
|
+
buddy-help # Command help
|
|
11
|
+
get-session-health # Session health snapshot
|
|
12
|
+
get-workflow-guidance '{"phase":"code-written"}'
|
|
13
|
+
generate-smart-plan '{"featureDescription":"..."}'
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Note: `hook-tool-use` is internal and used by Claude Code hooks.
|
|
17
|
+
|
|
18
|
+
## 🧭 Capability Keywords
|
|
19
|
+
|
|
20
|
+
| Capability | Keywords | Use For |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
| Code Review | review, audit, quality | Security checks, best practices |
|
|
23
|
+
| Testing | test, coverage, TDD | Unit, integration, E2E testing |
|
|
24
|
+
| Debugging | debug, bug, error | Root-cause analysis |
|
|
25
|
+
| Refactoring | refactor, cleanup | Structural improvements |
|
|
26
|
+
| API/Backend | api, endpoint, backend | API design and backend logic |
|
|
27
|
+
| Frontend/UI | ui, component, frontend | UI, accessibility, UX |
|
|
28
|
+
| Architecture | architecture, design, scalability | System design, tradeoffs |
|
|
29
|
+
| Data/Database | database, query, schema | Query tuning, schema design |
|
|
30
|
+
| Documentation | docs, guide, readme | Technical writing |
|
|
31
|
+
|
|
32
|
+
## 🎯 Common Workflows
|
|
33
|
+
|
|
34
|
+
### Feature Development
|
|
35
|
+
```
|
|
36
|
+
1. generate-smart-plan "<feature>"
|
|
37
|
+
2. buddy-do "implement <feature>"
|
|
38
|
+
3. buddy-do "write tests for <feature>"
|
|
39
|
+
4. buddy-do "review <feature> for quality"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Bug Fixing
|
|
43
|
+
```
|
|
44
|
+
1. buddy-do "debug <issue> and find root cause"
|
|
45
|
+
2. buddy-do "fix <issue> and add regression test"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Performance Review
|
|
49
|
+
```
|
|
50
|
+
1. buddy-do "profile performance for <area>"
|
|
51
|
+
2. buddy-do "optimize slow path in <area>"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## 💡 Quick Tips
|
|
55
|
+
|
|
56
|
+
✅ **DO**:
|
|
57
|
+
- Use clear, specific task descriptions
|
|
58
|
+
- Mention files, constraints, or target behaviors
|
|
59
|
+
- Use `buddy-remember` before large changes
|
|
60
|
+
|
|
61
|
+
❌ **DON'T**:
|
|
62
|
+
- Use vague descriptions ("fix bug")
|
|
63
|
+
- Skip context when it matters
|
|
64
|
+
|
|
65
|
+
## 📚 Full Documentation
|
|
66
|
+
|
|
67
|
+
- **Complete Guide**: `@claude-code-buddy://usage-guide`
|
|
68
|
+
- **Examples**: `@claude-code-buddy://examples`
|
|
69
|
+
- **Best Practices**: `@claude-code-buddy://best-practices`
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
**Remember**: The smart router learns from your patterns - the more you use it, the better it gets!
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Claude Code Buddy Complete Usage Guide
|
|
2
|
+
|
|
3
|
+
**Version**: 2.2.0
|
|
4
|
+
**Last Updated**: 2025-12-29
|
|
5
|
+
|
|
6
|
+
## 📖 Overview
|
|
7
|
+
|
|
8
|
+
Claude Code Buddy is a capability-routing system for Claude Code. It focuses on:
|
|
9
|
+
- Smart task routing
|
|
10
|
+
- Project memory
|
|
11
|
+
- Workflow guidance
|
|
12
|
+
- Structured planning
|
|
13
|
+
|
|
14
|
+
You describe the outcome, and CCB selects the best internal capability automatically.
|
|
15
|
+
|
|
16
|
+
## 🚀 Quick Start
|
|
17
|
+
|
|
18
|
+
### 1) Run a task with smart routing
|
|
19
|
+
```
|
|
20
|
+
buddy-do "implement user authentication with JWT"
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### 2) Recall project memory
|
|
24
|
+
```
|
|
25
|
+
buddy-remember "authentication decisions"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### 3) Generate a plan
|
|
29
|
+
```
|
|
30
|
+
generate-smart-plan "add email-based login"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 🧰 Tool Overview
|
|
34
|
+
|
|
35
|
+
- **buddy-do**: Execute tasks with smart routing
|
|
36
|
+
- **buddy-remember**: Recall project memory and decisions
|
|
37
|
+
- **buddy-help**: Command help and usage
|
|
38
|
+
- **get-session-health**: Check session health
|
|
39
|
+
- **get-workflow-guidance**: Next-step recommendations by phase
|
|
40
|
+
- **generate-smart-plan**: Implementation plan generation
|
|
41
|
+
|
|
42
|
+
Note: `hook-tool-use` is internal and used by Claude Code hooks.
|
|
43
|
+
|
|
44
|
+
## 🧭 Capability Examples
|
|
45
|
+
|
|
46
|
+
Use natural language and include intent, constraints, and file names when possible.
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
"Review src/auth.ts for security and correctness"
|
|
50
|
+
"Debug why login is returning 500s after deploy"
|
|
51
|
+
"Refactor UserService to reduce duplication"
|
|
52
|
+
"Design a REST API for session management"
|
|
53
|
+
"Optimize the database query in reports.sql"
|
|
54
|
+
"Write vitest tests for src/utils/date.ts"
|
|
55
|
+
"Draft README updates for new onboarding flow"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## 🔄 Workflow Guidance
|
|
59
|
+
|
|
60
|
+
CCB recognizes five phases:
|
|
61
|
+
- idle
|
|
62
|
+
- code-written
|
|
63
|
+
- test-complete
|
|
64
|
+
- commit-ready
|
|
65
|
+
- committed
|
|
66
|
+
|
|
67
|
+
Example usage:
|
|
68
|
+
```
|
|
69
|
+
get-workflow-guidance {"phase":"code-written"}
|
|
70
|
+
get-session-health
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## 🧠 Project Memory
|
|
74
|
+
|
|
75
|
+
Project memory is updated automatically at key milestones and commit events. Use it to recall prior decisions and patterns:
|
|
76
|
+
```
|
|
77
|
+
buddy-remember "why we chose SQLite"
|
|
78
|
+
buddy-remember "error handling strategy"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## ✅ Best Practices
|
|
82
|
+
|
|
83
|
+
- Be specific: mention files, constraints, and expected behavior
|
|
84
|
+
- Use `buddy-remember` before large changes
|
|
85
|
+
- Ask for a plan before large features
|
|
86
|
+
- Check `get-session-health` on long sessions
|
|
87
|
+
|
|
88
|
+
## 📚 Additional Resources
|
|
89
|
+
|
|
90
|
+
- **Quick Reference**: `@claude-code-buddy://quick-reference`
|
|
91
|
+
- **Examples**: `@claude-code-buddy://examples`
|
|
92
|
+
- **Best Practices**: `@claude-code-buddy://best-practices`
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pcircle/claude-code-buddy-mcp",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.11",
|
|
4
4
|
"description": "Your friendly AI companion for Claude Code - smart routing, prompt enhancement, and project memory",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
18
18
|
"dev": "tsx watch src/index.ts",
|
|
19
|
-
"build": "tsc",
|
|
19
|
+
"build": "tsc && npm run copy:resources",
|
|
20
|
+
"copy:resources": "mkdir -p dist/mcp/resources && cp -r src/mcp/resources/*.md dist/mcp/resources/",
|
|
20
21
|
"build:plugin": "npm run build && npm run prepare:plugin",
|
|
21
22
|
"prepare:plugin": "node scripts/prepare-plugin.js",
|
|
22
23
|
"start": "node dist/index.js",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
declare function benchmarkGetStats(): Promise<void>;
|
|
2
|
-
declare function benchmarkGetConnectedEntities(): Promise<void>;
|
|
3
|
-
declare function benchmarkAnalyzePatterns(): Promise<void>;
|
|
4
|
-
declare function benchmarkCPUCache(): Promise<void>;
|
|
5
|
-
declare function benchmarkResourceMonitorMemory(): Promise<void>;
|
|
6
|
-
declare function runAllBenchmarks(): Promise<void>;
|
|
7
|
-
export { benchmarkGetStats, benchmarkGetConnectedEntities, benchmarkAnalyzePatterns, benchmarkCPUCache, benchmarkResourceMonitorMemory, runAllBenchmarks, };
|
|
8
|
-
//# sourceMappingURL=performance-fixes.bench.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"performance-fixes.bench.d.ts","sourceRoot":"","sources":["../../src/__benchmarks__/performance-fixes.bench.ts"],"names":[],"mappings":"AA+BA,iBAAe,iBAAiB,kBA8C/B;AAGD,iBAAe,6BAA6B,kBA8C3C;AAGD,iBAAe,wBAAwB,kBAmDtC;AAGD,iBAAe,iBAAiB,kBA4C/B;AAGD,iBAAe,8BAA8B,kBAgE5C;AAGD,iBAAe,gBAAgB,kBAqB9B;AAOD,OAAO,EACL,iBAAiB,EACjB,6BAA6B,EAC7B,wBAAwB,EACxB,iBAAiB,EACjB,8BAA8B,EAC9B,gBAAgB,GACjB,CAAC"}
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import { performance } from 'perf_hooks';
|
|
2
|
-
import { KnowledgeGraph } from '../agents/knowledge/KnowledgeGraph.js';
|
|
3
|
-
import { LearningManager } from '../evolution/LearningManager.js';
|
|
4
|
-
import { PerformanceTracker } from '../evolution/PerformanceTracker.js';
|
|
5
|
-
import { AgentRouter } from '../orchestrator/AgentRouter.js';
|
|
6
|
-
import { toMicroDollars } from '../utils/money.js';
|
|
7
|
-
function measure(name, fn) {
|
|
8
|
-
return new Promise(async (resolve) => {
|
|
9
|
-
const start = performance.now();
|
|
10
|
-
await fn();
|
|
11
|
-
const duration = performance.now() - start;
|
|
12
|
-
console.log(` ${name}: ${duration.toFixed(2)}ms`);
|
|
13
|
-
resolve(duration);
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
async function benchmarkGetStats() {
|
|
17
|
-
console.log('\n📊 Benchmark #1: KnowledgeGraph.getStats() - N+1 Query Fix');
|
|
18
|
-
console.log('='.repeat(70));
|
|
19
|
-
const sizes = [10, 50, 100, 500];
|
|
20
|
-
for (const size of sizes) {
|
|
21
|
-
console.log(`\n Testing with ${size} entities:`);
|
|
22
|
-
const kg = new KnowledgeGraph(':memory:');
|
|
23
|
-
await kg.initialize();
|
|
24
|
-
for (let i = 0; i < size; i++) {
|
|
25
|
-
await kg.createEntity({
|
|
26
|
-
name: `entity${i}`,
|
|
27
|
-
entityType: 'test',
|
|
28
|
-
observations: [`Observation for entity ${i}`],
|
|
29
|
-
});
|
|
30
|
-
if (i > 0) {
|
|
31
|
-
await kg.createRelation({
|
|
32
|
-
from: `entity${i - 1}`,
|
|
33
|
-
to: `entity${i}`,
|
|
34
|
-
relationType: 'related_to',
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
const duration = await measure('getStats()', async () => {
|
|
39
|
-
await kg.getStats();
|
|
40
|
-
});
|
|
41
|
-
const expected = size <= 10 ? 10 : size <= 50 ? 15 : size <= 100 ? 20 : 40;
|
|
42
|
-
const status = duration < expected ? '✅ PASS' : '⚠️ SLOW';
|
|
43
|
-
console.log(` ${status} (expected < ${expected}ms)`);
|
|
44
|
-
await kg.close();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
async function benchmarkGetConnectedEntities() {
|
|
48
|
-
console.log('\n📊 Benchmark #2: KnowledgeGraph.getConnectedEntities() - Batch Query');
|
|
49
|
-
console.log('='.repeat(70));
|
|
50
|
-
const depths = [1, 2, 3];
|
|
51
|
-
const nodeCount = 20;
|
|
52
|
-
for (const depth of depths) {
|
|
53
|
-
console.log(`\n Testing with depth ${depth}:`);
|
|
54
|
-
const kg = new KnowledgeGraph(':memory:');
|
|
55
|
-
await kg.initialize();
|
|
56
|
-
for (let i = 0; i < nodeCount; i++) {
|
|
57
|
-
await kg.createEntity({
|
|
58
|
-
name: `node${i}`,
|
|
59
|
-
entityType: 'test',
|
|
60
|
-
observations: [`Node ${i}`],
|
|
61
|
-
});
|
|
62
|
-
for (let j = Math.max(0, i - 3); j < i; j++) {
|
|
63
|
-
await kg.createRelation({
|
|
64
|
-
from: `node${j}`,
|
|
65
|
-
to: `node${i}`,
|
|
66
|
-
relationType: 'connects_to',
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
const duration = await measure(`getConnectedEntities(depth=${depth})`, async () => {
|
|
71
|
-
await kg.getConnectedEntities('node0', depth);
|
|
72
|
-
});
|
|
73
|
-
const expected = depth === 1 ? 15 : depth === 2 ? 40 : 200;
|
|
74
|
-
const status = duration < expected ? '✅ PASS' : '⚠️ SLOW';
|
|
75
|
-
console.log(` ${status} (expected < ${expected}ms)`);
|
|
76
|
-
await kg.close();
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
async function benchmarkAnalyzePatterns() {
|
|
80
|
-
console.log('\n📊 Benchmark #3: LearningManager.analyzePatterns() - Parallel Extraction');
|
|
81
|
-
console.log('='.repeat(70));
|
|
82
|
-
const testCases = [
|
|
83
|
-
{ taskTypes: 3, metricsPerType: 50 },
|
|
84
|
-
{ taskTypes: 5, metricsPerType: 100 },
|
|
85
|
-
{ taskTypes: 10, metricsPerType: 200 },
|
|
86
|
-
];
|
|
87
|
-
for (const { taskTypes, metricsPerType } of testCases) {
|
|
88
|
-
console.log(`\n Testing with ${taskTypes} task types, ${metricsPerType} metrics each:`);
|
|
89
|
-
const tracker = new PerformanceTracker();
|
|
90
|
-
const manager = new LearningManager(tracker);
|
|
91
|
-
const agentId = 'test-agent';
|
|
92
|
-
for (let t = 0; t < taskTypes; t++) {
|
|
93
|
-
const taskType = `task-type-${t}`;
|
|
94
|
-
for (let m = 0; m < metricsPerType; m++) {
|
|
95
|
-
const metric = {
|
|
96
|
-
executionId: `exec-${t}-${m}`,
|
|
97
|
-
agentId,
|
|
98
|
-
taskType,
|
|
99
|
-
durationMs: 1000 + Math.random() * 2000,
|
|
100
|
-
cost: 0.001,
|
|
101
|
-
success: Math.random() > 0.2,
|
|
102
|
-
qualityScore: 0.6 + Math.random() * 0.4,
|
|
103
|
-
timestamp: new Date(),
|
|
104
|
-
};
|
|
105
|
-
tracker.track(metric);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
const duration = await measure('analyzePatterns()', async () => {
|
|
109
|
-
manager.analyzePatterns(agentId);
|
|
110
|
-
});
|
|
111
|
-
const expected = taskTypes <= 3 ? 300 : taskTypes <= 5 ? 600 : 1200;
|
|
112
|
-
const status = duration < expected ? '✅ PASS' : '⚠️ SLOW';
|
|
113
|
-
console.log(` ${status} (expected < ${expected}ms)`);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
async function benchmarkCPUCache() {
|
|
117
|
-
console.log('\n📊 Benchmark #4: AgentRouter.getCPUUsage() - Cache Hit Rate');
|
|
118
|
-
console.log('='.repeat(70));
|
|
119
|
-
const callCounts = [10, 100, 1000];
|
|
120
|
-
for (const calls of callCounts) {
|
|
121
|
-
console.log(`\n Testing with ${calls} route() calls:`);
|
|
122
|
-
const router = new AgentRouter();
|
|
123
|
-
const duration = await measure(`${calls} route() calls`, async () => {
|
|
124
|
-
const promises = [];
|
|
125
|
-
for (let i = 0; i < calls; i++) {
|
|
126
|
-
promises.push(router.route({
|
|
127
|
-
taskId: `task-${i}`,
|
|
128
|
-
taskType: 'benchmark-test',
|
|
129
|
-
complexity: 'simple',
|
|
130
|
-
requiredCapabilities: ['general'],
|
|
131
|
-
estimatedTokens: 1000,
|
|
132
|
-
estimatedCost: toMicroDollars(0.001),
|
|
133
|
-
executionMode: 'sequential',
|
|
134
|
-
reasoning: 'Benchmark routing test',
|
|
135
|
-
}));
|
|
136
|
-
}
|
|
137
|
-
await Promise.all(promises);
|
|
138
|
-
});
|
|
139
|
-
const expected = calls <= 10 ? 50 : calls <= 100 ? 200 : 500;
|
|
140
|
-
const avgPerCall = duration / calls;
|
|
141
|
-
const status = duration < expected ? '✅ PASS' : '⚠️ SLOW';
|
|
142
|
-
console.log(` ${status} (expected < ${expected}ms, avg ${avgPerCall.toFixed(2)}ms/call)`);
|
|
143
|
-
const cacheEfficiency = calls > 10 ? avgPerCall < 1 : avgPerCall < 5;
|
|
144
|
-
console.log(` Cache efficiency: ${cacheEfficiency ? '✅ Good' : '⚠️ Poor'}`);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
async function benchmarkResourceMonitorMemory() {
|
|
148
|
-
console.log('\n📊 Benchmark #5: ResourceMonitor - Memory Leak Prevention');
|
|
149
|
-
console.log('='.repeat(70));
|
|
150
|
-
const { ResourceMonitor } = await import('../core/ResourceMonitor.js');
|
|
151
|
-
console.log('\n Testing listener cleanup:');
|
|
152
|
-
const monitor = new ResourceMonitor();
|
|
153
|
-
const listenerCount = 50;
|
|
154
|
-
const unsubscribers = [];
|
|
155
|
-
if (global.gc)
|
|
156
|
-
global.gc();
|
|
157
|
-
const memBefore = process.memoryUsage().heapUsed;
|
|
158
|
-
for (let i = 0; i < listenerCount; i++) {
|
|
159
|
-
const unsubscribe = monitor.onThresholdExceeded('cpu', () => {
|
|
160
|
-
});
|
|
161
|
-
unsubscribers.push(unsubscribe);
|
|
162
|
-
}
|
|
163
|
-
console.log(` Created ${listenerCount} listeners`);
|
|
164
|
-
for (const unsubscribe of unsubscribers) {
|
|
165
|
-
unsubscribe();
|
|
166
|
-
}
|
|
167
|
-
console.log(` Unsubscribed all listeners`);
|
|
168
|
-
if (global.gc)
|
|
169
|
-
global.gc();
|
|
170
|
-
const memAfter = process.memoryUsage().heapUsed;
|
|
171
|
-
const memLeaked = (memAfter - memBefore) / 1024;
|
|
172
|
-
console.log(` Memory delta: ${memLeaked.toFixed(2)} KB`);
|
|
173
|
-
const status = memLeaked < 100 ? '✅ PASS' : '⚠️ LEAK';
|
|
174
|
-
console.log(` ${status} (expected < 100KB delta)`);
|
|
175
|
-
console.log('\n Testing dispose() cleanup:');
|
|
176
|
-
const monitor2 = new ResourceMonitor();
|
|
177
|
-
for (let i = 0; i < listenerCount; i++) {
|
|
178
|
-
monitor2.onThresholdExceeded('memory', () => { });
|
|
179
|
-
}
|
|
180
|
-
console.log(` Created ${listenerCount} listeners without cleanup`);
|
|
181
|
-
monitor2.dispose();
|
|
182
|
-
console.log(` Called dispose()`);
|
|
183
|
-
if (global.gc)
|
|
184
|
-
global.gc();
|
|
185
|
-
const memAfterDispose = process.memoryUsage().heapUsed;
|
|
186
|
-
const memLeakedAfterDispose = (memAfterDispose - memBefore) / 1024;
|
|
187
|
-
console.log(` Memory delta: ${memLeakedAfterDispose.toFixed(2)} KB`);
|
|
188
|
-
const disposeStatus = memLeakedAfterDispose < 100 ? '✅ PASS' : '⚠️ LEAK';
|
|
189
|
-
console.log(` ${disposeStatus} (expected < 100KB delta)`);
|
|
190
|
-
}
|
|
191
|
-
async function runAllBenchmarks() {
|
|
192
|
-
console.log('\n');
|
|
193
|
-
console.log('╔════════════════════════════════════════════════════════════════════╗');
|
|
194
|
-
console.log('║ Performance Benchmarks - P2 Major Optimizations Validation ║');
|
|
195
|
-
console.log('╚════════════════════════════════════════════════════════════════════╝');
|
|
196
|
-
const startTotal = performance.now();
|
|
197
|
-
await benchmarkGetStats();
|
|
198
|
-
await benchmarkGetConnectedEntities();
|
|
199
|
-
await benchmarkAnalyzePatterns();
|
|
200
|
-
await benchmarkCPUCache();
|
|
201
|
-
await benchmarkResourceMonitorMemory();
|
|
202
|
-
const totalDuration = performance.now() - startTotal;
|
|
203
|
-
console.log('\n');
|
|
204
|
-
console.log('='.repeat(70));
|
|
205
|
-
console.log(`Total benchmark time: ${totalDuration.toFixed(2)}ms`);
|
|
206
|
-
console.log('='.repeat(70));
|
|
207
|
-
console.log('\n✅ All benchmarks complete!\n');
|
|
208
|
-
}
|
|
209
|
-
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
210
|
-
runAllBenchmarks().catch(console.error);
|
|
211
|
-
}
|
|
212
|
-
export { benchmarkGetStats, benchmarkGetConnectedEntities, benchmarkAnalyzePatterns, benchmarkCPUCache, benchmarkResourceMonitorMemory, runAllBenchmarks, };
|
|
213
|
-
//# sourceMappingURL=performance-fixes.bench.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"performance-fixes.bench.js","sourceRoot":"","sources":["../../src/__benchmarks__/performance-fixes.bench.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,mBA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AC,GAAG,EAAE,CAAC;IAErC,MAAM,iBAAiB,EAAE,CAAC;IAC1B,MAAM,6BAA6B,EAAE,CAAC;IACtC,MAAM,wBAAwB,EAAE,CAAC;IACjC,MAAM,iBAAiB,EAAE,CAAC;IAC1B,MAAM,8BAA8B,EAAE,CAAC;IAEvC,MAAM,aAAa,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC;IAErD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAClB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7B,OAAO,CAAC,GAAG,CAAC,yBAAyB,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACnE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7B,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;AAChD,CAAC;AAGD,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,UAAU,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IACpD,gBAAgB,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC1C,CAAC;AAED,OAAO,EACL,iBAAiB,EACjB,6BAA6B,EAC7B,wBAAwB,EACxB,iBAAiB,EACjB,8BAA8B,EAC9B,gBAAgB,GACjB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BackgroundExecutorConstants.d.ts","sourceRoot":"","sources":["../../src/core/BackgroundExecutorConstants.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,YAAY;;CAGf,CAAC;AAOX,eAAO,MAAM,mBAAmB;;;CAKtB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BackgroundExecutorConstants.js","sourceRoot":"","sources":["../../src/core/BackgroundExecutorConstants.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,YAAY,GAAG;IAE1B,wBAAwB,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI;CAC/B,CAAC;AAOX,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAEjC,iBAAiB,EAAE,GAAG;IAEtB,MAAM,EAAE,CAAC;CACD,CAAC"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
export declare const QUALITY_THRESHOLDS: {
|
|
2
|
-
readonly HIGH: 0.8;
|
|
3
|
-
readonly LOW: 0.5;
|
|
4
|
-
readonly MIN_ACCEPTABLE: 0.7;
|
|
5
|
-
};
|
|
6
|
-
export declare const COST_OPTIMIZATION: {
|
|
7
|
-
readonly REDUCTION_TARGET: 0.8;
|
|
8
|
-
readonly VARIATION_PERCENT: 0.1;
|
|
9
|
-
readonly VARIATION_MIN_ABSOLUTE: 0.01;
|
|
10
|
-
readonly TARGET_REDUCTION: 0.2;
|
|
11
|
-
};
|
|
12
|
-
export declare const LEARNING_PARAMETERS: {
|
|
13
|
-
readonly CONFIDENCE_INCREMENT: 0.02;
|
|
14
|
-
readonly STATISTICAL_BASELINE_SAMPLES: 30;
|
|
15
|
-
readonly CONFIDENCE_PER_OBSERVATION: 0.3;
|
|
16
|
-
};
|
|
17
|
-
export declare const COMPLEXITY_THRESHOLDS: {
|
|
18
|
-
readonly LOW_MS: 5000;
|
|
19
|
-
readonly MEDIUM_MS: 15000;
|
|
20
|
-
};
|
|
21
|
-
export declare const STATISTICAL_PARAMETERS: {
|
|
22
|
-
readonly P95_MIN_SAMPLE_SIZE: 20;
|
|
23
|
-
readonly P95_PERCENTILE: 0.95;
|
|
24
|
-
readonly P95_TIMEOUT_MULTIPLIER: 1.5;
|
|
25
|
-
};
|
|
26
|
-
export declare const MEMORY_LIMITS: {
|
|
27
|
-
readonly MAX_SAVED_AGENTS: 100;
|
|
28
|
-
readonly MAX_PATTERNS_PER_AGENT: 100;
|
|
29
|
-
readonly MAX_FEEDBACK_PER_AGENT: 500;
|
|
30
|
-
};
|
|
31
|
-
export declare const PATTERN_EXTRACTION: {
|
|
32
|
-
readonly MIN_OBSERVATIONS: 10;
|
|
33
|
-
readonly MIN_CONFIDENCE: 0.7;
|
|
34
|
-
readonly SUCCESS_RATE_THRESHOLD: 0.8;
|
|
35
|
-
readonly FAILURE_RATE_THRESHOLD: 0.3;
|
|
36
|
-
readonly ANTI_PATTERN_OBSERVATION_DIVISOR: 2;
|
|
37
|
-
readonly OPTIMIZATION_OBSERVATION_DIVISOR: 2;
|
|
38
|
-
};
|
|
39
|
-
export declare const TEST_DEFAULTS: {
|
|
40
|
-
readonly SUCCESS_RATING: 4;
|
|
41
|
-
readonly FAILURE_RATING: 2;
|
|
42
|
-
};
|
|
43
|
-
export declare const PATTERN_KEYWORDS: {
|
|
44
|
-
readonly ERROR_HANDLING: readonly string[];
|
|
45
|
-
readonly VALIDATION: readonly string[];
|
|
46
|
-
readonly DOCUMENTATION: readonly string[];
|
|
47
|
-
readonly TYPE_ANNOTATIONS: readonly string[];
|
|
48
|
-
};
|
|
49
|
-
export declare const PATTERN_DESCRIPTIONS: {
|
|
50
|
-
readonly ERROR_HANDLING: "always add error handling to async functions";
|
|
51
|
-
readonly VALIDATION: "always include input validation";
|
|
52
|
-
readonly DOCUMENTATION: "always include comprehensive documentation";
|
|
53
|
-
readonly TYPE_ANNOTATIONS: "always add type annotations";
|
|
54
|
-
};
|
|
55
|
-
//# sourceMappingURL=LearningManagerConstants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LearningManagerConstants.d.ts","sourceRoot":"","sources":["../../src/evolution/LearningManagerConstants.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,kBAAkB;;;;CAOrB,CAAC;AAOX,eAAO,MAAM,iBAAiB;;;;;CASpB,CAAC;AAOX,eAAO,MAAM,mBAAmB;;;;CAOtB,CAAC;AAOX,eAAO,MAAM,qBAAqB;;;CAMxB,CAAC;AAOX,eAAO,MAAM,sBAAsB;;;;CAOzB,CAAC;AAOX,eAAO,MAAM,aAAa;;;;CAOhB,CAAC;AAOX,eAAO,MAAM,kBAAkB;;;;;;;CAarB,CAAC;AAOX,eAAO,MAAM,aAAa;;;CAKhB,CAAC;AAOX,eAAO,MAAM,gBAAgB;6BACwB,SAAS,MAAM,EAAE;yBAC7B,SAAS,MAAM,EAAE;4BACT,SAAS,MAAM,EAAE;+BACpB,SAAS,MAAM,EAAE;CACrD,CAAC;AAOX,eAAO,MAAM,oBAAoB;;;;;CAKvB,CAAC"}
|