claude-memory-layer 1.0.6 → 1.0.7

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,10 +1,10 @@
1
1
  {
2
2
  "name": "claude-memory-layer",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Claude Code plugin that learns from conversations to provide personalized assistance",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
7
- "code-memory": "dist/cli/index.js"
7
+ "claude-memory-layer": "dist/cli/index.js"
8
8
  },
9
9
  "type": "module",
10
10
  "scripts": {
@@ -33,6 +33,7 @@
33
33
  "@xenova/transformers": "^2.17.0",
34
34
  "commander": "^12.0.0",
35
35
  "duckdb": "^0.10.0",
36
+ "hono": "^4.0.0",
36
37
  "zod": "^3.22.0"
37
38
  },
38
39
  "devDependencies": {
package/scripts/build.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Build script for code-memory plugin
2
+ * Build script for claude-memory-layer plugin
3
3
  * Uses esbuild for fast bundling
4
4
  */
5
5
 
@@ -27,7 +27,11 @@ const commonOptions: esbuild.BuildOptions = {
27
27
  '@xenova/transformers',
28
28
  'duckdb',
29
29
  'commander',
30
- 'zod'
30
+ 'zod',
31
+ 'hono',
32
+ 'hono/cors',
33
+ 'hono/logger',
34
+ 'hono/bun'
31
35
  ],
32
36
  banner: {
33
37
  js: `import { createRequire } from 'module';
@@ -40,7 +44,7 @@ const __dirname = dirname(__filename);`
40
44
  };
41
45
 
42
46
  async function build() {
43
- console.log('šŸ”Ø Building code-memory plugin...\n');
47
+ console.log('šŸ”Ø Building claude-memory-layer plugin...\n');
44
48
 
45
49
  // Build CLI
46
50
  console.log('šŸ“¦ Building CLI...');
@@ -83,16 +87,41 @@ async function build() {
83
87
  outfile: 'dist/services/memory-service.js'
84
88
  });
85
89
 
90
+ // Build server
91
+ console.log('šŸ“¦ Building server...');
92
+ await esbuild.build({
93
+ ...commonOptions,
94
+ entryPoints: ['src/server/index.ts'],
95
+ outfile: 'dist/server/index.js',
96
+ external: [...(commonOptions.external || []), 'hono']
97
+ });
98
+
99
+ // Build server API
100
+ await esbuild.build({
101
+ ...commonOptions,
102
+ entryPoints: ['src/server/api/index.ts'],
103
+ outfile: 'dist/server/api/index.js',
104
+ external: [...(commonOptions.external || []), 'hono']
105
+ });
106
+
86
107
  // Copy plugin manifest
87
108
  console.log('šŸ“‹ Copying plugin files...');
88
109
  fs.cpSync('.claude-plugin', path.join(outdir, '.claude-plugin'), { recursive: true });
89
110
 
111
+ // Copy UI files
112
+ console.log('šŸ“‹ Copying UI files...');
113
+ if (fs.existsSync('src/ui')) {
114
+ fs.cpSync('src/ui', path.join(outdir, 'ui'), { recursive: true });
115
+ }
116
+
90
117
  console.log('\nāœ… Build complete!');
91
118
  console.log(`\nOutput: ${outdir}/`);
92
119
  console.log(' - cli/index.js');
93
120
  console.log(' - hooks/*.js');
94
121
  console.log(' - core/index.js');
95
122
  console.log(' - services/memory-service.js');
123
+ console.log(' - server/index.js');
124
+ console.log(' - ui/index.html');
96
125
  console.log(' - .claude-plugin/');
97
126
  }
98
127
 
package/src/cli/index.ts CHANGED
@@ -5,16 +5,18 @@
5
5
  */
6
6
 
7
7
  import { Command } from 'commander';
8
+ import { exec } from 'child_process';
8
9
  import {
9
10
  getDefaultMemoryService,
10
11
  getMemoryServiceForProject
11
12
  } from '../services/memory-service.js';
12
13
  import { createSessionHistoryImporter } from '../services/session-history-importer.js';
14
+ import { startServer, stopServer, isServerRunning } from '../server/index.js';
13
15
 
14
16
  const program = new Command();
15
17
 
16
18
  program
17
- .name('code-memory')
19
+ .name('claude-memory-layer')
18
20
  .description('Claude Code Memory Plugin CLI')
19
21
  .version('1.0.0');
