get-claudia 1.40.2 → 1.40.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.
Files changed (37) hide show
  1. package/bin/index.js +34 -0
  2. package/memory-daemon/claudia_memory/mcp/server.py +0 -3
  3. package/package.json +3 -2
  4. package/template-v2/.claude/skills/brain/SKILL.md +44 -147
  5. package/visualizer/README.md +103 -0
  6. package/visualizer/dist/assets/index-COiyYF_B.js +4875 -0
  7. package/visualizer/dist/assets/index-COiyYF_B.js.map +1 -0
  8. package/visualizer/dist/claudia-logo.png +0 -0
  9. package/visualizer/dist/index.html +80 -0
  10. package/visualizer/dist/styles.css +883 -0
  11. package/visualizer/index.html +80 -0
  12. package/visualizer/lib/database.js +105 -0
  13. package/visualizer/lib/events.js +201 -0
  14. package/visualizer/lib/graph.js +236 -0
  15. package/visualizer/lib/projection.js +133 -0
  16. package/visualizer/package-lock.json +2827 -0
  17. package/visualizer/package.json +25 -0
  18. package/visualizer/public/claudia-logo.png +0 -0
  19. package/visualizer/public/styles.css +883 -0
  20. package/visualizer/public-legacy/app.js +292 -0
  21. package/visualizer/public-legacy/effects.js +596 -0
  22. package/visualizer/public-legacy/graph.js +426 -0
  23. package/visualizer/public-legacy/index.html +102 -0
  24. package/visualizer/public-legacy/ui.js +605 -0
  25. package/visualizer/scripts/install.ps1 +263 -0
  26. package/visualizer/scripts/install.sh +260 -0
  27. package/visualizer/server.js +371 -0
  28. package/visualizer/src/camera.js +83 -0
  29. package/visualizer/src/effects.js +232 -0
  30. package/visualizer/src/graph.js +152 -0
  31. package/visualizer/src/links.js +124 -0
  32. package/visualizer/src/main.js +434 -0
  33. package/visualizer/src/nodes.js +217 -0
  34. package/visualizer/src/settings.js +225 -0
  35. package/visualizer/src/themes.js +552 -0
  36. package/visualizer/src/ui.js +1088 -0
  37. package/visualizer/vite.config.js +23 -0
package/bin/index.js CHANGED
@@ -178,6 +178,9 @@ async function main() {
178
178
  // Show what's new in this release
179
179
  showWhatsNew(isUpgrade);
180
180
 
181
+ // Install brain visualizer to ~/.claudia/visualizer/
182
+ installVisualizer();
183
+
181
184
  // Helper: seed demo database using spawn (safe, no shell injection)
182
185
  function seedDemoDatabase(targetPath, mcpPath, callback) {
183
186
  console.log(`\n${colors.cyan}Seeding demo database...${colors.reset}`);
@@ -466,6 +469,37 @@ ${cdStep} ${colors.cyan}claude${colors.reset}
466
469
  }
467
470
  }
468
471
 
