cogmem 3.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BENCHMARKS.md +62 -0
- package/CHANGELOG.md +215 -0
- package/CONCURRENT_ACCESS.md +27 -0
- package/CONTRIBUTING.md +32 -0
- package/LICENSE +21 -0
- package/MEMORY_ATLAS.md +101 -0
- package/MEMORY_MODEL.md +179 -0
- package/README.md +751 -0
- package/RECALL_EXPLAINABILITY.md +152 -0
- package/RELEASE_CHECKLIST.md +92 -0
- package/SECURITY.md +21 -0
- package/dist/adapters/MarkdownSourceLoader.d.ts +5 -0
- package/dist/adapters/MarkdownSourceLoader.js +19 -0
- package/dist/adapters/conversation/ConversationMarkdownAdapter.d.ts +9 -0
- package/dist/adapters/conversation/ConversationMarkdownAdapter.js +233 -0
- package/dist/adapters/hermes/HermesStateDbAdapter.d.ts +10 -0
- package/dist/adapters/hermes/HermesStateDbAdapter.js +268 -0
- package/dist/adapters/hermes/HermesWorkspaceProfile.d.ts +15 -0
- package/dist/adapters/hermes/HermesWorkspaceProfile.js +82 -0
- package/dist/adapters/index.d.ts +15 -0
- package/dist/adapters/index.js +12 -0
- package/dist/adapters/openclaw/OpenClawAdapterSupport.d.ts +14 -0
- package/dist/adapters/openclaw/OpenClawAdapterSupport.js +29 -0
- package/dist/adapters/openclaw/OpenClawDailyMemoryAdapter.d.ts +8 -0
- package/dist/adapters/openclaw/OpenClawDailyMemoryAdapter.js +35 -0
- package/dist/adapters/openclaw/OpenClawMemoryIndexAdapter.d.ts +8 -0
- package/dist/adapters/openclaw/OpenClawMemoryIndexAdapter.js +23 -0
- package/dist/adapters/openclaw/OpenClawPersonaAdapter.d.ts +8 -0
- package/dist/adapters/openclaw/OpenClawPersonaAdapter.js +24 -0
- package/dist/adapters/openclaw/OpenClawSessionAdapter.d.ts +8 -0
- package/dist/adapters/openclaw/OpenClawSessionAdapter.js +15 -0
- package/dist/adapters/openclaw/OpenClawUserProfileAdapter.d.ts +8 -0
- package/dist/adapters/openclaw/OpenClawUserProfileAdapter.js +24 -0
- package/dist/adapters/openclaw/OpenClawWorkspaceProfile.d.ts +38 -0
- package/dist/adapters/openclaw/OpenClawWorkspaceProfile.js +199 -0
- package/dist/adapters/soul/SoulMarkdownAdapter.d.ts +14 -0
- package/dist/adapters/soul/SoulMarkdownAdapter.js +255 -0
- package/dist/adapters/types.d.ts +97 -0
- package/dist/adapters/types.js +185 -0
- package/dist/agent/AgentMemoryBackend.d.ts +291 -0
- package/dist/agent/AgentMemoryBackend.js +1272 -0
- package/dist/agent/AgentRecallQueryCompiler.d.ts +20 -0
- package/dist/agent/AgentRecallQueryCompiler.js +289 -0
- package/dist/agent/ContextHygiene.d.ts +9 -0
- package/dist/agent/ContextHygiene.js +20 -0
- package/dist/agent/MemoryUsageReceipt.d.ts +35 -0
- package/dist/agent/MemoryUsageReceipt.js +136 -0
- package/dist/agent/SessionWorkingState.d.ts +20 -0
- package/dist/agent/SessionWorkingState.js +94 -0
- package/dist/agent/index.d.ts +6 -0
- package/dist/agent/index.js +5 -0
- package/dist/algorithm/AlgorithmReviewBackend.d.ts +84 -0
- package/dist/algorithm/AlgorithmReviewBackend.js +261 -0
- package/dist/algorithm/AlgorithmReviewMetrics.d.ts +23 -0
- package/dist/algorithm/AlgorithmReviewMetrics.js +25 -0
- package/dist/algorithm/Phase2ModelAlgorithmReviewBackend.d.ts +38 -0
- package/dist/algorithm/Phase2ModelAlgorithmReviewBackend.js +372 -0
- package/dist/assets/FileAssetIngestionService.d.ts +32 -0
- package/dist/assets/FileAssetIngestionService.js +133 -0
- package/dist/assets/FileAssetStore.d.ts +36 -0
- package/dist/assets/FileAssetStore.js +152 -0
- package/dist/assets/FileBlockStore.d.ts +12 -0
- package/dist/assets/FileBlockStore.js +110 -0
- package/dist/assets/FileChunkStore.d.ts +23 -0
- package/dist/assets/FileChunkStore.js +179 -0
- package/dist/assets/FileChunker.d.ts +10 -0
- package/dist/assets/FileChunker.js +69 -0
- package/dist/assets/FileLoaderRegistry.d.ts +8 -0
- package/dist/assets/FileLoaderRegistry.js +21 -0
- package/dist/assets/FileLoaders.d.ts +37 -0
- package/dist/assets/FileLoaders.js +268 -0
- package/dist/assets/index.d.ts +10 -0
- package/dist/assets/index.js +7 -0
- package/dist/assets/providers/types.d.ts +47 -0
- package/dist/assets/providers/types.js +1 -0
- package/dist/assets/types.d.ts +159 -0
- package/dist/assets/types.js +1 -0
- package/dist/atlas/ActionFrameExtractor.d.ts +15 -0
- package/dist/atlas/ActionFrameExtractor.js +135 -0
- package/dist/atlas/MemoryAtlasIndexer.d.ts +32 -0
- package/dist/atlas/MemoryAtlasIndexer.js +74 -0
- package/dist/atlas/MemoryAtlasQueryCompiler.d.ts +23 -0
- package/dist/atlas/MemoryAtlasQueryCompiler.js +55 -0
- package/dist/atlas/MemoryAtlasService.d.ts +25 -0
- package/dist/atlas/MemoryAtlasService.js +216 -0
- package/dist/atlas/MemoryAtlasTypes.d.ts +107 -0
- package/dist/atlas/MemoryAtlasTypes.js +1 -0
- package/dist/atlas/index.d.ts +6 -0
- package/dist/atlas/index.js +5 -0
- package/dist/backend/SemanticBackend.d.ts +40 -0
- package/dist/backend/SemanticBackend.js +107 -0
- package/dist/batch/IngestionCursorStore.d.ts +52 -0
- package/dist/batch/IngestionCursorStore.js +153 -0
- package/dist/batch/InstalledBatchProcessor.d.ts +88 -0
- package/dist/batch/InstalledBatchProcessor.js +179 -0
- package/dist/batch/SourceOnboarding.d.ts +56 -0
- package/dist/batch/SourceOnboarding.js +366 -0
- package/dist/belief/BeliefGovernanceService.d.ts +59 -0
- package/dist/belief/BeliefGovernanceService.js +183 -0
- package/dist/belief/BeliefStore.d.ts +78 -0
- package/dist/belief/BeliefStore.js +898 -0
- package/dist/benchmark/BenchmarkRegistry.d.ts +16 -0
- package/dist/benchmark/BenchmarkRegistry.js +97 -0
- package/dist/benchmark/BenchmarkReport.d.ts +23 -0
- package/dist/benchmark/BenchmarkReport.js +62 -0
- package/dist/benchmark/BenchmarkRunner.d.ts +27 -0
- package/dist/benchmark/BenchmarkRunner.js +64 -0
- package/dist/benchmark/BrainEval.d.ts +134 -0
- package/dist/benchmark/BrainEval.js +252 -0
- package/dist/benchmark/ExternalBenchmarkRunner.d.ts +8 -0
- package/dist/benchmark/ExternalBenchmarkRunner.js +12 -0
- package/dist/benchmark/LongMemEvalAdapter.d.ts +46 -0
- package/dist/benchmark/LongMemEvalAdapter.js +88 -0
- package/dist/benchmark/LongMemEvalCli.d.ts +6 -0
- package/dist/benchmark/LongMemEvalCli.js +26 -0
- package/dist/bin/CliJson.d.ts +17 -0
- package/dist/bin/CliJson.js +20 -0
- package/dist/bin/brain-eval.d.ts +3 -0
- package/dist/bin/brain-eval.js +46 -0
- package/dist/bin/cogmem.d.ts +3 -0
- package/dist/bin/cogmem.js +95 -0
- package/dist/bin/compact.d.ts +3 -0
- package/dist/bin/compact.js +96 -0
- package/dist/bin/connect.d.ts +3 -0
- package/dist/bin/connect.js +398 -0
- package/dist/bin/doctor.d.ts +3 -0
- package/dist/bin/doctor.js +171 -0
- package/dist/bin/dream.d.ts +3 -0
- package/dist/bin/dream.js +65 -0
- package/dist/bin/episode.d.ts +3 -0
- package/dist/bin/episode.js +268 -0
- package/dist/bin/explain-recall.d.ts +3 -0
- package/dist/bin/explain-recall.js +139 -0
- package/dist/bin/import-hermes.d.ts +3 -0
- package/dist/bin/import-hermes.js +6 -0
- package/dist/bin/import-openclaw.d.ts +3 -0
- package/dist/bin/import-openclaw.js +6 -0
- package/dist/bin/import-support.d.ts +43 -0
- package/dist/bin/import-support.js +528 -0
- package/dist/bin/init.d.ts +30 -0
- package/dist/bin/init.js +761 -0
- package/dist/bin/mcp.d.ts +3 -0
- package/dist/bin/mcp.js +52 -0
- package/dist/bin/memory.d.ts +3 -0
- package/dist/bin/memory.js +803 -0
- package/dist/bin/migrate-vectors.d.ts +3 -0
- package/dist/bin/migrate-vectors.js +74 -0
- package/dist/bin/migrate.d.ts +3 -0
- package/dist/bin/migrate.js +95 -0
- package/dist/bin/normalize-transcript.d.ts +16 -0
- package/dist/bin/normalize-transcript.js +153 -0
- package/dist/bin/openclaw.d.ts +3 -0
- package/dist/bin/openclaw.js +78 -0
- package/dist/bin/prospective.d.ts +3 -0
- package/dist/bin/prospective.js +115 -0
- package/dist/bin/re-embed.d.ts +3 -0
- package/dist/bin/re-embed.js +46 -0
- package/dist/bin/repair.d.ts +3 -0
- package/dist/bin/repair.js +118 -0
- package/dist/bin/snapshot.d.ts +3 -0
- package/dist/bin/snapshot.js +100 -0
- package/dist/bin/strategy.d.ts +3 -0
- package/dist/bin/strategy.js +66 -0
- package/dist/bin/update-release.d.ts +15 -0
- package/dist/bin/update-release.js +62 -0
- package/dist/bin/update.d.ts +3 -0
- package/dist/bin/update.js +215 -0
- package/dist/binding/BindingClassifier.d.ts +19 -0
- package/dist/binding/BindingClassifier.js +270 -0
- package/dist/binding/BindingDecisionEngine.d.ts +11 -0
- package/dist/binding/BindingDecisionEngine.js +13 -0
- package/dist/binding/ClaimKeyGenerator.d.ts +4 -0
- package/dist/binding/ClaimKeyGenerator.js +21 -0
- package/dist/binding/MemoryBindingService.d.ts +28 -0
- package/dist/binding/MemoryBindingService.js +283 -0
- package/dist/binding/MemoryBindingTypes.d.ts +140 -0
- package/dist/binding/MemoryBindingTypes.js +1 -0
- package/dist/binding/TopicPathRegistry.d.ts +5 -0
- package/dist/binding/TopicPathRegistry.js +33 -0
- package/dist/binding/index.d.ts +12 -0
- package/dist/binding/index.js +6 -0
- package/dist/boards/ApprovalBoard.d.ts +14 -0
- package/dist/boards/ApprovalBoard.js +32 -0
- package/dist/boards/Board.d.ts +23 -0
- package/dist/boards/Board.js +1 -0
- package/dist/boards/BoardEventBuffer.d.ts +10 -0
- package/dist/boards/BoardEventBuffer.js +22 -0
- package/dist/boards/BoardEventBus.d.ts +15 -0
- package/dist/boards/BoardEventBus.js +38 -0
- package/dist/boards/BoardEventFilter.d.ts +5 -0
- package/dist/boards/BoardEventFilter.js +1 -0
- package/dist/boards/BoardRegistry.d.ts +11 -0
- package/dist/boards/BoardRegistry.js +15 -0
- package/dist/boards/ContextBoard.d.ts +15 -0
- package/dist/boards/ContextBoard.js +33 -0
- package/dist/boards/MemoryBoard.d.ts +13 -0
- package/dist/boards/MemoryBoard.js +30 -0
- package/dist/boards/ProcessBoard.d.ts +16 -0
- package/dist/boards/ProcessBoard.js +56 -0
- package/dist/boards/ProposalBoard.d.ts +13 -0
- package/dist/boards/ProposalBoard.js +37 -0
- package/dist/boards/ReasoningTraceBoard.d.ts +11 -0
- package/dist/boards/ReasoningTraceBoard.js +34 -0
- package/dist/boards/TaskBoard.d.ts +14 -0
- package/dist/boards/TaskBoard.js +37 -0
- package/dist/boards/index.d.ts +13 -0
- package/dist/boards/index.js +12 -0
- package/dist/config/CogmemConfig.d.ts +43 -0
- package/dist/config/CogmemConfig.js +247 -0
- package/dist/config/VectorDimension.d.ts +13 -0
- package/dist/config/VectorDimension.js +53 -0
- package/dist/context/ContextCortex.d.ts +71 -0
- package/dist/context/ContextCortex.js +156 -0
- package/dist/context/index.d.ts +2 -0
- package/dist/context/index.js +1 -0
- package/dist/core/ImportanceLevels.d.ts +4 -0
- package/dist/core/ImportanceLevels.js +6 -0
- package/dist/core/IntentParser.d.ts +12 -0
- package/dist/core/IntentParser.js +211 -0
- package/dist/core/MemoryGraph.d.ts +100 -0
- package/dist/core/MemoryGraph.js +860 -0
- package/dist/core/Metabolism.d.ts +43 -0
- package/dist/core/Metabolism.js +196 -0
- package/dist/core/Neuron.d.ts +20 -0
- package/dist/core/Neuron.js +51 -0
- package/dist/core/QueryClassifier.d.ts +36 -0
- package/dist/core/QueryClassifier.js +161 -0
- package/dist/core/Reflection.d.ts +42 -0
- package/dist/core/Reflection.js +183 -0
- package/dist/core/ResonanceCore.d.ts +26 -0
- package/dist/core/ResonanceCore.js +115 -0
- package/dist/core/Synapse.d.ts +10 -0
- package/dist/core/Synapse.js +27 -0
- package/dist/core/TwoStagePulseRanker.d.ts +16 -0
- package/dist/core/TwoStagePulseRanker.js +120 -0
- package/dist/dream/DreamScheduler.d.ts +47 -0
- package/dist/dream/DreamScheduler.js +156 -0
- package/dist/dream/index.d.ts +2 -0
- package/dist/dream/index.js +1 -0
- package/dist/embedding/EmbeddingProvider.d.ts +16 -0
- package/dist/embedding/EmbeddingProvider.js +12 -0
- package/dist/embedding/NeuronEmbeddingStore.d.ts +38 -0
- package/dist/embedding/NeuronEmbeddingStore.js +193 -0
- package/dist/embedding/OllamaEmbeddingProvider.d.ts +21 -0
- package/dist/embedding/OllamaEmbeddingProvider.js +65 -0
- package/dist/embedding/QwenAPIEmbeddingProvider.d.ts +26 -0
- package/dist/embedding/QwenAPIEmbeddingProvider.js +53 -0
- package/dist/embedding/ReEmbeddingPipeline.d.ts +30 -0
- package/dist/embedding/ReEmbeddingPipeline.js +119 -0
- package/dist/embedding/ReEmbeddingStatus.d.ts +10 -0
- package/dist/embedding/ReEmbeddingStatus.js +1 -0
- package/dist/embedding/index.d.ts +11 -0
- package/dist/embedding/index.js +5 -0
- package/dist/encryption/AesGcmEncryptionProvider.d.ts +9 -0
- package/dist/encryption/AesGcmEncryptionProvider.js +42 -0
- package/dist/encryption/EncryptionProvider.d.ts +6 -0
- package/dist/encryption/EncryptionProvider.js +3 -0
- package/dist/encryption/index.d.ts +4 -0
- package/dist/encryption/index.js +2 -0
- package/dist/engine/BeliefExtractor.d.ts +48 -0
- package/dist/engine/BeliefExtractor.js +1189 -0
- package/dist/engine/CognitiveGraphCompiler.d.ts +24 -0
- package/dist/engine/CognitiveGraphCompiler.js +243 -0
- package/dist/engine/ConsolidationPipeline.d.ts +66 -0
- package/dist/engine/ConsolidationPipeline.js +376 -0
- package/dist/engine/ConsolidationTrigger.d.ts +18 -0
- package/dist/engine/ConsolidationTrigger.js +41 -0
- package/dist/engine/CrossTopicSynthesizer.d.ts +28 -0
- package/dist/engine/CrossTopicSynthesizer.js +70 -0
- package/dist/engine/CrossTopicTrigger.d.ts +17 -0
- package/dist/engine/CrossTopicTrigger.js +29 -0
- package/dist/engine/DeepWriteConfig.d.ts +14 -0
- package/dist/engine/DeepWriteConfig.js +37 -0
- package/dist/engine/DeepWriteMemoryCompiler.d.ts +43 -0
- package/dist/engine/DeepWriteMemoryCompiler.js +42 -0
- package/dist/engine/DeepWriteMemoryOrchestrator.d.ts +60 -0
- package/dist/engine/DeepWriteMemoryOrchestrator.js +175 -0
- package/dist/engine/DeepWritePromotionPolicy.d.ts +48 -0
- package/dist/engine/DeepWritePromotionPolicy.js +514 -0
- package/dist/engine/DeepWriteRedactor.d.ts +14 -0
- package/dist/engine/DeepWriteRedactor.js +53 -0
- package/dist/engine/DreamCuratorSchedule.d.ts +18 -0
- package/dist/engine/DreamCuratorSchedule.js +95 -0
- package/dist/engine/DreamCuratorWorker.d.ts +67 -0
- package/dist/engine/DreamCuratorWorker.js +908 -0
- package/dist/engine/EntityResolutionEngine.d.ts +45 -0
- package/dist/engine/EntityResolutionEngine.js +105 -0
- package/dist/engine/EpisodicSemanticDistiller.d.ts +25 -0
- package/dist/engine/EpisodicSemanticDistiller.js +68 -0
- package/dist/engine/EvolutionVerifier.d.ts +39 -0
- package/dist/engine/EvolutionVerifier.js +104 -0
- package/dist/engine/FactCompiler.d.ts +41 -0
- package/dist/engine/FactCompiler.js +820 -0
- package/dist/engine/GraphCommunityEngine.d.ts +20 -0
- package/dist/engine/GraphCommunityEngine.js +91 -0
- package/dist/engine/ImportanceSignalDetector.d.ts +11 -0
- package/dist/engine/ImportanceSignalDetector.js +51 -0
- package/dist/engine/IngestionEngine.d.ts +44 -0
- package/dist/engine/IngestionEngine.js +182 -0
- package/dist/engine/InteractionBinder.d.ts +16 -0
- package/dist/engine/InteractionBinder.js +87 -0
- package/dist/engine/LocalSemanticCompiler.d.ts +40 -0
- package/dist/engine/LocalSemanticCompiler.js +111 -0
- package/dist/engine/MemoryConsolidationEngine.d.ts +11 -0
- package/dist/engine/MemoryConsolidationEngine.js +21 -0
- package/dist/engine/MemoryGate.d.ts +10 -0
- package/dist/engine/MemoryGate.js +34 -0
- package/dist/engine/OfflineConsolidationPipeline.d.ts +148 -0
- package/dist/engine/OfflineConsolidationPipeline.js +670 -0
- package/dist/engine/OrphanCleaner.d.ts +15 -0
- package/dist/engine/OrphanCleaner.js +27 -0
- package/dist/engine/PipelineMetrics.d.ts +32 -0
- package/dist/engine/PipelineMetrics.js +126 -0
- package/dist/engine/PrincipleDecayPolicy.d.ts +17 -0
- package/dist/engine/PrincipleDecayPolicy.js +64 -0
- package/dist/engine/TopologyCompiler.d.ts +25 -0
- package/dist/engine/TopologyCompiler.js +276 -0
- package/dist/engine/WorkingMemoryDelta.d.ts +23 -0
- package/dist/engine/WorkingMemoryDelta.js +63 -0
- package/dist/entity/EntityGovernanceService.d.ts +47 -0
- package/dist/entity/EntityGovernanceService.js +215 -0
- package/dist/entity/index.d.ts +3 -0
- package/dist/entity/index.js +1 -0
- package/dist/episode/CogmemBlockStripper.d.ts +11 -0
- package/dist/episode/CogmemBlockStripper.js +58 -0
- package/dist/episode/CorrectionResolver.d.ts +30 -0
- package/dist/episode/CorrectionResolver.js +17 -0
- package/dist/episode/EpisodeAssembler.d.ts +54 -0
- package/dist/episode/EpisodeAssembler.js +203 -0
- package/dist/episode/EpisodeImportIdentity.d.ts +7 -0
- package/dist/episode/EpisodeImportIdentity.js +17 -0
- package/dist/episode/EpisodeSemanticSummarizer.d.ts +4 -0
- package/dist/episode/EpisodeSemanticSummarizer.js +31 -0
- package/dist/episode/EpisodeStore.d.ts +189 -0
- package/dist/episode/EpisodeStore.js +680 -0
- package/dist/episode/EpisodeTypes.d.ts +96 -0
- package/dist/episode/EpisodeTypes.js +1 -0
- package/dist/episode/TurnRelationClassifier.d.ts +40 -0
- package/dist/episode/TurnRelationClassifier.js +205 -0
- package/dist/episode/index.d.ts +9 -0
- package/dist/episode/index.js +8 -0
- package/dist/eval/datasets/contradiction_injection.d.ts +3 -0
- package/dist/eval/datasets/contradiction_injection.js +56 -0
- package/dist/eval/datasets/noisy_tool_output_corpus.d.ts +16 -0
- package/dist/eval/datasets/noisy_tool_output_corpus.js +59 -0
- package/dist/eval/datasets/synthetic_long_conversation.d.ts +40 -0
- package/dist/eval/datasets/synthetic_long_conversation.js +136 -0
- package/dist/eval/runners/EvalRunner.d.ts +12 -0
- package/dist/eval/runners/EvalRunner.js +66 -0
- package/dist/eval/runners/ReportFormatter.d.ts +13 -0
- package/dist/eval/runners/ReportFormatter.js +59 -0
- package/dist/eval/strategy/ContextOutcomeStore.d.ts +12 -0
- package/dist/eval/strategy/ContextOutcomeStore.js +44 -0
- package/dist/eval/strategy/ContextPolicyScorer.d.ts +25 -0
- package/dist/eval/strategy/ContextPolicyScorer.js +58 -0
- package/dist/eval/strategy/MemoryUseJudge.d.ts +49 -0
- package/dist/eval/strategy/MemoryUseJudge.js +75 -0
- package/dist/eval/strategy/StrategyDiversitySelector.d.ts +8 -0
- package/dist/eval/strategy/StrategyDiversitySelector.js +44 -0
- package/dist/eval/strategy/StrategyRolloutEvaluator.d.ts +15 -0
- package/dist/eval/strategy/StrategyRolloutEvaluator.js +30 -0
- package/dist/eval/strategy/index.d.ts +6 -0
- package/dist/eval/strategy/index.js +5 -0
- package/dist/factory.d.ts +726 -0
- package/dist/factory.js +2118 -0
- package/dist/governance/CandidateReviewService.d.ts +33 -0
- package/dist/governance/CandidateReviewService.js +126 -0
- package/dist/governance/ContradictionResolver.d.ts +22 -0
- package/dist/governance/ContradictionResolver.js +54 -0
- package/dist/governance/CredibilityScorer.d.ts +10 -0
- package/dist/governance/CredibilityScorer.js +29 -0
- package/dist/governance/DecayPolicy.d.ts +18 -0
- package/dist/governance/DecayPolicy.js +28 -0
- package/dist/governance/MemoryExplain.d.ts +46 -0
- package/dist/governance/MemoryExplain.js +62 -0
- package/dist/governance/MemoryGovernanceExecutor.d.ts +18 -0
- package/dist/governance/MemoryGovernanceExecutor.js +37 -0
- package/dist/governance/MemoryGovernancePlan.d.ts +36 -0
- package/dist/governance/MemoryGovernancePlan.js +1 -0
- package/dist/governance/MemoryGovernanceValidator.d.ts +13 -0
- package/dist/governance/MemoryGovernanceValidator.js +53 -0
- package/dist/governance/ObservationHygieneRules.d.ts +17 -0
- package/dist/governance/ObservationHygieneRules.js +28 -0
- package/dist/governance/PiiRedactor.d.ts +20 -0
- package/dist/governance/PiiRedactor.js +37 -0
- package/dist/governance/SupersedeChain.d.ts +21 -0
- package/dist/governance/SupersedeChain.js +107 -0
- package/dist/governance/index.d.ts +14 -0
- package/dist/governance/index.js +6 -0
- package/dist/graph/BrainGraphView.d.ts +20 -0
- package/dist/graph/BrainGraphView.js +45 -0
- package/dist/host/openclaw/AutoMemoryPluginInstaller.d.ts +45 -0
- package/dist/host/openclaw/AutoMemoryPluginInstaller.js +1904 -0
- package/dist/internal.d.ts +148 -0
- package/dist/internal.js +144 -0
- package/dist/lexicon/coreMemoryLexicon.d.ts +96 -0
- package/dist/lexicon/coreMemoryLexicon.js +525 -0
- package/dist/lexicon/language-packs/en.d.ts +42 -0
- package/dist/lexicon/language-packs/en.js +41 -0
- package/dist/lexicon/language-packs/zh.d.ts +42 -0
- package/dist/lexicon/language-packs/zh.js +41 -0
- package/dist/lexicon/zh/entities.d.ts +2 -0
- package/dist/lexicon/zh/entities.js +17 -0
- package/dist/lexicon/zh/index.d.ts +5 -0
- package/dist/lexicon/zh/index.js +3 -0
- package/dist/lexicon/zh/stopwords.d.ts +2 -0
- package/dist/lexicon/zh/stopwords.js +22 -0
- package/dist/lexicon/zh/topics.d.ts +6 -0
- package/dist/lexicon/zh/topics.js +52 -0
- package/dist/mcp/CoreMcpTools.d.ts +33 -0
- package/dist/mcp/CoreMcpTools.js +832 -0
- package/dist/mcp/server.d.ts +5 -0
- package/dist/mcp/server.js +29 -0
- package/dist/meta/MetaObservationCollector.d.ts +37 -0
- package/dist/meta/MetaObservationCollector.js +348 -0
- package/dist/meta/PolicyProposalGenerator.d.ts +11 -0
- package/dist/meta/PolicyProposalGenerator.js +159 -0
- package/dist/meta/ProposalApplier.d.ts +18 -0
- package/dist/meta/ProposalApplier.js +91 -0
- package/dist/meta/ProposalConfigOverlay.d.ts +13 -0
- package/dist/meta/ProposalConfigOverlay.js +27 -0
- package/dist/meta/ProposalEvalRunner.d.ts +31 -0
- package/dist/meta/ProposalEvalRunner.js +62 -0
- package/dist/meta/ProposalLedger.d.ts +34 -0
- package/dist/meta/ProposalLedger.js +242 -0
- package/dist/meta/types.d.ts +63 -0
- package/dist/meta/types.js +1 -0
- package/dist/migrations/0001_init.d.ts +4 -0
- package/dist/migrations/0001_init.js +67 -0
- package/dist/migrations/0002_v06_platform.d.ts +10 -0
- package/dist/migrations/0002_v06_platform.js +103 -0
- package/dist/migrations/0003_v07_dialogues.d.ts +9 -0
- package/dist/migrations/0003_v07_dialogues.js +53 -0
- package/dist/migrations/0004_v09_self_improvement.d.ts +9 -0
- package/dist/migrations/0004_v09_self_improvement.js +100 -0
- package/dist/migrations/0005_dialogue_buffer.d.ts +8 -0
- package/dist/migrations/0005_dialogue_buffer.js +44 -0
- package/dist/migrations/0006_deep_write_memory.d.ts +3 -0
- package/dist/migrations/0006_deep_write_memory.js +54 -0
- package/dist/migrations/0007_deep_write_summaries.d.ts +3 -0
- package/dist/migrations/0007_deep_write_summaries.js +24 -0
- package/dist/migrations/0009_memory_importance.d.ts +3 -0
- package/dist/migrations/0009_memory_importance.js +18 -0
- package/dist/migrations/0010_skill_neurons.d.ts +3 -0
- package/dist/migrations/0010_skill_neurons.js +19 -0
- package/dist/migrations/0011_topic_path.d.ts +3 -0
- package/dist/migrations/0011_topic_path.js +19 -0
- package/dist/migrations/0012_governance_security.d.ts +3 -0
- package/dist/migrations/0012_governance_security.js +23 -0
- package/dist/migrations/0015_memory_governance.d.ts +3 -0
- package/dist/migrations/0015_memory_governance.js +74 -0
- package/dist/migrations/0016_entity_governance.d.ts +3 -0
- package/dist/migrations/0016_entity_governance.js +40 -0
- package/dist/migrations/0017_belief_graph.d.ts +3 -0
- package/dist/migrations/0017_belief_graph.js +41 -0
- package/dist/migrations/0018_temporal_memory.d.ts +3 -0
- package/dist/migrations/0018_temporal_memory.js +25 -0
- package/dist/migrations/0019_context_cortex.d.ts +3 -0
- package/dist/migrations/0019_context_cortex.js +19 -0
- package/dist/migrations/0020_prospective_memory.d.ts +3 -0
- package/dist/migrations/0020_prospective_memory.js +42 -0
- package/dist/migrations/0021_strategy_cortex.d.ts +3 -0
- package/dist/migrations/0021_strategy_cortex.js +23 -0
- package/dist/migrations/0022_episode_dream_engine.d.ts +3 -0
- package/dist/migrations/0022_episode_dream_engine.js +74 -0
- package/dist/migrations/0023_episode_dream_hardening.d.ts +3 -0
- package/dist/migrations/0023_episode_dream_hardening.js +65 -0
- package/dist/migrations/0024_episode_ontology_reliability.d.ts +3 -0
- package/dist/migrations/0024_episode_ontology_reliability.js +70 -0
- package/dist/migrations/0025_memory_atlas.d.ts +6 -0
- package/dist/migrations/0025_memory_atlas.js +268 -0
- package/dist/migrations/0026_runtime_governance_atlas_reliability.d.ts +3 -0
- package/dist/migrations/0026_runtime_governance_atlas_reliability.js +72 -0
- package/dist/migrations/0027_openclaw_upgrade_hotfix.d.ts +3 -0
- package/dist/migrations/0027_openclaw_upgrade_hotfix.js +21 -0
- package/dist/migrations/SchemaMigrationRunner.d.ts +21 -0
- package/dist/migrations/SchemaMigrationRunner.js +67 -0
- package/dist/migrations/index.d.ts +36 -0
- package/dist/migrations/index.js +57 -0
- package/dist/models/ModelCapabilityRouter.d.ts +17 -0
- package/dist/models/ModelCapabilityRouter.js +75 -0
- package/dist/models/ModelRegistry.d.ts +15 -0
- package/dist/models/ModelRegistry.js +132 -0
- package/dist/models/ModelRole.d.ts +19 -0
- package/dist/models/ModelRole.js +1 -0
- package/dist/models/UserInsight.d.ts +16 -0
- package/dist/models/UserInsight.js +9 -0
- package/dist/models/UserInsightExtractor.d.ts +19 -0
- package/dist/models/UserInsightExtractor.js +99 -0
- package/dist/models/UserModelManager.d.ts +21 -0
- package/dist/models/UserModelManager.js +41 -0
- package/dist/models/UserModelStore.d.ts +20 -0
- package/dist/models/UserModelStore.js +136 -0
- package/dist/models/WorkingMemoryReporter.d.ts +16 -0
- package/dist/models/WorkingMemoryReporter.js +38 -0
- package/dist/models/adapters/MemoryReviewAdapter.d.ts +12 -0
- package/dist/models/adapters/MemoryReviewAdapter.js +77 -0
- package/dist/models/index.d.ts +8 -0
- package/dist/models/index.js +5 -0
- package/dist/models/providers/AnthropicClient.d.ts +17 -0
- package/dist/models/providers/AnthropicClient.js +40 -0
- package/dist/models/providers/OpenAICompatibleClient.d.ts +24 -0
- package/dist/models/providers/OpenAICompatibleClient.js +76 -0
- package/dist/observability/DecisionExplainer.d.ts +5 -0
- package/dist/observability/DecisionExplainer.js +62 -0
- package/dist/observability/TraceEvent.d.ts +11 -0
- package/dist/observability/TraceEvent.js +1 -0
- package/dist/observability/TraceQuery.d.ts +15 -0
- package/dist/observability/TraceQuery.js +28 -0
- package/dist/observability/TraceStore.d.ts +15 -0
- package/dist/observability/TraceStore.js +110 -0
- package/dist/observability/TraceWriter.d.ts +8 -0
- package/dist/observability/TraceWriter.js +14 -0
- package/dist/ontology/MemoryOntology.d.ts +4 -0
- package/dist/ontology/MemoryOntology.js +7 -0
- package/dist/prospective/ProspectiveMemoryService.d.ts +79 -0
- package/dist/prospective/ProspectiveMemoryService.js +258 -0
- package/dist/prospective/index.d.ts +2 -0
- package/dist/prospective/index.js +1 -0
- package/dist/public.d.ts +160 -0
- package/dist/public.js +115 -0
- package/dist/recall/BrainRecall.d.ts +96 -0
- package/dist/recall/BrainRecall.js +574 -0
- package/dist/recall/HierarchicalRecallRouter.d.ts +24 -0
- package/dist/recall/HierarchicalRecallRouter.js +62 -0
- package/dist/recall/RecallExplanation.d.ts +59 -0
- package/dist/recall/RecallExplanation.js +244 -0
- package/dist/recall/RecallGovernance.d.ts +10 -0
- package/dist/recall/RecallGovernance.js +83 -0
- package/dist/recall/RecallSufficiencyGate.d.ts +40 -0
- package/dist/recall/RecallSufficiencyGate.js +208 -0
- package/dist/recall/SourceContextMetadata.d.ts +49 -0
- package/dist/recall/SourceContextMetadata.js +134 -0
- package/dist/recall/TopicClassifier.d.ts +33 -0
- package/dist/recall/TopicClassifier.js +138 -0
- package/dist/recall/TopicDecayPolicy.d.ts +15 -0
- package/dist/recall/TopicDecayPolicy.js +46 -0
- package/dist/recall/TopicRegistry.d.ts +12 -0
- package/dist/recall/TopicRegistry.js +26 -0
- package/dist/recall/TopicSummaryBoard.d.ts +27 -0
- package/dist/recall/TopicSummaryBoard.js +139 -0
- package/dist/recall/VectorCandidateFilter.d.ts +50 -0
- package/dist/recall/VectorCandidateFilter.js +78 -0
- package/dist/retrieval/ConditionDslEvaluator.d.ts +33 -0
- package/dist/retrieval/ConditionDslEvaluator.js +160 -0
- package/dist/retrieval/EntityActivationIndex.d.ts +14 -0
- package/dist/retrieval/EntityActivationIndex.js +19 -0
- package/dist/retrieval/EvidenceFusionPolicy.d.ts +30 -0
- package/dist/retrieval/EvidenceFusionPolicy.js +112 -0
- package/dist/retrieval/EvidenceFusionRanker.d.ts +13 -0
- package/dist/retrieval/EvidenceFusionRanker.js +17 -0
- package/dist/retrieval/NarrativeRecallAssembler.d.ts +32 -0
- package/dist/retrieval/NarrativeRecallAssembler.js +27 -0
- package/dist/retrieval/NativeQueryParser.d.ts +23 -0
- package/dist/retrieval/NativeQueryParser.js +135 -0
- package/dist/retrieval/PlanDslExecutor.d.ts +67 -0
- package/dist/retrieval/PlanDslExecutor.js +194 -0
- package/dist/retrieval/PolicyRuntimeEvaluator.d.ts +48 -0
- package/dist/retrieval/PolicyRuntimeEvaluator.js +96 -0
- package/dist/retrieval/PolicySideEffectExecutor.d.ts +50 -0
- package/dist/retrieval/PolicySideEffectExecutor.js +202 -0
- package/dist/retrieval/PulseRetrievalEngine.d.ts +37 -0
- package/dist/retrieval/PulseRetrievalEngine.js +51 -0
- package/dist/retrieval/QueryCompiler.d.ts +18 -0
- package/dist/retrieval/QueryCompiler.js +97 -0
- package/dist/retrieval/QueryTimePendingEntityResolver.d.ts +67 -0
- package/dist/retrieval/QueryTimePendingEntityResolver.js +260 -0
- package/dist/retrieval/RetrievalPlanner.d.ts +42 -0
- package/dist/retrieval/RetrievalPlanner.js +209 -0
- package/dist/retrieval/TemporalBranchSearch.d.ts +38 -0
- package/dist/retrieval/TemporalBranchSearch.js +109 -0
- package/dist/retrieval/UniverseNavigator.d.ts +43 -0
- package/dist/retrieval/UniverseNavigator.js +75 -0
- package/dist/retrieval/UniverseTraversalExecutor.d.ts +21 -0
- package/dist/retrieval/UniverseTraversalExecutor.js +77 -0
- package/dist/routing/AnswerEvidenceTrace.d.ts +18 -0
- package/dist/routing/AnswerEvidenceTrace.js +1 -0
- package/dist/routing/BrainToolDispatcher.d.ts +37 -0
- package/dist/routing/BrainToolDispatcher.js +163 -0
- package/dist/routing/ConfidenceGate.d.ts +26 -0
- package/dist/routing/ConfidenceGate.js +40 -0
- package/dist/routing/ConfirmationPhraseMatcher.d.ts +9 -0
- package/dist/routing/ConfirmationPhraseMatcher.js +43 -0
- package/dist/routing/DirectReplyFormatter.d.ts +5 -0
- package/dist/routing/DirectReplyFormatter.js +55 -0
- package/dist/routing/EvidenceBudgetManager.d.ts +30 -0
- package/dist/routing/EvidenceBudgetManager.js +55 -0
- package/dist/routing/ExecutionLoop.d.ts +79 -0
- package/dist/routing/ExecutionLoop.js +234 -0
- package/dist/routing/IntentClassifier.d.ts +15 -0
- package/dist/routing/IntentClassifier.js +97 -0
- package/dist/routing/IntentPatternMatcher.d.ts +12 -0
- package/dist/routing/IntentPatternMatcher.js +206 -0
- package/dist/routing/IterativeLLMClarifier.d.ts +80 -0
- package/dist/routing/IterativeLLMClarifier.js +408 -0
- package/dist/routing/LLMToolSchema.d.ts +60 -0
- package/dist/routing/LLMToolSchema.js +143 -0
- package/dist/routing/MessageRouter.d.ts +20 -0
- package/dist/routing/MessageRouter.js +58 -0
- package/dist/routing/SessionContextSelector.d.ts +12 -0
- package/dist/routing/SessionContextSelector.js +86 -0
- package/dist/routing/SystemIntentClassifier.d.ts +15 -0
- package/dist/routing/SystemIntentClassifier.js +50 -0
- package/dist/routing/TaskPlan.d.ts +31 -0
- package/dist/routing/TaskPlan.js +1 -0
- package/dist/routing/TaskRouter.d.ts +13 -0
- package/dist/routing/TaskRouter.js +111 -0
- package/dist/routing/ToolCallParser.d.ts +16 -0
- package/dist/routing/ToolCallParser.js +123 -0
- package/dist/routing/ToolEvidenceNormalizer.d.ts +13 -0
- package/dist/routing/ToolEvidenceNormalizer.js +96 -0
- package/dist/routing/ToolEvidencePack.d.ts +36 -0
- package/dist/routing/ToolEvidencePack.js +84 -0
- package/dist/routing/ToolResultSanitizer.d.ts +19 -0
- package/dist/routing/ToolResultSanitizer.js +58 -0
- package/dist/routing/ToolUsePolicy.d.ts +78 -0
- package/dist/routing/ToolUsePolicy.js +163 -0
- package/dist/routing/index.d.ts +32 -0
- package/dist/routing/index.js +19 -0
- package/dist/routing/templates/ability_template.d.ts +2 -0
- package/dist/routing/templates/ability_template.js +34 -0
- package/dist/routing/templates/approvals_template.d.ts +2 -0
- package/dist/routing/templates/approvals_template.js +43 -0
- package/dist/routing/templates/context_template.d.ts +2 -0
- package/dist/routing/templates/context_template.js +25 -0
- package/dist/routing/templates/contradictions_template.d.ts +2 -0
- package/dist/routing/templates/contradictions_template.js +36 -0
- package/dist/routing/templates/importance_template.d.ts +2 -0
- package/dist/routing/templates/importance_template.js +23 -0
- package/dist/routing/templates/memory_template.d.ts +2 -0
- package/dist/routing/templates/memory_template.js +37 -0
- package/dist/routing/templates/self_manifest_template.d.ts +5 -0
- package/dist/routing/templates/self_manifest_template.js +64 -0
- package/dist/routing/templates/tasks_template.d.ts +2 -0
- package/dist/routing/templates/tasks_template.js +41 -0
- package/dist/routing/templates/trace_template.d.ts +2 -0
- package/dist/routing/templates/trace_template.js +37 -0
- package/dist/routing/tools/EntityExpandTool.d.ts +25 -0
- package/dist/routing/tools/EntityExpandTool.js +59 -0
- package/dist/routing/tools/NeuronContextTool.d.ts +32 -0
- package/dist/routing/tools/NeuronContextTool.js +66 -0
- package/dist/routing/tools/SecondaryRecallTool.d.ts +27 -0
- package/dist/routing/tools/SecondaryRecallTool.js +30 -0
- package/dist/routing/tools/SkillDiscoveryTool.d.ts +13 -0
- package/dist/routing/tools/SkillDiscoveryTool.js +11 -0
- package/dist/snapshot/SnapshotExporter.d.ts +13 -0
- package/dist/snapshot/SnapshotExporter.js +70 -0
- package/dist/snapshot/SnapshotHeader.d.ts +15 -0
- package/dist/snapshot/SnapshotHeader.js +1 -0
- package/dist/snapshot/SnapshotImporter.d.ts +20 -0
- package/dist/snapshot/SnapshotImporter.js +40 -0
- package/dist/snapshot/errors.d.ts +18 -0
- package/dist/snapshot/errors.js +34 -0
- package/dist/snapshot/index.d.ts +5 -0
- package/dist/snapshot/index.js +3 -0
- package/dist/storage/StorageCompactor.d.ts +30 -0
- package/dist/storage/StorageCompactor.js +95 -0
- package/dist/store/ActivationStore.d.ts +45 -0
- package/dist/store/ActivationStore.js +135 -0
- package/dist/store/BackgroundJobStore.d.ts +49 -0
- package/dist/store/BackgroundJobStore.js +156 -0
- package/dist/store/CandidateReviewStore.d.ts +33 -0
- package/dist/store/CandidateReviewStore.js +67 -0
- package/dist/store/CognitiveGraphStore.d.ts +42 -0
- package/dist/store/CognitiveGraphStore.js +193 -0
- package/dist/store/CompilerConfidenceStore.d.ts +20 -0
- package/dist/store/CompilerConfidenceStore.js +76 -0
- package/dist/store/DeepWriteCandidateStore.d.ts +94 -0
- package/dist/store/DeepWriteCandidateStore.js +290 -0
- package/dist/store/DeterministicEmbedder.d.ts +10 -0
- package/dist/store/DeterministicEmbedder.js +24 -0
- package/dist/store/DreamLedgerStore.d.ts +22 -0
- package/dist/store/DreamLedgerStore.js +84 -0
- package/dist/store/Embedder.d.ts +14 -0
- package/dist/store/Embedder.js +52 -0
- package/dist/store/EmbedderFactory.d.ts +12 -0
- package/dist/store/EmbedderFactory.js +51 -0
- package/dist/store/EntityStore.d.ts +195 -0
- package/dist/store/EntityStore.js +941 -0
- package/dist/store/EventStore.d.ts +118 -0
- package/dist/store/EventStore.js +699 -0
- package/dist/store/FactStore.d.ts +76 -0
- package/dist/store/FactStore.js +356 -0
- package/dist/store/HnswlibVectorStore.d.ts +2 -0
- package/dist/store/HnswlibVectorStore.js +1 -0
- package/dist/store/IVectorStore.d.ts +32 -0
- package/dist/store/IVectorStore.js +1 -0
- package/dist/store/InteractionUnitStore.d.ts +52 -0
- package/dist/store/InteractionUnitStore.js +167 -0
- package/dist/store/MemoryAtlasStore.d.ts +60 -0
- package/dist/store/MemoryAtlasStore.js +500 -0
- package/dist/store/MemoryBindingStore.d.ts +77 -0
- package/dist/store/MemoryBindingStore.js +608 -0
- package/dist/store/MemoryGovernanceStore.d.ts +23 -0
- package/dist/store/MemoryGovernanceStore.js +103 -0
- package/dist/store/MemoryInspectionStore.d.ts +61 -0
- package/dist/store/MemoryInspectionStore.js +215 -0
- package/dist/store/PlanRuntimeStore.d.ts +83 -0
- package/dist/store/PlanRuntimeStore.js +257 -0
- package/dist/store/PolicyExecutionProjector.d.ts +17 -0
- package/dist/store/PolicyExecutionProjector.js +115 -0
- package/dist/store/PolicyExecutionStore.d.ts +62 -0
- package/dist/store/PolicyExecutionStore.js +290 -0
- package/dist/store/PolicyProjectionStore.d.ts +18 -0
- package/dist/store/PolicyProjectionStore.js +61 -0
- package/dist/store/ProjectionObservabilityStore.d.ts +38 -0
- package/dist/store/ProjectionObservabilityStore.js +310 -0
- package/dist/store/ReasoningChainStore.d.ts +13 -0
- package/dist/store/ReasoningChainStore.js +74 -0
- package/dist/store/RuntimeProjectionStore.d.ts +18 -0
- package/dist/store/RuntimeProjectionStore.js +61 -0
- package/dist/store/RuntimeProjector.d.ts +17 -0
- package/dist/store/RuntimeProjector.js +119 -0
- package/dist/store/SqliteVecStore.d.ts +25 -0
- package/dist/store/SqliteVecStore.js +126 -0
- package/dist/store/SummaryStore.d.ts +56 -0
- package/dist/store/SummaryStore.js +225 -0
- package/dist/store/TemporalAdjacencyStore.d.ts +49 -0
- package/dist/store/TemporalAdjacencyStore.js +300 -0
- package/dist/store/TopologyStore.d.ts +89 -0
- package/dist/store/TopologyStore.js +657 -0
- package/dist/store/VectorProjector.d.ts +22 -0
- package/dist/store/VectorProjector.js +125 -0
- package/dist/store/VectorStore.d.ts +35 -0
- package/dist/store/VectorStore.js +201 -0
- package/dist/strategy/StrategyCapsule.d.ts +44 -0
- package/dist/strategy/StrategyCapsule.js +1 -0
- package/dist/strategy/StrategyConditionedCandidateBuilder.d.ts +9 -0
- package/dist/strategy/StrategyConditionedCandidateBuilder.js +11 -0
- package/dist/strategy/StrategyContextFormatter.d.ts +3 -0
- package/dist/strategy/StrategyContextFormatter.js +25 -0
- package/dist/strategy/StrategyCortex.d.ts +28 -0
- package/dist/strategy/StrategyCortex.js +78 -0
- package/dist/strategy/StrategyTemplateRegistry.d.ts +9 -0
- package/dist/strategy/StrategyTemplateRegistry.js +78 -0
- package/dist/strategy/index.d.ts +6 -0
- package/dist/strategy/index.js +5 -0
- package/dist/temporal/TemporalMemoryService.d.ts +62 -0
- package/dist/temporal/TemporalMemoryService.js +128 -0
- package/dist/temporal/index.d.ts +2 -0
- package/dist/temporal/index.js +1 -0
- package/dist/topic/TopicAliasRegistry.d.ts +21 -0
- package/dist/topic/TopicAliasRegistry.js +67 -0
- package/dist/topic/TopicGovernance.d.ts +21 -0
- package/dist/topic/TopicGovernance.js +173 -0
- package/dist/topic/TopicPathRegistry.d.ts +36 -0
- package/dist/topic/TopicPathRegistry.js +105 -0
- package/dist/topic/TopicRelationGraph.d.ts +23 -0
- package/dist/topic/TopicRelationGraph.js +55 -0
- package/dist/topic/TopicTypes.d.ts +73 -0
- package/dist/topic/TopicTypes.js +1 -0
- package/dist/topic/index.d.ts +6 -0
- package/dist/topic/index.js +5 -0
- package/dist/types/AsyncEnrichment.d.ts +62 -0
- package/dist/types/AsyncEnrichment.js +7 -0
- package/dist/types/BrainRecallResult.d.ts +66 -0
- package/dist/types/BrainRecallResult.js +1 -0
- package/dist/types/ExtensionPoints.d.ts +116 -0
- package/dist/types/ExtensionPoints.js +1 -0
- package/dist/types/Migration.d.ts +22 -0
- package/dist/types/Migration.js +1 -0
- package/dist/types/QueryTimePendingEntityResolution.d.ts +11 -0
- package/dist/types/QueryTimePendingEntityResolution.js +23 -0
- package/dist/types/index.d.ts +855 -0
- package/dist/types/index.js +24 -0
- package/dist/types/query-ir.d.ts +71 -0
- package/dist/types/query-ir.js +4 -0
- package/dist/types/reasoning.d.ts +16 -0
- package/dist/types/reasoning.js +4 -0
- package/dist/utils/AAAKGenerator.d.ts +57 -0
- package/dist/utils/AAAKGenerator.js +212 -0
- package/dist/utils/Config.d.ts +78 -0
- package/dist/utils/Config.js +91 -0
- package/dist/utils/ConversationMarkdownNormalization.d.ts +88 -0
- package/dist/utils/ConversationMarkdownNormalization.js +567 -0
- package/dist/utils/Logger.d.ts +22 -0
- package/dist/utils/Logger.js +77 -0
- package/dist/utils/hash.d.ts +33 -0
- package/dist/utils/hash.js +53 -0
- package/dist/utils/text.d.ts +2 -0
- package/dist/utils/text.js +19 -0
- package/dist/utils/vector.d.ts +26 -0
- package/dist/utils/vector.js +38 -0
- package/examples/hermes-backend/AGENTS.md +218 -0
- package/examples/hermes-backend/README.md +153 -0
- package/examples/hermes-backend/SKILL.md +365 -0
- package/examples/hermes-backend/references/operations.md +202 -0
- package/examples/openclaw-backend/AGENTS.md +195 -0
- package/examples/openclaw-backend/README.md +228 -0
- package/examples/openclaw-backend/SKILL.md +464 -0
- package/examples/openclaw-backend/references/operations.md +269 -0
- package/install.sh +84 -0
- package/package.json +90 -0
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
import { dirname, join, resolve } from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
import { printCliJson } from './CliJson.js';
|
|
7
|
+
import { installOpenClawAutoMemoryPlugin, } from '../host/openclaw/AutoMemoryPluginInstaller.js';
|
|
8
|
+
const HERMES_COGMEM_TOOLS = [
|
|
9
|
+
'cogmem_remember_turn',
|
|
10
|
+
'cogmem_recall',
|
|
11
|
+
'cogmem_explain_recall',
|
|
12
|
+
'cogmem_strategy_plan',
|
|
13
|
+
'cogmem_episode_append',
|
|
14
|
+
'cogmem_episode_import',
|
|
15
|
+
'cogmem_episode_status',
|
|
16
|
+
'cogmem_topic_list',
|
|
17
|
+
'cogmem_topic_operate',
|
|
18
|
+
'cogmem_topic_rollback',
|
|
19
|
+
'cogmem_episode_repair',
|
|
20
|
+
'cogmem_episode_seal',
|
|
21
|
+
'cogmem_dream_tick',
|
|
22
|
+
'cogmem_dream_status',
|
|
23
|
+
'cogmem_memory_map',
|
|
24
|
+
'cogmem_graph_overview',
|
|
25
|
+
'cogmem_graph_search',
|
|
26
|
+
'cogmem_graph_explore',
|
|
27
|
+
'cogmem_graph_node',
|
|
28
|
+
'cogmem_graph_neighbors',
|
|
29
|
+
'cogmem_graph_path',
|
|
30
|
+
'cogmem_graph_timeline',
|
|
31
|
+
'cogmem_graph_touch',
|
|
32
|
+
'cogmem_candidate_review',
|
|
33
|
+
'cogmem_maintenance_tick',
|
|
34
|
+
'cogmem_prospective',
|
|
35
|
+
];
|
|
36
|
+
function readArgs(argv) {
|
|
37
|
+
const values = {};
|
|
38
|
+
const positionals = [];
|
|
39
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
40
|
+
const item = argv[index];
|
|
41
|
+
if (!item.startsWith('--')) {
|
|
42
|
+
positionals.push(item);
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
const next = argv[index + 1];
|
|
46
|
+
const key = item.slice(2);
|
|
47
|
+
if (!next || next.startsWith('--')) {
|
|
48
|
+
values[key] = true;
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
values[key] = next;
|
|
52
|
+
index += 1;
|
|
53
|
+
}
|
|
54
|
+
const rawAgent = positionals[0];
|
|
55
|
+
const agent = rawAgent === 'openclaw' || rawAgent === 'hermes' ? rawAgent : undefined;
|
|
56
|
+
return {
|
|
57
|
+
agent,
|
|
58
|
+
workspaceRoot: resolve(stringValue(values.workspace) || '.'),
|
|
59
|
+
configPath: stringValue(values.config),
|
|
60
|
+
openclawConfigPath: stringValue(values['openclaw-config']),
|
|
61
|
+
hermesConfigPath: stringValue(values['hermes-config']),
|
|
62
|
+
pluginDir: stringValue(values['plugin-dir']),
|
|
63
|
+
bunPath: stringValue(values.bun),
|
|
64
|
+
projectId: stringValue(values.project),
|
|
65
|
+
agentId: stringValue(values['agent-id']),
|
|
66
|
+
outputPath: stringValue(values.output),
|
|
67
|
+
auto: values.auto === true,
|
|
68
|
+
dryRun: values['dry-run'] === true,
|
|
69
|
+
force: values.force === true,
|
|
70
|
+
json: values.json === true,
|
|
71
|
+
help: values.help === true || values.h === true,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function stringValue(value) {
|
|
75
|
+
return typeof value === 'string' ? value : undefined;
|
|
76
|
+
}
|
|
77
|
+
function packageRoot() {
|
|
78
|
+
return resolve(dirname(fileURLToPath(import.meta.url)), '../..');
|
|
79
|
+
}
|
|
80
|
+
function templatePathFor(agent) {
|
|
81
|
+
return join(packageRoot(), 'examples', `${agent}-backend`, 'SKILL.md');
|
|
82
|
+
}
|
|
83
|
+
function operationsTemplatePathFor(agent) {
|
|
84
|
+
return join(packageRoot(), 'examples', `${agent}-backend`, 'references', 'operations.md');
|
|
85
|
+
}
|
|
86
|
+
function defaultSkillPath(agent, workspaceRoot) {
|
|
87
|
+
if (agent === 'openclaw') {
|
|
88
|
+
return join(workspaceRoot, 'skills', 'cogmem-memory', 'SKILL.md');
|
|
89
|
+
}
|
|
90
|
+
return join(process.env.HOME || homedir(), '.hermes', 'skills', 'cogmem-memory', 'SKILL.md');
|
|
91
|
+
}
|
|
92
|
+
function nextCommands(agent) {
|
|
93
|
+
if (agent === 'openclaw') {
|
|
94
|
+
return [
|
|
95
|
+
'./node_modules/.bin/cogmem-init --agent openclaw --scope project',
|
|
96
|
+
'./node_modules/.bin/cogmem-doctor',
|
|
97
|
+
'./node_modules/.bin/cogmem-import-openclaw --workspace . --project openclaw --dry-run',
|
|
98
|
+
'./node_modules/.bin/cogmem-import-openclaw --workspace . --project openclaw',
|
|
99
|
+
'./node_modules/.bin/cogmem-connect openclaw --workspace . --auto --force',
|
|
100
|
+
];
|
|
101
|
+
}
|
|
102
|
+
return [
|
|
103
|
+
'./node_modules/.bin/cogmem-init --agent hermes',
|
|
104
|
+
'./node_modules/.bin/cogmem-doctor',
|
|
105
|
+
'./node_modules/.bin/cogmem-connect hermes --workspace . --auto --force',
|
|
106
|
+
'./node_modules/.bin/cogmem-import-hermes --workspace . --project hermes --dry-run',
|
|
107
|
+
'./node_modules/.bin/cogmem-import-hermes --workspace . --project hermes',
|
|
108
|
+
];
|
|
109
|
+
}
|
|
110
|
+
function usage() {
|
|
111
|
+
return [
|
|
112
|
+
'Usage: cogmem-connect <openclaw|hermes> [--workspace <dir>] [--output <SKILL.md>] [--auto] [--config <config.toml>] [--openclaw-config <openclaw.json>] [--hermes-config <config.yaml>] [--dry-run] [--force] [--json]',
|
|
113
|
+
'',
|
|
114
|
+
'Installs the agent-facing cogmem memory skill bundle into:',
|
|
115
|
+
' OpenClaw: <workspace>/skills/cogmem-memory/',
|
|
116
|
+
' Hermes: ~/.hermes/skills/cogmem-memory/',
|
|
117
|
+
'',
|
|
118
|
+
'The bundle includes SKILL.md plus references/operations.md with migration, import, recall, Atlas, governance, repair, and backup commands.',
|
|
119
|
+
'For OpenClaw, pass --auto to install the local automatic recall/remember plugin wrapper and patch OpenClaw plugin config.',
|
|
120
|
+
'For Hermes, pass --auto to patch ~/.hermes/config.yaml with a cogmem MCP server entry.',
|
|
121
|
+
].join('\n');
|
|
122
|
+
}
|
|
123
|
+
function hostConfigSnippet(agent, workspaceRoot, auto) {
|
|
124
|
+
if (agent === 'openclaw') {
|
|
125
|
+
if (auto) {
|
|
126
|
+
return [
|
|
127
|
+
'// cogmem-connect openclaw --auto installs a local OpenClaw plugin wrapper.',
|
|
128
|
+
'// The wrapper registers before_prompt_build for governed recall and agent_end for turn recording.',
|
|
129
|
+
'// It calls KernelAgentMemoryBackend through cogmem public API via a Bun bridge.',
|
|
130
|
+
'// Restart the OpenClaw Gateway after changing plugin code, hook policy, or plugins.load.paths.',
|
|
131
|
+
].join('\n');
|
|
132
|
+
}
|
|
133
|
+
return [
|
|
134
|
+
'// cogmem-connect does not modify OpenClaw host config.',
|
|
135
|
+
'// It installs a workspace skill at <workspace>/skills/cogmem-memory/SKILL.md.',
|
|
136
|
+
'// Current OpenClaw memory config is owned by OpenClaw, for example memory.backend = "builtin" | "qmd".',
|
|
137
|
+
'// Do not write unknown OpenClaw config fields for cogmem.',
|
|
138
|
+
'// Add host config only after installing a real OpenClaw plugin wrapper with a valid manifest/schema.',
|
|
139
|
+
].join('\n');
|
|
140
|
+
}
|
|
141
|
+
const mcpBin = resolveCogmemMcpCommand(workspaceRoot);
|
|
142
|
+
return [
|
|
143
|
+
'mcp_servers:',
|
|
144
|
+
' cogmem:',
|
|
145
|
+
` command: "${mcpBin}"`,
|
|
146
|
+
' args: []',
|
|
147
|
+
' enabled: true',
|
|
148
|
+
' tools:',
|
|
149
|
+
' include:',
|
|
150
|
+
...HERMES_COGMEM_TOOLS.map((tool) => ` - ${tool}`),
|
|
151
|
+
].join('\n');
|
|
152
|
+
}
|
|
153
|
+
function resolveCogmemMcpCommand(workspaceRoot) {
|
|
154
|
+
if (process.env.COGMEM_MCP_BIN)
|
|
155
|
+
return process.env.COGMEM_MCP_BIN;
|
|
156
|
+
const workspaceBin = join(workspaceRoot, 'node_modules', '.bin', 'cogmem-mcp');
|
|
157
|
+
if (existsSync(workspaceBin))
|
|
158
|
+
return workspaceBin;
|
|
159
|
+
const pathValue = process.env.PATH || '';
|
|
160
|
+
for (const segment of pathValue.split(':')) {
|
|
161
|
+
if (!segment)
|
|
162
|
+
continue;
|
|
163
|
+
const candidate = join(segment, 'cogmem-mcp');
|
|
164
|
+
if (existsSync(candidate))
|
|
165
|
+
return candidate;
|
|
166
|
+
}
|
|
167
|
+
return 'cogmem-mcp';
|
|
168
|
+
}
|
|
169
|
+
function installSkill(args) {
|
|
170
|
+
if (!args.agent)
|
|
171
|
+
throw new Error(usage());
|
|
172
|
+
const templatePath = templatePathFor(args.agent);
|
|
173
|
+
const operationsTemplatePath = operationsTemplatePathFor(args.agent);
|
|
174
|
+
for (const requiredPath of [templatePath, operationsTemplatePath]) {
|
|
175
|
+
if (!existsSync(requiredPath)) {
|
|
176
|
+
throw new Error(`Missing packaged skill template: ${requiredPath}`);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
const template = readFileSync(templatePath, 'utf8');
|
|
180
|
+
const operationsTemplate = readFileSync(operationsTemplatePath, 'utf8');
|
|
181
|
+
const skillPath = resolve(args.outputPath || defaultSkillPath(args.agent, args.workspaceRoot));
|
|
182
|
+
const operationsPath = join(dirname(skillPath), 'references', 'operations.md');
|
|
183
|
+
const skillFiles = [skillPath, operationsPath];
|
|
184
|
+
const alreadyCurrent = existsSync(skillPath)
|
|
185
|
+
&& readFileSync(skillPath, 'utf8') === template
|
|
186
|
+
&& existsSync(operationsPath)
|
|
187
|
+
&& readFileSync(operationsPath, 'utf8') === operationsTemplate;
|
|
188
|
+
let autoMemory;
|
|
189
|
+
let hermesMcp;
|
|
190
|
+
if (!args.dryRun && !alreadyCurrent) {
|
|
191
|
+
if (existsSync(skillPath) && !args.force) {
|
|
192
|
+
throw new Error(`Skill already exists at ${skillPath}. Re-run with --force to overwrite.`);
|
|
193
|
+
}
|
|
194
|
+
mkdirSync(dirname(skillPath), { recursive: true });
|
|
195
|
+
writeFileSync(skillPath, template, 'utf8');
|
|
196
|
+
mkdirSync(dirname(operationsPath), { recursive: true });
|
|
197
|
+
writeFileSync(operationsPath, operationsTemplate, 'utf8');
|
|
198
|
+
}
|
|
199
|
+
if (args.agent === 'openclaw' && args.auto) {
|
|
200
|
+
autoMemory = installOpenClawAutoMemoryPlugin({
|
|
201
|
+
workspaceRoot: args.workspaceRoot,
|
|
202
|
+
configPath: args.configPath,
|
|
203
|
+
openclawConfigPath: args.openclawConfigPath,
|
|
204
|
+
pluginDir: args.pluginDir,
|
|
205
|
+
bunPath: args.bunPath,
|
|
206
|
+
projectId: args.projectId,
|
|
207
|
+
agentId: args.agentId,
|
|
208
|
+
dryRun: args.dryRun,
|
|
209
|
+
force: args.force,
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
else if (args.agent === 'hermes' && args.auto) {
|
|
213
|
+
hermesMcp = installHermesMcpConfig({
|
|
214
|
+
workspaceRoot: args.workspaceRoot,
|
|
215
|
+
configPath: args.hermesConfigPath,
|
|
216
|
+
dryRun: args.dryRun,
|
|
217
|
+
force: args.force,
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
return {
|
|
221
|
+
agent: args.agent,
|
|
222
|
+
workspaceRoot: args.workspaceRoot,
|
|
223
|
+
skillPath,
|
|
224
|
+
skillFiles,
|
|
225
|
+
templatePath,
|
|
226
|
+
dryRun: args.dryRun,
|
|
227
|
+
installed: !args.dryRun && !alreadyCurrent,
|
|
228
|
+
alreadyCurrent,
|
|
229
|
+
nextCommands: nextCommands(args.agent),
|
|
230
|
+
hostConfigSnippet: hostConfigSnippet(args.agent, args.workspaceRoot, args.auto),
|
|
231
|
+
autoMemory,
|
|
232
|
+
hermesMcp,
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
function defaultHermesConfigPath(env = process.env) {
|
|
236
|
+
return join(env.HOME || homedir(), '.hermes', 'config.yaml');
|
|
237
|
+
}
|
|
238
|
+
function installHermesMcpConfig(input) {
|
|
239
|
+
const configPath = resolve(input.configPath || defaultHermesConfigPath());
|
|
240
|
+
const serverCommand = resolveCogmemMcpCommand(resolve(input.workspaceRoot));
|
|
241
|
+
const original = existsSync(configPath) ? readFileSync(configPath, 'utf8') : '';
|
|
242
|
+
const patched = patchHermesMcpConfig(original, serverCommand);
|
|
243
|
+
const changed = patched !== original;
|
|
244
|
+
let backupPath;
|
|
245
|
+
if (!input.dryRun && (changed || input.force)) {
|
|
246
|
+
mkdirSync(dirname(configPath), { recursive: true });
|
|
247
|
+
if (existsSync(configPath)) {
|
|
248
|
+
backupPath = `${configPath}.cogmem.bak-${Date.now()}`;
|
|
249
|
+
writeFileSync(backupPath, original, 'utf8');
|
|
250
|
+
}
|
|
251
|
+
writeFileSync(configPath, patched, 'utf8');
|
|
252
|
+
}
|
|
253
|
+
return {
|
|
254
|
+
enabled: true,
|
|
255
|
+
configPath,
|
|
256
|
+
serverCommand,
|
|
257
|
+
dryRun: input.dryRun,
|
|
258
|
+
configUpdated: changed || input.force,
|
|
259
|
+
backupPath,
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
function patchHermesMcpConfig(original, serverCommand) {
|
|
263
|
+
if (/^\s+cogmem\s*:/m.test(original) && original.includes('cogmem-mcp')) {
|
|
264
|
+
return patchExistingHermesCogmemConfig(original);
|
|
265
|
+
}
|
|
266
|
+
const lines = original.replace(/\r\n/g, '\n').split('\n');
|
|
267
|
+
const serverBlock = [
|
|
268
|
+
' cogmem:',
|
|
269
|
+
` command: "${serverCommand}"`,
|
|
270
|
+
' args: []',
|
|
271
|
+
' enabled: true',
|
|
272
|
+
' tools:',
|
|
273
|
+
' include:',
|
|
274
|
+
...HERMES_COGMEM_TOOLS.map((tool) => ` - ${tool}`),
|
|
275
|
+
];
|
|
276
|
+
const mcpIndex = lines.findIndex((line) => /^mcp_servers\s*:\s*(?:\{\})?\s*$/.test(line.trim()));
|
|
277
|
+
if (mcpIndex === -1) {
|
|
278
|
+
const prefix = original.trimEnd();
|
|
279
|
+
return `${prefix}${prefix ? '\n\n' : ''}mcp_servers:\n${serverBlock.join('\n')}\n`;
|
|
280
|
+
}
|
|
281
|
+
lines[mcpIndex] = 'mcp_servers:';
|
|
282
|
+
let insertAt = mcpIndex + 1;
|
|
283
|
+
while (insertAt < lines.length) {
|
|
284
|
+
const line = lines[insertAt];
|
|
285
|
+
if (line.trim() && !line.startsWith(' ') && !line.startsWith('\t') && !line.trim().startsWith('#'))
|
|
286
|
+
break;
|
|
287
|
+
insertAt += 1;
|
|
288
|
+
}
|
|
289
|
+
lines.splice(insertAt, 0, ...serverBlock);
|
|
290
|
+
return `${lines.join('\n').replace(/\n+$/u, '')}\n`;
|
|
291
|
+
}
|
|
292
|
+
function patchExistingHermesCogmemConfig(original) {
|
|
293
|
+
const lines = original.replace(/\r\n/g, '\n').split('\n');
|
|
294
|
+
const cogmemIndex = lines.findIndex((line) => /^\s+cogmem\s*:\s*$/.test(line));
|
|
295
|
+
if (cogmemIndex === -1)
|
|
296
|
+
return original.endsWith('\n') ? original : `${original}\n`;
|
|
297
|
+
const cogmemIndent = leadingSpaces(lines[cogmemIndex]);
|
|
298
|
+
let blockEnd = cogmemIndex + 1;
|
|
299
|
+
while (blockEnd < lines.length) {
|
|
300
|
+
const line = lines[blockEnd];
|
|
301
|
+
if (line.trim()
|
|
302
|
+
&& !line.trim().startsWith('#')
|
|
303
|
+
&& leadingSpaces(line) <= cogmemIndent) {
|
|
304
|
+
break;
|
|
305
|
+
}
|
|
306
|
+
blockEnd += 1;
|
|
307
|
+
}
|
|
308
|
+
const block = lines.slice(cogmemIndex, blockEnd);
|
|
309
|
+
const existingTools = new Set();
|
|
310
|
+
for (const line of block) {
|
|
311
|
+
const match = line.match(/^\s*-\s*(cogmem_[\w-]+)\s*$/);
|
|
312
|
+
if (match?.[1])
|
|
313
|
+
existingTools.add(match[1]);
|
|
314
|
+
}
|
|
315
|
+
const missing = HERMES_COGMEM_TOOLS.filter((tool) => !existingTools.has(tool));
|
|
316
|
+
if (missing.length === 0)
|
|
317
|
+
return `${lines.join('\n').replace(/\n+$/u, '')}\n`;
|
|
318
|
+
const includeRelativeIndex = block.findIndex((line) => /^\s+include\s*:\s*$/.test(line));
|
|
319
|
+
if (includeRelativeIndex !== -1) {
|
|
320
|
+
const includeIndex = cogmemIndex + includeRelativeIndex;
|
|
321
|
+
const includeIndent = leadingSpaces(lines[includeIndex]);
|
|
322
|
+
let insertAt = includeIndex + 1;
|
|
323
|
+
while (insertAt < blockEnd) {
|
|
324
|
+
const line = lines[insertAt];
|
|
325
|
+
if (!line.trim()) {
|
|
326
|
+
insertAt += 1;
|
|
327
|
+
continue;
|
|
328
|
+
}
|
|
329
|
+
if (leadingSpaces(line) <= includeIndent)
|
|
330
|
+
break;
|
|
331
|
+
if (!/^\s*-\s*/.test(line) && leadingSpaces(line) <= includeIndent + 2)
|
|
332
|
+
break;
|
|
333
|
+
insertAt += 1;
|
|
334
|
+
}
|
|
335
|
+
const itemIndent = `${' '.repeat(includeIndent + 2)}`;
|
|
336
|
+
lines.splice(insertAt, 0, ...missing.map((tool) => `${itemIndent}- ${tool}`));
|
|
337
|
+
return `${lines.join('\n').replace(/\n+$/u, '')}\n`;
|
|
338
|
+
}
|
|
339
|
+
const childIndent = `${' '.repeat(cogmemIndent + 2)}`;
|
|
340
|
+
const includeIndent = `${' '.repeat(cogmemIndent + 4)}`;
|
|
341
|
+
const itemIndent = `${' '.repeat(cogmemIndent + 6)}`;
|
|
342
|
+
lines.splice(blockEnd, 0, `${childIndent}tools:`, `${includeIndent}include:`, ...HERMES_COGMEM_TOOLS.map((tool) => `${itemIndent}- ${tool}`));
|
|
343
|
+
return `${lines.join('\n').replace(/\n+$/u, '')}\n`;
|
|
344
|
+
}
|
|
345
|
+
function leadingSpaces(line) {
|
|
346
|
+
return line.match(/^\s*/)?.[0].length ?? 0;
|
|
347
|
+
}
|
|
348
|
+
function printHuman(result) {
|
|
349
|
+
console.log(`cogmem ${result.agent} skill ${result.dryRun ? 'dry-run' : result.installed ? 'installed' : 'already current'}`);
|
|
350
|
+
console.log(`workspace: ${result.workspaceRoot}`);
|
|
351
|
+
console.log(`skill: ${result.skillPath}`);
|
|
352
|
+
console.log(`reference: ${result.skillFiles[1]}`);
|
|
353
|
+
console.log('');
|
|
354
|
+
console.log('Host config snippet:');
|
|
355
|
+
console.log(result.hostConfigSnippet);
|
|
356
|
+
if (result.autoMemory) {
|
|
357
|
+
console.log('');
|
|
358
|
+
console.log('OpenClaw automatic memory plugin:');
|
|
359
|
+
console.log(` plugin: ${result.autoMemory.pluginDir}`);
|
|
360
|
+
console.log(` config: ${result.autoMemory.openclawConfigPath}`);
|
|
361
|
+
console.log(` hooks: ${result.autoMemory.hookNames.join(', ')}`);
|
|
362
|
+
if (result.autoMemory.backupPath)
|
|
363
|
+
console.log(` backup: ${result.autoMemory.backupPath}`);
|
|
364
|
+
}
|
|
365
|
+
if (result.hermesMcp) {
|
|
366
|
+
console.log('');
|
|
367
|
+
console.log('Hermes MCP integration:');
|
|
368
|
+
console.log(` config: ${result.hermesMcp.configPath}`);
|
|
369
|
+
console.log(` command: ${result.hermesMcp.serverCommand}`);
|
|
370
|
+
if (result.hermesMcp.backupPath)
|
|
371
|
+
console.log(` backup: ${result.hermesMcp.backupPath}`);
|
|
372
|
+
console.log(' reload: /reload-mcp');
|
|
373
|
+
}
|
|
374
|
+
console.log('');
|
|
375
|
+
console.log('Next commands:');
|
|
376
|
+
for (const command of result.nextCommands) {
|
|
377
|
+
console.log(` ${command}`);
|
|
378
|
+
}
|
|
379
|
+
console.log('');
|
|
380
|
+
console.log('Then let the agent read the installed SKILL.md before changing runtime wiring.');
|
|
381
|
+
}
|
|
382
|
+
async function main() {
|
|
383
|
+
const args = readArgs(process.argv.slice(2));
|
|
384
|
+
if (args.help) {
|
|
385
|
+
console.log(usage());
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
const result = installSkill(args);
|
|
389
|
+
if (args.json) {
|
|
390
|
+
printCliJson(`connect.${result.agent}`, result);
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
printHuman(result);
|
|
394
|
+
}
|
|
395
|
+
main().catch((error) => {
|
|
396
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
397
|
+
process.exit(1);
|
|
398
|
+
});
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { loadCogmemConfig, resolveCogmemConfigPath } from '../config/CogmemConfig.js';
|
|
5
|
+
import { createMemoryKernelFromConfig } from '../factory.js';
|
|
6
|
+
import { defaultOpenClawAutoMemoryPluginDir, inspectOpenClawAutoMemoryPlugin, installOpenClawAutoMemoryPlugin, } from '../host/openclaw/AutoMemoryPluginInstaller.js';
|
|
7
|
+
import { compactStorage } from '../storage/StorageCompactor.js';
|
|
8
|
+
function readArg(name) {
|
|
9
|
+
const index = process.argv.indexOf(name);
|
|
10
|
+
if (index === -1)
|
|
11
|
+
return undefined;
|
|
12
|
+
return process.argv[index + 1];
|
|
13
|
+
}
|
|
14
|
+
function hasFlag(name) {
|
|
15
|
+
return process.argv.includes(name);
|
|
16
|
+
}
|
|
17
|
+
function ok(message) {
|
|
18
|
+
console.log(`OK ${message}`);
|
|
19
|
+
}
|
|
20
|
+
function warn(code, message) {
|
|
21
|
+
console.log(`WARN ${code}: ${message}`);
|
|
22
|
+
}
|
|
23
|
+
function printWarnings(diagnostics) {
|
|
24
|
+
for (const diagnostic of diagnostics) {
|
|
25
|
+
if (diagnostic.severity === 'warning')
|
|
26
|
+
warn(diagnostic.code, diagnostic.message);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function fail(message) {
|
|
30
|
+
console.error(`FAIL ${message}`);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
const configPath = readArg('--config');
|
|
34
|
+
const envPath = readArg('--env-path');
|
|
35
|
+
const fix = hasFlag('--fix');
|
|
36
|
+
const agent = readArg('--agent');
|
|
37
|
+
const workspace = readArg('--workspace');
|
|
38
|
+
const openclawConfigPath = readArg('--openclaw-config');
|
|
39
|
+
const pluginDir = readArg('--plugin-dir');
|
|
40
|
+
const bunPath = readArg('--bun');
|
|
41
|
+
const storage = hasFlag('--storage');
|
|
42
|
+
const pluginOnly = hasFlag('--plugin-only');
|
|
43
|
+
const json = hasFlag('--json');
|
|
44
|
+
if (envPath) {
|
|
45
|
+
fail('--env-path is no longer supported. Use cogmem-init to create .cogmem/config.toml, then run cogmem-doctor --config <config.toml>.');
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
const resolution = resolveCogmemConfigPath({ configPath });
|
|
49
|
+
if (resolution.kind === 'missing')
|
|
50
|
+
fail(`missing config file: ${resolution.path}`);
|
|
51
|
+
const loaded = loadCogmemConfig({ configPath: resolution.path });
|
|
52
|
+
const error = loaded.diagnostics.find((diagnostic) => diagnostic.severity === 'error');
|
|
53
|
+
if (error)
|
|
54
|
+
fail(`${error.code}: ${error.message}`);
|
|
55
|
+
if (pluginOnly) {
|
|
56
|
+
if (agent && agent !== 'openclaw')
|
|
57
|
+
fail('doctor --plugin-only currently supports --agent openclaw.');
|
|
58
|
+
const workspaceRoot = workspace || loaded.integrations.openclaw.workspaceDir || process.cwd();
|
|
59
|
+
let fixed = undefined;
|
|
60
|
+
if (fix) {
|
|
61
|
+
fixed = installOpenClawAutoMemoryPlugin({
|
|
62
|
+
workspaceRoot,
|
|
63
|
+
configPath: resolution.path,
|
|
64
|
+
openclawConfigPath,
|
|
65
|
+
pluginDir,
|
|
66
|
+
bunPath,
|
|
67
|
+
force: true,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
const inspection = inspectOpenClawAutoMemoryPlugin({
|
|
71
|
+
workspaceRoot,
|
|
72
|
+
pluginDir: pluginDir || defaultOpenClawAutoMemoryPluginDir(workspaceRoot),
|
|
73
|
+
});
|
|
74
|
+
const audit = readLatestOpenClawAudit(workspaceRoot);
|
|
75
|
+
if (json) {
|
|
76
|
+
console.log(JSON.stringify({
|
|
77
|
+
schemaVersion: 'cogmem.cli.v1',
|
|
78
|
+
command: 'doctor',
|
|
79
|
+
pluginOnly: true,
|
|
80
|
+
configPath: resolution.path,
|
|
81
|
+
openclaw: { plugin: inspection, fixed, audit },
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
printWarnings(loaded.diagnostics);
|
|
86
|
+
ok('configuration parsed');
|
|
87
|
+
ok(`openclaw plugin ${inspection.current ? 'current' : 'stale'} at ${inspection.pluginDir}`);
|
|
88
|
+
if (!inspection.current)
|
|
89
|
+
warn('openclaw_plugin_stale', 'Run cogmem doctor --fix --agent openclaw --plugin-only --workspace <workspace>.');
|
|
90
|
+
if (fixed)
|
|
91
|
+
ok(`openclaw auto memory integration fixed at ${fixed.pluginDir}`);
|
|
92
|
+
if (audit.lastBeforePromptBuild)
|
|
93
|
+
ok(`last before_prompt_build action=${audit.lastBeforePromptBuild.action || 'unknown'} reason=${audit.lastBeforePromptBuild.reason || ''}`);
|
|
94
|
+
}
|
|
95
|
+
process.exit(0);
|
|
96
|
+
}
|
|
97
|
+
printWarnings(loaded.diagnostics);
|
|
98
|
+
ok('configuration parsed');
|
|
99
|
+
ok(`cogmem home ${loaded.homeDir}`);
|
|
100
|
+
const kernel = createMemoryKernelFromConfig({ configPath: resolution.path });
|
|
101
|
+
const health = kernel.getHealthStatus();
|
|
102
|
+
if (health.package !== 'cogmem')
|
|
103
|
+
fail('unexpected package identity');
|
|
104
|
+
ok(`kernel ready at ${health.dbPath}`);
|
|
105
|
+
kernel.close();
|
|
106
|
+
if (storage) {
|
|
107
|
+
const storageStats = compactStorage({
|
|
108
|
+
dbPath: health.dbPath,
|
|
109
|
+
dryRun: true,
|
|
110
|
+
dimension: loaded.options.vectorDimension,
|
|
111
|
+
});
|
|
112
|
+
ok([
|
|
113
|
+
`storage raw_events=${storageStats.rawEventsBefore}`,
|
|
114
|
+
`vectors=${storageStats.vectorCountBefore}`,
|
|
115
|
+
`vector_bytes=${storageStats.vectorBytesBefore}`,
|
|
116
|
+
`eligible_vector_bytes=${storageStats.eligibleVectorBytes}`,
|
|
117
|
+
`vector_bytes_per_raw_event=${storageStats.vectorBytesPerRawEventBefore.toFixed(2)}`,
|
|
118
|
+
].join(' '));
|
|
119
|
+
if (storageStats.rawEventsBefore > 0 && storageStats.vectorBytesPerRawEventBefore >= 8192) {
|
|
120
|
+
warn('vector_storage_growth', 'Vector bytes per raw event are high; consider selective_compile/raw_then_dream and cogmem compact --dry-run.');
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (fix) {
|
|
124
|
+
if (agent !== 'openclaw') {
|
|
125
|
+
fail('doctor --fix currently requires --agent openclaw.');
|
|
126
|
+
}
|
|
127
|
+
const result = installOpenClawAutoMemoryPlugin({
|
|
128
|
+
workspaceRoot: workspace || loaded.integrations.openclaw.workspaceDir || process.cwd(),
|
|
129
|
+
configPath: resolution.path,
|
|
130
|
+
openclawConfigPath,
|
|
131
|
+
pluginDir,
|
|
132
|
+
bunPath,
|
|
133
|
+
force: true,
|
|
134
|
+
});
|
|
135
|
+
ok(`openclaw auto memory integration fixed at ${result.pluginDir}`);
|
|
136
|
+
ok(`openclaw config patched at ${result.openclawConfigPath}`);
|
|
137
|
+
}
|
|
138
|
+
if (agent === 'openclaw' || workspace) {
|
|
139
|
+
const workspaceRoot = workspace || loaded.integrations.openclaw.workspaceDir || process.cwd();
|
|
140
|
+
const inspection = inspectOpenClawAutoMemoryPlugin({
|
|
141
|
+
workspaceRoot,
|
|
142
|
+
pluginDir: pluginDir || defaultOpenClawAutoMemoryPluginDir(workspaceRoot),
|
|
143
|
+
});
|
|
144
|
+
if (inspection.installed) {
|
|
145
|
+
ok(`openclaw plugin ${inspection.current ? 'current' : 'stale'} at ${inspection.pluginDir}`);
|
|
146
|
+
if (!inspection.current)
|
|
147
|
+
warn('openclaw_plugin_stale', 'Run cogmem connect openclaw --workspace <workspace> --auto --force or cogmem doctor --fix --agent openclaw --plugin-only.');
|
|
148
|
+
}
|
|
149
|
+
const audit = readLatestOpenClawAudit(workspaceRoot);
|
|
150
|
+
if (audit.lastBeforePromptBuild) {
|
|
151
|
+
ok(`last before_prompt_build action=${audit.lastBeforePromptBuild.action || 'unknown'} reason=${audit.lastBeforePromptBuild.reason || ''}`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function readLatestOpenClawAudit(workspaceRoot) {
|
|
156
|
+
const logPath = join(workspaceRoot, '.cogmem', 'logs', 'openclaw-auto-memory.jsonl');
|
|
157
|
+
if (!existsSync(logPath))
|
|
158
|
+
return {};
|
|
159
|
+
const lines = readFileSync(logPath, 'utf8').split('\n').map((line) => line.trim()).filter(Boolean).slice(-200);
|
|
160
|
+
for (let index = lines.length - 1; index >= 0; index -= 1) {
|
|
161
|
+
try {
|
|
162
|
+
const record = JSON.parse(lines[index]);
|
|
163
|
+
if (record.hook === 'before_prompt_build')
|
|
164
|
+
return { lastBeforePromptBuild: record };
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
// Ignore malformed audit rows.
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return {};
|
|
171
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { createMemoryKernel, createMemoryKernelFromConfig } from '../factory.js';
|
|
3
|
+
import { printCliJson } from './CliJson.js';
|
|
4
|
+
function parseArgs(argv) {
|
|
5
|
+
const [command, ...rest] = argv;
|
|
6
|
+
const args = { command };
|
|
7
|
+
for (let index = 0; index < rest.length; index += 1) {
|
|
8
|
+
const item = rest[index];
|
|
9
|
+
if (!item.startsWith('--'))
|
|
10
|
+
continue;
|
|
11
|
+
const key = item.slice(2);
|
|
12
|
+
const next = rest[index + 1];
|
|
13
|
+
if (!next || next.startsWith('--'))
|
|
14
|
+
args[key] = true;
|
|
15
|
+
else {
|
|
16
|
+
args[key] = next;
|
|
17
|
+
index += 1;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return args;
|
|
21
|
+
}
|
|
22
|
+
function usage() {
|
|
23
|
+
return [
|
|
24
|
+
'Usage: cogmem dream <tick|status|retry> [args]',
|
|
25
|
+
' tick [--project <id>] [--mode auto|micro|normal|deep] [--max-episodes <n>] [--json]',
|
|
26
|
+
' status [--project <id>] [--json]',
|
|
27
|
+
' retry [--project <id>] [--json]',
|
|
28
|
+
'A tick is explicit and conditional. It processes sealed episodes only and never executes tools.',
|
|
29
|
+
'--json emits cogmem.cli.v1 with command payload fields at the top level.',
|
|
30
|
+
].join('\n');
|
|
31
|
+
}
|
|
32
|
+
function openKernel(args) {
|
|
33
|
+
const dbPath = stringArg(args, 'db');
|
|
34
|
+
return dbPath ? createMemoryKernel({ dbPath }) : createMemoryKernelFromConfig({ configPath: stringArg(args, 'config'), cwd: process.cwd() });
|
|
35
|
+
}
|
|
36
|
+
async function main() {
|
|
37
|
+
const args = parseArgs(process.argv.slice(2));
|
|
38
|
+
if (!args.command || args.help === true || args.h === true) {
|
|
39
|
+
console.log(usage());
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const kernel = openKernel(args);
|
|
43
|
+
try {
|
|
44
|
+
const projectId = stringArg(args, 'project');
|
|
45
|
+
const result = args.command === 'tick'
|
|
46
|
+
? await kernel.runDreamTick({ projectId, mode: modeArg(stringArg(args, 'mode')), maxEpisodes: numberArg(args, 'max-episodes') })
|
|
47
|
+
: args.command === 'status'
|
|
48
|
+
? kernel.getEpisodeDreamStatus(projectId)
|
|
49
|
+
: args.command === 'retry'
|
|
50
|
+
? { retried: kernel.retryFailedEpisodeDreams(projectId), status: kernel.getEpisodeDreamStatus(projectId) }
|
|
51
|
+
: (() => { throw new Error(usage()); })();
|
|
52
|
+
printCliJson(`dream.${args.command}`, result);
|
|
53
|
+
}
|
|
54
|
+
finally {
|
|
55
|
+
kernel.close();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function stringArg(args, key) { return typeof args[key] === 'string' && args[key] ? args[key] : undefined; }
|
|
59
|
+
function numberArg(args, key) { const value = stringArg(args, key); if (!value)
|
|
60
|
+
return undefined; const parsed = Number(value); if (!Number.isFinite(parsed))
|
|
61
|
+
throw new Error(`--${key} must be numeric`); return parsed; }
|
|
62
|
+
function modeArg(value) { if (!value)
|
|
63
|
+
return undefined; if (value === 'auto' || value === 'micro' || value === 'normal' || value === 'deep')
|
|
64
|
+
return value; throw new Error('mode must be auto, micro, normal, or deep'); }
|
|
65
|
+
main().catch((error) => { console.error(error instanceof Error ? error.message : String(error)); process.exit(1); });
|