20
22
 
@@ -349,7 +351,7 @@ program
349
351
  console.log(`... and ${sessions.length - 20} more sessions`);
350
352
  }
351
353
 
352
- console.log('\nUse "code-memory import --session <path>" to import a specific session');
354
+ console.log('\nUse "claude-memory-layer import --session <path>" to import a specific session');
353
355
  } catch (error) {
354
356
  console.error('List failed:', error);
355
357
  process.exit(1);
@@ -389,7 +391,7 @@ endlessCmd
389
391
  console.log(' - Working Set: Recent context kept active');
390
392
  console.log(' - Consolidation: Automatic memory integration');
391
393
  console.log(' - Continuity: Seamless context transitions\n');
392
- console.log('Use "code-memory endless status" to view current state');
394
+ console.log('Use "claude-memory-layer endless status" to view current state');
393
395
 
394
396
  await service.shutdown();
395
397
  } catch (error) {
@@ -462,7 +464,7 @@ endlessCmd
462
464
  }
463
465
  } else {
464
466
  console.log('Endless Mode is disabled.');
465
- console.log('Use "code-memory endless enable" to activate.');
467
+ console.log('Use "claude-memory-layer endless enable" to activate.');
466
468
  }
467
469
 
468
470
  await service.shutdown();
@@ -488,7 +490,7 @@ endlessCmd
488
490
 
489
491
  if (!service.isEndlessModeActive()) {
490
492
  console.log('\nāš ļø Endless Mode is not active');
491
- console.log('Use "code-memory endless enable" first');
493
+ console.log('Use "claude-memory-layer endless enable" first');
492
494
  process.exit(1);
493
495
  }
494
496
 
@@ -527,7 +529,7 @@ endlessCmd
527
529
 
528
530
  if (!service.isEndlessModeActive()) {
529
531
  console.log('\nāš ļø Endless Mode is not active');
530
- console.log('Use "code-memory endless enable" first');
532
+ console.log('Use "claude-memory-layer endless enable" first');
531
533
  process.exit(1);
532
534
  }
533
535
 
@@ -628,4 +630,81 @@ endlessCmd
628
630
  }
629
631
  });
630
632
 
633
+ /**
634
+ * Dashboard command - start web dashboard
635
+ */
636
+ program
637
+ .command('dashboard')
638
+ .description('Open memory dashboard in browser')
639
+ .option('-p, --port <port>', 'Server port', '37777')
640
+ .option('--no-open', 'Do not auto-open browser')
641
+ .action(async (options) => {
642
+ const port = parseInt(options.port, 10);
643
+
644
+ try {
645
+ // Check if server is already running
646
+ const running = await isServerRunning(port);
647
+ if (running) {
648
+ console.log(`\n🧠 Dashboard already running at http://localhost:${port}\n`);
649
+ if (options.open) {
650
+ openBrowser(`http://localhost:${port}`);
651
+ }
652
+ return;
653
+ }
654
+
655
+ // Start the server
656
+ console.log('\n🧠 Starting Code Memory Dashboard...\n');
657
+ startServer(port);
658
+
659
+ // Open browser
660
+ if (options.open) {
661
+ setTimeout(() => {
662
+ openBrowser(`http://localhost:${port}`);
663
+ }, 500);
664
+ }
665
+
666
+ console.log(`\nšŸ“Š Dashboard: http://localhost:${port}`);
667
+ console.log('Press Ctrl+C to stop the server\n');
668
+
669
+ // Handle graceful shutdown
670
+ const shutdown = () => {
671
+ console.log('\n\nšŸ‘‹ Shutting down dashboard...');
672
+ stopServer();
673
+ process.exit(0);
674
+ };
675
+
676
+ process.on('SIGINT', shutdown);
677
+ process.on('SIGTERM', shutdown);
678
+
679
+ // Keep process alive
680
+ await new Promise(() => {});
681
+ } catch (error) {
682
+ console.error('Dashboard failed:', error);
683
+ process.exit(1);
684
+ }
685
+ });
686
+
687
+ /**
688
+ * Open URL in default browser
689
+ */
690
+ function openBrowser(url: string): void {
691
+ const platform = process.platform;
692
+ let command: string;
693
+
694
+ if (platform === 'darwin') {
695
+ command = `open "${url}"`;
696
+ } else if (platform === 'win32') {
697
+ command = `start "" "${url}"`;
698
+ } else {
699
+ command = `xdg-open "${url}"`;
700
+ }
701
+
702
+ exec(command, (error) => {
703
+ if (error) {
704
+ console.log(`\nāš ļø Could not open browser automatically.`);
705
+ console.log(` Please open ${url} manually.\n`);
706
+ }
707
+ });
708
+ }
709
+
631
710
  program.parse();
