@stackmemoryai/stackmemory 0.5.58 → 0.5.61

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 (932) hide show
  1. package/README.md +105 -1
  2. package/dist/scripts/benchmark-performance.js +48 -0
  3. package/dist/scripts/benchmark-performance.js.map +7 -0
  4. package/dist/scripts/check-redis.js +42 -0
  5. package/dist/scripts/check-redis.js.map +7 -0
  6. package/dist/scripts/initialize.js +116 -0
  7. package/dist/scripts/initialize.js.map +7 -0
  8. package/dist/scripts/list-linear-tasks.js +124 -0
  9. package/dist/scripts/list-linear-tasks.js.map +7 -0
  10. package/dist/scripts/measure-handoff-impact.js +340 -0
  11. package/dist/scripts/measure-handoff-impact.js.map +7 -0
  12. package/dist/scripts/query-chromadb.js +160 -0
  13. package/dist/scripts/query-chromadb.js.map +7 -0
  14. package/dist/scripts/show-linear-summary.js +119 -0
  15. package/dist/scripts/show-linear-summary.js.map +7 -0
  16. package/dist/scripts/simple-swarm-demo.js +90 -0
  17. package/dist/scripts/simple-swarm-demo.js.map +7 -0
  18. package/dist/scripts/status.js +155 -0
  19. package/dist/scripts/status.js.map +7 -0
  20. package/dist/scripts/test-chromadb-sync.js +192 -0
  21. package/dist/scripts/test-chromadb-sync.js.map +7 -0
  22. package/dist/scripts/test-ralph-iteration-fix.js +86 -0
  23. package/dist/scripts/test-ralph-iteration-fix.js.map +7 -0
  24. package/dist/scripts/test-ralph-iterations.js +121 -0
  25. package/dist/scripts/test-ralph-iterations.js.map +7 -0
  26. package/dist/scripts/test-redis-storage.js +389 -0
  27. package/dist/scripts/test-redis-storage.js.map +7 -0
  28. package/dist/scripts/test-simple-ralph-state-sync.js +115 -0
  29. package/dist/scripts/test-simple-ralph-state-sync.js.map +7 -0
  30. package/dist/scripts/test-swarm-fixes.js +125 -0
  31. package/dist/scripts/test-swarm-fixes.js.map +7 -0
  32. package/dist/scripts/test-swarm-tui.js +23 -0
  33. package/dist/scripts/test-swarm-tui.js.map +7 -0
  34. package/dist/scripts/test-tui-shortcuts.js +52 -0
  35. package/dist/scripts/test-tui-shortcuts.js.map +7 -0
  36. package/dist/scripts/validate-tui-shortcuts.js +60 -0
  37. package/dist/scripts/validate-tui-shortcuts.js.map +7 -0
  38. package/dist/src/agents/core/agent-task-manager.js.map +7 -0
  39. package/dist/src/agents/verifiers/base-verifier.js.map +7 -0
  40. package/dist/src/agents/verifiers/formatter-verifier.js.map +7 -0
  41. package/dist/src/agents/verifiers/llm-judge.js.map +7 -0
  42. package/dist/src/cli/auto-detect.js.map +7 -0
  43. package/dist/src/cli/claude-sm-danger.js.map +7 -0
  44. package/dist/src/cli/claude-sm.js +1236 -0
  45. package/dist/src/cli/claude-sm.js.map +7 -0
  46. package/dist/src/cli/codex-sm-danger.js.map +7 -0
  47. package/dist/src/cli/codex-sm.js.map +7 -0
  48. package/dist/src/cli/commands/api.js.map +7 -0
  49. package/dist/src/cli/commands/auto-background.js.map +7 -0
  50. package/dist/src/cli/commands/cleanup-processes.js.map +7 -0
  51. package/dist/src/cli/commands/clear.js.map +7 -0
  52. package/dist/src/cli/commands/config.js.map +7 -0
  53. package/dist/src/cli/commands/context-rehydrate.js.map +7 -0
  54. package/dist/src/cli/commands/context.js.map +7 -0
  55. package/dist/src/cli/commands/daemon.js.map +7 -0
  56. package/dist/src/cli/commands/dashboard.js.map +7 -0
  57. package/dist/src/cli/commands/db.js.map +7 -0
  58. package/dist/src/cli/commands/decision.js.map +7 -0
  59. package/dist/src/cli/commands/discovery.js.map +7 -0
  60. package/dist/src/cli/commands/handoff.js.map +7 -0
  61. package/dist/src/cli/commands/hooks.js.map +7 -0
  62. package/dist/src/cli/commands/linear.js.map +7 -0
  63. package/dist/src/cli/commands/log.js.map +7 -0
  64. package/dist/src/cli/commands/login.js.map +7 -0
  65. package/dist/src/cli/commands/migrate.js.map +7 -0
  66. package/dist/src/cli/commands/model.js.map +7 -0
  67. package/dist/src/cli/commands/onboard.js.map +7 -0
  68. package/dist/src/cli/commands/projects.js.map +7 -0
  69. package/dist/src/cli/commands/ralph.js.map +7 -0
  70. package/dist/src/cli/commands/retrieval.js.map +7 -0
  71. package/dist/src/cli/commands/search.js +173 -0
  72. package/dist/src/cli/commands/search.js.map +7 -0
  73. package/dist/src/cli/commands/service.js.map +7 -0
  74. package/dist/src/cli/commands/session.js.map +7 -0
  75. package/dist/src/cli/commands/settings.js.map +7 -0
  76. package/dist/src/cli/commands/setup.js.map +7 -0
  77. package/dist/src/cli/commands/shell.js.map +7 -0
  78. package/dist/src/cli/commands/signup.js.map +7 -0
  79. package/dist/src/cli/commands/skills.js.map +7 -0
  80. package/dist/src/cli/commands/sms-notify.js.map +7 -0
  81. package/dist/src/cli/commands/storage-tier.js.map +7 -0
  82. package/dist/src/cli/commands/sweep.js.map +7 -0
  83. package/dist/src/cli/commands/tasks.js.map +7 -0
  84. package/dist/src/cli/commands/worktree.js.map +7 -0
  85. package/dist/src/cli/index.js +609 -0
  86. package/dist/src/cli/index.js.map +7 -0
  87. package/dist/src/cli/opencode-sm.js.map +7 -0
  88. package/dist/src/cli/utils/viewer.js.map +7 -0
  89. package/dist/src/core/config/config-manager.js.map +7 -0
  90. package/dist/src/core/config/feature-flags.js.map +7 -0
  91. package/dist/src/core/config/storage-config.js.map +7 -0
  92. package/dist/src/core/config/types.js.map +7 -0
  93. package/dist/src/core/context/auto-context.js.map +7 -0
  94. package/dist/src/core/context/dual-stack-manager.js.map +7 -0
  95. package/dist/src/core/context/enhanced-rehydration.js.map +7 -0
  96. package/dist/src/core/context/frame-database.js.map +7 -0
  97. package/dist/src/core/context/frame-digest.js.map +7 -0
  98. package/dist/src/core/context/frame-handoff-manager.js.map +7 -0
  99. package/dist/src/core/context/frame-lifecycle-hooks.js.map +7 -0
  100. package/dist/src/core/context/frame-recovery.js.map +7 -0
  101. package/dist/src/core/context/frame-stack.js.map +7 -0
  102. package/dist/src/core/context/index.js.map +7 -0
  103. package/dist/src/core/context/permission-manager.js.map +7 -0
  104. package/dist/src/core/context/recursive-context-manager.js.map +7 -0
  105. package/dist/src/core/context/refactored-frame-manager.js.map +7 -0
  106. package/dist/src/core/context/shared-context-layer.js.map +7 -0
  107. package/dist/src/core/context/stack-merge-resolver.js.map +7 -0
  108. package/dist/src/core/context/validation.js.map +7 -0
  109. package/dist/src/core/database/batch-operations.js.map +7 -0
  110. package/dist/src/core/database/connection-pool.js.map +7 -0
  111. package/dist/src/core/database/database-adapter.js.map +7 -0
  112. package/dist/src/core/database/migration-manager.js.map +7 -0
  113. package/dist/src/core/database/query-cache.js.map +7 -0
  114. package/dist/src/core/database/query-router.js.map +7 -0
  115. package/dist/src/core/database/sqlite-adapter.js +738 -0
  116. package/dist/src/core/database/sqlite-adapter.js.map +7 -0
  117. package/dist/src/core/digest/enhanced-hybrid-digest.js.map +7 -0
  118. package/dist/src/core/digest/frame-digest-integration.js.map +7 -0
  119. package/dist/src/core/digest/hybrid-digest-generator.js.map +7 -0
  120. package/dist/src/core/digest/index.js.map +7 -0
  121. package/dist/src/core/digest/types.js.map +7 -0
  122. package/dist/src/core/errors/error-utils.js +208 -0
  123. package/dist/src/core/errors/error-utils.js.map +7 -0
  124. package/dist/src/core/errors/index.js +521 -0
  125. package/dist/src/core/errors/index.js.map +7 -0
  126. package/dist/src/core/errors/recovery.js.map +7 -0
  127. package/dist/src/core/execution/parallel-executor.js.map +7 -0
  128. package/dist/src/core/extensions/custom-tools.js +567 -0
  129. package/dist/src/core/extensions/custom-tools.js.map +7 -0
  130. package/dist/src/core/extensions/index.js +55 -0
  131. package/dist/src/core/extensions/index.js.map +7 -0
  132. package/dist/src/core/extensions/loader.js +709 -0
  133. package/dist/src/core/extensions/loader.js.map +7 -0
  134. package/dist/src/core/extensions/plugin-system.js +506 -0
  135. package/dist/src/core/extensions/plugin-system.js.map +7 -0
  136. package/dist/src/core/extensions/provider-adapter.js +617 -0
  137. package/dist/src/core/extensions/provider-adapter.js.map +7 -0
  138. package/dist/src/core/extensions/sandbox-runtime.js +664 -0
  139. package/dist/src/core/extensions/sandbox-runtime.js.map +7 -0
  140. package/dist/src/core/frame/workflow-templates.js.map +7 -0
  141. package/dist/src/core/merge/conflict-detector.js.map +7 -0
  142. package/dist/src/core/merge/index.js.map +7 -0
  143. package/dist/src/core/merge/resolution-engine.js.map +7 -0
  144. package/dist/src/core/merge/stack-diff.js.map +7 -0
  145. package/dist/src/core/merge/unified-merge-resolver.js +303 -0
  146. package/dist/src/core/merge/unified-merge-resolver.js.map +7 -0
  147. package/dist/src/core/models/fallback-monitor.js.map +7 -0
  148. package/dist/src/core/models/model-router.js.map +7 -0
  149. package/dist/src/core/monitoring/error-handler.js.map +7 -0
  150. package/dist/src/core/monitoring/logger.js +202 -0
  151. package/dist/src/core/monitoring/logger.js.map +7 -0
  152. package/dist/src/core/monitoring/metrics.js.map +7 -0
  153. package/dist/src/core/monitoring/progress-tracker.js.map +7 -0
  154. package/dist/src/core/monitoring/session-monitor.js.map +7 -0
  155. package/dist/src/core/performance/context-cache.js.map +7 -0
  156. package/dist/src/core/performance/index.js.map +7 -0
  157. package/dist/src/core/performance/lazy-context-loader.js.map +7 -0
  158. package/dist/src/core/performance/monitor.js.map +7 -0
  159. package/dist/src/core/performance/optimized-frame-context.js.map +7 -0
  160. package/dist/src/core/performance/performance-benchmark.js.map +7 -0
  161. package/dist/src/core/performance/performance-profiler.js.map +7 -0
  162. package/dist/src/core/performance/streaming-jsonl-parser.js.map +7 -0
  163. package/dist/src/core/persistence/postgres-adapter.js.map +7 -0
  164. package/dist/src/core/projects/project-isolation.js.map +7 -0
  165. package/dist/src/core/projects/project-manager.js.map +7 -0
  166. package/dist/src/core/query/query-parser.js.map +7 -0
  167. package/dist/src/core/query/query-templates.js.map +7 -0
  168. package/dist/src/core/retrieval/context-retriever.js.map +7 -0
  169. package/dist/src/core/retrieval/index.js.map +7 -0
  170. package/dist/src/core/retrieval/llm-context-retrieval.js.map +7 -0
  171. package/dist/src/core/retrieval/llm-provider.js.map +7 -0
  172. package/dist/src/core/retrieval/retrieval-audit.js.map +7 -0
  173. package/dist/src/core/retrieval/summary-generator.js.map +7 -0
  174. package/dist/src/core/retrieval/types.js.map +7 -0
  175. package/dist/src/core/security/index.js +35 -0
  176. package/dist/src/core/security/index.js.map +7 -0
  177. package/dist/src/core/security/input-sanitizer.js +321 -0
  178. package/dist/src/core/security/input-sanitizer.js.map +7 -0
  179. package/dist/src/core/session/clear-survival.js.map +7 -0
  180. package/dist/src/core/session/enhanced-handoff.js.map +7 -0
  181. package/dist/src/core/session/handoff-generator.js.map +7 -0
  182. package/dist/src/core/session/index.js.map +7 -0
  183. package/dist/src/core/session/session-manager.js.map +7 -0
  184. package/dist/src/core/skills/index.js.map +7 -0
  185. package/dist/src/core/skills/skill-storage.js.map +7 -0
  186. package/dist/src/core/skills/types.js.map +7 -0
  187. package/dist/src/core/storage/chromadb-adapter.js +380 -0
  188. package/dist/src/core/storage/chromadb-adapter.js.map +7 -0
  189. package/dist/src/core/storage/infinite-storage.js.map +7 -0
  190. package/dist/src/core/storage/remote-storage.js.map +7 -0
  191. package/dist/src/core/storage/two-tier-storage.js.map +7 -0
  192. package/dist/src/core/trace/cli-trace-wrapper.js.map +7 -0
  193. package/dist/src/core/trace/db-trace-wrapper.js.map +7 -0
  194. package/dist/src/core/trace/debug-trace.js.map +7 -0
  195. package/dist/src/core/trace/index.js.map +7 -0
  196. package/dist/src/core/trace/linear-api-wrapper.js.map +7 -0
  197. package/dist/src/core/trace/trace-detector.js.map +7 -0
  198. package/dist/src/core/trace/trace-store.js.map +7 -0
  199. package/dist/src/core/trace/types.js.map +7 -0
  200. package/dist/src/core/utils/async-mutex.js.map +7 -0
  201. package/dist/src/core/utils/compression.js.map +7 -0
  202. package/dist/src/core/utils/update-checker.js.map +7 -0
  203. package/dist/src/core/worktree/worktree-manager.js.map +7 -0
  204. package/dist/src/daemon/daemon-config.js.map +7 -0
  205. package/dist/src/daemon/services/context-service.js.map +7 -0
  206. package/dist/src/daemon/services/linear-service.js.map +7 -0
  207. package/dist/src/daemon/session-daemon.js.map +7 -0
  208. package/dist/src/daemon/unified-daemon.js.map +7 -0
  209. package/dist/src/features/analytics/api/analytics-api.js.map +7 -0
  210. package/dist/src/features/analytics/core/analytics-service.js.map +7 -0
  211. package/dist/src/features/analytics/index.js.map +7 -0
  212. package/dist/src/features/analytics/queries/metrics-queries.js.map +7 -0
  213. package/dist/src/features/browser/browser-mcp.js.map +7 -0
  214. package/dist/src/features/sweep/index.js.map +7 -0
  215. package/dist/src/features/sweep/prediction-client.js.map +7 -0
  216. package/dist/src/features/sweep/prompt-builder.js.map +7 -0
  217. package/dist/src/features/sweep/pty-wrapper.js.map +7 -0
  218. package/dist/src/features/sweep/state-watcher.js.map +7 -0
  219. package/dist/src/features/sweep/status-bar.js.map +7 -0
  220. package/dist/src/features/sweep/sweep-server-manager.js.map +7 -0
  221. package/dist/src/features/sweep/tab-interceptor.js.map +7 -0
  222. package/dist/src/features/sweep/types.js.map +7 -0
  223. package/dist/src/features/tasks/linear-task-manager.js.map +7 -0
  224. package/dist/src/features/tasks/task-aware-context.js.map +7 -0
  225. package/dist/src/features/tui/simple-monitor.js.map +7 -0
  226. package/dist/src/features/tui/swarm-monitor.js.map +7 -0
  227. package/dist/src/features/web/client/stores/task-store.js.map +7 -0
  228. package/dist/src/features/web/server/index.js.map +7 -0
  229. package/dist/src/hooks/auto-background.js.map +7 -0
  230. package/dist/src/hooks/claude-code-whatsapp-hook.js.map +7 -0
  231. package/dist/src/hooks/config.js.map +7 -0
  232. package/dist/src/hooks/daemon.js.map +7 -0
  233. package/dist/src/hooks/events.js.map +7 -0
  234. package/dist/src/hooks/index.js.map +7 -0
  235. package/dist/src/hooks/linear-task-picker.js.map +7 -0
  236. package/dist/src/hooks/schemas.js.map +7 -0
  237. package/dist/src/hooks/secure-fs.js.map +7 -0
  238. package/dist/src/hooks/security-logger.js.map +7 -0
  239. package/dist/src/hooks/session-summary.js.map +7 -0
  240. package/dist/src/hooks/sms-action-runner.js.map +7 -0
  241. package/dist/src/hooks/sms-notify.js.map +7 -0
  242. package/dist/src/hooks/sms-watcher.js.map +7 -0
  243. package/dist/src/hooks/sms-webhook.js.map +7 -0
  244. package/dist/src/hooks/whatsapp-commands.js.map +7 -0
  245. package/dist/src/hooks/whatsapp-scheduler.js.map +7 -0
  246. package/dist/src/hooks/whatsapp-sync.js.map +7 -0
  247. package/dist/src/index.js.map +7 -0
  248. package/dist/src/integrations/anthropic/client.js.map +7 -0
  249. package/dist/src/integrations/claude-code/agent-bridge.js.map +7 -0
  250. package/dist/src/integrations/claude-code/enhanced-pre-clear-hooks.js.map +7 -0
  251. package/dist/src/integrations/claude-code/lifecycle-hooks.js.map +7 -0
  252. package/dist/src/integrations/claude-code/post-task-hooks.js.map +7 -0
  253. package/dist/src/integrations/claude-code/subagent-client-stub.js.map +7 -0
  254. package/dist/src/integrations/claude-code/subagent-client.js.map +7 -0
  255. package/dist/src/integrations/claude-code/task-coordinator.js.map +7 -0
  256. package/dist/src/integrations/linear/auth.js.map +7 -0
  257. package/dist/src/integrations/linear/auto-sync.js.map +7 -0
  258. package/dist/src/integrations/linear/client.js +634 -0
  259. package/dist/src/integrations/linear/client.js.map +7 -0
  260. package/dist/src/integrations/linear/config.js.map +7 -0
  261. package/dist/src/integrations/linear/migration.js.map +7 -0
  262. package/dist/src/integrations/linear/oauth-server.js.map +7 -0
  263. package/dist/src/integrations/linear/rest-client.js.map +7 -0
  264. package/dist/src/integrations/linear/sync-manager.js.map +7 -0
  265. package/dist/src/integrations/linear/sync-service.js.map +7 -0
  266. package/dist/src/integrations/linear/sync.js.map +7 -0
  267. package/dist/src/integrations/linear/unified-sync.js.map +7 -0
  268. package/dist/src/integrations/linear/webhook-handler.js.map +7 -0
  269. package/dist/src/integrations/linear/webhook-server.js.map +7 -0
  270. package/dist/src/integrations/linear/webhook.js.map +7 -0
  271. package/dist/src/integrations/mcp/handlers/code-execution-handlers.js.map +7 -0
  272. package/dist/src/integrations/mcp/handlers/context-handlers.js.map +7 -0
  273. package/dist/src/integrations/mcp/handlers/discovery-handlers.js.map +7 -0
  274. package/dist/src/integrations/mcp/handlers/index.js.map +7 -0
  275. package/dist/src/integrations/mcp/handlers/linear-handlers.js.map +7 -0
  276. package/dist/src/integrations/mcp/handlers/skill-handlers.js.map +7 -0
  277. package/dist/src/integrations/mcp/handlers/task-handlers.js.map +7 -0
  278. package/dist/src/integrations/mcp/handlers/trace-handlers.js.map +7 -0
  279. package/dist/src/integrations/mcp/index.js.map +7 -0
  280. package/dist/src/integrations/mcp/middleware/tool-scoring.js.map +7 -0
  281. package/dist/src/integrations/mcp/refactored-server.js.map +7 -0
  282. package/dist/src/integrations/mcp/remote-server.js +682 -0
  283. package/dist/src/integrations/mcp/remote-server.js.map +7 -0
  284. package/dist/src/integrations/mcp/schemas.js.map +7 -0
  285. package/dist/src/integrations/mcp/server.js +1975 -0
  286. package/dist/src/integrations/mcp/server.js.map +7 -0
  287. package/dist/src/integrations/mcp/tool-definitions-code.js.map +7 -0
  288. package/dist/src/integrations/mcp/tool-definitions.js.map +7 -0
  289. package/dist/src/integrations/ralph/bridge/ralph-stackmemory-bridge.js.map +7 -0
  290. package/dist/src/integrations/ralph/context/context-budget-manager.js.map +7 -0
  291. package/dist/src/integrations/ralph/context/stackmemory-context-loader.js.map +7 -0
  292. package/dist/src/integrations/ralph/coordination/enhanced-coordination.js.map +7 -0
  293. package/dist/src/integrations/ralph/index.js.map +7 -0
  294. package/dist/src/integrations/ralph/learning/pattern-learner.js.map +7 -0
  295. package/dist/src/integrations/ralph/lifecycle/iteration-lifecycle.js.map +7 -0
  296. package/dist/src/integrations/ralph/monitoring/swarm-dashboard.js.map +7 -0
  297. package/dist/src/integrations/ralph/monitoring/swarm-registry.js.map +7 -0
  298. package/dist/src/integrations/ralph/orchestration/multi-loop-orchestrator.js.map +7 -0
  299. package/dist/src/integrations/ralph/patterns/compounding-engineering-pattern.js.map +7 -0
  300. package/dist/src/integrations/ralph/patterns/extended-coherence-sessions.js.map +7 -0
  301. package/dist/src/integrations/ralph/patterns/oracle-worker-pattern.js.map +7 -0
  302. package/dist/src/integrations/ralph/performance/performance-optimizer.js.map +7 -0
  303. package/dist/src/integrations/ralph/recovery/crash-recovery.js.map +7 -0
  304. package/dist/src/integrations/ralph/state/state-reconciler.js.map +7 -0
  305. package/dist/src/integrations/ralph/swarm/git-workflow-manager.js.map +7 -0
  306. package/dist/src/integrations/ralph/swarm/swarm-coordinator.js.map +7 -0
  307. package/dist/src/integrations/ralph/types.js +5 -0
  308. package/dist/src/integrations/ralph/visualization/ralph-debugger.js.map +7 -0
  309. package/dist/src/mcp/stackmemory-mcp-server.js.map +7 -0
  310. package/dist/src/middleware/exponential-rate-limiter.js.map +7 -0
  311. package/dist/src/models/user.model.js.map +7 -0
  312. package/dist/src/servers/production/auth-middleware.js.map +7 -0
  313. package/dist/src/services/config-service.js.map +7 -0
  314. package/dist/src/services/context-service.js.map +7 -0
  315. package/dist/src/skills/api-discovery.js.map +7 -0
  316. package/dist/src/skills/api-skill.js.map +7 -0
  317. package/dist/src/skills/claude-skills.js.map +7 -0
  318. package/dist/src/skills/dashboard-launcher.js.map +7 -0
  319. package/dist/src/skills/recursive-agent-orchestrator.js.map +7 -0
  320. package/dist/src/skills/repo-ingestion-skill.js +632 -0
  321. package/dist/src/skills/repo-ingestion-skill.js.map +7 -0
  322. package/dist/src/skills/unified-rlm-orchestrator.js.map +7 -0
  323. package/dist/src/types/task.js.map +7 -0
  324. package/dist/src/utils/env.js.map +7 -0
  325. package/dist/src/utils/formatting.js.map +7 -0
  326. package/dist/src/utils/process-cleanup.js.map +7 -0
  327. package/package.json +13 -9
  328. package/scripts/background-sync-manager.js +145 -83
  329. package/scripts/claude-sm-autostart.js +17 -12
  330. package/scripts/gepa/README.md +275 -0
  331. package/scripts/gepa/config.json +53 -0
  332. package/scripts/gepa/evals/coding-tasks.jsonl +5 -0
  333. package/scripts/gepa/evals/fixtures/buggy-loop.js +18 -0
  334. package/scripts/gepa/evals/fixtures/callback-hell.js +53 -0
  335. package/scripts/gepa/generations/gen-000/baseline.md +124 -0
  336. package/scripts/gepa/hooks/auto-optimize.js +494 -0
  337. package/scripts/gepa/hooks/eval-tracker.js +203 -0
  338. package/scripts/gepa/hooks/reflect.js +311 -0
  339. package/scripts/gepa/optimize.js +611 -0
  340. package/scripts/gepa/state.json +14 -0
  341. package/scripts/initialize.ts +16 -7
  342. package/scripts/install.sh +14 -62
  343. package/scripts/status.ts +111 -46
  344. package/scripts/test-pre-publish-quick.sh +1 -1
  345. package/dist/agents/core/agent-task-manager.js.map +0 -7
  346. package/dist/agents/testing-agent.js +0 -614
  347. package/dist/agents/testing-agent.js.map +0 -7
  348. package/dist/agents/verifiers/base-verifier.js.map +0 -7
  349. package/dist/agents/verifiers/formatter-verifier.js.map +0 -7
  350. package/dist/agents/verifiers/llm-judge.js.map +0 -7
  351. package/dist/cli/auto-detect.js.map +0 -7
  352. package/dist/cli/browser-test.js +0 -33
  353. package/dist/cli/browser-test.js.map +0 -7
  354. package/dist/cli/claude-sm-danger.js.map +0 -7
  355. package/dist/cli/claude-sm.js +0 -1156
  356. package/dist/cli/claude-sm.js.map +0 -7
  357. package/dist/cli/codex-sm-danger.js.map +0 -7
  358. package/dist/cli/codex-sm.js.map +0 -7
  359. package/dist/cli/commands/api.js.map +0 -7
  360. package/dist/cli/commands/auto-background.js.map +0 -7
  361. package/dist/cli/commands/cleanup-processes.js.map +0 -7
  362. package/dist/cli/commands/clear.js.map +0 -7
  363. package/dist/cli/commands/config.js.map +0 -7
  364. package/dist/cli/commands/context-rehydrate.js.map +0 -7
  365. package/dist/cli/commands/context.js.map +0 -7
  366. package/dist/cli/commands/daemon.js.map +0 -7
  367. package/dist/cli/commands/dashboard.js.map +0 -7
  368. package/dist/cli/commands/db.js.map +0 -7
  369. package/dist/cli/commands/decision.js.map +0 -7
  370. package/dist/cli/commands/discovery.js.map +0 -7
  371. package/dist/cli/commands/handoff.js.map +0 -7
  372. package/dist/cli/commands/hooks.js.map +0 -7
  373. package/dist/cli/commands/linear-unified.js +0 -353
  374. package/dist/cli/commands/linear-unified.js.map +0 -7
  375. package/dist/cli/commands/linear.js.map +0 -7
  376. package/dist/cli/commands/log.js.map +0 -7
  377. package/dist/cli/commands/login.js.map +0 -7
  378. package/dist/cli/commands/migrate.js.map +0 -7
  379. package/dist/cli/commands/model.js.map +0 -7
  380. package/dist/cli/commands/monitor.js +0 -313
  381. package/dist/cli/commands/monitor.js.map +0 -7
  382. package/dist/cli/commands/onboard.js.map +0 -7
  383. package/dist/cli/commands/projects.js.map +0 -7
  384. package/dist/cli/commands/quality.js +0 -413
  385. package/dist/cli/commands/quality.js.map +0 -7
  386. package/dist/cli/commands/ralph.js.map +0 -7
  387. package/dist/cli/commands/retrieval.js.map +0 -7
  388. package/dist/cli/commands/search.js +0 -156
  389. package/dist/cli/commands/search.js.map +0 -7
  390. package/dist/cli/commands/service.js.map +0 -7
  391. package/dist/cli/commands/session.js.map +0 -7
  392. package/dist/cli/commands/settings.js.map +0 -7
  393. package/dist/cli/commands/setup.js.map +0 -7
  394. package/dist/cli/commands/shell.js.map +0 -7
  395. package/dist/cli/commands/signup.js.map +0 -7
  396. package/dist/cli/commands/skills.js.map +0 -7
  397. package/dist/cli/commands/sms-notify.js.map +0 -7
  398. package/dist/cli/commands/storage-tier.js.map +0 -7
  399. package/dist/cli/commands/storage.js +0 -360
  400. package/dist/cli/commands/storage.js.map +0 -7
  401. package/dist/cli/commands/sweep.js.map +0 -7
  402. package/dist/cli/commands/tasks.js.map +0 -7
  403. package/dist/cli/commands/test.js +0 -286
  404. package/dist/cli/commands/test.js.map +0 -7
  405. package/dist/cli/commands/workflow.js +0 -142
  406. package/dist/cli/commands/workflow.js.map +0 -7
  407. package/dist/cli/commands/worktree.js.map +0 -7
  408. package/dist/cli/index.js +0 -594
  409. package/dist/cli/index.js.map +0 -7
  410. package/dist/cli/opencode-sm.js.map +0 -7
  411. package/dist/cli/utils/viewer.js.map +0 -7
  412. package/dist/core/analytics/team-analytics.js +0 -378
  413. package/dist/core/analytics/team-analytics.js.map +0 -7
  414. package/dist/core/config/config-manager.js.map +0 -7
  415. package/dist/core/config/feature-flags.js.map +0 -7
  416. package/dist/core/config/storage-config.js.map +0 -7
  417. package/dist/core/config/types.js.map +0 -7
  418. package/dist/core/context/auto-context.js.map +0 -7
  419. package/dist/core/context/dual-stack-manager.js.map +0 -7
  420. package/dist/core/context/enhanced-rehydration.js.map +0 -7
  421. package/dist/core/context/frame-database.js.map +0 -7
  422. package/dist/core/context/frame-digest.js.map +0 -7
  423. package/dist/core/context/frame-handoff-manager.js.map +0 -7
  424. package/dist/core/context/frame-lifecycle-hooks.js.map +0 -7
  425. package/dist/core/context/frame-manager.js +0 -1069
  426. package/dist/core/context/frame-manager.js.map +0 -7
  427. package/dist/core/context/frame-recovery.js.map +0 -7
  428. package/dist/core/context/frame-stack.js.map +0 -7
  429. package/dist/core/context/incremental-gc.js +0 -290
  430. package/dist/core/context/incremental-gc.js.map +0 -7
  431. package/dist/core/context/index.js.map +0 -7
  432. package/dist/core/context/model-aware-compaction.js +0 -623
  433. package/dist/core/context/model-aware-compaction.js.map +0 -7
  434. package/dist/core/context/permission-manager.js.map +0 -7
  435. package/dist/core/context/recursive-context-manager.js.map +0 -7
  436. package/dist/core/context/refactored-frame-manager.js.map +0 -7
  437. package/dist/core/context/shared-context-layer.js.map +0 -7
  438. package/dist/core/context/stack-merge-resolver.js.map +0 -7
  439. package/dist/core/context/validation.js.map +0 -7
  440. package/dist/core/database/batch-operations.js.map +0 -7
  441. package/dist/core/database/connection-pool.js.map +0 -7
  442. package/dist/core/database/database-adapter.js.map +0 -7
  443. package/dist/core/database/migration-manager.js.map +0 -7
  444. package/dist/core/database/paradedb-adapter.js +0 -990
  445. package/dist/core/database/paradedb-adapter.js.map +0 -7
  446. package/dist/core/database/query-cache.js.map +0 -7
  447. package/dist/core/database/query-router.js.map +0 -7
  448. package/dist/core/database/sqlite-adapter.js +0 -728
  449. package/dist/core/database/sqlite-adapter.js.map +0 -7
  450. package/dist/core/digest/enhanced-hybrid-digest.js.map +0 -7
  451. package/dist/core/digest/frame-digest-integration.js.map +0 -7
  452. package/dist/core/digest/hybrid-digest-generator.js.map +0 -7
  453. package/dist/core/digest/index.js.map +0 -7
  454. package/dist/core/digest/types.js.map +0 -7
  455. package/dist/core/errors/index.js +0 -512
  456. package/dist/core/errors/index.js.map +0 -7
  457. package/dist/core/errors/recovery.js.map +0 -7
  458. package/dist/core/execution/parallel-executor.js.map +0 -7
  459. package/dist/core/frame/workflow-templates.js.map +0 -7
  460. package/dist/core/merge/conflict-detector.js.map +0 -7
  461. package/dist/core/merge/index.js.map +0 -7
  462. package/dist/core/merge/resolution-engine.js.map +0 -7
  463. package/dist/core/merge/stack-diff.js.map +0 -7
  464. package/dist/core/models/fallback-monitor.js.map +0 -7
  465. package/dist/core/models/model-router.js.map +0 -7
  466. package/dist/core/monitoring/error-handler.js.map +0 -7
  467. package/dist/core/monitoring/logger.js +0 -150
  468. package/dist/core/monitoring/logger.js.map +0 -7
  469. package/dist/core/monitoring/metrics.js.map +0 -7
  470. package/dist/core/monitoring/progress-tracker.js.map +0 -7
  471. package/dist/core/monitoring/session-monitor.js.map +0 -7
  472. package/dist/core/performance/context-cache.js.map +0 -7
  473. package/dist/core/performance/index.js.map +0 -7
  474. package/dist/core/performance/lazy-context-loader.js.map +0 -7
  475. package/dist/core/performance/monitor.js.map +0 -7
  476. package/dist/core/performance/optimized-frame-context.js.map +0 -7
  477. package/dist/core/performance/performance-benchmark.js.map +0 -7
  478. package/dist/core/performance/performance-profiler.js.map +0 -7
  479. package/dist/core/performance/streaming-jsonl-parser.js.map +0 -7
  480. package/dist/core/persistence/postgres-adapter.js.map +0 -7
  481. package/dist/core/projects/project-isolation.js.map +0 -7
  482. package/dist/core/projects/project-manager.js.map +0 -7
  483. package/dist/core/query/query-parser.js.map +0 -7
  484. package/dist/core/query/query-templates.js.map +0 -7
  485. package/dist/core/retrieval/context-retriever.js.map +0 -7
  486. package/dist/core/retrieval/graph-retrieval.js +0 -662
  487. package/dist/core/retrieval/graph-retrieval.js.map +0 -7
  488. package/dist/core/retrieval/hierarchical-retrieval.js +0 -656
  489. package/dist/core/retrieval/hierarchical-retrieval.js.map +0 -7
  490. package/dist/core/retrieval/index.js.map +0 -7
  491. package/dist/core/retrieval/llm-context-retrieval.js.map +0 -7
  492. package/dist/core/retrieval/llm-provider.js.map +0 -7
  493. package/dist/core/retrieval/retrieval-audit.js.map +0 -7
  494. package/dist/core/retrieval/retrieval-benchmarks.js +0 -521
  495. package/dist/core/retrieval/retrieval-benchmarks.js.map +0 -7
  496. package/dist/core/retrieval/summary-generator.js.map +0 -7
  497. package/dist/core/retrieval/types.js.map +0 -7
  498. package/dist/core/session/clear-survival.js.map +0 -7
  499. package/dist/core/session/enhanced-handoff.js.map +0 -7
  500. package/dist/core/session/handoff-generator.js.map +0 -7
  501. package/dist/core/session/index.js.map +0 -7
  502. package/dist/core/session/session-manager.js.map +0 -7
  503. package/dist/core/skills/index.js.map +0 -7
  504. package/dist/core/skills/skill-storage.js.map +0 -7
  505. package/dist/core/skills/types.js.map +0 -7
  506. package/dist/core/storage/chromadb-adapter.js +0 -354
  507. package/dist/core/storage/chromadb-adapter.js.map +0 -7
  508. package/dist/core/storage/infinite-storage.js.map +0 -7
  509. package/dist/core/storage/railway-optimized-storage.js +0 -591
  510. package/dist/core/storage/railway-optimized-storage.js.map +0 -7
  511. package/dist/core/storage/remote-storage.js.map +0 -7
  512. package/dist/core/storage/two-tier-storage.js.map +0 -7
  513. package/dist/core/trace/cli-trace-wrapper.js.map +0 -7
  514. package/dist/core/trace/db-trace-wrapper.js.map +0 -7
  515. package/dist/core/trace/debug-trace.js.map +0 -7
  516. package/dist/core/trace/index.js.map +0 -7
  517. package/dist/core/trace/linear-api-wrapper.js.map +0 -7
  518. package/dist/core/trace/trace-demo.js +0 -154
  519. package/dist/core/trace/trace-demo.js.map +0 -7
  520. package/dist/core/trace/trace-detector.demo.js +0 -142
  521. package/dist/core/trace/trace-detector.demo.js.map +0 -7
  522. package/dist/core/trace/trace-detector.js.map +0 -7
  523. package/dist/core/trace/trace-store.js.map +0 -7
  524. package/dist/core/trace/types.js.map +0 -7
  525. package/dist/core/utils/async-mutex.js.map +0 -7
  526. package/dist/core/utils/compression.js.map +0 -7
  527. package/dist/core/utils/update-checker.js.map +0 -7
  528. package/dist/core/worktree/worktree-manager.js.map +0 -7
  529. package/dist/daemon/daemon-config.js.map +0 -7
  530. package/dist/daemon/services/context-service.js.map +0 -7
  531. package/dist/daemon/services/linear-service.js.map +0 -7
  532. package/dist/daemon/session-daemon.js.map +0 -7
  533. package/dist/daemon/unified-daemon.js.map +0 -7
  534. package/dist/features/analytics/api/analytics-api.js.map +0 -7
  535. package/dist/features/analytics/core/analytics-service.js.map +0 -7
  536. package/dist/features/analytics/index.js.map +0 -7
  537. package/dist/features/analytics/queries/metrics-queries.js.map +0 -7
  538. package/dist/features/browser/browser-mcp.js.map +0 -7
  539. package/dist/features/sweep/index.js.map +0 -7
  540. package/dist/features/sweep/prediction-client.js.map +0 -7
  541. package/dist/features/sweep/prompt-builder.js.map +0 -7
  542. package/dist/features/sweep/pty-wrapper.js.map +0 -7
  543. package/dist/features/sweep/state-watcher.js.map +0 -7
  544. package/dist/features/sweep/status-bar.js.map +0 -7
  545. package/dist/features/sweep/sweep-server-manager.js.map +0 -7
  546. package/dist/features/sweep/tab-interceptor.js.map +0 -7
  547. package/dist/features/sweep/types.js.map +0 -7
  548. package/dist/features/tasks/linear-task-manager.js.map +0 -7
  549. package/dist/features/tasks/task-aware-context.js.map +0 -7
  550. package/dist/features/tui/simple-monitor.js.map +0 -7
  551. package/dist/features/tui/swarm-monitor.js.map +0 -7
  552. package/dist/features/web/client/stores/task-store.js.map +0 -7
  553. package/dist/features/web/server/index.js.map +0 -7
  554. package/dist/hooks/auto-background.js.map +0 -7
  555. package/dist/hooks/claude-code-whatsapp-hook.js.map +0 -7
  556. package/dist/hooks/config.js.map +0 -7
  557. package/dist/hooks/daemon.js.map +0 -7
  558. package/dist/hooks/events.js.map +0 -7
  559. package/dist/hooks/index.js.map +0 -7
  560. package/dist/hooks/linear-task-picker.js.map +0 -7
  561. package/dist/hooks/schemas.js.map +0 -7
  562. package/dist/hooks/secure-fs.js.map +0 -7
  563. package/dist/hooks/security-logger.js.map +0 -7
  564. package/dist/hooks/session-summary.js.map +0 -7
  565. package/dist/hooks/sms-action-runner.js.map +0 -7
  566. package/dist/hooks/sms-notify.js.map +0 -7
  567. package/dist/hooks/sms-watcher.js.map +0 -7
  568. package/dist/hooks/sms-webhook.js.map +0 -7
  569. package/dist/hooks/whatsapp-commands.js.map +0 -7
  570. package/dist/hooks/whatsapp-scheduler.js.map +0 -7
  571. package/dist/hooks/whatsapp-sync.js.map +0 -7
  572. package/dist/index.js.map +0 -7
  573. package/dist/integrations/anthropic/client.js.map +0 -7
  574. package/dist/integrations/claude-code/agent-bridge.js.map +0 -7
  575. package/dist/integrations/claude-code/enhanced-pre-clear-hooks.js.map +0 -7
  576. package/dist/integrations/claude-code/lifecycle-hooks.js.map +0 -7
  577. package/dist/integrations/claude-code/post-task-hooks.js.map +0 -7
  578. package/dist/integrations/claude-code/subagent-client-stub.js.map +0 -7
  579. package/dist/integrations/claude-code/subagent-client.js.map +0 -7
  580. package/dist/integrations/claude-code/task-coordinator.js.map +0 -7
  581. package/dist/integrations/linear/auth.js.map +0 -7
  582. package/dist/integrations/linear/auto-sync.js.map +0 -7
  583. package/dist/integrations/linear/client.js +0 -630
  584. package/dist/integrations/linear/client.js.map +0 -7
  585. package/dist/integrations/linear/config.js.map +0 -7
  586. package/dist/integrations/linear/migration.js.map +0 -7
  587. package/dist/integrations/linear/oauth-server.js.map +0 -7
  588. package/dist/integrations/linear/rest-client.js.map +0 -7
  589. package/dist/integrations/linear/sync-manager.js.map +0 -7
  590. package/dist/integrations/linear/sync-service.js.map +0 -7
  591. package/dist/integrations/linear/sync.js.map +0 -7
  592. package/dist/integrations/linear/unified-sync.js.map +0 -7
  593. package/dist/integrations/linear/webhook-handler.js.map +0 -7
  594. package/dist/integrations/linear/webhook-server.js.map +0 -7
  595. package/dist/integrations/linear/webhook.js.map +0 -7
  596. package/dist/integrations/mcp/handlers/code-execution-handlers.js.map +0 -7
  597. package/dist/integrations/mcp/handlers/context-handlers.js.map +0 -7
  598. package/dist/integrations/mcp/handlers/discovery-handlers.js.map +0 -7
  599. package/dist/integrations/mcp/handlers/index.js.map +0 -7
  600. package/dist/integrations/mcp/handlers/linear-handlers.js.map +0 -7
  601. package/dist/integrations/mcp/handlers/skill-handlers.js.map +0 -7
  602. package/dist/integrations/mcp/handlers/task-handlers.js.map +0 -7
  603. package/dist/integrations/mcp/handlers/trace-handlers.js.map +0 -7
  604. package/dist/integrations/mcp/index.js.map +0 -7
  605. package/dist/integrations/mcp/middleware/tool-scoring.js.map +0 -7
  606. package/dist/integrations/mcp/refactored-server.js.map +0 -7
  607. package/dist/integrations/mcp/remote-server.js +0 -691
  608. package/dist/integrations/mcp/remote-server.js.map +0 -7
  609. package/dist/integrations/mcp/schemas.js.map +0 -7
  610. package/dist/integrations/mcp/server.js +0 -1960
  611. package/dist/integrations/mcp/server.js.map +0 -7
  612. package/dist/integrations/mcp/tool-definitions-code.js.map +0 -7
  613. package/dist/integrations/mcp/tool-definitions.js.map +0 -7
  614. package/dist/integrations/mcp/trace-test.js +0 -48
  615. package/dist/integrations/mcp/trace-test.js.map +0 -7
  616. package/dist/integrations/pg-aiguide/embedding-provider.js +0 -189
  617. package/dist/integrations/pg-aiguide/embedding-provider.js.map +0 -7
  618. package/dist/integrations/pg-aiguide/semantic-search.js +0 -187
  619. package/dist/integrations/pg-aiguide/semantic-search.js.map +0 -7
  620. package/dist/integrations/pg-aiguide/timescale-analytics.js +0 -224
  621. package/dist/integrations/pg-aiguide/timescale-analytics.js.map +0 -7
  622. package/dist/integrations/ralph/bridge/ralph-stackmemory-bridge.js.map +0 -7
  623. package/dist/integrations/ralph/context/context-budget-manager.js.map +0 -7
  624. package/dist/integrations/ralph/context/stackmemory-context-loader.js.map +0 -7
  625. package/dist/integrations/ralph/coordination/enhanced-coordination.js.map +0 -7
  626. package/dist/integrations/ralph/index.js.map +0 -7
  627. package/dist/integrations/ralph/learning/pattern-learner.js.map +0 -7
  628. package/dist/integrations/ralph/lifecycle/iteration-lifecycle.js.map +0 -7
  629. package/dist/integrations/ralph/monitoring/swarm-dashboard.js.map +0 -7
  630. package/dist/integrations/ralph/monitoring/swarm-registry.js.map +0 -7
  631. package/dist/integrations/ralph/orchestration/multi-loop-orchestrator.js.map +0 -7
  632. package/dist/integrations/ralph/patterns/compounding-engineering-pattern.js.map +0 -7
  633. package/dist/integrations/ralph/patterns/extended-coherence-sessions.js.map +0 -7
  634. package/dist/integrations/ralph/patterns/oracle-worker-pattern.js.map +0 -7
  635. package/dist/integrations/ralph/performance/performance-optimizer.js.map +0 -7
  636. package/dist/integrations/ralph/ralph-integration-demo.js +0 -182
  637. package/dist/integrations/ralph/ralph-integration-demo.js.map +0 -7
  638. package/dist/integrations/ralph/recovery/crash-recovery.js.map +0 -7
  639. package/dist/integrations/ralph/state/state-reconciler.js.map +0 -7
  640. package/dist/integrations/ralph/swarm/git-workflow-manager.js.map +0 -7
  641. package/dist/integrations/ralph/swarm/swarm-coordinator.js.map +0 -7
  642. package/dist/integrations/ralph/visualization/ralph-debugger.js.map +0 -7
  643. package/dist/mcp/stackmemory-mcp-server.js.map +0 -7
  644. package/dist/middleware/exponential-rate-limiter.js.map +0 -7
  645. package/dist/models/user.model.js.map +0 -7
  646. package/dist/servers/production/auth-middleware.js.map +0 -7
  647. package/dist/servers/railway/config.js +0 -55
  648. package/dist/servers/railway/config.js.map +0 -7
  649. package/dist/servers/railway/index-enhanced.js +0 -160
  650. package/dist/servers/railway/index-enhanced.js.map +0 -7
  651. package/dist/servers/railway/index.js +0 -1349
  652. package/dist/servers/railway/index.js.map +0 -7
  653. package/dist/servers/railway/simple.js +0 -64
  654. package/dist/servers/railway/simple.js.map +0 -7
  655. package/dist/servers/railway/storage-test.js +0 -459
  656. package/dist/servers/railway/storage-test.js.map +0 -7
  657. package/dist/services/config-service.js.map +0 -7
  658. package/dist/services/context-service.js.map +0 -7
  659. package/dist/skills/api-discovery.js.map +0 -7
  660. package/dist/skills/api-skill.js.map +0 -7
  661. package/dist/skills/claude-skills.js.map +0 -7
  662. package/dist/skills/dashboard-launcher.js.map +0 -7
  663. package/dist/skills/recursive-agent-orchestrator.js.map +0 -7
  664. package/dist/skills/repo-ingestion-skill.js +0 -609
  665. package/dist/skills/repo-ingestion-skill.js.map +0 -7
  666. package/dist/skills/security-secrets-scanner.js +0 -284
  667. package/dist/skills/security-secrets-scanner.js.map +0 -7
  668. package/dist/skills/unified-rlm-orchestrator.js.map +0 -7
  669. package/dist/utils/env.js.map +0 -7
  670. package/dist/utils/formatting.js.map +0 -7
  671. package/dist/utils/process-cleanup.js.map +0 -7
  672. package/dist/validation/schemas.js +0 -222
  673. package/dist/validation/schemas.js.map +0 -7
  674. /package/dist/{agents → src/agents}/core/agent-task-manager.js +0 -0
  675. /package/dist/{agents → src/agents}/verifiers/base-verifier.js +0 -0
  676. /package/dist/{agents → src/agents}/verifiers/formatter-verifier.js +0 -0
  677. /package/dist/{agents → src/agents}/verifiers/llm-judge.js +0 -0
  678. /package/dist/{cli → src/cli}/auto-detect.js +0 -0
  679. /package/dist/{cli → src/cli}/claude-sm-danger.js +0 -0
  680. /package/dist/{cli → src/cli}/codex-sm-danger.js +0 -0
  681. /package/dist/{cli → src/cli}/codex-sm.js +0 -0
  682. /package/dist/{cli → src/cli}/commands/api.js +0 -0
  683. /package/dist/{cli → src/cli}/commands/auto-background.js +0 -0
  684. /package/dist/{cli → src/cli}/commands/cleanup-processes.js +0 -0
  685. /package/dist/{cli → src/cli}/commands/clear.js +0 -0
  686. /package/dist/{cli → src/cli}/commands/config.js +0 -0
  687. /package/dist/{cli → src/cli}/commands/context-rehydrate.js +0 -0
  688. /package/dist/{cli → src/cli}/commands/context.js +0 -0
  689. /package/dist/{cli → src/cli}/commands/daemon.js +0 -0
  690. /package/dist/{cli → src/cli}/commands/dashboard.js +0 -0
  691. /package/dist/{cli → src/cli}/commands/db.js +0 -0
  692. /package/dist/{cli → src/cli}/commands/decision.js +0 -0
  693. /package/dist/{cli → src/cli}/commands/discovery.js +0 -0
  694. /package/dist/{cli → src/cli}/commands/handoff.js +0 -0
  695. /package/dist/{cli → src/cli}/commands/hooks.js +0 -0
  696. /package/dist/{cli → src/cli}/commands/linear.js +0 -0
  697. /package/dist/{cli → src/cli}/commands/log.js +0 -0
  698. /package/dist/{cli → src/cli}/commands/login.js +0 -0
  699. /package/dist/{cli → src/cli}/commands/migrate.js +0 -0
  700. /package/dist/{cli → src/cli}/commands/model.js +0 -0
  701. /package/dist/{cli → src/cli}/commands/onboard.js +0 -0
  702. /package/dist/{cli → src/cli}/commands/projects.js +0 -0
  703. /package/dist/{cli → src/cli}/commands/ralph.js +0 -0
  704. /package/dist/{cli → src/cli}/commands/retrieval.js +0 -0
  705. /package/dist/{cli → src/cli}/commands/service.js +0 -0
  706. /package/dist/{cli → src/cli}/commands/session.js +0 -0
  707. /package/dist/{cli → src/cli}/commands/settings.js +0 -0
  708. /package/dist/{cli → src/cli}/commands/setup.js +0 -0
  709. /package/dist/{cli → src/cli}/commands/shell.js +0 -0
  710. /package/dist/{cli → src/cli}/commands/signup.js +0 -0
  711. /package/dist/{cli → src/cli}/commands/skills.js +0 -0
  712. /package/dist/{cli → src/cli}/commands/sms-notify.js +0 -0
  713. /package/dist/{cli → src/cli}/commands/storage-tier.js +0 -0
  714. /package/dist/{cli → src/cli}/commands/sweep.js +0 -0
  715. /package/dist/{cli → src/cli}/commands/tasks.js +0 -0
  716. /package/dist/{cli → src/cli}/commands/worktree.js +0 -0
  717. /package/dist/{cli → src/cli}/opencode-sm.js +0 -0
  718. /package/dist/{cli → src/cli}/utils/viewer.js +0 -0
  719. /package/dist/{core → src/core}/config/config-manager.js +0 -0
  720. /package/dist/{core → src/core}/config/feature-flags.js +0 -0
  721. /package/dist/{core → src/core}/config/storage-config.js +0 -0
  722. /package/dist/{core → src/core}/config/types.js +0 -0
  723. /package/dist/{core → src/core}/context/auto-context.js +0 -0
  724. /package/dist/{core → src/core}/context/dual-stack-manager.js +0 -0
  725. /package/dist/{core → src/core}/context/enhanced-rehydration.js +0 -0
  726. /package/dist/{core → src/core}/context/frame-database.js +0 -0
  727. /package/dist/{core → src/core}/context/frame-digest.js +0 -0
  728. /package/dist/{core → src/core}/context/frame-handoff-manager.js +0 -0
  729. /package/dist/{core → src/core}/context/frame-lifecycle-hooks.js +0 -0
  730. /package/dist/{core → src/core}/context/frame-recovery.js +0 -0
  731. /package/dist/{core → src/core}/context/frame-stack.js +0 -0
  732. /package/dist/{core → src/core}/context/frame-types.js +0 -0
  733. /package/dist/{core → src/core}/context/frame-types.js.map +0 -0
  734. /package/dist/{core → src/core}/context/index.js +0 -0
  735. /package/dist/{core → src/core}/context/permission-manager.js +0 -0
  736. /package/dist/{core → src/core}/context/recursive-context-manager.js +0 -0
  737. /package/dist/{core → src/core}/context/refactored-frame-manager.js +0 -0
  738. /package/dist/{core → src/core}/context/shared-context-layer.js +0 -0
  739. /package/dist/{core → src/core}/context/stack-merge-resolver.js +0 -0
  740. /package/dist/{core → src/core}/context/validation.js +0 -0
  741. /package/dist/{core → src/core}/database/batch-operations.js +0 -0
  742. /package/dist/{core → src/core}/database/connection-pool.js +0 -0
  743. /package/dist/{core → src/core}/database/database-adapter.js +0 -0
  744. /package/dist/{core → src/core}/database/migration-manager.js +0 -0
  745. /package/dist/{core → src/core}/database/query-cache.js +0 -0
  746. /package/dist/{core → src/core}/database/query-router.js +0 -0
  747. /package/dist/{core → src/core}/digest/enhanced-hybrid-digest.js +0 -0
  748. /package/dist/{core → src/core}/digest/frame-digest-integration.js +0 -0
  749. /package/dist/{core → src/core}/digest/hybrid-digest-generator.js +0 -0
  750. /package/dist/{core → src/core}/digest/index.js +0 -0
  751. /package/dist/{core → src/core}/digest/types.js +0 -0
  752. /package/dist/{core → src/core}/errors/recovery.js +0 -0
  753. /package/dist/{core → src/core}/execution/parallel-executor.js +0 -0
  754. /package/dist/{core/merge → src/core/extensions}/types.js +0 -0
  755. /package/dist/{core/merge → src/core/extensions}/types.js.map +0 -0
  756. /package/dist/{core → src/core}/frame/workflow-templates.js +0 -0
  757. /package/dist/{core → src/core}/merge/conflict-detector.js +0 -0
  758. /package/dist/{core → src/core}/merge/index.js +0 -0
  759. /package/dist/{core → src/core}/merge/resolution-engine.js +0 -0
  760. /package/dist/{core → src/core}/merge/stack-diff.js +0 -0
  761. /package/dist/{core → src/core/merge}/types.js +0 -0
  762. /package/dist/{core → src/core/merge}/types.js.map +0 -0
  763. /package/dist/{core → src/core}/models/fallback-monitor.js +0 -0
  764. /package/dist/{core → src/core}/models/model-router.js +0 -0
  765. /package/dist/{core → src/core}/monitoring/error-handler.js +0 -0
  766. /package/dist/{core → src/core}/monitoring/metrics.js +0 -0
  767. /package/dist/{core → src/core}/monitoring/progress-tracker.js +0 -0
  768. /package/dist/{core → src/core}/monitoring/session-monitor.js +0 -0
  769. /package/dist/{core → src/core}/performance/context-cache.js +0 -0
  770. /package/dist/{core → src/core}/performance/index.js +0 -0
  771. /package/dist/{core → src/core}/performance/lazy-context-loader.js +0 -0
  772. /package/dist/{core → src/core}/performance/monitor.js +0 -0
  773. /package/dist/{core → src/core}/performance/optimized-frame-context.js +0 -0
  774. /package/dist/{core → src/core}/performance/performance-benchmark.js +0 -0
  775. /package/dist/{core → src/core}/performance/performance-profiler.js +0 -0
  776. /package/dist/{core → src/core}/performance/streaming-jsonl-parser.js +0 -0
  777. /package/dist/{core → src/core}/persistence/postgres-adapter.js +0 -0
  778. /package/dist/{core → src/core}/projects/project-isolation.js +0 -0
  779. /package/dist/{core → src/core}/projects/project-manager.js +0 -0
  780. /package/dist/{core → src/core}/query/query-parser.js +0 -0
  781. /package/dist/{core → src/core}/query/query-templates.js +0 -0
  782. /package/dist/{core → src/core}/retrieval/context-retriever.js +0 -0
  783. /package/dist/{core → src/core}/retrieval/index.js +0 -0
  784. /package/dist/{core → src/core}/retrieval/llm-context-retrieval.js +0 -0
  785. /package/dist/{core → src/core}/retrieval/llm-provider.js +0 -0
  786. /package/dist/{core → src/core}/retrieval/retrieval-audit.js +0 -0
  787. /package/dist/{core → src/core}/retrieval/summary-generator.js +0 -0
  788. /package/dist/{core → src/core}/retrieval/types.js +0 -0
  789. /package/dist/{core → src/core}/session/clear-survival.js +0 -0
  790. /package/dist/{core → src/core}/session/enhanced-handoff.js +0 -0
  791. /package/dist/{core → src/core}/session/handoff-generator.js +0 -0
  792. /package/dist/{core → src/core}/session/index.js +0 -0
  793. /package/dist/{core → src/core}/session/session-manager.js +0 -0
  794. /package/dist/{core → src/core}/skills/index.js +0 -0
  795. /package/dist/{core → src/core}/skills/skill-storage.js +0 -0
  796. /package/dist/{core → src/core}/skills/types.js +0 -0
  797. /package/dist/{core → src/core}/storage/infinite-storage.js +0 -0
  798. /package/dist/{core → src/core}/storage/remote-storage.js +0 -0
  799. /package/dist/{core → src/core}/storage/two-tier-storage.js +0 -0
  800. /package/dist/{core → src/core}/trace/cli-trace-wrapper.js +0 -0
  801. /package/dist/{core → src/core}/trace/db-trace-wrapper.js +0 -0
  802. /package/dist/{core → src/core}/trace/debug-trace.js +0 -0
  803. /package/dist/{core → src/core}/trace/index.js +0 -0
  804. /package/dist/{core → src/core}/trace/linear-api-wrapper.js +0 -0
  805. /package/dist/{core → src/core}/trace/trace-detector.js +0 -0
  806. /package/dist/{core → src/core}/trace/trace-store.js +0 -0
  807. /package/dist/{core → src/core}/trace/types.js +0 -0
  808. /package/dist/{integrations/linear → src/core}/types.js +0 -0
  809. /package/dist/{integrations/linear → src/core}/types.js.map +0 -0
  810. /package/dist/{core → src/core}/utils/async-mutex.js +0 -0
  811. /package/dist/{core → src/core}/utils/compression.js +0 -0
  812. /package/dist/{core → src/core}/utils/update-checker.js +0 -0
  813. /package/dist/{core → src/core}/worktree/worktree-manager.js +0 -0
  814. /package/dist/{daemon → src/daemon}/daemon-config.js +0 -0
  815. /package/dist/{daemon → src/daemon}/services/context-service.js +0 -0
  816. /package/dist/{daemon → src/daemon}/services/linear-service.js +0 -0
  817. /package/dist/{daemon → src/daemon}/session-daemon.js +0 -0
  818. /package/dist/{daemon → src/daemon}/unified-daemon.js +0 -0
  819. /package/dist/{features → src/features}/analytics/api/analytics-api.js +0 -0
  820. /package/dist/{features → src/features}/analytics/core/analytics-service.js +0 -0
  821. /package/dist/{features → src/features}/analytics/index.js +0 -0
  822. /package/dist/{features → src/features}/analytics/queries/metrics-queries.js +0 -0
  823. /package/dist/{features → src/features}/analytics/types/metrics.js +0 -0
  824. /package/dist/{features → src/features}/analytics/types/metrics.js.map +0 -0
  825. /package/dist/{features → src/features}/browser/browser-mcp.js +0 -0
  826. /package/dist/{features → src/features}/sweep/index.js +0 -0
  827. /package/dist/{features → src/features}/sweep/prediction-client.js +0 -0
  828. /package/dist/{features → src/features}/sweep/prompt-builder.js +0 -0
  829. /package/dist/{features → src/features}/sweep/pty-wrapper.js +0 -0
  830. /package/dist/{features → src/features}/sweep/state-watcher.js +0 -0
  831. /package/dist/{features → src/features}/sweep/status-bar.js +0 -0
  832. /package/dist/{features → src/features}/sweep/sweep-server-manager.js +0 -0
  833. /package/dist/{features → src/features}/sweep/tab-interceptor.js +0 -0
  834. /package/dist/{features → src/features}/sweep/types.js +0 -0
  835. /package/dist/{features → src/features}/tasks/linear-task-manager.js +0 -0
  836. /package/dist/{features → src/features}/tasks/task-aware-context.js +0 -0
  837. /package/dist/{features → src/features}/tui/simple-monitor.js +0 -0
  838. /package/dist/{features → src/features}/tui/swarm-monitor.js +0 -0
  839. /package/dist/{features → src/features}/web/client/stores/task-store.js +0 -0
  840. /package/dist/{features → src/features}/web/server/index.js +0 -0
  841. /package/dist/{hooks → src/hooks}/auto-background.js +0 -0
  842. /package/dist/{hooks → src/hooks}/claude-code-whatsapp-hook.js +0 -0
  843. /package/dist/{hooks → src/hooks}/config.js +0 -0
  844. /package/dist/{hooks → src/hooks}/daemon.js +0 -0
  845. /package/dist/{hooks → src/hooks}/events.js +0 -0
  846. /package/dist/{hooks → src/hooks}/index.js +0 -0
  847. /package/dist/{hooks → src/hooks}/linear-task-picker.js +0 -0
  848. /package/dist/{hooks → src/hooks}/schemas.js +0 -0
  849. /package/dist/{hooks → src/hooks}/secure-fs.js +0 -0
  850. /package/dist/{hooks → src/hooks}/security-logger.js +0 -0
  851. /package/dist/{hooks → src/hooks}/session-summary.js +0 -0
  852. /package/dist/{hooks → src/hooks}/sms-action-runner.js +0 -0
  853. /package/dist/{hooks → src/hooks}/sms-notify.js +0 -0
  854. /package/dist/{hooks → src/hooks}/sms-watcher.js +0 -0
  855. /package/dist/{hooks → src/hooks}/sms-webhook.js +0 -0
  856. /package/dist/{hooks → src/hooks}/whatsapp-commands.js +0 -0
  857. /package/dist/{hooks → src/hooks}/whatsapp-scheduler.js +0 -0
  858. /package/dist/{hooks → src/hooks}/whatsapp-sync.js +0 -0
  859. /package/dist/{index.js → src/index.js} +0 -0
  860. /package/dist/{integrations → src/integrations}/anthropic/client.js +0 -0
  861. /package/dist/{integrations → src/integrations}/claude-code/agent-bridge.js +0 -0
  862. /package/dist/{integrations → src/integrations}/claude-code/enhanced-pre-clear-hooks.js +0 -0
  863. /package/dist/{integrations → src/integrations}/claude-code/lifecycle-hooks.js +0 -0
  864. /package/dist/{integrations → src/integrations}/claude-code/post-task-hooks.js +0 -0
  865. /package/dist/{integrations → src/integrations}/claude-code/subagent-client-stub.js +0 -0
  866. /package/dist/{integrations → src/integrations}/claude-code/subagent-client.js +0 -0
  867. /package/dist/{integrations → src/integrations}/claude-code/task-coordinator.js +0 -0
  868. /package/dist/{integrations → src/integrations}/linear/auth.js +0 -0
  869. /package/dist/{integrations → src/integrations}/linear/auto-sync.js +0 -0
  870. /package/dist/{integrations → src/integrations}/linear/config.js +0 -0
  871. /package/dist/{integrations → src/integrations}/linear/migration.js +0 -0
  872. /package/dist/{integrations → src/integrations}/linear/oauth-server.js +0 -0
  873. /package/dist/{integrations → src/integrations}/linear/rest-client.js +0 -0
  874. /package/dist/{integrations → src/integrations}/linear/sync-manager.js +0 -0
  875. /package/dist/{integrations → src/integrations}/linear/sync-service.js +0 -0
  876. /package/dist/{integrations → src/integrations}/linear/sync.js +0 -0
  877. /package/dist/{integrations/ralph → src/integrations/linear}/types.js +0 -0
  878. /package/dist/{integrations/ralph → src/integrations/linear}/types.js.map +0 -0
  879. /package/dist/{integrations → src/integrations}/linear/unified-sync.js +0 -0
  880. /package/dist/{integrations → src/integrations}/linear/webhook-handler.js +0 -0
  881. /package/dist/{integrations → src/integrations}/linear/webhook-server.js +0 -0
  882. /package/dist/{integrations → src/integrations}/linear/webhook.js +0 -0
  883. /package/dist/{integrations → src/integrations}/mcp/handlers/code-execution-handlers.js +0 -0
  884. /package/dist/{integrations → src/integrations}/mcp/handlers/context-handlers.js +0 -0
  885. /package/dist/{integrations → src/integrations}/mcp/handlers/discovery-handlers.js +0 -0
  886. /package/dist/{integrations → src/integrations}/mcp/handlers/index.js +0 -0
  887. /package/dist/{integrations → src/integrations}/mcp/handlers/linear-handlers.js +0 -0
  888. /package/dist/{integrations → src/integrations}/mcp/handlers/skill-handlers.js +0 -0
  889. /package/dist/{integrations → src/integrations}/mcp/handlers/task-handlers.js +0 -0
  890. /package/dist/{integrations → src/integrations}/mcp/handlers/trace-handlers.js +0 -0
  891. /package/dist/{integrations → src/integrations}/mcp/index.js +0 -0
  892. /package/dist/{integrations → src/integrations}/mcp/middleware/tool-scoring.js +0 -0
  893. /package/dist/{integrations → src/integrations}/mcp/refactored-server.js +0 -0
  894. /package/dist/{integrations → src/integrations}/mcp/schemas.js +0 -0
  895. /package/dist/{integrations → src/integrations}/mcp/tool-definitions-code.js +0 -0
  896. /package/dist/{integrations → src/integrations}/mcp/tool-definitions.js +0 -0
  897. /package/dist/{integrations → src/integrations}/ralph/bridge/ralph-stackmemory-bridge.js +0 -0
  898. /package/dist/{integrations → src/integrations}/ralph/context/context-budget-manager.js +0 -0
  899. /package/dist/{integrations → src/integrations}/ralph/context/stackmemory-context-loader.js +0 -0
  900. /package/dist/{integrations → src/integrations}/ralph/coordination/enhanced-coordination.js +0 -0
  901. /package/dist/{integrations → src/integrations}/ralph/index.js +0 -0
  902. /package/dist/{integrations → src/integrations}/ralph/learning/pattern-learner.js +0 -0
  903. /package/dist/{integrations → src/integrations}/ralph/lifecycle/iteration-lifecycle.js +0 -0
  904. /package/dist/{integrations → src/integrations}/ralph/monitoring/swarm-dashboard.js +0 -0
  905. /package/dist/{integrations → src/integrations}/ralph/monitoring/swarm-registry.js +0 -0
  906. /package/dist/{integrations → src/integrations}/ralph/orchestration/multi-loop-orchestrator.js +0 -0
  907. /package/dist/{integrations → src/integrations}/ralph/patterns/compounding-engineering-pattern.js +0 -0
  908. /package/dist/{integrations → src/integrations}/ralph/patterns/extended-coherence-sessions.js +0 -0
  909. /package/dist/{integrations → src/integrations}/ralph/patterns/oracle-worker-pattern.js +0 -0
  910. /package/dist/{integrations → src/integrations}/ralph/performance/performance-optimizer.js +0 -0
  911. /package/dist/{integrations → src/integrations}/ralph/recovery/crash-recovery.js +0 -0
  912. /package/dist/{integrations → src/integrations}/ralph/state/state-reconciler.js +0 -0
  913. /package/dist/{integrations → src/integrations}/ralph/swarm/git-workflow-manager.js +0 -0
  914. /package/dist/{integrations → src/integrations}/ralph/swarm/swarm-coordinator.js +0 -0
  915. /package/dist/{types/task.js.map → src/integrations/ralph/types.js.map} +0 -0
  916. /package/dist/{integrations → src/integrations}/ralph/visualization/ralph-debugger.js +0 -0
  917. /package/dist/{mcp → src/mcp}/stackmemory-mcp-server.js +0 -0
  918. /package/dist/{middleware → src/middleware}/exponential-rate-limiter.js +0 -0
  919. /package/dist/{models → src/models}/user.model.js +0 -0
  920. /package/dist/{servers → src/servers}/production/auth-middleware.js +0 -0
  921. /package/dist/{services → src/services}/config-service.js +0 -0
  922. /package/dist/{services → src/services}/context-service.js +0 -0
  923. /package/dist/{skills → src/skills}/api-discovery.js +0 -0
  924. /package/dist/{skills → src/skills}/api-skill.js +0 -0
  925. /package/dist/{skills → src/skills}/claude-skills.js +0 -0
  926. /package/dist/{skills → src/skills}/dashboard-launcher.js +0 -0
  927. /package/dist/{skills → src/skills}/recursive-agent-orchestrator.js +0 -0
  928. /package/dist/{skills → src/skills}/unified-rlm-orchestrator.js +0 -0
  929. /package/dist/{types → src/types}/task.js +0 -0
  930. /package/dist/{utils → src/utils}/env.js +0 -0
  931. /package/dist/{utils → src/utils}/formatting.js +0 -0
  932. /package/dist/{utils → src/utils}/process-cleanup.js +0 -0
