@stackmemoryai/stackmemory 1.12.0 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +131 -64
- package/README.md +3 -1
- package/bin/claude-sm +16 -1
- package/bin/claude-smd +16 -1
- package/bin/codex-smd +16 -1
- package/bin/gemini-sm +16 -1
- package/bin/hermes-sm +21 -0
- package/bin/hermes-smd +21 -0
- package/bin/opencode-sm +16 -1
- package/dist/src/cli/codex-sm.js +51 -11
- package/dist/src/cli/commands/brain.js +206 -0
- package/dist/src/cli/commands/company-os.js +184 -0
- package/dist/src/cli/commands/context.js +5 -0
- package/dist/src/cli/commands/operator.js +127 -0
- package/dist/src/cli/commands/orchestrate.js +2 -0
- package/dist/src/cli/commands/orchestrator.js +3 -2
- package/dist/src/cli/commands/patterns.js +254 -0
- package/dist/src/cli/commands/portal.js +161 -0
- package/dist/src/cli/commands/scaffold.js +92 -0
- package/dist/src/cli/commands/setup.js +1 -4
- package/dist/src/cli/commands/sync.js +253 -0
- package/dist/src/cli/commands/tasks.js +130 -1
- package/dist/src/cli/commands/vision.js +221 -0
- package/dist/src/cli/hermes-sm.js +224 -0
- package/dist/src/cli/index.js +15 -10
- package/dist/src/cli/utils/real-cli-bin.js +72 -0
- package/dist/src/core/brain/brain-store.js +187 -0
- package/dist/src/core/brain/brain-sync.js +193 -0
- package/dist/src/core/brain/index.js +78 -0
- package/dist/src/core/brain/types.js +10 -0
- package/dist/src/core/cache/token-estimator.js +24 -1
- package/dist/src/core/config/feature-flags.js +2 -6
- package/dist/src/core/context/frame-database.js +44 -0
- package/dist/src/core/context/recursive-context-manager.js +1 -1
- package/dist/src/core/context/rehydration.js +2 -1
- package/dist/src/core/database/sqlite-adapter.js +14 -1
- package/dist/src/core/models/model-router.js +33 -1
- package/dist/src/core/models/provider-pricing.js +58 -4
- package/dist/src/core/patterns/index.js +22 -0
- package/dist/src/core/patterns/pattern-applier.js +39 -0
- package/dist/src/core/patterns/pattern-observer.js +157 -0
- package/dist/src/core/patterns/pattern-store.js +259 -0
- package/dist/src/core/patterns/types.js +19 -0
- package/dist/src/core/retrieval/llm-context-retrieval.js +5 -4
- package/dist/src/core/retrieval/unified-context-assembler.js +11 -66
- package/dist/src/core/skill-packs/types.js +14 -1
- package/dist/src/core/storage/cloud-sync-manager.js +116 -0
- package/dist/src/core/storage/cloud-sync.js +574 -0
- package/dist/src/core/storage/two-tier-storage.js +5 -1
- package/dist/src/core/tasks/master-tasks-template.js +43 -0
- package/dist/src/core/tasks/md-task-parser.js +138 -0
- package/dist/src/core/vision/index.js +27 -0
- package/dist/src/core/vision/signals.js +79 -0
- package/dist/src/core/vision/types.js +22 -0
- package/dist/src/core/vision/vision-file.js +146 -0
- package/dist/src/core/vision/vision-loop.js +220 -0
- package/dist/src/core/wiki/wiki-compiler.js +103 -1
- package/dist/src/daemon/daemon-config.js +45 -0
- package/dist/src/daemon/services/desire-path-service.js +566 -0
- package/dist/src/daemon/services/research-stream-service.js +320 -0
- package/dist/src/daemon/services/telemetry-service.js +192 -0
- package/dist/src/daemon/unified-daemon.js +28 -1
- package/dist/src/features/browser/cli-browser-agent.js +417 -0
- package/dist/src/features/browser/stagehand-workflows.js +578 -0
- package/dist/src/features/operator/adapter-factory.js +62 -0
- package/dist/src/features/operator/browser-adapter.js +109 -0
- package/dist/src/features/operator/desktop-adapter.js +125 -0
- package/dist/src/features/operator/index.js +39 -0
- package/dist/src/features/operator/llm-decision.js +137 -0
- package/dist/src/features/operator/operator-logger.js +92 -0
- package/dist/src/features/operator/overnight-runner.js +327 -0
- package/dist/src/features/operator/screen-adapter.js +91 -0
- package/dist/src/features/operator/session-manager.js +127 -0
- package/dist/src/features/operator/state-machine.js +227 -0
- package/dist/src/features/operator/task-queue.js +81 -0
- package/dist/src/features/portal/index.js +26 -0
- package/dist/src/features/portal/server.js +240 -0
- package/dist/src/features/portal/types.js +14 -0
- package/dist/src/features/portal/ui.js +195 -0
- package/dist/src/features/tasks/task-aware-context.js +2 -1
- package/dist/src/features/tui/simple-monitor.js +0 -23
- package/dist/src/features/tui/swarm-monitor.js +8 -66
- package/dist/src/{integrations/diffmem/index.js → features/web/client/hooks/use-socket.js} +6 -5
- package/dist/src/features/web/client/lib/utils.js +12 -0
- package/dist/src/features/web/client/stores/session-store.js +12 -0
- package/dist/src/features/web/server/gcp-billing.js +76 -0
- package/dist/src/features/web/server/index.js +10 -0
- package/dist/src/features/web/server/spend-calculator.js +228 -0
- package/dist/src/hooks/schemas.js +4 -1
- package/dist/src/integrations/anthropic/client.js +3 -2
- package/dist/src/integrations/claude-code/agent-bridge.js +0 -3
- package/dist/src/integrations/claude-code/subagent-client.js +218 -11
- package/dist/src/integrations/claude-code/task-coordinator.js +2 -1
- package/dist/src/integrations/linear/webhook-retry.js +196 -0
- package/dist/src/integrations/linear/webhook-server.js +18 -22
- package/dist/src/integrations/mcp/handlers/cloud-sync-handlers.js +101 -0
- package/dist/src/integrations/mcp/handlers/index.js +27 -52
- package/dist/src/integrations/mcp/server.js +122 -335
- package/dist/src/integrations/mcp/tool-alias-registry.js +0 -73
- package/dist/src/integrations/mcp/tool-definitions.js +111 -510
- package/dist/src/mcp/stackmemory-mcp-server.js +404 -379
- package/dist/src/orchestrators/multimodal/determinism.js +2 -1
- package/dist/src/orchestrators/multimodal/harness.js +2 -1
- package/dist/src/skills/recursive-agent-orchestrator.js +2 -4
- package/dist/src/utils/process-cleanup.js +1 -7
- package/docs/README.md +42 -0
- package/docs/guides/README_INSTALL.md +208 -0
- package/package.json +18 -9
- package/scripts/claude-code-wrapper.sh +11 -0
- package/scripts/claude-sm-setup.sh +12 -1
- package/scripts/codex-wrapper.sh +11 -0
- package/scripts/git-hooks/branch-context-manager.sh +11 -0
- package/scripts/git-hooks/post-checkout-stackmemory.sh +11 -0
- package/scripts/git-hooks/post-commit-stackmemory.sh +11 -0
- package/scripts/git-hooks/pre-commit-stackmemory.sh +11 -0
- package/scripts/hooks/cleanup-shell.sh +12 -1
- package/scripts/hooks/task-complete.sh +12 -1
- package/scripts/install-code-execution-hooks.sh +12 -1
- package/scripts/install-sweep-hook.sh +12 -0
- package/scripts/install.sh +11 -0
- package/scripts/opencode-wrapper.sh +11 -0
- package/scripts/portal/cloud-init.yaml +69 -0
- package/scripts/portal/setup.sh +69 -0
- package/scripts/portal/stackmemory-portal.service +34 -0
- package/scripts/setup-claude-integration.sh +12 -1
- package/scripts/smoke-init-db.sh +23 -0
- package/scripts/stackmemory-daemon.sh +11 -0
- package/scripts/verify-dist.cjs +11 -4
- package/dist/src/cli/commands/ralph.js +0 -1053
- package/dist/src/hooks/diffmem-hooks.js +0 -376
- package/dist/src/integrations/diffmem/client.js +0 -208
- package/dist/src/integrations/diffmem/config.js +0 -14
- package/dist/src/integrations/greptile/client.js +0 -101
- package/dist/src/integrations/greptile/config.js +0 -14
- package/dist/src/integrations/greptile/index.js +0 -11
- package/dist/src/integrations/mcp/handlers/cross-search-handlers.js +0 -188
- package/dist/src/integrations/mcp/handlers/diffmem-handlers.js +0 -455
- package/dist/src/integrations/mcp/handlers/greptile-handlers.js +0 -456
- package/dist/src/integrations/mcp/handlers/provider-handlers.js +0 -227
- package/dist/src/integrations/ralph/bridge/ralph-stackmemory-bridge.js +0 -863
- package/dist/src/integrations/ralph/context/context-budget-manager.js +0 -308
- package/dist/src/integrations/ralph/context/stackmemory-context-loader.js +0 -354
- package/dist/src/integrations/ralph/index.js +0 -17
- package/dist/src/integrations/ralph/learning/pattern-learner.js +0 -416
- package/dist/src/integrations/ralph/lifecycle/iteration-lifecycle.js +0 -448
- package/dist/src/integrations/ralph/loopmax.js +0 -488
- package/dist/src/integrations/ralph/monitoring/swarm-dashboard.js +0 -293
- package/dist/src/integrations/ralph/monitoring/swarm-registry.js +0 -107
- package/dist/src/integrations/ralph/orchestration/multi-loop-orchestrator.js +0 -508
- package/dist/src/integrations/ralph/patterns/compounding-engineering-pattern.js +0 -407
- package/dist/src/integrations/ralph/patterns/extended-coherence-sessions.js +0 -495
- package/dist/src/integrations/ralph/patterns/oracle-worker-pattern.js +0 -387
- package/dist/src/integrations/ralph/performance/performance-optimizer.js +0 -357
- package/dist/src/integrations/ralph/recovery/crash-recovery.js +0 -461
- package/dist/src/integrations/ralph/state/state-reconciler.js +0 -420
- package/dist/src/integrations/ralph/swarm/git-workflow-manager.js +0 -444
- package/dist/src/integrations/ralph/swarm/swarm-coordinator.js +0 -1005
- package/dist/src/integrations/ralph/visualization/ralph-debugger.js +0 -635
- package/scripts/ralph-loop-implementation.js +0 -404
- /package/dist/src/{integrations/diffmem/types.js → core/storage/cloud-sync-types.js} +0 -0
- /package/dist/src/{integrations/greptile → features/operator}/types.js +0 -0
- /package/dist/src/{integrations/ralph/types.js → features/web/client/next-env.d.js} +0 -0
|
@@ -25,7 +25,8 @@ class WikiCompiler {
|
|
|
25
25
|
entities: join(this.config.wikiDir, "entities"),
|
|
26
26
|
concepts: join(this.config.wikiDir, "concepts"),
|
|
27
27
|
sources: join(this.config.wikiDir, "sources"),
|
|
28
|
-
synthesis: join(this.config.wikiDir, "synthesis")
|
|
28
|
+
synthesis: join(this.config.wikiDir, "synthesis"),
|
|
29
|
+
sops: join(this.config.wikiDir, "sops")
|
|
29
30
|
};
|
|
30
31
|
}
|
|
31
32
|
/** Initialize wiki directory structure */
|
|
@@ -92,6 +93,8 @@ class WikiCompiler {
|
|
|
92
93
|
this.writeArticle(path, this.buildSessionSource(ctx.sessionDigest));
|
|
93
94
|
created.push(path);
|
|
94
95
|
}
|
|
96
|
+
const derivedSops = this.generateDerivedSops(ctx.anchors);
|
|
97
|
+
created.push(...derivedSops);
|
|
95
98
|
this.updateIndex();
|
|
96
99
|
this.appendLog(
|
|
97
100
|
`## [${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}] create | full wiki`,
|
|
@@ -174,6 +177,8 @@ class WikiCompiler {
|
|
|
174
177
|
if (existsSync(filepath)) updated.push(path);
|
|
175
178
|
else created.push(path);
|
|
176
179
|
}
|
|
180
|
+
const derivedSops = this.generateDerivedSops(ctx.anchors);
|
|
181
|
+
created.push(...derivedSops);
|
|
177
182
|
if (created.length > 0 || updated.length > 0) {
|
|
178
183
|
this.updateIndex();
|
|
179
184
|
this.appendLog(
|
|
@@ -525,6 +530,11 @@ class WikiCompiler {
|
|
|
525
530
|
(f) => f.endsWith(".md")
|
|
526
531
|
).length;
|
|
527
532
|
}
|
|
533
|
+
byCategory["entities"] ??= 0;
|
|
534
|
+
byCategory["concepts"] ??= 0;
|
|
535
|
+
byCategory["sources"] ??= 0;
|
|
536
|
+
byCategory["synthesis"] ??= 0;
|
|
537
|
+
byCategory["sops"] ??= 0;
|
|
528
538
|
const logPath = join(this.dirs.root, "log.md");
|
|
529
539
|
let lastCompile = null;
|
|
530
540
|
if (existsSync(logPath)) {
|
|
@@ -826,6 +836,98 @@ class WikiCompiler {
|
|
|
826
836
|
}
|
|
827
837
|
return groups;
|
|
828
838
|
}
|
|
839
|
+
/**
|
|
840
|
+
* Derive Company OS SOPs from recurring frame anchors.
|
|
841
|
+
* Creates lightweight SOP drafts in wiki/sops/ for DECISION, CONSTRAINT, RISK, FACT anchors.
|
|
842
|
+
*/
|
|
843
|
+
generateDerivedSops(anchors) {
|
|
844
|
+
const created = [];
|
|
845
|
+
const derivedConfig = [
|
|
846
|
+
{
|
|
847
|
+
type: "DECISION",
|
|
848
|
+
id: 401,
|
|
849
|
+
name: "Decision-derived Process",
|
|
850
|
+
proseId: "E.9",
|
|
851
|
+
objective: "Preserve recurring decisions as repeatable guidance so the team does not re-debate settled questions."
|
|
852
|
+
},
|
|
853
|
+
{
|
|
854
|
+
type: "CONSTRAINT",
|
|
855
|
+
id: 402,
|
|
856
|
+
name: "Constraint-derived Process",
|
|
857
|
+
proseId: "E.10",
|
|
858
|
+
objective: "Preserve recurring constraints as repeatable guidance so the team respects known boundaries."
|
|
859
|
+
},
|
|
860
|
+
{
|
|
861
|
+
type: "RISK",
|
|
862
|
+
id: 403,
|
|
863
|
+
name: "Risk-derived Process",
|
|
864
|
+
proseId: "E.11",
|
|
865
|
+
objective: "Preserve recurring risks as repeatable guidance so the team mitigates them consistently."
|
|
866
|
+
},
|
|
867
|
+
{
|
|
868
|
+
type: "FACT",
|
|
869
|
+
id: 404,
|
|
870
|
+
name: "Fact-derived Process",
|
|
871
|
+
proseId: "E.12",
|
|
872
|
+
objective: "Preserve recurring facts as repeatable guidance so the team operates from shared knowledge."
|
|
873
|
+
}
|
|
874
|
+
];
|
|
875
|
+
for (const config of derivedConfig) {
|
|
876
|
+
const typeAnchors = anchors.filter((a) => a.type === config.type);
|
|
877
|
+
if (typeAnchors.length === 0) continue;
|
|
878
|
+
const path = `sops/SOP-${config.id}-${this.slugify(config.name)}.md`;
|
|
879
|
+
const items = typeAnchors.slice(-20).map((a) => {
|
|
880
|
+
const date = new Date(a.created_at * 1e3).toISOString().slice(0, 10);
|
|
881
|
+
return `- ${a.text} _(observed ${date} in [[sources/${this.slugify(a.frame_name)}]])_`;
|
|
882
|
+
}).join("\n");
|
|
883
|
+
const article = [
|
|
884
|
+
"---",
|
|
885
|
+
`title: "SOP-${config.id} ${config.name}"`,
|
|
886
|
+
`category: sop`,
|
|
887
|
+
`derived_from: "${config.type} anchors"`,
|
|
888
|
+
`created: ${(/* @__PURE__ */ new Date()).toISOString()}`,
|
|
889
|
+
`updated: ${(/* @__PURE__ */ new Date()).toISOString()}`,
|
|
890
|
+
`tags: [sop, derived, ${config.type.toLowerCase()}]`,
|
|
891
|
+
"---",
|
|
892
|
+
"",
|
|
893
|
+
`# SOP-${config.id} ${config.name}`,
|
|
894
|
+
"",
|
|
895
|
+
"**Owner:** Derived from frame anchors ",
|
|
896
|
+
"**Status:** Active ",
|
|
897
|
+
`**Related PROSE Expectation:** [${config.proseId} ${config.name}](../../docs/specs/COMPANY-OS-PROSE.md)`,
|
|
898
|
+
"",
|
|
899
|
+
"## Objective",
|
|
900
|
+
config.objective,
|
|
901
|
+
"",
|
|
902
|
+
"## Procedure",
|
|
903
|
+
"",
|
|
904
|
+
`1. **Review**`,
|
|
905
|
+
` - Review the latest ${config.type} anchors below before taking action.`,
|
|
906
|
+
"",
|
|
907
|
+
`2. **Apply**`,
|
|
908
|
+
` - Treat these ${config.type.toLowerCase()}s as guidance for current and future work.`,
|
|
909
|
+
"",
|
|
910
|
+
`3. **Update**`,
|
|
911
|
+
` - When a ${config.type.toLowerCase()} changes, record the new state in a frame so this SOP can be regenerated.`,
|
|
912
|
+
"",
|
|
913
|
+
"## Verification",
|
|
914
|
+
"",
|
|
915
|
+
`- Run \`stackmemory company-os audit ${config.type.toLowerCase()}-derived\``,
|
|
916
|
+
`- Expected result: the derived ${config.type.toLowerCase()}s below are reflected in current work.`,
|
|
917
|
+
"",
|
|
918
|
+
"### Derived anchors",
|
|
919
|
+
`${items}`,
|
|
920
|
+
"",
|
|
921
|
+
"## Non-compliance",
|
|
922
|
+
"",
|
|
923
|
+
`Ignoring or overriding these ${config.type.toLowerCase()}s without a new recorded decision is non-compliant.`,
|
|
924
|
+
""
|
|
925
|
+
].join("\n");
|
|
926
|
+
this.writeArticle(path, article);
|
|
927
|
+
created.push(path);
|
|
928
|
+
}
|
|
929
|
+
return created;
|
|
930
|
+
}
|
|
829
931
|
// ── Reading helpers ──
|
|
830
932
|
readExistingSources() {
|
|
831
933
|
const sources = [];
|
|
@@ -57,6 +57,51 @@ const DEFAULT_DAEMON_CONFIG = {
|
|
|
57
57
|
ignore: ["node_modules", ".git", "dist", "build", ".stackmemory"],
|
|
58
58
|
debounceMs: 2e3
|
|
59
59
|
},
|
|
60
|
+
telemetry: {
|
|
61
|
+
enabled: true,
|
|
62
|
+
// opt-out via STACKMEMORY_TELEMETRY=0
|
|
63
|
+
interval: 1440,
|
|
64
|
+
// 24 hours
|
|
65
|
+
maxSnapshots: 90
|
|
66
|
+
// ~3 months of daily
|
|
67
|
+
},
|
|
68
|
+
desirePaths: {
|
|
69
|
+
enabled: true,
|
|
70
|
+
// opt-out via STACKMEMORY_DESIRE_PATHS=0
|
|
71
|
+
interval: 360,
|
|
72
|
+
// scan every 6 hours
|
|
73
|
+
minFrequency: 3,
|
|
74
|
+
// 3+ occurrences to be a pattern
|
|
75
|
+
minSessions: 2,
|
|
76
|
+
// across 2+ distinct sessions
|
|
77
|
+
maxLogSizeBytes: 10 * 1024 * 1024,
|
|
78
|
+
// 10MB rotation
|
|
79
|
+
retentionDays: 30,
|
|
80
|
+
maxSequenceLength: 8,
|
|
81
|
+
autoPromoteThreshold: 0.8,
|
|
82
|
+
autoPromoteMinSessions: 5
|
|
83
|
+
},
|
|
84
|
+
researchStream: {
|
|
85
|
+
enabled: true,
|
|
86
|
+
// opt-out via STACKMEMORY_RESEARCH_STREAM=0
|
|
87
|
+
interval: 360,
|
|
88
|
+
// every 6 hours
|
|
89
|
+
keywords: [
|
|
90
|
+
"agent",
|
|
91
|
+
"ai",
|
|
92
|
+
"llm",
|
|
93
|
+
"mcp",
|
|
94
|
+
"context",
|
|
95
|
+
"memory",
|
|
96
|
+
"orchestration",
|
|
97
|
+
"skill",
|
|
98
|
+
"workflow",
|
|
99
|
+
"automation",
|
|
100
|
+
"browser agent",
|
|
101
|
+
"coding assistant"
|
|
102
|
+
],
|
|
103
|
+
maxSignalsPerScan: 50
|
|
104
|
+
},
|
|
60
105
|
heartbeatInterval: 60,
|
|
61
106
|
// 1 minute
|
|
62
107
|
inactivityTimeout: 0,
|