package/src/core/types.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Core types for code-memory plugin
2
+ * Core types for claude-memory-layer plugin
3
3
  * Idris2 inspired: Complete, immutable type definitions with Zod validation
4
4
  */
5
5
 
package/src/mcp/index.ts CHANGED
@@ -16,7 +16,7 @@ import { handleToolCall } from './handlers.js';
16
16
 
17
17
  const server = new Server(
18
18
  {
19
- name: 'code-memory-mcp',
19
+ name: 'claude-memory-layer-mcp',
20
20
  version: '1.0.0'
21
21
  },
22
22
  {
@@ -41,7 +41,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
41
41
  async function main() {
42
42
  const transport = new StdioServerTransport();
43
43
  await server.connect(transport);
44
- console.error('code-memory MCP server started');
44
+ console.error('claude-memory-layer MCP server started');
45
45
  }
46
46
 
47
47
  main().catch(console.error);
package/src/mcp/tools.ts CHANGED
@@ -8,7 +8,7 @@ import type { Tool } from '@modelcontextprotocol/sdk/types.js';
8
8
  export const tools: Tool[] = [
9
9
  {
10
10
  name: 'mem-search',
11
- description: 'Search code-memory for relevant past conversations and insights. Returns a compact index of results - use mem-details to get full content.',
11
+ description: 'Search claude-memory-layer for relevant past conversations and insights. Returns a compact index of results - use mem-details to get full content.',
12
12
  inputSchema: {
13
13
  type: 'object',
14
14
  properties: {
@@ -4,10 +4,63 @@
4
4
  */
5
5
 
6
6
  import { Hono } from 'hono';
7
- import { getDefaultMemoryService } from '../../services/memory-service.js';
7
+ import { getDefaultMemoryService, getMemoryServiceForProject } from '../../services/memory-service.js';
8
8
 
9
9
  export const statsRouter = new Hono();
10
10
 
11
+ // GET /api/stats/shared - Get shared store statistics
12
+ statsRouter.get('/shared', async (c) => {
13
+ try {
14
+ const memoryService = getDefaultMemoryService();
15
+ await memoryService.initialize();
16
+
17
+ const sharedStats = await memoryService.getSharedStoreStats();
18
+
19
+ return c.json({
20
+ troubleshooting: sharedStats?.troubleshooting || 0,
21
+ bestPractices: sharedStats?.bestPractices || 0,
22
+ commonErrors: sharedStats?.commonErrors || 0,
23
+ totalUsageCount: sharedStats?.totalUsageCount || 0,
24
+ lastUpdated: sharedStats?.lastUpdated || null
25
+ });
26
+ } catch (error) {
27
+ return c.json({
28
+ troubleshooting: 0,
29
+ bestPractices: 0,
30
+ commonErrors: 0,
31
+ totalUsageCount: 0,
32
+ lastUpdated: null
33
+ });
34
+ }
35
+ });
36
+
37
+ // GET /api/stats/endless - Get endless mode status
38
+ statsRouter.get('/endless', async (c) => {
39
+ try {
40
+ const projectPath = c.req.query('project') || process.cwd();
41
+ const memoryService = getMemoryServiceForProject(projectPath);
42
+ await memoryService.initialize();
43
+
44
+ const status = await memoryService.getEndlessModeStatus();
45
+
46
+ return c.json({
47
+ mode: status.mode,
48
+ continuityScore: status.continuityScore,
49
+ workingSetSize: status.workingSetSize,
50
+ consolidatedCount: status.consolidatedCount,
51
+ lastConsolidation: status.lastConsolidation?.toISOString() || null
52
+ });
53
+ } catch (error) {
54
+ return c.json({
55
+ mode: 'session',
56
+ continuityScore: 0,
57
+ workingSetSize: 0,
58
+ consolidatedCount: 0,
59
+ lastConsolidation: null
60
+ });
61
+ }
62
+ });
63
+
11
64
  // GET /api/stats - Get overall statistics
12
65
  statsRouter.get('/', async (c) => {
13
66
  try {