claude-recall 0.7.5 ā 0.7.6
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 +52 -2
- package/dist/cli/commands/migrate.js +72 -0
- package/dist/memory/storage.js +34 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -136,6 +136,51 @@ npm install -g claude-recall@latest
|
|
|
136
136
|
|
|
137
137
|
**Note:** MCP server configuration in `~/.claude.json` persists across updates. You only need to update the package.
|
|
138
138
|
|
|
139
|
+
### Schema Migration (v0.7.6+)
|
|
140
|
+
|
|
141
|
+
**Automatic Migration:**
|
|
142
|
+
|
|
143
|
+
Starting with v0.7.6, Claude Recall automatically migrates your database schema when needed. The first time you run any command after upgrading, missing columns will be added automatically.
|
|
144
|
+
|
|
145
|
+
**What Gets Migrated:**
|
|
146
|
+
- `sophistication_level` column (added in v0.7.0)
|
|
147
|
+
- `scope` column (added in v0.7.2)
|
|
148
|
+
|
|
149
|
+
You'll see console messages like:
|
|
150
|
+
```
|
|
151
|
+
š Migrating database schema: Adding scope column...
|
|
152
|
+
ā
Added scope column
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Manual Migration (Optional):**
|
|
156
|
+
|
|
157
|
+
If you prefer to run the migration explicitly:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
# Check current schema and migrate if needed
|
|
161
|
+
npx claude-recall migrate schema
|
|
162
|
+
|
|
163
|
+
# Create backup before migration
|
|
164
|
+
npx claude-recall migrate schema --backup
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Troubleshooting Schema Errors:**
|
|
168
|
+
|
|
169
|
+
If you see errors like:
|
|
170
|
+
- `"no such column: scope"`
|
|
171
|
+
- `"no such column: sophistication_level"`
|
|
172
|
+
|
|
173
|
+
Run the manual migration:
|
|
174
|
+
```bash
|
|
175
|
+
npx claude-recall migrate schema --backup
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
This will:
|
|
179
|
+
1. Create a backup of your database (if `--backup` flag used)
|
|
180
|
+
2. Add any missing columns
|
|
181
|
+
3. Create necessary indexes
|
|
182
|
+
4. Verify the migration succeeded
|
|
183
|
+
|
|
139
184
|
## Verifying Claude Recall is Working
|
|
140
185
|
|
|
141
186
|
To confirm claude-recall is active in your Claude Code session:
|
|
@@ -529,9 +574,14 @@ npx claude-recall monitor # View search monitoring stats
|
|
|
529
574
|
npx claude-recall test-memory-search # Test if Claude searches before file creation
|
|
530
575
|
```
|
|
531
576
|
|
|
532
|
-
**Migration
|
|
577
|
+
**Migration:**
|
|
533
578
|
```bash
|
|
534
|
-
|
|
579
|
+
# Database schema migration (v0.7.6+)
|
|
580
|
+
npx claude-recall migrate schema # Migrate database schema (automatic)
|
|
581
|
+
npx claude-recall migrate schema --backup # Create backup before migration
|
|
582
|
+
|
|
583
|
+
# Architecture migration (file-watcher ā MCP)
|
|
584
|
+
npx claude-recall migrate # Migrate from file-watcher to MCP architecture
|
|
535
585
|
```
|
|
536
586
|
|
|
537
587
|
### Global Options
|
|
@@ -73,6 +73,14 @@ class MigrateCommand {
|
|
|
73
73
|
const migrator = new MigrateCommand();
|
|
74
74
|
await migrator.completeMigration();
|
|
75
75
|
});
|
|
76
|
+
migrateCmd
|
|
77
|
+
.command('schema')
|
|
78
|
+
.description('Migrate database schema to latest version (adds missing columns)')
|
|
79
|
+
.option('--backup', 'Create backup before migration')
|
|
80
|
+
.action(async (options) => {
|
|
81
|
+
const migrator = new MigrateCommand();
|
|
82
|
+
await migrator.migrateSchema(options.backup);
|
|
83
|
+
});
|
|
76
84
|
}
|
|
77
85
|
async checkInstallation() {
|
|
78
86
|
console.log('š Checking for existing Claude Recall installation...\n');
|
|
@@ -241,5 +249,69 @@ class MigrateCommand {
|
|
|
241
249
|
}
|
|
242
250
|
return false;
|
|
243
251
|
}
|
|
252
|
+
async migrateSchema(createBackup = false) {
|
|
253
|
+
console.log('š Migrating database schema...\n');
|
|
254
|
+
try {
|
|
255
|
+
const dbPath = path.join(os.homedir(), '.claude-recall', 'claude-recall.db');
|
|
256
|
+
if (!fs.existsSync(dbPath)) {
|
|
257
|
+
console.log('ā Database not found. Nothing to migrate.');
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
// Create backup if requested
|
|
261
|
+
if (createBackup) {
|
|
262
|
+
const backupPath = `${dbPath}.backup.${Date.now()}`;
|
|
263
|
+
console.log(`š¦ Creating backup: ${backupPath}`);
|
|
264
|
+
fs.copyFileSync(dbPath, backupPath);
|
|
265
|
+
console.log('ā
Backup created\n');
|
|
266
|
+
}
|
|
267
|
+
// Access storage to trigger migration
|
|
268
|
+
const { MemoryStorage } = require('../../memory/storage');
|
|
269
|
+
const storage = new MemoryStorage(dbPath);
|
|
270
|
+
// Check what columns exist
|
|
271
|
+
const db = storage.getDatabase();
|
|
272
|
+
const columns = db.prepare("PRAGMA table_info(memories)").all();
|
|
273
|
+
const columnNames = columns.map((c) => c.name);
|
|
274
|
+
console.log('Current schema columns:');
|
|
275
|
+
console.log(' ' + columnNames.join(', '));
|
|
276
|
+
const hasSophistication = columnNames.includes('sophistication_level');
|
|
277
|
+
const hasScope = columnNames.includes('scope');
|
|
278
|
+
if (hasSophistication && hasScope) {
|
|
279
|
+
console.log('\nā
Schema is already up to date!');
|
|
280
|
+
console.log(' All required columns are present.');
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
console.log('\nš Schema update needed:');
|
|
284
|
+
if (!hasSophistication) {
|
|
285
|
+
console.log(' - Missing: sophistication_level (added in v0.7.0)');
|
|
286
|
+
}
|
|
287
|
+
if (!hasScope) {
|
|
288
|
+
console.log(' - Missing: scope (added in v0.7.2)');
|
|
289
|
+
}
|
|
290
|
+
console.log('\nāļø Running migration...');
|
|
291
|
+
// The migration happens automatically when MemoryStorage initializes
|
|
292
|
+
// Just force a re-init by creating a new instance
|
|
293
|
+
const { MemoryStorage: Storage2 } = require('../../memory/storage');
|
|
294
|
+
new Storage2(dbPath);
|
|
295
|
+
console.log('\nā
Migration complete!');
|
|
296
|
+
console.log(' Database schema is now up to date.');
|
|
297
|
+
}
|
|
298
|
+
// Display stats
|
|
299
|
+
console.log('\nš Database stats:');
|
|
300
|
+
const stats = storage.getStats();
|
|
301
|
+
console.log(` Total memories: ${stats.total}`);
|
|
302
|
+
if (stats.byType) {
|
|
303
|
+
console.log(' By type:');
|
|
304
|
+
for (const [type, count] of Object.entries(stats.byType)) {
|
|
305
|
+
console.log(` ${type}: ${count}`);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
catch (error) {
|
|
310
|
+
console.error('\nā Migration failed:', error);
|
|
311
|
+
console.log('\nIf you created a backup, you can restore it manually:');
|
|
312
|
+
console.log(` cp ~/.claude-recall/claude-recall.db.backup.* ~/.claude-recall/claude-recall.db`);
|
|
313
|
+
process.exit(1);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
244
316
|
}
|
|
245
317
|
exports.MigrateCommand = MigrateCommand;
|
package/dist/memory/storage.js
CHANGED
|
@@ -54,7 +54,8 @@ class MemoryStorage {
|
|
|
54
54
|
try {
|
|
55
55
|
const tableExists = this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='memories'").get();
|
|
56
56
|
if (tableExists) {
|
|
57
|
-
// Database is already initialized,
|
|
57
|
+
// Database is already initialized, run schema migration if needed
|
|
58
|
+
this.migrateSchema();
|
|
58
59
|
return;
|
|
59
60
|
}
|
|
60
61
|
}
|
|
@@ -78,6 +79,35 @@ class MemoryStorage {
|
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Migrate existing database schema to add missing columns
|
|
84
|
+
* Adds columns introduced in v0.7.0+ (sophistication_level, scope)
|
|
85
|
+
*/
|
|
86
|
+
migrateSchema() {
|
|
87
|
+
try {
|
|
88
|
+
// Get existing columns
|
|
89
|
+
const columns = this.db.prepare("PRAGMA table_info(memories)").all();
|
|
90
|
+
const columnNames = columns.map(c => c.name);
|
|
91
|
+
// Add sophistication_level if missing (v0.7.0+)
|
|
92
|
+
if (!columnNames.includes('sophistication_level')) {
|
|
93
|
+
console.log('š Migrating database schema: Adding sophistication_level column...');
|
|
94
|
+
this.db.exec('ALTER TABLE memories ADD COLUMN sophistication_level INTEGER DEFAULT 1');
|
|
95
|
+
this.db.exec('CREATE INDEX IF NOT EXISTS idx_memories_sophistication ON memories(sophistication_level)');
|
|
96
|
+
console.log('ā
Added sophistication_level column');
|
|
97
|
+
}
|
|
98
|
+
// Add scope if missing (v0.7.2+)
|
|
99
|
+
if (!columnNames.includes('scope')) {
|
|
100
|
+
console.log('š Migrating database schema: Adding scope column...');
|
|
101
|
+
this.db.exec("ALTER TABLE memories ADD COLUMN scope TEXT CHECK(scope IN ('universal', 'project', NULL))");
|
|
102
|
+
this.db.exec('CREATE INDEX IF NOT EXISTS idx_memories_scope_project ON memories(scope, project_id)');
|
|
103
|
+
console.log('ā
Added scope column');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
console.error('ā ļø Schema migration error:', error);
|
|
108
|
+
// Don't throw - let the database continue with existing schema
|
|
109
|
+
}
|
|
110
|
+
}
|
|
81
111
|
save(memory) {
|
|
82
112
|
const stmt = this.db.prepare(`
|
|
83
113
|
INSERT OR REPLACE INTO memories
|
|
@@ -126,7 +156,9 @@ class MemoryStorage {
|
|
|
126
156
|
is_active: row.is_active === 1,
|
|
127
157
|
superseded_by: row.superseded_by,
|
|
128
158
|
superseded_at: row.superseded_at,
|
|
129
|
-
confidence_score: row.confidence_score
|
|
159
|
+
confidence_score: row.confidence_score,
|
|
160
|
+
sophistication_level: row.sophistication_level || 1,
|
|
161
|
+
scope: row.scope || null
|
|
130
162
|
};
|
|
131
163
|
}
|
|
132
164
|
searchByContext(context) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-recall",
|
|
3
|
-
"version": "0.7.
|
|
4
|
-
"description": "Persistent memory for Claude Code with automatic capture, failure learning, sophistication tracking, project scoping,
|
|
3
|
+
"version": "0.7.6",
|
|
4
|
+
"description": "Persistent memory for Claude Code with automatic capture, failure learning, sophistication tracking, project scoping, project registry, and automatic schema migration via MCP server",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"claude-recall": "dist/cli/claude-recall-cli.js"
|