get-claudia 1.28.3 → 1.28.4

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/bin/index.js CHANGED
@@ -415,7 +415,7 @@ async function main() {
415
415
 
416
416
  mcpConfig.mcpServers['claudia-memory'] = {
417
417
  command: pythonCmd,
418
- args: ['-m', 'claudia_memory.mcp.server'],
418
+ args: ['-m', 'claudia_memory', '--project-dir', '${workspaceFolder}'],
419
419
  _description: 'Claudia memory system with vector search'
420
420
  };
421
421
  writeFileSync(mcpPath, JSON.stringify(mcpConfig, null, 2));
@@ -13,6 +13,7 @@ import json
13
13
  import logging
14
14
  import os
15
15
  import sqlite3
16
+ import sys
16
17
  import threading
17
18
  from contextlib import contextmanager
18
19
  from datetime import datetime
@@ -62,18 +63,34 @@ class Database:
62
63
  except ImportError:
63
64
  logger.debug("sqlite_vec package not installed")
64
65
  except Exception as e:
65
- logger.debug(f"sqlite_vec package failed: {e}")
66
+ logger.warning(f"sqlite_vec package installed but load() failed: {e}")
66
67
 
67
68
  # Method 2: Try native extension loading (for systems with pre-installed sqlite-vec)
68
69
  if not loaded:
69
70
  try:
70
71
  conn.enable_load_extension(True)
71
- sqlite_vec_paths = [
72
- "vec0", # If installed system-wide
73
- "/usr/local/lib/sqlite-vec/vec0",
74
- "/opt/homebrew/lib/sqlite-vec/vec0",
75
- str(Path.home() / ".local" / "lib" / "sqlite-vec" / "vec0"),
76
- ]
72
+ sqlite_vec_paths = ["vec0"] # System-wide
73
+
74
+ if sys.platform == "win32":
75
+ # Try to find vec0.dll in the sqlite-vec package directory
76
+ try:
77
+ import sqlite_vec as _sv
78
+ pkg_dir = Path(_sv.__file__).parent
79
+ for dll in pkg_dir.rglob("vec0*"):
80
+ if dll.suffix in (".dll", ".so"):
81
+ sqlite_vec_paths.append(str(dll.with_suffix("")))
82
+ except ImportError:
83
+ pass
84
+ sqlite_vec_paths.extend([
85
+ str(Path(sys.executable).parent / "DLLs" / "vec0"),
86
+ str(Path.home() / ".local" / "lib" / "sqlite-vec" / "vec0"),
87
+ ])
88
+ else:
89
+ sqlite_vec_paths.extend([
90
+ "/usr/local/lib/sqlite-vec/vec0",
91
+ "/opt/homebrew/lib/sqlite-vec/vec0",
92
+ str(Path.home() / ".local" / "lib" / "sqlite-vec" / "vec0"),
93
+ ])
77
94
 
78
95
  for path in sqlite_vec_paths:
79
96
  try:
@@ -92,10 +109,18 @@ class Database:
92
109
  logger.debug(f"Extension loading failed: {e}")
93
110
 
94
111
  if not loaded:
95
- logger.warning(
96
- "sqlite-vec not available. Vector search will be disabled. "
97
- "Install with: pip install sqlite-vec"
98
- )
112
+ if sys.platform == "win32":
113
+ logger.warning(
114
+ "sqlite-vec not available. Vector search will be disabled. "
115
+ "Install with: pip install sqlite-vec "
116
+ "If already installed but failing, ensure your Python and "
117
+ "sqlite-vec architectures match (both 64-bit or both 32-bit)."
118
+ )
119
+ else:
120
+ logger.warning(
121
+ "sqlite-vec not available. Vector search will be disabled. "
122
+ "Install with: pip install sqlite-vec"
123
+ )
99
124
 
100
125
  self._local.connection = conn
101
126
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "get-claudia",
3
- "version": "1.28.3",
3
+ "version": "1.28.4",
4
4
  "description": "An AI assistant who learns how you work.",
5
5
  "keywords": [
6
6
  "claudia",
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env python3
2
+ """Cross-platform pre-compact hook for Claudia.
3
+
4
+ Flushes WAL and injects context advisory before compaction.
5
+ """
6
+
7
+ import json
8
+ from urllib.request import urlopen
9
+ from urllib.error import URLError
10
+
11
+ # Signal daemon to flush WAL
12
+ try:
13
+ urlopen("http://localhost:3848/flush", timeout=3)
14
+ except (URLError, OSError, TimeoutError):
15
+ pass
16
+
17
+ print(json.dumps({
18
+ "additionalContext": (
19
+ "Context compaction advisory: If important information was discussed recently, "
20
+ "ensure it has been stored. Check: (1) Commitments: call memory.remember with "
21
+ "type='commitment' for any promises not yet stored. (2) People: call memory.entity "
22
+ "for anyone discussed in detail. (3) Relationships: call memory.relate for "
23
+ "connections mentioned. (4) Buffer: call memory.buffer_turn with a summary if "
24
+ "recent exchanges weren't buffered. With 1M context, compaction is less frequent, "
25
+ "but proactive capture remains good practice."
26
+ )
27
+ }))
@@ -0,0 +1,116 @@
1
+ #!/usr/bin/env python3
2
+ """Cross-platform session health check hook for Claudia.
3
+
4
+ Checks memory daemon health and provides actionable guidance when it's down.
5
+ Outputs JSON with additionalContext for Claude Code hooks.
6
+ """
7
+
8
+ import json
9
+ import os
10
+ import platform
11
+ import sys
12
+ from pathlib import Path
13
+ from urllib.request import urlopen
14
+ from urllib.error import URLError
15
+
16
+
17
+ def check_health():
18
+ context_parts = []
19
+
20
+ # Check health endpoint
21
+ try:
22
+ resp = urlopen("http://localhost:3848/health", timeout=5)
23
+ body = resp.read().decode()
24
+ if "healthy" in body:
25
+ print(json.dumps({"additionalContext": "Memory system healthy."}))
26
+ return
27
+ except (URLError, OSError, TimeoutError):
28
+ pass
29
+
30
+ context_parts.append(
31
+ "IMPORTANT: Memory daemon is NOT running. Without it, you lose semantic search, "
32
+ "pattern detection, cross-session learning, and proactive predictions. "
33
+ "You MUST surface this to the user and offer to help fix it."
34
+ )
35
+
36
+ # Check daemon installation status (platform-specific)
37
+ system = platform.system()
38
+ home = Path.home()
39
+
40
+ if system == "Darwin":
41
+ plist = home / "Library" / "LaunchAgents" / "com.claudia.memory.plist"
42
+ if plist.exists():
43
+ context_parts.append(
44
+ "Daemon is installed (LaunchAgent exists) but not running. "
45
+ "Suggest: 'Your memory daemon is installed but stopped. Want me to try starting it? "
46
+ "I can run: launchctl load ~/Library/LaunchAgents/com.claudia.memory.plist'"
47
+ )
48
+ else:
49
+ context_parts.append(
50
+ "Daemon is NOT installed. Suggest: 'The memory daemon hasn't been set up yet. "
51
+ "Want me to install it? I can run the installer for you.'"
52
+ )
53
+
54
+ elif system == "Linux":
55
+ service = home / ".config" / "systemd" / "user" / "claudia-memory.service"
56
+ if service.exists():
57
+ context_parts.append(
58
+ "Daemon is installed (systemd service exists) but not running. "
59
+ "Suggest: 'Your memory daemon is installed but stopped. Want me to try starting it? "
60
+ "I can run: systemctl --user start claudia-memory'"
61
+ )
62
+ else:
63
+ context_parts.append(
64
+ "Daemon is NOT installed. Suggest: 'The memory daemon hasn't been set up yet. "
65
+ "Want me to install it? I can run the installer for you.'"
66
+ )
67
+
68
+ elif system == "Windows":
69
+ # Check Task Scheduler for ClaudiaMemoryDaemon
70
+ task_status = None
71
+ try:
72
+ import subprocess
73
+ result = subprocess.run(
74
+ ["powershell", "-Command",
75
+ "(Get-ScheduledTask -TaskName 'ClaudiaMemoryDaemon' -ErrorAction SilentlyContinue).State"],
76
+ capture_output=True, text=True, timeout=5
77
+ )
78
+ task_status = result.stdout.strip()
79
+ except (FileNotFoundError, subprocess.TimeoutExpired, OSError):
80
+ pass
81
+
82
+ if task_status:
83
+ context_parts.append(
84
+ f"Daemon is installed (Task Scheduler, state: {task_status}). "
85
+ "Suggest: 'Your memory daemon is installed but not responding. "
86
+ "Want me to check the logs and try restarting it?'"
87
+ )
88
+ else:
89
+ context_parts.append(
90
+ "Daemon is NOT installed as a scheduled task. "
91
+ "Suggest: 'The memory daemon hasn't been set up yet. "
92
+ "Want me to install it? I can run the installer for you.'"
93
+ )
94
+
95
+ # Check for recent crash logs
96
+ log_path = home / ".claudia" / "daemon-stderr.log"
97
+ if log_path.exists():
98
+ try:
99
+ lines = log_path.read_text(encoding="utf-8", errors="replace").splitlines()
100
+ last_lines = lines[-5:-2] if len(lines) > 5 else lines[-3:]
101
+ if last_lines:
102
+ log_snippet = " ".join(line.strip() for line in last_lines)
103
+ context_parts.append(f"Recent daemon log: {log_snippet}")
104
+ except OSError:
105
+ pass
106
+
107
+ output = " ".join(context_parts)
108
+ print(json.dumps({"additionalContext": output}))
109
+
110
+
111
+ if __name__ == "__main__":
112
+ try:
113
+ check_health()
114
+ except Exception:
115
+ # Never let the hook crash Claude Code startup
116
+ print(json.dumps({"additionalContext": "Health check encountered an error."}))
@@ -3,9 +3,14 @@
3
3
  # Returns JSON with additionalContext to inform Claudia of memory system status
4
4
  # Provides actionable guidance when daemon is down
5
5
 
6
+ # Try curl first, fall back to PowerShell for Windows environments without curl
6
7
  if curl -s "http://localhost:3848/health" 2>/dev/null | grep -q "healthy"; then
7
8
  echo '{"additionalContext": "Memory system healthy."}'
8
9
  exit 0
10
+ elif command -v powershell.exe &>/dev/null && \
11
+ powershell.exe -Command "(Invoke-WebRequest -Uri 'http://localhost:3848/health' -UseBasicParsing -TimeoutSec 5).Content" 2>/dev/null | grep -q "healthy"; then
12
+ echo '{"additionalContext": "Memory system healthy."}'
13
+ exit 0
9
14
  fi
10
15
 
11
16
  # Daemon is NOT healthy. Figure out why and provide actionable guidance.
@@ -26,6 +31,17 @@ elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
26
31
  else
27
32
  CONTEXT="$CONTEXT Daemon is NOT installed. Suggest: 'The memory daemon hasn\u0027t been set up yet. Want me to install it? I can run the installer for you.'"
28
33
  fi
34
+ elif [[ "$OSTYPE" == msys* ]] || [[ "$OSTYPE" == cygwin* ]] || [[ "$OSTYPE" == MINGW* ]]; then
35
+ # Windows via Git Bash
36
+ TASK_STATUS=""
37
+ if command -v powershell.exe &>/dev/null; then
38
+ TASK_STATUS=$(powershell.exe -Command "(Get-ScheduledTask -TaskName 'ClaudiaMemoryDaemon' -ErrorAction SilentlyContinue).State" 2>/dev/null)
39
+ fi
40
+ if [ -n "$TASK_STATUS" ]; then
41
+ CONTEXT="$CONTEXT Daemon is installed (Task Scheduler, state: $TASK_STATUS). Suggest: 'Your memory daemon is installed but not responding. Want me to check the logs and try restarting it?'"
42
+ else
43
+ CONTEXT="$CONTEXT Daemon is NOT installed as a scheduled task. Suggest: 'The memory daemon hasn\u0027t been set up yet. Want me to install it? I can run the installer for you.'"
44
+ fi
29
45
  fi
30
46
 
31
47
  # Check for recent crash logs
@@ -9,7 +9,7 @@
9
9
  "hooks": [
10
10
  {
11
11
  "type": "command",
12
- "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/session-health-check.sh\"",
12
+ "command": "python3 \"$CLAUDE_PROJECT_DIR/.claude/hooks/session-health-check.py\" 2>/dev/null || python \"$CLAUDE_PROJECT_DIR/.claude/hooks/session-health-check.py\" 2>/dev/null || bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/session-health-check.sh\" 2>/dev/null || echo {\"additionalContext\":\"Health check skipped (no python3/python/bash on PATH).\"}",
13
13
  "timeout": 10000,
14
14
  "statusMessage": "Checking Claudia systems..."
15
15
  }
@@ -22,7 +22,7 @@
22
22
  "hooks": [
23
23
  {
24
24
  "type": "command",
25
- "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/pre-compact.sh\"",
25
+ "command": "python3 \"$CLAUDE_PROJECT_DIR/.claude/hooks/pre-compact.py\" 2>/dev/null || python \"$CLAUDE_PROJECT_DIR/.claude/hooks/pre-compact.py\" 2>/dev/null || bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/pre-compact.sh\" 2>/dev/null || echo {\"additionalContext\":\"Pre-compact hook skipped.\"}",
26
26
  "timeout": 5000,
27
27
  "statusMessage": "Preserving context..."
28
28
  }
@@ -53,9 +53,15 @@ Call memory.session_context with no arguments
53
53
  - Error/timeout: Daemon running but unhealthy
54
54
  - Tool not found: MCP connection broken
55
55
 
56
+ ### Step 2.5: Detect Platform
57
+
58
+ Run: `uname -s 2>/dev/null || echo Windows`
59
+
60
+ Use the appropriate command set below (macOS/Linux or Windows).
61
+
56
62
  ### Step 3: Check Daemon Process
57
63
 
58
- Run bash diagnostics:
64
+ **macOS/Linux:**
59
65
 
60
66
  ```bash
61
67
  # Check if daemon process is running
@@ -72,6 +78,28 @@ ls -la ~/.claudia/memory/*.db 2>/dev/null || echo "No database found"
72
78
  sqlite3 ~/.claudia/memory/claudia.db "SELECT COUNT(*) as memories FROM memories; SELECT COUNT(*) as entities FROM entities;" 2>/dev/null || echo "Cannot query database"
73
79
  ```
74
80
 
81
+ **Windows (PowerShell):**
82
+
83
+ ```powershell
84
+ # Check if daemon process is running
85
+ Get-Process python* | Where-Object { $_.CommandLine -like '*claudia_memory*' } 2>$null
86
+ # Fallback if CommandLine isn't available:
87
+ tasklist /FI "IMAGENAME eq python.exe" /V 2>$null | findstr claudia
88
+
89
+ # Check health endpoint
90
+ try { (Invoke-WebRequest -Uri 'http://localhost:3848/health' -UseBasicParsing -TimeoutSec 5).Content } catch { "Health endpoint not responding" }
91
+
92
+ # Check recent daemon logs
93
+ Get-Content -Tail 20 "$env:USERPROFILE\.claudia\daemon-stderr.log" 2>$null
94
+
95
+ # Check database exists and has data
96
+ dir "$env:USERPROFILE\.claudia\memory\*.db" 2>$null
97
+ & "$env:USERPROFILE\.claudia\daemon\venv\Scripts\python.exe" -c "import sqlite3; conn = sqlite3.connect('$env:USERPROFILE\.claudia\memory\claudia.db'); print('memories:', conn.execute('SELECT COUNT(*) FROM memories').fetchone()[0]); print('entities:', conn.execute('SELECT COUNT(*) FROM entities').fetchone()[0])"
98
+
99
+ # Check Task Scheduler status
100
+ Get-ScheduledTask -TaskName 'ClaudiaMemoryDaemon' -ErrorAction SilentlyContinue | Select-Object State
101
+ ```
102
+
75
103
  ### Step 4: Report Results
76
104
 
77
105
  Format the diagnosis as:
@@ -109,7 +137,7 @@ Format the diagnosis as:
109
137
 
110
138
  **Cause:** Daemon crashed or was never started
111
139
 
112
- **Fix:**
140
+ **Fix (macOS/Linux):**
113
141
  ```bash
114
142
  # Start the daemon manually
115
143
  cd ~/.claudia/daemon && source venv/bin/activate
@@ -119,6 +147,17 @@ python -m claudia_memory &
119
147
  cd [claudia-install-dir] && ./memory-daemon/scripts/install.sh
120
148
  ```
121
149
 
150
+ **Fix (Windows PowerShell):**
151
+ ```powershell
152
+ # Start the daemon manually
153
+ & "$env:USERPROFILE\.claudia\daemon\venv\Scripts\Activate.ps1"
154
+ python -m claudia_memory
155
+
156
+ # Or reinstall
157
+ cd [claudia-install-dir]
158
+ powershell -ExecutionPolicy Bypass -File memory-daemon\scripts\install.ps1
159
+ ```
160
+
122
161
  ### Issue: Health endpoint not responding
123
162
 
124
163
  **Cause:** Python 3.14 compatibility issue (fixed in v1.21.1+) or daemon crashed after startup
@@ -140,15 +179,31 @@ cd [claudia-install-dir] && ./memory-daemon/scripts/install.sh
140
179
 
141
180
  **Cause:** Daemon process exists but is unhealthy
142
181
 
143
- **Fix:**
182
+ **Fix (macOS/Linux):**
144
183
  1. Kill the old process: `pkill -f claudia_memory`
145
184
  2. Restart Claude Code (this restarts the MCP server)
146
185
  3. Check logs for specific errors
147
186
 
187
+ **Fix (Windows):**
188
+ 1. Kill the old process: `taskkill /F /FI "IMAGENAME eq python.exe"` (or use Task Manager)
189
+ 2. Restart Claude Code (this restarts the MCP server)
190
+ 3. Check logs: `Get-Content -Tail 50 "$env:USERPROFILE\.claudia\daemon-stderr.log"`
191
+
192
+ ### Issue: .mcp.json uses wrong entry point
193
+
194
+ **Detection:** Check the `args` array in `.mcp.json` for the `claudia-memory` server. If it says `claudia_memory.mcp.server` instead of `claudia_memory`, it bypasses project isolation, the health server, and background scheduling.
195
+
196
+ **Fix:** Update the args in `.mcp.json` to:
197
+ ```json
198
+ "args": ["-m", "claudia_memory", "--project-dir", "${workspaceFolder}"]
199
+ ```
200
+ Then restart Claude Code.
201
+
148
202
  ## Automatic Recovery
149
203
 
150
204
  If the daemon needs restart and user confirms:
151
205
 
206
+ **macOS/Linux:**
152
207
  ```bash
153
208
  # Kill any existing daemon
154
209
  pkill -f claudia_memory 2>/dev/null
@@ -160,4 +215,16 @@ sleep 2
160
215
  ps aux | grep claudia_memory | grep -v grep && echo "Still running, may need manual kill"
161
216
  ```
162
217
 
218
+ **Windows (PowerShell):**
219
+ ```powershell
220
+ # Kill any existing daemon
221
+ Get-Process python* -ErrorAction SilentlyContinue | Where-Object { $_.CommandLine -like '*claudia_memory*' } | Stop-Process -Force
222
+
223
+ # Wait for cleanup
224
+ Start-Sleep -Seconds 2
225
+
226
+ # Verify it's stopped
227
+ Get-Process python* -ErrorAction SilentlyContinue | Where-Object { $_.CommandLine -like '*claudia_memory*' }
228
+ ```
229
+
163
230
  Then instruct user to restart Claude Code, which will spawn a fresh daemon via MCP.
@@ -5,7 +5,8 @@
5
5
  "_disabled": true,
6
6
  "command": "~/.claudia/daemon/venv/bin/python",
7
7
  "args": ["-m", "claudia_memory", "--project-dir", "${workspaceFolder}"],
8
- "_setup": "Run: ~/.claudia/daemon/scripts/install.sh"
8
+ "_setup": "Run: ~/.claudia/daemon/scripts/install.sh",
9
+ "_windows": "On Windows, change command to: %USERPROFILE%\\.claudia\\daemon\\venv\\Scripts\\python.exe"
9
10
  },
10
11
 
11
12
  "gmail": {