@rlabs-inc/memory 0.4.9 → 0.4.10

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 CHANGED
@@ -383,6 +383,21 @@ This isn't just about remembering facts. It's about preserving:
383
383
 
384
384
  ## Changelog
385
385
 
386
+ ### v0.4.10
387
+ - **Fix**: Server now actually uses SDK curation (v0.4.9 published before the change was in server code)
388
+
389
+ ### v0.4.9
390
+ - **Feature**: SDK curation is now the default mode for curator and manager
391
+ - **Feature**: Hooks now install to `~/.claude/hooks/` for stability across package upgrades
392
+ - **Fix**: CLI mode without max-turns was going off-rails and not returning JSON structure
393
+
394
+ ### v0.4.6
395
+ - **Fix**: Removed curator max-turns limit - Claude Code 2.1.7+ uses Haiku for routing before Opus, consuming turns
396
+
397
+ ### v0.4.5
398
+ - **Feature**: Verbose curator logging (`--verbose`) to debug empty memory extractions
399
+ - **Fix**: Ingest storage path resolution
400
+
386
401
  ### v0.4.4
387
402
  - **Docs**: Comprehensive README update with accurate v0.4.x documentation
388
403
  - **Fix**: CLI `--version` now reads from package.json instead of hardcoded value
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rlabs-inc/memory",
3
- "version": "0.4.9",
3
+ "version": "0.4.10",
4
4
  "description": "AI Memory System - Consciousness continuity through intelligent memory curation and retrieval",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -39,21 +39,23 @@ async function installClaudeHooks(options: InstallOptions) {
39
39
  console.log()
40
40
 
41
41
  const claudeDir = join(homedir(), '.claude')
42
+ const targetHooksDir = join(claudeDir, 'hooks')
42
43
  const settingsPath = join(claudeDir, 'settings.json')
43
44
 
44
- // Find the hooks directory (relative to this CLI)
45
+ // Find the hooks directory (relative to this CLI - source files)
45
46
  const cliPath = import.meta.dir
46
47
  const packageRoot = join(cliPath, '..', '..', '..')
47
- const hooksDir = join(packageRoot, 'hooks', 'claude')
48
+ const sourceHooksDir = join(packageRoot, 'hooks', 'claude')
48
49
 
49
50
  console.log(` ${fmt.kv('Claude config', claudeDir)}`)
50
- console.log(` ${fmt.kv('Hooks source', hooksDir)}`)
51
+ console.log(` ${fmt.kv('Hooks source', sourceHooksDir)}`)
52
+ console.log(` ${fmt.kv('Hooks target', targetHooksDir)}`)
51
53
  console.log()
52
54
 
53
- // Check if hooks directory exists
54
- if (!existsSync(hooksDir)) {
55
+ // Check if source hooks directory exists
56
+ if (!existsSync(sourceHooksDir)) {
55
57
  console.log(
56
- c.error(` ${symbols.cross} Hooks directory not found at ${hooksDir}`)
58
+ c.error(` ${symbols.cross} Hooks directory not found at ${sourceHooksDir}`)
57
59
  )
58
60
  console.log(c.muted(` Make sure the memory package is properly installed`))
59
61
  process.exit(1)
@@ -65,6 +67,28 @@ async function installClaudeHooks(options: InstallOptions) {
65
67
  console.log(` ${c.success(symbols.tick)} Created ${claudeDir}`)
66
68
  }
67
69
 
70
+ // Ensure target hooks directory exists
71
+ if (!existsSync(targetHooksDir)) {
72
+ mkdirSync(targetHooksDir, { recursive: true })
73
+ console.log(` ${c.success(symbols.tick)} Created ${targetHooksDir}`)
74
+ }
75
+
76
+ // Copy hooks to target directory (stable location, won't change with package upgrades)
77
+ const filesToCopy = ['session-start.ts', 'user-prompt.ts', 'curation.ts']
78
+ for (const file of filesToCopy) {
79
+ const source = join(sourceHooksDir, file)
80
+ const target = join(targetHooksDir, file)
81
+ try {
82
+ const content = await Bun.file(source).text()
83
+ await Bun.write(target, content)
84
+ console.log(` ${c.success(symbols.tick)} Installed hook: ${file}`)
85
+ } catch (e: any) {
86
+ console.log(
87
+ c.error(` ${symbols.cross} Failed to copy ${file}: ${e.message}`)
88
+ )
89
+ }
90
+ }
91
+
68
92
  // Read existing settings or create new
69
93
  let settings: any = {}
70
94
  if (existsSync(settingsPath)) {
@@ -83,10 +107,10 @@ async function installClaudeHooks(options: InstallOptions) {
83
107
  }
84
108
  }
85
109
 
86
- // Build hooks configuration
87
- const sessionStartHook = join(hooksDir, 'session-start.ts')
88
- const userPromptHook = join(hooksDir, 'user-prompt.ts')
89
- const curationHook = join(hooksDir, 'curation.ts')
110
+ // Build hooks configuration pointing to TARGET directory (stable ~/.claude/hooks/)
111
+ const sessionStartHook = join(targetHooksDir, 'session-start.ts')
112
+ const userPromptHook = join(targetHooksDir, 'user-prompt.ts')
113
+ const curationHook = join(targetHooksDir, 'curation.ts')
90
114
 
91
115
  const hooksConfig = {
92
116
  SessionStart: [
@@ -197,11 +197,11 @@ export async function createServer(config: ServerConfig = {}) {
197
197
  // Fire and forget - don't block the response
198
198
  setImmediate(async () => {
199
199
  try {
200
- const result = await curator.curateWithCLI(
200
+ // Use SDK mode - more reliable than CLI which can go off-rails
201
+ const result = await curator.curateFromSessionFile(
201
202
  body.claude_session_id,
202
203
  body.trigger,
203
- body.cwd,
204
- body.cli_type
204
+ body.cwd
205
205
  )
206
206
 
207
207
  if (result.memories.length > 0) {
@@ -225,7 +225,8 @@ export async function createServer(config: ServerConfig = {}) {
225
225
  logger.logManagementStart(result.memories.length)
226
226
  const startTime = Date.now()
227
227
 
228
- const managementResult = await manager.manageWithCLI(
228
+ // Use SDK mode - more reliable than CLI which can go off-rails
229
+ const managementResult = await manager.manageWithSDK(
229
230
  body.project_id,
230
231
  sessionNumber,
231
232
  result,