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
package/dist/atlas.js
CHANGED
|
@@ -1,26 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { logger } from './utils/logger.js';
|
|
2
|
+
import { taskSignature } from './utils/task-signature.js';
|
|
3
|
+
import { deriveObjectives } from './utils/objectives.js';
|
|
4
|
+
import { applyValidationControls, createDefaultConfig } from './types/index.js';
|
|
2
5
|
import { createMemorySystem } from './memory/index.js';
|
|
3
|
-
import { loadCuratedPlaybooks as loadCuratedPlaybooksFn,
|
|
6
|
+
import { loadCuratedPlaybooks as loadCuratedPlaybooksFn, BUNDLED_SEED_PACKS, } from './memory/curated-loader.js';
|
|
4
7
|
import { resolvePlaybookSource, sourceStateKey, } from './memory/source-resolver.js';
|
|
5
8
|
import { createUnifiedPipeline, } from './learning/unified-pipeline.js';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { createConsolidationCoordinator, } from './learning/consolidation-coordinator.js';
|
|
10
|
+
import { LLMJudgeReplay, LiveReplay, BudgetedReplayJudge, ConditionalReplayJudge, StubJudge, } from './learning/replay.js';
|
|
11
|
+
import { AgentReplayExecutor } from './learning/replay-executor.js';
|
|
12
|
+
import { DefaultEnvironmentProvider, CompositeEnvironmentProvider, ReplayVerifierRegistry, buildReplayDescriptor, readReplayDescriptor, REPLAY_METADATA_KEY, } from './learning/replay-types.js';
|
|
13
|
+
import { GitWorkspaceSnapshotStore, WorkspaceSnapshotProvider, } from './learning/workspace-snapshot.js';
|
|
14
|
+
import { createUsageInference } from './learning/usage-inference.js';
|
|
11
15
|
import { createRouter } from './search/router.js';
|
|
12
|
-
import {
|
|
13
|
-
import { createRefinementLoop, } from './search/refinement-loop.js';
|
|
16
|
+
import { CostTracker, createRefinementLoop } from './search/refinement-loop.js';
|
|
14
17
|
import { createAgentManager } from './runtime/manager.js';
|
|
15
|
-
import { createSkillLibrary
|
|
18
|
+
import { createSkillLibrary } from './surfacing/skill-library.js';
|
|
16
19
|
import { SqliteStorageAdapter } from './surfacing/sqlite-storage-adapter.js';
|
|
20
|
+
import { SharedSkillBank, resolveSharedBankPath } from './surfacing/shared-bank.js';
|
|
17
21
|
import { join } from 'node:path';
|
|
18
22
|
import { createSqlitePersistence } from './persistence/index.js';
|
|
19
|
-
import { createPlaybookMCPServer
|
|
20
|
-
import { createAgenticTaskRunner
|
|
23
|
+
import { createPlaybookMCPServer } from './mcp/playbook-server.js';
|
|
24
|
+
import { createAgenticTaskRunner } from './workspace/runner.js';
|
|
21
25
|
import { usageInferenceTemplate } from './workspace/templates/usage-inference.js';
|
|
22
|
-
import { metaReflectionTemplate } from './workspace/templates/meta-reflection.js';
|
|
23
26
|
import { WorkspaceManager } from 'agent-workspace';
|
|
27
|
+
import { createExternalKnowledgeAcquisition, } from './learning/compound-bootstrap/index.js';
|
|
24
28
|
/**
|
|
25
29
|
* Atlas - Adaptive Trajectory Learning and Abstraction System
|
|
26
30
|
*
|
|
@@ -34,30 +38,42 @@ export class Atlas {
|
|
|
34
38
|
memory;
|
|
35
39
|
unifiedPipeline;
|
|
36
40
|
router;
|
|
37
|
-
solver = null;
|
|
38
41
|
agentManager = null;
|
|
39
42
|
refinementLoop = null;
|
|
40
43
|
config;
|
|
41
|
-
|
|
44
|
+
/** Provider bound for LLM-backed learning (reflective generation + judge fallback). */
|
|
45
|
+
learningProvider = null;
|
|
46
|
+
/** Registry resolving a descriptor's `verifierId` → verifier for live replay. */
|
|
47
|
+
replayVerifiers = new ReplayVerifierRegistry();
|
|
48
|
+
/** When set, solves capture a workspace snapshot for faithful Regime-B replay. */
|
|
49
|
+
snapshotStore = null;
|
|
50
|
+
/** Retention policy for snapshot GC (dead-ref grace period + object reclaim). */
|
|
51
|
+
snapshotRetention = {
|
|
52
|
+
maxAgeMs: 24 * 60 * 60 * 1000,
|
|
53
|
+
gc: false,
|
|
54
|
+
};
|
|
55
|
+
snapshotGcRegistered = false;
|
|
42
56
|
trajectoriesProcessed = 0;
|
|
43
|
-
teamTrajectoriesProcessed = 0;
|
|
44
57
|
// Playbook-based components
|
|
45
58
|
skillLibrary = null;
|
|
46
59
|
skillTreeStorage = null;
|
|
60
|
+
sharedSkillBank = null;
|
|
47
61
|
usageInference = null;
|
|
48
62
|
mcpServer = null;
|
|
49
63
|
// Agentic workspace components
|
|
50
64
|
taskRunner = null;
|
|
51
65
|
workspaceManager = null;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
teamSkillLibrary = null;
|
|
66
|
+
analysisAgentManager = null;
|
|
67
|
+
analysisWorkspaceManager = null;
|
|
68
|
+
// External knowledge acquisition (cold-start bootstrap + diagnostic gap-fill)
|
|
69
|
+
externalAcquisition = null;
|
|
57
70
|
// Unified SQLite persistence
|
|
58
71
|
persistence;
|
|
72
|
+
// Dreaming / consolidation (Phase B)
|
|
73
|
+
consolidationCoordinator = null;
|
|
74
|
+
dreamTimer = null;
|
|
59
75
|
constructor(config) {
|
|
60
|
-
this.config = createDefaultConfig(config);
|
|
76
|
+
this.config = applyValidationControls(createDefaultConfig(config));
|
|
61
77
|
// Create unified SQLite persistence
|
|
62
78
|
this.persistence = createSqlitePersistence({
|
|
63
79
|
baseDir: this.config.storage.baseDir,
|
|
@@ -65,37 +81,46 @@ export class Atlas {
|
|
|
65
81
|
});
|
|
66
82
|
// Initialize memory system (with optional knowledge bank)
|
|
67
83
|
this.memory = createMemorySystem(this.persistence, this.config.storage.baseDir, this.config.memory, this.config.knowledgeBank.enabled
|
|
68
|
-
? {
|
|
84
|
+
? {
|
|
85
|
+
...this.config.knowledgeBank,
|
|
86
|
+
coherenceChecking: this.config.features.coherenceChecking,
|
|
87
|
+
}
|
|
69
88
|
: undefined);
|
|
89
|
+
this.memory.setValidationControls(this.config.validation);
|
|
70
90
|
// Initialize unified learning pipeline (replaces LearningPipeline + InstantLoop + LoopCoordinator)
|
|
71
91
|
this.unifiedPipeline = createUnifiedPipeline(this.memory, {
|
|
72
92
|
instant: {
|
|
73
93
|
enableReflexion: this.config.features.reflexion,
|
|
74
|
-
enableCausalExtraction: this.config.features.causalExtraction,
|
|
75
94
|
},
|
|
76
95
|
batch: {
|
|
77
96
|
learning: this.config.learning,
|
|
78
|
-
energy: {
|
|
79
|
-
countThreshold: this.config.learning.minTrajectories ?? 10,
|
|
80
|
-
},
|
|
81
97
|
},
|
|
82
98
|
features: {
|
|
83
99
|
temporalCompression: this.config.features.temporalCompression,
|
|
84
|
-
reasoningBank: this.config.features.reasoningBank,
|
|
85
100
|
reflexion: this.config.features.reflexion,
|
|
86
|
-
|
|
101
|
+
dreamQueue: this.config.features.dreamQueue,
|
|
102
|
+
mergeProposing: this.config.features.mergeProposing,
|
|
103
|
+
reflectiveMutation: this.config.features.reflectiveMutation,
|
|
104
|
+
curation: this.config.features.curation,
|
|
105
|
+
liftTracking: this.config.features.liftTracking,
|
|
106
|
+
additiveConsolidation: this.config.features.additiveConsolidation,
|
|
107
|
+
},
|
|
108
|
+
dream: {
|
|
109
|
+
maxRowsPerDream: this.config.dream.maxRowsPerDream,
|
|
110
|
+
maxBatchesPerDream: this.config.dream.maxBatchesPerDream,
|
|
111
|
+
leaseTtlMs: this.config.dream.leaseTtlMs,
|
|
112
|
+
maxAttempts: this.config.dream.maxAttempts,
|
|
87
113
|
},
|
|
114
|
+
validation: this.config.validation,
|
|
88
115
|
}, this.persistence);
|
|
89
|
-
//
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
this.teamSkillLibrary = createTeamSkillLibrary(this.memory.teamExperiences);
|
|
98
|
-
}
|
|
116
|
+
// Consolidation coordinator: decides when a dream runs (cadence +
|
|
117
|
+
// single-flight). Drives the idle scheduler and the explicit dream() API.
|
|
118
|
+
this.consolidationCoordinator = createConsolidationCoordinator(this.persistence, (opts) => this.unifiedPipeline.dream(opts), {
|
|
119
|
+
countThreshold: this.config.dream.countThreshold,
|
|
120
|
+
maxStalenessMs: this.config.dream.maxStalenessMs,
|
|
121
|
+
});
|
|
122
|
+
// Initialize router
|
|
123
|
+
this.router = createRouter(this.memory, this.config.router, undefined);
|
|
99
124
|
}
|
|
100
125
|
/**
|
|
101
126
|
* Initialize Atlas (load persisted data)
|
|
@@ -103,7 +128,6 @@ export class Atlas {
|
|
|
103
128
|
async init() {
|
|
104
129
|
await this.persistence.init();
|
|
105
130
|
// Load persisted state for components created before persistence.init()
|
|
106
|
-
this.router.loadPersistedState();
|
|
107
131
|
this.unifiedPipeline.loadPersistedState();
|
|
108
132
|
await this.memory.init();
|
|
109
133
|
// Initialize unified pipeline async components (meta-learner, effectiveness tracker, energy seed)
|
|
@@ -113,18 +137,39 @@ export class Atlas {
|
|
|
113
137
|
if (metaLearner) {
|
|
114
138
|
this.router.setMetaLearner(metaLearner);
|
|
115
139
|
}
|
|
140
|
+
// Initialize external knowledge acquisition (cold-start bootstrap)
|
|
141
|
+
if (this.memory.knowledgeBank) {
|
|
142
|
+
this.externalAcquisition = createExternalKnowledgeAcquisition();
|
|
143
|
+
}
|
|
116
144
|
// Initialize playbook-based components if playbooks are available
|
|
117
145
|
if (this.memory.playbooks) {
|
|
146
|
+
// PR-D2: wire write-time curation config into PlaybookLibrary.
|
|
147
|
+
this.memory.playbooks.setCurationConfig({
|
|
148
|
+
enabled: this.config.features.curation,
|
|
149
|
+
});
|
|
118
150
|
// Load curated playbooks (bundled seed pack + additional dirs)
|
|
119
151
|
await this.loadCuratedPlaybooks();
|
|
120
|
-
this.skillLibrary = createSkillLibrary(this.memory.playbooks,
|
|
152
|
+
this.skillLibrary = createSkillLibrary(this.memory.playbooks, {
|
|
153
|
+
...this.config.skillLibrary,
|
|
154
|
+
// Keep Atlas' two playbook injection channels aligned when the
|
|
155
|
+
// memory retriever is switched for an experiment.
|
|
156
|
+
retrieval: this.config.memory.playbookRetrieval.mode !== 'legacy'
|
|
157
|
+
? this.config.memory.playbookRetrieval
|
|
158
|
+
: this.config.skillLibrary.retrieval,
|
|
159
|
+
});
|
|
121
160
|
this.usageInference = createUsageInference();
|
|
122
161
|
// Wire skill-tree publisher if enabled (default: true)
|
|
123
162
|
if (this.config.skillTree.enabled) {
|
|
124
163
|
const dbPath = join(this.config.storage.baseDir, this.config.skillTree.dbPath);
|
|
125
164
|
this.skillTreeStorage = new SqliteStorageAdapter(dbPath);
|
|
126
165
|
await this.skillTreeStorage.initialize();
|
|
127
|
-
|
|
166
|
+
// Optional shared-bank mirror: extracted playbooks are also written
|
|
167
|
+
// to a shared skill-tree filesystem bank (default ~/.skill-tree) so
|
|
168
|
+
// out-of-process consumers see them without an openhive bridge.
|
|
169
|
+
if (this.config.skillTree.sharedBank.enabled) {
|
|
170
|
+
this.sharedSkillBank = new SharedSkillBank(resolveSharedBankPath(this.config.skillTree.sharedBank.path));
|
|
171
|
+
}
|
|
172
|
+
this.skillLibrary.setPublisher(this.skillTreeStorage, this.sharedSkillBank ?? undefined);
|
|
128
173
|
}
|
|
129
174
|
// Refresh skill tiers on init
|
|
130
175
|
await this.skillLibrary.refreshTiers();
|
|
@@ -138,18 +183,24 @@ export class Atlas {
|
|
|
138
183
|
async loadCuratedPlaybooks() {
|
|
139
184
|
const cfg = this.config.curatedPlaybooks;
|
|
140
185
|
const recreate = cfg.recreateOnInit;
|
|
141
|
-
// Load bundled seed
|
|
186
|
+
// Load bundled seed packs (shipped with cognitive-core). Cold-start
|
|
187
|
+
// semantics: bundled packs only seed an EMPTY library so a warm store is
|
|
188
|
+
// never retro-seeded on upgrade; `recreateOnInit` bypasses the check for
|
|
189
|
+
// explicit seed-update workflows.
|
|
142
190
|
if (cfg.loadBundledSeedPack) {
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
191
|
+
const libraryEmpty = (await this.memory.playbooks.count()) === 0;
|
|
192
|
+
if (libraryEmpty || recreate) {
|
|
193
|
+
for (const pack of BUNDLED_SEED_PACKS) {
|
|
194
|
+
const loadOpts = recreate
|
|
195
|
+
? { recreate: true, sourceId: pack.sourceId }
|
|
196
|
+
: { sourceId: pack.sourceId };
|
|
197
|
+
await loadCuratedPlaybooksFn(pack.dir, this.memory.playbooks, loadOpts);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
147
200
|
}
|
|
148
201
|
// Load from additional directories (backward compat)
|
|
149
202
|
for (const dir of cfg.additionalDirs) {
|
|
150
|
-
const loadOpts = recreate
|
|
151
|
-
? { recreate: true, sourceId: dir }
|
|
152
|
-
: { sourceId: dir };
|
|
203
|
+
const loadOpts = recreate ? { recreate: true, sourceId: dir } : { sourceId: dir };
|
|
153
204
|
await loadCuratedPlaybooksFn(dir, this.memory.playbooks, loadOpts);
|
|
154
205
|
}
|
|
155
206
|
// Resolve and load from sources (local paths + git repos)
|
|
@@ -192,12 +243,187 @@ export class Atlas {
|
|
|
192
243
|
}
|
|
193
244
|
}
|
|
194
245
|
/**
|
|
195
|
-
*
|
|
196
|
-
*
|
|
246
|
+
* Register an LLM provider for LLM-backed learning — reflective playbook
|
|
247
|
+
* mutation and ReplayJudge-gated merge proposing. Independent of the
|
|
248
|
+
* solving path, so it can be used alongside `setAgentManager` (the
|
|
249
|
+
* recommended execution path, which uses backends rather than a single
|
|
250
|
+
* LLMProvider).
|
|
251
|
+
*
|
|
252
|
+
* The provider is bound into the maintenance loop and used to build a
|
|
253
|
+
* default {@link LLMJudgeReplay} for gating candidates. The
|
|
254
|
+
* `reflectiveMutation` / `mergeProposing` feature flags still gate
|
|
255
|
+
* whether those tasks actually run — without them set, this is a no-op
|
|
256
|
+
* at maintenance time.
|
|
197
257
|
*/
|
|
198
|
-
|
|
199
|
-
this.
|
|
200
|
-
|
|
258
|
+
setLearningProvider(provider) {
|
|
259
|
+
this.learningProvider = provider;
|
|
260
|
+
// Bind the generator; install a default LLM judge ONLY if none is set, so
|
|
261
|
+
// a previously-installed live judge (enableLiveReplayGating) survives a
|
|
262
|
+
// later setLearningProvider call regardless of order.
|
|
263
|
+
this.unifiedPipeline.setLearningLLM(provider);
|
|
264
|
+
this.unifiedPipeline.setJudgeIfUnset(new LLMJudgeReplay(provider));
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Register a verifier under an id so that live replay can score a
|
|
268
|
+
* reconstructed environment with a domain-appropriate signal. The id is
|
|
269
|
+
* stamped into an experience's replay descriptor (via the `replay` solve
|
|
270
|
+
* option) and resolved here at replay time.
|
|
271
|
+
*/
|
|
272
|
+
registerReplayVerifier(id, verifier) {
|
|
273
|
+
this.replayVerifiers.register(id, verifier);
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Enable Regime-B workspace snapshotting: each solve captures the working
|
|
277
|
+
* tree's initial state, so live-replay gating can later rematerialize it
|
|
278
|
+
* and score a candidate against the real end-state (build/tests). Defaults
|
|
279
|
+
* to a git-backed store; pass a custom store to override.
|
|
280
|
+
*
|
|
281
|
+
* Capture is best-effort and safe: non-git working trees (or capture
|
|
282
|
+
* failures) simply leave the experience non-snapshot-replayable, and
|
|
283
|
+
* gating falls back to the cheaper judge. Pair with a `replay.snapshot`
|
|
284
|
+
* solve hint to supply the verification command for scoring.
|
|
285
|
+
*/
|
|
286
|
+
enableWorkspaceSnapshots(store, options) {
|
|
287
|
+
this.snapshotStore =
|
|
288
|
+
store ??
|
|
289
|
+
new GitWorkspaceSnapshotStore({
|
|
290
|
+
excludePathspecs: options?.excludePathspecs,
|
|
291
|
+
});
|
|
292
|
+
if (options?.maxAgeMs !== undefined)
|
|
293
|
+
this.snapshotRetention.maxAgeMs = options.maxAgeMs;
|
|
294
|
+
if (options?.gc !== undefined)
|
|
295
|
+
this.snapshotRetention.gc = options.gc;
|
|
296
|
+
this.registerSnapshotGcTask();
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Register the snapshot-gc maintenance task (once). It scans live
|
|
300
|
+
* experiences for the snapshot refs still in use, then prunes each repo's
|
|
301
|
+
* anchored snapshots that are no longer referenced and past the grace
|
|
302
|
+
* period — bounding the unbounded ref growth from per-solve capture.
|
|
303
|
+
*/
|
|
304
|
+
registerSnapshotGcTask() {
|
|
305
|
+
if (this.snapshotGcRegistered)
|
|
306
|
+
return;
|
|
307
|
+
this.snapshotGcRegistered = true;
|
|
308
|
+
this.unifiedPipeline.registerMaintenanceTask({
|
|
309
|
+
name: 'snapshot-gc',
|
|
310
|
+
priority: 40,
|
|
311
|
+
execute: async () => {
|
|
312
|
+
const start = Date.now();
|
|
313
|
+
const store = this.snapshotStore;
|
|
314
|
+
if (!store?.prune) {
|
|
315
|
+
return {
|
|
316
|
+
taskName: 'snapshot-gc',
|
|
317
|
+
success: true,
|
|
318
|
+
durationMs: Date.now() - start,
|
|
319
|
+
details: { skipped: true, reason: 'no prunable snapshot store' },
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
// Refs still referenced by a live experience — never pruned.
|
|
323
|
+
const liveByRepo = new Map();
|
|
324
|
+
for (const exp of await this.memory.experiences.getAll()) {
|
|
325
|
+
const snap = readReplayDescriptor(exp)?.snapshot;
|
|
326
|
+
if (!snap?.ref || !snap.repo)
|
|
327
|
+
continue;
|
|
328
|
+
let set = liveByRepo.get(snap.repo);
|
|
329
|
+
if (!set) {
|
|
330
|
+
set = new Set();
|
|
331
|
+
liveByRepo.set(snap.repo, set);
|
|
332
|
+
}
|
|
333
|
+
set.add(snap.ref);
|
|
334
|
+
}
|
|
335
|
+
// Visit repos referenced by live experiences plus any the store
|
|
336
|
+
// captured into (covers repos whose experiences were all evicted).
|
|
337
|
+
const repos = new Set([...liveByRepo.keys(), ...(store.knownRepos?.() ?? [])]);
|
|
338
|
+
let refsPruned = 0;
|
|
339
|
+
for (const repo of repos) {
|
|
340
|
+
try {
|
|
341
|
+
refsPruned += await store.prune(repo, {
|
|
342
|
+
keepRefs: liveByRepo.get(repo) ?? new Set(),
|
|
343
|
+
minAgeMs: this.snapshotRetention.maxAgeMs,
|
|
344
|
+
gc: this.snapshotRetention.gc,
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
catch {
|
|
348
|
+
// one bad repo shouldn't kill the cycle
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
return {
|
|
352
|
+
taskName: 'snapshot-gc',
|
|
353
|
+
success: true,
|
|
354
|
+
durationMs: Date.now() - start,
|
|
355
|
+
details: { reposScanned: repos.size, refsPruned },
|
|
356
|
+
};
|
|
357
|
+
},
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Set (or replace) the ReplayJudge that gates playbook mutations/merges,
|
|
362
|
+
* without touching the LLM generator. Use to plug in a custom or live
|
|
363
|
+
* judge. Most callers want {@link enableLiveReplayGating} instead.
|
|
364
|
+
*/
|
|
365
|
+
setLearningJudge(judge) {
|
|
366
|
+
this.unifiedPipeline.setJudge(judge);
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Upgrade mutation/merge gating to a {@link LiveReplay} judge: candidates
|
|
370
|
+
* are scored by actually re-running their task through the AgentManager
|
|
371
|
+
* with the candidate playbook pinned in context, then verifying the
|
|
372
|
+
* outcome. Accurate but expensive — intended for high-stakes acceptance.
|
|
373
|
+
*
|
|
374
|
+
* Requires `setAgentManager(...)` to have been called (it needs real
|
|
375
|
+
* compute to run rollouts). Optionally caps rollouts per rolling window
|
|
376
|
+
* via {@link BudgetedReplayJudge}, routing overflow to `fallback` (or a
|
|
377
|
+
* neutral judge) so the maintenance loop never runs away on cost.
|
|
378
|
+
*
|
|
379
|
+
* Note: this supplies the *judge*. Reflective mutation also needs an LLM
|
|
380
|
+
* *generator* — pair with `setLearningProvider(...)` for the full
|
|
381
|
+
* high-stakes reflective path; merge proposing works with the judge alone.
|
|
382
|
+
*/
|
|
383
|
+
enableLiveReplayGating(options) {
|
|
384
|
+
if (!this.agentManager) {
|
|
385
|
+
throw new Error('enableLiveReplayGating() requires setAgentManager(...) first — live ' +
|
|
386
|
+
'replay re-runs tasks through the AgentManager.');
|
|
387
|
+
}
|
|
388
|
+
const agentType = options?.agentType ?? this.config.execution.defaultAgentType;
|
|
389
|
+
// Compose providers: the workspace-snapshot provider (Regime B) takes
|
|
390
|
+
// precedence over the descriptor/env-MCP provider (Phase 1) when both
|
|
391
|
+
// could apply. Falls back to the default provider alone when snapshots
|
|
392
|
+
// aren't enabled.
|
|
393
|
+
const provider = options?.environmentProvider ??
|
|
394
|
+
(this.snapshotStore
|
|
395
|
+
? new CompositeEnvironmentProvider([
|
|
396
|
+
new WorkspaceSnapshotProvider(this.snapshotStore, {
|
|
397
|
+
agentType,
|
|
398
|
+
verifyTimeoutMs: options?.timeoutMs,
|
|
399
|
+
}),
|
|
400
|
+
new DefaultEnvironmentProvider(this.replayVerifiers),
|
|
401
|
+
])
|
|
402
|
+
: new DefaultEnvironmentProvider(this.replayVerifiers));
|
|
403
|
+
const executor = new AgentReplayExecutor(this.agentManager, {
|
|
404
|
+
agentType,
|
|
405
|
+
verifier: options?.verifier,
|
|
406
|
+
timeoutMs: options?.timeoutMs,
|
|
407
|
+
environmentProvider: provider,
|
|
408
|
+
reconstructTask: options?.reconstructTask,
|
|
409
|
+
});
|
|
410
|
+
// The expensive, faithful path — optionally rate-limited.
|
|
411
|
+
let live = new LiveReplay(executor);
|
|
412
|
+
if (options?.maxRolloutsPerWindow !== undefined) {
|
|
413
|
+
live = new BudgetedReplayJudge(live, {
|
|
414
|
+
maxCalls: options.maxRolloutsPerWindow,
|
|
415
|
+
windowMs: options.windowMs,
|
|
416
|
+
fallback: options.fallback,
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
// Cheap path for experiences whose env can't be faithfully rebuilt.
|
|
420
|
+
const fallback = options?.fallback ??
|
|
421
|
+
(this.learningProvider
|
|
422
|
+
? new LLMJudgeReplay(this.learningProvider)
|
|
423
|
+
: new StubJudge(() => 0.5));
|
|
424
|
+
// Route each experience: faithfully-replayable → live, else → fallback.
|
|
425
|
+
const judge = new ConditionalReplayJudge((_pb, exp) => provider.isReplayable(exp), live, fallback);
|
|
426
|
+
this.unifiedPipeline.setJudge(judge);
|
|
201
427
|
}
|
|
202
428
|
/**
|
|
203
429
|
* Set up the AgentManager with backends for real action execution
|
|
@@ -208,6 +434,10 @@ export class Atlas {
|
|
|
208
434
|
this.agentManager = createAgentManager(this.memory, {
|
|
209
435
|
delegate: options?.delegate,
|
|
210
436
|
});
|
|
437
|
+
// PR-D2: wire helpfulness-weighted injection re-rank from features config.
|
|
438
|
+
this.agentManager.setCurationEnabled(this.config.features.curation);
|
|
439
|
+
// Exp 4: wire section-level playbook incorporation from memory config.
|
|
440
|
+
this.agentManager.setIncorporation(this.config.memory?.playbookRetrieval?.incorporation ?? 'full');
|
|
211
441
|
// Register all backends
|
|
212
442
|
for (const backend of backends) {
|
|
213
443
|
this.agentManager.registerBackend(backend);
|
|
@@ -220,22 +450,55 @@ export class Atlas {
|
|
|
220
450
|
this.taskRunner = createAgenticTaskRunner(this.workspaceManager, this.agentManager, this.memory, this.unifiedPipeline, this.config.agenticTasks);
|
|
221
451
|
// Connect task runner to unified pipeline for workspace-based analysis
|
|
222
452
|
this.unifiedPipeline.setTaskRunner(this.taskRunner);
|
|
223
|
-
// Connect task runner to team learning pipeline
|
|
224
|
-
if (this.teamLearning) {
|
|
225
|
-
this.teamLearning.setTaskRunner(this.taskRunner);
|
|
226
|
-
}
|
|
227
453
|
// Create refinement loop with config
|
|
228
454
|
this.refinementLoop = createRefinementLoop(this.agentManager, this.memory, {
|
|
229
455
|
maxIterations: this.config.refinement.maxIterations,
|
|
230
456
|
minAcceptableScore: this.config.refinement.acceptableScore,
|
|
231
457
|
evaluatorConfig: {
|
|
232
458
|
evaluatorAgentType: this.config.refinement.evaluatorAgentType,
|
|
459
|
+
// When false, the evaluator scores heuristically instead of spawning
|
|
460
|
+
// a live evaluation agent — the registered OutcomeVerifier still
|
|
461
|
+
// drives the refine/accept decision. (Decoupled from eligibility
|
|
462
|
+
// below, so refinement can fire with heuristic evaluation.)
|
|
463
|
+
useAgentEvaluation: this.config.refinement.useAgentEvaluation,
|
|
233
464
|
},
|
|
234
465
|
triggerOnStrategies: this.config.refinement.triggerOnStrategies,
|
|
235
466
|
confidenceThreshold: this.config.refinement.confidenceThreshold,
|
|
236
467
|
});
|
|
237
|
-
// Connect task runner to refinement loop for workspace-based evaluation and
|
|
238
|
-
|
|
468
|
+
// Connect task runner to refinement loop for workspace-based evaluation and
|
|
469
|
+
// analysis — ONLY when agentic evaluation is enabled. When disabled (e.g. an
|
|
470
|
+
// eval harness driving refinement via an OutcomeVerifier), withholding the
|
|
471
|
+
// task runner makes BOTH the evaluator (evaluate()) and the refinement-plan
|
|
472
|
+
// analysis (getRefinementPlan) fall back to heuristic, so no internal
|
|
473
|
+
// template spawn hangs waiting for a done() it never calls. The task agent
|
|
474
|
+
// itself still runs via agentManager.spawn.
|
|
475
|
+
if (this.config.refinement.useAgentEvaluation) {
|
|
476
|
+
this.refinementLoop.setTaskRunner(this.taskRunner);
|
|
477
|
+
}
|
|
478
|
+
if (this.externalAcquisition) {
|
|
479
|
+
this.refinementLoop.setExternalAcquisition(this.externalAcquisition);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Configure a separate AgentManager for offline analysis tasks such as
|
|
484
|
+
* playbook extraction. This keeps benchmark delegates on the solve path from
|
|
485
|
+
* accidentally handling workspace-abstraction prompts.
|
|
486
|
+
*/
|
|
487
|
+
setAnalysisAgentManager(backends) {
|
|
488
|
+
this.analysisAgentManager = createAgentManager(this.memory);
|
|
489
|
+
this.analysisAgentManager.setCurationEnabled(this.config.features.curation);
|
|
490
|
+
for (const backend of backends) {
|
|
491
|
+
this.analysisAgentManager.registerBackend(backend);
|
|
492
|
+
}
|
|
493
|
+
this.analysisWorkspaceManager = new WorkspaceManager({
|
|
494
|
+
baseDir: this.config.agenticTasks.workspaceBaseDir,
|
|
495
|
+
prefix: 'atlas-analysis-workspaces',
|
|
496
|
+
});
|
|
497
|
+
const analysisRunner = createAgenticTaskRunner(this.analysisWorkspaceManager, this.analysisAgentManager, this.memory, this.unifiedPipeline, this.config.agenticTasks);
|
|
498
|
+
this.unifiedPipeline.setTaskRunner(analysisRunner);
|
|
499
|
+
}
|
|
500
|
+
setLearningDiagnosticsCollector(collector) {
|
|
501
|
+
this.unifiedPipeline.setDiagnosticsCollector(collector);
|
|
239
502
|
}
|
|
240
503
|
/**
|
|
241
504
|
* Get the AgentManager for direct access
|
|
@@ -259,12 +522,51 @@ export class Atlas {
|
|
|
259
522
|
getDelegate() {
|
|
260
523
|
return this.agentManager?.getDelegate();
|
|
261
524
|
}
|
|
525
|
+
/**
|
|
526
|
+
* Disable workspace-based agentic analysis on the per-solve hot path
|
|
527
|
+
* (playbook usage inference + meta-reflection), forcing their heuristic
|
|
528
|
+
* fallbacks. Without this, each `solve()` spawns extra workspace analysis
|
|
529
|
+
* agents — which, behind a real agent delegate, means several nested agent
|
|
530
|
+
* calls per task. Eval harnesses call this so each solve is a single agent
|
|
531
|
+
* call. Learning fidelity is preserved: experience storage and immediate
|
|
532
|
+
* learning are unaffected; only the heavyweight agentic post-analysis is
|
|
533
|
+
* downgraded to its heuristic path.
|
|
534
|
+
*/
|
|
535
|
+
disableAgenticAnalysis() {
|
|
536
|
+
this.disableAgenticHotPathAnalysis();
|
|
537
|
+
// Also clear the pipeline's task runner so batch/dream analysis + playbook
|
|
538
|
+
// extraction use the heuristic path (no workspace-agent spawns). Without
|
|
539
|
+
// this, a dream that runs extraction (e.g. an eval that lowers
|
|
540
|
+
// minTrajectories) would still spawn agents despite "agentic analysis"
|
|
541
|
+
// being disabled.
|
|
542
|
+
this.unifiedPipeline.setTaskRunner(null);
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Disable only solve-time workspace analysis (usage inference +
|
|
546
|
+
* meta-reflection). Batch/dream extraction can still use a separately
|
|
547
|
+
* configured analysis runner.
|
|
548
|
+
*/
|
|
549
|
+
disableAgenticHotPathAnalysis() {
|
|
550
|
+
this.taskRunner = null;
|
|
551
|
+
}
|
|
262
552
|
/**
|
|
263
553
|
* Get the RefinementLoop for registering domain verifiers
|
|
264
554
|
*/
|
|
265
555
|
getRefinementLoop() {
|
|
266
556
|
return this.refinementLoop;
|
|
267
557
|
}
|
|
558
|
+
/**
|
|
559
|
+
* Register a pluggable outcome verifier so a domain (e.g. a benchmark
|
|
560
|
+
* harness) can mark self-reported successes as mis-executed and route them
|
|
561
|
+
* into refinement. Requires the AgentManager to be initialized first
|
|
562
|
+
* (via setAgentManager).
|
|
563
|
+
*/
|
|
564
|
+
setOutcomeVerifier(verifier) {
|
|
565
|
+
if (!this.refinementLoop) {
|
|
566
|
+
throw new Error('RefinementLoop not initialized. Call setAgentManager() first.');
|
|
567
|
+
}
|
|
568
|
+
this.refinementLoop.setOutcomeVerifier(verifier);
|
|
569
|
+
}
|
|
268
570
|
/**
|
|
269
571
|
* Get the AgenticTaskRunner for running analysis tasks
|
|
270
572
|
*/
|
|
@@ -281,21 +583,47 @@ export class Atlas {
|
|
|
281
583
|
* Solve a task using the best available method
|
|
282
584
|
* Prefers AgentManager with refinement when available
|
|
283
585
|
*/
|
|
284
|
-
async solve(task) {
|
|
586
|
+
async solve(task, options) {
|
|
285
587
|
// Route the task first
|
|
286
|
-
|
|
588
|
+
let routing = await this.router.route(task, options);
|
|
589
|
+
// Cold-start bootstrap: when router returns fallback and domain has
|
|
590
|
+
// sparse knowledge, analyze the workspace and synthesize notes so the
|
|
591
|
+
// agent has context on its first encounter with a new domain.
|
|
592
|
+
if (this.externalAcquisition &&
|
|
593
|
+
this.memory.knowledgeBank &&
|
|
594
|
+
routing.strategy === 'fallback' &&
|
|
595
|
+
this.validationCanWrite('knowledgeNote')) {
|
|
596
|
+
const domainNotes = await this.memory.knowledgeBank.search(task.domain ?? task.description.slice(0, 80), { maxResults: 5 });
|
|
597
|
+
if (this.externalAcquisition.shouldBootstrap(routing.strategy, domainNotes.length)) {
|
|
598
|
+
const workspacePath = this.workspaceManager ? this.config.storage.baseDir : undefined;
|
|
599
|
+
const { notes } = await this.externalAcquisition.bootstrap(task, workspacePath);
|
|
600
|
+
if (notes.length > 0) {
|
|
601
|
+
await this.memory.knowledgeBank.applyExtraction({
|
|
602
|
+
observations: notes,
|
|
603
|
+
entityUpdates: [],
|
|
604
|
+
contradictions: [],
|
|
605
|
+
links: [],
|
|
606
|
+
playbookLinks: [],
|
|
607
|
+
});
|
|
608
|
+
routing = await this.router.route(task, options);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
const servedMemoryContext = this.filterMemoryForServing(routing.memoryContext);
|
|
287
613
|
// Get skills for the agent if skill library is available
|
|
288
614
|
let injectedPlaybooks = [];
|
|
289
615
|
let skillContext = '';
|
|
290
|
-
if (this.skillLibrary
|
|
616
|
+
if (this.skillLibrary &&
|
|
617
|
+
this.validationCanRetrieve('playbooks') &&
|
|
618
|
+
this.validationCanServe('playbooks')) {
|
|
291
619
|
const skills = await this.skillLibrary.getSkillsForAgent(task);
|
|
292
620
|
injectedPlaybooks = [...skills.core, ...skills.domain, ...skills.contextual];
|
|
293
621
|
skillContext = this.skillLibrary.formatForSystemPrompt(skills);
|
|
294
622
|
}
|
|
295
623
|
// Merge playbooks from router's memory context (deduplicating by ID)
|
|
296
624
|
// This ensures we track ALL playbooks that will be injected into the agent
|
|
297
|
-
const injectedIds = new Set(injectedPlaybooks.map(p => p.id));
|
|
298
|
-
for (const { playbook } of
|
|
625
|
+
const injectedIds = new Set(injectedPlaybooks.map((p) => p.id));
|
|
626
|
+
for (const { playbook } of servedMemoryContext.playbooks) {
|
|
299
627
|
if (!injectedIds.has(playbook.id)) {
|
|
300
628
|
injectedPlaybooks.push(playbook);
|
|
301
629
|
injectedIds.add(playbook.id);
|
|
@@ -304,33 +632,29 @@ export class Atlas {
|
|
|
304
632
|
// Surface knowledge from knowledge bank (independent from skill surfacing)
|
|
305
633
|
let knowledgeContext = '';
|
|
306
634
|
let surfacedKnowledge;
|
|
307
|
-
if (this.memory.knowledgeBank
|
|
308
|
-
|
|
635
|
+
if (this.memory.knowledgeBank &&
|
|
636
|
+
this.validationCanRetrieve('knowledge') &&
|
|
637
|
+
this.validationCanServe('knowledge')) {
|
|
638
|
+
surfacedKnowledge = await this.memory.knowledgeBank.getRelevantKnowledge({
|
|
639
|
+
description: task.description,
|
|
640
|
+
domain: task.domain,
|
|
641
|
+
});
|
|
309
642
|
if (surfacedKnowledge.length > 0) {
|
|
310
643
|
knowledgeContext = this.memory.knowledgeBank.formatKnowledgeForPrompt(surfacedKnowledge);
|
|
311
644
|
}
|
|
312
645
|
}
|
|
646
|
+
else if (this.memory.knowledgeBank) {
|
|
647
|
+
surfacedKnowledge = [];
|
|
648
|
+
}
|
|
313
649
|
// Combine skill context + knowledge context
|
|
314
|
-
const combinedContext = [skillContext, knowledgeContext]
|
|
315
|
-
.filter(Boolean)
|
|
316
|
-
.join('\n\n');
|
|
650
|
+
const combinedContext = [skillContext, knowledgeContext].filter(Boolean).join('\n\n');
|
|
317
651
|
let result;
|
|
318
|
-
//
|
|
652
|
+
// AgentManager is the only execution path.
|
|
319
653
|
if (this.agentManager) {
|
|
320
|
-
result = await this.solveWithAgent(task, routing, combinedContext || undefined);
|
|
321
|
-
}
|
|
322
|
-
else if (this.solver && this.provider) {
|
|
323
|
-
// Fall back to DirectSolver (deprecated)
|
|
324
|
-
const solverResult = await this.solver.solve(task, routing);
|
|
325
|
-
result = {
|
|
326
|
-
trajectory: solverResult.trajectory,
|
|
327
|
-
usedMemory: solverResult.usedMemory,
|
|
328
|
-
strategy: solverResult.strategy,
|
|
329
|
-
usedAgentManager: false,
|
|
330
|
-
};
|
|
654
|
+
result = await this.solveWithAgent(task, routing, servedMemoryContext, combinedContext || undefined, options?.spawnConfig, options?.replay, options?.costBudgetUsd);
|
|
331
655
|
}
|
|
332
656
|
else {
|
|
333
|
-
throw new Error('No execution method available. Call setAgentManager()
|
|
657
|
+
throw new Error('No execution method available. Call setAgentManager().');
|
|
334
658
|
}
|
|
335
659
|
// Add injected playbooks to result
|
|
336
660
|
result.injectedPlaybooks = injectedPlaybooks;
|
|
@@ -340,6 +664,7 @@ export class Atlas {
|
|
|
340
664
|
const usageResults = await this.inferPlaybookUsage(result.trajectory, injectedPlaybooks);
|
|
341
665
|
// Convert to PlaybookUsage format and record outcomes
|
|
342
666
|
result.playbookUsage = [];
|
|
667
|
+
const canWritePlaybookOutcomes = this.validationCanWrite('playbook');
|
|
343
668
|
for (const usage of usageResults) {
|
|
344
669
|
result.playbookUsage.push({
|
|
345
670
|
playbookId: usage.playbookId,
|
|
@@ -348,65 +673,224 @@ export class Atlas {
|
|
|
348
673
|
usageConfidence: usage.usageConfidence,
|
|
349
674
|
wasSuccessful: usage.wasSuccessful,
|
|
350
675
|
});
|
|
351
|
-
// Record outcome for tier management
|
|
352
|
-
if (usage.wasUsed) {
|
|
676
|
+
// Record outcome for tier management (skill-library tier; always on wasUsed).
|
|
677
|
+
if (usage.wasUsed && canWritePlaybookOutcomes) {
|
|
353
678
|
await this.skillLibrary.recordOutcome(usage.playbookId, result.trajectory.id, usage.wasSuccessful, usage.context);
|
|
679
|
+
// PR-D2 (legacy path): wasUsed-gated counter update.
|
|
680
|
+
// Only active when injectionPresenceCredit is OFF (ablation arm).
|
|
681
|
+
// When injectionPresenceCredit is ON the counters are updated below
|
|
682
|
+
// via attribution across ALL injected playbooks, not just wasUsed ones
|
|
683
|
+
// — so we must not also call recordSuccess/recordFailure here or we
|
|
684
|
+
// double-count the wasUsed subset.
|
|
685
|
+
if (this.config.features.curation && !this.config.features.injectionPresenceCredit) {
|
|
686
|
+
if (usage.wasSuccessful) {
|
|
687
|
+
await this.memory.playbooks.recordSuccess(usage.playbookId, result.trajectory.id);
|
|
688
|
+
}
|
|
689
|
+
else {
|
|
690
|
+
await this.memory.playbooks.recordFailure(usage.playbookId, result.trajectory.id, usage.context ?? '', 'playbook-application-failure');
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
// F6: Injection-presence credit — attribute task outcome fractionally across
|
|
696
|
+
// ALL injected playbooks weighted by retrieval score. This replaces the
|
|
697
|
+
// wasUsed-gated counter path for the normal (injectionPresenceCredit=true) arm.
|
|
698
|
+
// The skillLibrary.recordOutcome() tier-management call above is KEPT — it is
|
|
699
|
+
// gated on wasUsed and manages skill-tier promotion/demotion, not counters.
|
|
700
|
+
if (this.config.features.curation &&
|
|
701
|
+
this.config.features.injectionPresenceCredit &&
|
|
702
|
+
canWritePlaybookOutcomes) {
|
|
703
|
+
const taskSucceeded = result.trajectory.outcome.success;
|
|
704
|
+
const credits = attributeCredit(servedMemoryContext.playbooks);
|
|
705
|
+
for (const { id, weight } of credits) {
|
|
706
|
+
await this.memory.playbooks.recordApplicationOutcome(id, taskSucceeded, weight);
|
|
354
707
|
}
|
|
355
708
|
}
|
|
356
709
|
}
|
|
357
|
-
//
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
710
|
+
// Phase 2 — meta-reflection + effectiveness annotation. These are deferred
|
|
711
|
+
// to the dream via a routing snapshot persisted on the queue row.
|
|
712
|
+
// (Usage inference above stays inline — it is SkillLibrary-coupled and
|
|
713
|
+
// produces the synchronous solve result.)
|
|
714
|
+
const appliedPlaybookIds = (result.playbookUsage ?? [])
|
|
715
|
+
.filter((u) => u.wasUsed)
|
|
716
|
+
.map((u) => u.playbookId);
|
|
717
|
+
const surfacedExperienceIds = servedMemoryContext.experiences.map((e) => e.experience.id);
|
|
718
|
+
const surfacedKnowledgeNoteIds = [
|
|
719
|
+
...(servedMemoryContext.knowledge ?? []).map((m) => m.note.frontmatter.id),
|
|
720
|
+
...(surfacedKnowledge ?? []).map((m) => m.note.frontmatter.id),
|
|
721
|
+
];
|
|
722
|
+
const snapshot = {
|
|
723
|
+
routingInfo: {
|
|
724
|
+
strategy: routing.strategy,
|
|
725
|
+
confidence: routing.confidence,
|
|
726
|
+
estimatedBudget: routing.estimatedBudget,
|
|
727
|
+
reasoning: routing.reasoning,
|
|
728
|
+
appliedStrategyIds: routing.appliedStrategyIds,
|
|
729
|
+
},
|
|
730
|
+
playbookMatchRefs: servedMemoryContext.playbooks.map((p) => ({
|
|
731
|
+
id: p.playbook.id,
|
|
732
|
+
score: p.score,
|
|
733
|
+
matchType: p.matchType,
|
|
734
|
+
})),
|
|
735
|
+
surfacedExperienceIds,
|
|
736
|
+
appliedPlaybookIds,
|
|
737
|
+
surfacedKnowledgeNoteIds,
|
|
738
|
+
};
|
|
739
|
+
const immediateResult = await this.unifiedPipeline.processTrajectory(result.trajectory, JSON.stringify(snapshot));
|
|
373
740
|
this.trajectoriesProcessed++;
|
|
741
|
+
// FIX 2 (ADDITIVE LEARNING, default OFF): unify frontier accounting with
|
|
742
|
+
// INJECTION. The instant loop only writes frontier rows for playbooks
|
|
743
|
+
// caught by the legacy 0.3 lexical findMatching, and injection-presence
|
|
744
|
+
// credit updates counters (recordApplicationOutcome) without touching the
|
|
745
|
+
// frontier — so an injected+reused playbook accrues no frontier row and
|
|
746
|
+
// stays invisible to the mutation-gate minibatch sampler. Here we record a
|
|
747
|
+
// frontier/live outcome for the playbooks that were actually SERVED (hybrid
|
|
748
|
+
// retrieval @ minScore), so reused playbooks accumulate frontier rows
|
|
749
|
+
// aligned with what was injected. Dedup: upsertFrontierRow is keyed by
|
|
750
|
+
// (task_signature, experience_id, playbook_id) with MAX(score), so
|
|
751
|
+
// re-writing a row the instant loop already wrote for THIS solve is
|
|
752
|
+
// idempotent — no double count. Distinct solves have distinct experience
|
|
753
|
+
// ids, which is exactly how a reused playbook reaches ≥2 minibatch rows.
|
|
754
|
+
if (this.config.features.additiveConsolidation && this.validationCanWrite('frontier')) {
|
|
755
|
+
const experienceId = immediateResult.instantLoop.experienceId;
|
|
756
|
+
if (experienceId) {
|
|
757
|
+
const sig = taskSignature(result.trajectory.task);
|
|
758
|
+
const score = result.trajectory.outcome.success
|
|
759
|
+
? Math.max(result.trajectory.outcome.partialScore, 1.0)
|
|
760
|
+
: result.trajectory.outcome.partialScore;
|
|
761
|
+
const objectives = deriveObjectives(result.trajectory);
|
|
762
|
+
for (const { playbook } of servedMemoryContext.playbooks) {
|
|
763
|
+
try {
|
|
764
|
+
await this.memory.playbooks.recordLiveOutcome(playbook.id, sig, experienceId, score, objectives);
|
|
765
|
+
}
|
|
766
|
+
catch {
|
|
767
|
+
// Non-fatal — frontier bookkeeping must never fail the solve.
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
// Populate extraction yield from the instant-loop result.
|
|
773
|
+
const il = immediateResult.instantLoop;
|
|
774
|
+
const byType = {};
|
|
775
|
+
if (il.experienceId)
|
|
776
|
+
byType['experience'] = 1;
|
|
777
|
+
if (il.knowledgeNotesExtracted > 0)
|
|
778
|
+
byType['knowledge'] = il.knowledgeNotesExtracted;
|
|
779
|
+
const itemsStored = Object.values(byType).reduce((a, b) => a + b, 0);
|
|
780
|
+
result.extractionYield = { itemsStored, byType };
|
|
781
|
+
// Dreaming hooks: optionally consolidate synchronously (eval determinism),
|
|
782
|
+
// then (re)arm the idle scheduler if enabled.
|
|
783
|
+
await this.maybeConsolidateInline();
|
|
784
|
+
this.scheduleDreamCheck();
|
|
374
785
|
return result;
|
|
375
786
|
}
|
|
376
787
|
/**
|
|
377
788
|
* Solve using AgentManager with optional refinement
|
|
378
789
|
*/
|
|
379
|
-
|
|
790
|
+
/**
|
|
791
|
+
* Stamp a replay descriptor onto a trajectory's metadata from the spawn
|
|
792
|
+
* config it ran under. Auto-captures the env (env-MCP / cwd / agentType);
|
|
793
|
+
* the optional hint adds verifierId / envHandle / reconstructable overrides.
|
|
794
|
+
*/
|
|
795
|
+
/**
|
|
796
|
+
* If workspace snapshotting is enabled, capture the spawn cwd's initial
|
|
797
|
+
* state and fold the snapshot handle into the replay hint (preserving any
|
|
798
|
+
* caller-supplied verifyCommand/successPattern). No-op / unchanged hint
|
|
799
|
+
* when snapshotting is off or capture isn't possible.
|
|
800
|
+
*/
|
|
801
|
+
async captureSnapshotHint(spawnConfig, hint) {
|
|
802
|
+
if (!this.snapshotStore)
|
|
803
|
+
return hint;
|
|
804
|
+
const dir = spawnConfig.cwd ?? process.cwd();
|
|
805
|
+
let snapshot = null;
|
|
806
|
+
try {
|
|
807
|
+
snapshot = await this.snapshotStore.capture(dir);
|
|
808
|
+
}
|
|
809
|
+
catch {
|
|
810
|
+
snapshot = null; // capture is best-effort
|
|
811
|
+
}
|
|
812
|
+
if (!snapshot)
|
|
813
|
+
return hint;
|
|
814
|
+
return {
|
|
815
|
+
...hint,
|
|
816
|
+
snapshot: {
|
|
817
|
+
...(hint?.snapshot ?? {}),
|
|
818
|
+
ref: snapshot.ref,
|
|
819
|
+
repo: snapshot.repo,
|
|
820
|
+
},
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
stampReplayDescriptor(trajectory, spawnConfig, hint) {
|
|
824
|
+
const descriptor = buildReplayDescriptor({
|
|
825
|
+
mcpServers: spawnConfig.mcpServers,
|
|
826
|
+
cwd: spawnConfig.cwd,
|
|
827
|
+
agentType: spawnConfig.agentType,
|
|
828
|
+
}, hint);
|
|
829
|
+
trajectory.metadata = { ...(trajectory.metadata ?? {}), [REPLAY_METADATA_KEY]: descriptor };
|
|
830
|
+
}
|
|
831
|
+
async solveWithAgent(task, routing, servedMemoryContext, skillContext, spawnConfigOverride, replayHint, costBudgetUsd) {
|
|
380
832
|
if (!this.agentManager) {
|
|
381
833
|
throw new Error('AgentManager not available');
|
|
382
834
|
}
|
|
383
835
|
// Build spawn configuration
|
|
384
836
|
const spawnConfig = {
|
|
385
837
|
agentType: this.config.execution.defaultAgentType,
|
|
386
|
-
task,
|
|
387
838
|
timeout: this.config.execution.maxExecutionTime * 1000,
|
|
388
839
|
captureToolCalls: this.config.execution.captureToolCalls,
|
|
389
840
|
// Inject skill context if available
|
|
390
841
|
systemPromptAdditions: skillContext || undefined,
|
|
391
|
-
// Pass router
|
|
392
|
-
injectedKnowledge:
|
|
842
|
+
// Pass the already serving-filtered router memory context to avoid duplicate queries.
|
|
843
|
+
injectedKnowledge: servedMemoryContext,
|
|
844
|
+
// Preserve the raw retrieval result for eval diagnostics so traces can
|
|
845
|
+
// distinguish retrieved-but-masked candidates from genuinely empty retrieval.
|
|
846
|
+
diagnosticKnowledge: routing.memoryContext,
|
|
847
|
+
// Per-call overrides (e.g. mcpServers, a caller-owned customer prompt).
|
|
848
|
+
// Shallow-merged before `task` is pinned so a caller can supply
|
|
849
|
+
// task-scoped execution context without disturbing the default build.
|
|
850
|
+
...(spawnConfigOverride ?? {}),
|
|
851
|
+
// `task` is always the routed task; an override cannot redirect it.
|
|
852
|
+
task,
|
|
393
853
|
};
|
|
854
|
+
// Regime B: snapshot the working tree's INITIAL state BEFORE the agent
|
|
855
|
+
// mutates it, so a replay rematerializes the same starting world. The
|
|
856
|
+
// captured ref is merged into the descriptor hint. Best-effort & safe:
|
|
857
|
+
// non-git dirs / failures just leave the experience non-snapshot-replayable.
|
|
858
|
+
const effectiveHint = await this.captureSnapshotHint(spawnConfig, replayHint);
|
|
394
859
|
// Run initial execution
|
|
395
860
|
const agentResult = await this.agentManager.spawn(spawnConfig);
|
|
396
|
-
//
|
|
397
|
-
|
|
398
|
-
|
|
861
|
+
// Capture a replay descriptor of the environment this ran under, so the
|
|
862
|
+
// experience derived from this trajectory can later be re-run faithfully
|
|
863
|
+
// by live-replay gating. Rides the trajectory.metadata channel that
|
|
864
|
+
// storeTrajectory() already spreads into experience.metadata.
|
|
865
|
+
this.stampReplayDescriptor(agentResult.trajectory, spawnConfig, effectiveHint);
|
|
866
|
+
// Check if refinement is eligible for this route (strategy + confidence).
|
|
867
|
+
// Eligibility is decoupled from useAgentEvaluation: that flag controls only
|
|
868
|
+
// HOW the evaluator scores (agentic vs heuristic), not WHETHER we refine —
|
|
869
|
+
// an external OutcomeVerifier can drive refinement with heuristic scoring.
|
|
870
|
+
const eligibleForRefinement = this.refinementLoop &&
|
|
399
871
|
this.refinementLoop.shouldTriggerRefinement(routing.strategy, routing.confidence);
|
|
400
872
|
let refinementResult;
|
|
401
|
-
if (
|
|
402
|
-
//
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
873
|
+
if (eligibleForRefinement) {
|
|
874
|
+
// Decouple from the success-only gate: refinement triggers on
|
|
875
|
+
// (verifier says retry) OR (hard failure). The default pass-through
|
|
876
|
+
// verifier preserves the previous success-only behavior.
|
|
877
|
+
const { refine, verdict } = await this.refinementLoop.shouldRefineOutcome({ success: agentResult.success, trajectory: agentResult.trajectory }, task);
|
|
878
|
+
if (refine) {
|
|
879
|
+
// Thread the verdict through so refine() skips its cheap early-return
|
|
880
|
+
// for a misexecuted-but-success trajectory and surfaces verdict.reason
|
|
881
|
+
// into the retry prompt.
|
|
882
|
+
const tracker = costBudgetUsd != null ? new CostTracker(costBudgetUsd) : undefined;
|
|
883
|
+
refinementResult = await this.refinementLoop.refine(agentResult.trajectory, spawnConfig, verdict, tracker);
|
|
884
|
+
// Refinement re-spawns with the same spawnConfig (env unchanged), so
|
|
885
|
+
// the same descriptor applies to the refined trajectory.
|
|
886
|
+
this.stampReplayDescriptor(refinementResult.trajectory, spawnConfig, effectiveHint);
|
|
887
|
+
return {
|
|
888
|
+
trajectory: refinementResult.trajectory,
|
|
889
|
+
routing,
|
|
890
|
+
usedAgentManager: true,
|
|
891
|
+
refinement: refinementResult,
|
|
892
|
+
};
|
|
893
|
+
}
|
|
410
894
|
}
|
|
411
895
|
return {
|
|
412
896
|
trajectory: agentResult.trajectory,
|
|
@@ -433,129 +917,112 @@ export class Atlas {
|
|
|
433
917
|
// Unified pipeline handles immediate + batch (if energy triggers)
|
|
434
918
|
const result = await this.unifiedPipeline.processTrajectory(trajectory);
|
|
435
919
|
this.trajectoriesProcessed++;
|
|
920
|
+
// Dreaming hooks (see solve()).
|
|
921
|
+
await this.maybeConsolidateInline();
|
|
922
|
+
this.scheduleDreamCheck();
|
|
436
923
|
return result;
|
|
437
924
|
}
|
|
438
925
|
/**
|
|
439
|
-
*
|
|
440
|
-
*
|
|
441
|
-
*
|
|
926
|
+
* Run a consolidation pass ("dream"): drain the durable dream_queue and run
|
|
927
|
+
* batch + maintenance over it. This is the decoupled replacement for inline
|
|
928
|
+
* batch learning — call it explicitly, on a schedule, or at close. A no-op
|
|
929
|
+
* (empty result) when there is nothing to drain or a dream is already running.
|
|
442
930
|
*/
|
|
443
|
-
async
|
|
444
|
-
|
|
445
|
-
return { teamTrajectoryId: trajectory.id, stored: false, analyzed: false };
|
|
446
|
-
}
|
|
447
|
-
const result = await this.teamLearning.processTeamTrajectory(trajectory);
|
|
448
|
-
this.teamTrajectoriesProcessed++;
|
|
449
|
-
// Generate team meta-reflection for the meta-learner
|
|
450
|
-
if (this.teamMetaLearner) {
|
|
451
|
-
try {
|
|
452
|
-
await this.teamMetaLearner.generateReflection(trajectory);
|
|
453
|
-
}
|
|
454
|
-
catch (error) {
|
|
455
|
-
console.error('[Atlas] Team meta-reflection failed:', error instanceof Error ? error.message : String(error));
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
// Run batch team learning if ready
|
|
459
|
-
if (this.teamLearning.shouldRunBatch()) {
|
|
460
|
-
await this.runTeamBatchLearning();
|
|
461
|
-
}
|
|
462
|
-
return result;
|
|
463
|
-
}
|
|
464
|
-
/**
|
|
465
|
-
* Run batch team playbook extraction explicitly.
|
|
466
|
-
*/
|
|
467
|
-
async runTeamBatchLearning() {
|
|
468
|
-
if (!this.teamLearning)
|
|
469
|
-
return null;
|
|
470
|
-
return this.teamLearning.runBatchLearning();
|
|
931
|
+
async dream(opts) {
|
|
932
|
+
return this.unifiedPipeline.dream(opts);
|
|
471
933
|
}
|
|
472
934
|
/**
|
|
473
|
-
* Get the
|
|
935
|
+
* Get the consolidation coordinator (cadence + single-flight) for direct
|
|
936
|
+
* access — e.g. to drive `maybeDream()` from an external scheduler.
|
|
474
937
|
*/
|
|
475
|
-
|
|
476
|
-
return this.
|
|
938
|
+
getConsolidationCoordinator() {
|
|
939
|
+
return this.consolidationCoordinator;
|
|
477
940
|
}
|
|
478
941
|
/**
|
|
479
|
-
*
|
|
480
|
-
*
|
|
481
|
-
*
|
|
942
|
+
* Synchronously consolidate after a solve/process call when configured —
|
|
943
|
+
* gives eval harnesses "free consolidation" determinism. No-op unless
|
|
944
|
+
* `dream.consolidateInline` is set.
|
|
482
945
|
*/
|
|
483
|
-
async
|
|
484
|
-
if (!this.
|
|
485
|
-
|
|
946
|
+
async maybeConsolidateInline() {
|
|
947
|
+
if (!this.validationAllowsStableMutation())
|
|
948
|
+
return;
|
|
949
|
+
if (this.config.dream.consolidateInline) {
|
|
950
|
+
await this.dream({ drainAll: true });
|
|
486
951
|
}
|
|
487
|
-
return this.teamRouter.recommend(input);
|
|
488
952
|
}
|
|
489
953
|
/**
|
|
490
|
-
*
|
|
954
|
+
* (Re)arm the in-process idle timer. Each solve/process resets it; on fire it
|
|
955
|
+
* asks the coordinator to dream if the cadence policy says it's due. Opt-in
|
|
956
|
+
* via `dream.scheduler.enabled`. The timer is unref'd so it never keeps the
|
|
957
|
+
* process alive on its own.
|
|
491
958
|
*/
|
|
492
|
-
|
|
493
|
-
|
|
959
|
+
scheduleDreamCheck() {
|
|
960
|
+
if (!this.validationAllowsStableMutation())
|
|
961
|
+
return;
|
|
962
|
+
if (!this.config.dream.scheduler.enabled || !this.consolidationCoordinator)
|
|
963
|
+
return;
|
|
964
|
+
if (this.dreamTimer)
|
|
965
|
+
clearTimeout(this.dreamTimer);
|
|
966
|
+
this.dreamTimer = setTimeout(() => {
|
|
967
|
+
this.dreamTimer = null;
|
|
968
|
+
void this.consolidationCoordinator.maybeDream().catch((error) => {
|
|
969
|
+
logger.error('[Atlas] Scheduled dream failed:', error instanceof Error ? error.message : String(error));
|
|
970
|
+
});
|
|
971
|
+
}, this.config.dream.scheduler.idleMs);
|
|
972
|
+
this.dreamTimer.unref?.();
|
|
494
973
|
}
|
|
495
974
|
/**
|
|
496
|
-
*
|
|
975
|
+
* Flip the validation mutation policy at runtime. Used by the live eval
|
|
976
|
+
* harness to FREEZE the learner during the held-out eval phase of a
|
|
977
|
+
* train/eval split: with `frozen`, `processTrajectory` becomes a no-op (no
|
|
978
|
+
* experience store, no dream-queue enqueue) and all write channels are
|
|
979
|
+
* gated off, so eval trajectories never train the learner — while retrieval
|
|
980
|
+
* and serving stay live so the trained memory is still injected. This
|
|
981
|
+
* enforces the train/eval isolation described in
|
|
982
|
+
* docs/DESIGN-meta-learning-validation.md § "Train-time oracle signal vs
|
|
983
|
+
* solve-time firewall". The pipeline shares this validation object by
|
|
984
|
+
* reference, so the flip applies to both Atlas and the pipeline gates.
|
|
497
985
|
*/
|
|
498
|
-
|
|
499
|
-
|
|
986
|
+
setValidationMutationMode(mode) {
|
|
987
|
+
this.config.validation.mutationMode = mode;
|
|
988
|
+
this.memory.setValidationControls(this.config.validation);
|
|
500
989
|
}
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
*/
|
|
504
|
-
getTeamSkillLibrary() {
|
|
505
|
-
return this.teamSkillLibrary;
|
|
990
|
+
validationAllowsStableMutation() {
|
|
991
|
+
return !this.config.validation.enabled || this.config.validation.mutationMode === 'active';
|
|
506
992
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
if (!this.teamSkillLibrary) {
|
|
514
|
-
throw new Error('Team learning is not enabled. Set teamLearning.enabled = true in config.');
|
|
515
|
-
}
|
|
516
|
-
await this.teamSkillLibrary.recordTeamOutcome(feedback);
|
|
993
|
+
validationCanWrite(channel) {
|
|
994
|
+
if (!this.config.validation.enabled)
|
|
995
|
+
return true;
|
|
996
|
+
if (this.config.validation.mutationMode !== 'active')
|
|
997
|
+
return false;
|
|
998
|
+
return this.config.validation.channelMasks.write.includes(channel);
|
|
517
999
|
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
async formatRoleGuidance(role, context) {
|
|
523
|
-
if (!this.teamSkillLibrary)
|
|
524
|
-
return '';
|
|
525
|
-
const ranked = await this.teamSkillLibrary.findRolePlaybooks(role, {
|
|
526
|
-
topology: context?.topology,
|
|
527
|
-
domain: context?.domain,
|
|
528
|
-
taskType: context?.taskType,
|
|
529
|
-
});
|
|
530
|
-
return this.teamSkillLibrary.formatRoleGuidance(role, ranked.map((r) => r.playbook));
|
|
1000
|
+
validationCanRetrieve(channel) {
|
|
1001
|
+
if (!this.config.validation.enabled)
|
|
1002
|
+
return true;
|
|
1003
|
+
return this.config.validation.channelMasks.retrieval.includes(channel);
|
|
531
1004
|
}
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
1005
|
+
validationCanServe(channel) {
|
|
1006
|
+
if (!this.config.validation.enabled)
|
|
1007
|
+
return true;
|
|
1008
|
+
return this.config.validation.channelMasks.serving.includes(channel);
|
|
1009
|
+
}
|
|
1010
|
+
filterMemoryForServing(memoryContext) {
|
|
1011
|
+
if (!this.config.validation.enabled)
|
|
1012
|
+
return memoryContext;
|
|
1013
|
+
return {
|
|
1014
|
+
...memoryContext,
|
|
1015
|
+
experiences: this.validationCanServe('experiences') ? memoryContext.experiences : [],
|
|
1016
|
+
playbooks: this.validationCanServe('playbooks') ? memoryContext.playbooks : [],
|
|
1017
|
+
knowledge: this.validationCanServe('knowledge') ? memoryContext.knowledge : [],
|
|
539
1018
|
};
|
|
540
|
-
const shouldIncludeAll = !options || (options.includeExperiences === undefined &&
|
|
541
|
-
options.includePlaybooks === undefined);
|
|
542
|
-
if (shouldIncludeAll || options?.includeExperiences) {
|
|
543
|
-
results.experiences = await this.memory.teamExperiences.findSimilarTeamExperiences(query, { domain: options?.domain, topology: options?.topology });
|
|
544
|
-
}
|
|
545
|
-
if (shouldIncludeAll || options?.includePlaybooks) {
|
|
546
|
-
results.playbooks = await this.memory.teamExperiences.findMatchingTeamPlaybooks({
|
|
547
|
-
taskType: query,
|
|
548
|
-
domain: options?.domain,
|
|
549
|
-
topology: options?.topology,
|
|
550
|
-
});
|
|
551
|
-
}
|
|
552
|
-
return results;
|
|
553
1019
|
}
|
|
554
1020
|
/**
|
|
555
|
-
* Run batch learning explicitly
|
|
1021
|
+
* Run batch learning explicitly. Drains the durable dream_queue via `dream()`
|
|
1022
|
+
* and returns the aggregate batch result.
|
|
556
1023
|
*/
|
|
557
1024
|
async runBatchLearning() {
|
|
558
|
-
return this.
|
|
1025
|
+
return (await this.dream({ drainAll: true })).batch;
|
|
559
1026
|
}
|
|
560
1027
|
/**
|
|
561
1028
|
* Query memory for relevant context
|
|
@@ -573,19 +1040,8 @@ export class Atlas {
|
|
|
573
1040
|
learning: {
|
|
574
1041
|
trajectoriesProcessed: this.trajectoriesProcessed,
|
|
575
1042
|
pendingTrajectories: this.unifiedPipeline.getAccumulatedCount(),
|
|
576
|
-
teamTrajectoriesProcessed: this.teamTrajectoriesProcessed,
|
|
577
1043
|
},
|
|
578
1044
|
};
|
|
579
|
-
// Add team memory stats if team learning is enabled
|
|
580
|
-
if (this.config.teamLearning.enabled) {
|
|
581
|
-
const teamStats = await this.memory.teamExperiences.getStats();
|
|
582
|
-
stats.teamMemory = {
|
|
583
|
-
teamExperienceCount: teamStats.teamExperienceCount,
|
|
584
|
-
teamPlaybookCount: teamStats.teamPlaybookCount,
|
|
585
|
-
rolePlaybookCount: teamStats.rolePlaybookCount,
|
|
586
|
-
teamMetaObservationCount: teamStats.metaObservationCount,
|
|
587
|
-
};
|
|
588
|
-
}
|
|
589
1045
|
// Add execution stats if AgentManager is available
|
|
590
1046
|
if (this.agentManager) {
|
|
591
1047
|
stats.execution = {
|
|
@@ -611,6 +1067,14 @@ export class Atlas {
|
|
|
611
1067
|
getMemory() {
|
|
612
1068
|
return this.memory;
|
|
613
1069
|
}
|
|
1070
|
+
/**
|
|
1071
|
+
* Get the unified SQLite persistence handle for direct access — e.g. to
|
|
1072
|
+
* inspect the dream_queue (pending/processing counts) or drive a dream from
|
|
1073
|
+
* an external scheduler.
|
|
1074
|
+
*/
|
|
1075
|
+
getPersistence() {
|
|
1076
|
+
return this.persistence;
|
|
1077
|
+
}
|
|
614
1078
|
/**
|
|
615
1079
|
* Get the knowledge bank for direct access (null if not enabled)
|
|
616
1080
|
*/
|
|
@@ -651,7 +1115,12 @@ export class Atlas {
|
|
|
651
1115
|
if (this.mcpServer) {
|
|
652
1116
|
return; // Already started
|
|
653
1117
|
}
|
|
654
|
-
this
|
|
1118
|
+
// Pass `this` as the in-process learning surface (G7) so the server can
|
|
1119
|
+
// expose ingest/extract/promote tools that drive the same-process loop.
|
|
1120
|
+
// Because the server is long-running and shares this Atlas instance, the
|
|
1121
|
+
// ingest tool keeps the in-memory batch accumulator warm — sidestepping
|
|
1122
|
+
// the fresh-process-empties-the-accumulator problem of CLI-per-trajectory.
|
|
1123
|
+
this.mcpServer = createPlaybookMCPServer(this.memory.playbooks, this.skillLibrary ?? undefined, this.config.mcp, this);
|
|
655
1124
|
}
|
|
656
1125
|
/**
|
|
657
1126
|
* Stop the MCP server
|
|
@@ -687,7 +1156,7 @@ export class Atlas {
|
|
|
687
1156
|
return result.output;
|
|
688
1157
|
}
|
|
689
1158
|
catch (error) {
|
|
690
|
-
|
|
1159
|
+
logger.error('Workspace-based usage inference failed, falling back to heuristic:', error instanceof Error ? error.message : error);
|
|
691
1160
|
}
|
|
692
1161
|
}
|
|
693
1162
|
// Heuristic fallback
|
|
@@ -696,41 +1165,6 @@ export class Atlas {
|
|
|
696
1165
|
}
|
|
697
1166
|
return [];
|
|
698
1167
|
}
|
|
699
|
-
/**
|
|
700
|
-
* Reflect on execution via workspace template when taskRunner available,
|
|
701
|
-
* otherwise fall back to MetaLearner's built-in heuristic reflection.
|
|
702
|
-
*/
|
|
703
|
-
async reflectOnExecution(trajectory, routing) {
|
|
704
|
-
const metaLearnerRef = this.unifiedPipeline.getMetaLearner();
|
|
705
|
-
if (!metaLearnerRef)
|
|
706
|
-
return;
|
|
707
|
-
const routingInfo = {
|
|
708
|
-
strategy: routing.strategy,
|
|
709
|
-
confidence: routing.confidence,
|
|
710
|
-
estimatedBudget: routing.estimatedBudget,
|
|
711
|
-
reasoning: routing.reasoning,
|
|
712
|
-
};
|
|
713
|
-
const playbookMatches = routing.memoryContext.playbooks;
|
|
714
|
-
if (this.taskRunner) {
|
|
715
|
-
try {
|
|
716
|
-
const result = await this.taskRunner.run(metaReflectionTemplate, {
|
|
717
|
-
trajectory,
|
|
718
|
-
routingDecision: routingInfo,
|
|
719
|
-
playbooksUsed: playbookMatches,
|
|
720
|
-
});
|
|
721
|
-
// Bridge template output into MetaLearner storage
|
|
722
|
-
const playbookIds = playbookMatches.map(p => p.playbook.id);
|
|
723
|
-
const actualEffort = trajectory.llmCalls ?? trajectory.steps.length;
|
|
724
|
-
await metaLearnerRef.recordFromReflection(result.output, trajectory.id, routingInfo, playbookIds, actualEffort);
|
|
725
|
-
return;
|
|
726
|
-
}
|
|
727
|
-
catch (error) {
|
|
728
|
-
console.error('Workspace-based meta-reflection failed, falling back to heuristic:', error instanceof Error ? error.message : error);
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
// Heuristic fallback
|
|
732
|
-
await metaLearnerRef.generateReflection(trajectory, routingInfo, playbookMatches);
|
|
733
|
-
}
|
|
734
1168
|
/**
|
|
735
1169
|
* Get the meta learner for direct access
|
|
736
1170
|
*/
|
|
@@ -746,16 +1180,17 @@ export class Atlas {
|
|
|
746
1180
|
async close() {
|
|
747
1181
|
// Stop MCP server if running
|
|
748
1182
|
await this.stopMCPServer();
|
|
749
|
-
//
|
|
750
|
-
if (this.
|
|
751
|
-
|
|
1183
|
+
// Cancel any pending idle-dream timer.
|
|
1184
|
+
if (this.dreamTimer) {
|
|
1185
|
+
clearTimeout(this.dreamTimer);
|
|
1186
|
+
this.dreamTimer = null;
|
|
752
1187
|
}
|
|
753
|
-
// Flush
|
|
754
|
-
|
|
755
|
-
|
|
1188
|
+
// Flush unified pipeline by draining the durable queue via a dream. The
|
|
1189
|
+
// `isInitialized` guard keeps a second close() (e.g. test teardown after an
|
|
1190
|
+
// explicit close) from touching an already-closed database.
|
|
1191
|
+
if (this.persistence.isInitialized && this.persistence.countPendingDreamRows() > 0) {
|
|
1192
|
+
await this.dream({ drainAll: true });
|
|
756
1193
|
}
|
|
757
|
-
// Flush MoE gate state before closing persistence
|
|
758
|
-
this.router.persistGateState();
|
|
759
1194
|
// Close effectiveness tracker
|
|
760
1195
|
const tracker = this.unifiedPipeline.getEffectivenessTracker();
|
|
761
1196
|
if (tracker) {
|
|
@@ -765,6 +1200,10 @@ export class Atlas {
|
|
|
765
1200
|
if (this.skillTreeStorage) {
|
|
766
1201
|
this.skillTreeStorage.close();
|
|
767
1202
|
}
|
|
1203
|
+
// Close the shared-bank mirror (best-effort)
|
|
1204
|
+
if (this.sharedSkillBank) {
|
|
1205
|
+
await this.sharedSkillBank.close();
|
|
1206
|
+
}
|
|
768
1207
|
// Close memory system
|
|
769
1208
|
await this.memory.close();
|
|
770
1209
|
// Close SQLite persistence
|
|
@@ -778,13 +1217,40 @@ export function createAtlas(config) {
|
|
|
778
1217
|
return new Atlas(config);
|
|
779
1218
|
}
|
|
780
1219
|
/**
|
|
781
|
-
*
|
|
782
|
-
*
|
|
1220
|
+
* F6: Compute relevance-weighted credit shares for injection-presence attribution.
|
|
1221
|
+
*
|
|
1222
|
+
* Given a list of injected playbooks with retrieval scores, returns an array of
|
|
1223
|
+
* `{ id, weight }` entries where weights sum to 1. When all scores are zero or
|
|
1224
|
+
* the list is empty the function returns uniform weights (1/k each).
|
|
1225
|
+
*
|
|
1226
|
+
* This is a pure function (no side-effects) so it can be unit-tested in isolation
|
|
1227
|
+
* and imported by tests without a full Atlas instance.
|
|
1228
|
+
*
|
|
1229
|
+
* @param playbooks - Playbooks that were injected, with their retrieval scores
|
|
1230
|
+
* @returns Attribution entries — one per injected playbook, weights summing to 1
|
|
1231
|
+
*
|
|
1232
|
+
* @example
|
|
1233
|
+
* // scores [0.9, 0.6, 0.3] → weights [0.5, 0.333, 0.167]
|
|
1234
|
+
* attributeCredit([
|
|
1235
|
+
* { playbook: { id: 'a', ... }, score: 0.9, matchType: 'situation' },
|
|
1236
|
+
* { playbook: { id: 'b', ... }, score: 0.6, matchType: 'situation' },
|
|
1237
|
+
* { playbook: { id: 'c', ... }, score: 0.3, matchType: 'situation' },
|
|
1238
|
+
* ])
|
|
1239
|
+
* // → [{ id: 'a', weight: 0.5 }, { id: 'b', weight: 0.333 }, { id: 'c', weight: 0.167 }]
|
|
783
1240
|
*/
|
|
784
|
-
export function
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
1241
|
+
export function attributeCredit(playbooks) {
|
|
1242
|
+
if (playbooks.length === 0)
|
|
1243
|
+
return [];
|
|
1244
|
+
const totalScore = playbooks.reduce((sum, p) => sum + p.score, 0);
|
|
1245
|
+
if (totalScore <= 0) {
|
|
1246
|
+
// Uniform fallback when all scores are zero or absent
|
|
1247
|
+
const uniform = 1 / playbooks.length;
|
|
1248
|
+
return playbooks.map((p) => ({ id: p.playbook.id, weight: uniform }));
|
|
1249
|
+
}
|
|
1250
|
+
return playbooks.map((p) => ({
|
|
1251
|
+
id: p.playbook.id,
|
|
1252
|
+
weight: p.score / totalScore,
|
|
1253
|
+
}));
|
|
788
1254
|
}
|
|
789
1255
|
/**
|
|
790
1256
|
* Create an Atlas instance with AgentManager backends
|