@stackmemoryai/stackmemory 0.5.59 → 0.5.62
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/README.md +105 -1
- package/dist/scripts/initialize.js +68 -1
- package/dist/scripts/initialize.js.map +2 -2
- package/dist/src/cli/claude-sm.js +130 -50
- package/dist/src/cli/claude-sm.js.map +2 -2
- package/dist/src/cli/index.js +18 -3
- package/dist/src/cli/index.js.map +3 -3
- package/dist/src/core/extensions/custom-tools.js +567 -0
- package/dist/src/core/extensions/custom-tools.js.map +7 -0
- package/dist/src/core/extensions/index.js +55 -0
- package/dist/src/core/extensions/index.js.map +7 -0
- package/dist/src/core/extensions/loader.js +709 -0
- package/dist/src/core/extensions/loader.js.map +7 -0
- package/dist/src/core/extensions/plugin-system.js +506 -0
- package/dist/src/core/extensions/plugin-system.js.map +7 -0
- package/dist/src/core/extensions/provider-adapter.js +617 -0
- package/dist/src/core/extensions/provider-adapter.js.map +7 -0
- package/dist/src/core/extensions/sandbox-runtime.js +664 -0
- package/dist/src/core/extensions/sandbox-runtime.js.map +7 -0
- package/dist/src/core/retrieval/index.js +2 -0
- package/dist/src/core/retrieval/index.js.map +2 -2
- package/dist/src/core/retrieval/privacy-filter.js +129 -0
- package/dist/src/core/retrieval/privacy-filter.js.map +7 -0
- package/dist/src/core/retrieval/unified-context-assembler.js +273 -0
- package/dist/src/core/retrieval/unified-context-assembler.js.map +7 -0
- package/dist/src/core/storage/chromadb-adapter.js +32 -6
- package/dist/src/core/storage/chromadb-adapter.js.map +2 -2
- package/dist/src/hooks/diffmem-hooks.js +377 -0
- package/dist/src/hooks/diffmem-hooks.js.map +7 -0
- package/dist/src/integrations/diffmem/client.js +209 -0
- package/dist/src/integrations/diffmem/client.js.map +7 -0
- package/dist/src/integrations/diffmem/config.js +15 -0
- package/dist/src/integrations/diffmem/config.js.map +7 -0
- package/dist/{core/session → src/integrations/diffmem}/index.js +5 -8
- package/dist/src/integrations/diffmem/index.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/diffmem-handlers.js +456 -0
- package/dist/src/integrations/mcp/handlers/diffmem-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/server.js +121 -0
- package/dist/src/integrations/mcp/server.js.map +2 -2
- package/dist/src/skills/repo-ingestion-skill.js +35 -12
- package/dist/src/skills/repo-ingestion-skill.js.map +2 -2
- package/package.json +13 -7
- package/scripts/background-sync-manager.js +145 -83
- package/scripts/claude-sm-autostart.js +17 -12
- package/scripts/gepa/README.md +275 -0
- package/scripts/gepa/config.json +53 -0
- package/scripts/gepa/evals/coding-tasks.jsonl +5 -0
- package/scripts/gepa/evals/fixtures/buggy-loop.js +18 -0
- package/scripts/gepa/evals/fixtures/callback-hell.js +53 -0
- package/scripts/gepa/generations/gen-000/baseline.md +124 -0
- package/scripts/gepa/hooks/auto-optimize.js +494 -0
- package/scripts/gepa/hooks/eval-tracker.js +203 -0
- package/scripts/gepa/hooks/reflect.js +311 -0
- package/scripts/gepa/optimize.js +611 -0
- package/scripts/gepa/state.json +14 -0
- package/scripts/initialize.ts +83 -1
- package/scripts/test-pre-publish-quick.sh +1 -1
- package/dist/agents/core/agent-task-manager.js +0 -527
- package/dist/agents/core/agent-task-manager.js.map +0 -7
- package/dist/agents/testing-agent.js +0 -614
- package/dist/agents/testing-agent.js.map +0 -7
- package/dist/agents/verifiers/base-verifier.js +0 -133
- package/dist/agents/verifiers/base-verifier.js.map +0 -7
- package/dist/agents/verifiers/formatter-verifier.js +0 -130
- package/dist/agents/verifiers/formatter-verifier.js.map +0 -7
- package/dist/agents/verifiers/llm-judge.js +0 -252
- package/dist/agents/verifiers/llm-judge.js.map +0 -7
- package/dist/cli/auto-detect.js +0 -321
- package/dist/cli/auto-detect.js.map +0 -7
- package/dist/cli/browser-test.js +0 -33
- package/dist/cli/browser-test.js.map +0 -7
- package/dist/cli/claude-sm-danger.js +0 -21
- package/dist/cli/claude-sm-danger.js.map +0 -7
- package/dist/cli/claude-sm.js +0 -1156
- package/dist/cli/claude-sm.js.map +0 -7
- package/dist/cli/codex-sm-danger.js +0 -21
- package/dist/cli/codex-sm-danger.js.map +0 -7
- package/dist/cli/codex-sm.js +0 -349
- package/dist/cli/codex-sm.js.map +0 -7
- package/dist/cli/commands/api.js +0 -232
- package/dist/cli/commands/api.js.map +0 -7
- package/dist/cli/commands/auto-background.js +0 -180
- package/dist/cli/commands/auto-background.js.map +0 -7
- package/dist/cli/commands/cleanup-processes.js +0 -68
- package/dist/cli/commands/cleanup-processes.js.map +0 -7
- package/dist/cli/commands/clear.js +0 -202
- package/dist/cli/commands/clear.js.map +0 -7
- package/dist/cli/commands/config.js +0 -445
- package/dist/cli/commands/config.js.map +0 -7
- package/dist/cli/commands/context-rehydrate.js +0 -751
- package/dist/cli/commands/context-rehydrate.js.map +0 -7
- package/dist/cli/commands/context.js +0 -343
- package/dist/cli/commands/context.js.map +0 -7
- package/dist/cli/commands/daemon.js +0 -392
- package/dist/cli/commands/daemon.js.map +0 -7
- package/dist/cli/commands/dashboard.js +0 -210
- package/dist/cli/commands/dashboard.js.map +0 -7
- package/dist/cli/commands/db.js +0 -147
- package/dist/cli/commands/db.js.map +0 -7
- package/dist/cli/commands/decision.js +0 -266
- package/dist/cli/commands/decision.js.map +0 -7
- package/dist/cli/commands/discovery.js +0 -279
- package/dist/cli/commands/discovery.js.map +0 -7
- package/dist/cli/commands/handoff.js +0 -624
- package/dist/cli/commands/handoff.js.map +0 -7
- package/dist/cli/commands/hooks.js +0 -298
- package/dist/cli/commands/hooks.js.map +0 -7
- package/dist/cli/commands/linear-unified.js +0 -353
- package/dist/cli/commands/linear-unified.js.map +0 -7
- package/dist/cli/commands/linear.js +0 -529
- package/dist/cli/commands/linear.js.map +0 -7
- package/dist/cli/commands/log.js +0 -169
- package/dist/cli/commands/log.js.map +0 -7
- package/dist/cli/commands/login.js +0 -172
- package/dist/cli/commands/login.js.map +0 -7
- package/dist/cli/commands/migrate.js +0 -240
- package/dist/cli/commands/migrate.js.map +0 -7
- package/dist/cli/commands/model.js +0 -533
- package/dist/cli/commands/model.js.map +0 -7
- package/dist/cli/commands/monitor.js +0 -313
- package/dist/cli/commands/monitor.js.map +0 -7
- package/dist/cli/commands/onboard.js +0 -536
- package/dist/cli/commands/onboard.js.map +0 -7
- package/dist/cli/commands/projects.js +0 -199
- package/dist/cli/commands/projects.js.map +0 -7
- package/dist/cli/commands/quality.js +0 -413
- package/dist/cli/commands/quality.js.map +0 -7
- package/dist/cli/commands/ralph.js +0 -909
- package/dist/cli/commands/ralph.js.map +0 -7
- package/dist/cli/commands/retrieval.js +0 -248
- package/dist/cli/commands/retrieval.js.map +0 -7
- package/dist/cli/commands/search.js +0 -173
- package/dist/cli/commands/search.js.map +0 -7
- package/dist/cli/commands/service.js +0 -749
- package/dist/cli/commands/service.js.map +0 -7
- package/dist/cli/commands/session.js +0 -200
- package/dist/cli/commands/session.js.map +0 -7
- package/dist/cli/commands/settings.js +0 -306
- package/dist/cli/commands/settings.js.map +0 -7
- package/dist/cli/commands/setup.js +0 -701
- package/dist/cli/commands/setup.js.map +0 -7
- package/dist/cli/commands/shell.js +0 -249
- package/dist/cli/commands/shell.js.map +0 -7
- package/dist/cli/commands/signup.js +0 -50
- package/dist/cli/commands/signup.js.map +0 -7
- package/dist/cli/commands/skills.js +0 -470
- package/dist/cli/commands/skills.js.map +0 -7
- package/dist/cli/commands/sms-notify.js +0 -795
- package/dist/cli/commands/sms-notify.js.map +0 -7
- package/dist/cli/commands/storage-tier.js +0 -183
- package/dist/cli/commands/storage-tier.js.map +0 -7
- package/dist/cli/commands/storage.js +0 -360
- package/dist/cli/commands/storage.js.map +0 -7
- package/dist/cli/commands/sweep.js +0 -249
- package/dist/cli/commands/sweep.js.map +0 -7
- package/dist/cli/commands/tasks.js +0 -213
- package/dist/cli/commands/tasks.js.map +0 -7
- package/dist/cli/commands/test.js +0 -286
- package/dist/cli/commands/test.js.map +0 -7
- package/dist/cli/commands/workflow.js +0 -142
- package/dist/cli/commands/workflow.js.map +0 -7
- package/dist/cli/commands/worktree.js +0 -319
- package/dist/cli/commands/worktree.js.map +0 -7
- package/dist/cli/index.js +0 -594
- package/dist/cli/index.js.map +0 -7
- package/dist/cli/opencode-sm.js +0 -448
- package/dist/cli/opencode-sm.js.map +0 -7
- package/dist/cli/utils/viewer.js +0 -96
- package/dist/cli/utils/viewer.js.map +0 -7
- package/dist/core/analytics/team-analytics.js +0 -378
- package/dist/core/analytics/team-analytics.js.map +0 -7
- package/dist/core/config/config-manager.js +0 -398
- package/dist/core/config/config-manager.js.map +0 -7
- package/dist/core/config/feature-flags.js +0 -76
- package/dist/core/config/feature-flags.js.map +0 -7
- package/dist/core/config/storage-config.js +0 -115
- package/dist/core/config/storage-config.js.map +0 -7
- package/dist/core/config/types.js +0 -144
- package/dist/core/config/types.js.map +0 -7
- package/dist/core/context/auto-context.js +0 -80
- package/dist/core/context/auto-context.js.map +0 -7
- package/dist/core/context/dual-stack-manager.js +0 -870
- package/dist/core/context/dual-stack-manager.js.map +0 -7
- package/dist/core/context/enhanced-rehydration.js +0 -994
- package/dist/core/context/enhanced-rehydration.js.map +0 -7
- package/dist/core/context/frame-database.js +0 -479
- package/dist/core/context/frame-database.js.map +0 -7
- package/dist/core/context/frame-digest.js +0 -250
- package/dist/core/context/frame-digest.js.map +0 -7
- package/dist/core/context/frame-handoff-manager.js +0 -778
- package/dist/core/context/frame-handoff-manager.js.map +0 -7
- package/dist/core/context/frame-lifecycle-hooks.js +0 -119
- package/dist/core/context/frame-lifecycle-hooks.js.map +0 -7
- package/dist/core/context/frame-manager.js +0 -1069
- package/dist/core/context/frame-manager.js.map +0 -7
- package/dist/core/context/frame-recovery.js +0 -302
- package/dist/core/context/frame-recovery.js.map +0 -7
- package/dist/core/context/frame-stack.js +0 -314
- package/dist/core/context/frame-stack.js.map +0 -7
- package/dist/core/context/frame-types.js +0 -5
- package/dist/core/context/frame-types.js.map +0 -7
- package/dist/core/context/incremental-gc.js +0 -290
- package/dist/core/context/incremental-gc.js.map +0 -7
- package/dist/core/context/index.js +0 -25
- package/dist/core/context/index.js.map +0 -7
- package/dist/core/context/model-aware-compaction.js +0 -623
- package/dist/core/context/model-aware-compaction.js.map +0 -7
- package/dist/core/context/permission-manager.js +0 -185
- package/dist/core/context/permission-manager.js.map +0 -7
- package/dist/core/context/recursive-context-manager.js +0 -592
- package/dist/core/context/recursive-context-manager.js.map +0 -7
- package/dist/core/context/refactored-frame-manager.js +0 -754
- package/dist/core/context/refactored-frame-manager.js.map +0 -7
- package/dist/core/context/shared-context-layer.js +0 -621
- package/dist/core/context/shared-context-layer.js.map +0 -7
- package/dist/core/context/stack-merge-resolver.js +0 -749
- package/dist/core/context/stack-merge-resolver.js.map +0 -7
- package/dist/core/context/validation.js +0 -130
- package/dist/core/context/validation.js.map +0 -7
- package/dist/core/database/batch-operations.js +0 -384
- package/dist/core/database/batch-operations.js.map +0 -7
- package/dist/core/database/connection-pool.js +0 -330
- package/dist/core/database/connection-pool.js.map +0 -7
- package/dist/core/database/database-adapter.js +0 -60
- package/dist/core/database/database-adapter.js.map +0 -7
- package/dist/core/database/migration-manager.js +0 -614
- package/dist/core/database/migration-manager.js.map +0 -7
- package/dist/core/database/paradedb-adapter.js +0 -990
- package/dist/core/database/paradedb-adapter.js.map +0 -7
- package/dist/core/database/query-cache.js +0 -298
- package/dist/core/database/query-cache.js.map +0 -7
- package/dist/core/database/query-router.js +0 -430
- package/dist/core/database/query-router.js.map +0 -7
- package/dist/core/database/sqlite-adapter.js +0 -738
- package/dist/core/database/sqlite-adapter.js.map +0 -7
- package/dist/core/digest/enhanced-hybrid-digest.js +0 -277
- package/dist/core/digest/enhanced-hybrid-digest.js.map +0 -7
- package/dist/core/digest/frame-digest-integration.js +0 -176
- package/dist/core/digest/frame-digest-integration.js.map +0 -7
- package/dist/core/digest/hybrid-digest-generator.js +0 -553
- package/dist/core/digest/hybrid-digest-generator.js.map +0 -7
- package/dist/core/digest/index.js +0 -9
- package/dist/core/digest/index.js.map +0 -7
- package/dist/core/digest/types.js +0 -25
- package/dist/core/digest/types.js.map +0 -7
- package/dist/core/errors/error-utils.js +0 -208
- package/dist/core/errors/error-utils.js.map +0 -7
- package/dist/core/errors/index.js +0 -521
- package/dist/core/errors/index.js.map +0 -7
- package/dist/core/errors/recovery.js +0 -269
- package/dist/core/errors/recovery.js.map +0 -7
- package/dist/core/execution/parallel-executor.js +0 -258
- package/dist/core/execution/parallel-executor.js.map +0 -7
- package/dist/core/frame/workflow-templates.js +0 -319
- package/dist/core/frame/workflow-templates.js.map +0 -7
- package/dist/core/merge/conflict-detector.js +0 -431
- package/dist/core/merge/conflict-detector.js.map +0 -7
- package/dist/core/merge/index.js +0 -9
- package/dist/core/merge/index.js.map +0 -7
- package/dist/core/merge/resolution-engine.js +0 -558
- package/dist/core/merge/resolution-engine.js.map +0 -7
- package/dist/core/merge/stack-diff.js +0 -532
- package/dist/core/merge/stack-diff.js.map +0 -7
- package/dist/core/merge/unified-merge-resolver.js +0 -303
- package/dist/core/merge/unified-merge-resolver.js.map +0 -7
- package/dist/core/models/fallback-monitor.js +0 -232
- package/dist/core/models/fallback-monitor.js.map +0 -7
- package/dist/core/models/model-router.js +0 -340
- package/dist/core/models/model-router.js.map +0 -7
- package/dist/core/monitoring/error-handler.js +0 -49
- package/dist/core/monitoring/error-handler.js.map +0 -7
- package/dist/core/monitoring/logger.js +0 -202
- package/dist/core/monitoring/logger.js.map +0 -7
- package/dist/core/monitoring/metrics.js +0 -172
- package/dist/core/monitoring/metrics.js.map +0 -7
- package/dist/core/monitoring/progress-tracker.js +0 -189
- package/dist/core/monitoring/progress-tracker.js.map +0 -7
- package/dist/core/monitoring/session-monitor.js +0 -300
- package/dist/core/monitoring/session-monitor.js.map +0 -7
- package/dist/core/performance/context-cache.js +0 -273
- package/dist/core/performance/context-cache.js.map +0 -7
- package/dist/core/performance/index.js +0 -11
- package/dist/core/performance/index.js.map +0 -7
- package/dist/core/performance/lazy-context-loader.js +0 -327
- package/dist/core/performance/lazy-context-loader.js.map +0 -7
- package/dist/core/performance/monitor.js +0 -221
- package/dist/core/performance/monitor.js.map +0 -7
- package/dist/core/performance/optimized-frame-context.js +0 -345
- package/dist/core/performance/optimized-frame-context.js.map +0 -7
- package/dist/core/performance/performance-benchmark.js +0 -277
- package/dist/core/performance/performance-benchmark.js.map +0 -7
- package/dist/core/performance/performance-profiler.js +0 -370
- package/dist/core/performance/performance-profiler.js.map +0 -7
- package/dist/core/performance/streaming-jsonl-parser.js +0 -195
- package/dist/core/performance/streaming-jsonl-parser.js.map +0 -7
- package/dist/core/persistence/postgres-adapter.js +0 -349
- package/dist/core/persistence/postgres-adapter.js.map +0 -7
- package/dist/core/projects/project-isolation.js +0 -201
- package/dist/core/projects/project-isolation.js.map +0 -7
- package/dist/core/projects/project-manager.js +0 -697
- package/dist/core/projects/project-manager.js.map +0 -7
- package/dist/core/query/query-parser.js +0 -370
- package/dist/core/query/query-parser.js.map +0 -7
- package/dist/core/query/query-templates.js +0 -321
- package/dist/core/query/query-templates.js.map +0 -7
- package/dist/core/retrieval/context-retriever.js +0 -479
- package/dist/core/retrieval/context-retriever.js.map +0 -7
- package/dist/core/retrieval/graph-retrieval.js +0 -662
- package/dist/core/retrieval/graph-retrieval.js.map +0 -7
- package/dist/core/retrieval/hierarchical-retrieval.js +0 -656
- package/dist/core/retrieval/hierarchical-retrieval.js.map +0 -7
- package/dist/core/retrieval/index.js +0 -8
- package/dist/core/retrieval/index.js.map +0 -7
- package/dist/core/retrieval/llm-context-retrieval.js +0 -613
- package/dist/core/retrieval/llm-context-retrieval.js.map +0 -7
- package/dist/core/retrieval/llm-provider.js +0 -151
- package/dist/core/retrieval/llm-provider.js.map +0 -7
- package/dist/core/retrieval/retrieval-audit.js +0 -236
- package/dist/core/retrieval/retrieval-audit.js.map +0 -7
- package/dist/core/retrieval/retrieval-benchmarks.js +0 -521
- package/dist/core/retrieval/retrieval-benchmarks.js.map +0 -7
- package/dist/core/retrieval/summary-generator.js +0 -589
- package/dist/core/retrieval/summary-generator.js.map +0 -7
- package/dist/core/retrieval/types.js +0 -21
- package/dist/core/retrieval/types.js.map +0 -7
- package/dist/core/security/index.js +0 -35
- package/dist/core/security/index.js.map +0 -7
- package/dist/core/security/input-sanitizer.js +0 -321
- package/dist/core/security/input-sanitizer.js.map +0 -7
- package/dist/core/session/clear-survival.js +0 -465
- package/dist/core/session/clear-survival.js.map +0 -7
- package/dist/core/session/enhanced-handoff.js +0 -792
- package/dist/core/session/enhanced-handoff.js.map +0 -7
- package/dist/core/session/handoff-generator.js +0 -343
- package/dist/core/session/handoff-generator.js.map +0 -7
- package/dist/core/session/index.js.map +0 -7
- package/dist/core/session/session-manager.js +0 -347
- package/dist/core/session/session-manager.js.map +0 -7
- package/dist/core/skills/index.js +0 -7
- package/dist/core/skills/index.js.map +0 -7
- package/dist/core/skills/skill-storage.js +0 -764
- package/dist/core/skills/skill-storage.js.map +0 -7
- package/dist/core/skills/types.js +0 -193
- package/dist/core/skills/types.js.map +0 -7
- package/dist/core/storage/chromadb-adapter.js +0 -354
- package/dist/core/storage/chromadb-adapter.js.map +0 -7
- package/dist/core/storage/infinite-storage.js +0 -510
- package/dist/core/storage/infinite-storage.js.map +0 -7
- package/dist/core/storage/railway-optimized-storage.js +0 -591
- package/dist/core/storage/railway-optimized-storage.js.map +0 -7
- package/dist/core/storage/remote-storage.js +0 -489
- package/dist/core/storage/remote-storage.js.map +0 -7
- package/dist/core/storage/two-tier-storage.js +0 -766
- package/dist/core/storage/two-tier-storage.js.map +0 -7
- package/dist/core/trace/cli-trace-wrapper.js +0 -132
- package/dist/core/trace/cli-trace-wrapper.js.map +0 -7
- package/dist/core/trace/db-trace-wrapper.js +0 -247
- package/dist/core/trace/db-trace-wrapper.js.map +0 -7
- package/dist/core/trace/debug-trace.js +0 -417
- package/dist/core/trace/debug-trace.js.map +0 -7
- package/dist/core/trace/index.js +0 -109
- package/dist/core/trace/index.js.map +0 -7
- package/dist/core/trace/linear-api-wrapper.js +0 -178
- package/dist/core/trace/linear-api-wrapper.js.map +0 -7
- package/dist/core/trace/trace-demo.js +0 -154
- package/dist/core/trace/trace-demo.js.map +0 -7
- package/dist/core/trace/trace-detector.demo.js +0 -142
- package/dist/core/trace/trace-detector.demo.js.map +0 -7
- package/dist/core/trace/trace-detector.js +0 -528
- package/dist/core/trace/trace-detector.js.map +0 -7
- package/dist/core/trace/trace-store.js +0 -345
- package/dist/core/trace/trace-store.js.map +0 -7
- package/dist/core/trace/types.js +0 -77
- package/dist/core/trace/types.js.map +0 -7
- package/dist/core/utils/async-mutex.js +0 -114
- package/dist/core/utils/async-mutex.js.map +0 -7
- package/dist/core/utils/compression.js +0 -83
- package/dist/core/utils/compression.js.map +0 -7
- package/dist/core/utils/update-checker.js +0 -218
- package/dist/core/utils/update-checker.js.map +0 -7
- package/dist/core/worktree/worktree-manager.js +0 -465
- package/dist/core/worktree/worktree-manager.js.map +0 -7
- package/dist/daemon/daemon-config.js +0 -149
- package/dist/daemon/daemon-config.js.map +0 -7
- package/dist/daemon/services/context-service.js +0 -122
- package/dist/daemon/services/context-service.js.map +0 -7
- package/dist/daemon/services/linear-service.js +0 -136
- package/dist/daemon/services/linear-service.js.map +0 -7
- package/dist/daemon/session-daemon.js +0 -312
- package/dist/daemon/session-daemon.js.map +0 -7
- package/dist/daemon/unified-daemon.js +0 -276
- package/dist/daemon/unified-daemon.js.map +0 -7
- package/dist/features/analytics/api/analytics-api.js +0 -287
- package/dist/features/analytics/api/analytics-api.js.map +0 -7
- package/dist/features/analytics/core/analytics-service.js +0 -282
- package/dist/features/analytics/core/analytics-service.js.map +0 -7
- package/dist/features/analytics/index.js +0 -18
- package/dist/features/analytics/index.js.map +0 -7
- package/dist/features/analytics/queries/metrics-queries.js +0 -277
- package/dist/features/analytics/queries/metrics-queries.js.map +0 -7
- package/dist/features/analytics/types/metrics.js +0 -5
- package/dist/features/analytics/types/metrics.js.map +0 -7
- package/dist/features/browser/browser-mcp.js +0 -492
- package/dist/features/browser/browser-mcp.js.map +0 -7
- package/dist/features/sweep/index.js +0 -20
- package/dist/features/sweep/index.js.map +0 -7
- package/dist/features/sweep/prediction-client.js +0 -155
- package/dist/features/sweep/prediction-client.js.map +0 -7
- package/dist/features/sweep/prompt-builder.js +0 -85
- package/dist/features/sweep/prompt-builder.js.map +0 -7
- package/dist/features/sweep/pty-wrapper.js +0 -171
- package/dist/features/sweep/pty-wrapper.js.map +0 -7
- package/dist/features/sweep/state-watcher.js +0 -87
- package/dist/features/sweep/state-watcher.js.map +0 -7
- package/dist/features/sweep/status-bar.js +0 -88
- package/dist/features/sweep/status-bar.js.map +0 -7
- package/dist/features/sweep/sweep-server-manager.js +0 -226
- package/dist/features/sweep/sweep-server-manager.js.map +0 -7
- package/dist/features/sweep/tab-interceptor.js +0 -38
- package/dist/features/sweep/tab-interceptor.js.map +0 -7
- package/dist/features/sweep/types.js +0 -18
- package/dist/features/sweep/types.js.map +0 -7
- package/dist/features/tasks/linear-task-manager.js +0 -487
- package/dist/features/tasks/linear-task-manager.js.map +0 -7
- package/dist/features/tasks/task-aware-context.js +0 -410
- package/dist/features/tasks/task-aware-context.js.map +0 -7
- package/dist/features/tui/simple-monitor.js +0 -116
- package/dist/features/tui/simple-monitor.js.map +0 -7
- package/dist/features/tui/swarm-monitor.js +0 -648
- package/dist/features/tui/swarm-monitor.js.map +0 -7
- package/dist/features/web/client/stores/task-store.js +0 -26
- package/dist/features/web/client/stores/task-store.js.map +0 -7
- package/dist/features/web/server/index.js +0 -194
- package/dist/features/web/server/index.js.map +0 -7
- package/dist/hooks/auto-background.js +0 -151
- package/dist/hooks/auto-background.js.map +0 -7
- package/dist/hooks/claude-code-whatsapp-hook.js +0 -197
- package/dist/hooks/claude-code-whatsapp-hook.js.map +0 -7
- package/dist/hooks/config.js +0 -150
- package/dist/hooks/config.js.map +0 -7
- package/dist/hooks/daemon.js +0 -364
- package/dist/hooks/daemon.js.map +0 -7
- package/dist/hooks/events.js +0 -58
- package/dist/hooks/events.js.map +0 -7
- package/dist/hooks/index.js +0 -12
- package/dist/hooks/index.js.map +0 -7
- package/dist/hooks/linear-task-picker.js +0 -186
- package/dist/hooks/linear-task-picker.js.map +0 -7
- package/dist/hooks/schemas.js +0 -197
- package/dist/hooks/schemas.js.map +0 -7
- package/dist/hooks/secure-fs.js +0 -49
- package/dist/hooks/secure-fs.js.map +0 -7
- package/dist/hooks/security-logger.js +0 -155
- package/dist/hooks/security-logger.js.map +0 -7
- package/dist/hooks/session-summary.js +0 -222
- package/dist/hooks/session-summary.js.map +0 -7
- package/dist/hooks/sms-action-runner.js +0 -371
- package/dist/hooks/sms-action-runner.js.map +0 -7
- package/dist/hooks/sms-notify.js +0 -506
- package/dist/hooks/sms-notify.js.map +0 -7
- package/dist/hooks/sms-watcher.js +0 -93
- package/dist/hooks/sms-watcher.js.map +0 -7
- package/dist/hooks/sms-webhook.js +0 -555
- package/dist/hooks/sms-webhook.js.map +0 -7
- package/dist/hooks/whatsapp-commands.js +0 -479
- package/dist/hooks/whatsapp-commands.js.map +0 -7
- package/dist/hooks/whatsapp-scheduler.js +0 -317
- package/dist/hooks/whatsapp-scheduler.js.map +0 -7
- package/dist/hooks/whatsapp-sync.js +0 -409
- package/dist/hooks/whatsapp-sync.js.map +0 -7
- package/dist/index.js +0 -25
- package/dist/index.js.map +0 -7
- package/dist/integrations/anthropic/client.js +0 -263
- package/dist/integrations/anthropic/client.js.map +0 -7
- package/dist/integrations/claude-code/agent-bridge.js +0 -768
- package/dist/integrations/claude-code/agent-bridge.js.map +0 -7
- package/dist/integrations/claude-code/enhanced-pre-clear-hooks.js +0 -459
- package/dist/integrations/claude-code/enhanced-pre-clear-hooks.js.map +0 -7
- package/dist/integrations/claude-code/lifecycle-hooks.js +0 -254
- package/dist/integrations/claude-code/lifecycle-hooks.js.map +0 -7
- package/dist/integrations/claude-code/post-task-hooks.js +0 -545
- package/dist/integrations/claude-code/post-task-hooks.js.map +0 -7
- package/dist/integrations/claude-code/subagent-client-stub.js +0 -20
- package/dist/integrations/claude-code/subagent-client-stub.js.map +0 -7
- package/dist/integrations/claude-code/subagent-client.js +0 -511
- package/dist/integrations/claude-code/subagent-client.js.map +0 -7
- package/dist/integrations/claude-code/task-coordinator.js +0 -360
- package/dist/integrations/claude-code/task-coordinator.js.map +0 -7
- package/dist/integrations/linear/auth.js +0 -337
- package/dist/integrations/linear/auth.js.map +0 -7
- package/dist/integrations/linear/auto-sync.js +0 -258
- package/dist/integrations/linear/auto-sync.js.map +0 -7
- package/dist/integrations/linear/client.js +0 -634
- package/dist/integrations/linear/client.js.map +0 -7
- package/dist/integrations/linear/config.js +0 -130
- package/dist/integrations/linear/config.js.map +0 -7
- package/dist/integrations/linear/migration.js +0 -361
- package/dist/integrations/linear/migration.js.map +0 -7
- package/dist/integrations/linear/oauth-server.js +0 -454
- package/dist/integrations/linear/oauth-server.js.map +0 -7
- package/dist/integrations/linear/rest-client.js +0 -213
- package/dist/integrations/linear/rest-client.js.map +0 -7
- package/dist/integrations/linear/sync-manager.js +0 -236
- package/dist/integrations/linear/sync-manager.js.map +0 -7
- package/dist/integrations/linear/sync-service.js +0 -231
- package/dist/integrations/linear/sync-service.js.map +0 -7
- package/dist/integrations/linear/sync.js +0 -782
- package/dist/integrations/linear/sync.js.map +0 -7
- package/dist/integrations/linear/types.js +0 -5
- package/dist/integrations/linear/types.js.map +0 -7
- package/dist/integrations/linear/unified-sync.js +0 -589
- package/dist/integrations/linear/unified-sync.js.map +0 -7
- package/dist/integrations/linear/webhook-handler.js +0 -219
- package/dist/integrations/linear/webhook-handler.js.map +0 -7
- package/dist/integrations/linear/webhook-server.js +0 -218
- package/dist/integrations/linear/webhook-server.js.map +0 -7
- package/dist/integrations/linear/webhook.js +0 -291
- package/dist/integrations/linear/webhook.js.map +0 -7
- package/dist/integrations/mcp/handlers/code-execution-handlers.js +0 -266
- package/dist/integrations/mcp/handlers/code-execution-handlers.js.map +0 -7
- package/dist/integrations/mcp/handlers/context-handlers.js +0 -257
- package/dist/integrations/mcp/handlers/context-handlers.js.map +0 -7
- package/dist/integrations/mcp/handlers/discovery-handlers.js +0 -497
- package/dist/integrations/mcp/handlers/discovery-handlers.js.map +0 -7
- package/dist/integrations/mcp/handlers/index.js +0 -166
- package/dist/integrations/mcp/handlers/index.js.map +0 -7
- package/dist/integrations/mcp/handlers/linear-handlers.js +0 -247
- package/dist/integrations/mcp/handlers/linear-handlers.js.map +0 -7
- package/dist/integrations/mcp/handlers/skill-handlers.js +0 -529
- package/dist/integrations/mcp/handlers/skill-handlers.js.map +0 -7
- package/dist/integrations/mcp/handlers/task-handlers.js +0 -239
- package/dist/integrations/mcp/handlers/task-handlers.js.map +0 -7
- package/dist/integrations/mcp/handlers/trace-handlers.js +0 -308
- package/dist/integrations/mcp/handlers/trace-handlers.js.map +0 -7
- package/dist/integrations/mcp/index.js +0 -23
- package/dist/integrations/mcp/index.js.map +0 -7
- package/dist/integrations/mcp/middleware/tool-scoring.js +0 -356
- package/dist/integrations/mcp/middleware/tool-scoring.js.map +0 -7
- package/dist/integrations/mcp/refactored-server.js +0 -374
- package/dist/integrations/mcp/refactored-server.js.map +0 -7
- package/dist/integrations/mcp/remote-server.js +0 -682
- package/dist/integrations/mcp/remote-server.js.map +0 -7
- package/dist/integrations/mcp/schemas.js +0 -147
- package/dist/integrations/mcp/schemas.js.map +0 -7
- package/dist/integrations/mcp/server.js +0 -1975
- package/dist/integrations/mcp/server.js.map +0 -7
- package/dist/integrations/mcp/tool-definitions-code.js +0 -125
- package/dist/integrations/mcp/tool-definitions-code.js.map +0 -7
- package/dist/integrations/mcp/tool-definitions.js +0 -702
- package/dist/integrations/mcp/tool-definitions.js.map +0 -7
- package/dist/integrations/mcp/trace-test.js +0 -48
- package/dist/integrations/mcp/trace-test.js.map +0 -7
- package/dist/integrations/pg-aiguide/embedding-provider.js +0 -189
- package/dist/integrations/pg-aiguide/embedding-provider.js.map +0 -7
- package/dist/integrations/pg-aiguide/semantic-search.js +0 -187
- package/dist/integrations/pg-aiguide/semantic-search.js.map +0 -7
- package/dist/integrations/pg-aiguide/timescale-analytics.js +0 -224
- package/dist/integrations/pg-aiguide/timescale-analytics.js.map +0 -7
- package/dist/integrations/ralph/bridge/ralph-stackmemory-bridge.js +0 -860
- package/dist/integrations/ralph/bridge/ralph-stackmemory-bridge.js.map +0 -7
- package/dist/integrations/ralph/context/context-budget-manager.js +0 -301
- package/dist/integrations/ralph/context/context-budget-manager.js.map +0 -7
- package/dist/integrations/ralph/context/stackmemory-context-loader.js +0 -360
- package/dist/integrations/ralph/context/stackmemory-context-loader.js.map +0 -7
- package/dist/integrations/ralph/coordination/enhanced-coordination.js +0 -410
- package/dist/integrations/ralph/coordination/enhanced-coordination.js.map +0 -7
- package/dist/integrations/ralph/index.js +0 -18
- package/dist/integrations/ralph/index.js.map +0 -7
- package/dist/integrations/ralph/learning/pattern-learner.js +0 -401
- package/dist/integrations/ralph/learning/pattern-learner.js.map +0 -7
- package/dist/integrations/ralph/lifecycle/iteration-lifecycle.js +0 -448
- package/dist/integrations/ralph/lifecycle/iteration-lifecycle.js.map +0 -7
- package/dist/integrations/ralph/monitoring/swarm-dashboard.js +0 -294
- package/dist/integrations/ralph/monitoring/swarm-dashboard.js.map +0 -7
- package/dist/integrations/ralph/monitoring/swarm-registry.js +0 -108
- package/dist/integrations/ralph/monitoring/swarm-registry.js.map +0 -7
- package/dist/integrations/ralph/orchestration/multi-loop-orchestrator.js +0 -463
- package/dist/integrations/ralph/orchestration/multi-loop-orchestrator.js.map +0 -7
- package/dist/integrations/ralph/patterns/compounding-engineering-pattern.js +0 -400
- package/dist/integrations/ralph/patterns/compounding-engineering-pattern.js.map +0 -7
- package/dist/integrations/ralph/patterns/extended-coherence-sessions.js +0 -473
- package/dist/integrations/ralph/patterns/extended-coherence-sessions.js.map +0 -7
- package/dist/integrations/ralph/patterns/oracle-worker-pattern.js +0 -388
- package/dist/integrations/ralph/patterns/oracle-worker-pattern.js.map +0 -7
- package/dist/integrations/ralph/performance/performance-optimizer.js +0 -358
- package/dist/integrations/ralph/performance/performance-optimizer.js.map +0 -7
- package/dist/integrations/ralph/ralph-integration-demo.js +0 -182
- package/dist/integrations/ralph/ralph-integration-demo.js.map +0 -7
- package/dist/integrations/ralph/recovery/crash-recovery.js +0 -462
- package/dist/integrations/ralph/recovery/crash-recovery.js.map +0 -7
- package/dist/integrations/ralph/state/state-reconciler.js +0 -404
- package/dist/integrations/ralph/state/state-reconciler.js.map +0 -7
- package/dist/integrations/ralph/swarm/git-workflow-manager.js +0 -428
- package/dist/integrations/ralph/swarm/git-workflow-manager.js.map +0 -7
- package/dist/integrations/ralph/swarm/swarm-coordinator.js +0 -996
- package/dist/integrations/ralph/swarm/swarm-coordinator.js.map +0 -7
- package/dist/integrations/ralph/types.js +0 -5
- package/dist/integrations/ralph/types.js.map +0 -7
- package/dist/integrations/ralph/visualization/ralph-debugger.js +0 -585
- package/dist/integrations/ralph/visualization/ralph-debugger.js.map +0 -7
- package/dist/mcp/stackmemory-mcp-server.js +0 -554
- package/dist/mcp/stackmemory-mcp-server.js.map +0 -7
- package/dist/middleware/exponential-rate-limiter.js +0 -289
- package/dist/middleware/exponential-rate-limiter.js.map +0 -7
- package/dist/models/user.model.js +0 -358
- package/dist/models/user.model.js.map +0 -7
- package/dist/servers/production/auth-middleware.js +0 -528
- package/dist/servers/production/auth-middleware.js.map +0 -7
- package/dist/servers/railway/config.js +0 -55
- package/dist/servers/railway/config.js.map +0 -7
- package/dist/servers/railway/index-enhanced.js +0 -160
- package/dist/servers/railway/index-enhanced.js.map +0 -7
- package/dist/servers/railway/index.js +0 -1349
- package/dist/servers/railway/index.js.map +0 -7
- package/dist/servers/railway/simple.js +0 -64
- package/dist/servers/railway/simple.js.map +0 -7
- package/dist/servers/railway/storage-test.js +0 -459
- package/dist/servers/railway/storage-test.js.map +0 -7
- package/dist/services/config-service.js +0 -65
- package/dist/services/config-service.js.map +0 -7
- package/dist/services/context-service.js +0 -194
- package/dist/services/context-service.js.map +0 -7
- package/dist/skills/api-discovery.js +0 -354
- package/dist/skills/api-discovery.js.map +0 -7
- package/dist/skills/api-skill.js +0 -475
- package/dist/skills/api-skill.js.map +0 -7
- package/dist/skills/claude-skills.js +0 -1061
- package/dist/skills/claude-skills.js.map +0 -7
- package/dist/skills/dashboard-launcher.js +0 -216
- package/dist/skills/dashboard-launcher.js.map +0 -7
- package/dist/skills/recursive-agent-orchestrator.js +0 -575
- package/dist/skills/recursive-agent-orchestrator.js.map +0 -7
- package/dist/skills/repo-ingestion-skill.js +0 -609
- package/dist/skills/repo-ingestion-skill.js.map +0 -7
- package/dist/skills/security-secrets-scanner.js +0 -284
- package/dist/skills/security-secrets-scanner.js.map +0 -7
- package/dist/skills/unified-rlm-orchestrator.js +0 -404
- package/dist/skills/unified-rlm-orchestrator.js.map +0 -7
- package/dist/types/task.js +0 -5
- package/dist/types/task.js.map +0 -7
- package/dist/utils/env.js +0 -50
- package/dist/utils/env.js.map +0 -7
- package/dist/utils/formatting.js +0 -62
- package/dist/utils/formatting.js.map +0 -7
- package/dist/utils/process-cleanup.js +0 -136
- package/dist/utils/process-cleanup.js.map +0 -7
- package/dist/validation/schemas.js +0 -222
- package/dist/validation/schemas.js.map +0 -7
- /package/dist/{core/merge → src/core/extensions}/types.js +0 -0
- /package/dist/{core/merge → src/core/extensions}/types.js.map +0 -0
- /package/dist/{core → src/integrations/diffmem}/types.js +0 -0
- /package/dist/{core → src/integrations/diffmem}/types.js.map +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# StackMemory
|
|
2
2
|
|
|
3
|
-
**Lossless, project-scoped memory for AI tools** • v0.5.
|
|
3
|
+
**Lossless, project-scoped memory for AI tools** • v0.5.59
|
|
4
4
|
|
|
5
5
|
StackMemory is a **production-ready memory runtime** for AI coding tools that preserves full project context across sessions:
|
|
6
6
|
|
|
@@ -36,6 +36,110 @@ StackMemory solves this by:
|
|
|
36
36
|
|
|
37
37
|
---
|
|
38
38
|
|
|
39
|
+
## Features
|
|
40
|
+
|
|
41
|
+
StackMemory includes powerful features to enhance your AI coding workflow. Enable/disable with `claude-sm config setup`.
|
|
42
|
+
|
|
43
|
+
### Predictive Edit
|
|
44
|
+
|
|
45
|
+
Anticipates your next edit and displays suggestions as a status bar overlay. Powered by llama-server and Claude Code's PostToolUse hooks.
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
claude-sm --sweep # Enable (default: on)
|
|
49
|
+
claude-sm --no-sweep # Disable
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
- **How it works**: Analyzes tool outputs and predicts likely follow-up edits
|
|
53
|
+
- **Interface**: Tab to accept, Esc to dismiss
|
|
54
|
+
- **Requirement**: Installs `node-pty` on first use
|
|
55
|
+
|
|
56
|
+
### Code Review
|
|
57
|
+
|
|
58
|
+
AI-powered code review using Greptile's codebase-aware analysis. Automatically registers the Greptile MCP server for deep repository understanding.
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
claude-sm --greptile # Enable (default: on)
|
|
62
|
+
claude-sm --no-greptile # Disable
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
- **Tools provided**: `index_repository`, `query_repository`, `get_repository_info`
|
|
66
|
+
- **Requirement**: `GREPTILE_API_KEY` in `.env`
|
|
67
|
+
|
|
68
|
+
### Prompt Forge
|
|
69
|
+
|
|
70
|
+
Genetic Eval-driven Prompt Algorithm (GEPA) for automatic system prompt optimization. Evolves your `CLAUDE.md` through mutation, evaluation, and selection.
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
claude-sm --gepa # Enable
|
|
74
|
+
claude-sm --no-gepa # Disable (default)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
- **Auto-optimize**: Watches `CLAUDE.md` and runs optimization on changes
|
|
78
|
+
- **Strategies**: rephrase, add_examples, remove_redundancy, restructure, add_constraints, simplify
|
|
79
|
+
- **Output**: Before/after comparison with metrics (lines, tokens, rules)
|
|
80
|
+
|
|
81
|
+
### Model Switcher
|
|
82
|
+
|
|
83
|
+
Dynamic model routing based on task complexity. Automatically selects the optimal model (Haiku/Sonnet/Opus) for each request.
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
claude-sm --model-routing # Enable
|
|
87
|
+
claude-sm --no-model-routing # Disable (default)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
- **Cost optimization**: Uses cheaper models for simple tasks
|
|
91
|
+
- **Quality preservation**: Routes complex tasks to more capable models
|
|
92
|
+
|
|
93
|
+
### Safe Branch
|
|
94
|
+
|
|
95
|
+
Git worktree isolation for experimental changes. Each session operates in an isolated branch, preventing accidental commits to main.
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
claude-sm --worktree # Enable
|
|
99
|
+
claude-sm --no-worktree # Disable (default)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
- **Isolation**: Changes happen in a separate worktree
|
|
103
|
+
- **Safety**: Main branch remains untouched until explicit merge
|
|
104
|
+
|
|
105
|
+
### Mobile Sync
|
|
106
|
+
|
|
107
|
+
WhatsApp notifications for session updates and task completion. Stay informed even when away from your terminal.
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
claude-sm --whatsapp # Enable
|
|
111
|
+
claude-sm --no-whatsapp # Disable (default)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
- **Notifications**: Session start, task completion, errors
|
|
115
|
+
- **Interactive**: Reply to trigger actions remotely
|
|
116
|
+
|
|
117
|
+
### Session Insights
|
|
118
|
+
|
|
119
|
+
Detailed tracing of session activity for debugging and optimization. Tracks tool calls, timing, and decision paths.
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
claude-sm --tracing # Enable
|
|
123
|
+
claude-sm --no-tracing # Disable (default)
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
- **Visibility**: Full execution trace
|
|
127
|
+
- **Analytics**: Performance metrics and patterns
|
|
128
|
+
|
|
129
|
+
### Task Alert
|
|
130
|
+
|
|
131
|
+
Desktop/terminal notifications when long-running tasks complete. Never miss a completed build or test run.
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
claude-sm --notify-on-done # Enable (default: on)
|
|
135
|
+
claude-sm --no-notify-on-done # Disable
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
- **Platforms**: macOS notifications, terminal bell
|
|
139
|
+
- **Smart**: Only notifies for tasks taking >10 seconds
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
39
143
|
## Core concepts (quick mental model)
|
|
40
144
|
|
|
41
145
|
| Concept | Meaning |
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
import { join } from "path";
|
|
14
14
|
import { execSync } from "child_process";
|
|
15
15
|
import chalk from "chalk";
|
|
16
|
+
const enableDiffMem = process.argv.includes("--with-diffmem");
|
|
16
17
|
function getEnv(key, defaultValue) {
|
|
17
18
|
const value = process.env[key];
|
|
18
19
|
if (value === void 0) {
|
|
@@ -102,15 +103,81 @@ try {
|
|
|
102
103
|
} catch {
|
|
103
104
|
console.log(chalk.yellow("\u26A0") + " Build failed - run npm run build manually");
|
|
104
105
|
}
|
|
106
|
+
if (enableDiffMem) {
|
|
107
|
+
console.log(chalk.blue("\n\u{1F9E0} Setting up DiffMem integration...\n"));
|
|
108
|
+
const diffmemDir = join(stackDir, "diffmem");
|
|
109
|
+
const diffmemStorageDir = join(diffmemDir, "storage");
|
|
110
|
+
const diffmemWorktreesDir = join(diffmemDir, "worktrees");
|
|
111
|
+
mkdirSync(diffmemStorageDir, { recursive: true });
|
|
112
|
+
mkdirSync(diffmemWorktreesDir, { recursive: true });
|
|
113
|
+
if (!existsSync(join(diffmemStorageDir, ".git"))) {
|
|
114
|
+
try {
|
|
115
|
+
execSync("git init", { cwd: diffmemStorageDir, stdio: "pipe" });
|
|
116
|
+
execSync('git commit --allow-empty -m "Initialize DiffMem storage"', {
|
|
117
|
+
cwd: diffmemStorageDir,
|
|
118
|
+
stdio: "pipe"
|
|
119
|
+
});
|
|
120
|
+
console.log(chalk.green("\u2713") + " Initialized DiffMem storage repository");
|
|
121
|
+
} catch {
|
|
122
|
+
console.log(
|
|
123
|
+
chalk.yellow("\u26A0") + " Failed to initialize git repo for DiffMem"
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
const diffmemConfigPath = join(diffmemDir, "config.json");
|
|
128
|
+
const diffmemConfig = {
|
|
129
|
+
enabled: true,
|
|
130
|
+
endpoint: "http://localhost:8000",
|
|
131
|
+
userId: process.env["USER"] || "default",
|
|
132
|
+
storagePath: diffmemStorageDir,
|
|
133
|
+
worktreePath: diffmemWorktreesDir
|
|
134
|
+
};
|
|
135
|
+
writeFileSync(diffmemConfigPath, JSON.stringify(diffmemConfig, null, 2));
|
|
136
|
+
console.log(chalk.green("\u2713") + " Created DiffMem configuration");
|
|
137
|
+
const envPath = join(projectRoot, ".env");
|
|
138
|
+
const diffmemEnvVars = `
|
|
139
|
+
# DiffMem Configuration (Long-term User Memory)
|
|
140
|
+
DIFFMEM_ENABLED=true
|
|
141
|
+
DIFFMEM_ENDPOINT=http://localhost:8000
|
|
142
|
+
DIFFMEM_USER_ID=${process.env["USER"] || "default"}
|
|
143
|
+
DIFFMEM_STORAGE_PATH=${diffmemStorageDir}
|
|
144
|
+
DIFFMEM_WORKTREE_PATH=${diffmemWorktreesDir}
|
|
145
|
+
`;
|
|
146
|
+
if (existsSync(envPath)) {
|
|
147
|
+
const envContent = readFileSync(envPath, "utf-8");
|
|
148
|
+
if (!envContent.includes("DIFFMEM_")) {
|
|
149
|
+
appendFileSync(envPath, diffmemEnvVars);
|
|
150
|
+
console.log(chalk.green("\u2713") + " Added DiffMem configuration to .env");
|
|
151
|
+
}
|
|
152
|
+
} else {
|
|
153
|
+
writeFileSync(envPath, diffmemEnvVars.trim() + "\n");
|
|
154
|
+
console.log(chalk.green("\u2713") + " Created .env with DiffMem configuration");
|
|
155
|
+
}
|
|
156
|
+
console.log(chalk.green("\u2713") + " DiffMem integration configured");
|
|
157
|
+
console.log(
|
|
158
|
+
chalk.gray(
|
|
159
|
+
" Note: DiffMem server must be running for user memory features"
|
|
160
|
+
)
|
|
161
|
+
);
|
|
162
|
+
}
|
|
105
163
|
console.log(chalk.green.bold("\n\u2705 StackMemory initialized successfully!\n"));
|
|
106
164
|
console.log(chalk.gray("Next steps:"));
|
|
107
165
|
console.log(chalk.gray("1. Add the MCP configuration above to Claude Code"));
|
|
108
166
|
console.log(chalk.gray("2. Restart Claude Code"));
|
|
109
167
|
console.log(chalk.gray("3. Start using context tracking!"));
|
|
168
|
+
if (enableDiffMem) {
|
|
169
|
+
console.log(chalk.gray("4. Start DiffMem server: npm run diffmem:start"));
|
|
170
|
+
}
|
|
110
171
|
console.log(chalk.gray("\nUseful commands:"));
|
|
111
172
|
console.log(
|
|
112
173
|
chalk.cyan(" npm run mcp:dev") + " - Start MCP server in dev mode"
|
|
113
174
|
);
|
|
114
175
|
console.log(chalk.cyan(" npm run status") + " - Check StackMemory status");
|
|
115
|
-
console.log(chalk.cyan(" npm run analyze") + " - Analyze context usage
|
|
176
|
+
console.log(chalk.cyan(" npm run analyze") + " - Analyze context usage");
|
|
177
|
+
if (enableDiffMem) {
|
|
178
|
+
console.log(
|
|
179
|
+
chalk.cyan(" npm run diffmem:start") + " - Start DiffMem server"
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
console.log();
|
|
116
183
|
//# sourceMappingURL=initialize.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../scripts/initialize.ts"],
|
|
4
|
-
"sourcesContent": ["#!/usr/bin/env tsx\n/**\n * Initialize StackMemory in the current project\n */\n\nimport {\n existsSync,\n mkdirSync,\n writeFileSync,\n readFileSync,\n appendFileSync,\n} from 'fs';\nimport { join } from 'path';\nimport { execSync } from 'child_process';\nimport chalk from 'chalk';\n// Type-safe environment variable access\nfunction getEnv(key: string, defaultValue?: string): string {\n const value = process.env[key];\n if (value === undefined) {\n if (defaultValue !== undefined) return defaultValue;\n throw new Error(`Environment variable ${key} is required`);\n }\n return value;\n}\n\nfunction getOptionalEnv(key: string): string | undefined {\n return process.env[key];\n}\n\nconst projectRoot = process.cwd();\n\nconsole.log(chalk.blue.bold('\\n\uD83D\uDE80 Initializing StackMemory...\\n'));\n\n// 1. Create .stackmemory directory\nconst stackDir = join(projectRoot, '.stackmemory');\nif (!existsSync(stackDir)) {\n mkdirSync(stackDir, { recursive: true });\n console.log(chalk.green('\u2713') + ' Created .stackmemory directory');\n} else {\n console.log(chalk.yellow('\u26A0') + ' .stackmemory directory already exists');\n}\n\n// 2. Add to .gitignore\nconst gitignorePath = join(projectRoot, '.gitignore');\nconst gitignoreEntry =\n '\\n# StackMemory\\n.stackmemory/*.db\\n.stackmemory/*.db-*\\n';\n\nif (existsSync(gitignorePath)) {\n const gitignore = readFileSync(gitignorePath, 'utf-8');\n if (!gitignore.includes('.stackmemory')) {\n appendFileSync(gitignorePath, gitignoreEntry);\n console.log(chalk.green('\u2713') + ' Added .stackmemory to .gitignore');\n }\n} else {\n writeFileSync(gitignorePath, gitignoreEntry);\n console.log(chalk.green('\u2713') + ' Created .gitignore with .stackmemory');\n}\n\n// 3. Create config file\nconst configPath = join(stackDir, 'config.json');\nif (!existsSync(configPath)) {\n const config = {\n projectId: projectRoot.split('/').pop(),\n userId: process.env['USER'] || 'default',\n teamId: 'local',\n initialized: new Date().toISOString(),\n };\n writeFileSync(configPath, JSON.stringify(config, null, 2));\n console.log(chalk.green('\u2713') + ' Created config file');\n}\n\n// 4. Create initial JSONL file\nconst jsonlPath = join(stackDir, 'frames.jsonl');\nif (!existsSync(jsonlPath)) {\n const initialFrame = {\n id: 'init_' + Date.now(),\n type: 'system',\n content: 'StackMemory initialized',\n timestamp: Date.now(),\n };\n writeFileSync(jsonlPath, JSON.stringify(initialFrame) + '\\n');\n console.log(chalk.green('\u2713') + ' Created frames.jsonl');\n}\n\n// 5. Create MCP config for Claude Code\nconst isMacOS = process.platform === 'darwin';\nconst mcpConfigPath = isMacOS\n ? join(\n process.env['HOME'] || '~',\n 'Library',\n 'Application Support',\n 'Claude',\n 'claude_desktop_config.json'\n )\n : join(\n process.env['HOME'] || '~',\n '.config',\n 'claude',\n 'claude_desktop_config.json'\n );\nconsole.log(chalk.blue('\\n\uD83D\uDCDD MCP Configuration for Claude Code:\\n'));\n\nconst mcpConfig = {\n mcpServers: {\n stackmemory: {\n command: 'node',\n args: [join(projectRoot, 'dist', 'integrations', 'mcp', 'server.js')],\n env: {\n PROJECT_ROOT: projectRoot,\n },\n },\n },\n};\n\nconsole.log(chalk.gray('Add this to your Claude Code MCP configuration:'));\nconsole.log(chalk.gray('(' + mcpConfigPath + ')\\n'));\nconsole.log(chalk.cyan(JSON.stringify(mcpConfig, null, 2)));\n\n// 6. Build the project\nconsole.log(chalk.blue('\\n\uD83D\uDCE6 Building TypeScript files...\\n'));\ntry {\n execSync('npm run build', { stdio: 'inherit', cwd: projectRoot });\n console.log(chalk.green('\u2713') + ' Build completed');\n} catch {\n console.log(chalk.yellow('\u26A0') + ' Build failed - run npm run build manually');\n}\n\nconsole.log(chalk.green.bold('\\n\u2705 StackMemory initialized successfully!\\n'));\nconsole.log(chalk.gray('Next steps:'));\nconsole.log(chalk.gray('1. Add the MCP configuration above to Claude Code'));\nconsole.log(chalk.gray('2. Restart Claude Code'));\nconsole.log(chalk.gray('3. Start using context tracking!'));\nconsole.log(chalk.gray('\\nUseful commands:'));\nconsole.log(\n chalk.cyan(' npm run mcp:dev') + ' - Start MCP server in dev mode'\n);\nconsole.log(chalk.cyan(' npm run status') + ' - Check StackMemory status');\nconsole.log(chalk.cyan(' npm run analyze') + ' - Analyze context usage
|
|
5
|
-
"mappings": ";;;;;AAKA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,YAAY;AACrB,SAAS,gBAAgB;AACzB,OAAO,WAAW;
|
|
4
|
+
"sourcesContent": ["#!/usr/bin/env tsx\n/**\n * Initialize StackMemory in the current project\n */\n\nimport {\n existsSync,\n mkdirSync,\n writeFileSync,\n readFileSync,\n appendFileSync,\n} from 'fs';\nimport { join } from 'path';\nimport { execSync } from 'child_process';\nimport chalk from 'chalk';\n\n// Parse CLI args for --with-diffmem flag\nconst enableDiffMem = process.argv.includes('--with-diffmem');\n// Type-safe environment variable access\nfunction getEnv(key: string, defaultValue?: string): string {\n const value = process.env[key];\n if (value === undefined) {\n if (defaultValue !== undefined) return defaultValue;\n throw new Error(`Environment variable ${key} is required`);\n }\n return value;\n}\n\nfunction getOptionalEnv(key: string): string | undefined {\n return process.env[key];\n}\n\nconst projectRoot = process.cwd();\n\nconsole.log(chalk.blue.bold('\\n\uD83D\uDE80 Initializing StackMemory...\\n'));\n\n// 1. Create .stackmemory directory\nconst stackDir = join(projectRoot, '.stackmemory');\nif (!existsSync(stackDir)) {\n mkdirSync(stackDir, { recursive: true });\n console.log(chalk.green('\u2713') + ' Created .stackmemory directory');\n} else {\n console.log(chalk.yellow('\u26A0') + ' .stackmemory directory already exists');\n}\n\n// 2. Add to .gitignore\nconst gitignorePath = join(projectRoot, '.gitignore');\nconst gitignoreEntry =\n '\\n# StackMemory\\n.stackmemory/*.db\\n.stackmemory/*.db-*\\n';\n\nif (existsSync(gitignorePath)) {\n const gitignore = readFileSync(gitignorePath, 'utf-8');\n if (!gitignore.includes('.stackmemory')) {\n appendFileSync(gitignorePath, gitignoreEntry);\n console.log(chalk.green('\u2713') + ' Added .stackmemory to .gitignore');\n }\n} else {\n writeFileSync(gitignorePath, gitignoreEntry);\n console.log(chalk.green('\u2713') + ' Created .gitignore with .stackmemory');\n}\n\n// 3. Create config file\nconst configPath = join(stackDir, 'config.json');\nif (!existsSync(configPath)) {\n const config = {\n projectId: projectRoot.split('/').pop(),\n userId: process.env['USER'] || 'default',\n teamId: 'local',\n initialized: new Date().toISOString(),\n };\n writeFileSync(configPath, JSON.stringify(config, null, 2));\n console.log(chalk.green('\u2713') + ' Created config file');\n}\n\n// 4. Create initial JSONL file\nconst jsonlPath = join(stackDir, 'frames.jsonl');\nif (!existsSync(jsonlPath)) {\n const initialFrame = {\n id: 'init_' + Date.now(),\n type: 'system',\n content: 'StackMemory initialized',\n timestamp: Date.now(),\n };\n writeFileSync(jsonlPath, JSON.stringify(initialFrame) + '\\n');\n console.log(chalk.green('\u2713') + ' Created frames.jsonl');\n}\n\n// 5. Create MCP config for Claude Code\nconst isMacOS = process.platform === 'darwin';\nconst mcpConfigPath = isMacOS\n ? join(\n process.env['HOME'] || '~',\n 'Library',\n 'Application Support',\n 'Claude',\n 'claude_desktop_config.json'\n )\n : join(\n process.env['HOME'] || '~',\n '.config',\n 'claude',\n 'claude_desktop_config.json'\n );\nconsole.log(chalk.blue('\\n\uD83D\uDCDD MCP Configuration for Claude Code:\\n'));\n\nconst mcpConfig = {\n mcpServers: {\n stackmemory: {\n command: 'node',\n args: [join(projectRoot, 'dist', 'integrations', 'mcp', 'server.js')],\n env: {\n PROJECT_ROOT: projectRoot,\n },\n },\n },\n};\n\nconsole.log(chalk.gray('Add this to your Claude Code MCP configuration:'));\nconsole.log(chalk.gray('(' + mcpConfigPath + ')\\n'));\nconsole.log(chalk.cyan(JSON.stringify(mcpConfig, null, 2)));\n\n// 6. Build the project\nconsole.log(chalk.blue('\\n\uD83D\uDCE6 Building TypeScript files...\\n'));\ntry {\n execSync('npm run build', { stdio: 'inherit', cwd: projectRoot });\n console.log(chalk.green('\u2713') + ' Build completed');\n} catch {\n console.log(chalk.yellow('\u26A0') + ' Build failed - run npm run build manually');\n}\n\n// 7. Optional: Initialize DiffMem for long-term user memory\nif (enableDiffMem) {\n console.log(chalk.blue('\\n\uD83E\uDDE0 Setting up DiffMem integration...\\n'));\n\n const diffmemDir = join(stackDir, 'diffmem');\n const diffmemStorageDir = join(diffmemDir, 'storage');\n const diffmemWorktreesDir = join(diffmemDir, 'worktrees');\n\n // Create DiffMem directories\n mkdirSync(diffmemStorageDir, { recursive: true });\n mkdirSync(diffmemWorktreesDir, { recursive: true });\n\n // Initialize git repo for storage\n if (!existsSync(join(diffmemStorageDir, '.git'))) {\n try {\n execSync('git init', { cwd: diffmemStorageDir, stdio: 'pipe' });\n execSync('git commit --allow-empty -m \"Initialize DiffMem storage\"', {\n cwd: diffmemStorageDir,\n stdio: 'pipe',\n });\n console.log(chalk.green('\u2713') + ' Initialized DiffMem storage repository');\n } catch {\n console.log(\n chalk.yellow('\u26A0') + ' Failed to initialize git repo for DiffMem'\n );\n }\n }\n\n // Create DiffMem config\n const diffmemConfigPath = join(diffmemDir, 'config.json');\n const diffmemConfig = {\n enabled: true,\n endpoint: 'http://localhost:8000',\n userId: process.env['USER'] || 'default',\n storagePath: diffmemStorageDir,\n worktreePath: diffmemWorktreesDir,\n };\n writeFileSync(diffmemConfigPath, JSON.stringify(diffmemConfig, null, 2));\n console.log(chalk.green('\u2713') + ' Created DiffMem configuration');\n\n // Add DiffMem env vars to .env file\n const envPath = join(projectRoot, '.env');\n const diffmemEnvVars = `\n# DiffMem Configuration (Long-term User Memory)\nDIFFMEM_ENABLED=true\nDIFFMEM_ENDPOINT=http://localhost:8000\nDIFFMEM_USER_ID=${process.env['USER'] || 'default'}\nDIFFMEM_STORAGE_PATH=${diffmemStorageDir}\nDIFFMEM_WORKTREE_PATH=${diffmemWorktreesDir}\n`;\n\n if (existsSync(envPath)) {\n const envContent = readFileSync(envPath, 'utf-8');\n if (!envContent.includes('DIFFMEM_')) {\n appendFileSync(envPath, diffmemEnvVars);\n console.log(chalk.green('\u2713') + ' Added DiffMem configuration to .env');\n }\n } else {\n writeFileSync(envPath, diffmemEnvVars.trim() + '\\n');\n console.log(chalk.green('\u2713') + ' Created .env with DiffMem configuration');\n }\n\n console.log(chalk.green('\u2713') + ' DiffMem integration configured');\n console.log(\n chalk.gray(\n ' Note: DiffMem server must be running for user memory features'\n )\n );\n}\n\nconsole.log(chalk.green.bold('\\n\u2705 StackMemory initialized successfully!\\n'));\nconsole.log(chalk.gray('Next steps:'));\nconsole.log(chalk.gray('1. Add the MCP configuration above to Claude Code'));\nconsole.log(chalk.gray('2. Restart Claude Code'));\nconsole.log(chalk.gray('3. Start using context tracking!'));\nif (enableDiffMem) {\n console.log(chalk.gray('4. Start DiffMem server: npm run diffmem:start'));\n}\nconsole.log(chalk.gray('\\nUseful commands:'));\nconsole.log(\n chalk.cyan(' npm run mcp:dev') + ' - Start MCP server in dev mode'\n);\nconsole.log(chalk.cyan(' npm run status') + ' - Check StackMemory status');\nconsole.log(chalk.cyan(' npm run analyze') + ' - Analyze context usage');\nif (enableDiffMem) {\n console.log(\n chalk.cyan(' npm run diffmem:start') + ' - Start DiffMem server'\n );\n}\nconsole.log();\n"],
|
|
5
|
+
"mappings": ";;;;;AAKA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,YAAY;AACrB,SAAS,gBAAgB;AACzB,OAAO,WAAW;AAGlB,MAAM,gBAAgB,QAAQ,KAAK,SAAS,gBAAgB;AAE5D,SAAS,OAAO,KAAa,cAA+B;AAC1D,QAAM,QAAQ,QAAQ,IAAI,GAAG;AAC7B,MAAI,UAAU,QAAW;AACvB,QAAI,iBAAiB,OAAW,QAAO;AACvC,UAAM,IAAI,MAAM,wBAAwB,GAAG,cAAc;AAAA,EAC3D;AACA,SAAO;AACT;AAEA,SAAS,eAAe,KAAiC;AACvD,SAAO,QAAQ,IAAI,GAAG;AACxB;AAEA,MAAM,cAAc,QAAQ,IAAI;AAEhC,QAAQ,IAAI,MAAM,KAAK,KAAK,2CAAoC,CAAC;AAGjE,MAAM,WAAW,KAAK,aAAa,cAAc;AACjD,IAAI,CAAC,WAAW,QAAQ,GAAG;AACzB,YAAU,UAAU,EAAE,WAAW,KAAK,CAAC;AACvC,UAAQ,IAAI,MAAM,MAAM,QAAG,IAAI,iCAAiC;AAClE,OAAO;AACL,UAAQ,IAAI,MAAM,OAAO,QAAG,IAAI,wCAAwC;AAC1E;AAGA,MAAM,gBAAgB,KAAK,aAAa,YAAY;AACpD,MAAM,iBACJ;AAEF,IAAI,WAAW,aAAa,GAAG;AAC7B,QAAM,YAAY,aAAa,eAAe,OAAO;AACrD,MAAI,CAAC,UAAU,SAAS,cAAc,GAAG;AACvC,mBAAe,eAAe,cAAc;AAC5C,YAAQ,IAAI,MAAM,MAAM,QAAG,IAAI,mCAAmC;AAAA,EACpE;AACF,OAAO;AACL,gBAAc,eAAe,cAAc;AAC3C,UAAQ,IAAI,MAAM,MAAM,QAAG,IAAI,uCAAuC;AACxE;AAGA,MAAM,aAAa,KAAK,UAAU,aAAa;AAC/C,IAAI,CAAC,WAAW,UAAU,GAAG;AAC3B,QAAM,SAAS;AAAA,IACb,WAAW,YAAY,MAAM,GAAG,EAAE,IAAI;AAAA,IACtC,QAAQ,QAAQ,IAAI,MAAM,KAAK;AAAA,IAC/B,QAAQ;AAAA,IACR,cAAa,oBAAI,KAAK,GAAE,YAAY;AAAA,EACtC;AACA,gBAAc,YAAY,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC;AACzD,UAAQ,IAAI,MAAM,MAAM,QAAG,IAAI,sBAAsB;AACvD;AAGA,MAAM,YAAY,KAAK,UAAU,cAAc;AAC/C,IAAI,CAAC,WAAW,SAAS,GAAG;AAC1B,QAAM,eAAe;AAAA,IACnB,IAAI,UAAU,KAAK,IAAI;AAAA,IACvB,MAAM;AAAA,IACN,SAAS;AAAA,IACT,WAAW,KAAK,IAAI;AAAA,EACtB;AACA,gBAAc,WAAW,KAAK,UAAU,YAAY,IAAI,IAAI;AAC5D,UAAQ,IAAI,MAAM,MAAM,QAAG,IAAI,uBAAuB;AACxD;AAGA,MAAM,UAAU,QAAQ,aAAa;AACrC,MAAM,gBAAgB,UAClB;AAAA,EACE,QAAQ,IAAI,MAAM,KAAK;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,IACA;AAAA,EACE,QAAQ,IAAI,MAAM,KAAK;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AACF;AACJ,QAAQ,IAAI,MAAM,KAAK,kDAA2C,CAAC;AAEnE,MAAM,YAAY;AAAA,EAChB,YAAY;AAAA,IACV,aAAa;AAAA,MACX,SAAS;AAAA,MACT,MAAM,CAAC,KAAK,aAAa,QAAQ,gBAAgB,OAAO,WAAW,CAAC;AAAA,MACpE,KAAK;AAAA,QACH,cAAc;AAAA,MAChB;AAAA,IACF;AAAA,EACF;AACF;AAEA,QAAQ,IAAI,MAAM,KAAK,iDAAiD,CAAC;AACzE,QAAQ,IAAI,MAAM,KAAK,MAAM,gBAAgB,KAAK,CAAC;AACnD,QAAQ,IAAI,MAAM,KAAK,KAAK,UAAU,WAAW,MAAM,CAAC,CAAC,CAAC;AAG1D,QAAQ,IAAI,MAAM,KAAK,4CAAqC,CAAC;AAC7D,IAAI;AACF,WAAS,iBAAiB,EAAE,OAAO,WAAW,KAAK,YAAY,CAAC;AAChE,UAAQ,IAAI,MAAM,MAAM,QAAG,IAAI,kBAAkB;AACnD,QAAQ;AACN,UAAQ,IAAI,MAAM,OAAO,QAAG,IAAI,4CAA4C;AAC9E;AAGA,IAAI,eAAe;AACjB,UAAQ,IAAI,MAAM,KAAK,iDAA0C,CAAC;AAElE,QAAM,aAAa,KAAK,UAAU,SAAS;AAC3C,QAAM,oBAAoB,KAAK,YAAY,SAAS;AACpD,QAAM,sBAAsB,KAAK,YAAY,WAAW;AAGxD,YAAU,mBAAmB,EAAE,WAAW,KAAK,CAAC;AAChD,YAAU,qBAAqB,EAAE,WAAW,KAAK,CAAC;AAGlD,MAAI,CAAC,WAAW,KAAK,mBAAmB,MAAM,CAAC,GAAG;AAChD,QAAI;AACF,eAAS,YAAY,EAAE,KAAK,mBAAmB,OAAO,OAAO,CAAC;AAC9D,eAAS,4DAA4D;AAAA,QACnE,KAAK;AAAA,QACL,OAAO;AAAA,MACT,CAAC;AACD,cAAQ,IAAI,MAAM,MAAM,QAAG,IAAI,yCAAyC;AAAA,IAC1E,QAAQ;AACN,cAAQ;AAAA,QACN,MAAM,OAAO,QAAG,IAAI;AAAA,MACtB;AAAA,IACF;AAAA,EACF;AAGA,QAAM,oBAAoB,KAAK,YAAY,aAAa;AACxD,QAAM,gBAAgB;AAAA,IACpB,SAAS;AAAA,IACT,UAAU;AAAA,IACV,QAAQ,QAAQ,IAAI,MAAM,KAAK;AAAA,IAC/B,aAAa;AAAA,IACb,cAAc;AAAA,EAChB;AACA,gBAAc,mBAAmB,KAAK,UAAU,eAAe,MAAM,CAAC,CAAC;AACvE,UAAQ,IAAI,MAAM,MAAM,QAAG,IAAI,gCAAgC;AAG/D,QAAM,UAAU,KAAK,aAAa,MAAM;AACxC,QAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA,kBAIP,QAAQ,IAAI,MAAM,KAAK,SAAS;AAAA,uBAC3B,iBAAiB;AAAA,wBAChB,mBAAmB;AAAA;AAGzC,MAAI,WAAW,OAAO,GAAG;AACvB,UAAM,aAAa,aAAa,SAAS,OAAO;AAChD,QAAI,CAAC,WAAW,SAAS,UAAU,GAAG;AACpC,qBAAe,SAAS,cAAc;AACtC,cAAQ,IAAI,MAAM,MAAM,QAAG,IAAI,sCAAsC;AAAA,IACvE;AAAA,EACF,OAAO;AACL,kBAAc,SAAS,eAAe,KAAK,IAAI,IAAI;AACnD,YAAQ,IAAI,MAAM,MAAM,QAAG,IAAI,0CAA0C;AAAA,EAC3E;AAEA,UAAQ,IAAI,MAAM,MAAM,QAAG,IAAI,iCAAiC;AAChE,UAAQ;AAAA,IACN,MAAM;AAAA,MACJ;AAAA,IACF;AAAA,EACF;AACF;AAEA,QAAQ,IAAI,MAAM,MAAM,KAAK,kDAA6C,CAAC;AAC3E,QAAQ,IAAI,MAAM,KAAK,aAAa,CAAC;AACrC,QAAQ,IAAI,MAAM,KAAK,mDAAmD,CAAC;AAC3E,QAAQ,IAAI,MAAM,KAAK,wBAAwB,CAAC;AAChD,QAAQ,IAAI,MAAM,KAAK,kCAAkC,CAAC;AAC1D,IAAI,eAAe;AACjB,UAAQ,IAAI,MAAM,KAAK,gDAAgD,CAAC;AAC1E;AACA,QAAQ,IAAI,MAAM,KAAK,oBAAoB,CAAC;AAC5C,QAAQ;AAAA,EACN,MAAM,KAAK,mBAAmB,IAAI;AACpC;AACA,QAAQ,IAAI,MAAM,KAAK,kBAAkB,IAAI,6BAA6B;AAC1E,QAAQ,IAAI,MAAM,KAAK,mBAAmB,IAAI,0BAA0B;AACxE,IAAI,eAAe;AACjB,UAAQ;AAAA,IACN,MAAM,KAAK,yBAAyB,IAAI;AAAA,EAC1C;AACF;AACA,QAAQ,IAAI;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -37,7 +37,8 @@ const DEFAULT_SM_CONFIG = {
|
|
|
37
37
|
defaultWhatsApp: false,
|
|
38
38
|
defaultModelRouting: false,
|
|
39
39
|
defaultSweep: true,
|
|
40
|
-
defaultGreptile: true
|
|
40
|
+
defaultGreptile: true,
|
|
41
|
+
defaultGEPA: false
|
|
41
42
|
};
|
|
42
43
|
function getConfigPath() {
|
|
43
44
|
return path.join(os.homedir(), ".stackmemory", "claude-sm.json");
|
|
@@ -84,7 +85,8 @@ class ClaudeSM {
|
|
|
84
85
|
useModelRouting: this.smConfig.defaultModelRouting,
|
|
85
86
|
useThinkingMode: false,
|
|
86
87
|
useSweep: this.smConfig.defaultSweep,
|
|
87
|
-
useGreptile: this.smConfig.defaultGreptile
|
|
88
|
+
useGreptile: this.smConfig.defaultGreptile,
|
|
89
|
+
useGEPA: this.smConfig.defaultGEPA
|
|
88
90
|
};
|
|
89
91
|
this.stackmemoryPath = this.findStackMemory();
|
|
90
92
|
this.worktreeScriptPath = path.join(
|
|
@@ -154,6 +156,67 @@ class ClaudeSM {
|
|
|
154
156
|
}
|
|
155
157
|
return null;
|
|
156
158
|
}
|
|
159
|
+
gepaProcess = null;
|
|
160
|
+
startGEPAWatcher() {
|
|
161
|
+
const claudeMdPath = fs.existsSync(path.join(process.cwd(), "CLAUDE.md")) ? path.join(process.cwd(), "CLAUDE.md") : null;
|
|
162
|
+
if (!claudeMdPath) {
|
|
163
|
+
console.log(chalk.gray(" Prompt Forge: disabled (no CLAUDE.md found)"));
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
const gepaPaths = [
|
|
167
|
+
// From dist/src/cli -> scripts/gepa (3 levels up)
|
|
168
|
+
path.join(__dirname, "../../../scripts/gepa/hooks/auto-optimize.js"),
|
|
169
|
+
// From src/cli -> scripts/gepa (2 levels up, for dev mode)
|
|
170
|
+
path.join(__dirname, "../../scripts/gepa/hooks/auto-optimize.js"),
|
|
171
|
+
// Global install location
|
|
172
|
+
path.join(
|
|
173
|
+
os.homedir(),
|
|
174
|
+
".stackmemory",
|
|
175
|
+
"scripts",
|
|
176
|
+
"gepa",
|
|
177
|
+
"hooks",
|
|
178
|
+
"auto-optimize.js"
|
|
179
|
+
),
|
|
180
|
+
// npm global install
|
|
181
|
+
path.join(
|
|
182
|
+
__dirname,
|
|
183
|
+
"..",
|
|
184
|
+
"..",
|
|
185
|
+
"scripts",
|
|
186
|
+
"gepa",
|
|
187
|
+
"hooks",
|
|
188
|
+
"auto-optimize.js"
|
|
189
|
+
)
|
|
190
|
+
];
|
|
191
|
+
const gepaScript = gepaPaths.find((p) => fs.existsSync(p));
|
|
192
|
+
if (!gepaScript) {
|
|
193
|
+
console.log(chalk.gray(" Prompt Forge: disabled (scripts not found)"));
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
this.gepaProcess = spawn("node", [gepaScript, "watch", claudeMdPath], {
|
|
197
|
+
detached: true,
|
|
198
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
199
|
+
env: { ...process.env, GEPA_SILENT: "1" }
|
|
200
|
+
});
|
|
201
|
+
this.gepaProcess.unref();
|
|
202
|
+
this.gepaProcess.stdout?.on("data", (data) => {
|
|
203
|
+
const output = data.toString().trim();
|
|
204
|
+
if (output && !output.includes("Watching")) {
|
|
205
|
+
console.log(chalk.magenta(`[GEPA] ${output}`));
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
console.log(
|
|
209
|
+
chalk.cyan(
|
|
210
|
+
` Prompt Forge: watching ${path.basename(claudeMdPath)} for optimization`
|
|
211
|
+
)
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
stopGEPAWatcher() {
|
|
215
|
+
if (this.gepaProcess) {
|
|
216
|
+
this.gepaProcess.kill("SIGTERM");
|
|
217
|
+
this.gepaProcess = null;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
157
220
|
ensureGreptileMcp() {
|
|
158
221
|
const apiKey = process.env["GREPTILE_API_KEY"];
|
|
159
222
|
const ghToken = process.env["GITHUB_TOKEN"];
|
|
@@ -582,6 +645,12 @@ class ClaudeSM {
|
|
|
582
645
|
case "--no-greptile":
|
|
583
646
|
this.config.useGreptile = false;
|
|
584
647
|
break;
|
|
648
|
+
case "--gepa":
|
|
649
|
+
this.config.useGEPA = true;
|
|
650
|
+
break;
|
|
651
|
+
case "--no-gepa":
|
|
652
|
+
this.config.useGEPA = false;
|
|
653
|
+
break;
|
|
585
654
|
default:
|
|
586
655
|
claudeArgs.push(arg);
|
|
587
656
|
}
|
|
@@ -727,6 +796,9 @@ class ClaudeSM {
|
|
|
727
796
|
if (this.config.useGreptile) {
|
|
728
797
|
this.ensureGreptileMcp();
|
|
729
798
|
}
|
|
799
|
+
if (this.config.useGEPA) {
|
|
800
|
+
this.startGEPAWatcher();
|
|
801
|
+
}
|
|
730
802
|
if (this.config.useWhatsApp) {
|
|
731
803
|
console.log(
|
|
732
804
|
chalk.cyan("\u{1F4F1} WhatsApp mode: notifications + webhook enabled")
|
|
@@ -817,6 +889,7 @@ class ClaudeSM {
|
|
|
817
889
|
process.exit(1);
|
|
818
890
|
});
|
|
819
891
|
claude.on("exit", async (code) => {
|
|
892
|
+
this.stopGEPAWatcher();
|
|
820
893
|
const status = fallbackMonitor.getStatus();
|
|
821
894
|
if (status.inFallback) {
|
|
822
895
|
console.log(
|
|
@@ -870,38 +943,24 @@ const configCmd = program.command("config").description("Manage claude-sm defaul
|
|
|
870
943
|
configCmd.command("show").description("Show current default settings").action(() => {
|
|
871
944
|
const config = loadSMConfig();
|
|
872
945
|
console.log(chalk.blue("claude-sm defaults:"));
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
);
|
|
876
|
-
console.log(
|
|
877
|
-
|
|
878
|
-
);
|
|
879
|
-
console.log(
|
|
880
|
-
|
|
881
|
-
);
|
|
882
|
-
console.log(
|
|
883
|
-
|
|
884
|
-
);
|
|
885
|
-
console.log(
|
|
886
|
-
|
|
887
|
-
);
|
|
888
|
-
console.log(
|
|
889
|
-
` defaultNotifyOnDone: ${config.defaultNotifyOnDone ? chalk.green("true") : chalk.gray("false")}`
|
|
890
|
-
);
|
|
891
|
-
console.log(
|
|
892
|
-
` defaultWhatsApp: ${config.defaultWhatsApp ? chalk.green("true") : chalk.gray("false")}`
|
|
893
|
-
);
|
|
894
|
-
console.log(
|
|
895
|
-
` defaultModelRouting: ${config.defaultModelRouting ? chalk.green("true") : chalk.gray("false")}`
|
|
896
|
-
);
|
|
897
|
-
console.log(
|
|
898
|
-
` defaultSweep: ${config.defaultSweep ? chalk.green("true") : chalk.gray("false")}`
|
|
899
|
-
);
|
|
900
|
-
console.log(
|
|
901
|
-
` defaultGreptile: ${config.defaultGreptile ? chalk.green("true") : chalk.gray("false")}`
|
|
902
|
-
);
|
|
946
|
+
const on = chalk.green("ON ");
|
|
947
|
+
const off = chalk.gray("OFF");
|
|
948
|
+
console.log(chalk.cyan("\n Feature Status"));
|
|
949
|
+
console.log(chalk.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
950
|
+
console.log(` Predictive Edit ${config.defaultSweep ? on : off}`);
|
|
951
|
+
console.log(` Code Review ${config.defaultGreptile ? on : off}`);
|
|
952
|
+
console.log(` Prompt Forge ${config.defaultGEPA ? on : off}`);
|
|
953
|
+
console.log(` Model Switcher ${config.defaultModelRouting ? on : off}`);
|
|
954
|
+
console.log(` Safe Branch ${config.defaultWorktree ? on : off}`);
|
|
955
|
+
console.log(` Mobile Sync ${config.defaultWhatsApp ? on : off}`);
|
|
956
|
+
console.log(` Session Insights ${config.defaultTracing ? on : off}`);
|
|
957
|
+
console.log(` Task Alert ${config.defaultNotifyOnDone ? on : off}`);
|
|
958
|
+
console.log(chalk.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
959
|
+
console.log(` Sandbox ${config.defaultSandbox ? on : off}`);
|
|
960
|
+
console.log(` Chrome ${config.defaultChrome ? on : off}`);
|
|
961
|
+
console.log(` Remote ${config.defaultRemote ? on : off}`);
|
|
903
962
|
console.log(chalk.gray(`
|
|
904
|
-
Config: ${getConfigPath()}`));
|
|
963
|
+
Config: ${getConfigPath()}`));
|
|
905
964
|
});
|
|
906
965
|
configCmd.command("set <key> <value>").description("Set a default (e.g., set worktree true)").action((key, value) => {
|
|
907
966
|
const config = loadSMConfig();
|
|
@@ -918,14 +977,15 @@ configCmd.command("set <key> <value>").description("Set a default (e.g., set wor
|
|
|
918
977
|
"model-routing": "defaultModelRouting",
|
|
919
978
|
modelrouting: "defaultModelRouting",
|
|
920
979
|
sweep: "defaultSweep",
|
|
921
|
-
greptile: "defaultGreptile"
|
|
980
|
+
greptile: "defaultGreptile",
|
|
981
|
+
gepa: "defaultGEPA"
|
|
922
982
|
};
|
|
923
983
|
const configKey = keyMap[key];
|
|
924
984
|
if (!configKey) {
|
|
925
985
|
console.log(chalk.red(`Unknown key: ${key}`));
|
|
926
986
|
console.log(
|
|
927
987
|
chalk.gray(
|
|
928
|
-
"Valid keys: worktree, sandbox, chrome, tracing, remote, notify-done, whatsapp, sweep, greptile"
|
|
988
|
+
"Valid keys: worktree, sandbox, chrome, tracing, remote, notify-done, whatsapp, sweep, greptile, gepa"
|
|
929
989
|
)
|
|
930
990
|
);
|
|
931
991
|
process.exit(1);
|
|
@@ -1016,6 +1076,21 @@ configCmd.command("greptile-off").description("Disable Greptile AI code review b
|
|
|
1016
1076
|
saveSMConfig(config);
|
|
1017
1077
|
console.log(chalk.green("Greptile disabled by default"));
|
|
1018
1078
|
});
|
|
1079
|
+
configCmd.command("gepa-on").description("Enable GEPA auto-optimization of CLAUDE.md on changes").action(() => {
|
|
1080
|
+
const config = loadSMConfig();
|
|
1081
|
+
config.defaultGEPA = true;
|
|
1082
|
+
saveSMConfig(config);
|
|
1083
|
+
console.log(chalk.green("GEPA auto-optimization enabled by default"));
|
|
1084
|
+
console.log(
|
|
1085
|
+
chalk.gray("CLAUDE.md changes will trigger evolutionary optimization")
|
|
1086
|
+
);
|
|
1087
|
+
});
|
|
1088
|
+
configCmd.command("gepa-off").description("Disable GEPA auto-optimization").action(() => {
|
|
1089
|
+
const config = loadSMConfig();
|
|
1090
|
+
config.defaultGEPA = false;
|
|
1091
|
+
saveSMConfig(config);
|
|
1092
|
+
console.log(chalk.green("GEPA auto-optimization disabled by default"));
|
|
1093
|
+
});
|
|
1019
1094
|
configCmd.command("setup").description("Interactive feature setup wizard").action(async () => {
|
|
1020
1095
|
const inquirer = await import("inquirer");
|
|
1021
1096
|
const ora = (await import("ora")).default;
|
|
@@ -1024,38 +1099,43 @@ configCmd.command("setup").description("Interactive feature setup wizard").actio
|
|
|
1024
1099
|
const features = [
|
|
1025
1100
|
{
|
|
1026
1101
|
key: "defaultSweep",
|
|
1027
|
-
name: "
|
|
1028
|
-
desc: "
|
|
1102
|
+
name: "Predictive Edit",
|
|
1103
|
+
desc: "AI-powered next-edit suggestions in real-time"
|
|
1029
1104
|
},
|
|
1030
1105
|
{
|
|
1031
1106
|
key: "defaultGreptile",
|
|
1032
|
-
name: "
|
|
1033
|
-
desc: "
|
|
1107
|
+
name: "Code Review",
|
|
1108
|
+
desc: "Automated code review with deep codebase intelligence"
|
|
1109
|
+
},
|
|
1110
|
+
{
|
|
1111
|
+
key: "defaultGEPA",
|
|
1112
|
+
name: "Prompt Forge",
|
|
1113
|
+
desc: "Evolutionary optimization of system prompts"
|
|
1034
1114
|
},
|
|
1035
1115
|
{
|
|
1036
1116
|
key: "defaultModelRouting",
|
|
1037
|
-
name: "Model
|
|
1038
|
-
desc: "
|
|
1117
|
+
name: "Model Switcher",
|
|
1118
|
+
desc: "Smart routing across Claude, Qwen, and other models"
|
|
1039
1119
|
},
|
|
1040
1120
|
{
|
|
1041
1121
|
key: "defaultWorktree",
|
|
1042
|
-
name: "
|
|
1043
|
-
desc: "
|
|
1122
|
+
name: "Safe Branch",
|
|
1123
|
+
desc: "Isolated git worktrees for conflict-free parallel work"
|
|
1044
1124
|
},
|
|
1045
1125
|
{
|
|
1046
1126
|
key: "defaultWhatsApp",
|
|
1047
|
-
name: "
|
|
1048
|
-
desc: "
|
|
1127
|
+
name: "Mobile Sync",
|
|
1128
|
+
desc: "Remote control and notifications via WhatsApp"
|
|
1049
1129
|
},
|
|
1050
1130
|
{
|
|
1051
1131
|
key: "defaultTracing",
|
|
1052
|
-
name: "
|
|
1053
|
-
desc: "
|
|
1132
|
+
name: "Session Insights",
|
|
1133
|
+
desc: "Deep execution tracing and performance analytics"
|
|
1054
1134
|
},
|
|
1055
1135
|
{
|
|
1056
1136
|
key: "defaultNotifyOnDone",
|
|
1057
|
-
name: "
|
|
1058
|
-
desc: "
|
|
1137
|
+
name: "Task Alert",
|
|
1138
|
+
desc: "Instant notification when sessions complete"
|
|
1059
1139
|
}
|
|
1060
1140
|
];
|
|
1061
1141
|
const choices = features.map((f) => ({
|
|
@@ -1147,7 +1227,7 @@ Saved to ${getConfigPath()}`));
|
|
|
1147
1227
|
program.option("-w, --worktree", "Create isolated worktree for this instance").option("-W, --no-worktree", "Disable worktree (override default)").option("-r, --remote", "Enable remote mode (WhatsApp for all questions)").option("--no-remote", "Disable remote mode (override default)").option("-n, --notify-done", "Send WhatsApp notification when session ends").option("--no-notify-done", "Disable notification when session ends").option(
|
|
1148
1228
|
"--whatsapp",
|
|
1149
1229
|
"Enable WhatsApp mode (auto-start webhook + ngrok + notifications)"
|
|
1150
|
-
).option("--no-whatsapp", "Disable WhatsApp mode (override default)").option("-s, --sandbox", "Enable sandbox mode (file/network restrictions)").option("-c, --chrome", "Enable Chrome automation").option("-a, --auto", "Automatically detect and apply best settings").option("-b, --branch <name>", "Specify branch name for worktree").option("-t, --task <desc>", "Task description for context").option("--claude-bin <path>", "Path to claude CLI (or use CLAUDE_BIN)").option("--no-context", "Disable StackMemory context integration").option("--no-trace", "Disable debug tracing (enabled by default)").option("--verbose-trace", "Enable verbose debug tracing with full details").option("--think", "Enable thinking mode with Qwen (deep reasoning)").option("--think-hard", "Alias for --think").option("--ultrathink", "Alias for --think").option("--qwen", "Force Qwen provider for this session").option("--openai", "Force OpenAI provider for this session").option("--ollama", "Force Ollama provider for this session").option("--model-routing", "Enable model routing").option("--no-model-routing", "Disable model routing").option("--sweep", "Enable Sweep next-edit predictions (PTY wrapper)").option("--no-sweep", "Disable Sweep predictions").option("--greptile", "Enable Greptile AI code review (MCP server)").option("--no-greptile", "Disable Greptile integration").helpOption("-h, --help", "Display help").allowUnknownOption(true).action(async (_options) => {
|
|
1230
|
+
).option("--no-whatsapp", "Disable WhatsApp mode (override default)").option("-s, --sandbox", "Enable sandbox mode (file/network restrictions)").option("-c, --chrome", "Enable Chrome automation").option("-a, --auto", "Automatically detect and apply best settings").option("-b, --branch <name>", "Specify branch name for worktree").option("-t, --task <desc>", "Task description for context").option("--claude-bin <path>", "Path to claude CLI (or use CLAUDE_BIN)").option("--no-context", "Disable StackMemory context integration").option("--no-trace", "Disable debug tracing (enabled by default)").option("--verbose-trace", "Enable verbose debug tracing with full details").option("--think", "Enable thinking mode with Qwen (deep reasoning)").option("--think-hard", "Alias for --think").option("--ultrathink", "Alias for --think").option("--qwen", "Force Qwen provider for this session").option("--openai", "Force OpenAI provider for this session").option("--ollama", "Force Ollama provider for this session").option("--model-routing", "Enable model routing").option("--no-model-routing", "Disable model routing").option("--sweep", "Enable Sweep next-edit predictions (PTY wrapper)").option("--no-sweep", "Disable Sweep predictions").option("--greptile", "Enable Greptile AI code review (MCP server)").option("--no-greptile", "Disable Greptile integration").option("--gepa", "Enable GEPA auto-optimization of CLAUDE.md").option("--no-gepa", "Disable GEPA auto-optimization").helpOption("-h, --help", "Display help").allowUnknownOption(true).action(async (_options) => {
|
|
1151
1231
|
const claudeSM = new ClaudeSM();
|
|
1152
1232
|
const args = process.argv.slice(2);
|
|
1153
1233
|
await claudeSM.run(args);
|