claude-code-memory-explorer 0.2.0 → 0.2.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-memory-explorer",
3
- "version": "0.2.0",
3
+ "version": "0.2.3",
4
4
  "description": "Memory explorer dashboard for Claude Code",
5
5
  "main": "server.js",
6
6
  "bin": {
@@ -22,5 +22,30 @@
22
22
  "devDependencies": {
23
23
  "husky": "^9.0.0"
24
24
  },
25
- "license": "MIT"
25
+ "keywords": [
26
+ "claude",
27
+ "claude-code",
28
+ "memory",
29
+ "dashboard",
30
+ "anthropic",
31
+ "ai",
32
+ "cli",
33
+ "explorer"
34
+ ],
35
+ "homepage": "https://github.com/NikiforovAll/claude-code-memory",
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "git+https://github.com/NikiforovAll/claude-code-memory.git"
39
+ },
40
+ "bugs": {
41
+ "url": "https://github.com/NikiforovAll/claude-code-memory/issues"
42
+ },
43
+ "author": "NikiforovAll",
44
+ "license": "MIT",
45
+ "files": [
46
+ "server.js",
47
+ "public/",
48
+ "README.md",
49
+ "LICENSE"
50
+ ]
26
51
  }
package/public/app.js CHANGED
@@ -57,7 +57,7 @@ function highlightSource(text, fileName) {
57
57
  return esc(text);
58
58
  }
59
59
 