472
+ function installVisualizer() {
473
+ const vizSrc = join(__dirname, '..', 'visualizer');
474
+ if (!existsSync(vizSrc)) return; // not bundled in this release
475
+
476
+ const vizDest = join(homedir(), '.claudia', 'visualizer');
477
+ try {
478
+ mkdirSync(vizDest, { recursive: true });
479
+ cpSync(vizSrc, vizDest, { recursive: true, force: true });
480
+ console.log(`${colors.green}✓${colors.reset} Brain visualizer installed at ~/.claudia/visualizer/`);
481
+
482
+ // Run npm install --production in background (non-blocking)
483
+ const npmCmd = isWindows ? 'npm.cmd' : 'npm';
484
+ const npmProc = spawn(npmCmd, ['install', '--production'], {
485
+ cwd: vizDest,
486
+ stdio: 'pipe',
487
+ });
488
+ npmProc.on('close', (code) => {
489
+ if (code !== 0) {
490
+ // Non-fatal: user can run npm install manually
491
+ process.stderr.write(`${colors.yellow}!${colors.reset} Visualizer npm install failed (run "npm install" in ~/.claudia/visualizer/ to fix)\n`);
492
+ }
493
+ });
494
+ npmProc.on('error', () => {
495
+ // npm not found or spawn failed — non-fatal
496
+ });
497
+ } catch (err) {
498
+ // Non-fatal: visualizer is optional
499
+ console.log(`${colors.dim} Brain visualizer install skipped: ${err.message}${colors.reset}`);
500
+ }
501
+ }
502
+
469
503
  function showWhatsNew(isUpgrade) {
470
504
  const c = colors.cyan;
471
505
  const y = colors.yellow;
@@ -1915,7 +1915,6 @@ async def call_tool(name: str, arguments: Dict[str, Any]) -> CallToolResult:
1915
1915
  episode_id = arguments.get("episode_id")
1916
1916
  svc = get_remember_service()
1917
1917
  if episode_id is None:
1918
- from datetime import datetime
1919
1918
  episode_id = svc.db.insert("episodes", {
1920
1919
  "started_at": datetime.utcnow().isoformat(),
1921
1920
  "source": "claude_code",
@@ -1924,7 +1923,6 @@ async def call_tool(name: str, arguments: Dict[str, Any]) -> CallToolResult:
1924
1923
  else:
1925
1924
  episode = svc.db.get_one("episodes", where="id = ?", where_params=(episode_id,))
1926
1925
  if not episode:
1927
- from datetime import datetime
1928
1926
  new_id = svc.db.insert("episodes", {
1929
1927
  "started_at": datetime.utcnow().isoformat(),
1930
1928
  "source": arguments.get("source", "claude_code"),
@@ -2724,7 +2722,6 @@ async def call_tool(name: str, arguments: Dict[str, Any]) -> CallToolResult:
2724
2722
 
2725
2723
  elif name == "memory.upcoming":
2726
2724
  _coerce_int(arguments, "days")
2727
- from ..services.recall import recall_upcoming_deadlines
2728
2725
  days = arguments.get("days", 14)
2729
2726
  include_overdue = arguments.get("include_overdue", True)
2730
2727
  results = recall_upcoming_deadlines(days, include_overdue=include_overdue)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "get-claudia",
3
- "version": "1.40.2",
3
+ "version": "1.40.4",
4
4
  "description": "An AI assistant who learns how you work.",
5
5
  "keywords": [
6
6
  "claudia",
@@ -32,7 +32,8 @@
32
32
  "bin",
33
33
  "template-v2",
34
34
  "memory-daemon",
35
- "assets"
35
+ "assets",
36
+ "visualizer"
36
37
  ],
37
38
  "engines": {
38
39
  "node": ">=18.0.0"
@@ -6,91 +6,39 @@ effort-level: medium
6
6
 
7
7
  # Brain
8
8
 
9
- Launch the Claudia Brain Visualizer, a real-time 3D visualization of my memory system showing entities, relationships, memories, patterns, and predictions as an interactive force-directed graph.
9
+ Launch the Claudia Brain Visualizer, a real-time 3D cosmos visualization of my memory system showing entities, relationships, memories, and patterns as a swirling interactive force-directed graph.
10
10
 
11
11
  **Triggers:** `/brain`, "show me your brain", "visualize memory", "open the brain", "memory graph"
12
12
 
13
13
  ---
14
14
 
15
- ## Prerequisites
15
+ ## Overview
16
16
 
17
- The visualizer requires:
18
- 1. **Memory daemon** running on port 3848 (handles embeddings)
19
- 2. **API server** running on port 3849 (serves graph data from database)
20
- 3. **Vite dev server** running on port 5173/5174 (Three.js frontend)
21
-
22
- The API server must be started with `--project-dir` pointing to the current Claudia installation to access the correct per-project database.
17
+ The visualizer is a single Express server (`server.js`) in `~/.claudia/visualizer/` that serves both the API (reads SQLite directly) and the pre-built 3D frontend from `dist/`. One process, one port (3849).
23
18
 
24
19
  ---
25
20
 
26
21
  ## Launch
27
22
 
28
- ### Step 1: Identify the current project directory
29
-
30
- The project directory is the Claudia installation root (where `context/me.md` lives). This is needed for database isolation.
31
-
32
- ```bash
33
- # The Claudia installation directory (where this command is being run from)
34
- PROJECT_DIR="$(pwd)"
35
- echo "PROJECT_DIR:$PROJECT_DIR"
36
- ```
37
-
38
- ### Step 2: Check if visualizer frontend is already running
39
-
40
- ```bash
41
- if curl -s http://localhost:5173 > /dev/null 2>&1; then
42
- echo "FRONTEND_RUNNING:5173"
43
- elif curl -s http://localhost:5174 > /dev/null 2>&1; then
44
- echo "FRONTEND_RUNNING:5174"
45
- else
46
- echo "FRONTEND_NOT_RUNNING"
47
- fi
48
- ```
49
-
50
- ### Step 3: Check if API server is running
23
+ ### Step 1: Check if already running
51
24
 
52
25
  ```bash
53
26
  if curl -s http://localhost:3849/health > /dev/null 2>&1; then
54
- echo "API_RUNNING"
55
- else
56
- echo "API_NOT_RUNNING"
57
- fi
58
- ```
59
-
60
- ### Step 4: Check if memory daemon is running
61
-
62
- ```bash
63
- if curl -s http://localhost:3848/health > /dev/null 2>&1; then
64
- echo "DAEMON_RUNNING"
27
+ echo "ALREADY_RUNNING"
65
28
  else
66
- echo "DAEMON_NOT_RUNNING"
29
+ echo "NOT_RUNNING"
67
30
  fi
68
31
  ```
69
32
 
70
- ### Step 5: Find the visualizer directories
33
+ ### Step 2: Find the visualizer directory
71
34
 
72
35
  ```bash
73
36
  VISUALIZER_DIR=""
74
- BACKEND_DIR=""
75
-
76
- # Find Three.js frontend
77
- for dir in \
78
- "$HOME/.claudia/visualizer-threejs" \
79
- "$(dirname "$(which get-claudia 2>/dev/null)")/../lib/node_modules/get-claudia/visualizer-threejs" \
80
- "$(npm root -g 2>/dev/null)/get-claudia/visualizer-threejs"; do
81
- if [ -d "$dir" ] && [ -f "$dir/package.json" ]; then
82
- VISUALIZER_DIR="$dir"
83
- break
84
- fi
85
- done
86
-
87
- # Find API backend (in visualizer/ sibling directory)
88
37
  for dir in \
89
38
  "$HOME/.claudia/visualizer" \
90
- "$(dirname "$(which get-claudia 2>/dev/null)")/../lib/node_modules/get-claudia/visualizer" \
91
39
  "$(npm root -g 2>/dev/null)/get-claudia/visualizer"; do
92
40
  if [ -d "$dir" ] && [ -f "$dir/server.js" ]; then
93
- BACKEND_DIR="$dir"
41
+ VISUALIZER_DIR="$dir"
94
42
  break
95
43
  fi
96
44
  done
@@ -100,75 +48,39 @@ if [ -z "$VISUALIZER_DIR" ]; then
100
48
  else
101
49
  echo "VISUALIZER_FOUND:$VISUALIZER_DIR"
102
50
  fi
103
-
104
- if [ -z "$BACKEND_DIR" ]; then
105
- echo "BACKEND_NOT_FOUND"
106
- else
107
- echo "BACKEND_FOUND:$BACKEND_DIR"
108
- fi
109
51
  ```
110
52
 
111
- ### Step 6: Start API backend if not running
112
-
113
- If **API_NOT_RUNNING** and **BACKEND_FOUND**:
53
+ ### Step 3: Start the server (if NOT_RUNNING and VISUALIZER_FOUND)
114
54
 
115
55
  ```bash
116
- cd "$BACKEND_DIR"
56
+ PROJECT_DIR="$(pwd)"
57
+ cd "$VISUALIZER_DIR"
117
58
 
118
59
  # Install deps if needed
119
60
  if [ ! -d "node_modules" ]; then
120
- echo "Installing backend dependencies..."
121
- npm install 2>&1
61
+ echo "Installing dependencies..."
62
+ npm install --production 2>&1
122
63
  fi
123
64
 
124
- # Start API server with project directory for database isolation
125
- nohup node server.js --project-dir "$PROJECT_DIR" > /tmp/claudia-brain-api.log 2>&1 &
126
- API_PID=$!
65
+ # Start server with --open to auto-launch browser
66
+ nohup node server.js --project-dir "$PROJECT_DIR" --open > /tmp/claudia-brain.log 2>&1 &
127
67
  sleep 2
128
68
 
129
- # Check if started successfully
69
+ # Verify it started
130
70
  if curl -s http://localhost:3849/health > /dev/null 2>&1; then
131
- echo "API_STARTED"
71
+ echo "STARTED"
132
72
  else
133
- echo "API_FAILED"
134
- tail -10 /tmp/claudia-brain-api.log
73
+ echo "FAILED"
74
+ tail -10 /tmp/claudia-brain.log
135
75
  fi
136
76
  ```
137
77
 
138
- ### Step 7: Start frontend if not running
139
-
140
- If **FRONTEND_NOT_RUNNING** and **VISUALIZER_FOUND**:
141
-
142
- ```bash
143
- cd "$VISUALIZER_DIR"
144
-
145
- # Install deps if needed
146
- if [ ! -d "node_modules" ]; then
147
- echo "Installing frontend dependencies..."
148
- npm install 2>&1
149
- fi
150
-
151
- # Start Vite dev server in background
152
- nohup npm run dev > /tmp/claudia-brain.log 2>&1 &
153
- BRAIN_PID=$!
154
- sleep 3
78
+ ### Step 4: Open browser (if ALREADY_RUNNING)
155
79
 
156
- # Check if started successfully
157
- if curl -s http://localhost:5173 > /dev/null 2>&1; then
158
- echo "FRONTEND_STARTED:5173"
159
- elif curl -s http://localhost:5174 > /dev/null 2>&1; then
160
- echo "FRONTEND_STARTED:5174"
161
- else
162
- echo "FRONTEND_FAILED"
163
- tail -20 /tmp/claudia-brain.log
164
- fi
165
- ```
166
-
167
- ### Step 8: Open in browser
80
+ If the server was already running, just open the browser:
168
81
 
169
82
  ```bash
170
- PORT="${PORT:-5173}"
171
- open "http://localhost:$PORT" 2>/dev/null || xdg-open "http://localhost:$PORT" 2>/dev/null || echo "OPEN_MANUALLY:$PORT"
83
+ open "http://localhost:3849" 2>/dev/null || xdg-open "http://localhost:3849" 2>/dev/null || echo "OPEN_MANUALLY:http://localhost:3849"
172
84
  ```
173
85
 
174
86
  ---
@@ -177,69 +89,54 @@ open "http://localhost:$PORT" 2>/dev/null || xdg-open "http://localhost:$PORT" 2
177
89
 
178
90
  **If already running:**
179
91
  ```
180
- Your brain is already live at http://localhost:[PORT]
92
+ Your brain is live at http://localhost:3849
181
93
  ```
182
94
 
183
95
  **If started successfully:**
184
96
  ```
185
97
  **Brain Visualizer**
186
- Launched at http://localhost:[PORT]
98
+ Live at http://localhost:3849
187
99
 
188
100
  Viewing database for: [PROJECT_DIR]
189
101
 
190
102
  What you're seeing:
191
- - **Entities** (people, orgs, projects, concepts) as colored nodes
192
- - **Memories** as smaller particles orbiting connected entities
193
- - **Relationships** as curved edges between entities
103
+ - **Entities** (people, orgs, projects, concepts) as colored nodes, size scales with importance
104
+ - **Relationships** as arcing edges with traveling pulse particles
194
105
  - **Patterns** as wireframe clusters
106
+ - **Starfield** background, the galaxy is just ambiance
195
107
 
196
108
  **Controls:**
197
- - Click any node for details
198
- - Press **H** to open the design panel (tweak colors, bloom, animations)
199
- - Use the search bar to find specific entities
200
- - The graph updates in real-time as I learn
109
+ - Click any node to see details, memories, and relationships
110
+ - Search bar (top left) to find specific entities, camera flies to matches
111
+ - H = toggle HUD, R = reset camera, F = fullscreen, Esc = close panel
112
+ - The graph updates live as I learn new things
201
113
  ```
202
114
 
203
- **If daemon not running:**
204
- ```
205
- The memory daemon isn't running. Start it first:
206
-
207
- ```bash
208
- cd ~/.claudia && python -m claudia_memory
115
+ **If visualizer not found:**
209
116
  ```
117
+ The Brain Visualizer isn't installed at ~/.claudia/visualizer/.
210
118
 
211
- Then try `/brain` again.
119
+ To install: run `npx get-claudia` again, or manually copy the visualizer directory:
120
+ 1. Copy `visualizer/` from the get-claudia package to `~/.claudia/visualizer/`
121
+ 2. Run `npm install --production` there
122
+ 3. Try `/brain` again
212
123
  ```
213
124
 
214
- **If API server failed:**
125
+ **If server failed to start:**
215
126
  ```
216
- The API server couldn't start. Check the log:
127
+ The server couldn't start. Check the log:
217
128
  ```bash
218
- tail -50 /tmp/claudia-brain-api.log
129
+ tail -50 /tmp/claudia-brain.log
219
130
  ```
220
131
 
221
132
  Common issues:
222
- - Port 3849 already in use
223
- - Database not found for this project
224
- - Missing node_modules (run `npm install` in the visualizer directory)
225
- ```
226
-
227
- **If visualizer not found:**
133
+ - Port 3849 already in use (kill the old process first)
134
+ - Database not found for this project (make sure --project-dir is correct)
135
+ - Missing node_modules (run `npm install --production` in ~/.claudia/visualizer/)
228
136
  ```
229
- The Brain Visualizer isn't installed. It ships with the visualizer and visualizer-threejs directories in the Claudia package.
230
-
231
- To install manually:
232
- 1. Copy visualizer/ to ~/.claudia/visualizer
233
- 2. Copy visualizer-threejs/ to ~/.claudia/visualizer-threejs
234
- 3. Run `npm install` in both directories
235
- 4. Try `/brain` again
236
- ```
237
-
238
- **If frontend failed:**
239
- Show the log output and suggest checking `/tmp/claudia-brain.log`.
240
137
 
241
138
  ---
242
139
 
243
140
  ## Tone
244
141
 
245
- Treat this like showing someone a cool feature. Be a little proud of it. "Want to see what your memory graph looks like?" energy.
142
+ Treat this like showing someone something cool. A little proud of it. "Want to see what your memory graph looks like?" energy.
@@ -0,0 +1,103 @@
1
+ # Claudia Brain Visualizer
2
+
3
+ Real-time 3D visualization of Claudia's memory system. Entities, relationships, memories, patterns, and predictions rendered as an interactive force-directed graph with semantic clustering.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ cd visualizer
9
+ npm install
10
+ node server.js
11
+ # Open http://localhost:3849
12
+ ```
13
+
14
+ The server auto-detects your Claudia memory database at `~/.claudia/memory/`.
15
+
16
+ ### Options
17
+
18
+ ```
19
+ --port 3849 Server port (default: 3849)
20
+ --project-dir /path Use project-specific database (hashed like the daemon)
21
+ --db /path/to/db Direct path to a .db file
22
+ ```
23
+
24
+ ### From a Claudia session
25
+
26
+ ```
27
+ /brain
28
+ ```
29
+
30
+ ## What You See
31
+
32
+ ### Nodes
33
+
34
+ | Type | Shape | Color |
35
+ |------|-------|-------|
36
+ | Person | Sphere | Warm gold |
37
+ | Organization | Cube | Blue |
38
+ | Project | Octahedron | Green |
39
+ | Concept | Icosahedron | Purple |
40
+ | Location | Sphere + rings | Orange |
41
+ | Memory (fact) | Particle | White |
42
+ | Memory (commitment) | Particle (pulsing) | Red |
43
+ | Memory (learning) | Particle | Green |
44
+ | Pattern | Wireframe icosahedron | Purple (breathing) |
45
+
46
+ Node size scales with `sqrt(importance)`. Opacity fades for items not accessed in 90+ days.
47
+
48
+ ### Edges
49
+
50
+ - **Entity relationships:** Thickness = strength, directional particles for forward edges
51
+ - **Memory links:** Thin lines connecting memories to related entities
52
+ - **Historical relationships:** Dashed ghost edges (toggle with `?historical=true`)
53
+
54
+ ### Real-Time Updates
55
+
56
+ The visualizer polls the database every 500ms via SSE. When Claudia learns something new in another session:
57
+
58
+ - New memories spawn with a flash animation
59
+ - Recalled memories pulse and brighten
60
+ - LLM-improved memories shimmer with golden aura
61
+ - New relationships draw in with growing edges
62
+ - Superseded relationships fade to dashed ghosts
63
+
64
+ ### Controls
65
+
66
+ - **Click** a node to see details (memories, relationships, documents)
67
+ - **Search** entities and memories in the sidebar
68
+ - **Filter** by node type and memory type
69
+ - **Timeline** scrubber to view the graph at any point in time
70
+ - **Drag** to rotate, scroll to zoom
71
+
72
+ ## Architecture
73
+
74
+ ```
75
+ server.js Express on :3849, static files + API
76
+ lib/database.js Read-only SQLite (WAL mode), workspace hash
77
+ lib/graph.js SQL -> graph JSON (nodes + edges)
78
+ lib/projection.js UMAP 384-dim -> 3D (with graceful fallback)
79
+ lib/events.js SSE stream, 500ms change detection
80
+ public/ Vanilla JS + 3d-force-graph (zero build step)
81
+ ```
82
+
83
+ The visualizer opens the database in **read-only mode** and never interferes with the running memory daemon.
84
+
85
+ ## API
86
+
87
+ | Endpoint | Purpose |
88
+ |----------|---------|
89
+ | `GET /health` | Server status + entity count |
90
+ | `GET /api/graph` | Full graph (nodes + edges + UMAP positions) |
91
+ | `GET /api/graph?historical=true` | Include superseded relationships |
92
+ | `GET /api/stats` | Counts for HUD overlay |
93
+ | `GET /api/entity/:id` | Entity detail with memories, relationships, documents |
94
+ | `GET /api/timeline?start=&end=` | Events for timeline scrubber |
95
+ | `GET /api/events` | SSE stream for real-time updates |
96
+
97
+ ## Schema Compatibility
98
+
99
+ The visualizer detects available database columns at startup and adapts queries accordingly. It works with any schema version from v1 through v8+:
100
+
101
+ - Pre-v5: No verification_status on memories (defaults to 'pending')
102
+ - Pre-v7: No documents table (documents section hidden)
103
+ - Pre-v8: No bi-temporal relationships (no historical toggle)