claude-mycelium 2.0.0
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/.claude/settings.local.json +14 -0
- package/README.md +304 -0
- package/dist/coordination/gradient-cache.d.ts +48 -0
- package/dist/coordination/gradient-cache.d.ts.map +1 -0
- package/dist/coordination/gradient-cache.js +145 -0
- package/dist/coordination/gradient-cache.js.map +1 -0
- package/dist/coordination/index.d.ts +10 -0
- package/dist/coordination/index.d.ts.map +1 -0
- package/dist/coordination/index.js +10 -0
- package/dist/coordination/index.js.map +1 -0
- package/dist/core/agent-executor.d.ts +31 -0
- package/dist/core/agent-executor.d.ts.map +1 -0
- package/dist/core/agent-executor.js +257 -0
- package/dist/core/agent-executor.js.map +1 -0
- package/dist/core/change-applier.d.ts +10 -0
- package/dist/core/change-applier.d.ts.map +1 -0
- package/dist/core/change-applier.js +32 -0
- package/dist/core/change-applier.js.map +1 -0
- package/dist/core/gradient.d.ts +60 -0
- package/dist/core/gradient.d.ts.map +1 -0
- package/dist/core/gradient.js +191 -0
- package/dist/core/gradient.js.map +1 -0
- package/dist/core/index.d.ts +24 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +24 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/mode-selector.d.ts +44 -0
- package/dist/core/mode-selector.d.ts.map +1 -0
- package/dist/core/mode-selector.js +208 -0
- package/dist/core/mode-selector.js.map +1 -0
- package/dist/core/signals/centrality.d.ts +44 -0
- package/dist/core/signals/centrality.d.ts.map +1 -0
- package/dist/core/signals/centrality.js +264 -0
- package/dist/core/signals/centrality.js.map +1 -0
- package/dist/core/signals/churn.d.ts +41 -0
- package/dist/core/signals/churn.d.ts.map +1 -0
- package/dist/core/signals/churn.js +188 -0
- package/dist/core/signals/churn.js.map +1 -0
- package/dist/core/signals/complexity.d.ts +29 -0
- package/dist/core/signals/complexity.d.ts.map +1 -0
- package/dist/core/signals/complexity.js +169 -0
- package/dist/core/signals/complexity.js.map +1 -0
- package/dist/core/signals/debt.d.ts +27 -0
- package/dist/core/signals/debt.d.ts.map +1 -0
- package/dist/core/signals/debt.js +80 -0
- package/dist/core/signals/debt.js.map +1 -0
- package/dist/core/signals/errors.d.ts +32 -0
- package/dist/core/signals/errors.d.ts.map +1 -0
- package/dist/core/signals/errors.js +73 -0
- package/dist/core/signals/errors.js.map +1 -0
- package/dist/core/signals/index.d.ts +19 -0
- package/dist/core/signals/index.d.ts.map +1 -0
- package/dist/core/signals/index.js +19 -0
- package/dist/core/signals/index.js.map +1 -0
- package/dist/cost/cost-tracker.d.ts +90 -0
- package/dist/cost/cost-tracker.d.ts.map +1 -0
- package/dist/cost/cost-tracker.js +305 -0
- package/dist/cost/cost-tracker.js.map +1 -0
- package/dist/cost/index.d.ts +56 -0
- package/dist/cost/index.d.ts.map +1 -0
- package/dist/cost/index.js +111 -0
- package/dist/cost/index.js.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/llm/anthropic-client.d.ts +52 -0
- package/dist/llm/anthropic-client.d.ts.map +1 -0
- package/dist/llm/anthropic-client.js +310 -0
- package/dist/llm/anthropic-client.js.map +1 -0
- package/dist/llm/index.d.ts +27 -0
- package/dist/llm/index.d.ts.map +1 -0
- package/dist/llm/index.js +34 -0
- package/dist/llm/index.js.map +1 -0
- package/dist/prompts/complexity-reducer.d.ts +7 -0
- package/dist/prompts/complexity-reducer.d.ts.map +1 -0
- package/dist/prompts/complexity-reducer.js +55 -0
- package/dist/prompts/complexity-reducer.js.map +1 -0
- package/dist/prompts/debt-payer.d.ts +7 -0
- package/dist/prompts/debt-payer.d.ts.map +1 -0
- package/dist/prompts/debt-payer.js +55 -0
- package/dist/prompts/debt-payer.js.map +1 -0
- package/dist/prompts/error-reducer.d.ts +7 -0
- package/dist/prompts/error-reducer.d.ts.map +1 -0
- package/dist/prompts/error-reducer.js +54 -0
- package/dist/prompts/error-reducer.js.map +1 -0
- package/dist/prompts/index.d.ts +22 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +112 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/stabilizer.d.ts +7 -0
- package/dist/prompts/stabilizer.d.ts.map +1 -0
- package/dist/prompts/stabilizer.js +55 -0
- package/dist/prompts/stabilizer.js.map +1 -0
- package/dist/prompts/types.d.ts +14 -0
- package/dist/prompts/types.d.ts.map +1 -0
- package/dist/prompts/types.js +5 -0
- package/dist/prompts/types.js.map +1 -0
- package/dist/trace/index.d.ts +51 -0
- package/dist/trace/index.d.ts.map +1 -0
- package/dist/trace/index.js +60 -0
- package/dist/trace/index.js.map +1 -0
- package/dist/trace/trace-event.d.ts +72 -0
- package/dist/trace/trace-event.d.ts.map +1 -0
- package/dist/trace/trace-event.js +244 -0
- package/dist/trace/trace-event.js.map +1 -0
- package/dist/types/index.d.ts +206 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +6 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/ci-provider.d.ts +43 -0
- package/dist/utils/ci-provider.d.ts.map +1 -0
- package/dist/utils/ci-provider.js +130 -0
- package/dist/utils/ci-provider.js.map +1 -0
- package/dist/utils/config.d.ts +31 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +85 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/error-provider.d.ts +51 -0
- package/dist/utils/error-provider.d.ts.map +1 -0
- package/dist/utils/error-provider.js +123 -0
- package/dist/utils/error-provider.js.map +1 -0
- package/dist/utils/file-utils.d.ts +18 -0
- package/dist/utils/file-utils.d.ts.map +1 -0
- package/dist/utils/file-utils.js +95 -0
- package/dist/utils/file-utils.js.map +1 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +10 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +36 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +74 -0
- package/dist/utils/logger.js.map +1 -0
- package/docs/IMPLEMENTATION-STATUS.md +199 -0
- package/docs/PHASE-0-COMPLETE.md +252 -0
- package/docs/PHASE-1-COMPLETE.md +204 -0
- package/docs/PHASE-2-COMPLETE.md +233 -0
- package/docs/PHASE2_COMPLETION_CHECKLIST.md +290 -0
- package/docs/PHASE2_INTEGRATION_SUMMARY.md +255 -0
- package/docs/PHASE2_QUICK_REFERENCE.md +365 -0
- package/docs/PHASE2_TEST_RESULTS.md +282 -0
- package/docs/ROADMAP.md +746 -0
- package/docs/SNAPSHOT.md +376 -0
- package/docs/adrs/ADR-001-signal-computation.md +76 -0
- package/docs/adrs/ADR-002-inhibitor-signals.md +108 -0
- package/docs/adrs/ADR-003-llm-integration.md +156 -0
- package/docs/adrs/ADR-004-process-architecture.md +175 -0
- package/docs/adrs/ADR-005-testing-strategy.md +243 -0
- package/docs/pitch.md +94 -0
- package/docs/specs/fourth-spec.md +1973 -0
- package/docs/specs/initial-spec.md +2096 -0
- package/docs/specs/second-spec.md +2690 -0
- package/package.json +50 -0
- package/src/coordination/gradient-cache.ts +185 -0
- package/src/coordination/index.ts +10 -0
- package/src/core/agent-executor.ts +327 -0
- package/src/core/change-applier.ts +338 -0
- package/src/core/gradient.ts +258 -0
- package/src/core/index.ts +24 -0
- package/src/core/mode-selector.ts +243 -0
- package/src/core/signals/centrality.ts +328 -0
- package/src/core/signals/churn.ts +239 -0
- package/src/core/signals/complexity.ts +206 -0
- package/src/core/signals/debt.ts +111 -0
- package/src/core/signals/errors.ts +93 -0
- package/src/core/signals/index.ts +19 -0
- package/src/cost/cost-tracker.ts +410 -0
- package/src/cost/index.ts +143 -0
- package/src/index.ts +43 -0
- package/src/llm/anthropic-client.ts +415 -0
- package/src/llm/index.ts +43 -0
- package/src/prompts/complexity-reducer.ts +59 -0
- package/src/prompts/debt-payer.ts +59 -0
- package/src/prompts/error-reducer.ts +58 -0
- package/src/prompts/index.ts +128 -0
- package/src/prompts/stabilizer.ts +59 -0
- package/src/prompts/types.ts +15 -0
- package/src/trace/README.md +178 -0
- package/src/trace/index.ts +88 -0
- package/src/trace/trace-event.ts +324 -0
- package/src/types/index.ts +271 -0
- package/src/utils/ci-provider.ts +145 -0
- package/src/utils/config.ts +95 -0
- package/src/utils/error-provider.ts +138 -0
- package/src/utils/file-utils.ts +111 -0
- package/src/utils/index.ts +10 -0
- package/src/utils/logger.ts +94 -0
- package/test-8d713cc8-f4b7-403d-8153-57573172b94c.ts +3 -0
- package/tests/coordination/gradient-cache.test.ts +270 -0
- package/tests/core/agent-executor.test.ts +217 -0
- package/tests/core/change-applier.test.ts +336 -0
- package/tests/core/gradient.test.ts +263 -0
- package/tests/core/mode-selector.test.ts +239 -0
- package/tests/core/signals/centrality.test.ts +512 -0
- package/tests/core/signals/churn.test.ts +355 -0
- package/tests/core/signals/complexity.test.ts +284 -0
- package/tests/core/signals/debt.test.ts +437 -0
- package/tests/core/signals/errors.test.ts +350 -0
- package/tests/cost/cost-tracker.test.ts +475 -0
- package/tests/integration/phase2.test.ts +405 -0
- package/tests/llm/anthropic-client.test.ts +437 -0
- package/tests/prompts/prompts.test.ts +266 -0
- package/tests/trace/trace-event.test.ts +666 -0
- package/tests/utils/file-utils.test.ts +148 -0
- package/tsconfig.json +24 -0
- package/vitest.config.ts +28 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(npm run build:*)",
|
|
5
|
+
"Bash(npm test:*)",
|
|
6
|
+
"Bash(find:*)",
|
|
7
|
+
"Bash(npx @claude-flow/cli@latest swarm init:*)"
|
|
8
|
+
]
|
|
9
|
+
},
|
|
10
|
+
"enableAllProjectMcpServers": true,
|
|
11
|
+
"enabledMcpjsonServers": [
|
|
12
|
+
"claude-flow"
|
|
13
|
+
]
|
|
14
|
+
}
|
package/README.md
ADDED
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
# Claude Mycelium 🍄
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/claude-mycelium)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://github.com/ruvnet/claude-mycelium)
|
|
6
|
+
[](https://www.typescriptlang.org/)
|
|
7
|
+
|
|
8
|
+
> **Self-Learning AI Code Evolution System** - Automated code quality improvement through intelligent gradient-based optimization and autonomous agent orchestration.
|
|
9
|
+
|
|
10
|
+
Claude Mycelium is an autonomous AI agent system that continuously learns and improves your codebase using gradient-based signals, inhibitor-based learning, and LLM-powered code transformations. Like a mycelium network, it spreads intelligence throughout your codebase, connecting patterns and optimizing quality.
|
|
11
|
+
|
|
12
|
+
## ✨ Features
|
|
13
|
+
|
|
14
|
+
### 🎯 Intelligent Signal System
|
|
15
|
+
- **Complexity Signal** - Detects cyclomatic complexity hotspots
|
|
16
|
+
- **Churn Signal** - Identifies frequently modified files
|
|
17
|
+
- **Centrality Signal** - Maps dependency relationships
|
|
18
|
+
- **Technical Debt Signal** - Tracks code quality issues
|
|
19
|
+
- **Error Signal** - Monitors runtime error patterns
|
|
20
|
+
|
|
21
|
+
### 🤖 Autonomous Agent System
|
|
22
|
+
- **4 Agent Modes** - Error Reducer, Complexity Reducer, Debt Payer, Stabilizer
|
|
23
|
+
- **Gradient-Based Optimization** - Mathematical gradient descent for code quality
|
|
24
|
+
- **Inhibitor-Based Learning** - Learns from failures through mycelium-inspired signals
|
|
25
|
+
- **Automatic Rollback** - Reverts changes if tests fail
|
|
26
|
+
- **Cost Tracking** - Monitors LLM API usage and efficiency
|
|
27
|
+
|
|
28
|
+
### 🔬 Phase 2 Complete
|
|
29
|
+
- ✅ **LLM Integration** - Anthropic Claude with streaming support
|
|
30
|
+
- ✅ **Agent Execution** - 10-step orchestration loop
|
|
31
|
+
- ✅ **Change Application** - Safe code modification with backup/rollback
|
|
32
|
+
- ✅ **Trace System** - JSONL-based learning foundation
|
|
33
|
+
- ✅ **Cost Tracking** - Multi-model pricing and budget monitoring
|
|
34
|
+
|
|
35
|
+
## 🚀 Quick Start
|
|
36
|
+
|
|
37
|
+
### Installation
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install claude-mycelium
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Prerequisites
|
|
44
|
+
|
|
45
|
+
- Node.js 20+
|
|
46
|
+
- TypeScript 5.0+
|
|
47
|
+
- Anthropic API Key
|
|
48
|
+
|
|
49
|
+
### Basic Usage
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import { executeAgent } from 'claude-mycelium';
|
|
53
|
+
|
|
54
|
+
// Set your API key
|
|
55
|
+
process.env.ANTHROPIC_API_KEY = 'sk-ant-...';
|
|
56
|
+
|
|
57
|
+
// Run the agent on a file
|
|
58
|
+
const result = await executeAgent(
|
|
59
|
+
'src/my-file.ts',
|
|
60
|
+
'error_reducer',
|
|
61
|
+
{ dryRun: false }
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
console.log(`Changes: ${result.changes}`);
|
|
65
|
+
console.log(`Cost: $${result.cost.toFixed(4)}`);
|
|
66
|
+
console.log(`Efficiency: ${result.trace.metabolic_efficiency.toFixed(3)}`);
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Calculate Gradient Scores
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
import { calculateGradient } from 'claude-mycelium';
|
|
73
|
+
|
|
74
|
+
const gradient = await calculateGradient('src/my-file.ts');
|
|
75
|
+
console.log(`Overall Score: ${gradient.score.toFixed(2)}`);
|
|
76
|
+
console.log(`Complexity: ${gradient.signals.complexity.value}`);
|
|
77
|
+
console.log(`Technical Debt: ${gradient.signals.debt.value}`);
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Agent Modes
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
// Error Reducer - Adds error handling and validation
|
|
84
|
+
await executeAgent('src/api.ts', 'error_reducer');
|
|
85
|
+
|
|
86
|
+
// Complexity Reducer - Simplifies complex functions
|
|
87
|
+
await executeAgent('src/utils.ts', 'complexity_reducer');
|
|
88
|
+
|
|
89
|
+
// Debt Payer - Fixes linting issues and code smells
|
|
90
|
+
await executeAgent('src/legacy.ts', 'debt_payer');
|
|
91
|
+
|
|
92
|
+
// Stabilizer - Reduces file churn and improves stability
|
|
93
|
+
await executeAgent('src/volatile.ts', 'stabilizer');
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## 📊 Architecture
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
┌─────────────────────────────────────────────────────────┐
|
|
100
|
+
│ Claude Mycelium - Self-Learning Code Evolution │
|
|
101
|
+
└─────────────────────────────────────────────────────────┘
|
|
102
|
+
│
|
|
103
|
+
┌────────────────┼────────────────┐
|
|
104
|
+
│ │ │
|
|
105
|
+
[Signals] [Gradient] [Agents]
|
|
106
|
+
│ │ │
|
|
107
|
+
5 dimensions Mathematical 4 modes
|
|
108
|
+
of quality optimization of action
|
|
109
|
+
│ │ │
|
|
110
|
+
└────────────────┼────────────────┘
|
|
111
|
+
│
|
|
112
|
+
┌──────────┴──────────┐
|
|
113
|
+
│ │
|
|
114
|
+
[LLM Layer] [Learning Layer]
|
|
115
|
+
│ │
|
|
116
|
+
Anthropic Claude Trace System
|
|
117
|
+
Cost Tracking Efficiency Metrics
|
|
118
|
+
Retry Logic Pattern Recognition
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## 🛠️ Configuration
|
|
122
|
+
|
|
123
|
+
### Environment Variables
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# Required
|
|
127
|
+
ANTHROPIC_API_KEY=sk-ant-...
|
|
128
|
+
|
|
129
|
+
# Optional
|
|
130
|
+
LOG_LEVEL=info # debug, info, warn, error
|
|
131
|
+
MAX_RETRIES=3 # LLM retry attempts
|
|
132
|
+
DRY_RUN=false # Simulate without changes
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### API Options
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
interface ExecuteOptions {
|
|
139
|
+
dryRun?: boolean; // Validate without applying
|
|
140
|
+
maxRetries?: number; // LLM retry attempts
|
|
141
|
+
createBackup?: boolean; // Backup before changes
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## 📈 How It Works
|
|
146
|
+
|
|
147
|
+
### The 10-Step Execution Loop
|
|
148
|
+
|
|
149
|
+
1. **Calculate Gradient** - Measure current code quality
|
|
150
|
+
2. **Select Mode** - Choose optimal agent strategy
|
|
151
|
+
3. **Generate Prompt** - Create context-aware instructions
|
|
152
|
+
4. **Call LLM** - Request code improvements
|
|
153
|
+
5. **Parse Response** - Extract code changes
|
|
154
|
+
6. **Validate** - Check TypeScript syntax
|
|
155
|
+
7. **Apply Changes** - Safely modify files
|
|
156
|
+
8. **Run Tests** - Verify correctness
|
|
157
|
+
9. **Calculate New Gradient** - Measure improvement
|
|
158
|
+
10. **Record Trace** - Learn from outcome
|
|
159
|
+
|
|
160
|
+
### Gradient-Based Optimization
|
|
161
|
+
|
|
162
|
+
Claude Mycelium treats code quality as a mathematical optimization problem:
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
Gradient = Σ(weight_i × signal_i)
|
|
166
|
+
|
|
167
|
+
Where:
|
|
168
|
+
- signal_complexity: Cyclomatic complexity
|
|
169
|
+
- signal_churn: File modification frequency
|
|
170
|
+
- signal_debt: Technical debt indicators
|
|
171
|
+
- signal_error: Error rate patterns
|
|
172
|
+
- signal_centrality: Dependency coupling
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## 🎓 Advanced Usage
|
|
176
|
+
|
|
177
|
+
### Custom Signal Weights
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
import { calculateGradient } from 'claude-mycelium';
|
|
181
|
+
|
|
182
|
+
const gradient = await calculateGradient('src/app.ts', {
|
|
183
|
+
weights: {
|
|
184
|
+
complexity: 0.3,
|
|
185
|
+
churn: 0.2,
|
|
186
|
+
debt: 0.3,
|
|
187
|
+
error: 0.1,
|
|
188
|
+
centrality: 0.1,
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Batch Processing
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
import { executeAgent } from 'claude-mycelium';
|
|
197
|
+
import { glob } from 'glob';
|
|
198
|
+
|
|
199
|
+
const files = await glob('src/**/*.ts');
|
|
200
|
+
|
|
201
|
+
for (const file of files) {
|
|
202
|
+
const gradient = await calculateGradient(file);
|
|
203
|
+
|
|
204
|
+
if (gradient.score > 0.7) {
|
|
205
|
+
// High complexity - needs improvement
|
|
206
|
+
await executeAgent(file, 'complexity_reducer');
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Learning from Traces
|
|
212
|
+
|
|
213
|
+
```typescript
|
|
214
|
+
import { getRecentEfficiency } from 'claude-mycelium';
|
|
215
|
+
|
|
216
|
+
// Get efficiency of last 10 changes
|
|
217
|
+
const efficiency = await getRecentEfficiency('src/app.ts', 10);
|
|
218
|
+
console.log(`Historical efficiency: ${efficiency}`);
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## 📦 What's Included
|
|
222
|
+
|
|
223
|
+
- `src/core/` - Agent execution and orchestration
|
|
224
|
+
- `src/signals/` - 5 quality measurement systems
|
|
225
|
+
- `src/gradient/` - Mathematical optimization
|
|
226
|
+
- `src/llm/` - Anthropic Claude integration
|
|
227
|
+
- `src/trace/` - Learning and efficiency tracking
|
|
228
|
+
- `src/cost/` - Budget monitoring and reporting
|
|
229
|
+
|
|
230
|
+
## 🔒 Safety Features
|
|
231
|
+
|
|
232
|
+
- **Backup System** - Creates backups before any changes
|
|
233
|
+
- **Automatic Rollback** - Reverts on test failures
|
|
234
|
+
- **TypeScript Validation** - Syntax checking before apply
|
|
235
|
+
- **Path Safety** - Prevents modification of .git/ and node_modules/
|
|
236
|
+
- **File Size Limits** - Protects against large file issues
|
|
237
|
+
- **Dry Run Mode** - Test without applying changes
|
|
238
|
+
|
|
239
|
+
## 📊 Performance
|
|
240
|
+
|
|
241
|
+
- **Test Coverage**: 289/292 tests passing (99%)
|
|
242
|
+
- **LLM Models**: Claude Sonnet 4.5, Opus 4.5, Haiku 3.5
|
|
243
|
+
- **Retry Logic**: Exponential backoff for rate limits
|
|
244
|
+
- **Cost Tracking**: Per-file and aggregate metrics
|
|
245
|
+
- **Efficiency**: Gradient improvement per dollar spent
|
|
246
|
+
|
|
247
|
+
## 🗺️ Roadmap
|
|
248
|
+
|
|
249
|
+
### Phase 1 ✅ Complete
|
|
250
|
+
- Signal system (5 dimensions)
|
|
251
|
+
- Gradient calculation
|
|
252
|
+
- Mode selection
|
|
253
|
+
- Caching and optimization
|
|
254
|
+
|
|
255
|
+
### Phase 2 ✅ Complete
|
|
256
|
+
- LLM integration (Anthropic Claude)
|
|
257
|
+
- Agent execution loop
|
|
258
|
+
- Change application with rollback
|
|
259
|
+
- Trace system and learning foundation
|
|
260
|
+
- Cost tracking and efficiency metrics
|
|
261
|
+
|
|
262
|
+
### Phase 3 🔄 Next
|
|
263
|
+
- Concurrency & coordination
|
|
264
|
+
- File locks (atomic operations)
|
|
265
|
+
- Process spawning and IPC
|
|
266
|
+
- Multi-agent coordination
|
|
267
|
+
|
|
268
|
+
### Phase 4 📋 Planned
|
|
269
|
+
- Inhibitor signals (ADR-002)
|
|
270
|
+
- Quarantine system
|
|
271
|
+
- Explorer mode
|
|
272
|
+
- Learning from failures
|
|
273
|
+
|
|
274
|
+
### Phase 5-9 📋 Future
|
|
275
|
+
- Multi-file orchestration
|
|
276
|
+
- Task planning and execution
|
|
277
|
+
- CLI and watch mode
|
|
278
|
+
- Distributed swarm coordination
|
|
279
|
+
|
|
280
|
+
## 🤝 Contributing
|
|
281
|
+
|
|
282
|
+
We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
283
|
+
|
|
284
|
+
## 📄 License
|
|
285
|
+
|
|
286
|
+
MIT License - see [LICENSE](LICENSE) for details
|
|
287
|
+
|
|
288
|
+
## 🙏 Acknowledgments
|
|
289
|
+
|
|
290
|
+
- Built with [Anthropic Claude](https://www.anthropic.com/claude)
|
|
291
|
+
- Inspired by gradient descent optimization
|
|
292
|
+
- Named after mycelium networks in nature
|
|
293
|
+
|
|
294
|
+
## 📞 Support
|
|
295
|
+
|
|
296
|
+
- **Issues**: [GitHub Issues](https://github.com/ruvnet/claude-mycelium/issues)
|
|
297
|
+
- **Discussions**: [GitHub Discussions](https://github.com/ruvnet/claude-mycelium/discussions)
|
|
298
|
+
- **Email**: support@claude-mycelium.dev
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
**Made with Claude Opus 4.5** 🍄✨
|
|
303
|
+
|
|
304
|
+
*Continuous code evolution through autonomous AI agents*
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gradient Cache
|
|
3
|
+
* Per ADR-001 and second-spec §2
|
|
4
|
+
*
|
|
5
|
+
* Caches computed gradients for 5 minutes to avoid expensive recomputation.
|
|
6
|
+
* Invalidated when files change or on explicit cache clear.
|
|
7
|
+
*
|
|
8
|
+
* Cache is in-memory for simplicity. Future: could persist to .agent-meta/
|
|
9
|
+
*/
|
|
10
|
+
import type { GradientScore } from '../core/gradient.js';
|
|
11
|
+
/**
|
|
12
|
+
* Get cached gradient if available and not expired
|
|
13
|
+
*/
|
|
14
|
+
export declare function getCachedGradient(filePath: string): GradientScore | null;
|
|
15
|
+
/**
|
|
16
|
+
* Store gradient in cache
|
|
17
|
+
*/
|
|
18
|
+
export declare function setCachedGradient(gradient: GradientScore): void;
|
|
19
|
+
/**
|
|
20
|
+
* Invalidate cache for specific file
|
|
21
|
+
*/
|
|
22
|
+
export declare function invalidateGradient(filePath: string): void;
|
|
23
|
+
/**
|
|
24
|
+
* Invalidate entire cache
|
|
25
|
+
* Used when files change or on explicit clear
|
|
26
|
+
*/
|
|
27
|
+
export declare function invalidateGradientCache(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Get cache statistics
|
|
30
|
+
*/
|
|
31
|
+
export declare function getGradientCacheStats(): {
|
|
32
|
+
size: number;
|
|
33
|
+
entries: Array<{
|
|
34
|
+
file: string;
|
|
35
|
+
age: number;
|
|
36
|
+
score: number;
|
|
37
|
+
}>;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Get cached gradient with fallback to computation
|
|
41
|
+
*/
|
|
42
|
+
export declare function getOrComputeGradient(filePath: string, computeFn: () => Promise<GradientScore>): Promise<GradientScore>;
|
|
43
|
+
/**
|
|
44
|
+
* Batch get or compute gradients
|
|
45
|
+
* Efficiently handles mix of cached and uncached files
|
|
46
|
+
*/
|
|
47
|
+
export declare function getOrComputeGradientBatch(filePaths: string[], computeBatchFn: (files: string[]) => Promise<Map<string, GradientScore>>): Promise<Map<string, GradientScore>>;
|
|
48
|
+
//# sourceMappingURL=gradient-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradient-cache.d.ts","sourceRoot":"","sources":["../../src/coordination/gradient-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAazD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CA2BxE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI,CAW/D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAMzD;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAK9C;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC9D,CAmBA;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,GACtC,OAAO,CAAC,aAAa,CAAC,CAaxB;AAED;;;GAGG;AACH,wBAAsB,yBAAyB,CAC7C,SAAS,EAAE,MAAM,EAAE,EACnB,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,GACvE,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAmCrC"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gradient Cache
|
|
3
|
+
* Per ADR-001 and second-spec §2
|
|
4
|
+
*
|
|
5
|
+
* Caches computed gradients for 5 minutes to avoid expensive recomputation.
|
|
6
|
+
* Invalidated when files change or on explicit cache clear.
|
|
7
|
+
*
|
|
8
|
+
* Cache is in-memory for simplicity. Future: could persist to .agent-meta/
|
|
9
|
+
*/
|
|
10
|
+
import { logDebug } from '../utils/logger.js';
|
|
11
|
+
// 5-minute TTL per spec
|
|
12
|
+
const CACHE_TTL_MS = 5 * 60 * 1000;
|
|
13
|
+
// In-memory cache
|
|
14
|
+
const cache = new Map();
|
|
15
|
+
/**
|
|
16
|
+
* Get cached gradient if available and not expired
|
|
17
|
+
*/
|
|
18
|
+
export function getCachedGradient(filePath) {
|
|
19
|
+
const cached = cache.get(filePath);
|
|
20
|
+
if (!cached) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
const now = Date.now();
|
|
24
|
+
const age = now - cached.computedAt;
|
|
25
|
+
if (age > CACHE_TTL_MS) {
|
|
26
|
+
// Expired
|
|
27
|
+
cache.delete(filePath);
|
|
28
|
+
logDebug('Gradient cache expired', {
|
|
29
|
+
file: filePath,
|
|
30
|
+
age: Math.round(age / 1000) + 's',
|
|
31
|
+
});
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
logDebug('Gradient cache hit', {
|
|
35
|
+
file: filePath,
|
|
36
|
+
age: Math.round(age / 1000) + 's',
|
|
37
|
+
score: cached.gradient.score.toFixed(3),
|
|
38
|
+
});
|
|
39
|
+
return cached.gradient;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Store gradient in cache
|
|
43
|
+
*/
|
|
44
|
+
export function setCachedGradient(gradient) {
|
|
45
|
+
cache.set(gradient.file, {
|
|
46
|
+
gradient,
|
|
47
|
+
computedAt: Date.now(),
|
|
48
|
+
});
|
|
49
|
+
logDebug('Gradient cached', {
|
|
50
|
+
file: gradient.file,
|
|
51
|
+
score: gradient.score.toFixed(3),
|
|
52
|
+
ttl: CACHE_TTL_MS / 1000 + 's',
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Invalidate cache for specific file
|
|
57
|
+
*/
|
|
58
|
+
export function invalidateGradient(filePath) {
|
|
59
|
+
const hadCache = cache.delete(filePath);
|
|
60
|
+
if (hadCache) {
|
|
61
|
+
logDebug('Gradient cache invalidated', { file: filePath });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Invalidate entire cache
|
|
66
|
+
* Used when files change or on explicit clear
|
|
67
|
+
*/
|
|
68
|
+
export function invalidateGradientCache() {
|
|
69
|
+
const count = cache.size;
|
|
70
|
+
cache.clear();
|
|
71
|
+
logDebug('Gradient cache cleared', { count });
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Get cache statistics
|
|
75
|
+
*/
|
|
76
|
+
export function getGradientCacheStats() {
|
|
77
|
+
const now = Date.now();
|
|
78
|
+
const entries = [];
|
|
79
|
+
for (const [file, cached] of cache.entries()) {
|
|
80
|
+
entries.push({
|
|
81
|
+
file,
|
|
82
|
+
age: Math.round((now - cached.computedAt) / 1000),
|
|
83
|
+
score: cached.gradient.score,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
// Sort by age (oldest first)
|
|
87
|
+
entries.sort((a, b) => b.age - a.age);
|
|
88
|
+
return {
|
|
89
|
+
size: cache.size,
|
|
90
|
+
entries,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Get cached gradient with fallback to computation
|
|
95
|
+
*/
|
|
96
|
+
export async function getOrComputeGradient(filePath, computeFn) {
|
|
97
|
+
// Check cache first
|
|
98
|
+
const cached = getCachedGradient(filePath);
|
|
99
|
+
if (cached) {
|
|
100
|
+
return cached;
|
|
101
|
+
}
|
|
102
|
+
// Cache miss - compute and store
|
|
103
|
+
logDebug('Gradient cache miss, computing', { file: filePath });
|
|
104
|
+
const gradient = await computeFn();
|
|
105
|
+
setCachedGradient(gradient);
|
|
106
|
+
return gradient;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Batch get or compute gradients
|
|
110
|
+
* Efficiently handles mix of cached and uncached files
|
|
111
|
+
*/
|
|
112
|
+
export async function getOrComputeGradientBatch(filePaths, computeBatchFn) {
|
|
113
|
+
const results = new Map();
|
|
114
|
+
const uncached = [];
|
|
115
|
+
// Check cache for each file
|
|
116
|
+
for (const file of filePaths) {
|
|
117
|
+
const cached = getCachedGradient(file);
|
|
118
|
+
if (cached) {
|
|
119
|
+
results.set(file, cached);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
uncached.push(file);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
// Compute remaining files in batch
|
|
126
|
+
if (uncached.length > 0) {
|
|
127
|
+
logDebug('Batch gradient cache miss', {
|
|
128
|
+
cached: filePaths.length - uncached.length,
|
|
129
|
+
uncached: uncached.length,
|
|
130
|
+
});
|
|
131
|
+
const computed = await computeBatchFn(uncached);
|
|
132
|
+
// Store newly computed gradients
|
|
133
|
+
for (const [file, gradient] of computed.entries()) {
|
|
134
|
+
setCachedGradient(gradient);
|
|
135
|
+
results.set(file, gradient);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
logDebug('Batch gradient cache hit (all)', {
|
|
140
|
+
count: filePaths.length,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
return results;
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=gradient-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradient-cache.js","sourceRoot":"","sources":["../../src/coordination/gradient-cache.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coordination Layer - Index
|
|
3
|
+
*
|
|
4
|
+
* Exports coordination utilities for managing agent work:
|
|
5
|
+
* - Gradient caching
|
|
6
|
+
* - File locks (Phase 3)
|
|
7
|
+
* - Process management (Phase 3)
|
|
8
|
+
*/
|
|
9
|
+
export * from './gradient-cache.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/coordination/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coordination Layer - Index
|
|
3
|
+
*
|
|
4
|
+
* Exports coordination utilities for managing agent work:
|
|
5
|
+
* - Gradient caching
|
|
6
|
+
* - File locks (Phase 3)
|
|
7
|
+
* - Process management (Phase 3)
|
|
8
|
+
*/
|
|
9
|
+
export * from './gradient-cache.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/coordination/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main Agent Executor
|
|
3
|
+
* Per second-spec §4
|
|
4
|
+
*
|
|
5
|
+
* Orchestrates the complete agent execution flow:
|
|
6
|
+
* 1. Calculate gradient for file
|
|
7
|
+
* 2. Generate prompt using mode-specific template
|
|
8
|
+
* 3. Call LLM
|
|
9
|
+
* 4. Parse LLM response for code changes
|
|
10
|
+
* 5. Apply changes
|
|
11
|
+
* 6. Record trace event
|
|
12
|
+
* 7. Calculate cost
|
|
13
|
+
* 8. Return result
|
|
14
|
+
*/
|
|
15
|
+
import type { Mode, TraceEvent } from '../types/index.js';
|
|
16
|
+
export interface AgentRunResult {
|
|
17
|
+
success: boolean;
|
|
18
|
+
changes: string[];
|
|
19
|
+
trace: TraceEvent;
|
|
20
|
+
cost: number;
|
|
21
|
+
}
|
|
22
|
+
export interface AgentExecuteOptions {
|
|
23
|
+
dryRun?: boolean;
|
|
24
|
+
maxRetries?: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Execute agent work on a single file
|
|
28
|
+
* Main entry point for agent execution
|
|
29
|
+
*/
|
|
30
|
+
export declare function executeAgent(file: string, mode: Mode, options?: AgentExecuteOptions): Promise<AgentRunResult>;
|
|
31
|
+
//# sourceMappingURL=agent-executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-executor.d.ts","sourceRoot":"","sources":["../../src/core/agent-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAUH,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAyB,MAAM,mBAAmB,CAAC;AAIjF,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAOD;;;GAGG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,IAAI,EACV,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,cAAc,CAAC,CAuKzB"}
|