@monoes/monomindcli 1.18.15 → 2.0.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/.claude/agents/core/researcher.md +29 -24
- package/.claude/agents/github/code-review-swarm.md +1 -1
- package/.claude/agents/github/github-modes.md +1 -1
- package/.claude/agents/github/issue-tracker.md +1 -3
- package/.claude/agents/github/multi-repo-swarm.md +1 -1
- package/.claude/agents/github/pr-manager.md +1 -3
- package/.claude/agents/github/project-board-sync.md +1 -1
- package/.claude/agents/github/release-manager.md +1 -1
- package/.claude/agents/github/repo-architect.md +4 -12
- package/.claude/agents/github/swarm-issue.md +1 -1
- package/.claude/agents/github/swarm-pr.md +1 -1
- package/.claude/agents/github/sync-coordinator.md +1 -1
- package/.claude/agents/github/workflow-automation.md +1 -1
- package/.claude/agents/goal/goal-planner.md +1 -2
- package/.claude/agents/specialized/specialized-workflow-architect.md +11 -14
- package/.claude/agents/testing/production-validator.md +8 -7
- package/.claude/agents/testing/testing-evidence-collector.md +3 -1
- package/.claude/commands/github/issue-tracker.md +0 -2
- package/.claude/commands/github/pr-manager.md +0 -2
- package/.claude/commands/github/repo-architect.md +3 -10
- package/.claude/commands/mastermind/code-review.md +4 -4
- package/.claude/commands/mastermind/help.md +5 -5
- package/.claude/commands/mastermind/okf-export.md +14 -0
- package/.claude/commands/mastermind/okf-import.md +15 -0
- package/.claude/commands/workflows/README.md +0 -1
- package/.claude/commands/workflows/workflow-create.md +0 -1
- package/.claude/commands/workflows/workflow-execute.md +1 -3
- package/.claude/commands/workflows/workflow-export.md +0 -2
- package/.claude/helpers/handlers/agent-start-handler.cjs +28 -36
- package/.claude/helpers/handlers/capture-handler.cjs +110 -0
- package/.claude/helpers/handlers/edit-handler.cjs +15 -0
- package/.claude/helpers/handlers/gates-handler.cjs +2 -8
- package/.claude/helpers/handlers/route-handler.cjs +314 -245
- package/.claude/helpers/handlers/session-handler.cjs +182 -163
- package/.claude/helpers/handlers/session-restore-handler.cjs +95 -53
- package/.claude/helpers/handlers/task-handler.cjs +17 -160
- package/.claude/helpers/hook-handler.cjs +153 -16
- package/.claude/helpers/intelligence.cjs +255 -15
- package/.claude/helpers/learning-service.mjs +1 -0
- package/.claude/helpers/mastermind-activate.cjs +33 -51
- package/.claude/helpers/monolean-activate.cjs +13 -3
- package/.claude/helpers/monolean-propagate.cjs +7 -3
- package/.claude/helpers/router.cjs +122 -11
- package/.claude/helpers/skill-registry.json +0 -189
- package/.claude/skills/github-toolkit/SKILL.md +60 -0
- package/.claude/skills/hive-mind-advanced/SKILL.md +0 -15
- package/.claude/skills/hooks-automation/SKILL.md +0 -1
- package/.claude/skills/mastermind-skills/_protocol.md +1 -1
- package/.claude/skills/mastermind-skills/architect.md +5 -6
- package/.claude/skills/mastermind-skills/autodev.md +8 -5
- package/.claude/skills/mastermind-skills/build.md +1 -2
- package/.claude/skills/mastermind-skills/review.md +8 -5
- package/.claude/skills/mastermind-skills/techport.md +37 -3
- package/.claude/skills/memory-toolkit/SKILL.md +75 -0
- package/.claude/skills/monodesign/document.md +9 -6
- package/.claude/skills/monodesign/extract.md +1 -1
- package/.claude/skills/monodesign/reference/document.md +1 -1
- package/.claude/skills/monodesign/reference/live.md +1 -1
- package/.claude/skills/monolean/SKILL.md +1 -1
- package/.claude/skills/specialagent/SKILL.md +2 -4
- package/.claude/skills/swarm-advanced/SKILL.md +0 -1
- package/README.md +2 -5
- package/bin/mcp-server.js +11 -1
- package/dist/src/autopilot-state.d.ts.map +1 -1
- package/dist/src/autopilot-state.js +4 -5
- package/dist/src/autopilot-state.js.map +1 -1
- package/dist/src/browser/dashboard/server.d.ts.map +1 -1
- package/dist/src/browser/dashboard/server.js +69 -1
- package/dist/src/browser/dashboard/server.js.map +1 -1
- package/dist/src/browser/dashboard/ui.html +214 -1764
- package/dist/src/capabilities/index.d.ts +0 -2
- package/dist/src/capabilities/index.d.ts.map +1 -1
- package/dist/src/capabilities/index.js +0 -1
- package/dist/src/capabilities/index.js.map +1 -1
- package/dist/src/commands/agent-lifecycle.d.ts.map +1 -1
- package/dist/src/commands/agent-lifecycle.js +2 -6
- package/dist/src/commands/agent-lifecycle.js.map +1 -1
- package/dist/src/commands/agent-ops.d.ts +1 -2
- package/dist/src/commands/agent-ops.d.ts.map +1 -1
- package/dist/src/commands/agent-ops.js +1 -59
- package/dist/src/commands/agent-ops.js.map +1 -1
- package/dist/src/commands/agent.d.ts.map +1 -1
- package/dist/src/commands/agent.js +2 -3
- package/dist/src/commands/agent.js.map +1 -1
- package/dist/src/commands/analyze-diff.js +1 -1
- package/dist/src/commands/analyze-diff.js.map +1 -1
- package/dist/src/commands/analyze.d.ts +0 -4
- package/dist/src/commands/analyze.d.ts.map +1 -1
- package/dist/src/commands/analyze.js +1 -29
- package/dist/src/commands/analyze.js.map +1 -1
- package/dist/src/commands/browse-action.d.ts.map +1 -1
- package/dist/src/commands/browse-action.js +94 -2
- package/dist/src/commands/browse-action.js.map +1 -1
- package/dist/src/commands/completions.d.ts.map +1 -1
- package/dist/src/commands/completions.js +12 -76
- package/dist/src/commands/completions.js.map +1 -1
- package/dist/src/commands/config.d.ts.map +1 -1
- package/dist/src/commands/config.js +0 -6
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/doctor-project-checks.d.ts +13 -3
- package/dist/src/commands/doctor-project-checks.d.ts.map +1 -1
- package/dist/src/commands/doctor-project-checks.js +131 -23
- package/dist/src/commands/doctor-project-checks.js.map +1 -1
- package/dist/src/commands/doctor.d.ts.map +1 -1
- package/dist/src/commands/doctor.js +6 -5
- package/dist/src/commands/doctor.js.map +1 -1
- package/dist/src/commands/guidance.d.ts +5 -1
- package/dist/src/commands/guidance.d.ts.map +1 -1
- package/dist/src/commands/guidance.js +11 -556
- package/dist/src/commands/guidance.js.map +1 -1
- package/dist/src/commands/hive-mind-comms.d.ts.map +1 -1
- package/dist/src/commands/hive-mind-comms.js +11 -4
- package/dist/src/commands/hive-mind-comms.js.map +1 -1
- package/dist/src/commands/hive-mind-helpers.js +2 -2
- package/dist/src/commands/hive-mind-helpers.js.map +1 -1
- package/dist/src/commands/hive-mind-ops.d.ts +1 -3
- package/dist/src/commands/hive-mind-ops.d.ts.map +1 -1
- package/dist/src/commands/hive-mind-ops.js +2 -116
- package/dist/src/commands/hive-mind-ops.js.map +1 -1
- package/dist/src/commands/hive-mind.d.ts +4 -4
- package/dist/src/commands/hive-mind.d.ts.map +1 -1
- package/dist/src/commands/hive-mind.js +11 -11
- package/dist/src/commands/hive-mind.js.map +1 -1
- package/dist/src/commands/hooks-coverage-commands.d.ts.map +1 -1
- package/dist/src/commands/hooks-coverage-commands.js +8 -7
- package/dist/src/commands/hooks-coverage-commands.js.map +1 -1
- package/dist/src/commands/hooks-coverage-gaps.js +1 -1
- package/dist/src/commands/hooks-coverage-gaps.js.map +1 -1
- package/dist/src/commands/hooks-coverage-routing.js +2 -2
- package/dist/src/commands/hooks-coverage-routing.js.map +1 -1
- package/dist/src/commands/hooks-extended-commands.d.ts +0 -3
- package/dist/src/commands/hooks-extended-commands.d.ts.map +1 -1
- package/dist/src/commands/hooks-extended-commands.js +0 -307
- package/dist/src/commands/hooks-extended-commands.js.map +1 -1
- package/dist/src/commands/hooks-formatting.d.ts +1 -5
- package/dist/src/commands/hooks-formatting.d.ts.map +1 -1
- package/dist/src/commands/hooks-formatting.js +1 -18
- package/dist/src/commands/hooks-formatting.js.map +1 -1
- package/dist/src/commands/hooks-workers.d.ts +1 -1
- package/dist/src/commands/hooks-workers.d.ts.map +1 -1
- package/dist/src/commands/hooks-workers.js +82 -330
- package/dist/src/commands/hooks-workers.js.map +1 -1
- package/dist/src/commands/hooks.d.ts.map +1 -1
- package/dist/src/commands/hooks.js +1 -12
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/commands/index.d.ts +2 -55
- package/dist/src/commands/index.d.ts.map +1 -1
- package/dist/src/commands/index.js +23 -216
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/init-wizard.d.ts.map +1 -1
- package/dist/src/commands/init-wizard.js +3 -5
- package/dist/src/commands/init-wizard.js.map +1 -1
- package/dist/src/commands/init.d.ts.map +1 -1
- package/dist/src/commands/init.js +4 -24
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/mcp.d.ts.map +1 -1
- package/dist/src/commands/mcp.js +32 -4
- package/dist/src/commands/mcp.js.map +1 -1
- package/dist/src/commands/memory-admin.d.ts +1 -2
- package/dist/src/commands/memory-admin.d.ts.map +1 -1
- package/dist/src/commands/memory-admin.js +1 -118
- package/dist/src/commands/memory-admin.js.map +1 -1
- package/dist/src/commands/memory-transfer.d.ts +1 -2
- package/dist/src/commands/memory-transfer.d.ts.map +1 -1
- package/dist/src/commands/memory-transfer.js +5 -171
- package/dist/src/commands/memory-transfer.js.map +1 -1
- package/dist/src/commands/memory.d.ts.map +1 -1
- package/dist/src/commands/memory.js +3 -6
- package/dist/src/commands/memory.js.map +1 -1
- package/dist/src/commands/neural-core.d.ts +3 -1
- package/dist/src/commands/neural-core.d.ts.map +1 -1
- package/dist/src/commands/neural-core.js +154 -15
- package/dist/src/commands/neural-core.js.map +1 -1
- package/dist/src/commands/neural-optimize.d.ts.map +1 -1
- package/dist/src/commands/neural-optimize.js +13 -15
- package/dist/src/commands/neural-optimize.js.map +1 -1
- package/dist/src/commands/neural-registry.d.ts +1 -1
- package/dist/src/commands/neural-registry.js +14 -14
- package/dist/src/commands/neural-registry.js.map +1 -1
- package/dist/src/commands/neural.d.ts +1 -1
- package/dist/src/commands/neural.js +6 -6
- package/dist/src/commands/neural.js.map +1 -1
- package/dist/src/commands/performance.d.ts.map +1 -1
- package/dist/src/commands/performance.js +68 -58
- package/dist/src/commands/performance.js.map +1 -1
- package/dist/src/commands/providers.d.ts.map +1 -1
- package/dist/src/commands/providers.js +77 -117
- package/dist/src/commands/providers.js.map +1 -1
- package/dist/src/commands/search-universal.d.ts +7 -1
- package/dist/src/commands/search-universal.d.ts.map +1 -1
- package/dist/src/commands/search-universal.js +59 -5
- package/dist/src/commands/search-universal.js.map +1 -1
- package/dist/src/commands/security-cve.d.ts.map +1 -1
- package/dist/src/commands/security-cve.js +3 -5
- package/dist/src/commands/security-cve.js.map +1 -1
- package/dist/src/commands/security-misc.d.ts +0 -1
- package/dist/src/commands/security-misc.d.ts.map +1 -1
- package/dist/src/commands/security-misc.js +69 -45
- package/dist/src/commands/security-misc.js.map +1 -1
- package/dist/src/commands/security.d.ts.map +1 -1
- package/dist/src/commands/security.js +2 -4
- package/dist/src/commands/security.js.map +1 -1
- package/dist/src/commands/session.d.ts.map +1 -1
- package/dist/src/commands/session.js +137 -281
- package/dist/src/commands/session.js.map +1 -1
- package/dist/src/commands/start.d.ts.map +1 -1
- package/dist/src/commands/start.js +2 -59
- package/dist/src/commands/start.js.map +1 -1
- package/dist/src/commands/status.d.ts.map +1 -1
- package/dist/src/commands/status.js +18 -29
- package/dist/src/commands/status.js.map +1 -1
- package/dist/src/commands/swarm.d.ts.map +1 -1
- package/dist/src/commands/swarm.js +113 -66
- package/dist/src/commands/swarm.js.map +1 -1
- package/dist/src/commands/task.d.ts.map +1 -1
- package/dist/src/commands/task.js +2 -49
- package/dist/src/commands/task.js.map +1 -1
- package/dist/src/consensus/audit-writer.d.ts.map +1 -1
- package/dist/src/consensus/audit-writer.js +43 -1
- package/dist/src/consensus/audit-writer.js.map +1 -1
- package/dist/src/consensus/tally.d.ts +19 -0
- package/dist/src/consensus/tally.d.ts.map +1 -0
- package/dist/src/consensus/tally.js +34 -0
- package/dist/src/consensus/tally.js.map +1 -0
- package/dist/src/index.d.ts +3 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +13 -9
- package/dist/src/index.js.map +1 -1
- package/dist/src/init/claudemd-generator.d.ts.map +1 -1
- package/dist/src/init/claudemd-generator.js +10 -14
- package/dist/src/init/claudemd-generator.js.map +1 -1
- package/dist/src/init/executor.d.ts.map +1 -1
- package/dist/src/init/executor.js +42 -100
- package/dist/src/init/executor.js.map +1 -1
- package/dist/src/init/helpers-generator.d.ts.map +1 -1
- package/dist/src/init/helpers-generator.js +2 -22
- package/dist/src/init/helpers-generator.js.map +1 -1
- package/dist/src/init/settings-generator.d.ts.map +1 -1
- package/dist/src/init/settings-generator.js +0 -13
- package/dist/src/init/settings-generator.js.map +1 -1
- package/dist/src/init/statusline-generator.d.ts.map +1 -1
- package/dist/src/init/statusline-generator.js +62 -0
- package/dist/src/init/statusline-generator.js.map +1 -1
- package/dist/src/init/types.d.ts +3 -9
- package/dist/src/init/types.d.ts.map +1 -1
- package/dist/src/init/types.js +0 -5
- package/dist/src/init/types.js.map +1 -1
- package/dist/src/knowledge/document-pipeline.d.ts.map +1 -1
- package/dist/src/knowledge/document-pipeline.js +18 -8
- package/dist/src/knowledge/document-pipeline.js.map +1 -1
- package/dist/src/mcp-client.d.ts.map +1 -1
- package/dist/src/mcp-client.js +0 -8
- package/dist/src/mcp-client.js.map +1 -1
- package/dist/src/mcp-server.d.ts.map +1 -1
- package/dist/src/mcp-server.js +14 -0
- package/dist/src/mcp-server.js.map +1 -1
- package/dist/src/mcp-tools/agent-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/agent-tools.js +0 -17
- package/dist/src/mcp-tools/agent-tools.js.map +1 -1
- package/dist/src/mcp-tools/coherence/causal-infer.d.ts +5 -5
- package/dist/src/mcp-tools/coherence/causal-infer.d.ts.map +1 -1
- package/dist/src/mcp-tools/coherence/causal-infer.js +32 -46
- package/dist/src/mcp-tools/coherence/causal-infer.js.map +1 -1
- package/dist/src/mcp-tools/coherence/coherence-check.d.ts.map +1 -1
- package/dist/src/mcp-tools/coherence/coherence-check.js +1 -19
- package/dist/src/mcp-tools/coherence/coherence-check.js.map +1 -1
- package/dist/src/mcp-tools/coherence/consensus-verify.d.ts +2 -3
- package/dist/src/mcp-tools/coherence/consensus-verify.d.ts.map +1 -1
- package/dist/src/mcp-tools/coherence/consensus-verify.js +22 -20
- package/dist/src/mcp-tools/coherence/consensus-verify.js.map +1 -1
- package/dist/src/mcp-tools/coherence/memory-gate.d.ts +3 -2
- package/dist/src/mcp-tools/coherence/memory-gate.d.ts.map +1 -1
- package/dist/src/mcp-tools/coherence/memory-gate.js +32 -19
- package/dist/src/mcp-tools/coherence/memory-gate.js.map +1 -1
- package/dist/src/mcp-tools/coherence/quantum-topology.d.ts +4 -4
- package/dist/src/mcp-tools/coherence/quantum-topology.d.ts.map +1 -1
- package/dist/src/mcp-tools/coherence/quantum-topology.js +11 -17
- package/dist/src/mcp-tools/coherence/quantum-topology.js.map +1 -1
- package/dist/src/mcp-tools/coherence/spectral-analyze.d.ts +2 -3
- package/dist/src/mcp-tools/coherence/spectral-analyze.d.ts.map +1 -1
- package/dist/src/mcp-tools/coherence/spectral-analyze.js +51 -32
- package/dist/src/mcp-tools/coherence/spectral-analyze.js.map +1 -1
- package/dist/src/mcp-tools/coherence/types.d.ts +8 -11
- package/dist/src/mcp-tools/coherence/types.d.ts.map +1 -1
- package/dist/src/mcp-tools/coherence/types.js +3 -18
- package/dist/src/mcp-tools/coherence/types.js.map +1 -1
- package/dist/src/mcp-tools/embeddings-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/embeddings-tools.js +1 -7
- package/dist/src/mcp-tools/embeddings-tools.js.map +1 -1
- package/dist/src/mcp-tools/graphify-tools.js +2 -2
- package/dist/src/mcp-tools/graphify-tools.js.map +1 -1
- package/dist/src/mcp-tools/guidance-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/guidance-tools.js +9 -19
- package/dist/src/mcp-tools/guidance-tools.js.map +1 -1
- package/dist/src/mcp-tools/hive-mind-tools.d.ts +8 -1
- package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/hive-mind-tools.js +198 -40
- package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -1
- package/dist/src/mcp-tools/hooks-advanced.d.ts +18 -0
- package/dist/src/mcp-tools/hooks-advanced.d.ts.map +1 -0
- package/dist/src/mcp-tools/hooks-advanced.js +25 -0
- package/dist/src/mcp-tools/hooks-advanced.js.map +1 -0
- package/dist/src/mcp-tools/hooks-intelligence.d.ts +4 -8
- package/dist/src/mcp-tools/hooks-intelligence.d.ts.map +1 -1
- package/dist/src/mcp-tools/hooks-intelligence.js +33 -482
- package/dist/src/mcp-tools/hooks-intelligence.js.map +1 -1
- package/dist/src/mcp-tools/hooks-routing.d.ts +1 -3
- package/dist/src/mcp-tools/hooks-routing.d.ts.map +1 -1
- package/dist/src/mcp-tools/hooks-routing.js +96 -202
- package/dist/src/mcp-tools/hooks-routing.js.map +1 -1
- package/dist/src/mcp-tools/hooks-synthesis.d.ts +31 -0
- package/dist/src/mcp-tools/hooks-synthesis.d.ts.map +1 -0
- package/dist/src/mcp-tools/hooks-synthesis.js +196 -0
- package/dist/src/mcp-tools/hooks-synthesis.js.map +1 -0
- package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.js +10 -11
- package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
- package/dist/src/mcp-tools/index.d.ts +0 -3
- package/dist/src/mcp-tools/index.d.ts.map +1 -1
- package/dist/src/mcp-tools/index.js +0 -4
- package/dist/src/mcp-tools/index.js.map +1 -1
- package/dist/src/mcp-tools/memory-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/memory-tools.js +24 -9
- package/dist/src/mcp-tools/memory-tools.js.map +1 -1
- package/dist/src/mcp-tools/monograph-tools.d.ts +6 -0
- package/dist/src/mcp-tools/monograph-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/monograph-tools.js +370 -95
- package/dist/src/mcp-tools/monograph-tools.js.map +1 -1
- package/dist/src/mcp-tools/neural-tools.d.ts +8 -9
- package/dist/src/mcp-tools/neural-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/neural-tools.js +249 -539
- package/dist/src/mcp-tools/neural-tools.js.map +1 -1
- package/dist/src/mcp-tools/performance-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/performance-tools.js +5 -17
- package/dist/src/mcp-tools/performance-tools.js.map +1 -1
- package/dist/src/mcp-tools/quality/coverage-analysis/prioritize-gaps.js +2 -2
- package/dist/src/mcp-tools/quality/coverage-analysis/prioritize-gaps.js.map +1 -1
- package/dist/src/mcp-tools/quality/security-compliance/detect-secrets.d.ts +4 -4
- package/dist/src/mcp-tools/quality-tools.d.ts +7 -2
- package/dist/src/mcp-tools/quality-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/quality-tools.js +7 -257
- package/dist/src/mcp-tools/quality-tools.js.map +1 -1
- package/dist/src/mcp-tools/security-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/security-tools.js +103 -0
- package/dist/src/mcp-tools/security-tools.js.map +1 -1
- package/dist/src/memory/intelligence.d.ts +9 -9
- package/dist/src/memory/intelligence.d.ts.map +1 -1
- package/dist/src/memory/intelligence.js +71 -59
- package/dist/src/memory/intelligence.js.map +1 -1
- package/dist/src/memory/memory-bridge.d.ts +1 -0
- package/dist/src/memory/memory-bridge.d.ts.map +1 -1
- package/dist/src/memory/memory-bridge.js +47 -5
- package/dist/src/memory/memory-bridge.js.map +1 -1
- package/dist/src/memory/memory-read.d.ts.map +1 -1
- package/dist/src/memory/memory-read.js +1 -19
- package/dist/src/memory/memory-read.js.map +1 -1
- package/dist/src/suggest.d.ts.map +1 -1
- package/dist/src/suggest.js +1 -12
- package/dist/src/suggest.js.map +1 -1
- package/dist/src/transfer/store/discovery.d.ts +3 -2
- package/dist/src/transfer/store/discovery.d.ts.map +1 -1
- package/dist/src/transfer/store/discovery.js +22 -70
- package/dist/src/transfer/store/discovery.js.map +1 -1
- package/dist/src/update/checker.d.ts.map +1 -1
- package/dist/src/update/checker.js +0 -1
- package/dist/src/update/checker.js.map +1 -1
- package/dist/src/utils/cosine-similarity.d.ts +22 -0
- package/dist/src/utils/cosine-similarity.d.ts.map +1 -0
- package/dist/src/utils/cosine-similarity.js +38 -0
- package/dist/src/utils/cosine-similarity.js.map +1 -0
- package/dist/src/utils/input-guards.d.ts +51 -0
- package/dist/src/utils/input-guards.d.ts.map +1 -0
- package/dist/src/utils/input-guards.js +223 -0
- package/dist/src/utils/input-guards.js.map +1 -0
- package/dist/src/utils/json-file.d.ts +33 -0
- package/dist/src/utils/json-file.d.ts.map +1 -0
- package/dist/src/utils/json-file.js +57 -0
- package/dist/src/utils/json-file.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -6
- package/scripts/sync-claude-assets.sh +16 -20
- package/.claude/agents/generated/case-analyst.md +0 -50
- package/.claude/agents/generated/channel-intelligence-director.md +0 -87
- package/.claude/agents/generated/chief-growth-officer.md +0 -88
- package/.claude/agents/generated/churn-analyst.md +0 -53
- package/.claude/agents/generated/code-reviewer.md +0 -55
- package/.claude/agents/generated/code-validator.md +0 -57
- package/.claude/agents/generated/complexity-scanner.md +0 -56
- package/.claude/agents/generated/content-seo-strategist.md +0 -90
- package/.claude/agents/generated/copy-editor.md +0 -45
- package/.claude/agents/generated/court-reporter.md +0 -50
- package/.claude/agents/generated/defender.md +0 -51
- package/.claude/agents/generated/devbot-orchestrator.md +0 -58
- package/.claude/agents/generated/devbot-planner.md +0 -63
- package/.claude/agents/generated/developer-community-strategist.md +0 -91
- package/.claude/agents/generated/editor-in-chief.md +0 -45
- package/.claude/agents/generated/fact-checker.md +0 -45
- package/.claude/agents/generated/impact-assessor.md +0 -54
- package/.claude/agents/generated/judge.md +0 -51
- package/.claude/agents/generated/outreach-partnership-strategist.md +0 -90
- package/.claude/agents/generated/prosecutor.md +0 -51
- package/.claude/agents/generated/reporter.md +0 -45
- package/.claude/agents/generated/social-media-strategist.md +0 -91
- package/.claude/agents/generated/video-visual-strategist.md +0 -90
- package/.claude/agents/reengineer-squad/boss.md +0 -113
- package/.claude/agents/reengineer-squad/critic-architect.md +0 -132
- package/.claude/agents/reengineer-squad/git-manager.md +0 -145
- package/.claude/agents/reengineer-squad/idea-generator.md +0 -95
- package/.claude/agents/reengineer-squad/implementer.md +0 -112
- package/.claude/agents/reengineer-squad/integration-planner.md +0 -112
- package/.claude/agents/reengineer-squad/source-analyst.md +0 -103
- package/.claude/agents/reengineer-squad/target-analyst.md +0 -118
- package/.claude/agents/reengineer-squad/tester.md +0 -105
- package/.claude/agents/sparc/architecture.md +0 -453
- package/.claude/agents/sparc/pseudocode.md +0 -299
- package/.claude/agents/sparc/refinement.md +0 -504
- package/.claude/agents/sparc/specification.md +0 -258
- package/.claude/agents/templates/implementer-sparc-coder.md +0 -231
- package/.claude/commands/sparc/analyzer.md +0 -35
- package/.claude/commands/sparc/architect.md +0 -36
- package/.claude/commands/sparc/ask.md +0 -56
- package/.claude/commands/sparc/batch-executor.md +0 -37
- package/.claude/commands/sparc/code.md +0 -48
- package/.claude/commands/sparc/coder.md +0 -37
- package/.claude/commands/sparc/debug.md +0 -42
- package/.claude/commands/sparc/debugger.md +0 -37
- package/.claude/commands/sparc/designer.md +0 -36
- package/.claude/commands/sparc/devops.md +0 -68
- package/.claude/commands/sparc/docs-writer.md +0 -39
- package/.claude/commands/sparc/documenter.md +0 -37
- package/.claude/commands/sparc/innovator.md +0 -37
- package/.claude/commands/sparc/integration.md +0 -42
- package/.claude/commands/sparc/mcp.md +0 -76
- package/.claude/commands/sparc/memory-manager.md +0 -57
- package/.claude/commands/sparc/optimizer.md +0 -37
- package/.claude/commands/sparc/orchestrator.md +0 -70
- package/.claude/commands/sparc/post-deployment-monitoring-mode.md +0 -42
- package/.claude/commands/sparc/refinement-optimization-mode.md +0 -42
- package/.claude/commands/sparc/researcher.md +0 -37
- package/.claude/commands/sparc/reviewer.md +0 -37
- package/.claude/commands/sparc/security-review.md +0 -39
- package/.claude/commands/sparc/sparc-modes.md +0 -120
- package/.claude/commands/sparc/sparc.md +0 -71
- package/.claude/commands/sparc/spec-pseudocode.md +0 -39
- package/.claude/commands/sparc/supabase-admin.md +0 -301
- package/.claude/commands/sparc/swarm-coordinator.md +0 -50
- package/.claude/commands/sparc/tdd.md +0 -37
- package/.claude/commands/sparc/tester.md +0 -37
- package/.claude/commands/sparc/tutorial.md +0 -38
- package/.claude/commands/sparc/workflow-manager.md +0 -37
- package/.claude/commands/sparc.md +0 -112
- package/.claude/helpers/auto-memory-hook.mjs +0 -503
- package/.claude/skills/sparc-methodology/SKILL.md +0 -950
- package/dist/src/capabilities/enrichment.d.ts +0 -44
- package/dist/src/capabilities/enrichment.d.ts.map +0 -1
- package/dist/src/capabilities/enrichment.js +0 -141
- package/dist/src/capabilities/enrichment.js.map +0 -1
- package/dist/src/commands/analyze-boundaries.d.ts +0 -14
- package/dist/src/commands/analyze-boundaries.d.ts.map +0 -1
- package/dist/src/commands/analyze-boundaries.js +0 -295
- package/dist/src/commands/analyze-boundaries.js.map +0 -1
- package/dist/src/commands/analyze-graph.d.ts +0 -14
- package/dist/src/commands/analyze-graph.d.ts.map +0 -1
- package/dist/src/commands/analyze-graph.js +0 -304
- package/dist/src/commands/analyze-graph.js.map +0 -1
- package/dist/src/commands/claims.d.ts +0 -10
- package/dist/src/commands/claims.d.ts.map +0 -1
- package/dist/src/commands/claims.js +0 -650
- package/dist/src/commands/claims.js.map +0 -1
- package/dist/src/commands/daemon.d.ts +0 -8
- package/dist/src/commands/daemon.d.ts.map +0 -1
- package/dist/src/commands/daemon.js +0 -681
- package/dist/src/commands/daemon.js.map +0 -1
- package/dist/src/commands/deployment.d.ts +0 -10
- package/dist/src/commands/deployment.d.ts.map +0 -1
- package/dist/src/commands/deployment.js +0 -706
- package/dist/src/commands/deployment.js.map +0 -1
- package/dist/src/commands/enrich.d.ts +0 -10
- package/dist/src/commands/enrich.d.ts.map +0 -1
- package/dist/src/commands/enrich.js +0 -58
- package/dist/src/commands/enrich.js.map +0 -1
- package/dist/src/commands/issues.d.ts +0 -21
- package/dist/src/commands/issues.d.ts.map +0 -1
- package/dist/src/commands/issues.js +0 -575
- package/dist/src/commands/issues.js.map +0 -1
- package/dist/src/commands/workflow.d.ts +0 -8
- package/dist/src/commands/workflow.d.ts.map +0 -1
- package/dist/src/commands/workflow.js +0 -677
- package/dist/src/commands/workflow.js.map +0 -1
- package/dist/src/mcp-tools/workflow-tools.d.ts +0 -8
- package/dist/src/mcp-tools/workflow-tools.d.ts.map +0 -1
- package/dist/src/mcp-tools/workflow-tools.js +0 -717
- package/dist/src/mcp-tools/workflow-tools.js.map +0 -1
- package/dist/src/services/claim-service.d.ts +0 -198
- package/dist/src/services/claim-service.d.ts.map +0 -1
- package/dist/src/services/claim-service.js +0 -890
- package/dist/src/services/claim-service.js.map +0 -1
- package/dist/src/services/headless-worker-executor.d.ts +0 -311
- package/dist/src/services/headless-worker-executor.d.ts.map +0 -1
- package/dist/src/services/headless-worker-executor.js +0 -1183
- package/dist/src/services/headless-worker-executor.js.map +0 -1
- package/dist/src/services/worker-daemon.d.ts +0 -248
- package/dist/src/services/worker-daemon.d.ts.map +0 -1
- package/dist/src/services/worker-daemon.js +0 -1417
- package/dist/src/services/worker-daemon.js.map +0 -1
- package/dist/src/ui/.monomind/capture/active-run.json +0 -1
- package/dist/src/ui/.monomind/orgs/system-trial-qa/runs/real-events-1782290897.convs.jsonl +0 -3
- package/dist/src/ui/.monomind/orgs/system-trial-qa/runs/real-events-1782290897.jsonl +0 -11
- package/dist/src/ui/.monomind/orgs/system-trial-qa/runs/rigid-qa-restart-1782288201.jsonl +0 -540
- package/dist/src/ui/.monomind/orgs/system-trial-qa-threads.jsonl +0 -3
- package/dist/src/ui/.monomind/orgs/test-event-fix/runs/rigid-qa-restart-1782288201.jsonl +0 -2
|
@@ -1,503 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Auto Memory Bridge Hook (ADR-048/049)
|
|
4
|
-
*
|
|
5
|
-
* Wires AutoMemoryBridge + LearningBridge + MemoryGraph into Claude Code
|
|
6
|
-
* session lifecycle. Called by settings.json SessionStart/SessionEnd hooks.
|
|
7
|
-
*
|
|
8
|
-
* Usage:
|
|
9
|
-
* node auto-memory-hook.mjs import # SessionStart: import auto memory files into backend
|
|
10
|
-
* node auto-memory-hook.mjs sync # SessionEnd: sync insights back to MEMORY.md
|
|
11
|
-
* node auto-memory-hook.mjs status # Show bridge status
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import { existsSync, mkdirSync, openSync, closeSync, unlinkSync, readFileSync, writeFileSync, renameSync, statSync } from 'fs';
|
|
15
|
-
import { join, dirname } from 'path';
|
|
16
|
-
import { fileURLToPath } from 'url';
|
|
17
|
-
|
|
18
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
19
|
-
const __dirname = dirname(__filename);
|
|
20
|
-
const PROJECT_ROOT = join(__dirname, '../..');
|
|
21
|
-
const DATA_DIR = join(PROJECT_ROOT, '.monomind', 'data');
|
|
22
|
-
const STORE_PATH = join(DATA_DIR, 'auto-memory-store.json');
|
|
23
|
-
|
|
24
|
-
// Colors
|
|
25
|
-
const GREEN = '\x1b[0;32m';
|
|
26
|
-
const CYAN = '\x1b[0;36m';
|
|
27
|
-
const DIM = '\x1b[2m';
|
|
28
|
-
const RESET = '\x1b[0m';
|
|
29
|
-
|
|
30
|
-
const log = (msg) => console.log(`${CYAN}[AutoMemory] ${msg}${RESET}`);
|
|
31
|
-
const success = (msg) => console.log(`${GREEN}[AutoMemory] ✓ ${msg}${RESET}`);
|
|
32
|
-
const dim = (msg) => console.log(` ${DIM}${msg}${RESET}`);
|
|
33
|
-
|
|
34
|
-
// Ensure data dir
|
|
35
|
-
if (!existsSync(DATA_DIR)) mkdirSync(DATA_DIR, { recursive: true });
|
|
36
|
-
|
|
37
|
-
// ============================================================================
|
|
38
|
-
// File-lock helper for concurrent hook coordination
|
|
39
|
-
// Uses O_EXCL exclusive-create as a spin lock.
|
|
40
|
-
// A 10ms synchronous wait (via Atomics.wait) is used between retries to avoid
|
|
41
|
-
// pegging the CPU. Acceptable for low-contention hook processes.
|
|
42
|
-
// ============================================================================
|
|
43
|
-
|
|
44
|
-
function withFileLock(lockPath, fn, timeoutMs = 5000) {
|
|
45
|
-
const start = Date.now();
|
|
46
|
-
const sharedBuf = new Int32Array(new SharedArrayBuffer(4));
|
|
47
|
-
while (true) {
|
|
48
|
-
try {
|
|
49
|
-
// O_EXCL: exclusive create — fails atomically if file already exists
|
|
50
|
-
const fd = openSync(lockPath, 'wx');
|
|
51
|
-
closeSync(fd);
|
|
52
|
-
break; // acquired lock
|
|
53
|
-
} catch {
|
|
54
|
-
if (Date.now() - start > timeoutMs) {
|
|
55
|
-
// Timeout: proceed without lock rather than deadlocking hook processes
|
|
56
|
-
try { fn(); } catch { /* best effort */ }
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
// Synchronous 10ms sleep via Atomics.wait (avoids busy-spin CPU peg)
|
|
60
|
-
Atomics.wait(sharedBuf, 0, 0, 10);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
try { fn(); } finally {
|
|
64
|
-
try { unlinkSync(lockPath); } catch { /* ignore */ }
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// ============================================================================
|
|
69
|
-
// Simple JSON File Backend (implements IMemoryBackend interface)
|
|
70
|
-
// ============================================================================
|
|
71
|
-
|
|
72
|
-
class JsonFileBackend {
|
|
73
|
-
constructor(filePath) {
|
|
74
|
-
this.filePath = filePath;
|
|
75
|
-
this.entries = new Map();
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
async initialize() {
|
|
79
|
-
if (existsSync(this.filePath)) {
|
|
80
|
-
try {
|
|
81
|
-
const MAX_STORE_BYTES = 50 * 1024 * 1024; // 50 MiB
|
|
82
|
-
if (statSync(this.filePath).size > MAX_STORE_BYTES) return;
|
|
83
|
-
const data = JSON.parse(readFileSync(this.filePath, 'utf-8'));
|
|
84
|
-
if (Array.isArray(data)) {
|
|
85
|
-
for (const entry of data) this.entries.set(entry.id, entry);
|
|
86
|
-
}
|
|
87
|
-
} catch { /* start fresh */ }
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
async shutdown() { this._persist(); }
|
|
92
|
-
async store(entry) { this.entries.set(entry.id, entry); this._persist(); }
|
|
93
|
-
async get(id) { return this.entries.get(id) ?? null; }
|
|
94
|
-
async getByKey(key, ns) {
|
|
95
|
-
for (const e of this.entries.values()) {
|
|
96
|
-
if (e.key === key && (!ns || e.namespace === ns)) return e;
|
|
97
|
-
}
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
|
-
async update(id, updates) {
|
|
101
|
-
const e = this.entries.get(id);
|
|
102
|
-
if (!e) return null;
|
|
103
|
-
if (updates.metadata) Object.assign(e.metadata, updates.metadata);
|
|
104
|
-
if (updates.content !== undefined) e.content = updates.content;
|
|
105
|
-
if (updates.tags) e.tags = updates.tags;
|
|
106
|
-
e.updatedAt = Date.now();
|
|
107
|
-
this._persist();
|
|
108
|
-
return e;
|
|
109
|
-
}
|
|
110
|
-
async delete(id) { return this.entries.delete(id); }
|
|
111
|
-
async query(opts) {
|
|
112
|
-
let results = [...this.entries.values()];
|
|
113
|
-
if (opts?.namespace) results = results.filter(e => e.namespace === opts.namespace);
|
|
114
|
-
if (opts?.type) results = results.filter(e => e.type === opts.type);
|
|
115
|
-
if (opts?.limit) results = results.slice(0, opts.limit);
|
|
116
|
-
return results;
|
|
117
|
-
}
|
|
118
|
-
async search() { return []; } // No vector search in JSON backend
|
|
119
|
-
async bulkInsert(entries) { for (const e of entries) this.entries.set(e.id, e); this._persist(); }
|
|
120
|
-
async bulkDelete(ids) { let n = 0; for (const id of ids) { if (this.entries.delete(id)) n++; } this._persist(); return n; }
|
|
121
|
-
async count() { return this.entries.size; }
|
|
122
|
-
async listNamespaces() {
|
|
123
|
-
const ns = new Set();
|
|
124
|
-
for (const e of this.entries.values()) ns.add(e.namespace || 'default');
|
|
125
|
-
return [...ns];
|
|
126
|
-
}
|
|
127
|
-
async clearNamespace(ns) {
|
|
128
|
-
let n = 0;
|
|
129
|
-
for (const [id, e] of this.entries) {
|
|
130
|
-
if (e.namespace === ns) { this.entries.delete(id); n++; }
|
|
131
|
-
}
|
|
132
|
-
this._persist();
|
|
133
|
-
return n;
|
|
134
|
-
}
|
|
135
|
-
async getStats() {
|
|
136
|
-
return {
|
|
137
|
-
totalEntries: this.entries.size,
|
|
138
|
-
entriesByNamespace: {},
|
|
139
|
-
entriesByType: { semantic: 0, episodic: 0, procedural: 0, working: 0, cache: 0 },
|
|
140
|
-
memoryUsage: 0, avgQueryTime: 0, avgSearchTime: 0,
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
async healthCheck() {
|
|
144
|
-
return {
|
|
145
|
-
status: 'healthy',
|
|
146
|
-
components: {
|
|
147
|
-
storage: { status: 'healthy', latency: 0 },
|
|
148
|
-
index: { status: 'healthy', latency: 0 },
|
|
149
|
-
cache: { status: 'healthy', latency: 0 },
|
|
150
|
-
},
|
|
151
|
-
timestamp: Date.now(), issues: [], recommendations: [],
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
_persist() {
|
|
156
|
-
const lockPath = this.filePath + '.lock';
|
|
157
|
-
withFileLock(lockPath, () => {
|
|
158
|
-
const data = JSON.stringify([...this.entries.values()], null, 2);
|
|
159
|
-
const tmpPath = this.filePath + '.tmp';
|
|
160
|
-
writeFileSync(tmpPath, data, 'utf-8');
|
|
161
|
-
renameSync(tmpPath, this.filePath);
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// ============================================================================
|
|
167
|
-
// Resolve memory package path (local dev or npm installed)
|
|
168
|
-
// ============================================================================
|
|
169
|
-
|
|
170
|
-
async function loadMemoryPackage() {
|
|
171
|
-
// Strategy 1: Local dev (built dist)
|
|
172
|
-
const localDist = join(PROJECT_ROOT, 'packages/@monomind/memory/dist/index.js');
|
|
173
|
-
if (existsSync(localDist)) {
|
|
174
|
-
try {
|
|
175
|
-
return await import(`file://${localDist}`);
|
|
176
|
-
} catch { /* fall through */ }
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// Strategy 2: Use createRequire for CJS-style resolution (handles nested node_modules
|
|
180
|
-
// when installed as a transitive dependency via npx monomind / npx monomind)
|
|
181
|
-
try {
|
|
182
|
-
const { createRequire } = await import('module');
|
|
183
|
-
const require = createRequire(join(PROJECT_ROOT, 'package.json'));
|
|
184
|
-
return require('@monomind/memory');
|
|
185
|
-
} catch { /* fall through */ }
|
|
186
|
-
|
|
187
|
-
// Strategy 3: ESM import (works when @monomind/memory is a direct dependency)
|
|
188
|
-
try {
|
|
189
|
-
return await import('@monomind/memory');
|
|
190
|
-
} catch { /* fall through */ }
|
|
191
|
-
|
|
192
|
-
// Strategy 4: Walk up from PROJECT_ROOT looking for @monomind/memory in any node_modules
|
|
193
|
-
let searchDir = PROJECT_ROOT;
|
|
194
|
-
const { parse } = await import('path');
|
|
195
|
-
while (searchDir !== parse(searchDir).root) {
|
|
196
|
-
const candidate = join(searchDir, 'node_modules', '@monoes', 'memory', 'dist', 'index.js');
|
|
197
|
-
if (existsSync(candidate)) {
|
|
198
|
-
try {
|
|
199
|
-
return await import(`file://${candidate}`);
|
|
200
|
-
} catch { /* fall through */ }
|
|
201
|
-
}
|
|
202
|
-
searchDir = dirname(searchDir);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
return null;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// ============================================================================
|
|
209
|
-
// Read config from .monomind/config.yaml
|
|
210
|
-
// ============================================================================
|
|
211
|
-
|
|
212
|
-
function readConfig() {
|
|
213
|
-
const configPath = join(PROJECT_ROOT, '.monomind', 'config.yaml');
|
|
214
|
-
const defaults = {
|
|
215
|
-
learningBridge: { enabled: true, sonaMode: 'balanced', confidenceDecayRate: 0.005, accessBoostAmount: 0.03, consolidationThreshold: 10 },
|
|
216
|
-
memoryGraph: { enabled: true, pageRankDamping: 0.85, maxNodes: 5000, similarityThreshold: 0.8 },
|
|
217
|
-
agentScopes: { enabled: true, defaultScope: 'project' },
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
if (!existsSync(configPath)) return defaults;
|
|
221
|
-
|
|
222
|
-
try {
|
|
223
|
-
const MAX_CONFIG_BYTES = 1 * 1024 * 1024; // 1 MiB
|
|
224
|
-
if (statSync(configPath).size > MAX_CONFIG_BYTES) return defaults;
|
|
225
|
-
const yaml = readFileSync(configPath, 'utf-8');
|
|
226
|
-
// Simple YAML parser for the memory section
|
|
227
|
-
const getBool = (key) => {
|
|
228
|
-
const match = yaml.match(new RegExp(`${key}:\\s*(true|false)`, 'i'));
|
|
229
|
-
return match ? match[1] === 'true' : undefined;
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
const lbEnabled = getBool('learningBridge[\\s\\S]*?enabled');
|
|
233
|
-
if (lbEnabled !== undefined) defaults.learningBridge.enabled = lbEnabled;
|
|
234
|
-
|
|
235
|
-
const mgEnabled = getBool('memoryGraph[\\s\\S]*?enabled');
|
|
236
|
-
if (mgEnabled !== undefined) defaults.memoryGraph.enabled = mgEnabled;
|
|
237
|
-
|
|
238
|
-
const asEnabled = getBool('agentScopes[\\s\\S]*?enabled');
|
|
239
|
-
if (asEnabled !== undefined) defaults.agentScopes.enabled = asEnabled;
|
|
240
|
-
|
|
241
|
-
return defaults;
|
|
242
|
-
} catch {
|
|
243
|
-
return defaults;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
// ============================================================================
|
|
248
|
-
// Commands
|
|
249
|
-
// ============================================================================
|
|
250
|
-
|
|
251
|
-
async function doImport() {
|
|
252
|
-
log('Importing auto memory files into bridge...');
|
|
253
|
-
|
|
254
|
-
const memPkg = await loadMemoryPackage();
|
|
255
|
-
if (!memPkg || !memPkg.AutoMemoryBridge) {
|
|
256
|
-
dim('Memory package not available — skipping auto memory import');
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
const config = readConfig();
|
|
261
|
-
const backend = new JsonFileBackend(STORE_PATH);
|
|
262
|
-
await backend.initialize();
|
|
263
|
-
|
|
264
|
-
const bridgeConfig = {
|
|
265
|
-
workingDir: PROJECT_ROOT,
|
|
266
|
-
syncMode: 'on-session-end',
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
// Wire learning if enabled and available
|
|
270
|
-
if (config.learningBridge.enabled && memPkg.LearningBridge) {
|
|
271
|
-
bridgeConfig.learning = {
|
|
272
|
-
sonaMode: config.learningBridge.sonaMode,
|
|
273
|
-
confidenceDecayRate: config.learningBridge.confidenceDecayRate,
|
|
274
|
-
accessBoostAmount: config.learningBridge.accessBoostAmount,
|
|
275
|
-
consolidationThreshold: config.learningBridge.consolidationThreshold,
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
// Wire graph if enabled and available
|
|
280
|
-
if (config.memoryGraph.enabled && memPkg.MemoryGraph) {
|
|
281
|
-
bridgeConfig.graph = {
|
|
282
|
-
pageRankDamping: config.memoryGraph.pageRankDamping,
|
|
283
|
-
maxNodes: config.memoryGraph.maxNodes,
|
|
284
|
-
similarityThreshold: config.memoryGraph.similarityThreshold,
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
const bridge = new memPkg.AutoMemoryBridge(backend, bridgeConfig);
|
|
289
|
-
|
|
290
|
-
// Wire episodic store so [memory:*] ops flow into traces during import
|
|
291
|
-
if (memPkg.EpisodicStore) {
|
|
292
|
-
try {
|
|
293
|
-
const episodicPath = join(PROJECT_ROOT, '.monomind', 'episodic', 'episodes.jsonl');
|
|
294
|
-
const episodicDir = dirname(episodicPath);
|
|
295
|
-
if (!existsSync(episodicDir)) mkdirSync(episodicDir, { recursive: true });
|
|
296
|
-
const epStore = new memPkg.EpisodicStore({ filePath: episodicPath, maxRunsPerEpisode: 20 });
|
|
297
|
-
bridge.setEpisodicStore(epStore);
|
|
298
|
-
} catch { /* non-fatal */ }
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
try {
|
|
302
|
-
const result = await bridge.importFromAutoMemory();
|
|
303
|
-
success(`Imported ${result.imported} entries (${result.skipped} skipped)`);
|
|
304
|
-
dim(`├─ Backend entries: ${await backend.count()}`);
|
|
305
|
-
dim(`├─ Learning: ${config.learningBridge.enabled ? 'active' : 'disabled'}`);
|
|
306
|
-
dim(`├─ Graph: ${config.memoryGraph.enabled ? 'active' : 'disabled'}`);
|
|
307
|
-
dim(`└─ Agent scopes: ${config.agentScopes.enabled ? 'active' : 'disabled'}`);
|
|
308
|
-
} catch (err) {
|
|
309
|
-
dim(`Import failed (non-critical): ${err.message}`);
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
// Second Brain: re-index new/changed documents on session start
|
|
313
|
-
try {
|
|
314
|
-
const capFile = join(PROJECT_ROOT, '.monomind', 'capabilities.json');
|
|
315
|
-
if (existsSync(capFile)) {
|
|
316
|
-
const caps = JSON.parse(readFileSync(capFile, 'utf-8'));
|
|
317
|
-
const hasDocsCap = Array.isArray(caps) ? caps.includes('documents') : (caps && caps.documents);
|
|
318
|
-
if (hasDocsCap) {
|
|
319
|
-
const { ingestDirectory } = await import(join(PROJECT_ROOT, 'packages/@monomind/cli/dist/src/knowledge/document-pipeline.js'));
|
|
320
|
-
const docResult = await ingestDirectory(PROJECT_ROOT, 'shared', { rootDir: PROJECT_ROOT });
|
|
321
|
-
if (docResult.filesProcessed > 0) {
|
|
322
|
-
dim(`├─ Second Brain: indexed ${docResult.totalChunks} new chunks from ${docResult.filesProcessed} docs`);
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
} catch { /* non-fatal — knowledge indexing is best-effort */ }
|
|
327
|
-
|
|
328
|
-
await backend.shutdown();
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
async function doSync() {
|
|
332
|
-
log('Syncing insights to auto memory files...');
|
|
333
|
-
|
|
334
|
-
const memPkg = await loadMemoryPackage();
|
|
335
|
-
if (!memPkg || !memPkg.AutoMemoryBridge) {
|
|
336
|
-
dim('Memory package not available — skipping sync');
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
const config = readConfig();
|
|
341
|
-
const backend = new JsonFileBackend(STORE_PATH);
|
|
342
|
-
await backend.initialize();
|
|
343
|
-
|
|
344
|
-
const entryCount = await backend.count();
|
|
345
|
-
if (entryCount === 0) {
|
|
346
|
-
dim('No entries to sync');
|
|
347
|
-
await backend.shutdown();
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
const bridgeConfig = {
|
|
352
|
-
workingDir: PROJECT_ROOT,
|
|
353
|
-
syncMode: 'on-session-end',
|
|
354
|
-
};
|
|
355
|
-
|
|
356
|
-
if (config.learningBridge.enabled && memPkg.LearningBridge) {
|
|
357
|
-
bridgeConfig.learning = {
|
|
358
|
-
sonaMode: config.learningBridge.sonaMode,
|
|
359
|
-
confidenceDecayRate: config.learningBridge.confidenceDecayRate,
|
|
360
|
-
consolidationThreshold: config.learningBridge.consolidationThreshold,
|
|
361
|
-
};
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
if (config.memoryGraph.enabled && memPkg.MemoryGraph) {
|
|
365
|
-
bridgeConfig.graph = {
|
|
366
|
-
pageRankDamping: config.memoryGraph.pageRankDamping,
|
|
367
|
-
maxNodes: config.memoryGraph.maxNodes,
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
const bridge = new memPkg.AutoMemoryBridge(backend, bridgeConfig);
|
|
372
|
-
|
|
373
|
-
// Wire episodic store so [memory:*] ops flow into traces during sync
|
|
374
|
-
if (memPkg.EpisodicStore) {
|
|
375
|
-
try {
|
|
376
|
-
const episodicPath = join(PROJECT_ROOT, '.monomind', 'episodic', 'episodes.jsonl');
|
|
377
|
-
if (existsSync(dirname(episodicPath))) {
|
|
378
|
-
const epStore = new memPkg.EpisodicStore({ filePath: episodicPath, maxRunsPerEpisode: 20 });
|
|
379
|
-
bridge.setEpisodicStore(epStore);
|
|
380
|
-
}
|
|
381
|
-
} catch { /* non-fatal */ }
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
try {
|
|
385
|
-
const syncResult = await bridge.syncToAutoMemory();
|
|
386
|
-
success(`Synced ${syncResult.synced} entries to auto memory`);
|
|
387
|
-
dim(`├─ Categories updated: ${syncResult.categories?.join(', ') || 'none'}`);
|
|
388
|
-
dim(`└─ Backend entries: ${entryCount}`);
|
|
389
|
-
|
|
390
|
-
// Curate MEMORY.md index with graph-aware ordering
|
|
391
|
-
await bridge.curateIndex();
|
|
392
|
-
success('Curated MEMORY.md index');
|
|
393
|
-
} catch (err) {
|
|
394
|
-
dim(`Sync failed (non-critical): ${err.message}`);
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
if (bridge.destroy) bridge.destroy();
|
|
398
|
-
await backend.shutdown();
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
async function doStatus() {
|
|
402
|
-
const memPkg = await loadMemoryPackage();
|
|
403
|
-
const config = readConfig();
|
|
404
|
-
|
|
405
|
-
console.log('\n=== Auto Memory Bridge Status ===\n');
|
|
406
|
-
console.log(` Package: ${memPkg ? '✅ Available' : '❌ Not found'}`);
|
|
407
|
-
console.log(` Store: ${existsSync(STORE_PATH) ? '✅ ' + STORE_PATH : '⏸ Not initialized'}`);
|
|
408
|
-
console.log(` LearningBridge: ${config.learningBridge.enabled ? '✅ Enabled' : '⏸ Disabled'}`);
|
|
409
|
-
console.log(` MemoryGraph: ${config.memoryGraph.enabled ? '✅ Enabled' : '⏸ Disabled'}`);
|
|
410
|
-
console.log(` AgentScopes: ${config.agentScopes.enabled ? '✅ Enabled' : '⏸ Disabled'}`);
|
|
411
|
-
|
|
412
|
-
if (existsSync(STORE_PATH)) {
|
|
413
|
-
try {
|
|
414
|
-
const MAX_STORE_BYTES = 50 * 1024 * 1024; // 50 MiB
|
|
415
|
-
if (statSync(STORE_PATH).size <= MAX_STORE_BYTES) {
|
|
416
|
-
const data = JSON.parse(readFileSync(STORE_PATH, 'utf-8'));
|
|
417
|
-
console.log(` Entries: ${Array.isArray(data) ? data.length : 0}`);
|
|
418
|
-
} else {
|
|
419
|
-
console.log(` Entries: (store too large to count)`);
|
|
420
|
-
}
|
|
421
|
-
} catch { /* ignore */ }
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
// AutoMem diagnostics (arXiv:2607.01224)
|
|
425
|
-
console.log('\n=== AutoMem Learning Loop Status ===\n');
|
|
426
|
-
|
|
427
|
-
// Episodic trace stats
|
|
428
|
-
const episodicPath = join(PROJECT_ROOT, '.monomind', 'episodic', 'episodes.jsonl');
|
|
429
|
-
if (existsSync(episodicPath) && memPkg && memPkg.EpisodicStore) {
|
|
430
|
-
try {
|
|
431
|
-
const epStore = new memPkg.EpisodicStore({ filePath: episodicPath, maxRunsPerEpisode: 20 });
|
|
432
|
-
const episodes = epStore.readAll();
|
|
433
|
-
let memOps = 0, skipDups = 0, writes = 0, searches = 0;
|
|
434
|
-
for (const ep of episodes) {
|
|
435
|
-
for (const line of (ep.summary || '').split('\n')) {
|
|
436
|
-
if (line.startsWith('[memory:')) {
|
|
437
|
-
memOps++;
|
|
438
|
-
if (line.includes('skip-duplicate')) skipDups++;
|
|
439
|
-
else if (line.includes('write]')) writes++;
|
|
440
|
-
else if (line.includes('search]')) searches++;
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
console.log(` Episodes: ${episodes.length}`);
|
|
445
|
-
console.log(` Memory ops: ${memOps} (${writes} writes, ${searches} searches, ${skipDups} skipped dups)`);
|
|
446
|
-
if (writes + searches > 0) {
|
|
447
|
-
const ratio = searches > 0 ? (writes / searches).toFixed(2) : 'N/A';
|
|
448
|
-
const dupRate = memOps > 0 ? Math.round(skipDups / memOps * 100) : 0;
|
|
449
|
-
console.log(` Write/search: ${ratio} | Dup rate: ${dupRate}%`);
|
|
450
|
-
}
|
|
451
|
-
} catch { console.log(' Episodes: (error reading)'); }
|
|
452
|
-
} else {
|
|
453
|
-
console.log(' Episodes: ⏸ No episodic traces yet');
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
// Scaffold optimizer history
|
|
457
|
-
const scaffoldPath = join(PROJECT_ROOT, '.monomind', 'data', 'scaffold-revisions.jsonl');
|
|
458
|
-
if (existsSync(scaffoldPath)) {
|
|
459
|
-
try {
|
|
460
|
-
const lines = readFileSync(scaffoldPath, 'utf-8').trim().split('\n').filter(Boolean);
|
|
461
|
-
console.log(` Scaffold revs: ${lines.length} revision(s) applied`);
|
|
462
|
-
} catch { /* ignore */ }
|
|
463
|
-
} else {
|
|
464
|
-
console.log(' Scaffold revs: ⏸ No revisions yet');
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
// Curated decisions
|
|
468
|
-
const backend2 = new JsonFileBackend(STORE_PATH);
|
|
469
|
-
await backend2.initialize();
|
|
470
|
-
try {
|
|
471
|
-
const curated = await backend2.query({ namespace: 'memory-training', limit: 10000 });
|
|
472
|
-
console.log(` Curated: ${curated.length} training decision(s)`);
|
|
473
|
-
} catch { console.log(' Curated: ⏸ No curated decisions'); }
|
|
474
|
-
await backend2.shutdown();
|
|
475
|
-
|
|
476
|
-
console.log('');
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
// ============================================================================
|
|
480
|
-
// Main
|
|
481
|
-
// ============================================================================
|
|
482
|
-
|
|
483
|
-
const command = process.argv[2] || 'status';
|
|
484
|
-
|
|
485
|
-
// Suppress unhandled rejection warnings from dynamic import() failures
|
|
486
|
-
// which can cause non-zero exit codes even when caught
|
|
487
|
-
process.once('unhandledRejection', () => {});
|
|
488
|
-
|
|
489
|
-
try {
|
|
490
|
-
switch (command) {
|
|
491
|
-
case 'import': await doImport(); break;
|
|
492
|
-
case 'sync': await doSync(); break;
|
|
493
|
-
case 'status': await doStatus(); break;
|
|
494
|
-
default:
|
|
495
|
-
console.log('Usage: auto-memory-hook.mjs <import|sync|status>');
|
|
496
|
-
process.exit(1);
|
|
497
|
-
}
|
|
498
|
-
} catch (err) {
|
|
499
|
-
// Hooks must never crash Claude Code - fail silently
|
|
500
|
-
dim(`Error (non-critical): ${err.message}`);
|
|
501
|
-
}
|
|
502
|
-
// Ensure clean exit for Claude Code hooks (exit 0 = success, no stderr = no error)
|
|
503
|
-
process.exit(0);
|