@stackmemoryai/stackmemory 0.5.0 → 0.5.2

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 (51) hide show
  1. package/dist/cli/commands/config.js +81 -0
  2. package/dist/cli/commands/config.js.map +2 -2
  3. package/dist/cli/commands/decision.js +262 -0
  4. package/dist/cli/commands/decision.js.map +7 -0
  5. package/dist/cli/commands/handoff.js +87 -24
  6. package/dist/cli/commands/handoff.js.map +3 -3
  7. package/dist/cli/commands/service.js +684 -0
  8. package/dist/cli/commands/service.js.map +7 -0
  9. package/dist/cli/commands/sweep.js +311 -0
  10. package/dist/cli/commands/sweep.js.map +7 -0
  11. package/dist/cli/index.js +98 -4
  12. package/dist/cli/index.js.map +2 -2
  13. package/dist/cli/streamlined-cli.js +144 -0
  14. package/dist/cli/streamlined-cli.js.map +7 -0
  15. package/dist/core/config/storage-config.js +111 -0
  16. package/dist/core/config/storage-config.js.map +7 -0
  17. package/dist/core/events/event-bus.js +110 -0
  18. package/dist/core/events/event-bus.js.map +7 -0
  19. package/dist/core/plugins/plugin-interface.js +87 -0
  20. package/dist/core/plugins/plugin-interface.js.map +7 -0
  21. package/dist/core/session/enhanced-handoff.js +654 -0
  22. package/dist/core/session/enhanced-handoff.js.map +7 -0
  23. package/dist/core/storage/simplified-storage.js +328 -0
  24. package/dist/core/storage/simplified-storage.js.map +7 -0
  25. package/dist/daemon/session-daemon.js +308 -0
  26. package/dist/daemon/session-daemon.js.map +7 -0
  27. package/dist/plugins/linear/index.js +166 -0
  28. package/dist/plugins/linear/index.js.map +7 -0
  29. package/dist/plugins/loader.js +57 -0
  30. package/dist/plugins/loader.js.map +7 -0
  31. package/dist/plugins/plugin-interface.js +67 -0
  32. package/dist/plugins/plugin-interface.js.map +7 -0
  33. package/dist/plugins/ralph/simple-ralph-plugin.js +305 -0
  34. package/dist/plugins/ralph/simple-ralph-plugin.js.map +7 -0
  35. package/dist/plugins/ralph/use-cases/code-generator.js +151 -0
  36. package/dist/plugins/ralph/use-cases/code-generator.js.map +7 -0
  37. package/dist/plugins/ralph/use-cases/test-generator.js +201 -0
  38. package/dist/plugins/ralph/use-cases/test-generator.js.map +7 -0
  39. package/dist/skills/repo-ingestion-skill.js +54 -10
  40. package/dist/skills/repo-ingestion-skill.js.map +2 -2
  41. package/package.json +4 -8
  42. package/scripts/archive/check-all-duplicates.ts +2 -2
  43. package/scripts/archive/merge-linear-duplicates.ts +6 -4
  44. package/scripts/install-claude-hooks-auto.js +72 -15
  45. package/scripts/measure-handoff-impact.mjs +395 -0
  46. package/scripts/measure-handoff-impact.ts +450 -0
  47. package/templates/claude-hooks/on-startup.js +200 -19
  48. package/templates/services/com.stackmemory.guardian.plist +59 -0
  49. package/templates/services/stackmemory-guardian.service +41 -0
  50. package/scripts/testing/results/real-performance-results.json +0 -90
  51. package/scripts/testing/test-tier-migration.js +0 -100
