ruvector 0.1.36 → 0.1.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -0
- package/bin/ruvector.js +10 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -277,6 +277,86 @@ npx ruvector export my-index backup.bin
|
|
|
277
277
|
npx ruvector import backup.bin restored-index
|
|
278
278
|
```
|
|
279
279
|
|
|
280
|
+
## Self-Learning Hooks (Claude Code Integration)
|
|
281
|
+
|
|
282
|
+
RuVector includes a self-learning intelligence layer that improves AI agent decisions over time. These hooks integrate with Claude Code and other AI development tools.
|
|
283
|
+
|
|
284
|
+
### Setup
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
# Initialize hooks in your project
|
|
288
|
+
npx ruvector hooks init
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### Hook Commands
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
# Session Management
|
|
295
|
+
ruvector hooks session-start # Start session tracking
|
|
296
|
+
ruvector hooks session-end # End session with export
|
|
297
|
+
|
|
298
|
+
# Pre/Post Edit Hooks
|
|
299
|
+
ruvector hooks pre-edit <file> # Get agent suggestions before editing
|
|
300
|
+
ruvector hooks post-edit <file> --success # Record edit outcomes
|
|
301
|
+
|
|
302
|
+
# Pre/Post Command Hooks
|
|
303
|
+
ruvector hooks pre-command "cargo test" # Analyze command before running
|
|
304
|
+
ruvector hooks post-command "cargo test" --success # Record command outcomes
|
|
305
|
+
|
|
306
|
+
# Intelligence
|
|
307
|
+
ruvector hooks stats # Show learning statistics
|
|
308
|
+
ruvector hooks route <task> # Get agent routing suggestion
|
|
309
|
+
ruvector hooks suggest-context # Get context suggestions
|
|
310
|
+
|
|
311
|
+
# Memory
|
|
312
|
+
ruvector hooks remember <content> -t <type> # Store in vector memory
|
|
313
|
+
ruvector hooks recall <query> # Semantic search memory
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### How It Works
|
|
317
|
+
|
|
318
|
+
The intelligence system uses:
|
|
319
|
+
- **Q-Learning**: Learns optimal agent routing from past successes/failures
|
|
320
|
+
- **Vector Memory**: Semantic storage with cosine similarity search
|
|
321
|
+
- **File Sequences**: Predicts related files based on edit patterns
|
|
322
|
+
- **Error Patterns**: Remembers fixes for common errors
|
|
323
|
+
|
|
324
|
+
### Example Output
|
|
325
|
+
|
|
326
|
+
```
|
|
327
|
+
🧠 Intelligence Analysis:
|
|
328
|
+
📁 ruvector-core/lib.rs
|
|
329
|
+
🤖 Recommended: rust-developer (80% confidence)
|
|
330
|
+
→ learned from past success
|
|
331
|
+
📚 Similar: 3 past edits
|
|
332
|
+
📎 Related: mod.rs, tests.rs
|
|
333
|
+
💬 ⚡ Core lib: run cargo test --lib after changes
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### Claude Code Integration
|
|
337
|
+
|
|
338
|
+
Add to your `.claude/settings.json`:
|
|
339
|
+
|
|
340
|
+
```json
|
|
341
|
+
{
|
|
342
|
+
"hooks": {
|
|
343
|
+
"PreToolUse": [{ "command": "ruvector hooks pre-edit $file" }],
|
|
344
|
+
"PostToolUse": [{ "command": "ruvector hooks post-edit $file --success" }],
|
|
345
|
+
"SessionStart": [{ "command": "ruvector hooks session-start" }],
|
|
346
|
+
"Stop": [{ "command": "ruvector hooks session-end" }]
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### Learning Data
|
|
352
|
+
|
|
353
|
+
| Storage | Contents |
|
|
354
|
+
|---------|----------|
|
|
355
|
+
| `.ruvector/intelligence.json` | Q-table, memories, trajectories |
|
|
356
|
+
| Patterns | State-action values for agent routing |
|
|
357
|
+
| Memories | Vector embeddings for semantic recall |
|
|
358
|
+
| Trajectories | Learning history for continuous improvement |
|
|
359
|
+
|
|
280
360
|
## Integrations
|
|
281
361
|
|
|
282
362
|
### LangChain
|
package/bin/ruvector.js
CHANGED
|
@@ -820,8 +820,9 @@ class Intelligence {
|
|
|
820
820
|
|
|
821
821
|
load() {
|
|
822
822
|
try {
|
|
823
|
-
|
|
824
|
-
|
|
823
|
+
const fss = require('fs');
|
|
824
|
+
if (fss.existsSync(INTEL_PATH)) {
|
|
825
|
+
return JSON.parse(fss.readFileSync(INTEL_PATH, 'utf-8'));
|
|
825
826
|
}
|
|
826
827
|
} catch {}
|
|
827
828
|
return {
|
|
@@ -837,9 +838,10 @@ class Intelligence {
|
|
|
837
838
|
}
|
|
838
839
|
|
|
839
840
|
save() {
|
|
841
|
+
const fss = require('fs');
|
|
840
842
|
const dir = path.dirname(INTEL_PATH);
|
|
841
|
-
if (!
|
|
842
|
-
|
|
843
|
+
if (!fss.existsSync(dir)) fss.mkdirSync(dir, { recursive: true });
|
|
844
|
+
fss.writeFileSync(INTEL_PATH, JSON.stringify(this.data, null, 2));
|
|
843
845
|
}
|
|
844
846
|
|
|
845
847
|
now() { return Math.floor(Date.now() / 1000); }
|
|
@@ -996,17 +998,18 @@ class Intelligence {
|
|
|
996
998
|
const hooksCmd = program.command('hooks').description('Self-learning intelligence hooks for Claude Code');
|
|
997
999
|
|
|
998
1000
|
hooksCmd.command('init').description('Initialize hooks in current project').option('--force', 'Force overwrite').action((opts) => {
|
|
1001
|
+
const fss = require('fs');
|
|
999
1002
|
const settingsPath = path.join(process.cwd(), '.claude', 'settings.json');
|
|
1000
1003
|
const settingsDir = path.dirname(settingsPath);
|
|
1001
|
-
if (!
|
|
1004
|
+
if (!fss.existsSync(settingsDir)) fss.mkdirSync(settingsDir, { recursive: true });
|
|
1002
1005
|
let settings = {};
|
|
1003
|
-
if (
|
|
1006
|
+
if (fss.existsSync(settingsPath)) try { settings = JSON.parse(fss.readFileSync(settingsPath, 'utf-8')); } catch {}
|
|
1004
1007
|
settings.hooks = settings.hooks || {};
|
|
1005
1008
|
settings.hooks.PreToolUse = [{ matcher: 'Edit|Write|MultiEdit', hooks: ['ruvector hooks pre-edit "$TOOL_INPUT_file_path"'] }, { matcher: 'Bash', hooks: ['ruvector hooks pre-command "$TOOL_INPUT_command"'] }];
|
|
1006
1009
|
settings.hooks.PostToolUse = [{ matcher: 'Edit|Write|MultiEdit', hooks: ['ruvector hooks post-edit "$TOOL_INPUT_file_path"'] }, { matcher: 'Bash', hooks: ['ruvector hooks post-command "$TOOL_INPUT_command"'] }];
|
|
1007
1010
|
settings.hooks.SessionStart = ['ruvector hooks session-start'];
|
|
1008
1011
|
settings.hooks.Stop = ['ruvector hooks session-end'];
|
|
1009
|
-
|
|
1012
|
+
fss.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
|
|
1010
1013
|
console.log(chalk.green('✅ Hooks initialized in .claude/settings.json'));
|
|
1011
1014
|
});
|
|
1012
1015
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ruvector",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.38",
|
|
4
4
|
"description": "High-performance vector database with Graph Neural Networks, Cypher queries, and AI agent routing. Build RAG apps, semantic search, recommendations, and agentic AI systems. Pinecone + Neo4j + PyTorch alternative.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|