cognitive-core 0.2.5 → 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 +116 -0
- package/dist/learning/pipeline.d.ts.map +1 -0
- package/dist/learning/pipeline.js +288 -0
- package/dist/learning/pipeline.js.map +1 -0
- 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 +6 -4
- package/dist/surfacing/skill-publisher.d.ts.map +1 -1
- package/dist/surfacing/skill-publisher.js +32 -30
- package/dist/surfacing/skill-publisher.js.map +1 -1
- package/dist/surfacing/sqlite-storage-adapter.d.ts.map +1 -1
- package/dist/surfacing/sqlite-storage-adapter.js +12 -8
- 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 -258
- package/src/surfacing/sqlite-storage-adapter.ts +0 -287
- 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/ranking-driven-loadout-e2e.test.ts +0 -185
- package/tests/integration/session-bank.test.ts +0 -231
- package/tests/integration/sessionlog-e2e.test.ts +0 -329
- package/tests/integration/skill-publishing-filesystem-e2e.test.ts +0 -216
- 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 -432
- package/tests/surfacing/sqlite-storage-adapter.test.ts +0 -197
- 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
|
@@ -0,0 +1,1409 @@
|
|
|
1
|
+
import { cpSync, existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, statSync, } from 'node:fs';
|
|
2
|
+
import { tmpdir } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { createAtlasWithAgents } from '../../atlas.js';
|
|
5
|
+
import { inferPlaybookSkillLevel } from '../../types/playbook.js';
|
|
6
|
+
import { createEmbeddingProvider, embeddingConfigFromEnv } from '../../embeddings/provider.js';
|
|
7
|
+
import { createClaudeCliLLMProvider } from './claude-cli-llm-provider.js';
|
|
8
|
+
import { createPlaybook, createTask } from '../../types/index.js';
|
|
9
|
+
import { aggregateCondition, ciDisjoint, normalizedGain } from '../metrics.js';
|
|
10
|
+
import { seededRng } from '../rng.js';
|
|
11
|
+
import { ClaudeBenchmarkDelegate } from './claude-delegate.js';
|
|
12
|
+
import { EnvBridgeError } from './env-bridge.js';
|
|
13
|
+
import { createTraceWriter } from './trace.js';
|
|
14
|
+
import { coldRowsMatchStream } from './cold-reuse.js';
|
|
15
|
+
import { loadResumeState } from './run-resume.js';
|
|
16
|
+
import { evaluateStopping, poolArmCounts } from './stopping.js';
|
|
17
|
+
import { selectDiscriminativeTasks } from './difficulty-registry.js';
|
|
18
|
+
import { diagnosticsToMechanismTraceEvents } from '../mechanism-trace-adapter.js';
|
|
19
|
+
import { emitMechanismTraceAsLiveTraceEntry, } from '../../learning/mechanism-trace.js';
|
|
20
|
+
import { readReplayDescriptor } from '../../learning/replay-types.js';
|
|
21
|
+
/**
|
|
22
|
+
* Default per-window cap on live-replay rollouts for `--live-replay-gating`.
|
|
23
|
+
* The single-parent gate scores parent + child across a minibatch per proposal,
|
|
24
|
+
* and a scaled run (24–40 tasks) fires several proposals across its dreams; the
|
|
25
|
+
* old default (20) was quietly exhausted, silently displacing the real-verifier
|
|
26
|
+
* signal with the LLM-judge fallback. 64 comfortably covers a scaled run's
|
|
27
|
+
* replayable minibatch while still bounding runaway rollout spend. Rolling
|
|
28
|
+
* window is 1h (BudgetedReplayJudge default), so long runs refresh naturally.
|
|
29
|
+
*/
|
|
30
|
+
export const DEFAULT_LIVE_REPLAY_ROLLOUT_BUDGET = 64;
|
|
31
|
+
/**
|
|
32
|
+
* Honest replayability predicate for the live-replay gate: an experience is
|
|
33
|
+
* faithfully replayable ONLY when the solve path stamped a reconstructable
|
|
34
|
+
* ReplayDescriptor carrying a stable `taskId`. Without it there is no way to
|
|
35
|
+
* re-run the CORRECT task, so the gate must fall back to the LLM judge rather
|
|
36
|
+
* than silently re-executing the last-solved task. Exported for testing.
|
|
37
|
+
*/
|
|
38
|
+
export function isTaskIdReplayable(experience) {
|
|
39
|
+
const d = readReplayDescriptor(experience);
|
|
40
|
+
return !!d && d.reconstructable && typeof d.envHandle?.taskId === 'string';
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Rebuild the {@link Task} for a replay rollout from an experience, re-stamping
|
|
44
|
+
* the stable task handle (`taskId`/`family`/`difficulty`) captured at solve time
|
|
45
|
+
* onto `task.metadata` so a stateful benchmark delegate drives the EXPERIENCE's
|
|
46
|
+
* task. Exported for testing.
|
|
47
|
+
*/
|
|
48
|
+
export function reconstructTaskFromReplayDescriptor(experience) {
|
|
49
|
+
const h = readReplayDescriptor(experience)?.envHandle ?? {};
|
|
50
|
+
return createTask({
|
|
51
|
+
description: experience.taskInput,
|
|
52
|
+
domain: experience.domain,
|
|
53
|
+
metadata: {
|
|
54
|
+
taskId: h.taskId,
|
|
55
|
+
...(h.family !== undefined ? { family: h.family } : {}),
|
|
56
|
+
...(h.difficulty !== undefined ? { difficulty: h.difficulty } : {}),
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Recursively merge `patch` into `base`. Plain objects are merged recursively;
|
|
62
|
+
* arrays and primitives replace the existing value. Neither argument is mutated.
|
|
63
|
+
*/
|
|
64
|
+
function deepMerge(base, patch) {
|
|
65
|
+
const result = { ...base };
|
|
66
|
+
for (const key of Object.keys(patch)) {
|
|
67
|
+
const bv = result[key];
|
|
68
|
+
const pv = patch[key];
|
|
69
|
+
if (pv !== null &&
|
|
70
|
+
typeof pv === 'object' &&
|
|
71
|
+
!Array.isArray(pv) &&
|
|
72
|
+
bv !== null &&
|
|
73
|
+
typeof bv === 'object' &&
|
|
74
|
+
!Array.isArray(bv)) {
|
|
75
|
+
result[key] = deepMerge(bv, pv);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
result[key] = pv;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Resolve which curated-playbook dirs a given arm seeds. `seedPlaybookDirs`
|
|
85
|
+
* apply to BOTH arms (recipe cold-start); `learningOnlySeedDirs` apply ONLY to
|
|
86
|
+
* the learning arm (oracle smoke). Seeding the cold arm with the latter would
|
|
87
|
+
* hand the baseline the answer and collapse the measured delta — the bug this
|
|
88
|
+
* isolation fixes. Exported for unit testing.
|
|
89
|
+
*/
|
|
90
|
+
export function resolveSeedDirs(seedPlaybookDirs, learningOnlySeedDirs, isLearningArm) {
|
|
91
|
+
return [...(seedPlaybookDirs ?? []), ...(isLearningArm ? (learningOnlySeedDirs ?? []) : [])];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Run `fn` over `items` with at most `limit` concurrent invocations, returning
|
|
95
|
+
* results in INPUT order (not completion order). `limit <= 1` runs sequentially.
|
|
96
|
+
* A worker-pool design: `limit` workers pull the next index until exhausted.
|
|
97
|
+
* If any `fn` rejects, the whole pool rejects (callers handle per-item errors
|
|
98
|
+
* inside `fn` so this only fires on programmer error).
|
|
99
|
+
*/
|
|
100
|
+
export async function mapPool(items, limit, fn) {
|
|
101
|
+
const results = new Array(items.length);
|
|
102
|
+
const n = items.length;
|
|
103
|
+
const workers = Math.max(1, Math.min(limit, n));
|
|
104
|
+
let next = 0;
|
|
105
|
+
async function worker() {
|
|
106
|
+
while (next < n) {
|
|
107
|
+
const i = next++;
|
|
108
|
+
results[i] = await fn(items[i], i);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
await Promise.all(Array.from({ length: workers }, () => worker()));
|
|
112
|
+
return results;
|
|
113
|
+
}
|
|
114
|
+
/** Whether an error thrown by the agent/CLI represents an infrastructure failure
|
|
115
|
+
* rather than a legitimate agent failure. */
|
|
116
|
+
function isEnvError(err) {
|
|
117
|
+
// EnvBridgeError is always an infra failure.
|
|
118
|
+
if (err instanceof EnvBridgeError)
|
|
119
|
+
return true;
|
|
120
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
121
|
+
// API rate-limit / overload
|
|
122
|
+
if (/429|529|rate.?limit|too many requests|overloaded/i.test(msg))
|
|
123
|
+
return true;
|
|
124
|
+
// Timeout
|
|
125
|
+
if (/timed? out|timeout/i.test(msg))
|
|
126
|
+
return true;
|
|
127
|
+
// CLI spawn or non-zero exit with no output
|
|
128
|
+
if (/Failed to spawn|exited [1-9]\d*(?:\b|:)|not found in PATH/i.test(msg))
|
|
129
|
+
return true;
|
|
130
|
+
// Bridge process died
|
|
131
|
+
if (/env bridge|bridge.*exit|Could not start env bridge/i.test(msg))
|
|
132
|
+
return true;
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
function previewOutcome(outcome, maxLength = 2000) {
|
|
136
|
+
const value = outcome.solution ?? outcome.errorInfo;
|
|
137
|
+
if (value === undefined || value === null)
|
|
138
|
+
return undefined;
|
|
139
|
+
const text = typeof value === 'string' ? value : JSON.stringify(value);
|
|
140
|
+
return text.length > maxLength ? `${text.slice(0, maxLength)}...` : text;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Deterministically partition a task stream into disjoint TRAIN and held-out
|
|
144
|
+
* EVAL splits, PER FAMILY, so both splits share families (the precondition for
|
|
145
|
+
* measuring transfer: trained on task A's oracle → helps held-out task B in the
|
|
146
|
+
* same family). Seeded, so both arms of a seed see the identical partition.
|
|
147
|
+
*
|
|
148
|
+
* Rules:
|
|
149
|
+
* - Group by `family` (fallback `skillTag`), preserving stream order.
|
|
150
|
+
* - A singleton family cannot be held out → its lone task goes to TRAIN.
|
|
151
|
+
* - Otherwise trainCount = round(k * trainRatio), clamped to [1, k-1] so both
|
|
152
|
+
* sub-splits are non-empty for every multi-task family.
|
|
153
|
+
* - Selection uses a per-family seeded shuffle so train/eval both span the
|
|
154
|
+
* family's difficulty range rather than a clean early/late cut.
|
|
155
|
+
*
|
|
156
|
+
* Exported for unit testing.
|
|
157
|
+
*/
|
|
158
|
+
export function partitionTrainEval(stream, trainRatio, splitSeed) {
|
|
159
|
+
const groups = new Map();
|
|
160
|
+
for (const item of stream) {
|
|
161
|
+
const key = item.family ?? item.skillTag ?? 'default';
|
|
162
|
+
const arr = groups.get(key) ?? [];
|
|
163
|
+
arr.push(item);
|
|
164
|
+
groups.set(key, arr);
|
|
165
|
+
}
|
|
166
|
+
const train = [];
|
|
167
|
+
const evalHeldOut = [];
|
|
168
|
+
for (const [family, items] of groups) {
|
|
169
|
+
if (items.length === 1) {
|
|
170
|
+
train.push(items[0]);
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
const rng = seededRng(`train-eval:${family}`, splitSeed);
|
|
174
|
+
const order = items.map((_, i) => i);
|
|
175
|
+
for (let i = order.length - 1; i > 0; i--) {
|
|
176
|
+
const j = Math.floor(rng() * (i + 1));
|
|
177
|
+
[order[i], order[j]] = [order[j], order[i]];
|
|
178
|
+
}
|
|
179
|
+
let trainCount = Math.round(items.length * trainRatio);
|
|
180
|
+
trainCount = Math.max(1, Math.min(items.length - 1, trainCount));
|
|
181
|
+
const trainIdx = new Set(order.slice(0, trainCount));
|
|
182
|
+
items.forEach((it, i) => (trainIdx.has(i) ? train : evalHeldOut).push(it));
|
|
183
|
+
}
|
|
184
|
+
return { train, evalHeldOut };
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Live learning-curve runner.
|
|
188
|
+
*
|
|
189
|
+
* Same two-arm design as the mock runner, but every task is solved by a REAL
|
|
190
|
+
* agent (Claude CLI) and scored against ground truth:
|
|
191
|
+
* - "learning": one Atlas carries memory across the stream — accumulated
|
|
192
|
+
* experiences/playbooks are injected into the agent's context.
|
|
193
|
+
* - "no-learning": a fresh cold Atlas per task — the agent solves each task
|
|
194
|
+
* with no injected memory (the stateless baseline).
|
|
195
|
+
*
|
|
196
|
+
* The delta answers the real question the mock can only simulate: does
|
|
197
|
+
* cognitive-core's accumulated memory actually improve task success?
|
|
198
|
+
*
|
|
199
|
+
* Single-turn benchmarks (GSM8K) use the ClaudeBenchmarkDelegate. Interactive
|
|
200
|
+
* benchmarks (ALFWorld) supply their own multi-turn delegate via
|
|
201
|
+
* `delegateFactory`.
|
|
202
|
+
*/
|
|
203
|
+
export class LiveEvalRunner {
|
|
204
|
+
config;
|
|
205
|
+
delegateFactory;
|
|
206
|
+
/**
|
|
207
|
+
* Mutation/merge activity accumulated across learning-arm seeds (summed).
|
|
208
|
+
* Populated after each learning-arm Atlas closes; attached to the learning
|
|
209
|
+
* ConditionResult so run reports prove whether the mutation path executed.
|
|
210
|
+
*/
|
|
211
|
+
learningMutationActivity = null;
|
|
212
|
+
/** Adopted per-(arm, seed) results from a prior aborted run, or null. */
|
|
213
|
+
resume;
|
|
214
|
+
constructor(config,
|
|
215
|
+
/** Override for interactive benchmarks that need a multi-turn delegate. */
|
|
216
|
+
delegateFactory) {
|
|
217
|
+
this.config = config;
|
|
218
|
+
this.delegateFactory = delegateFactory;
|
|
219
|
+
// Load the resume checkpoint eagerly (before any fresh checkpoint write) so
|
|
220
|
+
// adopted rows reflect the aborted run, not this run's in-progress state.
|
|
221
|
+
this.resume = config.resumeFrom ? loadResumeState(config.resumeFrom) : null;
|
|
222
|
+
}
|
|
223
|
+
/** Completed results for (arm, seed) from the resume checkpoint, if any. */
|
|
224
|
+
completed(arm, seed) {
|
|
225
|
+
return this.resume?.completedFor(arm, seed);
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Resolve the learning/train Atlas baseDir for a seed. With `runWorkDir`, this
|
|
229
|
+
* is a STABLE, deterministic subdir that survives process death (persistent =
|
|
230
|
+
* true → the caller must not delete it in `finally`). Without it, an ephemeral
|
|
231
|
+
* temp dir (persistent = false → deleted in `finally` as before).
|
|
232
|
+
*/
|
|
233
|
+
learningBaseDir(kind, seed) {
|
|
234
|
+
if (this.config.runWorkDir) {
|
|
235
|
+
const dir = join(this.config.runWorkDir, `${kind}-seed-${seed}`);
|
|
236
|
+
mkdirSync(dir, { recursive: true });
|
|
237
|
+
return { dir, persistent: true };
|
|
238
|
+
}
|
|
239
|
+
return { dir: mkdtempSync(join(tmpdir(), `cc-live-${kind}-${seed}-`)), persistent: false };
|
|
240
|
+
}
|
|
241
|
+
async run() {
|
|
242
|
+
const start = Date.now();
|
|
243
|
+
const evalConfig = {
|
|
244
|
+
backend: 'live',
|
|
245
|
+
taskCount: this.config.taskCount,
|
|
246
|
+
skillCount: 0,
|
|
247
|
+
seeds: this.config.seeds,
|
|
248
|
+
rollingWindow: this.config.rollingWindow,
|
|
249
|
+
coldProb: 0,
|
|
250
|
+
warmProb: 0,
|
|
251
|
+
forceBatchEvery: 0,
|
|
252
|
+
};
|
|
253
|
+
// Single-arm (ablation/attribution): learning only, no cold baseline.
|
|
254
|
+
if (this.config.singleArm) {
|
|
255
|
+
const learning = await this.runArm('learning', true);
|
|
256
|
+
this.attachMutationActivity(learning);
|
|
257
|
+
return {
|
|
258
|
+
config: evalConfig,
|
|
259
|
+
benchmarkName: this.config.benchmark.name,
|
|
260
|
+
singleArm: true,
|
|
261
|
+
learning,
|
|
262
|
+
noLearning: learning, // placeholder; not rendered in single-arm mode
|
|
263
|
+
successRateDelta: 0,
|
|
264
|
+
normalizedGain: 0,
|
|
265
|
+
significant: false,
|
|
266
|
+
ciDisjointAdvisory: false,
|
|
267
|
+
durationMs: Date.now() - start,
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
if (this.config.interleaveArms && this.config.seeds.length <= 1) {
|
|
271
|
+
this.log('[live] --interleave-arms: single seed — flag is a no-op');
|
|
272
|
+
}
|
|
273
|
+
// interleaveArms: per-seed arm-order alternation.
|
|
274
|
+
// Odd seeds run learning then cold (default); even seeds run cold then learning.
|
|
275
|
+
// We collect per-seed results into separate arrays and aggregate after all seeds.
|
|
276
|
+
const learningPerSeed = [];
|
|
277
|
+
const coldPerSeed = [];
|
|
278
|
+
for (let seedIdx = 0; seedIdx < this.config.seeds.length; seedIdx++) {
|
|
279
|
+
const seed = this.config.seeds[seedIdx];
|
|
280
|
+
const stream = await this.loadStream(seed);
|
|
281
|
+
// Train/eval isolation path: learner trains on the TRAIN split (oracle
|
|
282
|
+
// on) then is FROZEN and scored on the disjoint held-out EVAL split
|
|
283
|
+
// (oracle off). Only the EVAL split is aggregated. The cold baseline runs
|
|
284
|
+
// over the same held-out EVAL split. This is disjoint from the default
|
|
285
|
+
// interleaved path — reuse/interleave/stopping do not apply here.
|
|
286
|
+
if (this.config.trainEvalSplit?.enabled) {
|
|
287
|
+
const trainRatio = this.config.trainEvalSplit.trainRatio ?? 0.5;
|
|
288
|
+
const splitSeed = this.config.trainEvalSplit.splitSeed ?? 0;
|
|
289
|
+
const { train, evalHeldOut } = partitionTrainEval(stream, trainRatio, splitSeed + seed);
|
|
290
|
+
this.log(`[live] seed=${seed}: train/eval split — ${train.length} train (oracle on) / ` +
|
|
291
|
+
`${evalHeldOut.length} held-out eval (oracle off), trainRatio=${trainRatio}`);
|
|
292
|
+
if (evalHeldOut.length === 0) {
|
|
293
|
+
this.log(`[live] seed=${seed}: WARNING — held-out eval split is empty ` +
|
|
294
|
+
`(too few tasks per family for trainRatio=${trainRatio}); skipping seed`);
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
const learn = await this.runTrainThenEval(train, evalHeldOut, seed);
|
|
298
|
+
const cold = await this.runCold(evalHeldOut, seed);
|
|
299
|
+
learningPerSeed.push(learn);
|
|
300
|
+
coldPerSeed.push(cold);
|
|
301
|
+
continue;
|
|
302
|
+
}
|
|
303
|
+
const reusedCold = this.reusableColdRows(stream, seed);
|
|
304
|
+
if (reusedCold) {
|
|
305
|
+
this.log(`[live] seed=${seed}: reusing ${reusedCold.length} cold-arm results from prior run ` +
|
|
306
|
+
`(skipping cold arm)`);
|
|
307
|
+
const learn = await this.runCarry(stream, seed);
|
|
308
|
+
learningPerSeed.push(learn);
|
|
309
|
+
coldPerSeed.push(reusedCold);
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
const coldFirst = this.config.interleaveArms && seed % 2 === 0;
|
|
313
|
+
if (coldFirst) {
|
|
314
|
+
this.log(`[live] seed=${seed}: cold arm first (interleave-arms)`);
|
|
315
|
+
const cold = await this.runCold(stream, seed);
|
|
316
|
+
const learn = await this.runCarry(stream, seed);
|
|
317
|
+
coldPerSeed.push(cold);
|
|
318
|
+
learningPerSeed.push(learn);
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
this.log(`[live] seed=${seed}: learning arm first`);
|
|
322
|
+
const learn = await this.runCarry(stream, seed);
|
|
323
|
+
const cold = await this.runCold(stream, seed);
|
|
324
|
+
learningPerSeed.push(learn);
|
|
325
|
+
coldPerSeed.push(cold);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
// Sequential stopping at seed boundaries (only when more seeds remain):
|
|
329
|
+
// pool completed episodes, ask whether the remaining budget still buys
|
|
330
|
+
// information, and skip the rest of the seeds when it does not.
|
|
331
|
+
const remainingSeeds = this.config.seeds.length - seedIdx - 1;
|
|
332
|
+
if (this.config.stopping?.enabled && remainingSeeds > 0) {
|
|
333
|
+
const verdict = evaluateStopping({
|
|
334
|
+
learning: poolArmCounts(learningPerSeed),
|
|
335
|
+
cold: poolArmCounts(coldPerSeed),
|
|
336
|
+
remainingEpisodesPerArm: remainingSeeds * this.config.taskCount,
|
|
337
|
+
}, this.config.stopping);
|
|
338
|
+
this.log(`[live] stopping check after seed ${seed}: ${verdict.decision}` +
|
|
339
|
+
`${verdict.rule ? ` (${verdict.rule})` : ''} — ${verdict.reason}`);
|
|
340
|
+
if (verdict.decision === 'stop') {
|
|
341
|
+
this.log(`[live] adaptive stopping: skipping ${remainingSeeds} remaining seed(s) ` +
|
|
342
|
+
`(${remainingSeeds * this.config.taskCount * 2} episodes saved)`);
|
|
343
|
+
break;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
// Aggregate over the seeds actually run (adaptive stopping may truncate).
|
|
348
|
+
const seedsRun = this.config.seeds.slice(0, learningPerSeed.length);
|
|
349
|
+
const learning = aggregateCondition('learning', learningPerSeed, this.config.rollingWindow, seedsRun);
|
|
350
|
+
this.attachMutationActivity(learning);
|
|
351
|
+
const noLearning = aggregateCondition('no-learning', coldPerSeed, this.config.rollingWindow, seedsRun);
|
|
352
|
+
const advisory = ciDisjoint(learning.successRateCI, noLearning.successRateCI);
|
|
353
|
+
return {
|
|
354
|
+
config: evalConfig,
|
|
355
|
+
benchmarkName: this.config.benchmark.name,
|
|
356
|
+
learning,
|
|
357
|
+
noLearning,
|
|
358
|
+
successRateDelta: learning.successRate - noLearning.successRate,
|
|
359
|
+
normalizedGain: normalizedGain(noLearning.lateSuccessRate, learning.lateSuccessRate),
|
|
360
|
+
significant: advisory,
|
|
361
|
+
ciDisjointAdvisory: advisory,
|
|
362
|
+
durationMs: Date.now() - start,
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Load the task stream for a seed. With discriminative task selection,
|
|
367
|
+
* oversample the pool and down-select toward the p≈0.5 band using the
|
|
368
|
+
* difficulty registry; otherwise load exactly taskCount tasks.
|
|
369
|
+
*/
|
|
370
|
+
async loadStream(seed) {
|
|
371
|
+
const selection = this.config.taskSelection;
|
|
372
|
+
if (!selection) {
|
|
373
|
+
return this.config.benchmark.loadTasks({ count: this.config.taskCount, seed });
|
|
374
|
+
}
|
|
375
|
+
const oversample = selection.oversample ?? 3;
|
|
376
|
+
const pool = await this.config.benchmark.loadTasks({
|
|
377
|
+
count: this.config.taskCount * oversample,
|
|
378
|
+
seed,
|
|
379
|
+
});
|
|
380
|
+
const stream = selectDiscriminativeTasks(pool, this.config.taskCount, selection.registry, this.config.benchmark.name, seed, selection.minRuns);
|
|
381
|
+
this.log(`[live] seed=${seed}: discriminative selection — ${stream.length}/${pool.length} tasks ` +
|
|
382
|
+
`(families: ${[...new Set(stream.map((t) => t.skillTag))].join(', ')})`);
|
|
383
|
+
return stream;
|
|
384
|
+
}
|
|
385
|
+
async runArm(label, carryMemory) {
|
|
386
|
+
const perSeed = [];
|
|
387
|
+
for (const seed of this.config.seeds) {
|
|
388
|
+
const stream = await this.loadStream(seed);
|
|
389
|
+
this.log(`[live] arm=${label} seed=${seed}: ${stream.length} tasks`);
|
|
390
|
+
const results = carryMemory
|
|
391
|
+
? await this.runCarry(stream, seed)
|
|
392
|
+
: await this.runCold(stream, seed);
|
|
393
|
+
perSeed.push(results);
|
|
394
|
+
}
|
|
395
|
+
return aggregateCondition(label, perSeed, this.config.rollingWindow, this.config.seeds);
|
|
396
|
+
}
|
|
397
|
+
log(msg) {
|
|
398
|
+
if (!this.config.quiet)
|
|
399
|
+
console.error(msg);
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Prior cold-arm rows for this seed, or undefined when absent/mismatched.
|
|
403
|
+
* Mismatch (different task count or taskIds) means the prior run used a
|
|
404
|
+
* different config — adopting it would compare arms across different task
|
|
405
|
+
* sets, so we warn and fall back to actually running the cold arm.
|
|
406
|
+
*/
|
|
407
|
+
reusableColdRows(stream, seed) {
|
|
408
|
+
const rows = this.config.reuseColdBySeed?.[seed];
|
|
409
|
+
if (!rows)
|
|
410
|
+
return undefined;
|
|
411
|
+
const check = coldRowsMatchStream(rows, stream.map((s) => s.task.id));
|
|
412
|
+
if (!check.ok) {
|
|
413
|
+
this.log(`[live] seed=${seed}: NOT reusing cold arm — prior run does not match ` +
|
|
414
|
+
`this task stream (${check.reason}); running cold arm normally`);
|
|
415
|
+
return undefined;
|
|
416
|
+
}
|
|
417
|
+
return rows;
|
|
418
|
+
}
|
|
419
|
+
/** Learning arm: one Atlas + delegate carries memory across the stream.
|
|
420
|
+
* env_error tasks are retried once; if they still env_error, they are
|
|
421
|
+
* recorded with status='env_error' and excluded from learning writes. */
|
|
422
|
+
async runCarry(stream, seed) {
|
|
423
|
+
// `frozen` disables the dream queue, so the learning arm never
|
|
424
|
+
// consolidates playbooks mid-run — it silently degenerates into a cold arm
|
|
425
|
+
// with an experience store. Fine for retrieval-only smokes with seeded
|
|
426
|
+
// playbooks; a bug for learning-efficacy runs. Warn loudly.
|
|
427
|
+
if ((this.config.mutationMode ?? 'active') === 'frozen') {
|
|
428
|
+
this.log(`[live] WARNING: learning arm running with mutationMode=frozen — ` +
|
|
429
|
+
`dream-queue writes are disabled, so NO playbooks will be extracted ` +
|
|
430
|
+
`mid-run. For learning-efficacy runs use --mutation-mode active (the default).`);
|
|
431
|
+
}
|
|
432
|
+
// Resume: adopt already-completed learning rows for this seed. A
|
|
433
|
+
// fully-complete seed skips Atlas construction entirely (no reopen cost) —
|
|
434
|
+
// it just re-emits its rows through the checkpoint hook.
|
|
435
|
+
const completed = this.completed('learning', seed);
|
|
436
|
+
if (completed && stream.every((item) => completed.has(item.index))) {
|
|
437
|
+
this.log(`[live] seed=${seed}: learning arm fully complete in checkpoint ` +
|
|
438
|
+
`(${stream.length} tasks) — adopting rows, skipping arm`);
|
|
439
|
+
const results = stream.map((item) => completed.get(item.index));
|
|
440
|
+
for (const item of stream) {
|
|
441
|
+
await this.config.onTaskBoundary?.({
|
|
442
|
+
arm: 'learning',
|
|
443
|
+
seed,
|
|
444
|
+
taskIndex: item.index,
|
|
445
|
+
taskCount: stream.length,
|
|
446
|
+
result: completed.get(item.index),
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
return results;
|
|
450
|
+
}
|
|
451
|
+
const { dir: baseDir, persistent } = this.learningBaseDir('learn', seed);
|
|
452
|
+
const delegate = this.makeDelegate();
|
|
453
|
+
const atlas = this.makeAtlas(baseDir, delegate, true);
|
|
454
|
+
// Reopening a persisted baseDir restores accumulated playbooks/experiences
|
|
455
|
+
// (PlaybookLibrary.init reindexes the SQLite rows), so resumed later tasks
|
|
456
|
+
// see the memory the aborted run had learned.
|
|
457
|
+
await atlas.init();
|
|
458
|
+
await this.loadMetaPlaybooks(atlas, true);
|
|
459
|
+
// Wire learning-arm-only levers (distill / mutation gating). The cold arm
|
|
460
|
+
// (runCold) must NOT receive a learning provider — it is stateless by design.
|
|
461
|
+
this.wireLearningArmMutation(atlas);
|
|
462
|
+
delegate.setMemory?.(atlas.getMemory());
|
|
463
|
+
if (completed && completed.size > 0) {
|
|
464
|
+
this.log(`[live] seed=${seed}: resuming learning arm — adopting ${completed.size} ` +
|
|
465
|
+
`completed task(s), reopened ${baseDir}`);
|
|
466
|
+
}
|
|
467
|
+
const results = [];
|
|
468
|
+
try {
|
|
469
|
+
for (const item of stream) {
|
|
470
|
+
// Adopt an already-completed task instead of re-solving it. Memory for
|
|
471
|
+
// this task is already reflected in the reopened baseDir, so we also
|
|
472
|
+
// skip its maybeDream.
|
|
473
|
+
const prior = completed?.get(item.index);
|
|
474
|
+
const result = prior ??
|
|
475
|
+
(await this.solveWithRetry(atlas, delegate, item, 'learning', seed, stream.length));
|
|
476
|
+
results.push(result);
|
|
477
|
+
await this.config.onTaskBoundary?.({
|
|
478
|
+
arm: 'learning',
|
|
479
|
+
seed,
|
|
480
|
+
taskIndex: item.index,
|
|
481
|
+
taskCount: stream.length,
|
|
482
|
+
result,
|
|
483
|
+
});
|
|
484
|
+
// env_error: do NOT feed the trajectory to learning (skip maybeDream
|
|
485
|
+
// so the infra failure does not corrupt the memory state). Adopted rows
|
|
486
|
+
// are skipped too (their dream already ran in the aborted generation).
|
|
487
|
+
if (!prior && result.status !== 'env_error') {
|
|
488
|
+
// Decoupled modeling: consolidate between tasks (same as the mock
|
|
489
|
+
// runner). With extraction off (minTrajectories) this only replays the
|
|
490
|
+
// deferred analytics; if minTrajectories is lowered it also extracts
|
|
491
|
+
// playbooks mid-stream so later tasks can benefit.
|
|
492
|
+
await atlas.getConsolidationCoordinator()?.maybeDream();
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
finally {
|
|
497
|
+
// close() drains leftover dream rows (which can trigger a final
|
|
498
|
+
// maintenance cycle), so capture the mutation counters AFTER close.
|
|
499
|
+
await atlas.close();
|
|
500
|
+
this.captureMutationActivity(atlas, seed);
|
|
501
|
+
// Persistent dirs survive for --resume; the caller cleans up on success.
|
|
502
|
+
if (!persistent)
|
|
503
|
+
rmSync(baseDir, { recursive: true, force: true });
|
|
504
|
+
}
|
|
505
|
+
return results;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Wire learning-arm-only mutation levers onto a freshly-built Atlas:
|
|
509
|
+
* bind the learning LLM provider when `distill` or `mutationGating` is on
|
|
510
|
+
* (installs the LLMJudgeReplay gate judge + reflective generator), and —
|
|
511
|
+
* for `mutationGating` — make the maintenance scheduler fire after every
|
|
512
|
+
* dream so short eval streams reach the mutation tasks at all.
|
|
513
|
+
*/
|
|
514
|
+
wireLearningArmMutation(atlas) {
|
|
515
|
+
if (this.config.distill || this.config.mutationGating) {
|
|
516
|
+
atlas.setLearningProvider(this.config.learningLlmProvider ??
|
|
517
|
+
createClaudeCliLLMProvider({
|
|
518
|
+
model: this.config.model,
|
|
519
|
+
provider: this.config.provider,
|
|
520
|
+
awsRegion: this.config.awsRegion,
|
|
521
|
+
timeoutMs: this.config.timeoutMs,
|
|
522
|
+
}));
|
|
523
|
+
}
|
|
524
|
+
if (this.config.mutationGating) {
|
|
525
|
+
// batchInterval 1 is the production default too, but pin it here so
|
|
526
|
+
// eval mutation runs stay reachable even if the default drifts.
|
|
527
|
+
atlas.getLearning().getMaintenanceScheduler().updateConfig({ batchInterval: 1 });
|
|
528
|
+
this.wireGateJudge(atlas);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* FIX 1 — pick the mutation-gate judge and log the choice explicitly.
|
|
533
|
+
*
|
|
534
|
+
* With `--live-replay-gating`, install a {@link ConditionalReplayJudge}
|
|
535
|
+
* (via `atlas.enableLiveReplayGating`) so faithfully-replayable experiences
|
|
536
|
+
* are gated on the REAL verifier (re-execution outcome — the same
|
|
537
|
+
* ground-truth signal the harness computes) and only non-replayable ones
|
|
538
|
+
* fall back to the LLM judge. Otherwise the LLM judge stays — but the
|
|
539
|
+
* decision is always logged so a run's gating signal is never ambiguous.
|
|
540
|
+
*
|
|
541
|
+
* FAITHFUL REPLAY (see docs/DESIGN-meta-learning-validation.md §8): the gate
|
|
542
|
+
* is only honest if the rollout re-runs the CORRECT task. We route by the
|
|
543
|
+
* ReplayDescriptor the solve path stamps onto each experience — an experience
|
|
544
|
+
* is replayable ONLY when it carries a stable `taskId` — and reconstruct that
|
|
545
|
+
* task (with its `taskId`/`family`/`difficulty` metadata) so the stateful
|
|
546
|
+
* benchmark delegate drives the right task. Experiences without a descriptor
|
|
547
|
+
* (no taskId) honestly fall back to the LLM judge instead of silently
|
|
548
|
+
* re-running the last-solved task. The rollout itself is isolated from the
|
|
549
|
+
* solve path's cost/current-task state (see `AgentSpawnConfig.replay`).
|
|
550
|
+
*/
|
|
551
|
+
wireGateJudge(atlas) {
|
|
552
|
+
if (!this.config.liveReplayGating) {
|
|
553
|
+
this.log(`[live] mutation gating: LLM-judge gate (haiku proxy). Pass ` +
|
|
554
|
+
`--live-replay-gating to gate on the real task verifier instead.`);
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
// Honest replayability: only experiences carrying a stamped, reconstructable
|
|
558
|
+
// taskId descriptor are re-run for real; everything else falls back to the
|
|
559
|
+
// LLM judge (never a rollout of the wrong task). reconstruct() returns an
|
|
560
|
+
// empty env — the delegate owns the sandbox; the taskId reaches it via
|
|
561
|
+
// reconstructTask + spawnViaDelegate's setCurrentTask.
|
|
562
|
+
const provider = {
|
|
563
|
+
isReplayable: isTaskIdReplayable,
|
|
564
|
+
reconstruct: async () => ({}),
|
|
565
|
+
};
|
|
566
|
+
const budget = this.config.liveReplayMaxRolloutsPerWindow ?? DEFAULT_LIVE_REPLAY_ROLLOUT_BUDGET;
|
|
567
|
+
try {
|
|
568
|
+
atlas.enableLiveReplayGating({
|
|
569
|
+
timeoutMs: this.config.timeoutMs,
|
|
570
|
+
maxRolloutsPerWindow: budget,
|
|
571
|
+
environmentProvider: provider,
|
|
572
|
+
// Re-stamp the stable task handle onto the reconstructed task so the
|
|
573
|
+
// stateful delegate re-runs the EXPERIENCE's task, not the last solved.
|
|
574
|
+
reconstructTask: reconstructTaskFromReplayDescriptor,
|
|
575
|
+
});
|
|
576
|
+
this.log(`[live] mutation gating: LIVE replay gate enabled — experiences with a ` +
|
|
577
|
+
`stamped taskId scored by real re-execution + verifier (budget ` +
|
|
578
|
+
`${budget}/window), LLM judge fallback for the rest.`);
|
|
579
|
+
}
|
|
580
|
+
catch (e) {
|
|
581
|
+
// enableLiveReplayGating throws only when no AgentManager is wired.
|
|
582
|
+
// Keep the LLM judge (already installed by setLearningProvider) and
|
|
583
|
+
// make the degraded choice explicit.
|
|
584
|
+
this.log(`[live] mutation gating: could not enable live replay gating ` +
|
|
585
|
+
`(${e instanceof Error ? e.message : String(e)}); keeping LLM-judge gate.`);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* Read the learning-arm pipeline's accumulated mutation counters and fold
|
|
590
|
+
* them into the run-level accumulator (summed across seeds). Reads
|
|
591
|
+
* in-memory state only, so it is safe after `atlas.close()`.
|
|
592
|
+
*/
|
|
593
|
+
captureMutationActivity(atlas, seed) {
|
|
594
|
+
let activity;
|
|
595
|
+
try {
|
|
596
|
+
activity = atlas.getLearning().getMutationActivity();
|
|
597
|
+
}
|
|
598
|
+
catch {
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
const acc = (this.learningMutationActivity ??= {
|
|
602
|
+
maintenanceCyclesRun: 0,
|
|
603
|
+
reflective: {
|
|
604
|
+
runs: 0,
|
|
605
|
+
skipped: 0,
|
|
606
|
+
proposalsConsidered: 0,
|
|
607
|
+
proposalsAccepted: 0,
|
|
608
|
+
proposalsRejected: 0,
|
|
609
|
+
reasonCounts: {},
|
|
610
|
+
},
|
|
611
|
+
merge: {
|
|
612
|
+
runs: 0,
|
|
613
|
+
skipped: 0,
|
|
614
|
+
proposalsConsidered: 0,
|
|
615
|
+
proposalsAccepted: 0,
|
|
616
|
+
proposalsRejected: 0,
|
|
617
|
+
reasonCounts: {},
|
|
618
|
+
},
|
|
619
|
+
});
|
|
620
|
+
acc.maintenanceCyclesRun += activity.maintenanceCyclesRun;
|
|
621
|
+
for (const key of ['reflective', 'merge']) {
|
|
622
|
+
const from = activity[key];
|
|
623
|
+
const to = acc[key];
|
|
624
|
+
to.runs += from.runs;
|
|
625
|
+
to.skipped += from.skipped;
|
|
626
|
+
if (from.lastSkipReason)
|
|
627
|
+
to.lastSkipReason = from.lastSkipReason;
|
|
628
|
+
to.proposalsConsidered += from.proposalsConsidered;
|
|
629
|
+
to.proposalsAccepted += from.proposalsAccepted;
|
|
630
|
+
to.proposalsRejected += from.proposalsRejected;
|
|
631
|
+
for (const [reason, count] of Object.entries(from.reasonCounts)) {
|
|
632
|
+
if (typeof count !== 'number')
|
|
633
|
+
continue;
|
|
634
|
+
const rk = reason;
|
|
635
|
+
to.reasonCounts[rk] = (to.reasonCounts[rk] ?? 0) + count;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
if (this.config.mutationGating) {
|
|
639
|
+
this.log(`[live] seed=${seed} mutation activity: maintenanceCycles=${activity.maintenanceCyclesRun} ` +
|
|
640
|
+
`reflective(considered=${activity.reflective.proposalsConsidered} ` +
|
|
641
|
+
`accepted=${activity.reflective.proposalsAccepted} skipped=${activity.reflective.skipped}` +
|
|
642
|
+
`${activity.reflective.lastSkipReason ? ` lastSkip="${activity.reflective.lastSkipReason}"` : ''}) ` +
|
|
643
|
+
`merge(considered=${activity.merge.proposalsConsidered} ` +
|
|
644
|
+
`accepted=${activity.merge.proposalsAccepted} skipped=${activity.merge.skipped}` +
|
|
645
|
+
`${activity.merge.lastSkipReason ? ` lastSkip="${activity.merge.lastSkipReason}"` : ''})`);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
/** Attach the accumulated learning-arm mutation counters to the report row. */
|
|
649
|
+
attachMutationActivity(learning) {
|
|
650
|
+
if (this.learningMutationActivity) {
|
|
651
|
+
learning.mutationActivity = this.learningMutationActivity;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* Train/eval isolation arm: one Atlas trains on the TRAIN split (oracle on,
|
|
656
|
+
* playbooks extracted mid-stream), is flushed + FROZEN, then scored on the
|
|
657
|
+
* disjoint held-out EVAL split with the trained memory served read-only.
|
|
658
|
+
* Returns ONLY the held-out eval results (the measured set).
|
|
659
|
+
*
|
|
660
|
+
* The freeze (`setValidationMutationMode('frozen')`) is what makes the
|
|
661
|
+
* isolation complete: during eval, `processTrajectory` is a no-op, so eval
|
|
662
|
+
* trajectories are neither stored nor extracted — the learner never trains on
|
|
663
|
+
* a task it is measured on. Retrieval/serving stay live, so trained playbooks
|
|
664
|
+
* are still injected. See docs/DESIGN-meta-learning-validation.md §
|
|
665
|
+
* "Train-time oracle signal vs solve-time firewall".
|
|
666
|
+
*/
|
|
667
|
+
async runTrainThenEval(train, evalHeldOut, seed) {
|
|
668
|
+
if ((this.config.mutationMode ?? 'active') === 'frozen') {
|
|
669
|
+
this.log(`[live] WARNING: train/eval split with mutationMode=frozen — the TRAIN ` +
|
|
670
|
+
`phase will not extract playbooks; the eval measures a cold baseline.`);
|
|
671
|
+
}
|
|
672
|
+
const { dir: baseDir, persistent } = this.learningBaseDir('train', seed);
|
|
673
|
+
const delegate = this.makeDelegate();
|
|
674
|
+
const atlas = this.makeAtlas(baseDir, delegate, true);
|
|
675
|
+
await atlas.init();
|
|
676
|
+
await this.loadMetaPlaybooks(atlas, true);
|
|
677
|
+
this.wireLearningArmMutation(atlas);
|
|
678
|
+
delegate.setMemory?.(atlas.getMemory());
|
|
679
|
+
const completedTrain = this.completed('train', seed);
|
|
680
|
+
const completedEval = this.completed('learning', seed);
|
|
681
|
+
const evalResults = [];
|
|
682
|
+
try {
|
|
683
|
+
// TRAIN phase — oracle on; the learner extracts playbooks mid-stream.
|
|
684
|
+
for (const item of train) {
|
|
685
|
+
const priorTrain = completedTrain?.get(item.index);
|
|
686
|
+
const result = priorTrain ??
|
|
687
|
+
(await this.solveWithRetry(atlas, delegate, item, 'train', seed, train.length));
|
|
688
|
+
await this.config.onTaskBoundary?.({
|
|
689
|
+
arm: 'train',
|
|
690
|
+
seed,
|
|
691
|
+
taskIndex: item.index,
|
|
692
|
+
taskCount: train.length,
|
|
693
|
+
result,
|
|
694
|
+
});
|
|
695
|
+
if (!priorTrain && result.status !== 'env_error') {
|
|
696
|
+
await atlas.getConsolidationCoordinator()?.maybeDream();
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
// Flush the dream queue so ALL train trajectories are consolidated into
|
|
700
|
+
// playbooks BEFORE the eval phase reads memory.
|
|
701
|
+
await atlas.dream({ drainAll: true });
|
|
702
|
+
// FREEZE — eval trajectories must not train the learner (firewall).
|
|
703
|
+
atlas.setValidationMutationMode('frozen');
|
|
704
|
+
this.log(`[live] seed=${seed}: train phase complete (${train.length} tasks) — ` +
|
|
705
|
+
`frozen for held-out eval (${evalHeldOut.length} tasks)`);
|
|
706
|
+
// EVAL phase — scored against trained (read-only) memory; no learning.
|
|
707
|
+
for (const item of evalHeldOut) {
|
|
708
|
+
const priorEval = completedEval?.get(item.index);
|
|
709
|
+
const result = priorEval ??
|
|
710
|
+
(await this.solveWithRetry(atlas, delegate, item, 'learning', seed, evalHeldOut.length));
|
|
711
|
+
evalResults.push(result);
|
|
712
|
+
await this.config.onTaskBoundary?.({
|
|
713
|
+
arm: 'learning',
|
|
714
|
+
seed,
|
|
715
|
+
taskIndex: item.index,
|
|
716
|
+
taskCount: evalHeldOut.length,
|
|
717
|
+
result,
|
|
718
|
+
});
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
finally {
|
|
722
|
+
await atlas.close();
|
|
723
|
+
this.captureMutationActivity(atlas, seed);
|
|
724
|
+
// Persistent dirs survive for --resume; the caller cleans up on success.
|
|
725
|
+
if (!persistent)
|
|
726
|
+
rmSync(baseDir, { recursive: true, force: true });
|
|
727
|
+
}
|
|
728
|
+
return evalResults;
|
|
729
|
+
}
|
|
730
|
+
/** No-learning arm: a fresh cold Atlas + delegate per task.
|
|
731
|
+
* env_error tasks are retried once; on second failure recorded as env_error. */
|
|
732
|
+
async runCold(stream, seed) {
|
|
733
|
+
// Cold tasks are fully independent (fresh Atlas + delegate + bridge each),
|
|
734
|
+
// so they parallelize cleanly. `concurrency` caps in-flight episodes; each
|
|
735
|
+
// builds and tears down its own resources. Results stay in stream order.
|
|
736
|
+
// Clamp to the benchmark's max (ALFWorld's bridge isn't concurrency-safe).
|
|
737
|
+
const benchMax = this.config.benchmark.maxConcurrency ?? Infinity;
|
|
738
|
+
const limit = Math.max(1, Math.min(this.config.concurrency ?? 1, benchMax));
|
|
739
|
+
const completed = this.completed('no-learning', seed);
|
|
740
|
+
return mapPool(stream, limit, async (item) => {
|
|
741
|
+
// Resume: adopt an already-completed cold episode (paid for in the aborted
|
|
742
|
+
// run) instead of re-running it. Cold tasks are stateless, so no reopen.
|
|
743
|
+
const prior = completed?.get(item.index);
|
|
744
|
+
if (prior) {
|
|
745
|
+
await this.config.onTaskBoundary?.({
|
|
746
|
+
arm: 'no-learning',
|
|
747
|
+
seed,
|
|
748
|
+
taskIndex: item.index,
|
|
749
|
+
taskCount: stream.length,
|
|
750
|
+
result: prior,
|
|
751
|
+
});
|
|
752
|
+
return prior;
|
|
753
|
+
}
|
|
754
|
+
const baseDir = mkdtempSync(join(tmpdir(), `cc-live-cold-${seed}-${item.index}-`));
|
|
755
|
+
const delegate = this.makeDelegate();
|
|
756
|
+
const atlas = this.makeAtlas(baseDir, delegate);
|
|
757
|
+
await atlas.init();
|
|
758
|
+
delegate.setMemory?.(atlas.getMemory());
|
|
759
|
+
try {
|
|
760
|
+
const result = await this.solveWithRetry(atlas, delegate, item, 'no-learning', seed, stream.length);
|
|
761
|
+
await this.config.onTaskBoundary?.({
|
|
762
|
+
arm: 'no-learning',
|
|
763
|
+
seed,
|
|
764
|
+
taskIndex: item.index,
|
|
765
|
+
taskCount: stream.length,
|
|
766
|
+
result,
|
|
767
|
+
});
|
|
768
|
+
return result;
|
|
769
|
+
}
|
|
770
|
+
finally {
|
|
771
|
+
await atlas.close();
|
|
772
|
+
rmSync(baseDir, { recursive: true, force: true });
|
|
773
|
+
}
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
/**
|
|
777
|
+
* Solve a single task with one automatic retry on env_error.
|
|
778
|
+
* On second env_error, return a result with status='env_error'.
|
|
779
|
+
* env_error results are excluded from success-rate aggregates and learning.
|
|
780
|
+
*/
|
|
781
|
+
async solveWithRetry(atlas, delegate, item, arm, seed, taskCount) {
|
|
782
|
+
try {
|
|
783
|
+
return await this.solveOne(atlas, delegate, item, arm, taskCount);
|
|
784
|
+
}
|
|
785
|
+
catch (err) {
|
|
786
|
+
if (isEnvError(err)) {
|
|
787
|
+
if (this.config.failFast) {
|
|
788
|
+
this.log(`[live] task ${item.index + 1}/${taskCount} env_error (arm=${arm} seed=${seed}): ` +
|
|
789
|
+
`${err.message.slice(0, 200)} — fail-fast, recording as env_error`);
|
|
790
|
+
return {
|
|
791
|
+
index: item.index,
|
|
792
|
+
taskId: item.task.id,
|
|
793
|
+
skillTag: item.skillTag,
|
|
794
|
+
success: false,
|
|
795
|
+
status: 'env_error',
|
|
796
|
+
stepCount: 0,
|
|
797
|
+
knowledgeSurfaced: false,
|
|
798
|
+
priorSkillCoverage: 0,
|
|
799
|
+
wallTimeMs: 0,
|
|
800
|
+
};
|
|
801
|
+
}
|
|
802
|
+
this.log(`[live] task ${item.index + 1}/${taskCount} env_error (arm=${arm} seed=${seed}): ` +
|
|
803
|
+
`${err.message.slice(0, 200)} — retrying once`);
|
|
804
|
+
try {
|
|
805
|
+
return await this.solveOne(atlas, delegate, item, arm, taskCount);
|
|
806
|
+
}
|
|
807
|
+
catch (err2) {
|
|
808
|
+
this.log(`[live] task ${item.index + 1}/${taskCount} env_error again (arm=${arm} seed=${seed}): ` +
|
|
809
|
+
`${err2.message.slice(0, 200)} — recording as env_error`);
|
|
810
|
+
return {
|
|
811
|
+
index: item.index,
|
|
812
|
+
taskId: item.task.id,
|
|
813
|
+
skillTag: item.skillTag,
|
|
814
|
+
success: false,
|
|
815
|
+
status: 'env_error',
|
|
816
|
+
stepCount: 0,
|
|
817
|
+
knowledgeSurfaced: false,
|
|
818
|
+
priorSkillCoverage: 0,
|
|
819
|
+
wallTimeMs: 0,
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
throw err;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
async solveOne(atlas, delegate, item, arm, taskCount) {
|
|
827
|
+
delegate.setCurrentTask?.(item.task);
|
|
828
|
+
const costBefore = delegate.getTotalCostUsd?.() ?? 0;
|
|
829
|
+
const t0 = Date.now();
|
|
830
|
+
// --- Diagnostics: attach collector to AgentManager before the solve ---
|
|
831
|
+
const agentManager = atlas.getAgentManager();
|
|
832
|
+
let spawnDiag;
|
|
833
|
+
if (agentManager && this.config.traceDir) {
|
|
834
|
+
agentManager.setDiagnosticsCollector((d) => {
|
|
835
|
+
spawnDiag = d;
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
const result = await atlas.solve(item.task);
|
|
839
|
+
// Detach collector immediately after solve.
|
|
840
|
+
if (agentManager && this.config.traceDir) {
|
|
841
|
+
agentManager.setDiagnosticsCollector(undefined);
|
|
842
|
+
}
|
|
843
|
+
const wallTimeMs = Date.now() - t0;
|
|
844
|
+
const costAfter = delegate.getTotalCostUsd?.() ?? 0;
|
|
845
|
+
const costUsd = costAfter - costBefore;
|
|
846
|
+
const success = result.trajectory.outcome.success;
|
|
847
|
+
this.log(`[live] task ${item.index + 1}/${taskCount} ` +
|
|
848
|
+
`${success ? 'PASS' : 'fail'} ` +
|
|
849
|
+
`(${(wallTimeMs / 1000).toFixed(1)}s` +
|
|
850
|
+
`${costUsd > 0 ? `, $${costUsd.toFixed(4)}` : ''})`);
|
|
851
|
+
const ctx = result.routing?.memoryContext;
|
|
852
|
+
const knowledgeSurfaced = !!ctx && ctx.experiences.length + ctx.playbooks.length > 0;
|
|
853
|
+
const solution = result.trajectory.outcome.solution;
|
|
854
|
+
const partialScore = typeof solution?.partialScore === 'number' ? solution.partialScore : undefined;
|
|
855
|
+
// Larger budget so a multi-step agent transcript (incl. failures) is captured
|
|
856
|
+
// in the trace for behaviour/adoption debugging, not just the first ~2 steps.
|
|
857
|
+
const outputPreview = previewOutcome(result.trajectory.outcome, 12000);
|
|
858
|
+
// --- Diagnostics: influence sampling (learning arm only) ---
|
|
859
|
+
let influenceDiag;
|
|
860
|
+
const sampleEvery = this.config.influenceSampleEvery ?? 0;
|
|
861
|
+
if (arm === 'learning' && sampleEvery > 0 && agentManager && item.index % sampleEvery === 0) {
|
|
862
|
+
try {
|
|
863
|
+
const cmp = await agentManager.compareWithKnowledge({
|
|
864
|
+
agentType: 'delegate',
|
|
865
|
+
task: item.task,
|
|
866
|
+
});
|
|
867
|
+
influenceDiag = {
|
|
868
|
+
sampled: true,
|
|
869
|
+
changedOutput: cmp.withKnowledge.session.result !== cmp.baseline.session.result,
|
|
870
|
+
};
|
|
871
|
+
}
|
|
872
|
+
catch {
|
|
873
|
+
influenceDiag = { sampled: true, changedOutput: false };
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
// --- Diagnostics: emit trace entry if traceDir is configured ---
|
|
877
|
+
if (this.config.traceDir && spawnDiag !== undefined) {
|
|
878
|
+
const threshold = spawnDiag.knowledge.retrievalDiagnostics?.playbookMinScore ?? 0;
|
|
879
|
+
const diagnosticStrip = new Set(this.config.diagnosticStripChannels ?? []);
|
|
880
|
+
let deliveredKnowledgeBlob = spawnDiag.formattedKnowledge;
|
|
881
|
+
for (const ch of diagnosticStrip) {
|
|
882
|
+
deliveredKnowledgeBlob = stripMarkdownSection(deliveredKnowledgeBlob, CHANNEL_SECTION_HEADERS[ch]);
|
|
883
|
+
}
|
|
884
|
+
const deliveredPlaybooks = diagnosticStrip.has('playbooks')
|
|
885
|
+
? []
|
|
886
|
+
: spawnDiag.knowledge.playbooks.slice(0, spawnDiag.playbookCount).map((p) => ({
|
|
887
|
+
id: p.playbook.id,
|
|
888
|
+
name: p.playbook.name,
|
|
889
|
+
score: p.score,
|
|
890
|
+
retrievalMethod: p.retrievalMethod,
|
|
891
|
+
extractionMethod: p.playbook.provenance?.extractionMethod,
|
|
892
|
+
sourceFile: p.playbook.provenance?.sourceFile,
|
|
893
|
+
skillLevel: p.playbook.skillLevel ?? inferPlaybookSkillLevel(p.playbook),
|
|
894
|
+
applicabilityDecision: p.applicabilityDecision?.decision,
|
|
895
|
+
applicabilityReason: p.applicabilityDecision?.reason,
|
|
896
|
+
}));
|
|
897
|
+
const candidates = [
|
|
898
|
+
...spawnDiag.knowledge.experiences.map((e) => ({
|
|
899
|
+
id: e.experience.id,
|
|
900
|
+
type: 'experience',
|
|
901
|
+
score: e.score,
|
|
902
|
+
})),
|
|
903
|
+
...spawnDiag.knowledge.playbooks.map((p) => ({
|
|
904
|
+
id: p.playbook.id,
|
|
905
|
+
type: 'playbook',
|
|
906
|
+
score: p.score,
|
|
907
|
+
retrievalMethod: p.retrievalMethod,
|
|
908
|
+
applicabilityDecision: p.applicabilityDecision?.decision,
|
|
909
|
+
applicabilityReason: p.applicabilityDecision?.reason,
|
|
910
|
+
})),
|
|
911
|
+
];
|
|
912
|
+
const hitAtThreshold = candidates.some((c) => c.score >= threshold);
|
|
913
|
+
// Phase-0: map retrieval-time candidate decisions into full audit rows,
|
|
914
|
+
// stamping task identity and whether the candidate was ultimately
|
|
915
|
+
// injected. The injected set is the actually-served playbooks (strip-
|
|
916
|
+
// independent), so a candidate dropped by the gate shows injected=false
|
|
917
|
+
// with its rejection reason intact.
|
|
918
|
+
const injectedIds = new Set(spawnDiag.knowledge.playbooks.slice(0, spawnDiag.playbookCount).map((p) => p.playbook.id));
|
|
919
|
+
const candidateDecisions = spawnDiag.knowledge.retrievalDiagnostics?.candidateDecisions?.map((c) => {
|
|
920
|
+
const injected = injectedIds.has(c.playbookId);
|
|
921
|
+
return {
|
|
922
|
+
taskId: item.task.id,
|
|
923
|
+
family: item.family,
|
|
924
|
+
query: item.task.description,
|
|
925
|
+
candidateRank: c.candidateRank,
|
|
926
|
+
playbookId: c.playbookId,
|
|
927
|
+
playbookName: c.playbookName,
|
|
928
|
+
skillLevel: c.skillLevel,
|
|
929
|
+
retrievalMethod: c.retrievalMethod,
|
|
930
|
+
score: c.score,
|
|
931
|
+
domainFallbackUsed: c.domainFallbackUsed,
|
|
932
|
+
scoreFloorPassed: c.scoreFloorPassed,
|
|
933
|
+
rawDomains: c.rawDomains,
|
|
934
|
+
normalizedDomains: c.normalizedDomains,
|
|
935
|
+
taskDomains: c.taskDomains,
|
|
936
|
+
domainAliasOverlap: c.domainAliasOverlap,
|
|
937
|
+
cueHits: c.cueHits,
|
|
938
|
+
antiPatternHits: c.antiPatternHits,
|
|
939
|
+
decision: c.decision,
|
|
940
|
+
reason: c.reason,
|
|
941
|
+
gateEnforced: c.gateEnforced,
|
|
942
|
+
injected,
|
|
943
|
+
incorporationMode: injected
|
|
944
|
+
? c.decision === 'refine'
|
|
945
|
+
? 'refined-prose'
|
|
946
|
+
: 'prose'
|
|
947
|
+
: undefined,
|
|
948
|
+
};
|
|
949
|
+
});
|
|
950
|
+
const diag = {
|
|
951
|
+
taskIndex: item.index,
|
|
952
|
+
arm,
|
|
953
|
+
taskId: item.task.id,
|
|
954
|
+
family: item.family,
|
|
955
|
+
difficulty: item.difficulty,
|
|
956
|
+
skillTag: item.skillTag,
|
|
957
|
+
extraction: result.extractionYield ?? { itemsStored: 0, byType: {} },
|
|
958
|
+
retrieval: {
|
|
959
|
+
query: item.task.description,
|
|
960
|
+
candidates,
|
|
961
|
+
candidateDecisions,
|
|
962
|
+
hitAtThreshold,
|
|
963
|
+
threshold,
|
|
964
|
+
playbookRetriever: spawnDiag.knowledge.retrievalDiagnostics?.playbookRetriever,
|
|
965
|
+
playbookRawCount: spawnDiag.knowledge.retrievalDiagnostics?.playbookRawCount,
|
|
966
|
+
playbookExcludedByScoreFloor: spawnDiag.knowledge.retrievalDiagnostics?.playbookExcludedByScoreFloor,
|
|
967
|
+
playbookExcludedByApplicability: spawnDiag.knowledge.retrievalDiagnostics?.playbookExcludedByApplicability,
|
|
968
|
+
playbookDomainFallbackUsed: spawnDiag.knowledge.retrievalDiagnostics?.playbookDomainFallbackUsed,
|
|
969
|
+
playbookApplicabilityGateEnabled: spawnDiag.knowledge.retrievalDiagnostics?.playbookApplicabilityGateEnabled,
|
|
970
|
+
},
|
|
971
|
+
injection: {
|
|
972
|
+
blob: deliveredKnowledgeBlob,
|
|
973
|
+
playbookCount: diagnosticStrip.has('playbooks') ? 0 : spawnDiag.playbookCount,
|
|
974
|
+
experienceCount: diagnosticStrip.has('experiences') ? 0 : spawnDiag.experienceCount,
|
|
975
|
+
playbooks: deliveredPlaybooks,
|
|
976
|
+
},
|
|
977
|
+
influence: influenceDiag,
|
|
978
|
+
outcome: {
|
|
979
|
+
success,
|
|
980
|
+
status: success ? 'success' : 'failure',
|
|
981
|
+
stepCount: result.trajectory.steps.length,
|
|
982
|
+
wallTimeMs,
|
|
983
|
+
costUsd: costUsd > 0 ? costUsd : undefined,
|
|
984
|
+
outputPreview,
|
|
985
|
+
},
|
|
986
|
+
};
|
|
987
|
+
const trace = createTraceWriter(this.config.traceDir, item.task.id);
|
|
988
|
+
trace({ type: 'diagnostics', ...diag });
|
|
989
|
+
const collectMechanismTrace = emitMechanismTraceAsLiveTraceEntry(trace);
|
|
990
|
+
for (const event of diagnosticsToMechanismTraceEvents(diag, {
|
|
991
|
+
benchmark: this.config.benchmark.name,
|
|
992
|
+
source: 'LiveEvalRunner.runTask',
|
|
993
|
+
})) {
|
|
994
|
+
collectMechanismTrace(event);
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
return {
|
|
998
|
+
index: item.index,
|
|
999
|
+
taskId: item.task.id,
|
|
1000
|
+
skillTag: item.skillTag,
|
|
1001
|
+
success,
|
|
1002
|
+
status: success ? 'success' : 'failure',
|
|
1003
|
+
stepCount: result.trajectory.steps.length,
|
|
1004
|
+
knowledgeSurfaced,
|
|
1005
|
+
priorSkillCoverage: 0,
|
|
1006
|
+
wallTimeMs,
|
|
1007
|
+
costUsd: costUsd > 0 ? costUsd : undefined,
|
|
1008
|
+
partialScore,
|
|
1009
|
+
};
|
|
1010
|
+
}
|
|
1011
|
+
makeDelegate() {
|
|
1012
|
+
const opts = {
|
|
1013
|
+
model: this.config.model,
|
|
1014
|
+
timeoutMs: this.config.timeoutMs,
|
|
1015
|
+
provider: this.config.provider,
|
|
1016
|
+
awsRegion: this.config.awsRegion,
|
|
1017
|
+
refine: this.config.refine,
|
|
1018
|
+
// failFast: one attempt per model call — a hung call costs one timeout,
|
|
1019
|
+
// not the 2-3x compounding that turns doomed episodes into hours.
|
|
1020
|
+
...(this.config.failFast ? { cliRetries: 0 } : {}),
|
|
1021
|
+
};
|
|
1022
|
+
if (this.delegateFactory)
|
|
1023
|
+
return this.delegateFactory(this.config.benchmark, opts);
|
|
1024
|
+
return new ClaudeBenchmarkDelegate(this.config.benchmark, opts);
|
|
1025
|
+
}
|
|
1026
|
+
makeAtlas(baseDir, delegate, isLearningArm = false) {
|
|
1027
|
+
if (this.config.proceduralMemoryDir) {
|
|
1028
|
+
const targetDir = join(baseDir, 'playbooks');
|
|
1029
|
+
if (existsSync(this.config.proceduralMemoryDir)) {
|
|
1030
|
+
rmSync(targetDir, { recursive: true, force: true });
|
|
1031
|
+
cpSync(this.config.proceduralMemoryDir, targetDir, { recursive: true });
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
// Skill-learning benchmarks opt into playbook extraction via
|
|
1035
|
+
// `playbookMinTrajectories`; others leave it off (extraction disabled). When
|
|
1036
|
+
// on, the mid-run dream extracts playbooks at a cadence clamped to the
|
|
1037
|
+
// stream length so even short benchmarks consolidate before the run ends.
|
|
1038
|
+
//
|
|
1039
|
+
// When `distill` or `analysisBackends` is enabled on the learning arm and
|
|
1040
|
+
// the benchmark has no explicit playbookMinTrajectories, lower the threshold
|
|
1041
|
+
// to distillMinTrajectories (default 3) so the mid-run dream fires and the
|
|
1042
|
+
// non-heuristic extractor actually runs before the run ends.
|
|
1043
|
+
const pbMin = this.config.benchmark.playbookMinTrajectories ??
|
|
1044
|
+
(isLearningArm &&
|
|
1045
|
+
(this.config.distill ||
|
|
1046
|
+
this.config.mutationGating ||
|
|
1047
|
+
(this.config.analysisBackends?.length ?? 0) > 0)
|
|
1048
|
+
? (this.config.distillMinTrajectories ?? 3)
|
|
1049
|
+
: undefined);
|
|
1050
|
+
const learnsPlaybooks = typeof pbMin === 'number' && pbMin > 0;
|
|
1051
|
+
const minTrajectories = learnsPlaybooks ? pbMin : 1_000_000;
|
|
1052
|
+
const dreamCadence = learnsPlaybooks
|
|
1053
|
+
? Math.max(1, Math.min(pbMin, this.config.taskCount))
|
|
1054
|
+
: undefined;
|
|
1055
|
+
const config = {
|
|
1056
|
+
storage: { baseDir, dbName: 'eval.db' },
|
|
1057
|
+
// No bundled seed pack / skill-tree publishing / agent-refinement confound.
|
|
1058
|
+
// B1: seedPlaybookDirs seeds BOTH arms (recipe cold-start, lifts absolute
|
|
1059
|
+
// performance equally). learningOnlySeedDirs seeds ONLY the learning arm
|
|
1060
|
+
// (oracle smoke) — seeding the cold arm there would hand it the answer.
|
|
1061
|
+
curatedPlaybooks: {
|
|
1062
|
+
// bundledSeeds: the Phase-1 seed-lift arm — committed seed channels ON
|
|
1063
|
+
// in both arms (see LiveRunConfig.bundledSeeds for the A/B protocol).
|
|
1064
|
+
loadBundledSeedPack: this.config.bundledSeeds ?? false,
|
|
1065
|
+
additionalDirs: resolveSeedDirs(this.config.seedPlaybookDirs, this.config.learningOnlySeedDirs, isLearningArm),
|
|
1066
|
+
},
|
|
1067
|
+
skillTree: { enabled: false },
|
|
1068
|
+
// Disable within-task refinement entirely: the delegate's execute() returns
|
|
1069
|
+
// ground-truth pass/fail from the test oracle, so Atlas retrying on failure
|
|
1070
|
+
// leaks the oracle signal into the agent prompt — an unfair advantage that
|
|
1071
|
+
// inflates scores. maxIterations:0 prevents any retry spawns.
|
|
1072
|
+
refinement: { useAgentEvaluation: false, maxIterations: 0 },
|
|
1073
|
+
// Playbook extraction: ON for skill-learning benchmarks (small
|
|
1074
|
+
// minTrajectories), OFF otherwise (1_000_000). Either way the immediate
|
|
1075
|
+
// loop stores experiences + bumps playbook confidence on the hot path.
|
|
1076
|
+
learning: { minTrajectories },
|
|
1077
|
+
// Model the shipped system: decoupled dreaming. When extraction is on, the
|
|
1078
|
+
// mid-run maybeDream() (in runCarry) consolidates at `dreamCadence` so
|
|
1079
|
+
// later tasks reuse playbooks learned earlier in the stream. With
|
|
1080
|
+
// analysisBackends configured, playbooks use the workspace abstractor;
|
|
1081
|
+
// otherwise evals keep the legacy no-nested-agent heuristic path.
|
|
1082
|
+
dream: {
|
|
1083
|
+
...(dreamCadence !== undefined
|
|
1084
|
+
? { countThreshold: dreamCadence, maxStalenessMs: 1_000_000_000 }
|
|
1085
|
+
: {}),
|
|
1086
|
+
},
|
|
1087
|
+
// Success-biased exemplars: only inject trajectories that worked. Raw
|
|
1088
|
+
// failed trajectories injected as exemplars anchor the agent to bad
|
|
1089
|
+
// approaches (the ALFWorld poisoning we diagnosed). Failures are still
|
|
1090
|
+
// stored and learned from via reflexion / anti-patterns / causal edges.
|
|
1091
|
+
memory: {
|
|
1092
|
+
// Seed-free by default: warmth must come from learned memory or the
|
|
1093
|
+
// explicit seed levers (seedPlaybookDirs / metaPlaybookDirs / the
|
|
1094
|
+
// bundledSeeds seed-lift arm), never implicitly.
|
|
1095
|
+
seedMetaPlaybooks: this.config.bundledSeeds ?? false,
|
|
1096
|
+
seedMetaStrategies: this.config.bundledSeeds ?? false,
|
|
1097
|
+
injectFailedExperiences: false,
|
|
1098
|
+
playbookRetrieval: {
|
|
1099
|
+
// skill-tree-hybrid by default: the legacy lexical retriever's
|
|
1100
|
+
// textSimilarity between a long task description and short
|
|
1101
|
+
// trigger/situation strings tops out ~0.02-0.10, so the 0.1 floor
|
|
1102
|
+
// gated out virtually every mid-run learned playbook (observed in
|
|
1103
|
+
// the 2026-07-01 multi-seed traces; a replay of the same playbooks/
|
|
1104
|
+
// query scored 0.58/0.38 under hybrid vs 0.096 max under legacy).
|
|
1105
|
+
// The roadmap experiments already standardize on hybrid.
|
|
1106
|
+
mode: this.config.playbookRetriever ?? 'skill-tree-hybrid',
|
|
1107
|
+
minScore: this.config.minPlaybookScore ?? 0.1,
|
|
1108
|
+
fusion: 'rrf',
|
|
1109
|
+
incorporation: this.config.playbookIncorporation ?? 'full',
|
|
1110
|
+
},
|
|
1111
|
+
playbookApplicability: {
|
|
1112
|
+
enabled: this.config.playbookApplicabilityGate ?? false,
|
|
1113
|
+
},
|
|
1114
|
+
...(this.config.proceduralMemorySource || this.config.proceduralMemoryDir
|
|
1115
|
+
? {
|
|
1116
|
+
proceduralMemory: {
|
|
1117
|
+
source: this.config.proceduralMemorySource ?? 'filesystem',
|
|
1118
|
+
dir: 'playbooks',
|
|
1119
|
+
...(this.config.proceduralMemoryStrictStartup !== undefined
|
|
1120
|
+
? { strictStartup: this.config.proceduralMemoryStrictStartup }
|
|
1121
|
+
: {}),
|
|
1122
|
+
...(this.config.proceduralMemoryPruneSqliteOnly !== undefined
|
|
1123
|
+
? { pruneSqliteOnly: this.config.proceduralMemoryPruneSqliteOnly }
|
|
1124
|
+
: {}),
|
|
1125
|
+
},
|
|
1126
|
+
}
|
|
1127
|
+
: {}),
|
|
1128
|
+
},
|
|
1129
|
+
validation: {
|
|
1130
|
+
enabled: true,
|
|
1131
|
+
mutationMode: this.config.mutationMode ?? 'active',
|
|
1132
|
+
// Without this, applyValidationControls would silently strip the
|
|
1133
|
+
// seed channels the bundledSeeds arm is trying to measure.
|
|
1134
|
+
allowSeeds: this.config.bundledSeeds ?? false,
|
|
1135
|
+
},
|
|
1136
|
+
// ADDITIVE LEARNING A/B lever (config default ON). When explicitly set
|
|
1137
|
+
// (true OR false) we write the resolved boolean so `--no-additive`
|
|
1138
|
+
// genuinely disables it, overriding the config default; when undefined
|
|
1139
|
+
// (library caller) we leave features unset so the config default applies.
|
|
1140
|
+
// FeaturesConfigSchema fills every other feature with its default.
|
|
1141
|
+
...(this.config.additive !== undefined
|
|
1142
|
+
? { features: { additiveConsolidation: this.config.additive } }
|
|
1143
|
+
: {}),
|
|
1144
|
+
};
|
|
1145
|
+
if (this.config.configPatch) {
|
|
1146
|
+
// Deep merge so nested keys (e.g. memory.injectFailedExperiences) are
|
|
1147
|
+
// preserved when the patch only specifies siblings.
|
|
1148
|
+
const merged = deepMerge(config, this.config.configPatch);
|
|
1149
|
+
Object.keys(merged).forEach((k) => {
|
|
1150
|
+
config[k] = merged[k];
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1153
|
+
// No registered backends — the delegate handles all execution.
|
|
1154
|
+
const atlas = createAtlasWithAgents([], config);
|
|
1155
|
+
atlas.setDelegate(delegate);
|
|
1156
|
+
if (this.config.traceDir) {
|
|
1157
|
+
const learningTrace = createTraceWriter(this.config.traceDir, 'learning');
|
|
1158
|
+
atlas.setLearningDiagnosticsCollector((event) => {
|
|
1159
|
+
learningTrace({ type: 'learning-diagnostics', ...event });
|
|
1160
|
+
});
|
|
1161
|
+
// FIX 3: make the GEPA-style mutation loop observable — write one
|
|
1162
|
+
// `mutation` mechanism-trace event per considered proposal so a fired
|
|
1163
|
+
// (or suppressed) mutation is recoverable after the run.
|
|
1164
|
+
const mutationTrace = createTraceWriter(this.config.traceDir, 'mutations');
|
|
1165
|
+
const emitMutation = emitMechanismTraceAsLiveTraceEntry(mutationTrace);
|
|
1166
|
+
atlas.getLearning().setMechanismTraceCollector((event) => {
|
|
1167
|
+
if (event.family === 'mutation')
|
|
1168
|
+
emitMutation(event);
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
if (this.config.analysisBackends && this.config.analysisBackends.length > 0) {
|
|
1172
|
+
atlas.setAnalysisAgentManager(this.config.analysisBackends);
|
|
1173
|
+
}
|
|
1174
|
+
// Semantic retrieval: resolve provider type.
|
|
1175
|
+
// embedProvider takes precedence; legacy `embed: true` defaults to 'local'.
|
|
1176
|
+
// 'local' = LocalEmbeddingProvider (all-MiniLM-L6-v2, 384-dim, no API key).
|
|
1177
|
+
// 'hash' = HashEmbeddingProvider (zero-dep lexical baseline, 256-dim).
|
|
1178
|
+
// 'none' = no embedding; text-similarity scoring (default).
|
|
1179
|
+
//
|
|
1180
|
+
// Hot-path note: LocalEmbeddingProvider.embed() is async and blocks on the
|
|
1181
|
+
// first model load (~seconds). We set embedOnStore=false so experiences are
|
|
1182
|
+
// NOT embedded during InstantLoop.process (the <200ms hot path). Embeddings
|
|
1183
|
+
// are computed lazily on first retrieval in findSimilar / findMatching.
|
|
1184
|
+
// Playbooks are embedded at add()-time in the dream phase (off hot path).
|
|
1185
|
+
const providerType = this.config.embedProvider ?? (this.config.embed ? 'local' : 'none');
|
|
1186
|
+
if (providerType !== 'none') {
|
|
1187
|
+
const provider = createEmbeddingProvider(embeddingConfigFromEnv(providerType));
|
|
1188
|
+
if (provider) {
|
|
1189
|
+
// Pass embedOnStore=false for local to avoid blocking the InstantLoop
|
|
1190
|
+
// hot path; hash is sync so it's fine either way but we keep consistent.
|
|
1191
|
+
atlas.getMemory().setEmbeddingProvider(provider, { embedOnStore: false });
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
// Each solve must be a SINGLE benchmark agent call. If a separate analysis
|
|
1195
|
+
// manager exists, preserve it for dream-phase extraction and only disable
|
|
1196
|
+
// solve-time usage/meta analysis; otherwise clear all workspace analysis.
|
|
1197
|
+
if (this.config.analysisBackends && this.config.analysisBackends.length > 0) {
|
|
1198
|
+
atlas.disableAgenticHotPathAnalysis();
|
|
1199
|
+
}
|
|
1200
|
+
else {
|
|
1201
|
+
atlas.disableAgenticAnalysis();
|
|
1202
|
+
}
|
|
1203
|
+
return atlas;
|
|
1204
|
+
}
|
|
1205
|
+
async loadMetaPlaybooks(atlas, isLearningArm) {
|
|
1206
|
+
if (!isLearningArm || !this.config.metaPlaybookDirs?.length)
|
|
1207
|
+
return;
|
|
1208
|
+
const memory = atlas.getMemory();
|
|
1209
|
+
let loaded = 0;
|
|
1210
|
+
for (const inputPath of this.config.metaPlaybookDirs) {
|
|
1211
|
+
for (const file of findPlaybookJsonFiles(inputPath)) {
|
|
1212
|
+
const raw = JSON.parse(readFileSync(file, 'utf8'));
|
|
1213
|
+
await memory.metaPlaybooks.add(revivePlaybook(raw));
|
|
1214
|
+
loaded++;
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
if (loaded > 0) {
|
|
1218
|
+
this.log(`[live] seeded ${loaded} meta-playbook(s) into learning-analysis bank`);
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
export function findPlaybookJsonFiles(inputPath) {
|
|
1223
|
+
if (!existsSync(inputPath)) {
|
|
1224
|
+
throw new Error(`Meta-playbook path does not exist: ${inputPath}`);
|
|
1225
|
+
}
|
|
1226
|
+
const stat = statSync(inputPath);
|
|
1227
|
+
if (stat.isFile()) {
|
|
1228
|
+
return inputPath.endsWith('.json') ? [inputPath] : [];
|
|
1229
|
+
}
|
|
1230
|
+
if (!stat.isDirectory())
|
|
1231
|
+
return [];
|
|
1232
|
+
const files = [];
|
|
1233
|
+
for (const entry of readdirSync(inputPath).sort()) {
|
|
1234
|
+
const child = join(inputPath, entry);
|
|
1235
|
+
const childStat = statSync(child);
|
|
1236
|
+
if (childStat.isDirectory()) {
|
|
1237
|
+
files.push(...findPlaybookJsonFiles(child));
|
|
1238
|
+
}
|
|
1239
|
+
else if (childStat.isFile() && child.endsWith('.json')) {
|
|
1240
|
+
files.push(child);
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
return files;
|
|
1244
|
+
}
|
|
1245
|
+
export function revivePlaybook(raw) {
|
|
1246
|
+
if (!raw.name || !raw.applicability || !raw.guidance) {
|
|
1247
|
+
throw new Error('Meta-playbook JSON must include name, applicability, and guidance');
|
|
1248
|
+
}
|
|
1249
|
+
const provenance = raw.provenance
|
|
1250
|
+
? {
|
|
1251
|
+
...raw.provenance,
|
|
1252
|
+
recordedAt: new Date(raw.provenance.recordedAt),
|
|
1253
|
+
}
|
|
1254
|
+
: undefined;
|
|
1255
|
+
const evolution = raw.evolution
|
|
1256
|
+
? {
|
|
1257
|
+
...raw.evolution,
|
|
1258
|
+
lastUsed: raw.evolution.lastUsed ? new Date(raw.evolution.lastUsed) : undefined,
|
|
1259
|
+
failures: raw.evolution.failures.map((failure) => ({
|
|
1260
|
+
...failure,
|
|
1261
|
+
timestamp: new Date(failure.timestamp),
|
|
1262
|
+
})),
|
|
1263
|
+
refinements: raw.evolution.refinements.map((refinement) => ({
|
|
1264
|
+
...refinement,
|
|
1265
|
+
addedAt: new Date(refinement.addedAt),
|
|
1266
|
+
})),
|
|
1267
|
+
}
|
|
1268
|
+
: undefined;
|
|
1269
|
+
return createPlaybook({
|
|
1270
|
+
...raw,
|
|
1271
|
+
name: raw.name,
|
|
1272
|
+
applicability: raw.applicability,
|
|
1273
|
+
guidance: raw.guidance,
|
|
1274
|
+
provenance,
|
|
1275
|
+
evolution,
|
|
1276
|
+
createdAt: raw.createdAt ? new Date(raw.createdAt) : undefined,
|
|
1277
|
+
updatedAt: raw.updatedAt ? new Date(raw.updatedAt) : undefined,
|
|
1278
|
+
});
|
|
1279
|
+
}
|
|
1280
|
+
export function createLiveEvalRunner(config, delegateFactory) {
|
|
1281
|
+
return new LiveEvalRunner(config, delegateFactory);
|
|
1282
|
+
}
|
|
1283
|
+
/**
|
|
1284
|
+
* Section headers emitted by DefaultKnowledgeInjector.formatMarkdown for each
|
|
1285
|
+
* ablatable channel (see src/runtime/manager.ts). Kept in sync by the
|
|
1286
|
+
* channel-stripping unit test, which formats real knowledge and asserts the
|
|
1287
|
+
* stripped systemContext no longer contains them.
|
|
1288
|
+
*/
|
|
1289
|
+
const CHANNEL_SECTION_HEADERS = {
|
|
1290
|
+
experiences: '## Similar Past Experiences',
|
|
1291
|
+
playbooks: '## Candidate Playbooks',
|
|
1292
|
+
};
|
|
1293
|
+
/**
|
|
1294
|
+
* Remove a `## <header>` markdown section (header through the next `## ` or
|
|
1295
|
+
* end of string) from formatted knowledge text.
|
|
1296
|
+
*/
|
|
1297
|
+
function stripMarkdownSection(text, header) {
|
|
1298
|
+
const start = text.indexOf(header);
|
|
1299
|
+
if (start === -1)
|
|
1300
|
+
return text;
|
|
1301
|
+
const next = text.indexOf('\n## ', start + header.length);
|
|
1302
|
+
const removed = next === -1 ? text.slice(0, start) : text.slice(0, start) + text.slice(next + 1);
|
|
1303
|
+
return removed;
|
|
1304
|
+
}
|
|
1305
|
+
/**
|
|
1306
|
+
* Delegate wrapper that strips chosen knowledge channels before forwarding to
|
|
1307
|
+
* the inner delegate. Mirrors AblatingBackend for the live path.
|
|
1308
|
+
*
|
|
1309
|
+
* IMPORTANT: live delegates consume the pre-formatted `systemContext` STRING
|
|
1310
|
+
* (built by AgentManager.spawnViaDelegate before the delegate is called), not
|
|
1311
|
+
* the structured `injectedKnowledge` object — so both must be stripped.
|
|
1312
|
+
* Stripping only the object would be a silent no-op on the live path.
|
|
1313
|
+
*/
|
|
1314
|
+
export class ChannelStrippingDelegate {
|
|
1315
|
+
inner;
|
|
1316
|
+
channels;
|
|
1317
|
+
constructor(inner, channels) {
|
|
1318
|
+
this.inner = inner;
|
|
1319
|
+
this.channels = channels;
|
|
1320
|
+
}
|
|
1321
|
+
execute(prompt, options) {
|
|
1322
|
+
const knowledge = options.injectedKnowledge;
|
|
1323
|
+
if (this.channels.length === 0) {
|
|
1324
|
+
return this.inner.execute(prompt, options);
|
|
1325
|
+
}
|
|
1326
|
+
const strip = new Set(this.channels);
|
|
1327
|
+
const stripped = knowledge
|
|
1328
|
+
? {
|
|
1329
|
+
...knowledge,
|
|
1330
|
+
experiences: strip.has('experiences') ? [] : knowledge.experiences,
|
|
1331
|
+
playbooks: strip.has('playbooks') ? [] : knowledge.playbooks,
|
|
1332
|
+
}
|
|
1333
|
+
: knowledge;
|
|
1334
|
+
let systemContext = options.systemContext;
|
|
1335
|
+
if (systemContext) {
|
|
1336
|
+
for (const ch of this.channels) {
|
|
1337
|
+
systemContext = stripMarkdownSection(systemContext, CHANNEL_SECTION_HEADERS[ch]);
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
return this.inner.execute(prompt, {
|
|
1341
|
+
...options,
|
|
1342
|
+
injectedKnowledge: stripped,
|
|
1343
|
+
systemContext,
|
|
1344
|
+
});
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
/**
|
|
1348
|
+
* Live ablation runner: runs the learning arm multiple times, each time
|
|
1349
|
+
* disabling one component, to measure each component's contribution.
|
|
1350
|
+
* Results are single-arm ConditionResults that can be compared to a full run.
|
|
1351
|
+
*/
|
|
1352
|
+
export class LiveAblationRunner {
|
|
1353
|
+
baseConfig;
|
|
1354
|
+
arms;
|
|
1355
|
+
delegateFactory;
|
|
1356
|
+
constructor(baseConfig, arms, delegateFactory) {
|
|
1357
|
+
this.baseConfig = baseConfig;
|
|
1358
|
+
this.arms = arms;
|
|
1359
|
+
this.delegateFactory = delegateFactory;
|
|
1360
|
+
}
|
|
1361
|
+
async run() {
|
|
1362
|
+
const traceDirFor = (label) => {
|
|
1363
|
+
if (!this.baseConfig.traceDir)
|
|
1364
|
+
return undefined;
|
|
1365
|
+
const safeLabel = label.replace(/[^a-z0-9._-]+/gi, '-').toLowerCase();
|
|
1366
|
+
return join(this.baseConfig.traceDir, safeLabel);
|
|
1367
|
+
};
|
|
1368
|
+
const fullRunner = new LiveEvalRunner({ ...this.baseConfig, singleArm: true, traceDir: traceDirFor('full') }, this.delegateFactory);
|
|
1369
|
+
const full = await fullRunner.run();
|
|
1370
|
+
const ablations = [];
|
|
1371
|
+
for (const arm of this.arms) {
|
|
1372
|
+
// For channel-type ablations, wrap the delegate factory to strip channels.
|
|
1373
|
+
const wrappedFactory = arm.channels?.length
|
|
1374
|
+
? (benchmark, opts) => {
|
|
1375
|
+
const inner = this.delegateFactory
|
|
1376
|
+
? this.delegateFactory(benchmark, opts)
|
|
1377
|
+
: new ClaudeBenchmarkDelegate(benchmark, opts);
|
|
1378
|
+
const channels = arm.channels;
|
|
1379
|
+
// Return a proxy that strips channels but preserves all delegate hooks
|
|
1380
|
+
// (setCurrentTask, getTotalCostUsd, setMemory).
|
|
1381
|
+
const stripping = new ChannelStrippingDelegate(inner, channels);
|
|
1382
|
+
const bm = inner;
|
|
1383
|
+
return Object.assign(stripping, {
|
|
1384
|
+
setCurrentTask: bm.setCurrentTask?.bind(bm),
|
|
1385
|
+
getTotalCostUsd: bm.getTotalCostUsd?.bind(bm),
|
|
1386
|
+
setMemory: bm.setMemory?.bind(bm),
|
|
1387
|
+
});
|
|
1388
|
+
}
|
|
1389
|
+
: this.delegateFactory;
|
|
1390
|
+
const patchedConfig = {
|
|
1391
|
+
...this.baseConfig,
|
|
1392
|
+
singleArm: true,
|
|
1393
|
+
traceDir: traceDirFor(arm.label),
|
|
1394
|
+
diagnosticStripChannels: arm.channels,
|
|
1395
|
+
configPatch: arm.configPatch && Object.keys(arm.configPatch).length > 0
|
|
1396
|
+
? { ...this.baseConfig.configPatch, ...arm.configPatch }
|
|
1397
|
+
: this.baseConfig.configPatch,
|
|
1398
|
+
};
|
|
1399
|
+
const runner = new LiveEvalRunner(patchedConfig, wrappedFactory);
|
|
1400
|
+
const result = await runner.run();
|
|
1401
|
+
ablations.push({ label: arm.label, result });
|
|
1402
|
+
}
|
|
1403
|
+
return { full, ablations };
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
export function createLiveAblationRunner(baseConfig, arms, delegateFactory) {
|
|
1407
|
+
return new LiveAblationRunner(baseConfig, arms, delegateFactory);
|
|
1408
|
+
}
|
|
1409
|
+
//# sourceMappingURL=live-runner.js.map
|