@@ -0,0 +1,59 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <!--
4
+ StackMemory Guardian Service - macOS launchd configuration
5
+
6
+ This plist is generated dynamically during `stackmemory service install`.
7
+ Edit this template to customize the service behavior.
8
+
9
+ Installation location: ~/Library/LaunchAgents/com.stackmemory.guardian.plist
10
+ -->
11
+ <plist version="1.0">
12
+ <dict>
13
+ <!-- Service identifier -->
14
+ <key>Label</key>
15
+ <string>com.stackmemory.guardian</string>
16
+
17
+ <!-- Command to execute -->
18
+ <key>ProgramArguments</key>
19
+ <array>
20
+ <string>/usr/local/bin/node</string>
21
+ <string>$HOME/.stackmemory/guardian.js</string>
22
+ </array>
23
+
24
+ <!-- Start automatically on login -->
25
+ <key>RunAtLoad</key>
26
+ <true/>
27
+
28
+ <!-- Restart on failure -->
29
+ <key>KeepAlive</key>
30
+ <dict>
31
+ <key>SuccessfulExit</key>
32
+ <false/>
33
+ </dict>
34
+
35
+ <!-- Working directory -->
36
+ <key>WorkingDirectory</key>
37
+ <string>$HOME/.stackmemory</string>
38
+
39
+ <!-- Log output -->
40
+ <key>StandardOutPath</key>
41
+ <string>$HOME/.stackmemory/logs/guardian.log</string>
42
+
43
+ <key>StandardErrorPath</key>
44
+ <string>$HOME/.stackmemory/logs/guardian.error.log</string>
45
+
46
+ <!-- Environment variables -->
47
+ <key>EnvironmentVariables</key>
48
+ <dict>
49
+ <key>HOME</key>
50
+ <string>$HOME</string>
51
+ <key>PATH</key>
52
+ <string>/usr/local/bin:/usr/bin:/bin</string>
53
+ </dict>
54
+
55
+ <!-- Minimum time between restarts (seconds) -->
56
+ <key>ThrottleInterval</key>
57
+ <integer>30</integer>
58
+ </dict>
59
+ </plist>
@@ -0,0 +1,41 @@
1
+ # StackMemory Guardian Service - Linux systemd configuration
2
+ #
3
+ # This service file is generated dynamically during `stackmemory service install`.
4
+ # Edit this template to customize the service behavior.
5
+ #
6
+ # Installation location: ~/.config/systemd/user/stackmemory-guardian.service
7
+ #
8
+ # Manual commands:
9
+ # systemctl --user start stackmemory-guardian
10
+ # systemctl --user stop stackmemory-guardian
11
+ # systemctl --user status stackmemory-guardian
12
+ # journalctl --user -u stackmemory-guardian -f
13
+
14
+ [Unit]
15
+ Description=StackMemory Guardian Service
16
+ Documentation=https://github.com/stackmemoryai/stackmemory
17
+ After=network.target
18
+
19
+ [Service]
20
+ Type=simple
21
+
22
+ # Command to execute
23
+ ExecStart=/usr/bin/node $HOME/.stackmemory/guardian.js
24
+
25
+ # Restart on failure with 30 second delay
26
+ Restart=on-failure
27
+ RestartSec=30
28
+
29
+ # Working directory
30
+ WorkingDirectory=$HOME/.stackmemory
31
+
32
+ # Environment
33
+ Environment=HOME=$HOME
34
+ Environment=PATH=/usr/local/bin:/usr/bin:/bin
35
+
36
+ # Log output
37
+ StandardOutput=append:$HOME/.stackmemory/logs/guardian.log
38
+ StandardError=append:$HOME/.stackmemory/logs/guardian.error.log
39
+
40
+ [Install]
41
+ WantedBy=default.target
@@ -1,90 +0,0 @@
1
- {
2
- "timestamp": "2026-01-06T15:16:51.046Z",
3
- "tests": [
4
- {
5
- "test": "status_command",
6
- "iterations": 3,
7
- "measurements": [
8
- 393.8040000000001,
9
- 396.434667,
10
- 393.71524999999997
11
- ],
12
- "average": 394.6513056666667,
13
- "unit": "ms"
14
- },
15
- {
16
- "test": "context_operations",
17
- "operations": [
18
- {
19
- "operation": "version_check",
20
- "duration": 398.65762500000005,
21
- "success": true
22
- },
23
- {
24
- "operation": "tasks_list",
25
- "duration": 518.715792,
26
- "success": true
27
- }
28
- ],
29
- "totalTime": 917.373417,
30
- "unit": "ms"
31
- },
32
- {
33
- "test": "task_operations",
34
- "operations": [
35
- {
36
- "operation": "add_task",
37
- "duration": 518.383875,
38
- "success": true,
39
- "outputSize": 245
40
- },
41
- {
42
- "operation": "list_tasks",
43
- "duration": 526.2628340000001,
44
- "success": true,
45
- "outputSize": 2751
46
- },
47
- {
48
- "operation": "show_task",
49
- "duration": 395.6398339999996,
50
- "success": true,
51
- "outputSize": 92
52
- }
53
- ],
54
- "unit": "ms"
55
- },
56
- {
57
- "test": "storage_performance",
58
- "results": {
59
- "database": {
60
- "exists": true,
61
- "size": 602112,
62
- "sizeFormatted": "588.00 KB",
63
- "modified": "2026-01-06T15:16:54.814Z"
64
- },
65
- "tasks": {
66
- "exists": true,
67
- "size": 219410,
68
- "sizeFormatted": "214.27 KB",
69
- "lineCount": 249,
70
- "modified": "2026-01-06T15:16:54.286Z"
71
- }
72
- }
73
- },
74
- {
75
- "test": "baseline_comparison",
76
- "baseline": {
77
- "taskListing": {
78
- "withStackMemory": 501.72233400000005,
79
- "withoutStackMemory": 5000,
80
- "unit": "ms"
81
- },
82
- "taskCreation": {
83
- "withStackMemory": 500.09279100000003,
84
- "withoutStackMemory": 30000,
85
- "unit": "ms"
86
- }
87
- }
88
- }
89
- ]
90
- }
@@ -1,100 +0,0 @@
1
- #!/usr/bin/env node
2
- import 'dotenv/config';
3
- import Database from 'better-sqlite3';
4
- import { RailwayOptimizedStorage } from './dist/core/storage/railway-optimized-storage.js';
5
- import { ConfigManager } from './dist/core/config/config-manager.js';
6
- import { v4 as uuidv4 } from 'uuid';
7
-
8
- async function testTierMigration() {
9
- const db = new Database('.stackmemory/context.db');
10
- const configManager = new ConfigManager();
11
-
12
- // Create storage with shorter tier durations for testing
13
- const storage = new RailwayOptimizedStorage(db, configManager, {
14
- tiers: {
15
- hotHours: 0.001, // Very short for testing (3.6 seconds)
16
- warmDays: 0.0001, // Very short for testing (8.64 seconds)
17
- compressionScore: 0.5
18
- }
19
- });
20
-
21
- // Create a test trace
22
- const traceId = `test_${uuidv4()}`;
23
- const testTrace = {
24
- id: traceId,
25
- type: 'test',
26
- score: 0.7,
27
- summary: 'Test trace for tier migration',
28
- metadata: {
29
- startTime: Date.now() - 1000, // 1 second ago
30
- endTime: Date.now(),
31
- filesModified: ['test.js'],
32
- errorsEncountered: [],
33
- decisionsRecorded: [],
34
- causalChain: []
35
- },
36
- tools: [
37
- { tool: 'test', input: 'test input', output: 'test output' }
38
- ],
39
- compressed: false
40
- };
41
-
42
- console.log('📝 Creating test trace:', testTrace.id);
43
-
44
- // First, insert the trace into the traces table to satisfy foreign key
45
- db.prepare(`
46
- INSERT INTO traces (id, type, score, summary, start_time, end_time,
47
- files_modified, errors_encountered, decisions_recorded,
48
- causal_chain, compressed_data, created_at)
49
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
50
- `).run(
51
- traceId,
52
- 'test',
53
- 0.7,
54
- 'Test trace for tier migration',
55
- testTrace.metadata.startTime,
56
- testTrace.metadata.endTime,
57
- JSON.stringify(testTrace.metadata.filesModified),
58
- JSON.stringify(testTrace.metadata.errorsEncountered),
59
- JSON.stringify(testTrace.metadata.decisionsRecorded),
60
- testTrace.metadata.causalChain.length,
61
- JSON.stringify(testTrace),
62
- Date.now()
63
- );
64
-
65
- // Store the trace in storage tiers
66
- const tier = await storage.storeTrace(testTrace);
67
- console.log(`✅ Stored in ${tier} tier`);
68
-
69
- // Check storage location
70
- const location = db.prepare('SELECT * FROM storage_tiers WHERE trace_id = ?').get(testTrace.id);
71
- console.log('📍 Initial location:', location);
72
-
73
- // Wait a moment for the trace to age
74
- console.log('⏳ Waiting 5 seconds for trace to age...');
75
- await new Promise(resolve => setTimeout(resolve, 5000));
76
-
77
- // Trigger migration
78
- console.log('🔄 Triggering migration...');
79
- const results = await storage.migrateTiers();
80
- console.log('Migration results:', results);
81
-
82
- // Check new location
83
- const newLocation = db.prepare('SELECT * FROM storage_tiers WHERE trace_id = ?').get(testTrace.id);
84
- console.log('📍 New location:', newLocation);
85
-
86
- // Try to retrieve the trace
87
- console.log('🔍 Retrieving trace after migration...');
88
- const retrieved = await storage.retrieveTrace(testTrace.id);
89
- console.log('✅ Retrieved:', retrieved ? 'Success' : 'Failed');
90
-
91
- if (retrieved) {
92
- console.log(' ID matches:', retrieved.id === testTrace.id);
93
- console.log(' Summary matches:', retrieved.summary === testTrace.summary);
94
- }
95
-
96
- db.close();
97
- console.log('✨ Test complete!');
98
- }
99
-
100
- testTierMigration().catch(console.error);