60
- function linkifyImports(text, sourceId) {
60
+ function linkifyImports(text, _sourceId) {
61
61
  if (!stackData.length) return { text, placeholders: [] };
62
62
  const byName = Object.fromEntries(stackData.map((c) => [c.name, c]));
63
63
  const placeholders = [];
@@ -183,14 +183,14 @@ function addRecentProject(p) {
183
183
  localStorage.setItem('recentProjects', JSON.stringify(recent.slice(0, 10)));
184
184
  }
185
185
 
186
- function removeRecentProject(p, e) {
186
+ function _removeRecentProject(p, e) {
187
187
  e.stopPropagation();
188
188
  const recent = getRecentProjects().filter((r) => r !== p);
189
189
  localStorage.setItem('recentProjects', JSON.stringify(recent));
190
190
  renderRecentProjects();
191
191
  }
192
192
 
193
- function selectRecentProject(p) {
193
+ function _selectRecentProject(p) {
194
194
  document.getElementById('projectPathInput').value = p;
195
195
  }
196
196
 
@@ -206,9 +206,9 @@ function renderRecentProjects() {
206
206
  recent
207
207
  .map(
208
208
  (p) =>
209
- `<div class="recent-project-item" onclick="selectRecentProject('${escJs(p)}')">` +
209
+ `<div class="recent-project-item" onclick="_selectRecentProject('${escJs(p)}')">` +
210
210
  `<span>${esc(p)}</span>` +
211
- `<button class="recent-project-remove" onclick="removeRecentProject('${escJs(p)}', event)" title="Remove">&#10005;</button>` +
211
+ `<button class="recent-project-remove" onclick="_removeRecentProject('${escJs(p)}', event)" title="Remove">&#10005;</button>` +
212
212
  `</div>`,
213
213
  )
214
214
  .join('');
@@ -243,13 +243,14 @@ function bindModalKeys(inputId, modalId, submitFn) {
243
243
 
244
244
  // #region RENDER_TREE
245
245
 
246
- const SCOPE_ORDER = ['policy', 'user', 'project', 'rule', 'memory'];
246
+ const SCOPE_ORDER = ['policy', 'user', 'project', 'rule', 'memory', 'user-memory'];
247
247
  const SCOPE_LABELS = {
248
248
  policy: 'Managed Policy',
249
249
  user: 'User',
250
250
  project: 'Project',
251
251
  rule: 'Rules',
252
252
  memory: 'Auto Memory',
253
+ 'user-memory': 'User Memory',
253
254
  };
254
255
  const LOAD_ICONS = {
255
256
  always: '\u25CF',
@@ -315,7 +316,7 @@ function renderTree() {
315
316
  const loadTitle = LOAD_TITLES[item.load] || item.load;
316
317
  const meta = `${item.lines}L`;
317
318
  const isConditional = item.load === 'conditional' || item.load === 'ondemand';
318
- const pad = indent ? ' style="padding-left:' + (12 + indent * 16) + 'px"' : '';
319
+ const pad = indent ? ` style="padding-left:${12 + indent * 16}px"` : '';
319
320
  let h = `<div class="tree-item${sel}${indent ? ' tree-child' : ''}${isConditional ? ' tree-conditional' : ''}" data-id="${esc(item.id)}" title="${esc(item.path)}" onclick="selectFile('${escJs(item.id)}')"${pad}>`;
320
321
  h += `<span class="load-icon" title="${loadTitle}" style="color:var(--scope-${item.scope})">${loadIcon}</span>`;
321
322
  h += `<span class="file-name">${esc(item.name)}</span>`;
@@ -398,6 +399,41 @@ function navigateGroup(direction) {
398
399
 
399
400
  // #endregion RENDER_TREE
400
401
 
402
+ // #region MEMORY_INDEX
403
+
404
+ function parseMemoryIndex(content) {
405
+ const entries = [];
406
+ for (const line of content.split('\n')) {
407
+ const m = line.match(/^\s*-\s*\[([^\]]+)\]\(([^)]+\.md)\)\s*[—–-]\s*(.+)$/);
408
+ if (m) entries.push({ name: m[1], file: m[2], desc: m[3].trim() });
409
+ }
410
+ return entries;
411
+ }
412
+
413
+ function renderMemoryIndexTable(entries) {
414
+ const TYPE_COLORS = { feedback: 'rule', user: 'user', project: 'project', reference: 'local' };
415
+ const byName = Object.fromEntries(stackData.map((s) => [s.name, s]));
416
+ let html = '<div class="memory-index">';
417
+ for (const entry of entries) {
418
+ const child = byName[entry.file];
419
+ const typeMatch = entry.file.match(/^([a-z]+)_/);
420
+ const type = typeMatch ? typeMatch[1] : 'memory';
421
+ const scopeColor = TYPE_COLORS[type] || 'memory';
422
+ const nameHtml = child
423
+ ? `<a class="import-link" href="#" onclick="selectFile('${escJs(child.id)}');return false" title="${esc(child.path)}">${esc(entry.name)}</a>`
424
+ : `<span class="import-link unresolved" title="Not found: ${esc(entry.file)}">⚠ ${esc(entry.name)}</span>`;
425
+ html += `<div class="memory-index-row">`;
426
+ html += `<span class="scope-badge scope-${scopeColor} memory-index-type">${esc(type)}</span>`;
427
+ html += `<span class="memory-index-name">${nameHtml}</span>`;
428
+ html += `<span class="memory-index-desc">${esc(entry.desc)}</span>`;
429
+ html += `</div>`;
430
+ }
431
+ html += '</div>';
432
+ return html;
433
+ }
434
+
435
+ // #endregion MEMORY_INDEX
436
+
401
437
  // #region RENDER_PREVIEW
402
438
 
403
439
  async function renderPreview() {
@@ -461,7 +497,16 @@ async function renderPreview() {
461
497
  const { text: processed, placeholders } = linkifyImports(text, source.id);
462
498
  return restorePlaceholders(highlightSource(processed, source.name), placeholders);
463
499
  };
464
- if (source.scope === 'memory' && source.load === 'startup' && source.maxLines) {
500
+
501
+ // Memory index view — render structured table for MEMORY.md index files
502
+ if ((source.scope === 'memory' || source.scope === 'user-memory') && source.name === 'MEMORY.md') {
503
+ const entries = parseMemoryIndex(content);
504
+ if (entries.length) {
505
+ html += renderMemoryIndexTable(entries);
506
+ }
507
+ }
508
+
509
+ if ((source.scope === 'memory' || source.scope === 'user-memory') && source.load === 'startup' && source.maxLines) {
465
510
  const lines = content.split('\n');
466
511
  const cutoff = source.maxLines;
467
512
  if (lines.length > cutoff) {
@@ -481,8 +526,8 @@ async function renderPreview() {
481
526
  }
482
527
 
483
528
  function formatBytes(b) {
484
- if (b < 1024) return b + 'B';
485
- return (b / 1024).toFixed(1) + 'KB';
529
+ if (b < 1024) return `${b}B`;
530
+ return `${(b / 1024).toFixed(1)}KB`;
486
531
  }
487
532
 
488
533
  async function openInEditor(filePath) {
@@ -564,7 +609,7 @@ async function loadData() {
564
609
  renderPreview();
565
610
  }
566
611
  } catch (err) {
567
- showToast('Failed to load: ' + err.message, 'error');
612
+ showToast(`Failed to load: ${err.message}`, 'error');
568
613
  }
569
614
  }
570
615
 
@@ -660,7 +705,7 @@ document.addEventListener('keydown', (e) => {
660
705
  });
661
706
  })();
662
707
 
663
- function hubNavigate(app, url) {
708
+ function _hubNavigate(app, url) {
664
709
  if (!window.__HUB__?.enabled) return;
665
710
  window.parent?.postMessage({ type: 'hub:navigate', app, url }, '*');
666
711
  }
package/public/style.css CHANGED
@@ -24,6 +24,7 @@
24
24
  --scope-local: #8a9bb5;
25
25
  --scope-rule: #a89bc4;
26
26
  --scope-memory: #c4a06a;
27
+ --scope-user-memory: #9ab87a;
27
28
  --scope-policy: #b58a8a;
28
29
  --font-mono: 'IBM Plex Mono', monospace;
29
30
  --font-serif: 'Playfair Display', serif;
@@ -120,7 +121,7 @@ body {
120
121
  cursor: pointer;
121
122
  font-size: 11px;
122
123
  font-family: var(--font-mono);
123
- max-width: 300px;
124
+ white-space: nowrap;
124
125
  }
125
126
  .topbar-project:hover {
126
127
  border-color: var(--accent);
@@ -400,6 +401,40 @@ body.light .tree-conditional .file-name {
400
401
  text-decoration: none;
401
402
  opacity: 0.6;
402
403
  }
404
+ /* #region MEMORY_INDEX */
405
+ .memory-index {
406
+ padding: 8px 12px;
407
+ border-bottom: 1px solid var(--border);
408
+ display: flex;
409
+ flex-direction: column;
410
+ gap: 4px;
411
+ }
412
+ .memory-index-row {
413
+ display: grid;
414
+ grid-template-columns: 72px 160px 1fr;
415
+ align-items: baseline;
416
+ gap: 8px;
417
+ padding: 3px 0;
418
+ }
419
+ .memory-index-type {
420
+ flex-shrink: 0;
421
+ }
422
+ .memory-index-name {
423
+ font-size: 11px;
424
+ font-family: var(--font-mono);
425
+ white-space: nowrap;
426
+ overflow: hidden;
427
+ text-overflow: ellipsis;
428
+ }
429
+ .memory-index-desc {
430
+ font-size: 10px;
431
+ color: var(--text-muted);
432
+ white-space: nowrap;
433
+ overflow: hidden;
434
+ text-overflow: ellipsis;
435
+ }
436
+ /* #endregion MEMORY_INDEX */
437
+
403
438
  .cutoff-line {
404
439
  border-top: 2px dashed var(--error);
405
440
  margin: 8px 0;
@@ -449,6 +484,10 @@ body.light .tree-conditional .file-name {
449
484
  background: rgba(196, 149, 106, 0.18);
450
485
  color: var(--scope-memory);
451
486
  }
487
+ .scope-user-memory {
488
+ background: rgba(154, 184, 122, 0.18);
489
+ color: var(--scope-user-memory);
490
+ }
452
491
  .scope-policy {
453
492
  background: rgba(181, 138, 138, 0.18);
454
493
  color: var(--scope-policy);
package/server.js CHANGED
@@ -332,6 +332,38 @@ function discoverMemorySources(projectPath) {
332
332
  }
333
333
  }
334
334
 
335
+ // 7. User-level memory (~/.claude/memory/)
336
+ const userMemoryDir = path.join(os.homedir(), '.claude', 'memory');
337
+ if (fs.existsSync(userMemoryDir)) {
338
+ const userMemoryMd = path.join(userMemoryDir, 'MEMORY.md');
339
+ const userMemInfo = fileInfo(userMemoryMd);
340
+ if (userMemInfo) {
341
+ sources.push({
342
+ id: 'user-memory-index',
343
+ name: 'MEMORY.md',
344
+ scope: 'user-memory',
345
+ load: 'startup',
346
+ ...userMemInfo,
347
+ maxLines: 200,
348
+ maxBytes: 25 * 1024,
349
+ ...spreadImports(userMemInfo.path, userMemInfo.content),
350
+ });
351
+ }
352
+ for (const file of findMdFiles(userMemoryDir)) {
353
+ if (path.basename(file) === 'MEMORY.md') continue;
354
+ const info = fileInfo(file);
355
+ if (!info) continue;
356
+ sources.push({
357
+ id: `user-memory-${path.basename(file, '.md')}`,
358
+ name: path.basename(file),
359
+ scope: 'user-memory',
360
+ load: 'ondemand',
361
+ ...info,
362
+ ...spreadImports(info.path, info.content),
363
+ });
364
+ }
365
+ }
366
+
335
367
  // Resolve imports recursively — add imported files as sources if not already present
336
368
  const seen = new Set(sources.map(s => s.path));
337
369
  const sourceByPath = Object.fromEntries(sources.map(s => [s.path, s]));
@@ -1,54 +0,0 @@
1
- ---
2
- description: Bump version, tag, push, and create a GitHub release with auto-generated notes
3
- argument-hint: "[version e.g. 1.13.0 or rc4]"
4
- ---
5
-
6
- # Release
7
-
8
- Create a new release for this project.
9
-
10
- ## Inputs
11
-
12
- - `$ARGUMENTS` — target version or shorthand. Examples:
13
- - `1.13.0` — full version
14
- - `rc4` — shorthand for next RC (e.g. if current is `1.19.0-rc.3`, becomes `1.19.0-rc.4`)
15
- - If not provided, ask the user.
16
-
17
- ## Steps
18
-
19
- 1. **Determine version**: Use `$ARGUMENTS` or ask user. Handle `rc<N>` shorthand by reading current version from `package.json` and replacing/appending the RC suffix. Validate it's different from the current version.
20
-
21
- 2. **Detect prerelease**: If version contains `-rc.`, `-alpha.`, `-beta.`, treat as prerelease.
22
-
23
- 3. **Check working tree**: Run `git status`. If there are uncommitted changes, warn the user and stop.
24
-
25
- 4. **Bump version**:
26
- ```
27
- npm version <version> --no-git-tag-version
28
- ```
29
-
30
- 5. **Commit & push** (push to current branch, not hardcoded `main`):
31
- ```
32
- git add package.json package-lock.json
33
- git commit -m "🔖 chore: Bump version to <version>"
34
- git push origin HEAD
35
- ```
36
-
37
- 6. **Tag & push tag**:
38
- ```
39
- git tag v<version>
40
- git push origin v<version>
41
- ```
42
-
43
- 7. **Generate release notes**: Collect commits since the previous tag using `git log --oneline <prev-tag>..HEAD`. Write a **user-facing summary** grouped by:
44
- - Features (✨) — describe what was added, not raw commit messages
45
- - Fixes (🐛)
46
- - Other notable changes
47
- Include a "Full Changelog" compare link at the bottom.
48
-
49
- 8. **Create GitHub release** (add `--prerelease` flag for RC/alpha/beta):
50
- ```
51
- gh release create v<version> --title "v<version>" --notes "<notes>" [--prerelease]
52
- ```
53
-
54
- 9. **Report**: Show the release URL to the user.
@@ -1,36 +0,0 @@
1
- name: Deploy static site to Pages
2
-
3
- on:
4
- push:
5
- branches: ["main", "master"]
6
- paths:
7
- - "docs/**"
8
- workflow_dispatch:
9
-
10
- permissions:
11
- contents: read
12
- pages: write
13
- id-token: write
14
-
15
- concurrency:
16
- group: "pages"
17
- cancel-in-progress: false
18
-
19
- jobs:
20
- deploy:
21
- environment:
22
- name: github-pages
23
- url: ${{ steps.deployment.outputs.page_url }}
24
- runs-on: ubuntu-latest
25
- steps:
26
- - name: Checkout
27
- uses: actions/checkout@v4
28
- - name: Setup Pages
29
- uses: actions/configure-pages@v5
30
- - name: Upload artifact
31
- uses: actions/upload-pages-artifact@v3
32
- with:
33
- path: "docs"
34
- - name: Deploy to GitHub Pages
35
- id: deployment
36
- uses: actions/deploy-pages@v4
package/CLAUDE.md DELETED
@@ -1,49 +0,0 @@
1
- # CLAUDE.md
2
-
3
- This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
-
5
- ## What This Is
6
-
7
- Dashboard for visualizing all memory sources that influence Claude Code behavior. Shows the full memory stack: CLAUDE.md files (user/project/local), rules (`.claude/rules/*.md` with optional path-scoped frontmatter), auto memory (`~/.claude/projects/<encoded>/memory/`), and `@import` chains.
8
-
9
- ## Commands
10
-
11
- - `npm start` — run server (port 3459)
12
- - `npm run dev` — run with auto-open browser
13
- - `npx @biomejs/biome check public/app.js public/style.css` — lint
14
- - `npx @biomejs/biome format --write public/app.js public/style.css` — format
15
-
16
- ## Architecture
17
-
18
- Single-file Express backend + vanilla JS frontend. No build step, no framework.
19
-
20
- - **`server.js`** — Express server with two main responsibilities:
21
- 1. **Filesystem scanning** (`discoverMemorySources`) — walks `~/.claude/`, ancestor directories, project `.claude/rules/`, and auto memory dirs to build the full memory source stack
22
- 2. **API endpoints** — `/api/stack`, `/api/summary`, `/api/file`, `/api/rules/match`, `/api/imports` etc.
23
- - **`public/app.js`** — SPA with tree panel (left) + preview panel (right) split layout. Fetches from API, renders tree grouped by scope, shows syntax-highlighted preview with frontmatter badges and clickable `@import` links.
24
- - **`public/style.css`** — CSS variables on `:root` (dark default), `body.light` overrides. Scope colors: user=blue, project=green, local=yellow, rule=purple, memory=orange, policy=red.
25
-
26
- Both JS files use `// #region` / `// #endregion` markers for code organization.
27
-
28
- ## Key Server Concepts
29
-
30
- - **Project path encoding**: Claude Code stores auto memory in `~/.claude/projects/<encoded-path>/memory/`. The encoding replaces `/` with `-` and strips `:` from drive letters. `findMemoryDir()` tries exact match first, falls back to substring matching.
31
- - **Import resolution**: `@path/to/file.md` references are parsed from content. `resolveExistingImports()` resolves paths and filters out non-existent files. Imported files are recursively added to the stack (max 5 levels).
32
- - **Frontmatter parsing**: YAML frontmatter in rules files (`paths`, `type`, `name`, `description`) determines conditional loading. `parseFrontmatter()` handles both inline values and YAML array syntax.
33
- - **Rules matching**: `micromatch` glob matching against rule `paths` frontmatter via `/api/rules/match?file=`.
34
- - **Cache**: 30-second TTL on `discoverMemorySources` results, cleared on project switch or manual refresh.
35
-
36
- ## Conventions
37
-
38
- - Dark theme default, light theme via `body.light` class
39
- - Accent color: `#e86f33`
40
- - Fonts: IBM Plex Mono (data/code), Playfair Display (headings)
41
- - Keyboard-driven: j/k navigation, t=theme, r=refresh, e=open in editor, ?=help
42
- - Port 3459 (cost=3458, marketplace=3460)
43
- - `zoom: 1.25` on body for proportional scaling
44
- - No token/context budget estimation — only line/byte counts (deliberate decision)
45
-
46
- ## Prior Art
47
-
48
- - `../claude-code-cost` — same stack, data visualization patterns
49
- - `../claude-code-marketplace` — file tree, markdown preview, project picker, Highlight.js usage
Binary file
Binary file
package/biome.json DELETED
@@ -1,33 +0,0 @@
1
- {
2
- "$schema": "https://biomejs.dev/schemas/2.4.10/schema.json",
3
- "formatter": {
4
- "enabled": true,
5
- "indentStyle": "space",
6
- "indentWidth": 2,
7
- "lineWidth": 120
8
- },
9
- "linter": {
10
- "enabled": true,
11
- "rules": {
12
- "style": {
13
- "noDescendingSpecificity": "off"
14
- },
15
- "suspicious": {
16
- "useIterableCallbackReturn": "off"
17
- }
18
- }
19
- },
20
- "javascript": {
21
- "formatter": {
22
- "quoteStyle": "single"
23
- }
24
- },
25
- "css": {
26
- "formatter": {
27
- "quoteStyle": "single"
28
- }
29
- },
30
- "files": {
31
- "includes": ["public/app.js", "public/style.css"]
32
- }
33
- }
Binary file
Binary file