@@ -0,0 +1,1236 @@
1
+ #!/usr/bin/env node
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const __filename = __fileURLToPath(import.meta.url);
5
+ const __dirname = __pathDirname(__filename);
6
+ import { config as loadDotenv } from "dotenv";
7
+ loadDotenv({ override: true, debug: false });
8
+ import { spawn, execSync, execFileSync } from "child_process";
9
+ import * as fs from "fs";
10
+ import * as path from "path";
11
+ import * as os from "os";
12
+ import { program } from "commander";
13
+ import { v4 as uuidv4 } from "uuid";
14
+ import chalk from "chalk";
15
+ import { initializeTracing, trace } from "../core/trace/index.js";
16
+ import {
17
+ generateSessionSummary,
18
+ formatSummaryMessage
19
+ } from "../hooks/session-summary.js";
20
+ import { sendNotification, loadSMSConfig } from "../hooks/sms-notify.js";
21
+ import { enableAutoSync } from "../hooks/whatsapp-sync.js";
22
+ import { enableCommands } from "../hooks/whatsapp-commands.js";
23
+ import { startScheduler, listSchedules } from "../hooks/whatsapp-scheduler.js";
24
+ import {
25
+ getModelRouter,
26
+ loadModelRouterConfig
27
+ } from "../core/models/model-router.js";
28
+ import { launchWrapper } from "../features/sweep/pty-wrapper.js";
29
+ import { FallbackMonitor } from "../core/models/fallback-monitor.js";
30
+ const DEFAULT_SM_CONFIG = {
31
+ defaultWorktree: false,
32
+ defaultSandbox: false,
33
+ defaultChrome: false,
34
+ defaultTracing: true,
35
+ defaultRemote: false,
36
+ defaultNotifyOnDone: true,
37
+ defaultWhatsApp: false,
38
+ defaultModelRouting: false,
39
+ defaultSweep: true,
40
+ defaultGreptile: true,
41
+ defaultGEPA: false
42
+ };
43
+ function getConfigPath() {
44
+ return path.join(os.homedir(), ".stackmemory", "claude-sm.json");
45
+ }
46
+ function loadSMConfig() {
47
+ try {
48
+ const configPath = getConfigPath();
49
+ if (fs.existsSync(configPath)) {
50
+ const content = fs.readFileSync(configPath, "utf8");
51
+ return { ...DEFAULT_SM_CONFIG, ...JSON.parse(content) };
52
+ }
53
+ } catch {
54
+ }
55
+ return { ...DEFAULT_SM_CONFIG };
56
+ }
57
+ function saveSMConfig(config) {
58
+ const configPath = getConfigPath();
59
+ const dir = path.dirname(configPath);
60
+ if (!fs.existsSync(dir)) {
61
+ fs.mkdirSync(dir, { recursive: true });
62
+ }
63
+ fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
64
+ }
65
+ class ClaudeSM {
66
+ config;
67
+ stackmemoryPath;
68
+ worktreeScriptPath;
69
+ claudeConfigDir;
70
+ smConfig;
71
+ constructor() {
72
+ this.smConfig = loadSMConfig();
73
+ this.config = {
74
+ instanceId: this.generateInstanceId(),
75
+ useSandbox: this.smConfig.defaultSandbox,
76
+ useChrome: this.smConfig.defaultChrome,
77
+ useWorktree: this.smConfig.defaultWorktree,
78
+ useRemote: this.smConfig.defaultRemote,
79
+ notifyOnDone: this.smConfig.defaultNotifyOnDone,
80
+ useWhatsApp: this.smConfig.defaultWhatsApp,
81
+ contextEnabled: true,
82
+ tracingEnabled: this.smConfig.defaultTracing,
83
+ verboseTracing: false,
84
+ sessionStartTime: Date.now(),
85
+ useModelRouting: this.smConfig.defaultModelRouting,
86
+ useThinkingMode: false,
87
+ useSweep: this.smConfig.defaultSweep,
88
+ useGreptile: this.smConfig.defaultGreptile,
89
+ useGEPA: this.smConfig.defaultGEPA
90
+ };
91
+ this.stackmemoryPath = this.findStackMemory();
92
+ this.worktreeScriptPath = path.join(
93
+ __dirname,
94
+ "../../scripts/claude-worktree-manager.sh"
95
+ );
96
+ this.claudeConfigDir = path.join(os.homedir(), ".claude");
97
+ if (!fs.existsSync(this.claudeConfigDir)) {
98
+ fs.mkdirSync(this.claudeConfigDir, { recursive: true });
99
+ }
100
+ }
101
+ generateInstanceId() {
102
+ return uuidv4().substring(0, 8);
103
+ }
104
+ findStackMemory() {
105
+ const possiblePaths = [
106
+ path.join(os.homedir(), ".stackmemory", "bin", "stackmemory"),
107
+ "/usr/local/bin/stackmemory",
108
+ "/opt/homebrew/bin/stackmemory",
109
+ "stackmemory"
110
+ // Rely on PATH
111
+ ];
112
+ for (const smPath of possiblePaths) {
113
+ try {
114
+ execFileSync("which", [smPath], { stdio: "ignore" });
115
+ return smPath;
116
+ } catch {
117
+ }
118
+ }
119
+ return "stackmemory";
120
+ }
121
+ isGitRepo() {
122
+ try {
123
+ execSync("git rev-parse --git-dir", { stdio: "ignore" });
124
+ return true;
125
+ } catch {
126
+ return false;
127
+ }
128
+ }
129
+ getCurrentBranch() {
130
+ try {
131
+ return execSync("git rev-parse --abbrev-ref HEAD", {
132
+ encoding: "utf8"
133
+ }).trim();
134
+ } catch {
135
+ return "main";
136
+ }
137
+ }
138
+ hasUncommittedChanges() {
139
+ try {
140
+ const status = execSync("git status --porcelain", { encoding: "utf8" });
141
+ return status.length > 0;
142
+ } catch {
143
+ return false;
144
+ }
145
+ }
146
+ resolveClaudeBin() {
147
+ if (this.config.claudeBin && this.config.claudeBin.trim()) {
148
+ return this.config.claudeBin.trim();
149
+ }
150
+ const envBin = process.env["CLAUDE_BIN"];
151
+ if (envBin && envBin.trim()) return envBin.trim();
152
+ try {
153
+ execSync("which claude", { stdio: "ignore" });
154
+ return "claude";
155
+ } catch {
156
+ }
157
+ return null;
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
+ }
220
+ ensureGreptileMcp() {
221
+ const apiKey = process.env["GREPTILE_API_KEY"];
222
+ const ghToken = process.env["GITHUB_TOKEN"];
223
+ if (!apiKey) {
224
+ console.log(
225
+ chalk.gray(" Greptile: disabled (set GREPTILE_API_KEY in .env)")
226
+ );
227
+ return;
228
+ }
229
+ try {
230
+ const result = execSync("claude mcp list 2>/dev/null", {
231
+ encoding: "utf-8"
232
+ });
233
+ if (result.includes("greptile")) {
234
+ console.log(chalk.gray(" Greptile: MCP server registered"));
235
+ return;
236
+ }
237
+ } catch {
238
+ }
239
+ try {
240
+ const cmd = [
241
+ "claude mcp add",
242
+ "--transport http",
243
+ "greptile",
244
+ "https://api.greptile.com/mcp",
245
+ `--header "Authorization: Bearer ${apiKey}"`
246
+ ];
247
+ if (ghToken) {
248
+ cmd.push(`--header "X-GitHub-Token: ${ghToken}"`);
249
+ }
250
+ execSync(cmd.join(" "), { stdio: "ignore" });
251
+ console.log(chalk.cyan(" Greptile: MCP server registered"));
252
+ } catch {
253
+ try {
254
+ const envArgs = [`GREPTILE_API_KEY=${apiKey}`];
255
+ if (ghToken) envArgs.push(`GITHUB_TOKEN=${ghToken}`);
256
+ execSync(
257
+ `claude mcp add greptile -- env ${envArgs.join(" ")} npx greptile-mcp-server`,
258
+ { stdio: "ignore" }
259
+ );
260
+ console.log(chalk.cyan(" Greptile: MCP server registered (stdio)"));
261
+ } catch {
262
+ console.log(chalk.gray(" Greptile: failed to register MCP server"));
263
+ }
264
+ }
265
+ }
266
+ setupWorktree() {
267
+ if (!this.config.useWorktree || !this.isGitRepo()) {
268
+ return null;
269
+ }
270
+ console.log(chalk.blue("\u{1F333} Setting up isolated worktree..."));
271
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").substring(0, 19);
272
+ const branch = this.config.branch || `claude-${this.config.task || "work"}-${timestamp}-${this.config.instanceId}`;
273
+ const repoName = path.basename(process.cwd());
274
+ const worktreePath = path.join(
275
+ path.dirname(process.cwd()),
276
+ `${repoName}--${branch}`
277
+ );
278
+ try {
279
+ const flags = [];
280
+ if (this.config.useSandbox) flags.push("--sandbox");
281
+ if (this.config.useChrome) flags.push("--chrome");
282
+ const cmd = `git worktree add -b "${branch}" "${worktreePath}"`;
283
+ execSync(cmd, { stdio: "inherit" });
284
+ console.log(chalk.green(`\u2705 Worktree created: ${worktreePath}`));
285
+ console.log(chalk.gray(` Branch: ${branch}`));
286
+ const configPath = path.join(worktreePath, ".claude-instance.json");
287
+ const configData = {
288
+ instanceId: this.config.instanceId,
289
+ worktreePath,
290
+ branch,
291
+ task: this.config.task,
292
+ sandboxEnabled: this.config.useSandbox,
293
+ chromeEnabled: this.config.useChrome,
294
+ created: (/* @__PURE__ */ new Date()).toISOString(),
295
+ parentRepo: process.cwd()
296
+ };
297
+ fs.writeFileSync(configPath, JSON.stringify(configData, null, 2));
298
+ const envFiles = [".env", ".env.local", ".mise.toml", ".tool-versions"];
299
+ for (const file of envFiles) {
300
+ const srcPath = path.join(process.cwd(), file);
301
+ if (fs.existsSync(srcPath)) {
302
+ fs.copyFileSync(srcPath, path.join(worktreePath, file));
303
+ }
304
+ }
305
+ return worktreePath;
306
+ } catch (err) {
307
+ console.error(chalk.red("\u274C Failed to create worktree:"), err);
308
+ return null;
309
+ }
310
+ }
311
+ saveContext(message, metadata = {}) {
312
+ if (!this.config.contextEnabled) return;
313
+ try {
314
+ const contextData = {
315
+ message,
316
+ metadata: {
317
+ ...metadata,
318
+ instanceId: this.config.instanceId,
319
+ worktree: this.config.worktreePath,
320
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
321
+ }
322
+ };
323
+ const cmd = `${this.stackmemoryPath} context save --json '${JSON.stringify(contextData)}'`;
324
+ execSync(cmd, { stdio: "ignore" });
325
+ } catch {
326
+ }
327
+ }
328
+ loadContext() {
329
+ if (!this.config.contextEnabled) return;
330
+ try {
331
+ console.log(chalk.blue("\u{1F4DA} Loading previous context..."));
332
+ const cmd = `${this.stackmemoryPath} context show`;
333
+ const output = execSync(cmd, {
334
+ encoding: "utf8",
335
+ stdio: ["pipe", "pipe", "pipe"]
336
+ // Capture stderr to suppress errors
337
+ });
338
+ const lines = output.trim().split("\n").filter((l) => l.trim());
339
+ if (lines.length > 3) {
340
+ console.log(chalk.gray("Context stack loaded"));
341
+ }
342
+ } catch {
343
+ }
344
+ }
345
+ detectMultipleInstances() {
346
+ try {
347
+ const lockDir = path.join(process.cwd(), ".claude-worktree-locks");
348
+ if (!fs.existsSync(lockDir)) return false;
349
+ const locks = fs.readdirSync(lockDir).filter((f) => f.endsWith(".lock"));
350
+ const activeLocks = locks.filter((lockFile) => {
351
+ const lockPath = path.join(lockDir, lockFile);
352
+ const lockData = JSON.parse(fs.readFileSync(lockPath, "utf8"));
353
+ const lockAge = Date.now() - new Date(lockData.created).getTime();
354
+ return lockAge < 24 * 60 * 60 * 1e3;
355
+ });
356
+ return activeLocks.length > 0;
357
+ } catch {
358
+ return false;
359
+ }
360
+ }
361
+ suggestWorktreeMode() {
362
+ if (this.hasUncommittedChanges()) {
363
+ console.log(chalk.yellow("\u26A0\uFE0F Uncommitted changes detected"));
364
+ console.log(
365
+ chalk.gray(" Consider using --worktree to work in isolation")
366
+ );
367
+ }
368
+ if (this.detectMultipleInstances()) {
369
+ console.log(chalk.yellow("\u26A0\uFE0F Other Claude instances detected"));
370
+ console.log(
371
+ chalk.gray(" Using --worktree is recommended to avoid conflicts")
372
+ );
373
+ }
374
+ }
375
+ async startWhatsAppServices() {
376
+ const WEBHOOK_PORT = 3456;
377
+ console.log(chalk.cyan("\n\u{1F4F1} WhatsApp Mode - Full Integration"));
378
+ console.log(chalk.gray("\u2500".repeat(42)));
379
+ const smsConfig = loadSMSConfig();
380
+ if (!smsConfig.enabled) {
381
+ console.log(
382
+ chalk.yellow(" Notifications disabled. Run: stackmemory notify enable")
383
+ );
384
+ }
385
+ try {
386
+ enableAutoSync();
387
+ console.log(
388
+ chalk.green(" \u2713 Auto-sync enabled (digests on frame close)")
389
+ );
390
+ } catch {
391
+ console.log(chalk.gray(" Auto-sync: skipped"));
392
+ }
393
+ try {
394
+ enableCommands();
395
+ console.log(chalk.green(" \u2713 Command processing enabled"));
396
+ console.log(
397
+ chalk.gray(" Reply: status, tasks, context, help, build, test, lint")
398
+ );
399
+ } catch {
400
+ console.log(chalk.gray(" Command processing: skipped"));
401
+ }
402
+ try {
403
+ const schedules = listSchedules();
404
+ if (schedules.length > 0) {
405
+ startScheduler();
406
+ console.log(
407
+ chalk.green(` \u2713 Scheduler started (${schedules.length} schedules)`)
408
+ );
409
+ }
410
+ } catch {
411
+ }
412
+ const webhookRunning = await fetch(
413
+ `http://localhost:${WEBHOOK_PORT}/health`
414
+ ).then((r) => r.ok).catch(() => false);
415
+ if (!webhookRunning) {
416
+ const webhookPath = path.join(__dirname, "../hooks/sms-webhook.js");
417
+ const webhookProcess = spawn("node", [webhookPath], {
418
+ detached: true,
419
+ stdio: "ignore",
420
+ env: { ...process.env, SMS_WEBHOOK_PORT: String(WEBHOOK_PORT) }
421
+ });
422
+ webhookProcess.unref();
423
+ console.log(
424
+ chalk.green(` \u2713 Webhook server started (port ${WEBHOOK_PORT})`)
425
+ );
426
+ } else {
427
+ console.log(
428
+ chalk.green(` \u2713 Webhook already running (port ${WEBHOOK_PORT})`)
429
+ );
430
+ }
431
+ const ngrokRunning = await fetch("http://localhost:4040/api/tunnels").then((r) => r.ok).catch(() => false);
432
+ if (!ngrokRunning) {
433
+ const ngrokProcess = spawn("ngrok", ["http", String(WEBHOOK_PORT)], {
434
+ detached: true,
435
+ stdio: "ignore"
436
+ });
437
+ ngrokProcess.unref();
438
+ console.log(chalk.gray(" Starting ngrok tunnel..."));
439
+ await new Promise((resolve) => setTimeout(resolve, 3e3));
440
+ }
441
+ try {
442
+ const tunnels = await fetch("http://localhost:4040/api/tunnels").then(
443
+ (r) => r.json()
444
+ );
445
+ const publicUrl = tunnels?.tunnels?.[0]?.public_url;
446
+ if (publicUrl) {
447
+ const configDir = path.join(os.homedir(), ".stackmemory");
448
+ const configPath = path.join(configDir, "ngrok-url.txt");
449
+ if (!fs.existsSync(configDir)) {
450
+ fs.mkdirSync(configDir, { recursive: true });
451
+ }
452
+ fs.writeFileSync(configPath, publicUrl);
453
+ console.log(chalk.green(` \u2713 ngrok tunnel: ${publicUrl}/sms/incoming`));
454
+ }
455
+ } catch {
456
+ console.log(chalk.yellow(" ngrok: waiting for tunnel..."));
457
+ }
458
+ if (smsConfig.pendingPrompts.length > 0) {
459
+ console.log();
460
+ console.log(
461
+ chalk.yellow(
462
+ ` \u23F3 ${smsConfig.pendingPrompts.length} pending prompt(s) awaiting response:`
463
+ )
464
+ );
465
+ smsConfig.pendingPrompts.slice(0, 3).forEach((p, i) => {
466
+ const msg = p.message.length > 40 ? p.message.slice(0, 40) + "..." : p.message;
467
+ console.log(chalk.gray(` ${i + 1}. [${p.id}] ${msg}`));
468
+ });
469
+ if (smsConfig.pendingPrompts.length > 3) {
470
+ console.log(
471
+ chalk.gray(` ... and ${smsConfig.pendingPrompts.length - 3} more`)
472
+ );
473
+ }
474
+ }
475
+ console.log();
476
+ console.log(chalk.gray(" Quick actions from WhatsApp:"));
477
+ console.log(chalk.gray(' "status" - session status'));
478
+ console.log(chalk.gray(' "context" - current frame digest'));
479
+ console.log(chalk.gray(' "1", "2" - respond to prompts'));
480
+ console.log(chalk.gray("\u2500".repeat(42)));
481
+ }
482
+ async sendDoneNotification(exitCode) {
483
+ try {
484
+ const context = {
485
+ instanceId: this.config.instanceId,
486
+ exitCode,
487
+ sessionStartTime: this.config.sessionStartTime,
488
+ worktreePath: this.config.worktreePath,
489
+ branch: this.config.branch,
490
+ task: this.config.task
491
+ };
492
+ const summary = await generateSessionSummary(context);
493
+ const message = formatSummaryMessage(summary, this.config.instanceId);
494
+ console.log(chalk.cyan("\nSending session summary via WhatsApp..."));
495
+ let options = summary.suggestions.slice(0, 4).map((s) => ({
496
+ key: s.key,
497
+ label: s.label,
498
+ action: s.action
499
+ }));
500
+ if (options.length < 2) {
501
+ const defaults = [
502
+ { key: "1", label: "Start new session", action: "claude-sm" },
503
+ {
504
+ key: "2",
505
+ label: "View logs",
506
+ action: "tail -30 ~/.claude/logs/*.log"
507
+ }
508
+ ];
509
+ options = defaults.slice(0, 2 - options.length).concat(options);
510
+ options.forEach((o, i) => o.key = String(i + 1));
511
+ }
512
+ const result = await sendNotification({
513
+ type: "task_complete",
514
+ title: `Claude Session ${this.config.instanceId}`,
515
+ message,
516
+ prompt: {
517
+ type: "options",
518
+ options
519
+ }
520
+ });
521
+ if (result.success) {
522
+ console.log(chalk.green("Notification sent successfully"));
523
+ } else {
524
+ console.log(
525
+ chalk.yellow(`Notification not sent: ${result.error || "unknown"}`)
526
+ );
527
+ }
528
+ } catch (error) {
529
+ console.log(
530
+ chalk.yellow(
531
+ `Could not send notification: ${error instanceof Error ? error.message : "unknown"}`
532
+ )
533
+ );
534
+ }
535
+ }
536
+ async run(args) {
537
+ const claudeArgs = [];
538
+ let i = 0;
539
+ while (i < args.length) {
540
+ const arg = args[i];
541
+ switch (arg) {
542
+ case "--worktree":
543
+ case "-w":
544
+ this.config.useWorktree = true;
545
+ break;
546
+ case "--no-worktree":
547
+ case "-W":
548
+ this.config.useWorktree = false;
549
+ break;
550
+ case "--remote":
551
+ case "-r":
552
+ this.config.useRemote = true;
553
+ break;
554
+ case "--no-remote":
555
+ this.config.useRemote = false;
556
+ break;
557
+ case "--notify-done":
558
+ case "-n":
559
+ this.config.notifyOnDone = true;
560
+ break;
561
+ case "--no-notify-done":
562
+ this.config.notifyOnDone = false;
563
+ break;
564
+ case "--whatsapp":
565
+ this.config.useWhatsApp = true;
566
+ this.config.notifyOnDone = true;
567
+ break;
568
+ case "--no-whatsapp":
569
+ this.config.useWhatsApp = false;
570
+ break;
571
+ case "--sandbox":
572
+ case "-s":
573
+ this.config.useSandbox = true;
574
+ claudeArgs.push("--sandbox");
575
+ break;
576
+ case "--chrome":
577
+ case "-c":
578
+ this.config.useChrome = true;
579
+ claudeArgs.push("--chrome");
580
+ break;
581
+ case "--no-context":
582
+ this.config.contextEnabled = false;
583
+ break;
584
+ case "--no-trace":
585
+ this.config.tracingEnabled = false;
586
+ break;
587
+ case "--verbose-trace":
588
+ this.config.verboseTracing = true;
589
+ break;
590
+ case "--branch":
591
+ case "-b":
592
+ i++;
593
+ this.config.branch = args[i];
594
+ break;
595
+ case "--task":
596
+ case "-t":
597
+ i++;
598
+ this.config.task = args[i];
599
+ break;
600
+ case "--claude-bin":
601
+ i++;
602
+ this.config.claudeBin = args[i];
603
+ process.env["CLAUDE_BIN"] = this.config.claudeBin;
604
+ break;
605
+ case "--auto":
606
+ case "-a":
607
+ if (this.isGitRepo()) {
608
+ this.config.useWorktree = this.hasUncommittedChanges() || this.detectMultipleInstances();
609
+ }
610
+ break;
611
+ case "--think":
612
+ case "--think-hard":
613
+ case "--ultrathink":
614
+ this.config.useThinkingMode = true;
615
+ this.config.useModelRouting = true;
616
+ this.config.forceProvider = "qwen";
617
+ break;
618
+ case "--qwen":
619
+ this.config.useModelRouting = true;
620
+ this.config.forceProvider = "qwen";
621
+ break;
622
+ case "--openai":
623
+ this.config.useModelRouting = true;
624
+ this.config.forceProvider = "openai";
625
+ break;
626
+ case "--ollama":
627
+ this.config.useModelRouting = true;
628
+ this.config.forceProvider = "ollama";
629
+ break;
630
+ case "--model-routing":
631
+ this.config.useModelRouting = true;
632
+ break;
633
+ case "--no-model-routing":
634
+ this.config.useModelRouting = false;
635
+ break;
636
+ case "--sweep":
637
+ this.config.useSweep = true;
638
+ break;
639
+ case "--no-sweep":
640
+ this.config.useSweep = false;
641
+ break;
642
+ case "--greptile":
643
+ this.config.useGreptile = true;
644
+ break;
645
+ case "--no-greptile":
646
+ this.config.useGreptile = false;
647
+ break;
648
+ case "--gepa":
649
+ this.config.useGEPA = true;
650
+ break;
651
+ case "--no-gepa":
652
+ this.config.useGEPA = false;
653
+ break;
654
+ default:
655
+ claudeArgs.push(arg);
656
+ }
657
+ i++;
658
+ }
659
+ const printIndex = claudeArgs.findIndex(
660
+ (a) => a === "-p" || a === "--print"
661
+ );
662
+ if (printIndex !== -1) {
663
+ const nextArg = claudeArgs[printIndex + 1];
664
+ const hasStdin = !process.stdin.isTTY;
665
+ const hasPromptArg = nextArg && !nextArg.startsWith("-");
666
+ if (!hasStdin && !hasPromptArg) {
667
+ console.error(
668
+ chalk.red("Error: --print/-p requires a prompt argument.")
669
+ );
670
+ console.log(chalk.gray('Usage: claude-smd -p "your prompt here"'));
671
+ console.log(chalk.gray(' echo "prompt" | claude-smd -p'));
672
+ process.exit(1);
673
+ }
674
+ }
675
+ if (this.config.tracingEnabled) {
676
+ process.env["DEBUG_TRACE"] = "true";
677
+ process.env["STACKMEMORY_DEBUG"] = "true";
678
+ process.env["TRACE_OUTPUT"] = "file";
679
+ process.env["TRACE_MASK_SENSITIVE"] = "true";
680
+ if (this.config.verboseTracing) {
681
+ process.env["TRACE_VERBOSITY"] = "full";
682
+ process.env["TRACE_PARAMS"] = "true";
683
+ process.env["TRACE_RESULTS"] = "true";
684
+ process.env["TRACE_MEMORY"] = "true";
685
+ } else {
686
+ process.env["TRACE_VERBOSITY"] = "summary";
687
+ process.env["TRACE_PARAMS"] = "true";
688
+ process.env["TRACE_RESULTS"] = "false";
689
+ }
690
+ initializeTracing();
691
+ trace.command(
692
+ "claude-sm",
693
+ {
694
+ instanceId: this.config.instanceId,
695
+ worktree: this.config.useWorktree,
696
+ sandbox: this.config.useSandbox,
697
+ task: this.config.task
698
+ },
699
+ async () => {
700
+ }
701
+ );
702
+ }
703
+ console.log(chalk.blue("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"));
704
+ console.log(chalk.blue("\u2551 Claude + StackMemory + Worktree \u2551"));
705
+ console.log(chalk.blue("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D"));
706
+ console.log();
707
+ if (this.isGitRepo()) {
708
+ const branch = this.getCurrentBranch();
709
+ console.log(chalk.gray(`\u{1F4CD} Current branch: ${branch}`));
710
+ if (!this.config.useWorktree) {
711
+ this.suggestWorktreeMode();
712
+ }
713
+ }
714
+ if (this.config.useWorktree) {
715
+ const worktreePath = this.setupWorktree();
716
+ if (worktreePath) {
717
+ this.config.worktreePath = worktreePath;
718
+ process.chdir(worktreePath);
719
+ this.saveContext("Created worktree for Claude instance", {
720
+ action: "worktree_created",
721
+ path: worktreePath,
722
+ branch: this.config.branch
723
+ });
724
+ }
725
+ }
726
+ this.loadContext();
727
+ process.env["CLAUDE_INSTANCE_ID"] = this.config.instanceId;
728
+ if (this.config.worktreePath) {
729
+ process.env["CLAUDE_WORKTREE_PATH"] = this.config.worktreePath;
730
+ }
731
+ if (this.config.useRemote) {
732
+ process.env["CLAUDE_REMOTE"] = "1";
733
+ }
734
+ console.log(chalk.gray(`\u{1F916} Instance ID: ${this.config.instanceId}`));
735
+ console.log(chalk.gray(`\u{1F4C1} Working in: ${process.cwd()}`));
736
+ if (this.config.useSandbox) {
737
+ console.log(chalk.yellow("\u{1F512} Sandbox mode enabled"));
738
+ }
739
+ if (this.config.useRemote) {
740
+ console.log(
741
+ chalk.cyan("\u{1F4F1} Remote mode: WhatsApp notifications for all questions")
742
+ );
743
+ }
744
+ if (this.config.useChrome) {
745
+ console.log(chalk.yellow("\u{1F310} Chrome automation enabled"));
746
+ }
747
+ if (this.config.tracingEnabled) {
748
+ console.log(
749
+ chalk.gray(`\u{1F50D} Debug tracing enabled (logs to ~/.stackmemory/traces/)`)
750
+ );
751
+ if (this.config.verboseTracing) {
752
+ console.log(
753
+ chalk.gray(` Verbose mode: capturing all execution details`)
754
+ );
755
+ }
756
+ }
757
+ if (this.config.useModelRouting) {
758
+ const routerConfig = loadModelRouterConfig();
759
+ if (routerConfig.enabled || this.config.forceProvider) {
760
+ const router = getModelRouter();
761
+ let routeResult;
762
+ if (this.config.forceProvider) {
763
+ const env = router.switchTo(this.config.forceProvider);
764
+ Object.assign(process.env, env);
765
+ console.log(
766
+ chalk.magenta(`\u{1F500} Model: ${this.config.forceProvider} (forced)`)
767
+ );
768
+ if (this.config.forceProvider === "qwen" && this.config.useThinkingMode) {
769
+ const qwenConfig = routerConfig.providers.qwen;
770
+ if (qwenConfig?.params?.enable_thinking) {
771
+ console.log(
772
+ chalk.gray(
773
+ ` Thinking mode: budget ${qwenConfig.params.thinking_budget || 1e4} tokens`
774
+ )
775
+ );
776
+ }
777
+ }
778
+ } else {
779
+ const taskType = this.config.useThinkingMode ? "think" : "default";
780
+ routeResult = router.route(taskType, this.config.task);
781
+ Object.assign(process.env, routeResult.env);
782
+ if (routeResult.switched) {
783
+ console.log(
784
+ chalk.magenta(`\u{1F500} Model routed to: ${routeResult.provider}`)
785
+ );
786
+ }
787
+ }
788
+ } else {
789
+ console.log(
790
+ chalk.gray(
791
+ " Model routing: disabled (run: stackmemory model enable)"
792
+ )
793
+ );
794
+ }
795
+ }
796
+ if (this.config.useGreptile) {
797
+ this.ensureGreptileMcp();
798
+ }
799
+ if (this.config.useGEPA) {
800
+ this.startGEPAWatcher();
801
+ }
802
+ if (this.config.useWhatsApp) {
803
+ console.log(
804
+ chalk.cyan("\u{1F4F1} WhatsApp mode: notifications + webhook enabled")
805
+ );
806
+ await this.startWhatsAppServices();
807
+ }
808
+ console.log();
809
+ if (this.config.useSweep) {
810
+ const claudeBin2 = this.resolveClaudeBin();
811
+ if (!claudeBin2) {
812
+ console.error(chalk.red("Claude CLI not found."));
813
+ process.exit(1);
814
+ return;
815
+ }
816
+ console.log(
817
+ chalk.cyan("[Sweep] Launching Claude with prediction bar...")
818
+ );
819
+ console.log(chalk.gray("\u2500".repeat(42)));
820
+ try {
821
+ await launchWrapper({
822
+ claudeBin: claudeBin2,
823
+ claudeArgs
824
+ });
825
+ } catch (error) {
826
+ console.error(chalk.red(error.message));
827
+ process.exit(1);
828
+ }
829
+ return;
830
+ }
831
+ console.log(chalk.gray("Starting Claude..."));
832
+ console.log(chalk.gray("\u2500".repeat(42)));
833
+ const claudeBin = this.resolveClaudeBin();
834
+ if (!claudeBin) {
835
+ console.error(chalk.red("\u274C Claude CLI not found."));
836
+ console.log(
837
+ chalk.gray(
838
+ " Install Claude CLI or set an override:\n export CLAUDE_BIN=/path/to/claude\n claude-sm --help\n\n Ensure PATH includes npm global bin (npm bin -g)."
839
+ )
840
+ );
841
+ process.exit(1);
842
+ return;
843
+ }
844
+ const fallbackMonitor = new FallbackMonitor({
845
+ enabled: true,
846
+ maxRestarts: 2,
847
+ restartDelayMs: 1500,
848
+ onFallback: (provider, reason) => {
849
+ console.log(chalk.yellow(`
850
+ [auto-fallback] Switching to ${provider}`));
851
+ console.log(chalk.gray(` Reason: ${reason}`));
852
+ console.log(chalk.gray(` Session will continue on ${provider}...`));
853
+ if (this.config.notifyOnDone || this.config.useWhatsApp) {
854
+ sendNotification({
855
+ type: "custom",
856
+ title: "Model Fallback",
857
+ message: `Claude unavailable (${reason}). Switched to ${provider}.`
858
+ }).catch(() => {
859
+ });
860
+ }
861
+ }
862
+ });
863
+ const fallbackAvailable = fallbackMonitor.isFallbackAvailable();
864
+ if (fallbackAvailable) {
865
+ console.log(
866
+ chalk.gray(` Auto-fallback: Qwen ready (on rate limit/error)`)
867
+ );
868
+ }
869
+ const wrapper = fallbackMonitor.wrapProcess(claudeBin, claudeArgs, {
870
+ env: process.env,
871
+ cwd: process.cwd()
872
+ });
873
+ const claude = wrapper.start();
874
+ claude.on("error", (err) => {
875
+ console.error(chalk.red("\u274C Failed to launch Claude CLI."));
876
+ if (err.code === "ENOENT") {
877
+ console.error(
878
+ chalk.gray(" Not found. Set CLAUDE_BIN or install claude on PATH.")
879
+ );
880
+ } else if (err.code === "EPERM" || err.code === "EACCES") {
881
+ console.error(
882
+ chalk.gray(
883
+ " Permission/sandbox issue. Try outside a sandbox or set CLAUDE_BIN."
884
+ )
885
+ );
886
+ } else {
887
+ console.error(chalk.gray(` ${err.message}`));
888
+ }
889
+ process.exit(1);
890
+ });
891
+ claude.on("exit", async (code) => {
892
+ this.stopGEPAWatcher();
893
+ const status = fallbackMonitor.getStatus();
894
+ if (status.inFallback) {
895
+ console.log(
896
+ chalk.yellow(
897
+ `
898
+ Session completed on fallback provider: ${status.currentProvider}`
899
+ )
900
+ );
901
+ }
902
+ this.saveContext("Claude session ended", {
903
+ action: "session_end",
904
+ exitCode: code
905
+ });
906
+ if (this.config.tracingEnabled) {
907
+ const summary = trace.getExecutionSummary();
908
+ console.log();
909
+ console.log(chalk.gray("\u2500".repeat(42)));
910
+ console.log(chalk.blue("Debug Trace Summary:"));
911
+ console.log(chalk.gray(summary));
912
+ }
913
+ if (this.config.notifyOnDone || this.config.useRemote) {
914
+ await this.sendDoneNotification(code);
915
+ }
916
+ if (this.config.worktreePath) {
917
+ console.log();
918
+ console.log(chalk.gray("\u2500".repeat(42)));
919
+ console.log(chalk.blue("Session ended in worktree:"));
920
+ console.log(chalk.gray(` ${this.config.worktreePath}`));
921
+ console.log();
922
+ console.log(chalk.gray("To remove worktree: gd_claude"));
923
+ console.log(chalk.gray("To merge to main: cwm"));
924
+ }
925
+ process.exit(code || 0);
926
+ });
927
+ process.on("SIGINT", () => {
928
+ this.saveContext("Claude session interrupted", {
929
+ action: "session_interrupt"
930
+ });
931
+ claude.kill("SIGINT");
932
+ });
933
+ process.on("SIGTERM", () => {
934
+ this.saveContext("Claude session terminated", {
935
+ action: "session_terminate"
936
+ });
937
+ claude.kill("SIGTERM");
938
+ });
939
+ }
940
+ }
941
+ program.name("claude-sm").description("Claude with StackMemory context and worktree isolation").version("1.0.0");
942
+ const configCmd = program.command("config").description("Manage claude-sm defaults");
943
+ configCmd.command("show").description("Show current default settings").action(() => {
944
+ const config = loadSMConfig();
945
+ console.log(chalk.blue("claude-sm defaults:"));
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}`);
962
+ console.log(chalk.gray(`
963
+ Config: ${getConfigPath()}`));
964
+ });
965
+ configCmd.command("set <key> <value>").description("Set a default (e.g., set worktree true)").action((key, value) => {
966
+ const config = loadSMConfig();
967
+ const boolValue = value === "true" || value === "1" || value === "on";
968
+ const keyMap = {
969
+ worktree: "defaultWorktree",
970
+ sandbox: "defaultSandbox",
971
+ chrome: "defaultChrome",
972
+ tracing: "defaultTracing",
973
+ remote: "defaultRemote",
974
+ "notify-done": "defaultNotifyOnDone",
975
+ notifyondone: "defaultNotifyOnDone",
976
+ whatsapp: "defaultWhatsApp",
977
+ "model-routing": "defaultModelRouting",
978
+ modelrouting: "defaultModelRouting",
979
+ sweep: "defaultSweep",
980
+ greptile: "defaultGreptile",
981
+ gepa: "defaultGEPA"
982
+ };
983
+ const configKey = keyMap[key];
984
+ if (!configKey) {
985
+ console.log(chalk.red(`Unknown key: ${key}`));
986
+ console.log(
987
+ chalk.gray(
988
+ "Valid keys: worktree, sandbox, chrome, tracing, remote, notify-done, whatsapp, sweep, greptile, gepa"
989
+ )
990
+ );
991
+ process.exit(1);
992
+ }
993
+ config[configKey] = boolValue;
994
+ saveSMConfig(config);
995
+ console.log(chalk.green(`Set ${key} = ${boolValue}`));
996
+ });
997
+ configCmd.command("worktree-on").description("Enable worktree mode by default").action(() => {
998
+ const config = loadSMConfig();
999
+ config.defaultWorktree = true;
1000
+ saveSMConfig(config);
1001
+ console.log(chalk.green("Worktree mode enabled by default"));
1002
+ });
1003
+ configCmd.command("worktree-off").description("Disable worktree mode by default").action(() => {
1004
+ const config = loadSMConfig();
1005
+ config.defaultWorktree = false;
1006
+ saveSMConfig(config);
1007
+ console.log(chalk.green("Worktree mode disabled by default"));
1008
+ });
1009
+ configCmd.command("remote-on").description("Enable remote mode by default (WhatsApp for all questions)").action(() => {
1010
+ const config = loadSMConfig();
1011
+ config.defaultRemote = true;
1012
+ saveSMConfig(config);
1013
+ console.log(chalk.green("Remote mode enabled by default"));
1014
+ });
1015
+ configCmd.command("remote-off").description("Disable remote mode by default").action(() => {
1016
+ const config = loadSMConfig();
1017
+ config.defaultRemote = false;
1018
+ saveSMConfig(config);
1019
+ console.log(chalk.green("Remote mode disabled by default"));
1020
+ });
1021
+ configCmd.command("notify-done-on").description("Enable WhatsApp notification when session ends (default)").action(() => {
1022
+ const config = loadSMConfig();
1023
+ config.defaultNotifyOnDone = true;
1024
+ saveSMConfig(config);
1025
+ console.log(chalk.green("Notify-on-done enabled by default"));
1026
+ });
1027
+ configCmd.command("notify-done-off").description("Disable notification when session ends").action(() => {
1028
+ const config = loadSMConfig();
1029
+ config.defaultNotifyOnDone = false;
1030
+ saveSMConfig(config);
1031
+ console.log(chalk.green("Notify-on-done disabled by default"));
1032
+ });
1033
+ configCmd.command("whatsapp-on").description("Enable WhatsApp mode by default (auto-starts webhook + ngrok)").action(() => {
1034
+ const config = loadSMConfig();
1035
+ config.defaultWhatsApp = true;
1036
+ config.defaultNotifyOnDone = true;
1037
+ saveSMConfig(config);
1038
+ console.log(chalk.green("WhatsApp mode enabled by default"));
1039
+ console.log(chalk.gray("Sessions will auto-start webhook and ngrok"));
1040
+ });
1041
+ configCmd.command("whatsapp-off").description("Disable WhatsApp mode by default").action(() => {
1042
+ const config = loadSMConfig();
1043
+ config.defaultWhatsApp = false;
1044
+ saveSMConfig(config);
1045
+ console.log(chalk.green("WhatsApp mode disabled by default"));
1046
+ });
1047
+ configCmd.command("model-routing-on").description(
1048
+ "Enable model routing by default (route tasks to Qwen/other models)"
1049
+ ).action(() => {
1050
+ const config = loadSMConfig();
1051
+ config.defaultModelRouting = true;
1052
+ saveSMConfig(config);
1053
+ console.log(chalk.green("Model routing enabled by default"));
1054
+ console.log(chalk.gray("Configure with: stackmemory model setup-qwen"));
1055
+ });
1056
+ configCmd.command("model-routing-off").description("Disable model routing by default (use Claude only)").action(() => {
1057
+ const config = loadSMConfig();
1058
+ config.defaultModelRouting = false;
1059
+ saveSMConfig(config);
1060
+ console.log(chalk.green("Model routing disabled by default"));
1061
+ });
1062
+ configCmd.command("greptile-on").description(
1063
+ "Enable Greptile AI code review by default (requires GREPTILE_API_KEY)"
1064
+ ).action(() => {
1065
+ const config = loadSMConfig();
1066
+ config.defaultGreptile = true;
1067
+ saveSMConfig(config);
1068
+ console.log(chalk.green("Greptile enabled by default"));
1069
+ if (!process.env["GREPTILE_API_KEY"]) {
1070
+ console.log(chalk.gray("Set GREPTILE_API_KEY in .env to activate"));
1071
+ }
1072
+ });
1073
+ configCmd.command("greptile-off").description("Disable Greptile AI code review by default").action(() => {
1074
+ const config = loadSMConfig();
1075
+ config.defaultGreptile = false;
1076
+ saveSMConfig(config);
1077
+ console.log(chalk.green("Greptile disabled by default"));
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
+ });
1094
+ configCmd.command("setup").description("Interactive feature setup wizard").action(async () => {
1095
+ const inquirer = await import("inquirer");
1096
+ const ora = (await import("ora")).default;
1097
+ const config = loadSMConfig();
1098
+ console.log(chalk.cyan("\nClaude-SM Feature Setup\n"));
1099
+ const features = [
1100
+ {
1101
+ key: "defaultSweep",
1102
+ name: "Predictive Edit",
1103
+ desc: "AI-powered next-edit suggestions in real-time"
1104
+ },
1105
+ {
1106
+ key: "defaultGreptile",
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"
1114
+ },
1115
+ {
1116
+ key: "defaultModelRouting",
1117
+ name: "Model Switcher",
1118
+ desc: "Smart routing across Claude, Qwen, and other models"
1119
+ },
1120
+ {
1121
+ key: "defaultWorktree",
1122
+ name: "Safe Branch",
1123
+ desc: "Isolated git worktrees for conflict-free parallel work"
1124
+ },
1125
+ {
1126
+ key: "defaultWhatsApp",
1127
+ name: "Mobile Sync",
1128
+ desc: "Remote control and notifications via WhatsApp"
1129
+ },
1130
+ {
1131
+ key: "defaultTracing",
1132
+ name: "Session Insights",
1133
+ desc: "Deep execution tracing and performance analytics"
1134
+ },
1135
+ {
1136
+ key: "defaultNotifyOnDone",
1137
+ name: "Task Alert",
1138
+ desc: "Instant notification when sessions complete"
1139
+ }
1140
+ ];
1141
+ const choices = features.map((f) => ({
1142
+ name: `${f.name} - ${f.desc}`,
1143
+ value: f.key,
1144
+ checked: config[f.key]
1145
+ }));
1146
+ const { selected } = await inquirer.default.prompt([
1147
+ {
1148
+ type: "checkbox",
1149
+ name: "selected",
1150
+ message: "Select features to enable:",
1151
+ choices
1152
+ }
1153
+ ]);
1154
+ const selectedKeys = selected;
1155
+ for (const f of features) {
1156
+ config[f.key] = selectedKeys.includes(f.key);
1157
+ }
1158
+ saveSMConfig(config);
1159
+ if (config.defaultSweep) {
1160
+ let hasPty = false;
1161
+ try {
1162
+ await import("node-pty");
1163
+ hasPty = true;
1164
+ } catch {
1165
+ }
1166
+ if (!hasPty) {
1167
+ const spinner = ora("Installing node-pty...").start();
1168
+ try {
1169
+ execSync("npm install node-pty", {
1170
+ stdio: "ignore",
1171
+ cwd: process.cwd()
1172
+ });
1173
+ spinner.succeed("node-pty installed");
1174
+ } catch {
1175
+ spinner.fail("Failed to install node-pty");
1176
+ console.log(chalk.gray(" Install manually: npm install node-pty"));
1177
+ }
1178
+ }
1179
+ }
1180
+ if (config.defaultGreptile) {
1181
+ const apiKey = process.env["GREPTILE_API_KEY"];
1182
+ if (!apiKey) {
1183
+ const { key } = await inquirer.default.prompt([
1184
+ {
1185
+ type: "password",
1186
+ name: "key",
1187
+ message: "Enter your Greptile API key (from app.greptile.com):",
1188
+ mask: "*"
1189
+ }
1190
+ ]);
1191
+ if (key && key.trim()) {
1192
+ const envPath = path.join(process.cwd(), ".env");
1193
+ const line = `
1194
+ GREPTILE_API_KEY=${key.trim()}
1195
+ `;
1196
+ fs.appendFileSync(envPath, line);
1197
+ process.env["GREPTILE_API_KEY"] = key.trim();
1198
+ console.log(chalk.green(" API key saved to .env"));
1199
+ }
1200
+ }
1201
+ const currentKey = process.env["GREPTILE_API_KEY"];
1202
+ if (currentKey) {
1203
+ try {
1204
+ const result = execSync("claude mcp list 2>/dev/null", {
1205
+ encoding: "utf-8"
1206
+ });
1207
+ if (!result.includes("greptile")) {
1208
+ execSync(
1209
+ `claude mcp add --transport http greptile https://api.greptile.com/mcp --header "Authorization: Bearer ${currentKey}"`,
1210
+ { stdio: "ignore" }
1211
+ );
1212
+ console.log(chalk.green(" Greptile MCP server registered"));
1213
+ }
1214
+ } catch {
1215
+ }
1216
+ }
1217
+ }
1218
+ console.log(chalk.cyan("\nFeature summary:"));
1219
+ for (const f of features) {
1220
+ const on = config[f.key];
1221
+ const mark = on ? chalk.green("ON") : chalk.gray("OFF");
1222
+ console.log(` ${mark} ${f.name}`);
1223
+ }
1224
+ console.log(chalk.gray(`
1225
+ Saved to ${getConfigPath()}`));
1226
+ });
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(
1228
+ "--whatsapp",
1229
+ "Enable WhatsApp mode (auto-start webhook + ngrok + notifications)"
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) => {
1231
+ const claudeSM = new ClaudeSM();
1232
+ const args = process.argv.slice(2);
1233
+ await claudeSM.run(args);
1234
+ });
1235
+ program.parse(process.argv);
1236
+ //# sourceMappingURL=claude-sm.js.map