cognitive-core 0.2.4 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +88 -143
- package/dist/agents/mock-provider.d.ts.map +1 -1
- package/dist/agents/mock-provider.js.map +1 -1
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/types.js +5 -4
- package/dist/agents/types.js.map +1 -1
- package/dist/atlas.d.ts +309 -97
- package/dist/atlas.d.ts.map +1 -1
- package/dist/atlas.js +743 -277
- package/dist/atlas.js.map +1 -1
- package/dist/bin/cli-utils.d.ts +25 -2
- package/dist/bin/cli-utils.d.ts.map +1 -1
- package/dist/bin/cli-utils.js +79 -9
- package/dist/bin/cli-utils.js.map +1 -1
- package/dist/bin/cognitive-core.js +32 -0
- package/dist/bin/cognitive-core.js.map +1 -1
- package/dist/bin/commands/dream.d.ts +17 -0
- package/dist/bin/commands/dream.d.ts.map +1 -0
- package/dist/bin/commands/dream.js +168 -0
- package/dist/bin/commands/dream.js.map +1 -0
- package/dist/bin/commands/eval.d.ts +181 -0
- package/dist/bin/commands/eval.d.ts.map +1 -0
- package/dist/bin/commands/eval.js +1582 -0
- package/dist/bin/commands/eval.js.map +1 -0
- package/dist/bin/commands/kb.js +0 -8
- package/dist/bin/commands/kb.js.map +1 -1
- package/dist/bin/commands/learn.js +12 -4
- package/dist/bin/commands/learn.js.map +1 -1
- package/dist/bin/commands/legacy.d.ts.map +1 -1
- package/dist/bin/commands/legacy.js +1 -1
- package/dist/bin/commands/legacy.js.map +1 -1
- package/dist/bin/commands/run.d.ts.map +1 -1
- package/dist/bin/commands/run.js +10 -9
- package/dist/bin/commands/run.js.map +1 -1
- package/dist/bin/commands/sessions.d.ts.map +1 -1
- package/dist/bin/commands/sessions.js.map +1 -1
- package/dist/bin/commands/skills.d.ts.map +1 -1
- package/dist/bin/commands/skills.js +283 -1
- package/dist/bin/commands/skills.js.map +1 -1
- package/dist/embeddings/bm25.d.ts.map +1 -1
- package/dist/embeddings/bm25.js +1 -2
- package/dist/embeddings/bm25.js.map +1 -1
- package/dist/embeddings/index.d.ts +3 -3
- package/dist/embeddings/index.d.ts.map +1 -1
- package/dist/embeddings/index.js +3 -3
- package/dist/embeddings/index.js.map +1 -1
- package/dist/embeddings/inverted-index.js +62 -7
- package/dist/embeddings/inverted-index.js.map +1 -1
- package/dist/embeddings/manager.d.ts.map +1 -1
- package/dist/embeddings/manager.js +6 -5
- package/dist/embeddings/manager.js.map +1 -1
- package/dist/embeddings/provider.d.ts +96 -5
- package/dist/embeddings/provider.d.ts.map +1 -1
- package/dist/embeddings/provider.js +171 -48
- package/dist/embeddings/provider.js.map +1 -1
- package/dist/embeddings/vector-store.d.ts.map +1 -1
- package/dist/embeddings/vector-store.js +3 -1
- package/dist/embeddings/vector-store.js.map +1 -1
- package/dist/eval/ablation-validate.d.ts +12 -0
- package/dist/eval/ablation-validate.d.ts.map +1 -0
- package/dist/eval/ablation-validate.js +78 -0
- package/dist/eval/ablation-validate.js.map +1 -0
- package/dist/eval/ablation.d.ts +94 -0
- package/dist/eval/ablation.d.ts.map +1 -0
- package/dist/eval/ablation.js +161 -0
- package/dist/eval/ablation.js.map +1 -0
- package/dist/eval/ci-smoke.d.ts +11 -0
- package/dist/eval/ci-smoke.d.ts.map +1 -0
- package/dist/eval/ci-smoke.js +49 -0
- package/dist/eval/ci-smoke.js.map +1 -0
- package/dist/eval/diagnostics.d.ts +214 -0
- package/dist/eval/diagnostics.d.ts.map +1 -0
- package/dist/eval/diagnostics.js +107 -0
- package/dist/eval/diagnostics.js.map +1 -0
- package/dist/eval/index.d.ts +27 -0
- package/dist/eval/index.d.ts.map +1 -0
- package/dist/eval/index.js +27 -0
- package/dist/eval/index.js.map +1 -0
- package/dist/eval/live/alfworld.d.ts +248 -0
- package/dist/eval/live/alfworld.d.ts.map +1 -0
- package/dist/eval/live/alfworld.js +637 -0
- package/dist/eval/live/alfworld.js.map +1 -0
- package/dist/eval/live/alfworld_h1.d.ts +16 -0
- package/dist/eval/live/alfworld_h1.d.ts.map +1 -0
- package/dist/eval/live/alfworld_h1.js +75 -0
- package/dist/eval/live/alfworld_h1.js.map +1 -0
- package/dist/eval/live/alfworld_memory.d.ts +38 -0
- package/dist/eval/live/alfworld_memory.d.ts.map +1 -0
- package/dist/eval/live/alfworld_memory.js +184 -0
- package/dist/eval/live/alfworld_memory.js.map +1 -0
- package/dist/eval/live/alfworld_strategy.d.ts +65 -0
- package/dist/eval/live/alfworld_strategy.d.ts.map +1 -0
- package/dist/eval/live/alfworld_strategy.js +89 -0
- package/dist/eval/live/alfworld_strategy.js.map +1 -0
- package/dist/eval/live/azure-openai-llm-provider.d.ts +41 -0
- package/dist/eval/live/azure-openai-llm-provider.d.ts.map +1 -0
- package/dist/eval/live/azure-openai-llm-provider.js +92 -0
- package/dist/eval/live/azure-openai-llm-provider.js.map +1 -0
- package/dist/eval/live/bridges/skillflow_e2b_bridge.d.ts +3 -0
- package/dist/eval/live/bridges/skillflow_e2b_bridge.d.ts.map +1 -0
- package/dist/eval/live/bridges/skillflow_e2b_bridge.js +12 -0
- package/dist/eval/live/bridges/skillflow_e2b_bridge.js.map +1 -0
- package/dist/eval/live/claude-cli-llm-provider.d.ts +53 -0
- package/dist/eval/live/claude-cli-llm-provider.d.ts.map +1 -0
- package/dist/eval/live/claude-cli-llm-provider.js +71 -0
- package/dist/eval/live/claude-cli-llm-provider.js.map +1 -0
- package/dist/eval/live/claude-cli.d.ts +96 -0
- package/dist/eval/live/claude-cli.d.ts.map +1 -0
- package/dist/eval/live/claude-cli.js +314 -0
- package/dist/eval/live/claude-cli.js.map +1 -0
- package/dist/eval/live/claude-delegate.d.ts +41 -0
- package/dist/eval/live/claude-delegate.d.ts.map +1 -0
- package/dist/eval/live/claude-delegate.js +59 -0
- package/dist/eval/live/claude-delegate.js.map +1 -0
- package/dist/eval/live/claude-workspace-backend.d.ts +24 -0
- package/dist/eval/live/claude-workspace-backend.d.ts.map +1 -0
- package/dist/eval/live/claude-workspace-backend.js +76 -0
- package/dist/eval/live/claude-workspace-backend.js.map +1 -0
- package/dist/eval/live/clbench.d.ts +64 -0
- package/dist/eval/live/clbench.d.ts.map +1 -0
- package/dist/eval/live/clbench.js +291 -0
- package/dist/eval/live/clbench.js.map +1 -0
- package/dist/eval/live/cold-reuse.d.ts +21 -0
- package/dist/eval/live/cold-reuse.d.ts.map +1 -0
- package/dist/eval/live/cold-reuse.js +102 -0
- package/dist/eval/live/cold-reuse.js.map +1 -0
- package/dist/eval/live/difficulty-registry.d.ts +68 -0
- package/dist/eval/live/difficulty-registry.d.ts.map +1 -0
- package/dist/eval/live/difficulty-registry.js +169 -0
- package/dist/eval/live/difficulty-registry.js.map +1 -0
- package/dist/eval/live/docker.d.ts +52 -0
- package/dist/eval/live/docker.d.ts.map +1 -0
- package/dist/eval/live/docker.js +164 -0
- package/dist/eval/live/docker.js.map +1 -0
- package/dist/eval/live/env-bridge.d.ts +68 -0
- package/dist/eval/live/env-bridge.d.ts.map +1 -0
- package/dist/eval/live/env-bridge.js +188 -0
- package/dist/eval/live/env-bridge.js.map +1 -0
- package/dist/eval/live/gsm8k.d.ts +44 -0
- package/dist/eval/live/gsm8k.d.ts.map +1 -0
- package/dist/eval/live/gsm8k.js +142 -0
- package/dist/eval/live/gsm8k.js.map +1 -0
- package/dist/eval/live/index.d.ts +38 -0
- package/dist/eval/live/index.d.ts.map +1 -0
- package/dist/eval/live/index.js +38 -0
- package/dist/eval/live/index.js.map +1 -0
- package/dist/eval/live/lifelongagent.d.ts +64 -0
- package/dist/eval/live/lifelongagent.d.ts.map +1 -0
- package/dist/eval/live/lifelongagent.js +216 -0
- package/dist/eval/live/lifelongagent.js.map +1 -0
- package/dist/eval/live/lift-registry.d.ts +128 -0
- package/dist/eval/live/lift-registry.d.ts.map +1 -0
- package/dist/eval/live/lift-registry.js +147 -0
- package/dist/eval/live/lift-registry.js.map +1 -0
- package/dist/eval/live/live-benchmark.d.ts +84 -0
- package/dist/eval/live/live-benchmark.d.ts.map +1 -0
- package/dist/eval/live/live-benchmark.js +2 -0
- package/dist/eval/live/live-benchmark.js.map +1 -0
- package/dist/eval/live/live-runner.d.ts +609 -0
- package/dist/eval/live/live-runner.d.ts.map +1 -0
- package/dist/eval/live/live-runner.js +1409 -0
- package/dist/eval/live/live-runner.js.map +1 -0
- package/dist/eval/live/refine.d.ts +88 -0
- package/dist/eval/live/refine.d.ts.map +1 -0
- package/dist/eval/live/refine.js +135 -0
- package/dist/eval/live/refine.js.map +1 -0
- package/dist/eval/live/registry-store.d.ts +109 -0
- package/dist/eval/live/registry-store.d.ts.map +1 -0
- package/dist/eval/live/registry-store.js +272 -0
- package/dist/eval/live/registry-store.js.map +1 -0
- package/dist/eval/live/run-checkpoint.d.ts +55 -0
- package/dist/eval/live/run-checkpoint.d.ts.map +1 -0
- package/dist/eval/live/run-checkpoint.js +86 -0
- package/dist/eval/live/run-checkpoint.js.map +1 -0
- package/dist/eval/live/run-resume.d.ts +22 -0
- package/dist/eval/live/run-resume.d.ts.map +1 -0
- package/dist/eval/live/run-resume.js +70 -0
- package/dist/eval/live/run-resume.js.map +1 -0
- package/dist/eval/live/skill-injector.d.ts +36 -0
- package/dist/eval/live/skill-injector.d.ts.map +1 -0
- package/dist/eval/live/skill-injector.js +81 -0
- package/dist/eval/live/skill-injector.js.map +1 -0
- package/dist/eval/live/skillflow-embedded-workbook-bundle.d.ts +3 -0
- package/dist/eval/live/skillflow-embedded-workbook-bundle.d.ts.map +1 -0
- package/dist/eval/live/skillflow-embedded-workbook-bundle.js +391 -0
- package/dist/eval/live/skillflow-embedded-workbook-bundle.js.map +1 -0
- package/dist/eval/live/skillflow.d.ts +154 -0
- package/dist/eval/live/skillflow.d.ts.map +1 -0
- package/dist/eval/live/skillflow.js +612 -0
- package/dist/eval/live/skillflow.js.map +1 -0
- package/dist/eval/live/skilllearnbench.d.ts +43 -0
- package/dist/eval/live/skilllearnbench.d.ts.map +1 -0
- package/dist/eval/live/skilllearnbench.js +154 -0
- package/dist/eval/live/skilllearnbench.js.map +1 -0
- package/dist/eval/live/skillopt_v1.d.ts +96 -0
- package/dist/eval/live/skillopt_v1.d.ts.map +1 -0
- package/dist/eval/live/skillopt_v1.js +0 -0
- package/dist/eval/live/skillopt_v1.js.map +1 -0
- package/dist/eval/live/skillopt_v1_causal.d.ts +26 -0
- package/dist/eval/live/skillopt_v1_causal.d.ts.map +1 -0
- package/dist/eval/live/skillopt_v1_causal.js +106 -0
- package/dist/eval/live/skillopt_v1_causal.js.map +1 -0
- package/dist/eval/live/skillopt_v1_memory.d.ts +53 -0
- package/dist/eval/live/skillopt_v1_memory.d.ts.map +1 -0
- package/dist/eval/live/skillopt_v1_memory.js +147 -0
- package/dist/eval/live/skillopt_v1_memory.js.map +1 -0
- package/dist/eval/live/skillopt_v1_rules.d.ts +39 -0
- package/dist/eval/live/skillopt_v1_rules.d.ts.map +1 -0
- package/dist/eval/live/skillopt_v1_rules.js +91 -0
- package/dist/eval/live/skillopt_v1_rules.js.map +1 -0
- package/dist/eval/live/skillsbench.d.ts +138 -0
- package/dist/eval/live/skillsbench.d.ts.map +1 -0
- package/dist/eval/live/skillsbench.js +626 -0
- package/dist/eval/live/skillsbench.js.map +1 -0
- package/dist/eval/live/stopping.d.ts +69 -0
- package/dist/eval/live/stopping.d.ts.map +1 -0
- package/dist/eval/live/stopping.js +213 -0
- package/dist/eval/live/stopping.js.map +1 -0
- package/dist/eval/live/trace.d.ts +20 -0
- package/dist/eval/live/trace.d.ts.map +1 -0
- package/dist/eval/live/trace.js +41 -0
- package/dist/eval/live/trace.js.map +1 -0
- package/dist/eval/mechanism-trace-adapter.d.ts +8 -0
- package/dist/eval/mechanism-trace-adapter.d.ts.map +1 -0
- package/dist/eval/mechanism-trace-adapter.js +118 -0
- package/dist/eval/mechanism-trace-adapter.js.map +1 -0
- package/dist/eval/memory-ab.d.ts +61 -0
- package/dist/eval/memory-ab.d.ts.map +1 -0
- package/dist/eval/memory-ab.js +161 -0
- package/dist/eval/memory-ab.js.map +1 -0
- package/dist/eval/memory-mock.d.ts +54 -0
- package/dist/eval/memory-mock.d.ts.map +1 -0
- package/dist/eval/memory-mock.js +129 -0
- package/dist/eval/memory-mock.js.map +1 -0
- package/dist/eval/memory-qa/index.d.ts +13 -0
- package/dist/eval/memory-qa/index.d.ts.map +1 -0
- package/dist/eval/memory-qa/index.js +13 -0
- package/dist/eval/memory-qa/index.js.map +1 -0
- package/dist/eval/memory-qa/iterative.d.ts +80 -0
- package/dist/eval/memory-qa/iterative.d.ts.map +1 -0
- package/dist/eval/memory-qa/iterative.js +107 -0
- package/dist/eval/memory-qa/iterative.js.map +1 -0
- package/dist/eval/memory-qa/loaders.d.ts +11 -0
- package/dist/eval/memory-qa/loaders.d.ts.map +1 -0
- package/dist/eval/memory-qa/loaders.js +21 -0
- package/dist/eval/memory-qa/loaders.js.map +1 -0
- package/dist/eval/memory-qa/metrics.d.ts +3 -0
- package/dist/eval/memory-qa/metrics.d.ts.map +1 -0
- package/dist/eval/memory-qa/metrics.js +2 -0
- package/dist/eval/memory-qa/metrics.js.map +1 -0
- package/dist/eval/memory-qa/qa.d.ts +186 -0
- package/dist/eval/memory-qa/qa.d.ts.map +1 -0
- package/dist/eval/memory-qa/qa.js +424 -0
- package/dist/eval/memory-qa/qa.js.map +1 -0
- package/dist/eval/memory-qa/retrieval.d.ts +33 -0
- package/dist/eval/memory-qa/retrieval.d.ts.map +1 -0
- package/dist/eval/memory-qa/retrieval.js +44 -0
- package/dist/eval/memory-qa/retrieval.js.map +1 -0
- package/dist/eval/memory-qa/serving.d.ts +60 -0
- package/dist/eval/memory-qa/serving.d.ts.map +1 -0
- package/dist/eval/memory-qa/serving.js +267 -0
- package/dist/eval/memory-qa/serving.js.map +1 -0
- package/dist/eval/memory-qa/types.d.ts +2 -0
- package/dist/eval/memory-qa/types.d.ts.map +1 -0
- package/dist/eval/memory-qa/types.js +2 -0
- package/dist/eval/memory-qa/types.js.map +1 -0
- package/dist/eval/metrics.d.ts +120 -0
- package/dist/eval/metrics.d.ts.map +1 -0
- package/dist/eval/metrics.js +361 -0
- package/dist/eval/metrics.js.map +1 -0
- package/dist/eval/oracle-smoke.d.ts +75 -0
- package/dist/eval/oracle-smoke.d.ts.map +1 -0
- package/dist/eval/oracle-smoke.js +143 -0
- package/dist/eval/oracle-smoke.js.map +1 -0
- package/dist/eval/playbook-calibration-report.d.ts +40 -0
- package/dist/eval/playbook-calibration-report.d.ts.map +1 -0
- package/dist/eval/playbook-calibration-report.js +246 -0
- package/dist/eval/playbook-calibration-report.js.map +1 -0
- package/dist/eval/playbook-candidate-decisions-report.d.ts +36 -0
- package/dist/eval/playbook-candidate-decisions-report.d.ts.map +1 -0
- package/dist/eval/playbook-candidate-decisions-report.js +201 -0
- package/dist/eval/playbook-candidate-decisions-report.js.map +1 -0
- package/dist/eval/playbook-usage-report.d.ts +7 -0
- package/dist/eval/playbook-usage-report.d.ts.map +1 -0
- package/dist/eval/playbook-usage-report.js +222 -0
- package/dist/eval/playbook-usage-report.js.map +1 -0
- package/dist/eval/report.d.ts +28 -0
- package/dist/eval/report.d.ts.map +1 -0
- package/dist/eval/report.js +567 -0
- package/dist/eval/report.js.map +1 -0
- package/dist/eval/retrieval/corpus.d.ts +41 -0
- package/dist/eval/retrieval/corpus.d.ts.map +1 -0
- package/dist/eval/retrieval/corpus.js +158 -0
- package/dist/eval/retrieval/corpus.js.map +1 -0
- package/dist/eval/retrieval/index.d.ts +12 -0
- package/dist/eval/retrieval/index.d.ts.map +1 -0
- package/dist/eval/retrieval/index.js +14 -0
- package/dist/eval/retrieval/index.js.map +1 -0
- package/dist/eval/retrieval/knowledge-corpus.d.ts +91 -0
- package/dist/eval/retrieval/knowledge-corpus.d.ts.map +1 -0
- package/dist/eval/retrieval/knowledge-corpus.js +268 -0
- package/dist/eval/retrieval/knowledge-corpus.js.map +1 -0
- package/dist/eval/retrieval/knowledge-quality.d.ts +91 -0
- package/dist/eval/retrieval/knowledge-quality.d.ts.map +1 -0
- package/dist/eval/retrieval/knowledge-quality.js +247 -0
- package/dist/eval/retrieval/knowledge-quality.js.map +1 -0
- package/dist/eval/retrieval/ladder.d.ts +69 -0
- package/dist/eval/retrieval/ladder.d.ts.map +1 -0
- package/dist/eval/retrieval/ladder.js +80 -0
- package/dist/eval/retrieval/ladder.js.map +1 -0
- package/dist/eval/retrieval/quality.d.ts +39 -0
- package/dist/eval/retrieval/quality.d.ts.map +1 -0
- package/dist/eval/retrieval/quality.js +75 -0
- package/dist/eval/retrieval/quality.js.map +1 -0
- package/dist/eval/rng.d.ts +25 -0
- package/dist/eval/rng.d.ts.map +1 -0
- package/dist/eval/rng.js +43 -0
- package/dist/eval/rng.js.map +1 -0
- package/dist/eval/runner.d.ts +65 -0
- package/dist/eval/runner.d.ts.map +1 -0
- package/dist/eval/runner.js +216 -0
- package/dist/eval/runner.js.map +1 -0
- package/dist/eval/skill-bundle.d.ts +18 -0
- package/dist/eval/skill-bundle.d.ts.map +1 -0
- package/dist/eval/skill-bundle.js +38 -0
- package/dist/eval/skill-bundle.js.map +1 -0
- package/dist/eval/swarmkit-report.d.ts +21 -0
- package/dist/eval/swarmkit-report.d.ts.map +1 -0
- package/dist/eval/swarmkit-report.js +93 -0
- package/dist/eval/swarmkit-report.js.map +1 -0
- package/dist/eval/task-stream.d.ts +22 -0
- package/dist/eval/task-stream.d.ts.map +1 -0
- package/dist/eval/task-stream.js +99 -0
- package/dist/eval/task-stream.js.map +1 -0
- package/dist/eval/types.d.ts +173 -0
- package/dist/eval/types.d.ts.map +1 -0
- package/dist/eval/types.js +11 -0
- package/dist/eval/types.js.map +1 -0
- package/dist/experimental/causal-store.d.ts +97 -0
- package/dist/experimental/causal-store.d.ts.map +1 -0
- package/dist/experimental/causal-store.js +213 -0
- package/dist/experimental/causal-store.js.map +1 -0
- package/dist/experimental/graph-layers/base.d.ts +29 -0
- package/dist/experimental/graph-layers/base.d.ts.map +1 -0
- package/dist/experimental/graph-layers/base.js +143 -0
- package/dist/experimental/graph-layers/base.js.map +1 -0
- package/dist/experimental/graph-layers/causal.d.ts +14 -0
- package/dist/experimental/graph-layers/causal.d.ts.map +1 -0
- package/dist/experimental/graph-layers/causal.js +14 -0
- package/dist/experimental/graph-layers/causal.js.map +1 -0
- package/dist/experimental/graph-layers/entity.d.ts +14 -0
- package/dist/experimental/graph-layers/entity.d.ts.map +1 -0
- package/dist/experimental/graph-layers/entity.js +14 -0
- package/dist/experimental/graph-layers/entity.js.map +1 -0
- package/dist/experimental/graph-layers/index.d.ts +6 -0
- package/dist/experimental/graph-layers/index.d.ts.map +1 -0
- package/dist/experimental/graph-layers/index.js +6 -0
- package/dist/experimental/graph-layers/index.js.map +1 -0
- package/dist/experimental/graph-layers/semantic.d.ts +14 -0
- package/dist/experimental/graph-layers/semantic.d.ts.map +1 -0
- package/dist/experimental/graph-layers/semantic.js +14 -0
- package/dist/experimental/graph-layers/semantic.js.map +1 -0
- package/dist/experimental/graph-layers/temporal.d.ts +14 -0
- package/dist/experimental/graph-layers/temporal.d.ts.map +1 -0
- package/dist/experimental/graph-layers/temporal.js +14 -0
- package/dist/experimental/graph-layers/temporal.js.map +1 -0
- package/dist/experimental/healing-orchestrator.d.ts +182 -0
- package/dist/experimental/healing-orchestrator.d.ts.map +1 -0
- package/dist/experimental/healing-orchestrator.js +250 -0
- package/dist/experimental/healing-orchestrator.js.map +1 -0
- package/dist/experimental/knowledge-graph-types.d.ts +148 -0
- package/dist/experimental/knowledge-graph-types.d.ts.map +1 -0
- package/dist/experimental/knowledge-graph-types.js +40 -0
- package/dist/experimental/knowledge-graph-types.js.map +1 -0
- package/dist/experimental/knowledge-graph.d.ts +41 -0
- package/dist/experimental/knowledge-graph.d.ts.map +1 -0
- package/dist/experimental/knowledge-graph.js +270 -0
- package/dist/experimental/knowledge-graph.js.map +1 -0
- package/dist/experimental/meta-reflection.d.ts +47 -0
- package/dist/experimental/meta-reflection.d.ts.map +1 -0
- package/dist/experimental/meta-reflection.js +143 -0
- package/dist/experimental/meta-reflection.js.map +1 -0
- package/dist/experimental/moe-gate.d.ts +134 -0
- package/dist/experimental/moe-gate.d.ts.map +1 -0
- package/dist/experimental/moe-gate.js +240 -0
- package/dist/experimental/moe-gate.js.map +1 -0
- package/dist/experimental/reasoning-bank.d.ts +130 -0
- package/dist/experimental/reasoning-bank.d.ts.map +1 -0
- package/dist/experimental/reasoning-bank.js +427 -0
- package/dist/experimental/reasoning-bank.js.map +1 -0
- package/dist/experimental/team/team-config.d.ts +127 -0
- package/dist/experimental/team/team-config.d.ts.map +1 -0
- package/dist/experimental/team/team-config.js +48 -0
- package/dist/experimental/team/team-config.js.map +1 -0
- package/dist/experimental/team/team-experience.d.ts +300 -0
- package/dist/experimental/team/team-experience.d.ts.map +1 -0
- package/dist/experimental/team/team-experience.js +355 -0
- package/dist/experimental/team/team-experience.js.map +1 -0
- package/dist/experimental/team/team-ingester.d.ts +152 -0
- package/dist/experimental/team/team-ingester.d.ts.map +1 -0
- package/dist/experimental/team/team-ingester.js +330 -0
- package/dist/experimental/team/team-ingester.js.map +1 -0
- package/dist/experimental/team/team-meta-learner.d.ts +51 -0
- package/dist/experimental/team/team-meta-learner.d.ts.map +1 -0
- package/dist/experimental/team/team-meta-learner.js +404 -0
- package/dist/experimental/team/team-meta-learner.js.map +1 -0
- package/dist/experimental/team/team-meta.d.ts +160 -0
- package/dist/experimental/team/team-meta.d.ts.map +1 -0
- package/dist/experimental/team/team-meta.js +42 -0
- package/dist/experimental/team/team-meta.js.map +1 -0
- package/dist/experimental/team/team-pipeline.d.ts +77 -0
- package/dist/experimental/team/team-pipeline.d.ts.map +1 -0
- package/dist/experimental/team/team-pipeline.js +262 -0
- package/dist/experimental/team/team-pipeline.js.map +1 -0
- package/dist/experimental/team/team-playbook-extraction.d.ts +45 -0
- package/dist/experimental/team/team-playbook-extraction.d.ts.map +1 -0
- package/dist/experimental/team/team-playbook-extraction.js +526 -0
- package/dist/experimental/team/team-playbook-extraction.js.map +1 -0
- package/dist/experimental/team/team-playbook.d.ts +276 -0
- package/dist/experimental/team/team-playbook.d.ts.map +1 -0
- package/dist/experimental/team/team-playbook.js +85 -0
- package/dist/experimental/team/team-playbook.js.map +1 -0
- package/dist/experimental/team/team-router.d.ts +98 -0
- package/dist/experimental/team/team-router.d.ts.map +1 -0
- package/dist/experimental/team/team-router.js +312 -0
- package/dist/experimental/team/team-router.js.map +1 -0
- package/dist/experimental/team/team-skill-library.d.ts +180 -0
- package/dist/experimental/team/team-skill-library.d.ts.map +1 -0
- package/dist/experimental/team/team-skill-library.js +385 -0
- package/dist/experimental/team/team-skill-library.js.map +1 -0
- package/dist/experimental/team/team-trajectory-analysis.d.ts +19 -0
- package/dist/experimental/team/team-trajectory-analysis.d.ts.map +1 -0
- package/dist/experimental/team/team-trajectory-analysis.js +442 -0
- package/dist/experimental/team/team-trajectory-analysis.js.map +1 -0
- package/dist/experimental/team/team-trajectory.d.ts +305 -0
- package/dist/experimental/team/team-trajectory.d.ts.map +1 -0
- package/dist/experimental/team/team-trajectory.js +315 -0
- package/dist/experimental/team/team-trajectory.js.map +1 -0
- package/dist/factory.d.ts +2 -3
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +12 -11
- package/dist/factory.js.map +1 -1
- package/dist/index.d.ts +9 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -32
- package/dist/index.js.map +1 -1
- package/dist/learning/analyzer.d.ts +26 -36
- package/dist/learning/analyzer.d.ts.map +1 -1
- package/dist/learning/analyzer.js +50 -11
- package/dist/learning/analyzer.js.map +1 -1
- package/dist/learning/compound-bootstrap/external-acquisition.d.ts +63 -0
- package/dist/learning/compound-bootstrap/external-acquisition.d.ts.map +1 -0
- package/dist/learning/compound-bootstrap/external-acquisition.js +255 -0
- package/dist/learning/compound-bootstrap/external-acquisition.js.map +1 -0
- package/dist/learning/compound-bootstrap/index.d.ts +3 -0
- package/dist/learning/compound-bootstrap/index.d.ts.map +1 -0
- package/dist/learning/compound-bootstrap/index.js +3 -0
- package/dist/learning/compound-bootstrap/index.js.map +1 -0
- package/dist/learning/compound-bootstrap/workspace-analyzer.d.ts +33 -0
- package/dist/learning/compound-bootstrap/workspace-analyzer.d.ts.map +1 -0
- package/dist/learning/compound-bootstrap/workspace-analyzer.js +379 -0
- package/dist/learning/compound-bootstrap/workspace-analyzer.js.map +1 -0
- package/dist/learning/consolidation-coordinator.d.ts +49 -0
- package/dist/learning/consolidation-coordinator.d.ts.map +1 -0
- package/dist/learning/consolidation-coordinator.js +75 -0
- package/dist/learning/consolidation-coordinator.js.map +1 -0
- package/dist/learning/convention-distiller.d.ts +84 -0
- package/dist/learning/convention-distiller.d.ts.map +1 -0
- package/dist/learning/convention-distiller.js +268 -0
- package/dist/learning/convention-distiller.js.map +1 -0
- package/dist/learning/distiller.d.ts +82 -0
- package/dist/learning/distiller.d.ts.map +1 -0
- package/dist/learning/distiller.js +353 -0
- package/dist/learning/distiller.js.map +1 -0
- package/dist/learning/effectiveness.d.ts +12 -2
- package/dist/learning/effectiveness.d.ts.map +1 -1
- package/dist/learning/effectiveness.js +18 -14
- package/dist/learning/effectiveness.js.map +1 -1
- package/dist/learning/escalation.d.ts +89 -0
- package/dist/learning/escalation.d.ts.map +1 -0
- package/dist/learning/escalation.js +168 -0
- package/dist/learning/escalation.js.map +1 -0
- package/dist/learning/external-exposure.d.ts +57 -0
- package/dist/learning/external-exposure.d.ts.map +1 -0
- package/dist/learning/external-exposure.js +95 -0
- package/dist/learning/external-exposure.js.map +1 -0
- package/dist/learning/gepa-proposer.d.ts +116 -0
- package/dist/learning/gepa-proposer.d.ts.map +1 -0
- package/dist/learning/gepa-proposer.js +258 -0
- package/dist/learning/gepa-proposer.js.map +1 -0
- package/dist/learning/index.d.ts +21 -8
- package/dist/learning/index.d.ts.map +1 -1
- package/dist/learning/index.js +28 -10
- package/dist/learning/index.js.map +1 -1
- package/dist/learning/instant-loop.d.ts +46 -16
- package/dist/learning/instant-loop.d.ts.map +1 -1
- package/dist/learning/instant-loop.js +114 -111
- package/dist/learning/instant-loop.js.map +1 -1
- package/dist/learning/knowledge-extractor.d.ts.map +1 -1
- package/dist/learning/knowledge-extractor.js +1 -2
- package/dist/learning/knowledge-extractor.js.map +1 -1
- package/dist/learning/llm-extractor.d.ts +88 -0
- package/dist/learning/llm-extractor.d.ts.map +1 -0
- package/dist/learning/llm-extractor.js +372 -0
- package/dist/learning/llm-extractor.js.map +1 -0
- package/dist/learning/loop-coordinator.d.ts +61 -0
- package/dist/learning/loop-coordinator.d.ts.map +1 -0
- package/dist/learning/loop-coordinator.js +96 -0
- package/dist/learning/loop-coordinator.js.map +1 -0
- package/dist/learning/maintenance-scheduler.d.ts +15 -4
- package/dist/learning/maintenance-scheduler.d.ts.map +1 -1
- package/dist/learning/maintenance-scheduler.js +19 -16
- package/dist/learning/maintenance-scheduler.js.map +1 -1
- package/dist/learning/mechanism-trace.d.ts +196 -0
- package/dist/learning/mechanism-trace.d.ts.map +1 -0
- package/dist/learning/mechanism-trace.js +81 -0
- package/dist/learning/mechanism-trace.js.map +1 -0
- package/dist/learning/merge-proposer.d.ts +102 -0
- package/dist/learning/merge-proposer.d.ts.map +1 -0
- package/dist/learning/merge-proposer.js +253 -0
- package/dist/learning/merge-proposer.js.map +1 -0
- package/dist/learning/meta-learner.d.ts +9 -7
- package/dist/learning/meta-learner.d.ts.map +1 -1
- package/dist/learning/meta-learner.js +16 -45
- package/dist/learning/meta-learner.js.map +1 -1
- package/dist/learning/mutation-gate.d.ts +218 -0
- package/dist/learning/mutation-gate.d.ts.map +1 -0
- package/dist/learning/mutation-gate.js +390 -0
- package/dist/learning/mutation-gate.js.map +1 -0
- package/dist/learning/oracle-signal.d.ts +67 -0
- package/dist/learning/oracle-signal.d.ts.map +1 -0
- package/dist/learning/oracle-signal.js +94 -0
- package/dist/learning/oracle-signal.js.map +1 -0
- package/dist/learning/pipeline.d.ts +31 -4
- package/dist/learning/pipeline.d.ts.map +1 -1
- package/dist/learning/pipeline.js +64 -12
- package/dist/learning/pipeline.js.map +1 -1
- package/dist/learning/playbook-extractor.d.ts +8 -0
- package/dist/learning/playbook-extractor.d.ts.map +1 -1
- package/dist/learning/playbook-extractor.js +119 -34
- package/dist/learning/playbook-extractor.js.map +1 -1
- package/dist/learning/playbook-optimizer.d.ts +37 -0
- package/dist/learning/playbook-optimizer.d.ts.map +1 -0
- package/dist/learning/playbook-optimizer.js +125 -0
- package/dist/learning/playbook-optimizer.js.map +1 -0
- package/dist/learning/reflective-proposer.d.ts +173 -0
- package/dist/learning/reflective-proposer.d.ts.map +1 -0
- package/dist/learning/reflective-proposer.js +354 -0
- package/dist/learning/reflective-proposer.js.map +1 -0
- package/dist/learning/reflexion-generator.d.ts.map +1 -1
- package/dist/learning/reflexion-generator.js +4 -3
- package/dist/learning/reflexion-generator.js.map +1 -1
- package/dist/learning/replay-executor.d.ts +64 -0
- package/dist/learning/replay-executor.d.ts.map +1 -0
- package/dist/learning/replay-executor.js +92 -0
- package/dist/learning/replay-executor.js.map +1 -0
- package/dist/learning/replay-types.d.ts +150 -0
- package/dist/learning/replay-types.d.ts.map +1 -0
- package/dist/learning/replay-types.js +207 -0
- package/dist/learning/replay-types.js.map +1 -0
- package/dist/learning/replay.d.ts +166 -0
- package/dist/learning/replay.d.ts.map +1 -0
- package/dist/learning/replay.js +228 -0
- package/dist/learning/replay.js.map +1 -0
- package/dist/learning/seed-report.d.ts +88 -0
- package/dist/learning/seed-report.d.ts.map +1 -0
- package/dist/learning/seed-report.js +120 -0
- package/dist/learning/seed-report.js.map +1 -0
- package/dist/learning/trajectory-sources/dataclaw.d.ts.map +1 -1
- package/dist/learning/trajectory-sources/dataclaw.js +6 -18
- package/dist/learning/trajectory-sources/dataclaw.js.map +1 -1
- package/dist/learning/trajectory-sources/entire.d.ts.map +1 -1
- package/dist/learning/trajectory-sources/entire.js +30 -9
- package/dist/learning/trajectory-sources/entire.js.map +1 -1
- package/dist/learning/trajectory-sources/file.d.ts.map +1 -1
- package/dist/learning/trajectory-sources/file.js.map +1 -1
- package/dist/learning/trajectory-sources/huggingface.d.ts.map +1 -1
- package/dist/learning/trajectory-sources/huggingface.js +7 -7
- package/dist/learning/trajectory-sources/huggingface.js.map +1 -1
- package/dist/learning/trajectory-sources/in-memory.d.ts.map +1 -1
- package/dist/learning/trajectory-sources/in-memory.js.map +1 -1
- package/dist/learning/trajectory-sources/index.d.ts +3 -4
- package/dist/learning/trajectory-sources/index.d.ts.map +1 -1
- package/dist/learning/trajectory-sources/index.js +3 -4
- package/dist/learning/trajectory-sources/index.js.map +1 -1
- package/dist/learning/trajectory-sources/pipeline.d.ts +4 -3
- package/dist/learning/trajectory-sources/pipeline.d.ts.map +1 -1
- package/dist/learning/trajectory-sources/pipeline.js +4 -3
- package/dist/learning/trajectory-sources/pipeline.js.map +1 -1
- package/dist/learning/unified-pipeline.d.ts +486 -61
- package/dist/learning/unified-pipeline.d.ts.map +1 -1
- package/dist/learning/unified-pipeline.js +1501 -232
- package/dist/learning/unified-pipeline.js.map +1 -1
- package/dist/learning/usage-inference.d.ts.map +1 -1
- package/dist/learning/usage-inference.js +4 -9
- package/dist/learning/usage-inference.js.map +1 -1
- package/dist/learning/workspace-snapshot.d.ts +146 -0
- package/dist/learning/workspace-snapshot.d.ts.map +1 -0
- package/dist/learning/workspace-snapshot.js +269 -0
- package/dist/learning/workspace-snapshot.js.map +1 -0
- package/dist/mcp/playbook-server.d.ts +61 -2
- package/dist/mcp/playbook-server.d.ts.map +1 -1
- package/dist/mcp/playbook-server.js +179 -9
- package/dist/mcp/playbook-server.js.map +1 -1
- package/dist/memory/coherence.d.ts.map +1 -1
- package/dist/memory/coherence.js +5 -7
- package/dist/memory/coherence.js.map +1 -1
- package/dist/memory/curated-loader.d.ts +24 -0
- package/dist/memory/curated-loader.d.ts.map +1 -1
- package/dist/memory/curated-loader.js +22 -5
- package/dist/memory/curated-loader.js.map +1 -1
- package/dist/memory/evolution/llm-evolver.d.ts +36 -0
- package/dist/memory/evolution/llm-evolver.d.ts.map +1 -0
- package/dist/memory/evolution/llm-evolver.js +106 -0
- package/dist/memory/evolution/llm-evolver.js.map +1 -0
- package/dist/memory/experience.d.ts +34 -13
- package/dist/memory/experience.d.ts.map +1 -1
- package/dist/memory/experience.js +59 -48
- package/dist/memory/experience.js.map +1 -1
- package/dist/memory/extraction/conversation-extractor.d.ts +62 -0
- package/dist/memory/extraction/conversation-extractor.d.ts.map +1 -0
- package/dist/memory/extraction/conversation-extractor.js +169 -0
- package/dist/memory/extraction/conversation-extractor.js.map +1 -0
- package/dist/memory/filesystem-cascade.d.ts +116 -0
- package/dist/memory/filesystem-cascade.d.ts.map +1 -0
- package/dist/memory/filesystem-cascade.js +221 -0
- package/dist/memory/filesystem-cascade.js.map +1 -0
- package/dist/memory/index.d.ts +14 -10
- package/dist/memory/index.d.ts.map +1 -1
- package/dist/memory/index.js +15 -12
- package/dist/memory/index.js.map +1 -1
- package/dist/memory/knowledge-bank.d.ts +145 -29
- package/dist/memory/knowledge-bank.d.ts.map +1 -1
- package/dist/memory/knowledge-bank.js +511 -200
- package/dist/memory/knowledge-bank.js.map +1 -1
- package/dist/memory/knowledge-defrag.d.ts +32 -9
- package/dist/memory/knowledge-defrag.d.ts.map +1 -1
- package/dist/memory/knowledge-defrag.js +57 -49
- package/dist/memory/knowledge-defrag.js.map +1 -1
- package/dist/memory/meta-playbook-bank.d.ts +24 -0
- package/dist/memory/meta-playbook-bank.d.ts.map +1 -0
- package/dist/memory/meta-playbook-bank.js +135 -0
- package/dist/memory/meta-playbook-bank.js.map +1 -0
- package/dist/memory/meta.d.ts.map +1 -1
- package/dist/memory/meta.js +33 -14
- package/dist/memory/meta.js.map +1 -1
- package/dist/memory/playbook-applicability.d.ts +43 -0
- package/dist/memory/playbook-applicability.d.ts.map +1 -0
- package/dist/memory/playbook-applicability.js +155 -0
- package/dist/memory/playbook-applicability.js.map +1 -0
- package/dist/memory/playbook-incorporation.d.ts +24 -0
- package/dist/memory/playbook-incorporation.d.ts.map +1 -0
- package/dist/memory/playbook-incorporation.js +41 -0
- package/dist/memory/playbook-incorporation.js.map +1 -0
- package/dist/memory/playbook.d.ts +444 -7
- package/dist/memory/playbook.d.ts.map +1 -1
- package/dist/memory/playbook.js +1231 -50
- package/dist/memory/playbook.js.map +1 -1
- package/dist/memory/procedural-skill.d.ts +142 -0
- package/dist/memory/procedural-skill.d.ts.map +1 -0
- package/dist/memory/procedural-skill.js +846 -0
- package/dist/memory/procedural-skill.js.map +1 -0
- package/dist/memory/search-provider.d.ts +8 -3
- package/dist/memory/search-provider.d.ts.map +1 -1
- package/dist/memory/search-providers/embedding.d.ts +64 -0
- package/dist/memory/search-providers/embedding.d.ts.map +1 -0
- package/dist/memory/search-providers/embedding.js +96 -0
- package/dist/memory/search-providers/embedding.js.map +1 -0
- package/dist/memory/search-providers/hybrid.d.ts +74 -0
- package/dist/memory/search-providers/hybrid.d.ts.map +1 -0
- package/dist/memory/search-providers/hybrid.js +94 -0
- package/dist/memory/search-providers/hybrid.js.map +1 -0
- package/dist/memory/search-providers/index.d.ts +3 -0
- package/dist/memory/search-providers/index.d.ts.map +1 -1
- package/dist/memory/search-providers/index.js +3 -0
- package/dist/memory/search-providers/index.js.map +1 -1
- package/dist/memory/search-providers/keyword-expanding.d.ts +22 -0
- package/dist/memory/search-providers/keyword-expanding.d.ts.map +1 -0
- package/dist/memory/search-providers/keyword-expanding.js +35 -0
- package/dist/memory/search-providers/keyword-expanding.js.map +1 -0
- package/dist/memory/search-providers/minimem.d.ts +16 -4
- package/dist/memory/search-providers/minimem.d.ts.map +1 -1
- package/dist/memory/search-providers/minimem.js +14 -3
- package/dist/memory/search-providers/minimem.js.map +1 -1
- package/dist/memory/search-providers/text-similarity.d.ts +2 -4
- package/dist/memory/search-providers/text-similarity.d.ts.map +1 -1
- package/dist/memory/search-providers/text-similarity.js.map +1 -1
- package/dist/memory/seeds/meta-playbook-seeds.d.ts +27 -0
- package/dist/memory/seeds/meta-playbook-seeds.d.ts.map +1 -0
- package/dist/memory/seeds/meta-playbook-seeds.js +560 -0
- package/dist/memory/seeds/meta-playbook-seeds.js.map +1 -0
- package/dist/memory/seeds/meta-strategy-seeds.d.ts +23 -0
- package/dist/memory/seeds/meta-strategy-seeds.d.ts.map +1 -0
- package/dist/memory/seeds/meta-strategy-seeds.js +82 -0
- package/dist/memory/seeds/meta-strategy-seeds.js.map +1 -0
- package/dist/memory/seeds/seed-loader.d.ts +34 -0
- package/dist/memory/seeds/seed-loader.d.ts.map +1 -0
- package/dist/memory/seeds/seed-loader.js +60 -0
- package/dist/memory/seeds/seed-loader.js.map +1 -0
- package/dist/memory/skill-exporter.d.ts.map +1 -1
- package/dist/memory/skill-exporter.js +1 -2
- package/dist/memory/skill-exporter.js.map +1 -1
- package/dist/memory/source-resolver.d.ts.map +1 -1
- package/dist/memory/source-resolver.js +7 -8
- package/dist/memory/source-resolver.js.map +1 -1
- package/dist/memory/system.d.ts +119 -14
- package/dist/memory/system.d.ts.map +1 -1
- package/dist/memory/system.js +416 -60
- package/dist/memory/system.js.map +1 -1
- package/dist/memory/temporal-compressor.d.ts +1 -1
- package/dist/memory/temporal-compressor.d.ts.map +1 -1
- package/dist/memory/temporal-compressor.js +26 -16
- package/dist/memory/temporal-compressor.js.map +1 -1
- package/dist/persistence/index.d.ts +2 -2
- package/dist/persistence/index.d.ts.map +1 -1
- package/dist/persistence/index.js +1 -1
- package/dist/persistence/index.js.map +1 -1
- package/dist/persistence/migrator.d.ts +34 -1
- package/dist/persistence/migrator.d.ts.map +1 -1
- package/dist/persistence/migrator.js +163 -33
- package/dist/persistence/migrator.js.map +1 -1
- package/dist/persistence/sqlite-persistence.d.ts +412 -1
- package/dist/persistence/sqlite-persistence.d.ts.map +1 -1
- package/dist/persistence/sqlite-persistence.js +1038 -47
- package/dist/persistence/sqlite-persistence.js.map +1 -1
- package/dist/runtime/backends/acp-protocol.d.ts.map +1 -1
- package/dist/runtime/backends/acp-protocol.js +2 -1
- package/dist/runtime/backends/acp-protocol.js.map +1 -1
- package/dist/runtime/backends/acp.d.ts.map +1 -1
- package/dist/runtime/backends/acp.js +5 -4
- package/dist/runtime/backends/acp.js.map +1 -1
- package/dist/runtime/backends/index.d.ts +2 -2
- package/dist/runtime/backends/index.d.ts.map +1 -1
- package/dist/runtime/backends/index.js +2 -2
- package/dist/runtime/backends/index.js.map +1 -1
- package/dist/runtime/backends/macro-agent.d.ts +17 -1
- package/dist/runtime/backends/macro-agent.d.ts.map +1 -1
- package/dist/runtime/backends/macro-agent.js +1 -1
- package/dist/runtime/backends/macro-agent.js.map +1 -1
- package/dist/runtime/backends/mock.d.ts.map +1 -1
- package/dist/runtime/backends/mock.js.map +1 -1
- package/dist/runtime/backends/subprocess.d.ts.map +1 -1
- package/dist/runtime/backends/subprocess.js +5 -4
- package/dist/runtime/backends/subprocess.js.map +1 -1
- package/dist/runtime/compute-provider.d.ts +2 -18
- package/dist/runtime/compute-provider.d.ts.map +1 -1
- package/dist/runtime/compute-provider.js +8 -8
- package/dist/runtime/compute-provider.js.map +1 -1
- package/dist/runtime/flows/learning.d.ts +2 -1
- package/dist/runtime/flows/learning.d.ts.map +1 -1
- package/dist/runtime/flows/learning.js +4 -5
- package/dist/runtime/flows/learning.js.map +1 -1
- package/dist/runtime/flows/validation.d.ts.map +1 -1
- package/dist/runtime/flows/validation.js +2 -5
- package/dist/runtime/flows/validation.js.map +1 -1
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/manager.d.ts +128 -0
- package/dist/runtime/manager.d.ts.map +1 -1
- package/dist/runtime/manager.js +375 -64
- package/dist/runtime/manager.js.map +1 -1
- package/dist/runtime/types.d.ts +92 -1
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/search/evaluator.d.ts +71 -0
- package/dist/search/evaluator.d.ts.map +1 -1
- package/dist/search/evaluator.js +40 -5
- package/dist/search/evaluator.js.map +1 -1
- package/dist/search/index.d.ts +3 -5
- package/dist/search/index.d.ts.map +1 -1
- package/dist/search/index.js +4 -7
- package/dist/search/index.js.map +1 -1
- package/dist/search/moe-gate.d.ts +48 -2
- package/dist/search/moe-gate.d.ts.map +1 -1
- package/dist/search/moe-gate.js +117 -4
- package/dist/search/moe-gate.js.map +1 -1
- package/dist/search/refinement-loop.d.ts +63 -3
- package/dist/search/refinement-loop.d.ts.map +1 -1
- package/dist/search/refinement-loop.js +278 -23
- package/dist/search/refinement-loop.js.map +1 -1
- package/dist/search/refinement-types.d.ts +4 -2
- package/dist/search/refinement-types.d.ts.map +1 -1
- package/dist/search/refinement-types.js +2 -11
- package/dist/search/refinement-types.js.map +1 -1
- package/dist/search/router.d.ts +41 -34
- package/dist/search/router.d.ts.map +1 -1
- package/dist/search/router.js +156 -90
- package/dist/search/router.js.map +1 -1
- package/dist/search/solver.js +1 -1
- package/dist/search/solver.js.map +1 -1
- package/dist/search/task-difficulty.d.ts +54 -0
- package/dist/search/task-difficulty.d.ts.map +1 -0
- package/dist/search/task-difficulty.js +116 -0
- package/dist/search/task-difficulty.js.map +1 -0
- package/dist/search/tau-bench-verifier.d.ts +74 -0
- package/dist/search/tau-bench-verifier.d.ts.map +1 -0
- package/dist/search/tau-bench-verifier.js +96 -0
- package/dist/search/tau-bench-verifier.js.map +1 -0
- package/dist/search/verification-runner.d.ts.map +1 -1
- package/dist/search/verification-runner.js +6 -5
- package/dist/search/verification-runner.js.map +1 -1
- package/dist/session-bank/git-reader.d.ts.map +1 -1
- package/dist/session-bank/git-reader.js +5 -19
- package/dist/session-bank/git-reader.js.map +1 -1
- package/dist/session-bank/parser.d.ts.map +1 -1
- package/dist/session-bank/parser.js +26 -0
- package/dist/session-bank/parser.js.map +1 -1
- package/dist/session-bank/session-bank.d.ts.map +1 -1
- package/dist/session-bank/session-bank.js +2 -5
- package/dist/session-bank/session-bank.js.map +1 -1
- package/dist/session-bank/types.d.ts +24 -0
- package/dist/session-bank/types.d.ts.map +1 -1
- package/dist/surfacing/index.d.ts +3 -3
- package/dist/surfacing/index.d.ts.map +1 -1
- package/dist/surfacing/index.js +2 -2
- package/dist/surfacing/index.js.map +1 -1
- package/dist/surfacing/shared-bank.d.ts +43 -0
- package/dist/surfacing/shared-bank.d.ts.map +1 -0
- package/dist/surfacing/shared-bank.js +104 -0
- package/dist/surfacing/shared-bank.js.map +1 -0
- package/dist/surfacing/skill-library.d.ts +98 -2
- package/dist/surfacing/skill-library.d.ts.map +1 -1
- package/dist/surfacing/skill-library.js +192 -17
- package/dist/surfacing/skill-library.js.map +1 -1
- package/dist/surfacing/skill-publisher.d.ts +3 -1
- package/dist/surfacing/skill-publisher.d.ts.map +1 -1
- package/dist/surfacing/skill-publisher.js +28 -28
- package/dist/surfacing/skill-publisher.js.map +1 -1
- package/dist/surfacing/sqlite-storage-adapter.d.ts +2 -2
- package/dist/surfacing/sqlite-storage-adapter.d.ts.map +1 -1
- package/dist/surfacing/sqlite-storage-adapter.js +27 -18
- package/dist/surfacing/sqlite-storage-adapter.js.map +1 -1
- package/dist/types/analysis.d.ts +43 -0
- package/dist/types/analysis.d.ts.map +1 -0
- package/dist/types/analysis.js +10 -0
- package/dist/types/analysis.js.map +1 -0
- package/dist/types/config.d.ts +2178 -425
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js +600 -88
- package/dist/types/config.js.map +1 -1
- package/dist/types/dataclaw.d.ts +3 -3
- package/dist/types/index.d.ts +4 -7
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -10
- package/dist/types/index.js.map +1 -1
- package/dist/types/knowledge-graph.d.ts +1 -1
- package/dist/types/knowledge-graph.d.ts.map +1 -1
- package/dist/types/knowledge.d.ts +219 -11
- package/dist/types/knowledge.d.ts.map +1 -1
- package/dist/types/knowledge.js +90 -30
- package/dist/types/knowledge.js.map +1 -1
- package/dist/types/memory.d.ts +8 -0
- package/dist/types/memory.d.ts.map +1 -1
- package/dist/types/memory.js +12 -4
- package/dist/types/memory.js.map +1 -1
- package/dist/types/outcome.d.ts +11 -0
- package/dist/types/outcome.d.ts.map +1 -1
- package/dist/types/outcome.js +9 -0
- package/dist/types/outcome.js.map +1 -1
- package/dist/types/playbook.d.ts +63 -0
- package/dist/types/playbook.d.ts.map +1 -1
- package/dist/types/playbook.js +51 -0
- package/dist/types/playbook.js.map +1 -1
- package/dist/types/trajectory-source.d.ts +1 -1
- package/dist/types/trajectory-source.d.ts.map +1 -1
- package/dist/types/trajectory.d.ts +61 -0
- package/dist/types/trajectory.d.ts.map +1 -1
- package/dist/types/trajectory.js +25 -0
- package/dist/types/trajectory.js.map +1 -1
- package/dist/utils/clock.d.ts +36 -0
- package/dist/utils/clock.d.ts.map +1 -0
- package/dist/utils/clock.js +48 -0
- package/dist/utils/clock.js.map +1 -0
- package/dist/utils/frontmatter.d.ts.map +1 -1
- package/dist/utils/frontmatter.js +10 -2
- package/dist/utils/frontmatter.js.map +1 -1
- package/dist/utils/index.d.ts +4 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +4 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/logger.d.ts +31 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +50 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/objectives.d.ts +45 -0
- package/dist/utils/objectives.d.ts.map +1 -0
- package/dist/utils/objectives.js +74 -0
- package/dist/utils/objectives.js.map +1 -0
- package/dist/utils/partitioned-store.d.ts.map +1 -1
- package/dist/utils/partitioned-store.js.map +1 -1
- package/dist/utils/playbook-hash.d.ts +19 -0
- package/dist/utils/playbook-hash.d.ts.map +1 -0
- package/dist/utils/playbook-hash.js +51 -0
- package/dist/utils/playbook-hash.js.map +1 -0
- package/dist/utils/similarity.d.ts.map +1 -1
- package/dist/utils/similarity.js.map +1 -1
- package/dist/utils/solver-canonicalizer.d.ts +22 -0
- package/dist/utils/solver-canonicalizer.d.ts.map +1 -0
- package/dist/utils/solver-canonicalizer.js +41 -0
- package/dist/utils/solver-canonicalizer.js.map +1 -0
- package/dist/utils/storage.d.ts.map +1 -1
- package/dist/utils/storage.js +1 -3
- package/dist/utils/storage.js.map +1 -1
- package/dist/utils/task-signature.d.ts +34 -0
- package/dist/utils/task-signature.d.ts.map +1 -0
- package/dist/utils/task-signature.js +112 -0
- package/dist/utils/task-signature.js.map +1 -0
- package/dist/utils/trajectory-helpers.d.ts.map +1 -1
- package/dist/utils/trajectory-helpers.js.map +1 -1
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js.map +1 -1
- package/dist/workspace/efficacy-toolkit.d.ts.map +1 -1
- package/dist/workspace/efficacy-toolkit.js +18 -26
- package/dist/workspace/efficacy-toolkit.js.map +1 -1
- package/dist/workspace/index.d.ts +4 -3
- package/dist/workspace/index.d.ts.map +1 -1
- package/dist/workspace/index.js +5 -3
- package/dist/workspace/index.js.map +1 -1
- package/dist/workspace/runner.d.ts.map +1 -1
- package/dist/workspace/runner.js +95 -21
- package/dist/workspace/runner.js.map +1 -1
- package/dist/workspace/skill-converter.d.ts +66 -1
- package/dist/workspace/skill-converter.d.ts.map +1 -1
- package/dist/workspace/skill-converter.js +238 -19
- package/dist/workspace/skill-converter.js.map +1 -1
- package/dist/workspace/skill-import.d.ts +43 -0
- package/dist/workspace/skill-import.d.ts.map +1 -0
- package/dist/workspace/skill-import.js +40 -0
- package/dist/workspace/skill-import.js.map +1 -0
- package/dist/workspace/templates/index.d.ts +6 -8
- package/dist/workspace/templates/index.d.ts.map +1 -1
- package/dist/workspace/templates/index.js +7 -11
- package/dist/workspace/templates/index.js.map +1 -1
- package/dist/workspace/templates/knowledge-defrag.d.ts.map +1 -1
- package/dist/workspace/templates/knowledge-defrag.js +0 -2
- package/dist/workspace/templates/knowledge-defrag.js.map +1 -1
- package/dist/workspace/templates/knowledge-extraction.d.ts +11 -0
- package/dist/workspace/templates/knowledge-extraction.d.ts.map +1 -1
- package/dist/workspace/templates/knowledge-extraction.js +11 -6
- package/dist/workspace/templates/knowledge-extraction.js.map +1 -1
- package/dist/workspace/templates/playbook-conditioning.d.ts +38 -0
- package/dist/workspace/templates/playbook-conditioning.d.ts.map +1 -0
- package/dist/workspace/templates/playbook-conditioning.js +147 -0
- package/dist/workspace/templates/playbook-conditioning.js.map +1 -0
- package/dist/workspace/templates/playbook-decay-detection.d.ts.map +1 -1
- package/dist/workspace/templates/playbook-decay-detection.js +24 -18
- package/dist/workspace/templates/playbook-decay-detection.js.map +1 -1
- package/dist/workspace/templates/playbook-efficacy-audit.d.ts.map +1 -1
- package/dist/workspace/templates/playbook-efficacy-audit.js +26 -11
- package/dist/workspace/templates/playbook-efficacy-audit.js.map +1 -1
- package/dist/workspace/templates/playbook-extraction.d.ts.map +1 -1
- package/dist/workspace/templates/playbook-extraction.js +75 -15
- package/dist/workspace/templates/playbook-extraction.js.map +1 -1
- package/dist/workspace/templates/playbook-lifecycle-review.d.ts.map +1 -1
- package/dist/workspace/templates/playbook-lifecycle-review.js +12 -8
- package/dist/workspace/templates/playbook-lifecycle-review.js.map +1 -1
- package/dist/workspace/templates/refinement-analysis.d.ts.map +1 -1
- package/dist/workspace/templates/refinement-analysis.js +11 -5
- package/dist/workspace/templates/refinement-analysis.js.map +1 -1
- package/dist/workspace/templates/skill-enrichment.d.ts.map +1 -1
- package/dist/workspace/templates/skill-enrichment.js +7 -11
- package/dist/workspace/templates/skill-enrichment.js.map +1 -1
- package/dist/workspace/templates/solution-evaluation.d.ts.map +1 -1
- package/dist/workspace/templates/solution-evaluation.js +15 -8
- package/dist/workspace/templates/solution-evaluation.js.map +1 -1
- package/dist/workspace/templates/trajectory-analysis.d.ts.map +1 -1
- package/dist/workspace/templates/trajectory-analysis.js +1 -3
- package/dist/workspace/templates/trajectory-analysis.js.map +1 -1
- package/dist/workspace/templates/usage-inference.d.ts.map +1 -1
- package/dist/workspace/templates/usage-inference.js +9 -7
- package/dist/workspace/templates/usage-inference.js.map +1 -1
- package/dist/workspace/types.d.ts +32 -2
- package/dist/workspace/types.d.ts.map +1 -1
- package/dist/workspace/types.js +29 -0
- package/dist/workspace/types.js.map +1 -1
- package/package.json +43 -19
- package/playbooks/agent-ops/long-task-checkpointing.json +54 -0
- package/playbooks/agent-ops/progressive-context-gathering.json +56 -0
- package/playbooks/agent-ops/safe-destructive-operations.json +59 -0
- package/playbooks/agent-ops/scope-discipline.json +56 -0
- package/playbooks/agent-ops/stall-detection-strategy-switch.json +55 -0
- package/playbooks/agent-ops/verification-before-completion.json +54 -0
- package/playbooks/alfworld/clean-and-place.json +35 -0
- package/playbooks/alfworld/cool-and-place.json +35 -0
- package/playbooks/alfworld/examine-in-light.json +32 -0
- package/playbooks/alfworld/heat-and-place.json +35 -0
- package/playbooks/alfworld/pick-and-place.json +37 -0
- package/playbooks/alfworld/pick-two-and-place.json +35 -0
- package/.claude/settings.json +0 -197
- package/.entire/settings.json +0 -4
- package/.sessionlog/settings.json +0 -4
- package/CLAUDE.md +0 -233
- package/SKILL.md +0 -193
- package/docs/DESIGN-agentic-workspace.md +0 -2057
- package/docs/DESIGN-semantic-memory-knowledge-bank.md +0 -1789
- package/docs/DESIGN-session-bank.md +0 -1134
- package/docs/DESIGN-team-extraction-pipeline.md +0 -1369
- package/docs/PROPOSAL-team-aware-learning.md +0 -1080
- package/docs/RESEARCH-semantic-memory-knowledge-structures.md +0 -517
- package/docs/RESEARCH-team-trajectory-learning.md +0 -553
- package/gaps.md +0 -204
- package/scripts/migrate-to-playbooks.ts +0 -307
- package/src/agents/index.ts +0 -14
- package/src/agents/mock-provider.ts +0 -93
- package/src/agents/types.ts +0 -137
- package/src/atlas.ts +0 -1198
- package/src/bin/cli-utils.ts +0 -220
- package/src/bin/cognitive-core.ts +0 -162
- package/src/bin/commands/kb.ts +0 -266
- package/src/bin/commands/learn.ts +0 -100
- package/src/bin/commands/legacy.ts +0 -182
- package/src/bin/commands/run.ts +0 -113
- package/src/bin/commands/sessions.ts +0 -221
- package/src/bin/commands/skills.ts +0 -146
- package/src/embeddings/bm25.ts +0 -337
- package/src/embeddings/index.ts +0 -42
- package/src/embeddings/inverted-index.ts +0 -134
- package/src/embeddings/manager.ts +0 -293
- package/src/embeddings/provider.ts +0 -318
- package/src/embeddings/vector-store.ts +0 -365
- package/src/factory.ts +0 -280
- package/src/index.ts +0 -495
- package/src/learning/analyzer.ts +0 -319
- package/src/learning/effectiveness.ts +0 -428
- package/src/learning/energy-evaluator.ts +0 -282
- package/src/learning/healing-orchestrator.ts +0 -383
- package/src/learning/index.ts +0 -150
- package/src/learning/instant-loop.ts +0 -357
- package/src/learning/knowledge-extractor.ts +0 -470
- package/src/learning/maintenance-scheduler.ts +0 -271
- package/src/learning/meta-learner.ts +0 -552
- package/src/learning/playbook-extractor.ts +0 -702
- package/src/learning/reflexion-generator.ts +0 -273
- package/src/learning/team-ingester.ts +0 -499
- package/src/learning/team-meta-learner.ts +0 -558
- package/src/learning/team-pipeline.ts +0 -364
- package/src/learning/trajectory-sources/dataclaw.ts +0 -403
- package/src/learning/trajectory-sources/entire.ts +0 -251
- package/src/learning/trajectory-sources/file.ts +0 -136
- package/src/learning/trajectory-sources/huggingface.ts +0 -248
- package/src/learning/trajectory-sources/in-memory.ts +0 -61
- package/src/learning/trajectory-sources/index.ts +0 -15
- package/src/learning/trajectory-sources/pipeline.ts +0 -69
- package/src/learning/unified-pipeline.ts +0 -1191
- package/src/learning/usage-inference.ts +0 -372
- package/src/mcp/index.ts +0 -12
- package/src/mcp/playbook-server.ts +0 -565
- package/src/memory/candidate-retrieval.ts +0 -72
- package/src/memory/causal-store.ts +0 -273
- package/src/memory/coherence.ts +0 -252
- package/src/memory/curated-loader.ts +0 -213
- package/src/memory/experience.ts +0 -682
- package/src/memory/graph-layers/base.ts +0 -184
- package/src/memory/graph-layers/causal.ts +0 -16
- package/src/memory/graph-layers/entity.ts +0 -16
- package/src/memory/graph-layers/index.ts +0 -5
- package/src/memory/graph-layers/semantic.ts +0 -16
- package/src/memory/graph-layers/temporal.ts +0 -16
- package/src/memory/index.ts +0 -131
- package/src/memory/knowledge-bank.ts +0 -1317
- package/src/memory/knowledge-defrag.ts +0 -329
- package/src/memory/knowledge-graph.ts +0 -361
- package/src/memory/meta.ts +0 -488
- package/src/memory/playbook.ts +0 -676
- package/src/memory/reasoning-bank.ts +0 -458
- package/src/memory/reflexion.ts +0 -122
- package/src/memory/search-provider.ts +0 -35
- package/src/memory/search-providers/index.ts +0 -3
- package/src/memory/search-providers/minimem.ts +0 -84
- package/src/memory/search-providers/text-similarity.ts +0 -35
- package/src/memory/skill-exporter.ts +0 -357
- package/src/memory/source-resolver.ts +0 -422
- package/src/memory/system.ts +0 -620
- package/src/memory/team-experience.ts +0 -604
- package/src/memory/temporal-compressor.ts +0 -409
- package/src/persistence/index.ts +0 -37
- package/src/persistence/migrator.ts +0 -298
- package/src/persistence/serializers.ts +0 -79
- package/src/persistence/sqlite-persistence.ts +0 -925
- package/src/runtime/backends/acp-protocol.ts +0 -231
- package/src/runtime/backends/acp.ts +0 -239
- package/src/runtime/backends/index.ts +0 -38
- package/src/runtime/backends/macro-agent.ts +0 -177
- package/src/runtime/backends/mock.ts +0 -218
- package/src/runtime/backends/subprocess.ts +0 -356
- package/src/runtime/compute-provider.ts +0 -206
- package/src/runtime/flows/learning.ts +0 -166
- package/src/runtime/flows/validation.ts +0 -381
- package/src/runtime/index.ts +0 -75
- package/src/runtime/manager.ts +0 -685
- package/src/runtime/types.ts +0 -198
- package/src/search/evaluator.ts +0 -499
- package/src/search/index.ts +0 -78
- package/src/search/moe-gate.ts +0 -304
- package/src/search/refinement-loop.ts +0 -457
- package/src/search/refinement-types.ts +0 -159
- package/src/search/router.ts +0 -368
- package/src/search/solver.ts +0 -303
- package/src/search/team-router.ts +0 -459
- package/src/search/verification-runner.ts +0 -570
- package/src/session-bank/git-reader.ts +0 -200
- package/src/session-bank/index.ts +0 -26
- package/src/session-bank/parser.ts +0 -548
- package/src/session-bank/session-bank.ts +0 -485
- package/src/session-bank/types.ts +0 -176
- package/src/surfacing/index.ts +0 -29
- package/src/surfacing/publisher.ts +0 -23
- package/src/surfacing/skill-library.ts +0 -625
- package/src/surfacing/skill-publisher.ts +0 -257
- package/src/surfacing/sqlite-storage-adapter.ts +0 -285
- package/src/surfacing/team-skill-library.ts +0 -610
- package/src/types/config.ts +0 -661
- package/src/types/dataclaw.ts +0 -99
- package/src/types/huggingface-transformers.d.ts +0 -12
- package/src/types/index.ts +0 -293
- package/src/types/knowledge-graph.ts +0 -246
- package/src/types/knowledge.ts +0 -388
- package/src/types/memory.ts +0 -300
- package/src/types/meta.ts +0 -218
- package/src/types/outcome.ts +0 -66
- package/src/types/playbook.ts +0 -215
- package/src/types/step.ts +0 -40
- package/src/types/task.ts +0 -52
- package/src/types/team-meta.ts +0 -212
- package/src/types/team-playbook.ts +0 -384
- package/src/types/team-trajectory.ts +0 -673
- package/src/types/trajectory-source.ts +0 -47
- package/src/types/trajectory.ts +0 -80
- package/src/utils/error-classifier.ts +0 -113
- package/src/utils/frontmatter.ts +0 -118
- package/src/utils/index.ts +0 -63
- package/src/utils/partitioned-store.ts +0 -299
- package/src/utils/similarity.ts +0 -139
- package/src/utils/storage.ts +0 -249
- package/src/utils/trajectory-helpers.ts +0 -79
- package/src/utils/validation.ts +0 -286
- package/src/workspace/efficacy-toolkit.ts +0 -496
- package/src/workspace/index.ts +0 -77
- package/src/workspace/runner.ts +0 -281
- package/src/workspace/skill-converter.ts +0 -288
- package/src/workspace/templates/index.ts +0 -95
- package/src/workspace/templates/knowledge-defrag.ts +0 -223
- package/src/workspace/templates/knowledge-extraction.ts +0 -337
- package/src/workspace/templates/meta-reflection.ts +0 -208
- package/src/workspace/templates/playbook-decay-detection.ts +0 -272
- package/src/workspace/templates/playbook-efficacy-audit.ts +0 -246
- package/src/workspace/templates/playbook-extraction.ts +0 -240
- package/src/workspace/templates/playbook-lifecycle-review.ts +0 -274
- package/src/workspace/templates/refinement-analysis.ts +0 -162
- package/src/workspace/templates/skill-enrichment.ts +0 -275
- package/src/workspace/templates/solution-evaluation.ts +0 -199
- package/src/workspace/templates/team-playbook-extraction.ts +0 -631
- package/src/workspace/templates/team-trajectory-analysis.ts +0 -564
- package/src/workspace/templates/trajectory-analysis.ts +0 -234
- package/src/workspace/templates/usage-inference.ts +0 -163
- package/src/workspace/types.ts +0 -185
- package/tests/atlas-knowledge.test.ts +0 -165
- package/tests/embeddings/bm25.test.ts +0 -130
- package/tests/embeddings/inverted-index.test.ts +0 -138
- package/tests/embeddings/manager.test.ts +0 -205
- package/tests/feature-toggles.test.ts +0 -275
- package/tests/fixtures/behavioral-trajectories.ts +0 -210
- package/tests/gap-fixes.test.ts +0 -1116
- package/tests/integration/atlas.test.ts +0 -266
- package/tests/integration/cli-e2e.test.ts +0 -621
- package/tests/integration/curated-sources-e2e.test.ts +0 -502
- package/tests/integration/dataclaw-e2e.test.ts +0 -559
- package/tests/integration/e2e.test.ts +0 -1337
- package/tests/integration/entire-e2e.test.ts +0 -376
- package/tests/integration/huggingface-e2e.test.ts +0 -627
- package/tests/integration/persistence-e2e.test.ts +0 -741
- package/tests/integration/phase-e2e.test.ts +0 -1143
- package/tests/integration/pipeline-data-correctness.test.ts +0 -794
- package/tests/integration/session-bank.test.ts +0 -231
- package/tests/integration/sessionlog-e2e.test.ts +0 -329
- package/tests/integration/skill-tree-wiring.test.ts +0 -152
- package/tests/integration/unified-pipeline-e2e.test.ts +0 -634
- package/tests/learning/analyzer.test.ts +0 -426
- package/tests/learning/dataclaw-trajectory-source.test.ts +0 -642
- package/tests/learning/effectiveness.test.ts +0 -542
- package/tests/learning/energy-evaluator.test.ts +0 -180
- package/tests/learning/entire-trajectory-source.test.ts +0 -380
- package/tests/learning/healing-orchestrator.test.ts +0 -269
- package/tests/learning/huggingface-trajectory-source.test.ts +0 -817
- package/tests/learning/instant-loop.test.ts +0 -243
- package/tests/learning/knowledge-extractor.test.ts +0 -491
- package/tests/learning/maintenance-scheduler.test.ts +0 -191
- package/tests/learning/meta-learner.test.ts +0 -418
- package/tests/learning/pipeline-memory-updates.test.ts +0 -721
- package/tests/learning/playbook-extractor-provenance.test.ts +0 -114
- package/tests/learning/reflexion-generator.test.ts +0 -411
- package/tests/learning/team-ingester.test.ts +0 -349
- package/tests/learning/team-meta-learner.test.ts +0 -618
- package/tests/learning/team-pipeline.test.ts +0 -334
- package/tests/learning/trajectory-sources.test.ts +0 -320
- package/tests/learning/unified-pipeline-efficacy.test.ts +0 -232
- package/tests/learning/unified-pipeline.test.ts +0 -322
- package/tests/learning/usage-inference.test.ts +0 -254
- package/tests/mcp/playbook-server.test.ts +0 -257
- package/tests/memory/candidate-retrieval.test.ts +0 -167
- package/tests/memory/causal-store.test.ts +0 -276
- package/tests/memory/coherence.test.ts +0 -232
- package/tests/memory/compound-engineering-seed.test.ts +0 -338
- package/tests/memory/curated-loader-extended.test.ts +0 -225
- package/tests/memory/experience.test.ts +0 -203
- package/tests/memory/graph-layers/semantic.test.ts +0 -219
- package/tests/memory/knowledge-bank-extraction.test.ts +0 -558
- package/tests/memory/knowledge-bank.test.ts +0 -705
- package/tests/memory/knowledge-defrag.test.ts +0 -366
- package/tests/memory/knowledge-evolution.test.ts +0 -563
- package/tests/memory/knowledge-graph.test.ts +0 -492
- package/tests/memory/knowledge-inbox.test.ts +0 -258
- package/tests/memory/knowledge-minimem.test.ts +0 -251
- package/tests/memory/meta.test.ts +0 -399
- package/tests/memory/playbook-quality-validation.test.ts +0 -430
- package/tests/memory/playbook.test.ts +0 -644
- package/tests/memory/provenance.test.ts +0 -648
- package/tests/memory/reasoning-bank.test.ts +0 -239
- package/tests/memory/reflexion.test.ts +0 -166
- package/tests/memory/skill-exporter.test.ts +0 -475
- package/tests/memory/source-resolver.test.ts +0 -700
- package/tests/memory/system.test.ts +0 -330
- package/tests/memory/team-experience.test.ts +0 -411
- package/tests/memory/temporal-compressor.test.ts +0 -318
- package/tests/persistence/migrator.test.ts +0 -1009
- package/tests/persistence/sqlite-persistence.test.ts +0 -635
- package/tests/runtime/agent-manager.test.ts +0 -517
- package/tests/runtime/compute-provider.test.ts +0 -288
- package/tests/runtime/delegate.test.ts +0 -354
- package/tests/runtime/macro-agent-backend.test.ts +0 -266
- package/tests/runtime/mock-backend.test.ts +0 -248
- package/tests/search/evaluator.test.ts +0 -257
- package/tests/search/moe-gate.test.ts +0 -250
- package/tests/search/refinement-loop.test.ts +0 -477
- package/tests/search/refinement.test.ts +0 -267
- package/tests/search/router.test.ts +0 -506
- package/tests/search/team-router.test.ts +0 -376
- package/tests/search/verification-runner.test.ts +0 -357
- package/tests/session-bank/fixtures/multi-tool-session/full.jsonl +0 -12
- package/tests/session-bank/fixtures/multi-tool-session/metadata.json +0 -28
- package/tests/session-bank/fixtures/root-metadata.json +0 -18
- package/tests/session-bank/fixtures/sessionlog-root-metadata.json +0 -16
- package/tests/session-bank/fixtures/sessionlog-session/full.jsonl +0 -6
- package/tests/session-bank/fixtures/sessionlog-session/metadata.json +0 -55
- package/tests/session-bank/fixtures/simple-session/full.jsonl +0 -6
- package/tests/session-bank/fixtures/simple-session/metadata.json +0 -38
- package/tests/session-bank/git-reader.test.ts +0 -232
- package/tests/session-bank/parser.test.ts +0 -453
- package/tests/session-bank/session-bank.test.ts +0 -546
- package/tests/surfacing/skill-library.test.ts +0 -297
- package/tests/surfacing/skill-publisher.test.ts +0 -437
- package/tests/surfacing/sqlite-storage-adapter.test.ts +0 -206
- package/tests/surfacing/team-skill-library.test.ts +0 -444
- package/tests/types/outcome.test.ts +0 -147
- package/tests/types/step.test.ts +0 -133
- package/tests/types/task.test.ts +0 -158
- package/tests/types/team-meta.test.ts +0 -147
- package/tests/types/team-playbook.test.ts +0 -246
- package/tests/types/team-trajectory.test.ts +0 -557
- package/tests/types/trajectory.test.ts +0 -253
- package/tests/utils/error-classifier.test.ts +0 -149
- package/tests/utils/frontmatter.test.ts +0 -208
- package/tests/utils/partitioned-store.test.ts +0 -230
- package/tests/utils/similarity.test.ts +0 -188
- package/tests/utils/trajectory-helpers.test.ts +0 -163
- package/tests/utils/validation.test.ts +0 -252
- package/tests/workspace/efficacy-toolkit.test.ts +0 -404
- package/tests/workspace/full-flow.test.ts +0 -845
- package/tests/workspace/manager.test.ts +0 -215
- package/tests/workspace/runner.test.ts +0 -336
- package/tests/workspace/skill-converter.test.ts +0 -205
- package/tests/workspace/templates/knowledge-extraction.test.ts +0 -235
- package/tests/workspace/templates/playbook-efficacy.test.ts +0 -377
- package/tests/workspace/templates/team-playbook-extraction.test.ts +0 -341
- package/tests/workspace/templates/team-trajectory-analysis.test.ts +0 -417
- package/tsconfig.json +0 -25
- package/vitest.config.ts +0 -22
|
@@ -1,15 +1,87 @@
|
|
|
1
|
-
import { readFile, writeFile, readdir, mkdir, unlink, access } from 'node:fs/promises';
|
|
1
|
+
import { readFile, writeFile, rename, readdir, mkdir, unlink, access } from 'node:fs/promises';
|
|
2
|
+
import { logger } from '../utils/logger.js';
|
|
2
3
|
import { join, relative } from 'node:path';
|
|
3
|
-
import {
|
|
4
|
-
import { KnowledgeGraphManager } from './knowledge-graph.js';
|
|
4
|
+
import { createObservation, createEntityNote, inferLayerFromRelation } from '../types/knowledge.js';
|
|
5
5
|
import { CoherenceChecker } from './coherence.js';
|
|
6
|
-
import { parseKnowledgeNote, serializeKnowledgeNote
|
|
6
|
+
import { parseKnowledgeNote, serializeKnowledgeNote } from '../utils/frontmatter.js';
|
|
7
7
|
import { TextSimilaritySearchProvider } from './search-providers/text-similarity.js';
|
|
8
|
+
import { EmbeddingSearchProvider } from './search-providers/embedding.js';
|
|
9
|
+
import { HybridSearchProvider, } from './search-providers/hybrid.js';
|
|
10
|
+
import { extractConversationFacts } from './extraction/conversation-extractor.js';
|
|
11
|
+
/**
|
|
12
|
+
* Max stripped-body length for a note to count as a content-free index record.
|
|
13
|
+
* Defrag's index records carry only a one-line marker ("Entity record for X.
|
|
14
|
+
* Linked facts: N."). A content-bearing entity note — e.g. a consolidated note
|
|
15
|
+
* written by evolve() — has a real body and must stay retrievable.
|
|
16
|
+
*/
|
|
17
|
+
const INDEX_RECORD_BODY_MAX = 160;
|
|
18
|
+
/**
|
|
19
|
+
* Max consolidated (entity-type content) notes allowed into a single retrieval
|
|
20
|
+
* window. A broad merge that matches by entity name would otherwise crowd out
|
|
21
|
+
* the precise atomic fact a single-hop question needs; capping keeps merges as
|
|
22
|
+
* supplements while aggregation/multi-hop still gets the few relevant ones.
|
|
23
|
+
*/
|
|
24
|
+
const MAX_CONSOLIDATED_NOTES = 2;
|
|
25
|
+
/**
|
|
26
|
+
* An index-mode entity record: an `entity` note whose purpose is to anchor a
|
|
27
|
+
* set of atomic facts (via entity-layer links) rather than to carry content.
|
|
28
|
+
* Such records are excluded from retrievable content and used only as a
|
|
29
|
+
* relevance boost for their linked facts.
|
|
30
|
+
*
|
|
31
|
+
* The body gate is essential: without it, ANY entity note with an entity-layer
|
|
32
|
+
* link (including a consolidated merge with a rich body) would be treated as a
|
|
33
|
+
* content-free anchor and dropped from retrieval, discarding its content.
|
|
34
|
+
*/
|
|
35
|
+
function isEntityIndexRecord(note) {
|
|
36
|
+
if (note.frontmatter.type !== 'entity')
|
|
37
|
+
return false;
|
|
38
|
+
if (!note.frontmatter.links.some((l) => l.layer === 'entity'))
|
|
39
|
+
return false;
|
|
40
|
+
const body = note.body.replace(/^#\s.*(?:\n+|$)/, '').trim();
|
|
41
|
+
return body.length < INDEX_RECORD_BODY_MAX;
|
|
42
|
+
}
|
|
43
|
+
/** Lowercase word set for cheap lexical overlap (WS2c relevance excerpting). */
|
|
44
|
+
function tokenSet(s) {
|
|
45
|
+
return new Set(s
|
|
46
|
+
.toLowerCase()
|
|
47
|
+
.replace(/[^a-z0-9\s]/g, ' ')
|
|
48
|
+
.split(/\s+/)
|
|
49
|
+
.filter((w) => w.length > 2));
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Build a query-relevant excerpt of a note body under a character budget.
|
|
53
|
+
* Multi-section notes (## headings) are ranked per section by lexical overlap
|
|
54
|
+
* with the query so the most relevant material survives truncation; otherwise
|
|
55
|
+
* falls back to head truncation. Small bodies are returned unchanged.
|
|
56
|
+
*/
|
|
57
|
+
function excerptForQuery(body, query, maxChars) {
|
|
58
|
+
if (body.length <= maxChars)
|
|
59
|
+
return body;
|
|
60
|
+
const sections = body.split(/\n(?=##\s)/);
|
|
61
|
+
if (sections.length <= 1)
|
|
62
|
+
return `${body.slice(0, maxChars)}…`;
|
|
63
|
+
const header = /^##\s/.test(sections[0]) ? '' : (sections.shift() ?? '');
|
|
64
|
+
const qTokens = tokenSet(query);
|
|
65
|
+
const scored = sections.map((s) => {
|
|
66
|
+
let overlap = 0;
|
|
67
|
+
for (const t of tokenSet(s))
|
|
68
|
+
if (qTokens.has(t))
|
|
69
|
+
overlap++;
|
|
70
|
+
return { s, overlap };
|
|
71
|
+
});
|
|
72
|
+
scored.sort((a, b) => b.overlap - a.overlap);
|
|
73
|
+
let out = header ? `${header.trim()}\n` : '';
|
|
74
|
+
for (const { s } of scored) {
|
|
75
|
+
if (out.length + s.length + 1 > maxChars)
|
|
76
|
+
continue;
|
|
77
|
+
out += `${s.trim()}\n`;
|
|
78
|
+
}
|
|
79
|
+
return out.trim() || `${body.slice(0, maxChars)}…`;
|
|
80
|
+
}
|
|
8
81
|
/**
|
|
9
82
|
* KnowledgeBank — Semantic memory store for facts, concepts, and relationships.
|
|
10
83
|
*
|
|
11
84
|
* Uses the filesystem as the universal primary index (minimem-compatible).
|
|
12
|
-
* Maintains a multi-layer graph overlay as a derived index for relationship queries.
|
|
13
85
|
*
|
|
14
86
|
* Directory structure:
|
|
15
87
|
* {memoryDir}/
|
|
@@ -18,25 +90,28 @@ import { TextSimilaritySearchProvider } from './search-providers/text-similarity
|
|
|
18
90
|
* entities/ — living entity docs ({entity}.md)
|
|
19
91
|
* domains/ — domain summaries ({domain}.md)
|
|
20
92
|
* inbox/ — unorganized agent-authored notes
|
|
21
|
-
* .knowledge/ — derived index files (
|
|
93
|
+
* .knowledge/ — derived index files (manifest)
|
|
22
94
|
*/
|
|
23
95
|
export class KnowledgeBank {
|
|
24
|
-
graph;
|
|
25
96
|
memoryDir;
|
|
26
97
|
bankConfig;
|
|
27
98
|
initialized = false;
|
|
28
99
|
searchProvider = new TextSimilaritySearchProvider();
|
|
29
100
|
coherenceChecker = new CoherenceChecker();
|
|
101
|
+
/** Neural embedding provider for note retrieval (null ⇒ lexical floor). */
|
|
102
|
+
embedder = null;
|
|
103
|
+
/** True once an embedder is configured — takes precedence over minimem auto-detect. */
|
|
104
|
+
embeddingConfigured = false;
|
|
30
105
|
// Directory paths (resolved on init)
|
|
31
106
|
observationsDir = '';
|
|
32
107
|
entitiesDir = '';
|
|
33
108
|
domainsDir = '';
|
|
109
|
+
conventionsDir = '';
|
|
34
110
|
inboxDir = '';
|
|
35
111
|
indexDir = '';
|
|
36
112
|
constructor(memoryDir, config) {
|
|
37
113
|
this.memoryDir = memoryDir;
|
|
38
114
|
this.bankConfig = config;
|
|
39
|
-
this.graph = new KnowledgeGraphManager(this.bankConfig.graph);
|
|
40
115
|
}
|
|
41
116
|
// =========================================================================
|
|
42
117
|
// Lifecycle
|
|
@@ -53,6 +128,7 @@ export class KnowledgeBank {
|
|
|
53
128
|
this.observationsDir = join(knowledgeBase, 'observations');
|
|
54
129
|
this.entitiesDir = join(knowledgeBase, 'entities');
|
|
55
130
|
this.domainsDir = join(knowledgeBase, 'domains');
|
|
131
|
+
this.conventionsDir = join(knowledgeBase, 'conventions');
|
|
56
132
|
this.inboxDir = join(this.memoryDir, 'inbox');
|
|
57
133
|
this.indexDir = join(this.memoryDir, '.knowledge');
|
|
58
134
|
// Create directory structure
|
|
@@ -60,11 +136,10 @@ export class KnowledgeBank {
|
|
|
60
136
|
mkdir(this.observationsDir, { recursive: true }),
|
|
61
137
|
mkdir(this.entitiesDir, { recursive: true }),
|
|
62
138
|
mkdir(this.domainsDir, { recursive: true }),
|
|
139
|
+
mkdir(this.conventionsDir, { recursive: true }),
|
|
63
140
|
mkdir(this.inboxDir, { recursive: true }),
|
|
64
141
|
mkdir(this.indexDir, { recursive: true }),
|
|
65
142
|
]);
|
|
66
|
-
// Load graph from disk
|
|
67
|
-
await this.graph.loadFromDisk(this.indexDir);
|
|
68
143
|
// Detect minimem and swap search provider if available
|
|
69
144
|
if (this.bankConfig.minimemAware) {
|
|
70
145
|
await this.detectMinimem();
|
|
@@ -74,7 +149,6 @@ export class KnowledgeBank {
|
|
|
74
149
|
async close() {
|
|
75
150
|
if (!this.initialized)
|
|
76
151
|
return;
|
|
77
|
-
await this.graph.saveToDisk(this.indexDir);
|
|
78
152
|
}
|
|
79
153
|
// =========================================================================
|
|
80
154
|
// Write Operations
|
|
@@ -83,10 +157,18 @@ export class KnowledgeBank {
|
|
|
83
157
|
* Create a new knowledge note and write it to disk.
|
|
84
158
|
* Runs coherence checking against existing notes — contradictions are flagged
|
|
85
159
|
* via metadata but the note is still stored.
|
|
86
|
-
* Updates the graph overlay in memory.
|
|
87
160
|
*/
|
|
88
161
|
async addObservation(note) {
|
|
89
162
|
await this.init();
|
|
163
|
+
// Assign a filePath when the caller leaves it empty (e.g. bootstrap notes)
|
|
164
|
+
if (!note.filePath) {
|
|
165
|
+
const noteType = note.frontmatter.type === 'entity'
|
|
166
|
+
? 'entity'
|
|
167
|
+
: note.frontmatter.type === 'domain-summary'
|
|
168
|
+
? 'domain-summary'
|
|
169
|
+
: 'observation';
|
|
170
|
+
note.filePath = this.resolveNotePath(noteType, `${note.frontmatter.id}.md`);
|
|
171
|
+
}
|
|
90
172
|
// Run coherence check against related existing notes (if enabled)
|
|
91
173
|
if (this.bankConfig.coherenceChecking !== false) {
|
|
92
174
|
try {
|
|
@@ -104,7 +186,6 @@ export class KnowledgeBank {
|
|
|
104
186
|
}
|
|
105
187
|
}
|
|
106
188
|
await this.writeNote(note);
|
|
107
|
-
this.graph.addNode(this.noteToGraphNode(note));
|
|
108
189
|
return note.frontmatter.id;
|
|
109
190
|
}
|
|
110
191
|
/**
|
|
@@ -137,8 +218,6 @@ export class KnowledgeBank {
|
|
|
137
218
|
note.frontmatter.source.trajectories.push(update.trajectoryId);
|
|
138
219
|
}
|
|
139
220
|
await this.writeNote(note);
|
|
140
|
-
// Update graph node
|
|
141
|
-
this.graph.addNode(this.noteToGraphNode(note));
|
|
142
221
|
}
|
|
143
222
|
// =========================================================================
|
|
144
223
|
// Read Operations
|
|
@@ -149,11 +228,7 @@ export class KnowledgeBank {
|
|
|
149
228
|
async getNote(id) {
|
|
150
229
|
await this.init();
|
|
151
230
|
// Try each directory
|
|
152
|
-
for (const dir of [
|
|
153
|
-
this.observationsDir,
|
|
154
|
-
this.entitiesDir,
|
|
155
|
-
this.domainsDir,
|
|
156
|
-
]) {
|
|
231
|
+
for (const dir of [this.observationsDir, this.entitiesDir, this.domainsDir]) {
|
|
157
232
|
const notes = await this.scanDirectory(dir);
|
|
158
233
|
const found = notes.find((n) => n.frontmatter.id === id);
|
|
159
234
|
if (found)
|
|
@@ -200,9 +275,7 @@ export class KnowledgeBank {
|
|
|
200
275
|
await this.init();
|
|
201
276
|
try {
|
|
202
277
|
const files = await readdir(this.entitiesDir);
|
|
203
|
-
return files
|
|
204
|
-
.filter((f) => f.endsWith('.md'))
|
|
205
|
-
.map((f) => f.replace('.md', ''));
|
|
278
|
+
return files.filter((f) => f.endsWith('.md')).map((f) => f.replace('.md', ''));
|
|
206
279
|
}
|
|
207
280
|
catch {
|
|
208
281
|
return [];
|
|
@@ -215,9 +288,7 @@ export class KnowledgeBank {
|
|
|
215
288
|
await this.init();
|
|
216
289
|
try {
|
|
217
290
|
const files = await readdir(this.domainsDir);
|
|
218
|
-
return files
|
|
219
|
-
.filter((f) => f.endsWith('.md'))
|
|
220
|
-
.map((f) => f.replace('.md', ''));
|
|
291
|
+
return files.filter((f) => f.endsWith('.md')).map((f) => f.replace('.md', ''));
|
|
221
292
|
}
|
|
222
293
|
catch {
|
|
223
294
|
return [];
|
|
@@ -228,48 +299,109 @@ export class KnowledgeBank {
|
|
|
228
299
|
*/
|
|
229
300
|
async getAllNotes() {
|
|
230
301
|
await this.init();
|
|
231
|
-
const [observations, entities, domains] = await Promise.all([
|
|
302
|
+
const [observations, entities, domains, conventions] = await Promise.all([
|
|
232
303
|
this.scanDirectory(this.observationsDir),
|
|
233
304
|
this.scanDirectory(this.entitiesDir),
|
|
234
305
|
this.scanDirectory(this.domainsDir),
|
|
306
|
+
this.scanDirectory(this.conventionsDir),
|
|
235
307
|
]);
|
|
236
|
-
return [...observations, ...entities, ...domains];
|
|
308
|
+
return [...observations, ...entities, ...domains, ...conventions];
|
|
237
309
|
}
|
|
238
310
|
// =========================================================================
|
|
239
|
-
//
|
|
311
|
+
// Convention Operations (PR-D3)
|
|
240
312
|
// =========================================================================
|
|
241
313
|
/**
|
|
242
|
-
*
|
|
314
|
+
* Store a convention note.
|
|
315
|
+
* Uses addObservation as the underlying write path (coherence skip is safe
|
|
316
|
+
* here since conventions are user-authored, not extracted).
|
|
243
317
|
*/
|
|
244
|
-
async
|
|
318
|
+
async storeConvention(note) {
|
|
245
319
|
await this.init();
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
320
|
+
// Ensure conventions land in the conventions sub-directory
|
|
321
|
+
if (!note.filePath || !note.filePath.includes('conventions/')) {
|
|
322
|
+
note.filePath = this.resolveConventionPath(`${note.frontmatter.id}.md`);
|
|
323
|
+
}
|
|
324
|
+
await this.writeNote(note);
|
|
325
|
+
return note.frontmatter.id;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Upsert a convention by ID: if one with the same ID already exists,
|
|
329
|
+
* merge the evidence count and re-evaluate the binding threshold.
|
|
330
|
+
*
|
|
331
|
+
* Binding rules (PR-D3):
|
|
332
|
+
* - 'instruction' type correction → binding immediately (evidenceCount=1 suffices)
|
|
333
|
+
* - other types → binding when evidenceCount >= 2
|
|
334
|
+
*
|
|
335
|
+
* Returns the (possibly updated) note.
|
|
336
|
+
*/
|
|
337
|
+
async upsertConvention(note) {
|
|
338
|
+
await this.init();
|
|
339
|
+
const existing = await this.getConventionById(note.frontmatter.id);
|
|
340
|
+
if (existing) {
|
|
341
|
+
// Merge evidence count
|
|
342
|
+
const existingEvidence = existing.frontmatter.evidenceCount ?? 1;
|
|
343
|
+
const newEvidence = note.frontmatter.evidenceCount ?? 1;
|
|
344
|
+
const mergedEvidence = existingEvidence + newEvidence;
|
|
345
|
+
existing.frontmatter.evidenceCount = mergedEvidence;
|
|
346
|
+
existing.frontmatter.updated = new Date().toISOString();
|
|
347
|
+
// Re-evaluate binding: instruction tags flip binding immediately;
|
|
348
|
+
// otherwise require >= 2 corroborating corrections.
|
|
349
|
+
const isInstruction = existing.frontmatter.tags.includes('instruction');
|
|
350
|
+
existing.frontmatter.binding = isInstruction || mergedEvidence >= 2;
|
|
351
|
+
existing.frontmatter.confidence = existing.frontmatter.binding ? 0.9 : 0.5;
|
|
352
|
+
// Merge tags from the incoming note
|
|
353
|
+
for (const tag of note.frontmatter.tags) {
|
|
354
|
+
if (!existing.frontmatter.tags.includes(tag)) {
|
|
355
|
+
existing.frontmatter.tags.push(tag);
|
|
356
|
+
}
|
|
256
357
|
}
|
|
358
|
+
await this.storeConvention(existing);
|
|
359
|
+
return existing;
|
|
257
360
|
}
|
|
258
|
-
|
|
361
|
+
await this.storeConvention(note);
|
|
362
|
+
return note;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Retrieve conventions filtered by scope and optionally by domain.
|
|
366
|
+
*
|
|
367
|
+
* Scope semantics:
|
|
368
|
+
* - 'global' conventions are always returned regardless of requested scope.
|
|
369
|
+
* - Other scopes are returned only when their scope matches the requested scope.
|
|
370
|
+
*
|
|
371
|
+
* Pass `repoOrDomain` to additionally filter 'repo' or 'domain' scoped conventions
|
|
372
|
+
* by a specific identifier stored in the note's domain array.
|
|
373
|
+
*/
|
|
374
|
+
async getConventions(options) {
|
|
375
|
+
await this.init();
|
|
376
|
+
const all = await this.scanDirectory(this.conventionsDir);
|
|
377
|
+
return all.filter((note) => {
|
|
378
|
+
const noteScope = note.frontmatter.scope;
|
|
379
|
+
// Binding filter
|
|
380
|
+
if (options?.bindingOnly && !note.frontmatter.binding)
|
|
381
|
+
return false;
|
|
382
|
+
// No scope filter → return all
|
|
383
|
+
if (!options?.scope)
|
|
384
|
+
return true;
|
|
385
|
+
// Global conventions are always included
|
|
386
|
+
if (noteScope === 'global')
|
|
387
|
+
return true;
|
|
388
|
+
// Exact scope match required for non-global
|
|
389
|
+
if (noteScope !== options.scope)
|
|
390
|
+
return false;
|
|
391
|
+
// For repo/domain scopes, also filter by the specific identifier
|
|
392
|
+
if (options.repoOrDomain && (noteScope === 'repo' || noteScope === 'domain')) {
|
|
393
|
+
return note.frontmatter.domain.includes(options.repoOrDomain);
|
|
394
|
+
}
|
|
395
|
+
return true;
|
|
396
|
+
});
|
|
259
397
|
}
|
|
260
398
|
/**
|
|
261
|
-
* Get
|
|
399
|
+
* Get a convention note by ID.
|
|
262
400
|
*/
|
|
263
|
-
async
|
|
401
|
+
async getConventionById(id) {
|
|
264
402
|
await this.init();
|
|
265
|
-
const
|
|
266
|
-
return
|
|
267
|
-
.filter((e) => e.crossSystem === 'playbook')
|
|
268
|
-
.map((e) => ({
|
|
269
|
-
noteId: e.from,
|
|
270
|
-
playbookId: e.to,
|
|
271
|
-
relation: 'supports',
|
|
272
|
-
}));
|
|
403
|
+
const notes = await this.scanDirectory(this.conventionsDir);
|
|
404
|
+
return notes.find((n) => n.frontmatter.id === id) ?? null;
|
|
273
405
|
}
|
|
274
406
|
// =========================================================================
|
|
275
407
|
// Stats
|
|
@@ -282,7 +414,8 @@ export class KnowledgeBank {
|
|
|
282
414
|
this.countFiles(this.domainsDir),
|
|
283
415
|
this.countFiles(this.inboxDir),
|
|
284
416
|
]);
|
|
285
|
-
|
|
417
|
+
// convention count is available via getConventions() but not tracked in KnowledgeStats
|
|
418
|
+
// (KnowledgeStats is a shared interface — we don't widen it to avoid breaking changes)
|
|
286
419
|
// Compute average confidence and domain breakdown
|
|
287
420
|
const allNotes = await this.getAllNotes();
|
|
288
421
|
let totalConfidence = 0;
|
|
@@ -301,7 +434,6 @@ export class KnowledgeBank {
|
|
|
301
434
|
entityCount: entities,
|
|
302
435
|
domainCount: domains,
|
|
303
436
|
inboxCount: inbox,
|
|
304
|
-
graph: graphStats,
|
|
305
437
|
avgConfidence: allNotes.length > 0 ? totalConfidence / allNotes.length : 0,
|
|
306
438
|
staleCount,
|
|
307
439
|
domainBreakdown,
|
|
@@ -325,8 +457,14 @@ export class KnowledgeBank {
|
|
|
325
457
|
}
|
|
326
458
|
// Exclude stale notes
|
|
327
459
|
candidates = candidates.filter((note) => !note.frontmatter.tags.includes('stale'));
|
|
460
|
+
// Exclude index-mode entity records: they are content-free anchors (name +
|
|
461
|
+
// links to atomic facts) and must never be surfaced as retrievable content.
|
|
462
|
+
candidates = candidates.filter((note) => !isEntityIndexRecord(note));
|
|
328
463
|
// Delegate scoring to the search provider
|
|
329
|
-
const results = await this.searchProvider.search(query, candidates, {
|
|
464
|
+
const results = await this.searchProvider.search(query, candidates, {
|
|
465
|
+
maxResults,
|
|
466
|
+
domains: options?.domains,
|
|
467
|
+
});
|
|
330
468
|
// Build a lookup for fast note retrieval by ID
|
|
331
469
|
const noteById = new Map(candidates.map((n) => [n.frontmatter.id, n]));
|
|
332
470
|
const matches = [];
|
|
@@ -343,82 +481,149 @@ export class KnowledgeBank {
|
|
|
343
481
|
return matches;
|
|
344
482
|
}
|
|
345
483
|
/**
|
|
346
|
-
* Get relevant knowledge for a task
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
*
|
|
484
|
+
* Get relevant knowledge for a task.
|
|
485
|
+
*
|
|
486
|
+
* Retrieval is a single fused ranking rather than fixed tiers:
|
|
487
|
+
* - Domain summaries (when a domain is given) are pinned on top as high-level
|
|
488
|
+
* context.
|
|
489
|
+
* - A wide pool of atomic fact/observation notes is retrieved semantically.
|
|
490
|
+
* - Entity records that match the query (index mode) do NOT inject content;
|
|
491
|
+
* instead they add a score BOOST to their linked atomic facts, lifting
|
|
492
|
+
* entity-relevant facts within the pool (see DESIGN WS2a/WS2b).
|
|
493
|
+
* - Legacy content-mode entity notes are still surfaced as `entity` matches.
|
|
494
|
+
* All non-domain candidates then compete on a single fused score.
|
|
350
495
|
*/
|
|
351
496
|
async getRelevantKnowledge(task, options) {
|
|
352
497
|
await this.init();
|
|
353
498
|
const surfacingConfig = this.bankConfig.surfacing;
|
|
354
499
|
const maxNotes = options?.maxNotes ?? surfacingConfig.maxNotesPerTask;
|
|
355
500
|
const maxTokens = options?.maxTokens ?? surfacingConfig.maxTokensForKnowledge;
|
|
356
|
-
const
|
|
501
|
+
const boostWeight = surfacingConfig.entityBoostWeight ?? 0.15;
|
|
502
|
+
// Domain matches are pinned on top.
|
|
503
|
+
const domainMatches = [];
|
|
357
504
|
const seenIds = new Set();
|
|
358
|
-
// Tier 1: Domain match
|
|
359
505
|
if (surfacingConfig.includeDomainSummaries && task.domain) {
|
|
360
506
|
const domainSummary = await this.getDomainSummary(task.domain);
|
|
361
|
-
if (domainSummary
|
|
507
|
+
if (domainSummary) {
|
|
362
508
|
seenIds.add(domainSummary.frontmatter.id);
|
|
363
|
-
|
|
364
|
-
note: domainSummary,
|
|
365
|
-
score: 1.0,
|
|
366
|
-
matchType: 'domain',
|
|
367
|
-
});
|
|
509
|
+
domainMatches.push({ note: domainSummary, score: 1.0, matchType: 'domain' });
|
|
368
510
|
}
|
|
369
511
|
}
|
|
370
|
-
//
|
|
512
|
+
// Entity pass: gather per-fact boosts (index records) and legacy content
|
|
513
|
+
// entity notes to surface directly.
|
|
514
|
+
//
|
|
515
|
+
// The boost is frequency-weighted (IDF-style): an entity linked to many facts
|
|
516
|
+
// (e.g. the conversation's main subject) is non-discriminative, so a flat
|
|
517
|
+
// boost would flood the pool with that entity's generic facts and drown the
|
|
518
|
+
// semantically-relevant ones. We scale the boost down by link count so a rare
|
|
519
|
+
// entity lifts its facts strongly while a ubiquitous one barely moves them.
|
|
520
|
+
const boostByFact = new Map();
|
|
521
|
+
const entityContentMatches = [];
|
|
371
522
|
if (surfacingConfig.includeEntityNotes) {
|
|
372
523
|
const entityNames = await this.listEntities();
|
|
373
524
|
const taskLower = task.description.toLowerCase();
|
|
374
525
|
for (const entitySlug of entityNames) {
|
|
375
526
|
const entityWords = entitySlug.replace(/-/g, ' ');
|
|
376
|
-
if (taskLower.includes(entitySlug) || taskLower.includes(entityWords))
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
527
|
+
if (!(taskLower.includes(entitySlug) || taskLower.includes(entityWords)))
|
|
528
|
+
continue;
|
|
529
|
+
const entityNote = await this.getEntity(entitySlug);
|
|
530
|
+
if (!entityNote)
|
|
531
|
+
continue;
|
|
532
|
+
if (isEntityIndexRecord(entityNote)) {
|
|
533
|
+
const links = entityNote.frontmatter.links.filter((l) => l.layer === 'entity');
|
|
534
|
+
// n=1 → /1.58, n=8 → /3.3, n=100 → /6.6: dominant entities fade out.
|
|
535
|
+
const w = boostWeight / Math.log2(links.length + 2);
|
|
536
|
+
for (const l of links) {
|
|
537
|
+
boostByFact.set(l.target, Math.max(boostByFact.get(l.target) ?? 0, w));
|
|
387
538
|
}
|
|
388
539
|
}
|
|
540
|
+
else if (!seenIds.has(entityNote.frontmatter.id)) {
|
|
541
|
+
entityContentMatches.push({ note: entityNote, score: 0.9, matchType: 'entity' });
|
|
542
|
+
}
|
|
389
543
|
}
|
|
390
544
|
}
|
|
391
|
-
//
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
545
|
+
// Semantic pool — retrieve wider than maxNotes so boosted facts can be
|
|
546
|
+
// lifted into the final window.
|
|
547
|
+
const poolSize = Math.max(maxNotes * 3, maxNotes + boostByFact.size, 12);
|
|
548
|
+
const searchResults = await this.search(task.description, {
|
|
549
|
+
domains: task.domain ? [task.domain] : undefined,
|
|
550
|
+
maxResults: poolSize,
|
|
551
|
+
});
|
|
552
|
+
const fused = searchResults.map((r) => {
|
|
553
|
+
const boost = boostByFact.get(r.note.frontmatter.id);
|
|
554
|
+
return boost ? { ...r, score: r.score + boost, matchType: 'entity' } : r;
|
|
555
|
+
});
|
|
556
|
+
// Combine non-domain candidates and rank by single fused score.
|
|
557
|
+
const rest = [];
|
|
558
|
+
const restSeen = new Set(seenIds);
|
|
559
|
+
for (const m of [...entityContentMatches, ...fused]) {
|
|
560
|
+
const id = m.note.frontmatter.id;
|
|
561
|
+
if (restSeen.has(id))
|
|
562
|
+
continue;
|
|
563
|
+
restSeen.add(id);
|
|
564
|
+
rest.push(m);
|
|
565
|
+
}
|
|
566
|
+
rest.sort((a, b) => b.score - a.score);
|
|
567
|
+
// 1-hop link expansion: pull in neighbors connected to the top matches by
|
|
568
|
+
// EXPLICIT non-index edges (the causal/temporal/semantic links written by
|
|
569
|
+
// evolve()), so a matched fact also surfaces the facts it was linked to —
|
|
570
|
+
// the pre-computed structure a multi-hop question needs. No-op for banks
|
|
571
|
+
// without such links (plain extraction/defrag only create entity-layer
|
|
572
|
+
// index links, which are skipped here since they are already handled by the
|
|
573
|
+
// boost pass above).
|
|
574
|
+
const expanded = await this.expandLinkedNeighbors(rest, restSeen);
|
|
575
|
+
if (expanded.length > 0) {
|
|
576
|
+
rest.push(...expanded);
|
|
577
|
+
rest.sort((a, b) => b.score - a.score);
|
|
578
|
+
}
|
|
579
|
+
// Fill the window from the ranked list, but cap consolidated (entity-type)
|
|
580
|
+
// notes so they supplement rather than evict atomic facts.
|
|
581
|
+
const budget = Math.max(0, maxNotes - domainMatches.length);
|
|
582
|
+
const selected = [];
|
|
583
|
+
let consolidatedCount = 0;
|
|
584
|
+
for (const m of rest) {
|
|
585
|
+
if (selected.length >= budget)
|
|
586
|
+
break;
|
|
587
|
+
if (m.note.frontmatter.type === 'entity') {
|
|
588
|
+
if (consolidatedCount >= MAX_CONSOLIDATED_NOTES)
|
|
400
589
|
continue;
|
|
401
|
-
|
|
402
|
-
matches.push(result);
|
|
403
|
-
if (matches.length >= maxNotes)
|
|
404
|
-
break;
|
|
590
|
+
consolidatedCount++;
|
|
405
591
|
}
|
|
592
|
+
selected.push(m);
|
|
406
593
|
}
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
const typeOrder = { domain: 0, entity: 1, semantic: 2, graph: 3 };
|
|
410
|
-
const typeA = typeOrder[a.matchType ?? 'semantic'];
|
|
411
|
-
const typeB = typeOrder[b.matchType ?? 'semantic'];
|
|
412
|
-
if (typeA !== typeB)
|
|
413
|
-
return typeA - typeB;
|
|
414
|
-
return b.score - a.score;
|
|
415
|
-
});
|
|
416
|
-
// Enforce limits
|
|
417
|
-
const limited = matches.slice(0, maxNotes);
|
|
418
|
-
return this.enforceTokenBudget(limited, maxTokens);
|
|
594
|
+
const combined = [...domainMatches, ...selected];
|
|
595
|
+
return this.enforceTokenBudget(combined, maxTokens, task.description);
|
|
419
596
|
}
|
|
420
597
|
/**
|
|
421
|
-
*
|
|
598
|
+
* Gather the linked neighbors of the top-ranked matches (1 hop), following
|
|
599
|
+
* only explicit non-index edges. Each neighbor is scored as a discount of the
|
|
600
|
+
* seed that reached it, so it competes for a slot without outranking direct
|
|
601
|
+
* matches. Returns notes not already present in `seen`.
|
|
602
|
+
*/
|
|
603
|
+
async expandLinkedNeighbors(ranked, seen) {
|
|
604
|
+
const EXPAND_SEEDS = 8;
|
|
605
|
+
const NEIGHBOR_DISCOUNT = 0.6;
|
|
606
|
+
const additions = [];
|
|
607
|
+
const added = new Set();
|
|
608
|
+
for (const seed of ranked.slice(0, EXPAND_SEEDS)) {
|
|
609
|
+
for (const link of seed.note.frontmatter.links) {
|
|
610
|
+
// Entity-layer (index) links are handled by the boost pass; skip them.
|
|
611
|
+
if (link.layer === 'entity')
|
|
612
|
+
continue;
|
|
613
|
+
const target = link.target;
|
|
614
|
+
if (seen.has(target) || added.has(target))
|
|
615
|
+
continue;
|
|
616
|
+
const note = await this.getNote(target);
|
|
617
|
+
if (!note || isEntityIndexRecord(note) || note.frontmatter.tags.includes('stale'))
|
|
618
|
+
continue;
|
|
619
|
+
added.add(target);
|
|
620
|
+
additions.push({ note, score: seed.score * NEIGHBOR_DISCOUNT, matchType: 'graph' });
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
return additions;
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* Process inbox files: classify, move to correct directory.
|
|
422
627
|
* Files with valid frontmatter are classified by type field.
|
|
423
628
|
* Files without valid frontmatter get heuristic classification as observations.
|
|
424
629
|
*/
|
|
@@ -459,8 +664,6 @@ export class KnowledgeBank {
|
|
|
459
664
|
movedToEntities++;
|
|
460
665
|
else if (result === 'domain-summary')
|
|
461
666
|
movedToDomains++;
|
|
462
|
-
// Add to graph
|
|
463
|
-
this.graph.addNode(this.noteToGraphNode(note));
|
|
464
667
|
// Remove from inbox
|
|
465
668
|
await unlink(absPath);
|
|
466
669
|
processed++;
|
|
@@ -480,6 +683,107 @@ export class KnowledgeBank {
|
|
|
480
683
|
const defragmenter = new KnowledgeDefragmenter(this, this.bankConfig.defrag);
|
|
481
684
|
return defragmenter.defragment();
|
|
482
685
|
}
|
|
686
|
+
/**
|
|
687
|
+
* Agentic memory evolution. Given an `evolver` (an agent- or LLM-backed
|
|
688
|
+
* function; see `createAgenticMemoryEvolver` / `createLlmMemoryEvolver`), take
|
|
689
|
+
* a snapshot of the bank, let the evolver propose a plan, then apply it via
|
|
690
|
+
* existing primitives:
|
|
691
|
+
* - `supersede` → recordContradiction (down-weight stale, point new note)
|
|
692
|
+
* - `merge` → write a consolidated entity note linking the source facts
|
|
693
|
+
* - `link` → add an explicit edge (esp. entity↔entity) for multi-hop
|
|
694
|
+
*
|
|
695
|
+
* The bank never learns HOW the plan was produced — the evolver is a plain
|
|
696
|
+
* function, keeping the memory layer free of the agent/workspace runtime.
|
|
697
|
+
*/
|
|
698
|
+
async evolve(evolver) {
|
|
699
|
+
await this.init();
|
|
700
|
+
const notes = await this.getAllNotes();
|
|
701
|
+
const [entities, domains] = await Promise.all([this.listEntities(), this.listDomains()]);
|
|
702
|
+
const plan = await evolver({ notes, domains, entities });
|
|
703
|
+
return this.applyEvolutionPlan(plan);
|
|
704
|
+
}
|
|
705
|
+
/** Apply a {@link MemoryEvolutionPlan}. Referenced-but-missing note ids are skipped. */
|
|
706
|
+
async applyEvolutionPlan(plan) {
|
|
707
|
+
await this.init();
|
|
708
|
+
const result = { superseded: 0, merged: 0, linked: 0, skipped: 0 };
|
|
709
|
+
for (const action of plan.actions) {
|
|
710
|
+
switch (action.type) {
|
|
711
|
+
case 'supersede': {
|
|
712
|
+
const superseding = await this.getNote(action.supersededById);
|
|
713
|
+
const stale = await this.getNote(action.staleId);
|
|
714
|
+
if (!superseding || !stale) {
|
|
715
|
+
result.skipped++;
|
|
716
|
+
break;
|
|
717
|
+
}
|
|
718
|
+
await this.recordContradiction({
|
|
719
|
+
existingNoteId: action.staleId,
|
|
720
|
+
newObservation: superseding,
|
|
721
|
+
conflictDescription: action.reason || 'evolver: superseded',
|
|
722
|
+
resolution: 'supersede',
|
|
723
|
+
});
|
|
724
|
+
result.superseded++;
|
|
725
|
+
break;
|
|
726
|
+
}
|
|
727
|
+
case 'merge': {
|
|
728
|
+
const sources = (await Promise.all(action.sourceIds.map((id) => this.getNote(id)))).filter((n) => n !== null);
|
|
729
|
+
if (sources.length === 0) {
|
|
730
|
+
result.skipped++;
|
|
731
|
+
break;
|
|
732
|
+
}
|
|
733
|
+
const domain = action.domain ?? [
|
|
734
|
+
...new Set(sources.flatMap((n) => n.frontmatter.domain)),
|
|
735
|
+
];
|
|
736
|
+
const entityNote = createEntityNote({
|
|
737
|
+
entityName: action.entityName,
|
|
738
|
+
body: action.body,
|
|
739
|
+
domain,
|
|
740
|
+
tags: ['evolved', 'consolidated'],
|
|
741
|
+
source: { origin: 'agent-authored' },
|
|
742
|
+
links: sources.map((n) => ({
|
|
743
|
+
target: n.frontmatter.id,
|
|
744
|
+
relation: 'part-of',
|
|
745
|
+
layer: 'entity',
|
|
746
|
+
})),
|
|
747
|
+
});
|
|
748
|
+
await this.addObservation(entityNote);
|
|
749
|
+
result.merged++;
|
|
750
|
+
break;
|
|
751
|
+
}
|
|
752
|
+
case 'link': {
|
|
753
|
+
const applied = await this.addLink(action.from, action.to, action.relation);
|
|
754
|
+
if (applied)
|
|
755
|
+
result.linked++;
|
|
756
|
+
else
|
|
757
|
+
result.skipped++;
|
|
758
|
+
break;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
return result;
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* Add an explicit graph edge from one note to another (idempotent). Returns
|
|
766
|
+
* false if the source note does not exist. Entity↔entity edges added here are
|
|
767
|
+
* what let a single retrieval surface a pre-linked structure for multi-hop
|
|
768
|
+
* questions instead of forcing the answerer to re-derive the join.
|
|
769
|
+
*/
|
|
770
|
+
async addLink(fromId, toId, relation) {
|
|
771
|
+
await this.init();
|
|
772
|
+
const from = await this.getNote(fromId);
|
|
773
|
+
if (!from)
|
|
774
|
+
return false;
|
|
775
|
+
const exists = from.frontmatter.links.some((l) => l.target === toId && l.relation === relation);
|
|
776
|
+
if (!exists) {
|
|
777
|
+
from.frontmatter.links.push({
|
|
778
|
+
target: toId,
|
|
779
|
+
relation,
|
|
780
|
+
layer: inferLayerFromRelation(relation),
|
|
781
|
+
});
|
|
782
|
+
from.frontmatter.updated = new Date().toISOString();
|
|
783
|
+
await this.writeNote(from);
|
|
784
|
+
}
|
|
785
|
+
return true;
|
|
786
|
+
}
|
|
483
787
|
async applyExtraction(extraction) {
|
|
484
788
|
await this.init();
|
|
485
789
|
// 1. Add new observations
|
|
@@ -499,34 +803,22 @@ export class KnowledgeBank {
|
|
|
499
803
|
for (const contradiction of extraction.contradictions) {
|
|
500
804
|
await this.recordContradiction(contradiction);
|
|
501
805
|
}
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
const semanticLayer = this.graph.getLayer('semantic');
|
|
519
|
-
if (!semanticLayer)
|
|
520
|
-
continue;
|
|
521
|
-
semanticLayer.addEdge({
|
|
522
|
-
from: pbLink.noteId,
|
|
523
|
-
to: pbLink.playbookId,
|
|
524
|
-
relation: pbLink.relation,
|
|
525
|
-
weight: 0.5,
|
|
526
|
-
created: new Date().toISOString(),
|
|
527
|
-
crossSystem: 'playbook',
|
|
528
|
-
});
|
|
529
|
-
}
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* First-class ADD-only conversational extraction (see DESIGN WS3).
|
|
809
|
+
*
|
|
810
|
+
* Extracts atomic, coreference-resolved, dated, entity-tagged facts from
|
|
811
|
+
* dialogue turns and writes them as observations. The LLM is injected as a
|
|
812
|
+
* `complete` callback so the memory layer carries no model dependency; without
|
|
813
|
+
* one a deterministic heuristic is used. Returns the extracted knowledge that
|
|
814
|
+
* was applied.
|
|
815
|
+
*/
|
|
816
|
+
async extractFromConversation(input, complete) {
|
|
817
|
+
await this.init();
|
|
818
|
+
const knownEntities = input.knownEntities ?? (await this.listEntities());
|
|
819
|
+
const extraction = await extractConversationFacts({ ...input, knownEntities }, complete);
|
|
820
|
+
await this.applyExtraction(extraction);
|
|
821
|
+
return extraction;
|
|
530
822
|
}
|
|
531
823
|
/**
|
|
532
824
|
* Reinforce a knowledge note with new evidence from a trajectory.
|
|
@@ -539,8 +831,7 @@ export class KnowledgeBank {
|
|
|
539
831
|
throw new Error(`Cannot reinforce: note not found: ${noteId}`);
|
|
540
832
|
}
|
|
541
833
|
const alpha = this.bankConfig.confidence.reinforcementAlpha;
|
|
542
|
-
note.frontmatter.confidence =
|
|
543
|
-
(1 - alpha) * note.frontmatter.confidence + alpha * 1.0;
|
|
834
|
+
note.frontmatter.confidence = (1 - alpha) * note.frontmatter.confidence + alpha * 1.0;
|
|
544
835
|
// Add trajectory to source (no duplicates)
|
|
545
836
|
if (!note.frontmatter.source.trajectories) {
|
|
546
837
|
note.frontmatter.source.trajectories = [];
|
|
@@ -551,7 +842,6 @@ export class KnowledgeBank {
|
|
|
551
842
|
// Update timestamp
|
|
552
843
|
note.frontmatter.updated = new Date().toISOString();
|
|
553
844
|
await this.writeNote(note);
|
|
554
|
-
this.graph.addNode(this.noteToGraphNode(note));
|
|
555
845
|
}
|
|
556
846
|
async recordContradiction(contradiction) {
|
|
557
847
|
await this.init();
|
|
@@ -561,17 +851,6 @@ export class KnowledgeBank {
|
|
|
561
851
|
if (!existingNew) {
|
|
562
852
|
await this.addObservation(contradiction.newObservation);
|
|
563
853
|
}
|
|
564
|
-
// Add a 'contradicts' edge in the entity layer
|
|
565
|
-
const entityLayer = this.graph.getLayer('entity');
|
|
566
|
-
if (entityLayer) {
|
|
567
|
-
entityLayer.addEdge({
|
|
568
|
-
from: contradiction.newObservation.frontmatter.id,
|
|
569
|
-
to: contradiction.existingNoteId,
|
|
570
|
-
relation: 'contradicts',
|
|
571
|
-
weight: 0.8,
|
|
572
|
-
created: new Date().toISOString(),
|
|
573
|
-
});
|
|
574
|
-
}
|
|
575
854
|
// Load the existing note for confidence updates
|
|
576
855
|
const existingNote = await this.getNote(contradiction.existingNoteId);
|
|
577
856
|
if (contradiction.resolution === 'supersede') {
|
|
@@ -579,21 +858,9 @@ export class KnowledgeBank {
|
|
|
579
858
|
if (existingNote) {
|
|
580
859
|
existingNote.frontmatter.confidence = Math.max(0, existingNote.frontmatter.confidence - penalty);
|
|
581
860
|
await this.writeNote(existingNote);
|
|
582
|
-
this.graph.addNode(this.noteToGraphNode(existingNote));
|
|
583
861
|
}
|
|
584
862
|
contradiction.newObservation.frontmatter.supersedes = contradiction.existingNoteId;
|
|
585
863
|
await this.writeNote(contradiction.newObservation);
|
|
586
|
-
// Add temporal 'supersedes' edge
|
|
587
|
-
const temporalLayer = this.graph.getLayer('temporal');
|
|
588
|
-
if (temporalLayer) {
|
|
589
|
-
temporalLayer.addEdge({
|
|
590
|
-
from: contradiction.newObservation.frontmatter.id,
|
|
591
|
-
to: contradiction.existingNoteId,
|
|
592
|
-
relation: 'supersedes',
|
|
593
|
-
weight: 1.0,
|
|
594
|
-
created: new Date().toISOString(),
|
|
595
|
-
});
|
|
596
|
-
}
|
|
597
864
|
}
|
|
598
865
|
else if (contradiction.resolution === 'coexist') {
|
|
599
866
|
// Both notes get half penalty
|
|
@@ -601,13 +868,11 @@ export class KnowledgeBank {
|
|
|
601
868
|
if (existingNote) {
|
|
602
869
|
existingNote.frontmatter.confidence = Math.max(0, existingNote.frontmatter.confidence - halfPenalty);
|
|
603
870
|
await this.writeNote(existingNote);
|
|
604
|
-
this.graph.addNode(this.noteToGraphNode(existingNote));
|
|
605
871
|
}
|
|
606
872
|
const newNote = await this.getNote(contradiction.newObservation.frontmatter.id);
|
|
607
873
|
if (newNote) {
|
|
608
874
|
newNote.frontmatter.confidence = Math.max(0, newNote.frontmatter.confidence - halfPenalty);
|
|
609
875
|
await this.writeNote(newNote);
|
|
610
|
-
this.graph.addNode(this.noteToGraphNode(newNote));
|
|
611
876
|
}
|
|
612
877
|
}
|
|
613
878
|
else if (contradiction.resolution === 'review') {
|
|
@@ -616,14 +881,12 @@ export class KnowledgeBank {
|
|
|
616
881
|
if (!existingNote.frontmatter.tags.includes('needs-review')) {
|
|
617
882
|
existingNote.frontmatter.tags.push('needs-review');
|
|
618
883
|
await this.writeNote(existingNote);
|
|
619
|
-
this.graph.addNode(this.noteToGraphNode(existingNote));
|
|
620
884
|
}
|
|
621
885
|
}
|
|
622
886
|
const newNote = await this.getNote(contradiction.newObservation.frontmatter.id);
|
|
623
887
|
if (newNote && !newNote.frontmatter.tags.includes('needs-review')) {
|
|
624
888
|
newNote.frontmatter.tags.push('needs-review');
|
|
625
889
|
await this.writeNote(newNote);
|
|
626
|
-
this.graph.addNode(this.noteToGraphNode(newNote));
|
|
627
890
|
}
|
|
628
891
|
}
|
|
629
892
|
}
|
|
@@ -670,7 +933,6 @@ export class KnowledgeBank {
|
|
|
670
933
|
}
|
|
671
934
|
// Write to disk without updating the 'updated' timestamp
|
|
672
935
|
await this.writeNote(note);
|
|
673
|
-
this.graph.addNode(this.noteToGraphNode(note));
|
|
674
936
|
decayed++;
|
|
675
937
|
}
|
|
676
938
|
return { decayed, newlyStale, alreadyStale };
|
|
@@ -691,40 +953,39 @@ export class KnowledgeBank {
|
|
|
691
953
|
if (!analysis && options?.analyzer) {
|
|
692
954
|
analysis = await options.analyzer.analyze(item.trajectory);
|
|
693
955
|
}
|
|
694
|
-
const extraction = await this.extractFromTrajectory(item.trajectory, analysis, options?.
|
|
956
|
+
const extraction = await this.extractFromTrajectory(item.trajectory, analysis, options?.agenticExtractor);
|
|
695
957
|
results.push(extraction);
|
|
696
958
|
}
|
|
697
959
|
return results;
|
|
698
960
|
}
|
|
699
961
|
/**
|
|
700
962
|
* Extract knowledge from a single trajectory.
|
|
701
|
-
* Uses the
|
|
702
|
-
*
|
|
963
|
+
* Uses the agentic extractor if provided (wire one up with the workspace
|
|
964
|
+
* layer's `createAgenticKnowledgeExtractor`), otherwise falls back to the
|
|
965
|
+
* heuristic extractor. Applies the extraction to the knowledge bank.
|
|
703
966
|
*/
|
|
704
|
-
async extractFromTrajectory(trajectory, analysis,
|
|
967
|
+
async extractFromTrajectory(trajectory, analysis, agenticExtractor) {
|
|
705
968
|
await this.init();
|
|
706
969
|
// Compute analysis if not provided
|
|
707
970
|
const { createAnalyzer } = await import('../learning/analyzer.js');
|
|
708
|
-
const resolvedAnalysis = analysis ?? await createAnalyzer('simple').analyze(trajectory);
|
|
971
|
+
const resolvedAnalysis = analysis ?? (await createAnalyzer('simple').analyze(trajectory));
|
|
709
972
|
// Gather context for extraction
|
|
710
973
|
const existingEntities = await this.listEntities();
|
|
711
974
|
const relatedNotes = await this.getAllNotes();
|
|
712
|
-
// Try
|
|
713
|
-
if (
|
|
975
|
+
// Try agentic extraction if an extractor is available
|
|
976
|
+
if (agenticExtractor) {
|
|
714
977
|
try {
|
|
715
|
-
const
|
|
716
|
-
const result = await taskRunner.run(knowledgeExtractionTemplate, {
|
|
978
|
+
const extraction = await agenticExtractor({
|
|
717
979
|
trajectory,
|
|
718
980
|
analysis: resolvedAnalysis,
|
|
719
981
|
existingEntities,
|
|
720
982
|
relatedNotes: relatedNotes.slice(0, 20),
|
|
721
983
|
});
|
|
722
|
-
const extraction = result.output;
|
|
723
984
|
await this.applyExtraction(extraction);
|
|
724
985
|
return extraction;
|
|
725
986
|
}
|
|
726
987
|
catch (error) {
|
|
727
|
-
|
|
988
|
+
logger.error('Agentic knowledge extraction failed, falling back to heuristic:', error instanceof Error ? error.message : error);
|
|
728
989
|
}
|
|
729
990
|
}
|
|
730
991
|
// Heuristic fallback
|
|
@@ -781,6 +1042,44 @@ export class KnowledgeBank {
|
|
|
781
1042
|
setSearchProvider(provider) {
|
|
782
1043
|
this.searchProvider = provider;
|
|
783
1044
|
}
|
|
1045
|
+
/**
|
|
1046
|
+
* Attach a neural embedding provider. When set, knowledge-note retrieval
|
|
1047
|
+
* defaults to a **hybrid** scorer ({@link HybridSearchProvider}: lexical
|
|
1048
|
+
* TextSimilarity + embedding cosine, fused by balanced linear w=0.5 — the
|
|
1049
|
+
* cross-benchmark best); pass `null` to revert to the lexical TextSimilarity
|
|
1050
|
+
* floor.
|
|
1051
|
+
*
|
|
1052
|
+
* Why hybrid by default: on real memory-QA retrieval (LoCoMo) the hybrid beats
|
|
1053
|
+
* BOTH pure embedding and pure lexical overall (+9pp over the best single
|
|
1054
|
+
* channel) — embedding alone actually *lost* to lexical there because most
|
|
1055
|
+
* questions share surface tokens with their evidence. See
|
|
1056
|
+
* docs/DESIGN-memory-qa-benchmarks.md §4a. Set `mode: 'embedding'` for the
|
|
1057
|
+
* pure-cosine path (e.g. paraphrase-heavy corpora; see amem §6.6).
|
|
1058
|
+
*
|
|
1059
|
+
* Precedence: an explicitly configured embedder wins over minimem
|
|
1060
|
+
* auto-detection (see {@link detectMinimem}).
|
|
1061
|
+
*/
|
|
1062
|
+
setEmbeddingProvider(provider, options) {
|
|
1063
|
+
this.embedder = provider;
|
|
1064
|
+
this.embeddingConfigured = provider !== null;
|
|
1065
|
+
if (!provider) {
|
|
1066
|
+
this.searchProvider = new TextSimilaritySearchProvider();
|
|
1067
|
+
return;
|
|
1068
|
+
}
|
|
1069
|
+
const embedding = new EmbeddingSearchProvider(provider, { minScore: options?.minScore });
|
|
1070
|
+
// Hybrid weight auto-tunes to the encoder (bge→0.2, all-MiniLM→0.5; §4f).
|
|
1071
|
+
this.searchProvider =
|
|
1072
|
+
(options?.mode ?? 'hybrid') === 'embedding'
|
|
1073
|
+
? embedding
|
|
1074
|
+
: new HybridSearchProvider(new TextSimilaritySearchProvider(), embedding, {
|
|
1075
|
+
...options?.hybrid,
|
|
1076
|
+
lexicalWeight: options?.hybrid?.lexicalWeight ?? provider.recommendedLexicalWeight ?? 0.5,
|
|
1077
|
+
});
|
|
1078
|
+
}
|
|
1079
|
+
/** The attached embedding provider, if any. */
|
|
1080
|
+
getEmbeddingProvider() {
|
|
1081
|
+
return this.embedder;
|
|
1082
|
+
}
|
|
784
1083
|
// =========================================================================
|
|
785
1084
|
// Internal Helpers
|
|
786
1085
|
// =========================================================================
|
|
@@ -795,6 +1094,9 @@ export class KnowledgeBank {
|
|
|
795
1094
|
* Falls back to TextSimilaritySearchProvider on any failure.
|
|
796
1095
|
*/
|
|
797
1096
|
async detectMinimem() {
|
|
1097
|
+
// An explicitly configured embedding provider takes precedence over minimem.
|
|
1098
|
+
if (this.embeddingConfigured)
|
|
1099
|
+
return;
|
|
798
1100
|
try {
|
|
799
1101
|
// Check for minimem markers
|
|
800
1102
|
const minimemDir = join(this.memoryDir, '.minimem');
|
|
@@ -861,7 +1163,14 @@ export class KnowledgeBank {
|
|
|
861
1163
|
const dir = absPath.substring(0, absPath.lastIndexOf('/'));
|
|
862
1164
|
await mkdir(dir, { recursive: true });
|
|
863
1165
|
const content = serializeKnowledgeNote(note);
|
|
864
|
-
|
|
1166
|
+
// Atomic write: same-dir temp file + rename (atomic within a filesystem) so a
|
|
1167
|
+
// crash mid-write never leaves a truncated note. Mirrors the procedural
|
|
1168
|
+
// SKILL.md writer (procedural-skill.ts). The `.tmp` temp is hidden and skipped
|
|
1169
|
+
// by scanDirectory (which only reads `.md`).
|
|
1170
|
+
const fileName = absPath.substring(absPath.lastIndexOf('/') + 1);
|
|
1171
|
+
const tmpPath = join(dir, `.${fileName}.${Date.now()}.${Math.random().toString(36).slice(2)}.tmp`);
|
|
1172
|
+
await writeFile(tmpPath, content, 'utf-8');
|
|
1173
|
+
await rename(tmpPath, absPath);
|
|
865
1174
|
}
|
|
866
1175
|
/**
|
|
867
1176
|
* Scan a directory for .md files and parse them as KnowledgeNotes.
|
|
@@ -909,9 +1218,7 @@ export class KnowledgeBank {
|
|
|
909
1218
|
* When minimemAware, paths are nested under memory/knowledge/ instead of knowledge/.
|
|
910
1219
|
*/
|
|
911
1220
|
resolveNotePath(type, filename) {
|
|
912
|
-
const knowledgePrefix = this.bankConfig.minimemAware
|
|
913
|
-
? 'memory/knowledge'
|
|
914
|
-
: 'knowledge';
|
|
1221
|
+
const knowledgePrefix = this.bankConfig.minimemAware ? 'memory/knowledge' : 'knowledge';
|
|
915
1222
|
if (type === 'entity') {
|
|
916
1223
|
return `${knowledgePrefix}/entities/${filename}`;
|
|
917
1224
|
}
|
|
@@ -920,12 +1227,20 @@ export class KnowledgeBank {
|
|
|
920
1227
|
}
|
|
921
1228
|
return `${knowledgePrefix}/observations/${filename}`;
|
|
922
1229
|
}
|
|
1230
|
+
/**
|
|
1231
|
+
* Resolve the relative path for a convention note filename.
|
|
1232
|
+
*/
|
|
1233
|
+
resolveConventionPath(filename) {
|
|
1234
|
+
const knowledgePrefix = this.bankConfig.minimemAware ? 'memory/knowledge' : 'knowledge';
|
|
1235
|
+
return `${knowledgePrefix}/conventions/${filename}`;
|
|
1236
|
+
}
|
|
923
1237
|
/**
|
|
924
1238
|
* Move an inbox note to the correct directory based on its type.
|
|
925
1239
|
* Updates the note's filePath accordingly.
|
|
926
1240
|
*/
|
|
927
1241
|
async moveInboxNote(note) {
|
|
928
1242
|
const type = note.frontmatter.type;
|
|
1243
|
+
// convention notes are not moved through inbox — they go via storeConvention
|
|
929
1244
|
const noteType = type === 'entity' ? 'entity' : type === 'domain-summary' ? 'domain-summary' : 'observation';
|
|
930
1245
|
const filename = `${note.frontmatter.id}.md`;
|
|
931
1246
|
note.filePath = this.resolveNotePath(noteType, filename);
|
|
@@ -950,22 +1265,30 @@ export class KnowledgeBank {
|
|
|
950
1265
|
source: { origin: 'agent-authored' },
|
|
951
1266
|
});
|
|
952
1267
|
}
|
|
953
|
-
/**
|
|
954
|
-
* Convert a KnowledgeNote to a GraphNode.
|
|
955
|
-
*/
|
|
956
1268
|
/**
|
|
957
1269
|
* Enforce a token budget on a list of matches.
|
|
958
1270
|
* Always includes at least one match.
|
|
959
1271
|
*/
|
|
960
|
-
enforceTokenBudget(matches, maxTokens) {
|
|
1272
|
+
enforceTokenBudget(matches, maxTokens, query) {
|
|
961
1273
|
const result = [];
|
|
962
1274
|
let usedTokens = 0;
|
|
963
1275
|
for (const match of matches) {
|
|
964
|
-
|
|
1276
|
+
let body = match.note.body;
|
|
1277
|
+
// Relevance-aware per-note excerpting: when a single note would consume a
|
|
1278
|
+
// large share of the budget, keep the query-relevant sections rather than
|
|
1279
|
+
// dropping the note or blindly head-truncating (WS2c). Only applies to
|
|
1280
|
+
// oversized multi-section notes; atomic facts pass through untouched.
|
|
1281
|
+
if (query) {
|
|
1282
|
+
const perNoteCharBudget = Math.max(600, Math.floor((maxTokens * 4) / 2));
|
|
1283
|
+
if (body.length > perNoteCharBudget) {
|
|
1284
|
+
body = excerptForQuery(body, query, perNoteCharBudget);
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
const noteTokens = Math.ceil(body.length / 4);
|
|
965
1288
|
if (usedTokens + noteTokens > maxTokens && result.length > 0) {
|
|
966
1289
|
break;
|
|
967
1290
|
}
|
|
968
|
-
result.push(match);
|
|
1291
|
+
result.push(body === match.note.body ? match : { ...match, note: { ...match.note, body } });
|
|
969
1292
|
usedTokens += noteTokens;
|
|
970
1293
|
}
|
|
971
1294
|
return result;
|
|
@@ -1003,7 +1326,7 @@ export class KnowledgeBank {
|
|
|
1003
1326
|
const trajectoryIds = note.frontmatter.source.trajectories.slice(0, 3);
|
|
1004
1327
|
lines.push(`\n*Evidence: ${trajectoryIds.join(', ')}*`);
|
|
1005
1328
|
}
|
|
1006
|
-
//
|
|
1329
|
+
// Frontmatter links
|
|
1007
1330
|
if (includeLinks && note.frontmatter.links.length > 0) {
|
|
1008
1331
|
const linkSummary = note.frontmatter.links
|
|
1009
1332
|
.slice(0, 3)
|
|
@@ -1032,17 +1355,5 @@ export class KnowledgeBank {
|
|
|
1032
1355
|
return hasDomainOverlap;
|
|
1033
1356
|
});
|
|
1034
1357
|
}
|
|
1035
|
-
noteToGraphNode(note) {
|
|
1036
|
-
return {
|
|
1037
|
-
id: note.frontmatter.id,
|
|
1038
|
-
file: note.filePath,
|
|
1039
|
-
type: note.frontmatter.type,
|
|
1040
|
-
domains: note.frontmatter.domain,
|
|
1041
|
-
entities: note.frontmatter.entities,
|
|
1042
|
-
tags: note.frontmatter.tags,
|
|
1043
|
-
confidence: note.frontmatter.confidence,
|
|
1044
|
-
updated: note.frontmatter.updated,
|
|
1045
|
-
};
|
|
1046
|
-
}
|
|
1047
1358
|
}
|
|
1048
1359
|
//# sourceMappingURL=knowledge-bank.js.map
|