ruvector 0.1.49 → 0.1.50

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.
Files changed (3) hide show
  1. package/HOOKS.md +221 -0
  2. package/README.md +20 -0
  3. package/package.json +1 -1
package/HOOKS.md ADDED
@@ -0,0 +1,221 @@
1
+ # RuVector Hooks for Claude Code
2
+
3
+ Self-learning intelligence hooks that enhance Claude Code with Q-learning, vector memory, and automatic agent routing.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ # Full setup: hooks + pretrain + optimized agents
9
+ npx ruvector hooks init --pretrain --build-agents quality
10
+
11
+ # Or step by step:
12
+ npx ruvector hooks init # Setup hooks
13
+ npx ruvector hooks pretrain # Analyze repository
14
+ npx ruvector hooks build-agents # Generate agent configs
15
+ ```
16
+
17
+ ## What It Does
18
+
19
+ RuVector hooks integrate with Claude Code to provide:
20
+
21
+ | Feature | Description |
22
+ |---------|-------------|
23
+ | **Agent Routing** | Suggests the best agent for each file type based on learned patterns |
24
+ | **Co-edit Patterns** | Predicts "likely next files" from git history |
25
+ | **Vector Memory** | Semantic recall of project context |
26
+ | **Command Analysis** | Risk assessment for bash commands |
27
+ | **Self-Learning** | Q-learning improves suggestions over time |
28
+
29
+ ## Commands
30
+
31
+ ### Initialization
32
+
33
+ ```bash
34
+ # Full configuration
35
+ npx ruvector hooks init
36
+
37
+ # With pretrain and agent building
38
+ npx ruvector hooks init --pretrain --build-agents security
39
+
40
+ # Minimal (basic hooks only)
41
+ npx ruvector hooks init --minimal
42
+
43
+ # Options
44
+ --force # Overwrite existing settings
45
+ --minimal # Basic hooks only
46
+ --pretrain # Run pretrain after init
47
+ --build-agents # Generate optimized agents (quality|speed|security|testing|fullstack)
48
+ --no-claude-md # Skip CLAUDE.md creation
49
+ --no-permissions # Skip permissions config
50
+ --no-env # Skip environment variables
51
+ --no-gitignore # Skip .gitignore update
52
+ --no-mcp # Skip MCP server config
53
+ --no-statusline # Skip status line config
54
+ ```
55
+
56
+ ### Pretrain
57
+
58
+ Analyze your repository to bootstrap intelligence:
59
+
60
+ ```bash
61
+ npx ruvector hooks pretrain
62
+
63
+ # Options
64
+ --depth <n> # Git history depth (default: 100)
65
+ --verbose # Show detailed progress
66
+ --skip-git # Skip git history analysis
67
+ --skip-files # Skip file structure analysis
68
+ ```
69
+
70
+ **What it learns:**
71
+ - File type → Agent mapping (`.rs` → rust-developer)
72
+ - Co-edit patterns from git history
73
+ - Directory → Agent mapping
74
+ - Project context memories
75
+
76
+ ### Build Agents
77
+
78
+ Generate optimized `.claude/agents/` configurations:
79
+
80
+ ```bash
81
+ npx ruvector hooks build-agents --focus quality
82
+
83
+ # Focus modes
84
+ --focus quality # Code quality, best practices (default)
85
+ --focus speed # Rapid development, prototyping
86
+ --focus security # OWASP, input validation, encryption
87
+ --focus testing # TDD, comprehensive coverage
88
+ --focus fullstack # Balanced frontend/backend/database
89
+
90
+ # Options
91
+ --output <dir> # Output directory (default: .claude/agents)
92
+ --format <fmt> # yaml, json, or md (default: yaml)
93
+ --include-prompts # Include system prompts in agent configs
94
+ ```
95
+
96
+ ### Verification & Diagnostics
97
+
98
+ ```bash
99
+ # Check if hooks are working
100
+ npx ruvector hooks verify
101
+
102
+ # Diagnose and fix issues
103
+ npx ruvector hooks doctor
104
+ npx ruvector hooks doctor --fix
105
+ ```
106
+
107
+ ### Data Management
108
+
109
+ ```bash
110
+ # View statistics
111
+ npx ruvector hooks stats
112
+
113
+ # Export intelligence data
114
+ npx ruvector hooks export -o backup.json
115
+ npx ruvector hooks export --include-all
116
+
117
+ # Import intelligence data
118
+ npx ruvector hooks import backup.json
119
+ npx ruvector hooks import backup.json --merge
120
+ ```
121
+
122
+ ### Memory Operations
123
+
124
+ ```bash
125
+ # Store context in vector memory
126
+ npx ruvector hooks remember "API uses JWT auth" -t project
127
+
128
+ # Semantic search memory
129
+ npx ruvector hooks recall "authentication"
130
+
131
+ # Route a task to best agent
132
+ npx ruvector hooks route "implement user login"
133
+ ```
134
+
135
+ ## Hook Events
136
+
137
+ | Event | Trigger | RuVector Action |
138
+ |-------|---------|-----------------|
139
+ | **PreToolUse** | Before Edit/Write/Bash | Agent routing, file analysis, command risk |
140
+ | **PostToolUse** | After Edit/Write/Bash | Q-learning update, pattern recording |
141
+ | **SessionStart** | Conversation begins | Load intelligence, display stats |
142
+ | **Stop** | Conversation ends | Save learning data |
143
+ | **UserPromptSubmit** | User sends message | Context suggestions |
144
+ | **PreCompact** | Before context compaction | Preserve important context |
145
+ | **Notification** | Any notification | Track events for learning |
146
+
147
+ ## Generated Files
148
+
149
+ After running `hooks init`:
150
+
151
+ ```
152
+ your-project/
153
+ ├── .claude/
154
+ │ ├── settings.json # Hooks configuration
155
+ │ ├── statusline.sh # Status bar script
156
+ │ └── agents/ # Generated agents (with --build-agents)
157
+ │ ├── rust-specialist.yaml
158
+ │ ├── typescript-specialist.yaml
159
+ │ ├── test-architect.yaml
160
+ │ └── project-coordinator.yaml
161
+ ├── .ruvector/
162
+ │ └── intelligence.json # Learning data
163
+ ├── CLAUDE.md # Project documentation
164
+ └── .gitignore # Updated with .ruvector/
165
+ ```
166
+
167
+ ## Environment Variables
168
+
169
+ | Variable | Default | Description |
170
+ |----------|---------|-------------|
171
+ | `RUVECTOR_INTELLIGENCE_ENABLED` | `true` | Enable/disable intelligence |
172
+ | `RUVECTOR_LEARNING_RATE` | `0.1` | Q-learning rate (0.0-1.0) |
173
+ | `RUVECTOR_MEMORY_BACKEND` | `rvlite` | Memory storage backend |
174
+ | `INTELLIGENCE_MODE` | `treatment` | A/B testing mode |
175
+
176
+ ## Example Output
177
+
178
+ ### Agent Routing
179
+ ```
180
+ 🧠 Intelligence Analysis:
181
+ 📁 src/api/routes.ts
182
+ 🤖 Recommended: typescript-developer (85% confidence)
183
+ → learned from 127 .ts files in repo
184
+ 📎 Likely next files:
185
+ - src/api/handlers.ts (12 co-edits)
186
+ - src/types/api.ts (8 co-edits)
187
+ ```
188
+
189
+ ### Command Analysis
190
+ ```
191
+ 🧠 Command Analysis:
192
+ 📦 Category: rust
193
+ 🏷️ Type: test
194
+ ✅ Risk: LOW
195
+ ```
196
+
197
+ ## Best Practices
198
+
199
+ 1. **Run pretrain on existing repos** — Bootstrap intelligence before starting work
200
+ 2. **Use focus modes** — Match agent generation to your current task
201
+ 3. **Export before major changes** — Backup learning data
202
+ 4. **Let it learn** — Intelligence improves with each edit
203
+
204
+ ## Troubleshooting
205
+
206
+ ```bash
207
+ # Check setup
208
+ npx ruvector hooks verify
209
+
210
+ # Fix common issues
211
+ npx ruvector hooks doctor --fix
212
+
213
+ # Reset and reinitialize
214
+ npx ruvector hooks init --force --pretrain
215
+ ```
216
+
217
+ ## Links
218
+
219
+ - [RuVector GitHub](https://github.com/ruvnet/ruvector)
220
+ - [npm Package](https://www.npmjs.com/package/ruvector)
221
+ - [Claude Code Documentation](https://docs.anthropic.com/claude-code)
package/README.md CHANGED
@@ -20,6 +20,26 @@ Built by [rUv](https://ruv.io) with production-grade Rust performance and intell
20
20
 
21
21
  ---
22
22
 
23
+ ## 🧠 Claude Code Hooks (NEW)
24
+
25
+ **Self-learning intelligence for Claude Code** — RuVector provides optimized hooks that learn from your development patterns.
26
+
27
+ ```bash
28
+ # One-command setup with pretrain and agent generation
29
+ npx ruvector hooks init --pretrain --build-agents quality
30
+ ```
31
+
32
+ **Features:**
33
+ - 🎯 **Smart Agent Routing** — Automatically suggests the best agent for each file type
34
+ - 📚 **Repository Pretrain** — Analyzes your codebase to bootstrap intelligence
35
+ - 🤖 **Agent Builder** — Generates optimized `.claude/agents/` configs for your stack
36
+ - 🔗 **Co-edit Patterns** — Learns which files are edited together from git history
37
+ - 💾 **Vector Memory** — Semantic recall of project context
38
+
39
+ 📖 **[Full Hooks Documentation →](https://github.com/ruvnet/ruvector/blob/main/npm/packages/ruvector/HOOKS.md)**
40
+
41
+ ---
42
+
23
43
  ## 🌟 Why Ruvector?
24
44
 
25
45
  ### The Problem with Existing Vector Databases
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ruvector",
3
- "version": "0.1.49",
3
+ "version": "0.1.50",
4
4
  "description": "High-performance vector database for Node.js with automatic native/WASM fallback",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",