cognitive-core 0.0.2 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.json +88 -0
- package/.claude/settings.local.json +11 -0
- package/.entire/settings.json +4 -0
- package/README.md +563 -107
- package/SKILL.md +193 -0
- package/dist/agents/index.d.ts +3 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +5 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/mock-provider.d.ts +23 -0
- package/dist/agents/mock-provider.d.ts.map +1 -0
- package/dist/agents/mock-provider.js +71 -0
- package/dist/agents/mock-provider.js.map +1 -0
- package/dist/agents/types.d.ts +98 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/agents/types.js +44 -0
- package/dist/agents/types.js.map +1 -0
- package/dist/atlas.d.ts +334 -0
- package/dist/atlas.d.ts.map +1 -0
- package/dist/atlas.js +702 -0
- package/dist/atlas.js.map +1 -0
- package/dist/bin/cognitive-core.d.ts +18 -0
- package/dist/bin/cognitive-core.d.ts.map +1 -0
- package/dist/bin/cognitive-core.js +419 -0
- package/dist/bin/cognitive-core.js.map +1 -0
- package/dist/embeddings/bm25.d.ts +104 -0
- package/dist/embeddings/bm25.d.ts.map +1 -0
- package/dist/embeddings/bm25.js +264 -0
- package/dist/embeddings/bm25.js.map +1 -0
- package/dist/embeddings/index.d.ts +12 -0
- package/dist/embeddings/index.d.ts.map +1 -0
- package/dist/embeddings/index.js +16 -0
- package/dist/embeddings/index.js.map +1 -0
- package/dist/embeddings/manager.d.ts +112 -0
- package/dist/embeddings/manager.d.ts.map +1 -0
- package/dist/embeddings/manager.js +215 -0
- package/dist/embeddings/manager.js.map +1 -0
- package/dist/embeddings/provider.d.ts +101 -0
- package/dist/embeddings/provider.d.ts.map +1 -0
- package/dist/embeddings/provider.js +235 -0
- package/dist/embeddings/provider.js.map +1 -0
- package/dist/embeddings/vector-store.d.ts +101 -0
- package/dist/embeddings/vector-store.d.ts.map +1 -0
- package/dist/embeddings/vector-store.js +256 -0
- package/dist/embeddings/vector-store.js.map +1 -0
- package/dist/factory.d.ts +193 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/factory.js +109 -0
- package/dist/factory.js.map +1 -0
- package/dist/index.d.ts +32 -453
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +115 -509
- package/dist/index.js.map +1 -0
- package/dist/learning/analyzer.d.ts +110 -0
- package/dist/learning/analyzer.d.ts.map +1 -0
- package/dist/learning/analyzer.js +213 -0
- package/dist/learning/analyzer.js.map +1 -0
- package/dist/learning/effectiveness.d.ts +158 -0
- package/dist/learning/effectiveness.d.ts.map +1 -0
- package/dist/learning/effectiveness.js +251 -0
- package/dist/learning/effectiveness.js.map +1 -0
- package/dist/learning/index.d.ts +12 -0
- package/dist/learning/index.d.ts.map +1 -0
- package/dist/learning/index.js +17 -0
- package/dist/learning/index.js.map +1 -0
- package/dist/learning/knowledge-extractor.d.ts +56 -0
- package/dist/learning/knowledge-extractor.d.ts.map +1 -0
- package/dist/learning/knowledge-extractor.js +336 -0
- package/dist/learning/knowledge-extractor.js.map +1 -0
- 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/meta-learner.d.ts +87 -0
- package/dist/learning/meta-learner.d.ts.map +1 -0
- package/dist/learning/meta-learner.js +398 -0
- package/dist/learning/meta-learner.js.map +1 -0
- package/dist/learning/pipeline.d.ts +89 -0
- package/dist/learning/pipeline.d.ts.map +1 -0
- package/dist/learning/pipeline.js +236 -0
- package/dist/learning/pipeline.js.map +1 -0
- package/dist/learning/playbook-extractor.d.ts +113 -0
- package/dist/learning/playbook-extractor.d.ts.map +1 -0
- package/dist/learning/playbook-extractor.js +523 -0
- package/dist/learning/playbook-extractor.js.map +1 -0
- package/dist/learning/team-ingester.d.ts +152 -0
- package/dist/learning/team-ingester.d.ts.map +1 -0
- package/dist/learning/team-ingester.js +333 -0
- package/dist/learning/team-ingester.js.map +1 -0
- package/dist/learning/team-meta-learner.d.ts +50 -0
- package/dist/learning/team-meta-learner.d.ts.map +1 -0
- package/dist/learning/team-meta-learner.js +417 -0
- package/dist/learning/team-meta-learner.js.map +1 -0
- package/dist/learning/team-pipeline.d.ts +76 -0
- package/dist/learning/team-pipeline.d.ts.map +1 -0
- package/dist/learning/team-pipeline.js +266 -0
- package/dist/learning/team-pipeline.js.map +1 -0
- package/dist/learning/trajectory-sources/dataclaw.d.ts +41 -0
- package/dist/learning/trajectory-sources/dataclaw.d.ts.map +1 -0
- package/dist/learning/trajectory-sources/dataclaw.js +330 -0
- package/dist/learning/trajectory-sources/dataclaw.js.map +1 -0
- package/dist/learning/trajectory-sources/entire.d.ts +28 -0
- package/dist/learning/trajectory-sources/entire.d.ts.map +1 -0
- package/dist/learning/trajectory-sources/entire.js +182 -0
- package/dist/learning/trajectory-sources/entire.js.map +1 -0
- package/dist/learning/trajectory-sources/file.d.ts +23 -0
- package/dist/learning/trajectory-sources/file.d.ts.map +1 -0
- package/dist/learning/trajectory-sources/file.js +101 -0
- package/dist/learning/trajectory-sources/file.js.map +1 -0
- package/dist/learning/trajectory-sources/huggingface.d.ts +36 -0
- package/dist/learning/trajectory-sources/huggingface.d.ts.map +1 -0
- package/dist/learning/trajectory-sources/huggingface.js +157 -0
- package/dist/learning/trajectory-sources/huggingface.js.map +1 -0
- package/dist/learning/trajectory-sources/in-memory.d.ts +21 -0
- package/dist/learning/trajectory-sources/in-memory.d.ts.map +1 -0
- package/dist/learning/trajectory-sources/in-memory.js +43 -0
- package/dist/learning/trajectory-sources/in-memory.js.map +1 -0
- package/dist/learning/trajectory-sources/index.d.ts +7 -0
- package/dist/learning/trajectory-sources/index.d.ts.map +1 -0
- package/dist/learning/trajectory-sources/index.js +7 -0
- package/dist/learning/trajectory-sources/index.js.map +1 -0
- package/dist/learning/trajectory-sources/pipeline.d.ts +24 -0
- package/dist/learning/trajectory-sources/pipeline.d.ts.map +1 -0
- package/dist/learning/trajectory-sources/pipeline.js +47 -0
- package/dist/learning/trajectory-sources/pipeline.js.map +1 -0
- package/dist/learning/usage-inference.d.ts +82 -0
- package/dist/learning/usage-inference.d.ts.map +1 -0
- package/dist/learning/usage-inference.js +261 -0
- package/dist/learning/usage-inference.js.map +1 -0
- package/dist/mcp/index.d.ts +6 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +6 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/playbook-server.d.ts +120 -0
- package/dist/mcp/playbook-server.d.ts.map +1 -0
- package/dist/mcp/playbook-server.js +427 -0
- package/dist/mcp/playbook-server.js.map +1 -0
- package/dist/memory/curated-loader.d.ts +62 -0
- package/dist/memory/curated-loader.d.ts.map +1 -0
- package/dist/memory/curated-loader.js +106 -0
- package/dist/memory/curated-loader.js.map +1 -0
- package/dist/memory/experience.d.ts +122 -0
- package/dist/memory/experience.d.ts.map +1 -0
- package/dist/memory/experience.js +392 -0
- package/dist/memory/experience.js.map +1 -0
- package/dist/memory/graph-layers/base.d.ts +29 -0
- package/dist/memory/graph-layers/base.d.ts.map +1 -0
- package/dist/memory/graph-layers/base.js +143 -0
- package/dist/memory/graph-layers/base.js.map +1 -0
- package/dist/memory/graph-layers/causal.d.ts +14 -0
- package/dist/memory/graph-layers/causal.d.ts.map +1 -0
- package/dist/memory/graph-layers/causal.js +14 -0
- package/dist/memory/graph-layers/causal.js.map +1 -0
- package/dist/memory/graph-layers/entity.d.ts +14 -0
- package/dist/memory/graph-layers/entity.d.ts.map +1 -0
- package/dist/memory/graph-layers/entity.js +14 -0
- package/dist/memory/graph-layers/entity.js.map +1 -0
- package/dist/memory/graph-layers/index.d.ts +6 -0
- package/dist/memory/graph-layers/index.d.ts.map +1 -0
- package/dist/memory/graph-layers/index.js +6 -0
- package/dist/memory/graph-layers/index.js.map +1 -0
- package/dist/memory/graph-layers/semantic.d.ts +14 -0
- package/dist/memory/graph-layers/semantic.d.ts.map +1 -0
- package/dist/memory/graph-layers/semantic.js +14 -0
- package/dist/memory/graph-layers/semantic.js.map +1 -0
- package/dist/memory/graph-layers/temporal.d.ts +14 -0
- package/dist/memory/graph-layers/temporal.d.ts.map +1 -0
- package/dist/memory/graph-layers/temporal.js +14 -0
- package/dist/memory/graph-layers/temporal.js.map +1 -0
- package/dist/memory/index.d.ts +14 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +19 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/knowledge-bank.d.ts +220 -0
- package/dist/memory/knowledge-bank.d.ts.map +1 -0
- package/dist/memory/knowledge-bank.js +1003 -0
- package/dist/memory/knowledge-bank.js.map +1 -0
- package/dist/memory/knowledge-defrag.d.ts +49 -0
- package/dist/memory/knowledge-defrag.d.ts.map +1 -0
- package/dist/memory/knowledge-defrag.js +257 -0
- package/dist/memory/knowledge-defrag.js.map +1 -0
- package/dist/memory/knowledge-graph.d.ts +41 -0
- package/dist/memory/knowledge-graph.d.ts.map +1 -0
- package/dist/memory/knowledge-graph.js +273 -0
- package/dist/memory/knowledge-graph.js.map +1 -0
- package/dist/memory/meta.d.ts +90 -0
- package/dist/memory/meta.d.ts.map +1 -0
- package/dist/memory/meta.js +362 -0
- package/dist/memory/meta.js.map +1 -0
- package/dist/memory/playbook.d.ts +133 -0
- package/dist/memory/playbook.d.ts.map +1 -0
- package/dist/memory/playbook.js +357 -0
- package/dist/memory/playbook.js.map +1 -0
- package/dist/memory/search-provider.d.ts +31 -0
- package/dist/memory/search-provider.d.ts.map +1 -0
- package/dist/memory/search-provider.js +2 -0
- package/dist/memory/search-provider.js.map +1 -0
- package/dist/memory/search-providers/index.d.ts +3 -0
- package/dist/memory/search-providers/index.d.ts.map +1 -0
- package/dist/memory/search-providers/index.js +3 -0
- package/dist/memory/search-providers/index.js.map +1 -0
- package/dist/memory/search-providers/minimem.d.ts +43 -0
- package/dist/memory/search-providers/minimem.d.ts.map +1 -0
- package/dist/memory/search-providers/minimem.js +56 -0
- package/dist/memory/search-providers/minimem.js.map +1 -0
- package/dist/memory/search-providers/text-similarity.d.ts +15 -0
- package/dist/memory/search-providers/text-similarity.d.ts.map +1 -0
- package/dist/memory/search-providers/text-similarity.js +21 -0
- package/dist/memory/search-providers/text-similarity.js.map +1 -0
- package/dist/memory/skill-exporter.d.ts +75 -0
- package/dist/memory/skill-exporter.d.ts.map +1 -0
- package/dist/memory/skill-exporter.js +248 -0
- package/dist/memory/skill-exporter.js.map +1 -0
- package/dist/memory/system.d.ts +179 -0
- package/dist/memory/system.d.ts.map +1 -0
- package/dist/memory/system.js +421 -0
- package/dist/memory/system.js.map +1 -0
- package/dist/memory/team-experience.d.ts +298 -0
- package/dist/memory/team-experience.d.ts.map +1 -0
- package/dist/memory/team-experience.js +355 -0
- package/dist/memory/team-experience.js.map +1 -0
- package/dist/runtime/backends/acp-protocol.d.ts +49 -0
- package/dist/runtime/backends/acp-protocol.d.ts.map +1 -0
- package/dist/runtime/backends/acp-protocol.js +166 -0
- package/dist/runtime/backends/acp-protocol.js.map +1 -0
- package/dist/runtime/backends/acp.d.ts +67 -0
- package/dist/runtime/backends/acp.d.ts.map +1 -0
- package/dist/runtime/backends/acp.js +166 -0
- package/dist/runtime/backends/acp.js.map +1 -0
- package/dist/runtime/backends/index.d.ts +7 -0
- package/dist/runtime/backends/index.d.ts.map +1 -0
- package/dist/runtime/backends/index.js +8 -0
- package/dist/runtime/backends/index.js.map +1 -0
- package/dist/runtime/backends/macro-agent.d.ts +104 -0
- package/dist/runtime/backends/macro-agent.d.ts.map +1 -0
- package/dist/runtime/backends/macro-agent.js +107 -0
- package/dist/runtime/backends/macro-agent.js.map +1 -0
- package/dist/runtime/backends/mock.d.ts +67 -0
- package/dist/runtime/backends/mock.d.ts.map +1 -0
- package/dist/runtime/backends/mock.js +153 -0
- package/dist/runtime/backends/mock.js.map +1 -0
- package/dist/runtime/backends/subprocess.d.ts +56 -0
- package/dist/runtime/backends/subprocess.d.ts.map +1 -0
- package/dist/runtime/backends/subprocess.js +260 -0
- package/dist/runtime/backends/subprocess.js.map +1 -0
- package/dist/runtime/compute-provider.d.ts +87 -0
- package/dist/runtime/compute-provider.d.ts.map +1 -0
- package/dist/runtime/compute-provider.js +87 -0
- package/dist/runtime/compute-provider.js.map +1 -0
- package/dist/runtime/flows/learning.d.ts +73 -0
- package/dist/runtime/flows/learning.d.ts.map +1 -0
- package/dist/runtime/flows/learning.js +116 -0
- package/dist/runtime/flows/learning.js.map +1 -0
- package/dist/runtime/flows/validation.d.ts +122 -0
- package/dist/runtime/flows/validation.d.ts.map +1 -0
- package/dist/runtime/flows/validation.js +223 -0
- package/dist/runtime/flows/validation.js.map +1 -0
- package/dist/runtime/index.d.ts +7 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +10 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/manager.d.ts +149 -0
- package/dist/runtime/manager.d.ts.map +1 -0
- package/dist/runtime/manager.js +535 -0
- package/dist/runtime/manager.js.map +1 -0
- package/dist/runtime/types.d.ts +176 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +2 -0
- package/dist/runtime/types.js.map +1 -0
- package/dist/search/evaluator.d.ts +109 -0
- package/dist/search/evaluator.d.ts.map +1 -0
- package/dist/search/evaluator.js +372 -0
- package/dist/search/evaluator.js.map +1 -0
- package/dist/search/index.d.ts +8 -0
- package/dist/search/index.d.ts.map +1 -0
- package/dist/search/index.js +13 -0
- package/dist/search/index.js.map +1 -0
- package/dist/search/refinement-loop.d.ts +90 -0
- package/dist/search/refinement-loop.d.ts.map +1 -0
- package/dist/search/refinement-loop.js +316 -0
- package/dist/search/refinement-loop.js.map +1 -0
- package/dist/search/refinement-types.d.ts +154 -0
- package/dist/search/refinement-types.d.ts.map +1 -0
- package/dist/search/refinement-types.js +99 -0
- package/dist/search/refinement-types.js.map +1 -0
- package/dist/search/router.d.ts +61 -0
- package/dist/search/router.d.ts.map +1 -0
- package/dist/search/router.js +197 -0
- package/dist/search/router.js.map +1 -0
- package/dist/search/solver.d.ts +75 -0
- package/dist/search/solver.d.ts.map +1 -0
- package/dist/search/solver.js +216 -0
- package/dist/search/solver.js.map +1 -0
- package/dist/search/team-router.d.ts +91 -0
- package/dist/search/team-router.d.ts.map +1 -0
- package/dist/search/team-router.js +315 -0
- package/dist/search/team-router.js.map +1 -0
- package/dist/search/verification-runner.d.ts +125 -0
- package/dist/search/verification-runner.d.ts.map +1 -0
- package/dist/search/verification-runner.js +440 -0
- package/dist/search/verification-runner.js.map +1 -0
- package/dist/session-bank/git-reader.d.ts +39 -0
- package/dist/session-bank/git-reader.d.ts.map +1 -0
- package/dist/session-bank/git-reader.js +165 -0
- package/dist/session-bank/git-reader.js.map +1 -0
- package/dist/session-bank/index.d.ts +5 -0
- package/dist/session-bank/index.d.ts.map +1 -0
- package/dist/session-bank/index.js +4 -0
- package/dist/session-bank/index.js.map +1 -0
- package/dist/session-bank/parser.d.ts +39 -0
- package/dist/session-bank/parser.d.ts.map +1 -0
- package/dist/session-bank/parser.js +231 -0
- package/dist/session-bank/parser.js.map +1 -0
- package/dist/session-bank/session-bank.d.ts +35 -0
- package/dist/session-bank/session-bank.d.ts.map +1 -0
- package/dist/session-bank/session-bank.js +326 -0
- package/dist/session-bank/session-bank.js.map +1 -0
- package/dist/session-bank/types.d.ts +129 -0
- package/dist/session-bank/types.d.ts.map +1 -0
- package/dist/session-bank/types.js +7 -0
- package/dist/session-bank/types.js.map +1 -0
- package/dist/surfacing/index.d.ts +6 -0
- package/dist/surfacing/index.d.ts.map +1 -0
- package/dist/surfacing/index.js +5 -0
- package/dist/surfacing/index.js.map +1 -0
- package/dist/surfacing/publisher.d.ts +22 -0
- package/dist/surfacing/publisher.d.ts.map +1 -0
- package/dist/surfacing/publisher.js +9 -0
- package/dist/surfacing/publisher.js.map +1 -0
- package/dist/surfacing/skill-library.d.ts +170 -0
- package/dist/surfacing/skill-library.d.ts.map +1 -0
- package/dist/surfacing/skill-library.js +455 -0
- package/dist/surfacing/skill-library.js.map +1 -0
- package/dist/surfacing/skill-publisher.d.ts +43 -0
- package/dist/surfacing/skill-publisher.d.ts.map +1 -0
- package/dist/surfacing/skill-publisher.js +197 -0
- package/dist/surfacing/skill-publisher.js.map +1 -0
- package/dist/surfacing/sqlite-storage-adapter.d.ts +42 -0
- package/dist/surfacing/sqlite-storage-adapter.d.ts.map +1 -0
- package/dist/surfacing/sqlite-storage-adapter.js +207 -0
- package/dist/surfacing/sqlite-storage-adapter.js.map +1 -0
- package/dist/surfacing/team-skill-library.d.ts +180 -0
- package/dist/surfacing/team-skill-library.d.ts.map +1 -0
- package/dist/surfacing/team-skill-library.js +384 -0
- package/dist/surfacing/team-skill-library.js.map +1 -0
- package/dist/types/config.d.ts +2287 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +490 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/dataclaw.d.ts +286 -0
- package/dist/types/dataclaw.d.ts.map +1 -0
- package/dist/types/dataclaw.js +84 -0
- package/dist/types/dataclaw.js.map +1 -0
- package/dist/types/index.d.ts +16 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +26 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/knowledge-graph.d.ts +148 -0
- package/dist/types/knowledge-graph.d.ts.map +1 -0
- package/dist/types/knowledge-graph.js +40 -0
- package/dist/types/knowledge-graph.js.map +1 -0
- package/dist/types/knowledge.d.ts +280 -0
- package/dist/types/knowledge.d.ts.map +1 -0
- package/dist/types/knowledge.js +191 -0
- package/dist/types/knowledge.js.map +1 -0
- package/dist/types/memory.d.ts +339 -0
- package/dist/types/memory.d.ts.map +1 -0
- package/dist/types/memory.js +207 -0
- package/dist/types/memory.js.map +1 -0
- package/dist/types/meta.d.ts +146 -0
- package/dist/types/meta.d.ts.map +1 -0
- package/dist/types/meta.js +51 -0
- package/dist/types/meta.js.map +1 -0
- package/dist/types/outcome.d.ts +42 -0
- package/dist/types/outcome.d.ts.map +1 -0
- package/dist/types/outcome.js +50 -0
- package/dist/types/outcome.js.map +1 -0
- package/dist/types/playbook.d.ts +119 -0
- package/dist/types/playbook.d.ts.map +1 -0
- package/dist/types/playbook.js +71 -0
- package/dist/types/playbook.js.map +1 -0
- package/dist/types/step.d.ts +44 -0
- package/dist/types/step.d.ts.map +1 -0
- package/dist/types/step.js +32 -0
- package/dist/types/step.js.map +1 -0
- package/dist/types/task.d.ts +91 -0
- package/dist/types/task.d.ts.map +1 -0
- package/dist/types/task.js +39 -0
- package/dist/types/task.js.map +1 -0
- package/dist/types/team-meta.d.ts +160 -0
- package/dist/types/team-meta.d.ts.map +1 -0
- package/dist/types/team-meta.js +42 -0
- package/dist/types/team-meta.js.map +1 -0
- package/dist/types/team-playbook.d.ts +276 -0
- package/dist/types/team-playbook.d.ts.map +1 -0
- package/dist/types/team-playbook.js +85 -0
- package/dist/types/team-playbook.js.map +1 -0
- package/dist/types/team-trajectory.d.ts +305 -0
- package/dist/types/team-trajectory.d.ts.map +1 -0
- package/dist/types/team-trajectory.js +304 -0
- package/dist/types/team-trajectory.js.map +1 -0
- package/dist/types/trajectory-source.d.ts +39 -0
- package/dist/types/trajectory-source.d.ts.map +1 -0
- package/dist/types/trajectory-source.js +2 -0
- package/dist/types/trajectory-source.js.map +1 -0
- package/dist/types/trajectory.d.ts +221 -0
- package/dist/types/trajectory.d.ts.map +1 -0
- package/dist/types/trajectory.js +60 -0
- package/dist/types/trajectory.js.map +1 -0
- package/dist/utils/frontmatter.d.ts +34 -0
- package/dist/utils/frontmatter.d.ts.map +1 -0
- package/dist/utils/frontmatter.js +93 -0
- package/dist/utils/frontmatter.js.map +1 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +5 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/similarity.d.ts +31 -0
- package/dist/utils/similarity.d.ts.map +1 -0
- package/dist/utils/similarity.js +107 -0
- package/dist/utils/similarity.js.map +1 -0
- package/dist/utils/storage.d.ts +106 -0
- package/dist/utils/storage.d.ts.map +1 -0
- package/dist/utils/storage.js +203 -0
- package/dist/utils/storage.js.map +1 -0
- package/dist/utils/validation.d.ts +129 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +171 -0
- package/dist/utils/validation.js.map +1 -0
- package/dist/workspace/index.d.ts +6 -0
- package/dist/workspace/index.d.ts.map +1 -0
- package/dist/workspace/index.js +11 -0
- package/dist/workspace/index.js.map +1 -0
- package/dist/workspace/runner.d.ts +50 -0
- package/dist/workspace/runner.d.ts.map +1 -0
- package/dist/workspace/runner.js +219 -0
- package/dist/workspace/runner.js.map +1 -0
- package/dist/workspace/skill-converter.d.ts +18 -0
- package/dist/workspace/skill-converter.d.ts.map +1 -0
- package/dist/workspace/skill-converter.js +257 -0
- package/dist/workspace/skill-converter.js.map +1 -0
- package/dist/workspace/templates/index.d.ts +11 -0
- package/dist/workspace/templates/index.d.ts.map +1 -0
- package/dist/workspace/templates/index.js +21 -0
- package/dist/workspace/templates/index.js.map +1 -0
- package/dist/workspace/templates/knowledge-defrag.d.ts +25 -0
- package/dist/workspace/templates/knowledge-defrag.d.ts.map +1 -0
- package/dist/workspace/templates/knowledge-defrag.js +154 -0
- package/dist/workspace/templates/knowledge-defrag.js.map +1 -0
- package/dist/workspace/templates/knowledge-extraction.d.ts +25 -0
- package/dist/workspace/templates/knowledge-extraction.d.ts.map +1 -0
- package/dist/workspace/templates/knowledge-extraction.js +246 -0
- package/dist/workspace/templates/knowledge-extraction.js.map +1 -0
- package/dist/workspace/templates/meta-reflection.d.ts +47 -0
- package/dist/workspace/templates/meta-reflection.d.ts.map +1 -0
- package/dist/workspace/templates/meta-reflection.js +135 -0
- package/dist/workspace/templates/meta-reflection.js.map +1 -0
- package/dist/workspace/templates/playbook-extraction.d.ts +20 -0
- package/dist/workspace/templates/playbook-extraction.d.ts.map +1 -0
- package/dist/workspace/templates/playbook-extraction.js +189 -0
- package/dist/workspace/templates/playbook-extraction.js.map +1 -0
- package/dist/workspace/templates/refinement-analysis.d.ts +31 -0
- package/dist/workspace/templates/refinement-analysis.d.ts.map +1 -0
- package/dist/workspace/templates/refinement-analysis.js +107 -0
- package/dist/workspace/templates/refinement-analysis.js.map +1 -0
- package/dist/workspace/templates/solution-evaluation.d.ts +21 -0
- package/dist/workspace/templates/solution-evaluation.d.ts.map +1 -0
- package/dist/workspace/templates/solution-evaluation.js +131 -0
- package/dist/workspace/templates/solution-evaluation.js.map +1 -0
- package/dist/workspace/templates/team-playbook-extraction.d.ts +44 -0
- package/dist/workspace/templates/team-playbook-extraction.d.ts.map +1 -0
- package/dist/workspace/templates/team-playbook-extraction.js +497 -0
- package/dist/workspace/templates/team-playbook-extraction.js.map +1 -0
- package/dist/workspace/templates/team-trajectory-analysis.d.ts +19 -0
- package/dist/workspace/templates/team-trajectory-analysis.d.ts.map +1 -0
- package/dist/workspace/templates/team-trajectory-analysis.js +442 -0
- package/dist/workspace/templates/team-trajectory-analysis.js.map +1 -0
- package/dist/workspace/templates/trajectory-analysis.d.ts +19 -0
- package/dist/workspace/templates/trajectory-analysis.d.ts.map +1 -0
- package/dist/workspace/templates/trajectory-analysis.js +170 -0
- package/dist/workspace/templates/trajectory-analysis.js.map +1 -0
- package/dist/workspace/templates/usage-inference.d.ts +19 -0
- package/dist/workspace/templates/usage-inference.d.ts.map +1 -0
- package/dist/workspace/templates/usage-inference.js +125 -0
- package/dist/workspace/templates/usage-inference.js.map +1 -0
- package/dist/workspace/types.d.ts +145 -0
- package/dist/workspace/types.d.ts.map +1 -0
- package/dist/workspace/types.js +17 -0
- package/dist/workspace/types.js.map +1 -0
- package/docs/DESIGN-agentic-workspace.md +2057 -0
- package/docs/DESIGN-semantic-memory-knowledge-bank.md +1789 -0
- package/docs/DESIGN-session-bank.md +1134 -0
- package/docs/DESIGN-team-extraction-pipeline.md +1369 -0
- package/docs/DESIGN-workspace-migration.md +1079 -0
- package/docs/PLAN-agentic-workspace-implementation.md +717 -0
- package/docs/PLAN-graph-migration.md +299 -0
- package/docs/PLAN-session-bank-implementation.md +474 -0
- package/docs/PROPOSAL-team-aware-learning.md +1080 -0
- package/docs/RESEARCH-semantic-memory-knowledge-structures.md +517 -0
- package/docs/RESEARCH-team-trajectory-learning.md +553 -0
- package/gaps.md +204 -0
- package/package.json +67 -33
- package/references/agent-workspace/CLAUDE.md +74 -0
- package/references/agent-workspace/README.md +587 -0
- package/references/agent-workspace/media/banner.png +0 -0
- package/references/agent-workspace/package-lock.json +2061 -0
- package/references/agent-workspace/package.json +54 -0
- package/references/agent-workspace/src/handle.ts +122 -0
- package/references/agent-workspace/src/index.ts +32 -0
- package/references/agent-workspace/src/manager.ts +102 -0
- package/references/agent-workspace/src/readers/json.ts +71 -0
- package/references/agent-workspace/src/readers/markdown.ts +37 -0
- package/references/agent-workspace/src/readers/raw.ts +27 -0
- package/references/agent-workspace/src/types.ts +68 -0
- package/references/agent-workspace/src/validation.ts +93 -0
- package/references/agent-workspace/src/writers/json.ts +17 -0
- package/references/agent-workspace/src/writers/markdown.ts +27 -0
- package/references/agent-workspace/src/writers/raw.ts +22 -0
- package/references/agent-workspace/tests/errors.test.ts +652 -0
- package/references/agent-workspace/tests/handle.test.ts +144 -0
- package/references/agent-workspace/tests/manager.test.ts +124 -0
- package/references/agent-workspace/tests/readers.test.ts +205 -0
- package/references/agent-workspace/tests/validation.test.ts +196 -0
- package/references/agent-workspace/tests/writers.test.ts +108 -0
- package/references/agent-workspace/tsconfig.json +20 -0
- package/references/agent-workspace/tsup.config.ts +9 -0
- package/references/minimem/.claude/settings.json +7 -0
- package/references/minimem/.sudocode/issues.jsonl +18 -0
- package/references/minimem/.sudocode/specs.jsonl +1 -0
- package/references/minimem/CLAUDE.md +310 -0
- package/references/minimem/README.md +556 -0
- package/references/minimem/claude-plugin/.claude-plugin/plugin.json +10 -0
- package/references/minimem/claude-plugin/.mcp.json +7 -0
- package/references/minimem/claude-plugin/README.md +158 -0
- package/references/minimem/claude-plugin/commands/recall.md +47 -0
- package/references/minimem/claude-plugin/commands/remember.md +41 -0
- package/references/minimem/claude-plugin/hooks/__tests__/hooks.test.ts +272 -0
- package/references/minimem/claude-plugin/hooks/hooks.json +27 -0
- package/references/minimem/claude-plugin/hooks/session-end.sh +86 -0
- package/references/minimem/claude-plugin/hooks/session-start.sh +85 -0
- package/references/minimem/claude-plugin/skills/memory/SKILL.md +108 -0
- package/references/minimem/package-lock.json +5373 -0
- package/references/minimem/package.json +60 -0
- package/references/minimem/scripts/postbuild.js +35 -0
- package/references/minimem/src/__tests__/edge-cases.test.ts +371 -0
- package/references/minimem/src/__tests__/errors.test.ts +265 -0
- package/references/minimem/src/__tests__/helpers.ts +199 -0
- package/references/minimem/src/__tests__/internal.test.ts +407 -0
- package/references/minimem/src/__tests__/knowledge.test.ts +287 -0
- package/references/minimem/src/__tests__/minimem.integration.test.ts +1127 -0
- package/references/minimem/src/__tests__/session.test.ts +190 -0
- package/references/minimem/src/cli/__tests__/commands.test.ts +759 -0
- package/references/minimem/src/cli/commands/__tests__/conflicts.test.ts +141 -0
- package/references/minimem/src/cli/commands/append.ts +76 -0
- package/references/minimem/src/cli/commands/config.ts +262 -0
- package/references/minimem/src/cli/commands/conflicts.ts +413 -0
- package/references/minimem/src/cli/commands/daemon.ts +169 -0
- package/references/minimem/src/cli/commands/index.ts +12 -0
- package/references/minimem/src/cli/commands/init.ts +88 -0
- package/references/minimem/src/cli/commands/mcp.ts +177 -0
- package/references/minimem/src/cli/commands/push-pull.ts +213 -0
- package/references/minimem/src/cli/commands/search.ts +158 -0
- package/references/minimem/src/cli/commands/status.ts +84 -0
- package/references/minimem/src/cli/commands/sync-init.ts +290 -0
- package/references/minimem/src/cli/commands/sync.ts +70 -0
- package/references/minimem/src/cli/commands/upsert.ts +197 -0
- package/references/minimem/src/cli/config.ts +584 -0
- package/references/minimem/src/cli/index.ts +264 -0
- package/references/minimem/src/cli/shared.ts +161 -0
- package/references/minimem/src/cli/sync/__tests__/central.test.ts +152 -0
- package/references/minimem/src/cli/sync/__tests__/conflicts.test.ts +209 -0
- package/references/minimem/src/cli/sync/__tests__/daemon.test.ts +118 -0
- package/references/minimem/src/cli/sync/__tests__/detection.test.ts +207 -0
- package/references/minimem/src/cli/sync/__tests__/integration.test.ts +476 -0
- package/references/minimem/src/cli/sync/__tests__/registry.test.ts +363 -0
- package/references/minimem/src/cli/sync/__tests__/state.test.ts +255 -0
- package/references/minimem/src/cli/sync/__tests__/validation.test.ts +193 -0
- package/references/minimem/src/cli/sync/__tests__/watcher.test.ts +178 -0
- package/references/minimem/src/cli/sync/central.ts +292 -0
- package/references/minimem/src/cli/sync/conflicts.ts +204 -0
- package/references/minimem/src/cli/sync/daemon.ts +407 -0
- package/references/minimem/src/cli/sync/detection.ts +138 -0
- package/references/minimem/src/cli/sync/index.ts +107 -0
- package/references/minimem/src/cli/sync/operations.ts +373 -0
- package/references/minimem/src/cli/sync/registry.ts +279 -0
- package/references/minimem/src/cli/sync/state.ts +355 -0
- package/references/minimem/src/cli/sync/validation.ts +206 -0
- package/references/minimem/src/cli/sync/watcher.ts +234 -0
- package/references/minimem/src/cli/version.ts +34 -0
- package/references/minimem/src/core/index.ts +9 -0
- package/references/minimem/src/core/indexer.ts +628 -0
- package/references/minimem/src/core/searcher.ts +221 -0
- package/references/minimem/src/db/schema.ts +183 -0
- package/references/minimem/src/db/sqlite-vec.ts +24 -0
- package/references/minimem/src/embeddings/__tests__/embeddings.test.ts +431 -0
- package/references/minimem/src/embeddings/batch-gemini.ts +392 -0
- package/references/minimem/src/embeddings/batch-openai.ts +409 -0
- package/references/minimem/src/embeddings/embeddings.ts +434 -0
- package/references/minimem/src/index.ts +109 -0
- package/references/minimem/src/internal.ts +299 -0
- package/references/minimem/src/minimem.ts +1276 -0
- package/references/minimem/src/search/__tests__/hybrid.test.ts +247 -0
- package/references/minimem/src/search/graph.ts +234 -0
- package/references/minimem/src/search/hybrid.ts +151 -0
- package/references/minimem/src/search/search.ts +256 -0
- package/references/minimem/src/server/__tests__/mcp.test.ts +341 -0
- package/references/minimem/src/server/__tests__/tools.test.ts +364 -0
- package/references/minimem/src/server/mcp.ts +326 -0
- package/references/minimem/src/server/tools.ts +720 -0
- package/references/minimem/src/session.ts +460 -0
- package/references/minimem/tsconfig.json +19 -0
- package/references/minimem/tsup.config.ts +26 -0
- package/references/minimem/vitest.config.ts +24 -0
- package/references/skill-tree/.claude/settings.json +6 -0
- package/references/skill-tree/.sudocode/issues.jsonl +11 -0
- package/references/skill-tree/.sudocode/specs.jsonl +1 -0
- package/references/skill-tree/CLAUDE.md +150 -0
- package/references/skill-tree/README.md +324 -0
- package/references/skill-tree/docs/GAPS_v1.md +221 -0
- package/references/skill-tree/docs/INTEGRATION_PLAN.md +467 -0
- package/references/skill-tree/docs/TODOS.md +91 -0
- package/references/skill-tree/docs/anthropic_skill_guide.md +1364 -0
- package/references/skill-tree/docs/design/federated-skill-trees.md +524 -0
- package/references/skill-tree/docs/design/multi-agent-sync.md +759 -0
- package/references/skill-tree/docs/scraper/BRAINSTORM.md +583 -0
- package/references/skill-tree/docs/scraper/POC_PLAN.md +420 -0
- package/references/skill-tree/docs/scraper/README.md +170 -0
- package/references/skill-tree/examples/basic-usage.ts +190 -0
- package/references/skill-tree/package-lock.json +1509 -0
- package/references/skill-tree/package.json +66 -0
- package/references/skill-tree/scraper/README.md +123 -0
- package/references/skill-tree/scraper/docs/DESIGN.md +683 -0
- package/references/skill-tree/scraper/docs/PLAN.md +336 -0
- package/references/skill-tree/scraper/drizzle.config.ts +10 -0
- package/references/skill-tree/scraper/package-lock.json +6329 -0
- package/references/skill-tree/scraper/package.json +68 -0
- package/references/skill-tree/scraper/test/fixtures/invalid-skill/missing-description.md +7 -0
- package/references/skill-tree/scraper/test/fixtures/invalid-skill/missing-name.md +7 -0
- package/references/skill-tree/scraper/test/fixtures/minimal-skill/SKILL.md +27 -0
- package/references/skill-tree/scraper/test/fixtures/skill-json/SKILL.json +21 -0
- package/references/skill-tree/scraper/test/fixtures/skill-with-meta/SKILL.md +54 -0
- package/references/skill-tree/scraper/test/fixtures/skill-with-meta/_meta.json +24 -0
- package/references/skill-tree/scraper/test/fixtures/valid-skill/SKILL.md +93 -0
- package/references/skill-tree/scraper/test/fixtures/valid-skill/_meta.json +22 -0
- package/references/skill-tree/scraper/tsup.config.ts +14 -0
- package/references/skill-tree/scraper/vitest.config.ts +17 -0
- package/references/skill-tree/scripts/convert-to-vitest.ts +166 -0
- package/references/skill-tree/skills/skill-writer/SKILL.md +339 -0
- package/references/skill-tree/skills/skill-writer/references/examples.md +326 -0
- package/references/skill-tree/skills/skill-writer/references/patterns.md +210 -0
- package/references/skill-tree/skills/skill-writer/references/quality-checklist.md +123 -0
- package/references/skill-tree/test/run-all.ts +106 -0
- package/references/skill-tree/test/utils.ts +128 -0
- package/references/skill-tree/vitest.config.ts +16 -0
- package/scripts/migrate-to-playbooks.ts +307 -0
- package/src/agents/index.ts +14 -0
- package/src/agents/mock-provider.ts +93 -0
- package/src/agents/types.ts +137 -0
- package/src/atlas.ts +1072 -0
- package/src/bin/cognitive-core.ts +470 -0
- package/src/embeddings/bm25.ts +337 -0
- package/src/embeddings/index.ts +39 -0
- package/src/embeddings/manager.ts +288 -0
- package/src/embeddings/provider.ts +318 -0
- package/src/embeddings/vector-store.ts +353 -0
- package/src/factory.ts +263 -0
- package/src/index.ts +368 -0
- package/src/learning/analyzer.ts +335 -0
- package/src/learning/effectiveness.ts +428 -0
- package/src/learning/index.ts +93 -0
- package/src/learning/knowledge-extractor.ts +470 -0
- package/src/learning/meta-learner.ts +570 -0
- package/src/learning/pipeline.ts +323 -0
- package/src/learning/playbook-extractor.ts +702 -0
- package/src/learning/team-ingester.ts +499 -0
- package/src/learning/team-meta-learner.ts +558 -0
- package/src/learning/team-pipeline.ts +364 -0
- package/src/learning/trajectory-sources/dataclaw.ts +403 -0
- package/src/learning/trajectory-sources/entire.ts +240 -0
- package/src/learning/trajectory-sources/file.ts +136 -0
- package/src/learning/trajectory-sources/huggingface.ts +248 -0
- package/src/learning/trajectory-sources/in-memory.ts +61 -0
- package/src/learning/trajectory-sources/index.ts +15 -0
- package/src/learning/trajectory-sources/pipeline.ts +69 -0
- package/src/learning/usage-inference.ts +372 -0
- package/src/mcp/index.ts +12 -0
- package/src/mcp/playbook-server.ts +565 -0
- package/src/memory/curated-loader.ts +160 -0
- package/src/memory/experience.ts +515 -0
- package/src/memory/graph-layers/base.ts +184 -0
- package/src/memory/graph-layers/causal.ts +16 -0
- package/src/memory/graph-layers/entity.ts +16 -0
- package/src/memory/graph-layers/index.ts +5 -0
- package/src/memory/graph-layers/semantic.ts +16 -0
- package/src/memory/graph-layers/temporal.ts +16 -0
- package/src/memory/index.ts +72 -0
- package/src/memory/knowledge-bank.ts +1260 -0
- package/src/memory/knowledge-defrag.ts +329 -0
- package/src/memory/knowledge-graph.ts +361 -0
- package/src/memory/meta.ts +506 -0
- package/src/memory/playbook.ts +493 -0
- package/src/memory/search-provider.ts +35 -0
- package/src/memory/search-providers/index.ts +3 -0
- package/src/memory/search-providers/minimem.ts +84 -0
- package/src/memory/search-providers/text-similarity.ts +35 -0
- package/src/memory/skill-exporter.ts +357 -0
- package/src/memory/system.ts +604 -0
- package/src/memory/team-experience.ts +604 -0
- package/src/runtime/backends/acp-protocol.ts +231 -0
- package/src/runtime/backends/acp.ts +239 -0
- package/src/runtime/backends/index.ts +38 -0
- package/src/runtime/backends/macro-agent.ts +177 -0
- package/src/runtime/backends/mock.ts +218 -0
- package/src/runtime/backends/subprocess.ts +356 -0
- package/src/runtime/compute-provider.ts +206 -0
- package/src/runtime/flows/learning.ts +183 -0
- package/src/runtime/flows/validation.ts +381 -0
- package/src/runtime/index.ts +75 -0
- package/src/runtime/manager.ts +685 -0
- package/src/runtime/types.ts +198 -0
- package/src/search/evaluator.ts +499 -0
- package/src/search/index.ts +68 -0
- package/src/search/refinement-loop.ts +457 -0
- package/src/search/refinement-types.ts +159 -0
- package/src/search/router.ts +261 -0
- package/src/search/solver.ts +303 -0
- package/src/search/team-router.ts +459 -0
- package/src/search/verification-runner.ts +570 -0
- package/src/session-bank/git-reader.ts +190 -0
- package/src/session-bank/index.ts +24 -0
- package/src/session-bank/parser.ts +366 -0
- package/src/session-bank/session-bank.ts +464 -0
- package/src/session-bank/types.ts +173 -0
- package/src/surfacing/index.ts +29 -0
- package/src/surfacing/publisher.ts +23 -0
- package/src/surfacing/skill-library.ts +625 -0
- package/src/surfacing/skill-publisher.ts +223 -0
- package/src/surfacing/sqlite-storage-adapter.ts +301 -0
- package/src/surfacing/team-skill-library.ts +610 -0
- package/src/types/config.ts +585 -0
- package/src/types/dataclaw.ts +99 -0
- package/src/types/huggingface-transformers.d.ts +12 -0
- package/src/types/index.ts +286 -0
- package/src/types/knowledge-graph.ts +246 -0
- package/src/types/knowledge.ts +388 -0
- package/src/types/memory.ts +270 -0
- package/src/types/meta.ts +218 -0
- package/src/types/outcome.ts +66 -0
- package/src/types/playbook.ts +196 -0
- package/src/types/step.ts +40 -0
- package/src/types/task.ts +52 -0
- package/src/types/team-meta.ts +212 -0
- package/src/types/team-playbook.ts +384 -0
- package/src/types/team-trajectory.ts +673 -0
- package/src/types/trajectory-source.ts +47 -0
- package/src/types/trajectory.ts +80 -0
- package/src/utils/frontmatter.ts +118 -0
- package/src/utils/index.ts +45 -0
- package/src/utils/similarity.ts +139 -0
- package/src/utils/storage.ts +249 -0
- package/src/utils/validation.ts +286 -0
- package/src/workspace/index.ts +48 -0
- package/src/workspace/runner.ts +281 -0
- package/src/workspace/skill-converter.ts +288 -0
- package/src/workspace/templates/index.ts +64 -0
- package/src/workspace/templates/knowledge-defrag.ts +223 -0
- package/src/workspace/templates/knowledge-extraction.ts +337 -0
- package/src/workspace/templates/meta-reflection.ts +208 -0
- package/src/workspace/templates/playbook-extraction.ts +240 -0
- package/src/workspace/templates/refinement-analysis.ts +162 -0
- package/src/workspace/templates/solution-evaluation.ts +199 -0
- package/src/workspace/templates/team-playbook-extraction.ts +631 -0
- package/src/workspace/templates/team-trajectory-analysis.ts +564 -0
- package/src/workspace/templates/trajectory-analysis.ts +234 -0
- package/src/workspace/templates/usage-inference.ts +163 -0
- package/src/workspace/types.ts +233 -0
- package/tests/atlas-knowledge.test.ts +165 -0
- package/tests/embeddings/bm25.test.ts +130 -0
- package/tests/embeddings/manager.test.ts +205 -0
- package/tests/gap-fixes.test.ts +1103 -0
- package/tests/integration/atlas.test.ts +266 -0
- package/tests/integration/dataclaw-e2e.test.ts +559 -0
- package/tests/integration/e2e.test.ts +1336 -0
- package/tests/integration/entire-e2e.test.ts +187 -0
- package/tests/integration/huggingface-e2e.test.ts +627 -0
- package/tests/integration/session-bank.test.ts +225 -0
- package/tests/integration/skill-tree-wiring.test.ts +152 -0
- package/tests/learning/analyzer.test.ts +426 -0
- package/tests/learning/dataclaw-trajectory-source.test.ts +642 -0
- package/tests/learning/effectiveness.test.ts +542 -0
- package/tests/learning/entire-trajectory-source.test.ts +380 -0
- package/tests/learning/huggingface-trajectory-source.test.ts +817 -0
- package/tests/learning/knowledge-extractor.test.ts +491 -0
- package/tests/learning/pipeline.test.ts +176 -0
- package/tests/learning/playbook-extractor-provenance.test.ts +114 -0
- package/tests/learning/team-ingester.test.ts +349 -0
- package/tests/learning/team-meta-learner.test.ts +618 -0
- package/tests/learning/team-pipeline.test.ts +334 -0
- package/tests/learning/trajectory-sources.test.ts +312 -0
- package/tests/learning/usage-inference.test.ts +254 -0
- package/tests/mcp/playbook-server.test.ts +252 -0
- package/tests/memory/experience.test.ts +198 -0
- package/tests/memory/graph-layers/semantic.test.ts +219 -0
- package/tests/memory/knowledge-bank-extraction.test.ts +558 -0
- package/tests/memory/knowledge-bank.test.ts +705 -0
- package/tests/memory/knowledge-defrag.test.ts +366 -0
- package/tests/memory/knowledge-evolution.test.ts +563 -0
- package/tests/memory/knowledge-graph.test.ts +492 -0
- package/tests/memory/knowledge-inbox.test.ts +258 -0
- package/tests/memory/knowledge-minimem.test.ts +251 -0
- package/tests/memory/playbook.test.ts +338 -0
- package/tests/memory/provenance.test.ts +639 -0
- package/tests/memory/skill-exporter.test.ts +470 -0
- package/tests/memory/system.test.ts +325 -0
- package/tests/memory/team-experience.test.ts +411 -0
- package/tests/runtime/agent-manager.test.ts +512 -0
- package/tests/runtime/compute-provider.test.ts +288 -0
- package/tests/runtime/delegate.test.ts +349 -0
- package/tests/runtime/macro-agent-backend.test.ts +266 -0
- package/tests/runtime/mock-backend.test.ts +248 -0
- package/tests/search/refinement-loop.test.ts +468 -0
- package/tests/search/refinement.test.ts +267 -0
- package/tests/search/router.test.ts +427 -0
- package/tests/search/team-router.test.ts +376 -0
- package/tests/session-bank/fixtures/multi-tool-session/full.jsonl +12 -0
- package/tests/session-bank/fixtures/multi-tool-session/metadata.json +28 -0
- package/tests/session-bank/fixtures/root-metadata.json +18 -0
- package/tests/session-bank/fixtures/simple-session/full.jsonl +6 -0
- package/tests/session-bank/fixtures/simple-session/metadata.json +38 -0
- package/tests/session-bank/git-reader.test.ts +232 -0
- package/tests/session-bank/parser.test.ts +321 -0
- package/tests/session-bank/session-bank.test.ts +546 -0
- package/tests/surfacing/skill-library.test.ts +292 -0
- package/tests/surfacing/skill-publisher.test.ts +398 -0
- package/tests/surfacing/sqlite-storage-adapter.test.ts +218 -0
- package/tests/surfacing/team-skill-library.test.ts +444 -0
- package/tests/types/outcome.test.ts +147 -0
- package/tests/types/step.test.ts +133 -0
- package/tests/types/task.test.ts +158 -0
- package/tests/types/team-meta.test.ts +147 -0
- package/tests/types/team-playbook.test.ts +246 -0
- package/tests/types/team-trajectory.test.ts +557 -0
- package/tests/types/trajectory.test.ts +253 -0
- package/tests/utils/frontmatter.test.ts +208 -0
- package/tests/utils/similarity.test.ts +188 -0
- package/tests/utils/validation.test.ts +252 -0
- package/tests/workspace/full-flow.test.ts +839 -0
- package/tests/workspace/manager.test.ts +215 -0
- package/tests/workspace/runner.test.ts +330 -0
- package/tests/workspace/skill-converter.test.ts +205 -0
- package/tests/workspace/templates/knowledge-extraction.test.ts +235 -0
- package/tests/workspace/templates/team-playbook-extraction.test.ts +341 -0
- package/tests/workspace/templates/team-trajectory-analysis.test.ts +417 -0
- package/tsconfig.json +25 -0
- package/vitest.config.ts +22 -0
- package/dist/index.d.mts +0 -466
- package/dist/index.mjs +0 -478
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Playbook Extraction Template
|
|
3
|
+
*
|
|
4
|
+
* Replaces both PlaybookExtractor (heuristic) and LLMPlaybookExtractor
|
|
5
|
+
* with a unified workspace-based agentic extraction.
|
|
6
|
+
*
|
|
7
|
+
* - Small batches (<=3 trajectories) → heuristic fallback
|
|
8
|
+
* - Larger batches → agent semantically identifies patterns and creates playbooks
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { WorkspaceHandle } from 'agent-workspace';
|
|
12
|
+
import type { Trajectory, Playbook } from '../../types/index.js';
|
|
13
|
+
import type { AnalysisResult } from '../../learning/analyzer.js';
|
|
14
|
+
import type {
|
|
15
|
+
ExtractedPlaybooks,
|
|
16
|
+
} from '../../learning/playbook-extractor.js';
|
|
17
|
+
import { createPlaybookExtractor } from '../../learning/playbook-extractor.js';
|
|
18
|
+
import type {
|
|
19
|
+
AgenticTaskTemplate,
|
|
20
|
+
AnalysisComplexity,
|
|
21
|
+
} from '../types.js';
|
|
22
|
+
import type { ComputeRequirements } from '../../runtime/compute-provider.js';
|
|
23
|
+
|
|
24
|
+
// ============================================================
|
|
25
|
+
// Input / Output Types
|
|
26
|
+
// ============================================================
|
|
27
|
+
|
|
28
|
+
export interface PlaybookExtractionInput {
|
|
29
|
+
trajectories: Trajectory[];
|
|
30
|
+
analyses: AnalysisResult[];
|
|
31
|
+
existingPlaybooks: Playbook[];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Output is ExtractedPlaybooks (reused from learning/playbook-extractor.ts)
|
|
35
|
+
|
|
36
|
+
// ============================================================
|
|
37
|
+
// Template Implementation
|
|
38
|
+
// ============================================================
|
|
39
|
+
|
|
40
|
+
export const playbookExtractionTemplate: AgenticTaskTemplate<
|
|
41
|
+
PlaybookExtractionInput,
|
|
42
|
+
ExtractedPlaybooks
|
|
43
|
+
> = {
|
|
44
|
+
taskType: 'playbook-extraction',
|
|
45
|
+
domain: 'playbook-extraction',
|
|
46
|
+
description: 'Extract reusable playbooks from trajectory batch',
|
|
47
|
+
|
|
48
|
+
assessComplexity(input: PlaybookExtractionInput): AnalysisComplexity {
|
|
49
|
+
if (input.trajectories.length <= 3) return 'heuristic';
|
|
50
|
+
if (input.trajectories.length > 10) return 'thorough';
|
|
51
|
+
return 'standard';
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
async heuristicFallback(input: PlaybookExtractionInput): Promise<ExtractedPlaybooks> {
|
|
55
|
+
const extractor = createPlaybookExtractor();
|
|
56
|
+
return extractor.extract(
|
|
57
|
+
input.trajectories,
|
|
58
|
+
input.analyses,
|
|
59
|
+
input.existingPlaybooks
|
|
60
|
+
);
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
async prepareWorkspace(
|
|
64
|
+
input: PlaybookExtractionInput,
|
|
65
|
+
handle: WorkspaceHandle
|
|
66
|
+
): Promise<void> {
|
|
67
|
+
// Write summary
|
|
68
|
+
const successCount = input.analyses.filter(a => a.success).length;
|
|
69
|
+
const domains = [...new Set(input.trajectories.map(t => t.task.domain))];
|
|
70
|
+
await handle.writeJson('input', 'summary.json', {
|
|
71
|
+
batchSize: input.trajectories.length,
|
|
72
|
+
domains,
|
|
73
|
+
successRate: input.trajectories.length > 0
|
|
74
|
+
? successCount / input.trajectories.length
|
|
75
|
+
: 0,
|
|
76
|
+
existingPlaybookCount: input.existingPlaybooks.length,
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// Write each trajectory with its analysis
|
|
80
|
+
for (let i = 0; i < input.trajectories.length; i++) {
|
|
81
|
+
const traj = input.trajectories[i];
|
|
82
|
+
const analysis = input.analyses[i];
|
|
83
|
+
await handle.writeJson('input', `trajectories/${traj.id}.json`, {
|
|
84
|
+
id: traj.id,
|
|
85
|
+
domain: traj.task.domain,
|
|
86
|
+
description: traj.task.description,
|
|
87
|
+
outcome: traj.outcome,
|
|
88
|
+
stepCount: traj.steps.length,
|
|
89
|
+
keySteps: analysis.keySteps,
|
|
90
|
+
abstractable: analysis.abstractable,
|
|
91
|
+
errorPatterns: analysis.errorPatterns,
|
|
92
|
+
// Include only key steps to keep workspace focused
|
|
93
|
+
steps: analysis.keySteps.map(idx => ({
|
|
94
|
+
index: idx,
|
|
95
|
+
thought: traj.steps[idx]?.thought,
|
|
96
|
+
action: traj.steps[idx]?.action,
|
|
97
|
+
observation: traj.steps[idx]?.observation,
|
|
98
|
+
})),
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Write existing playbook summaries for deduplication
|
|
103
|
+
for (const playbook of input.existingPlaybooks) {
|
|
104
|
+
await handle.writeJson('input', `existing-playbooks/${playbook.id}.json`, {
|
|
105
|
+
id: playbook.id,
|
|
106
|
+
name: playbook.name,
|
|
107
|
+
strategy: playbook.guidance.strategy,
|
|
108
|
+
tactics: playbook.guidance.tactics,
|
|
109
|
+
domains: playbook.applicability.domains,
|
|
110
|
+
successCount: playbook.evolution.successCount,
|
|
111
|
+
failureCount: playbook.evolution.failureCount,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
buildTaskPrompt(input: PlaybookExtractionInput): string {
|
|
117
|
+
return [
|
|
118
|
+
`Extract reusable playbooks from ${input.trajectories.length} agent trajectories.`,
|
|
119
|
+
'',
|
|
120
|
+
'Read input/summary.json for batch overview.',
|
|
121
|
+
'Read input/trajectories/*.json for individual trajectory data.',
|
|
122
|
+
'Read input/existing-playbooks/*.json to avoid duplicating existing playbooks.',
|
|
123
|
+
'',
|
|
124
|
+
'For each pattern you identify:',
|
|
125
|
+
'1. Check if it overlaps with an existing playbook (if so, create an update, not a new playbook)',
|
|
126
|
+
'2. Extract a clear strategy and tactical steps',
|
|
127
|
+
'3. Identify when the playbook applies and when it should NOT apply',
|
|
128
|
+
'',
|
|
129
|
+
'Write results to output/extraction.json with this schema:',
|
|
130
|
+
'```json',
|
|
131
|
+
'{',
|
|
132
|
+
' "new": [',
|
|
133
|
+
' {',
|
|
134
|
+
' "name": "descriptive-name",',
|
|
135
|
+
' "strategy": "high-level approach",',
|
|
136
|
+
' "tactics": ["step1", "step2"],',
|
|
137
|
+
' "situations": ["when to apply"],',
|
|
138
|
+
' "triggers": ["keywords or patterns"],',
|
|
139
|
+
' "antiPatterns": ["when NOT to apply"],',
|
|
140
|
+
' "domains": ["applicable domains"],',
|
|
141
|
+
' "confidence": 0.0-1.0',
|
|
142
|
+
' }',
|
|
143
|
+
' ],',
|
|
144
|
+
' "updates": [',
|
|
145
|
+
' {',
|
|
146
|
+
' "id": "existing-playbook-id",',
|
|
147
|
+
' "newTrigger": "optional new trigger",',
|
|
148
|
+
' "newAntiPattern": "optional new anti-pattern",',
|
|
149
|
+
' "refinementContext": "when this refinement applies",',
|
|
150
|
+
' "refinementAddition": "what to add to the playbook"',
|
|
151
|
+
' }',
|
|
152
|
+
' ]',
|
|
153
|
+
'}',
|
|
154
|
+
'```',
|
|
155
|
+
].join('\n');
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
getSkills() { return []; },
|
|
159
|
+
getResources() { return []; },
|
|
160
|
+
|
|
161
|
+
outputConfig: {
|
|
162
|
+
files: [
|
|
163
|
+
{
|
|
164
|
+
path: 'extraction.json',
|
|
165
|
+
format: 'json' as const,
|
|
166
|
+
required: true,
|
|
167
|
+
description: 'Extracted playbooks and updates to existing playbooks',
|
|
168
|
+
},
|
|
169
|
+
],
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
async collectOutput(handle: WorkspaceHandle): Promise<ExtractedPlaybooks> {
|
|
173
|
+
const raw = await handle.readJson('output', 'extraction.json') as Record<string, unknown>;
|
|
174
|
+
const { createPlaybook } = await import('../../types/index.js');
|
|
175
|
+
|
|
176
|
+
const newPlaybooks: Playbook[] = [];
|
|
177
|
+
if (Array.isArray(raw.new)) {
|
|
178
|
+
for (const item of raw.new as Record<string, unknown>[]) {
|
|
179
|
+
newPlaybooks.push(createPlaybook({
|
|
180
|
+
name: String(item.name ?? 'Unnamed Playbook'),
|
|
181
|
+
guidance: {
|
|
182
|
+
strategy: String(item.strategy ?? ''),
|
|
183
|
+
tactics: Array.isArray(item.tactics) ? item.tactics.map(String) : [],
|
|
184
|
+
},
|
|
185
|
+
applicability: {
|
|
186
|
+
situations: Array.isArray(item.situations) ? item.situations.map(String) : [],
|
|
187
|
+
triggers: Array.isArray(item.triggers) ? item.triggers.map(String) : [],
|
|
188
|
+
antiPatterns: Array.isArray(item.antiPatterns) ? item.antiPatterns.map(String) : [],
|
|
189
|
+
domains: Array.isArray(item.domains) ? item.domains.map(String) : [],
|
|
190
|
+
},
|
|
191
|
+
confidence: typeof item.confidence === 'number' ? item.confidence : 0.5,
|
|
192
|
+
complexity: 'moderate',
|
|
193
|
+
}));
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const updates: ExtractedPlaybooks['updates'] = [];
|
|
198
|
+
if (Array.isArray(raw.updates)) {
|
|
199
|
+
for (const item of raw.updates as Record<string, unknown>[]) {
|
|
200
|
+
updates.push({
|
|
201
|
+
id: String(item.id ?? ''),
|
|
202
|
+
newTrigger: item.newTrigger ? String(item.newTrigger) : undefined,
|
|
203
|
+
newAntiPattern: item.newAntiPattern ? String(item.newAntiPattern) : undefined,
|
|
204
|
+
refinement: item.refinementContext ? {
|
|
205
|
+
context: String(item.refinementContext),
|
|
206
|
+
addition: String(item.refinementAddition ?? ''),
|
|
207
|
+
source: 'success' as const,
|
|
208
|
+
addedAt: new Date(),
|
|
209
|
+
} : undefined,
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return { new: newPlaybooks, updates };
|
|
215
|
+
},
|
|
216
|
+
|
|
217
|
+
async processOutput(): Promise<void> {
|
|
218
|
+
// Pipeline handles storage
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
computeRequirements: {
|
|
222
|
+
mode: 'local',
|
|
223
|
+
complexity: 'standard',
|
|
224
|
+
},
|
|
225
|
+
|
|
226
|
+
getComputeRequirements(
|
|
227
|
+
_input: PlaybookExtractionInput,
|
|
228
|
+
complexity: AnalysisComplexity
|
|
229
|
+
): ComputeRequirements {
|
|
230
|
+
return {
|
|
231
|
+
mode: 'local',
|
|
232
|
+
complexity,
|
|
233
|
+
timeout: complexity === 'thorough' ? 300_000 : 180_000,
|
|
234
|
+
};
|
|
235
|
+
},
|
|
236
|
+
|
|
237
|
+
agentType: 'claude-code',
|
|
238
|
+
timeout: 180_000,
|
|
239
|
+
captureToolCalls: true,
|
|
240
|
+
};
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Refinement Analysis Template
|
|
3
|
+
*
|
|
4
|
+
* Enhances the RefinementLoop's failure analysis with workspace-based
|
|
5
|
+
* root cause analysis. Instead of just retrying, the agent analyzes
|
|
6
|
+
* WHY the previous attempt failed and produces a targeted strategy.
|
|
7
|
+
*
|
|
8
|
+
* - First failure → lightweight analysis
|
|
9
|
+
* - Repeated failures → standard deeper analysis
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type { WorkspaceHandle } from 'agent-workspace';
|
|
13
|
+
import type { Trajectory, Task } from '../../types/index.js';
|
|
14
|
+
import type { EvaluationResult } from '../../search/refinement-types.js';
|
|
15
|
+
import type {
|
|
16
|
+
AgenticTaskTemplate,
|
|
17
|
+
AnalysisComplexity,
|
|
18
|
+
} from '../types.js';
|
|
19
|
+
import type { ComputeRequirements } from '../../runtime/compute-provider.js';
|
|
20
|
+
|
|
21
|
+
// ============================================================
|
|
22
|
+
// Input / Output Types
|
|
23
|
+
// ============================================================
|
|
24
|
+
|
|
25
|
+
export interface RefinementAnalysisInput {
|
|
26
|
+
trajectory: Trajectory;
|
|
27
|
+
task: Task;
|
|
28
|
+
evaluation: EvaluationResult;
|
|
29
|
+
previousAttempts: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface RefinementPlan {
|
|
33
|
+
/** Root causes identified for the failure */
|
|
34
|
+
rootCauses: string[];
|
|
35
|
+
/** Recommended strategy for the next attempt */
|
|
36
|
+
strategy: string;
|
|
37
|
+
/** Specific steps to take */
|
|
38
|
+
steps: string[];
|
|
39
|
+
/** Patterns to avoid (from previous failure) */
|
|
40
|
+
avoidPatterns: string[];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// ============================================================
|
|
44
|
+
// Template Implementation
|
|
45
|
+
// ============================================================
|
|
46
|
+
|
|
47
|
+
export const refinementAnalysisTemplate: AgenticTaskTemplate<
|
|
48
|
+
RefinementAnalysisInput,
|
|
49
|
+
RefinementPlan
|
|
50
|
+
> = {
|
|
51
|
+
taskType: 'refinement-analysis',
|
|
52
|
+
domain: 'refinement-analysis',
|
|
53
|
+
description: 'Analyze failure and plan refinement strategy',
|
|
54
|
+
|
|
55
|
+
assessComplexity(input: RefinementAnalysisInput): AnalysisComplexity {
|
|
56
|
+
// First failure → lightweight
|
|
57
|
+
if (input.previousAttempts <= 1) return 'lightweight';
|
|
58
|
+
// Repeated failures → deeper analysis
|
|
59
|
+
return 'standard';
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
// No heuristic fallback — refinement always benefits from semantic reasoning
|
|
63
|
+
|
|
64
|
+
async prepareWorkspace(
|
|
65
|
+
input: RefinementAnalysisInput,
|
|
66
|
+
handle: WorkspaceHandle
|
|
67
|
+
): Promise<void> {
|
|
68
|
+
const { trajectory, task, evaluation, previousAttempts } = input;
|
|
69
|
+
|
|
70
|
+
await handle.writeJson('input', 'context.json', {
|
|
71
|
+
task: {
|
|
72
|
+
description: task.description,
|
|
73
|
+
domain: task.domain,
|
|
74
|
+
},
|
|
75
|
+
evaluation: {
|
|
76
|
+
quality: evaluation.quality,
|
|
77
|
+
score: evaluation.score,
|
|
78
|
+
issues: evaluation.issues,
|
|
79
|
+
},
|
|
80
|
+
previousAttempts,
|
|
81
|
+
outcome: trajectory.outcome,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
await handle.writeJsonl('input', 'steps.jsonl',
|
|
85
|
+
trajectory.steps.map((step, i) => ({
|
|
86
|
+
index: i,
|
|
87
|
+
thought: step.thought?.slice(0, 300),
|
|
88
|
+
action: step.action.slice(0, 300),
|
|
89
|
+
observation: step.observation?.slice(0, 300),
|
|
90
|
+
}))
|
|
91
|
+
);
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
buildTaskPrompt(input: RefinementAnalysisInput): string {
|
|
95
|
+
const attemptNum = input.previousAttempts + 1;
|
|
96
|
+
return [
|
|
97
|
+
`This is attempt #${attemptNum}. The previous attempt failed with quality "${input.evaluation.quality}" (score: ${input.evaluation.score}).`,
|
|
98
|
+
'',
|
|
99
|
+
'Read input/context.json for task, evaluation, and outcome details.',
|
|
100
|
+
'Read input/steps.jsonl for the execution trace.',
|
|
101
|
+
'',
|
|
102
|
+
'Perform root cause analysis:',
|
|
103
|
+
'1. Why did the previous attempt fail? Identify specific root causes.',
|
|
104
|
+
'2. What strategy should the next attempt use?',
|
|
105
|
+
'3. What specific steps should be taken?',
|
|
106
|
+
'4. What patterns from the failed attempt should be avoided?',
|
|
107
|
+
'',
|
|
108
|
+
'Write to output/plan.json:',
|
|
109
|
+
'```json',
|
|
110
|
+
'{',
|
|
111
|
+
' "rootCauses": ["cause1", "cause2"],',
|
|
112
|
+
' "strategy": "high-level approach for next attempt",',
|
|
113
|
+
' "steps": ["specific step 1", "specific step 2"],',
|
|
114
|
+
' "avoidPatterns": ["pattern to avoid 1", "pattern to avoid 2"]',
|
|
115
|
+
'}',
|
|
116
|
+
'```',
|
|
117
|
+
].join('\n');
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
getSkills() { return []; },
|
|
121
|
+
getResources() { return []; },
|
|
122
|
+
|
|
123
|
+
outputConfig: {
|
|
124
|
+
files: [{
|
|
125
|
+
path: 'plan.json',
|
|
126
|
+
format: 'json' as const,
|
|
127
|
+
required: true,
|
|
128
|
+
description: 'Refinement plan with root causes and strategy',
|
|
129
|
+
}],
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
async collectOutput(handle: WorkspaceHandle): Promise<RefinementPlan> {
|
|
133
|
+
const raw = await handle.readJson('output', 'plan.json') as Record<string, unknown>;
|
|
134
|
+
return {
|
|
135
|
+
rootCauses: Array.isArray(raw.rootCauses) ? raw.rootCauses.map(String) : [],
|
|
136
|
+
strategy: String(raw.strategy ?? ''),
|
|
137
|
+
steps: Array.isArray(raw.steps) ? raw.steps.map(String) : [],
|
|
138
|
+
avoidPatterns: Array.isArray(raw.avoidPatterns) ? raw.avoidPatterns.map(String) : [],
|
|
139
|
+
};
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
async processOutput(): Promise<void> {},
|
|
143
|
+
|
|
144
|
+
computeRequirements: {
|
|
145
|
+
mode: 'local',
|
|
146
|
+
complexity: 'lightweight',
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
getComputeRequirements(
|
|
150
|
+
_input: RefinementAnalysisInput,
|
|
151
|
+
complexity: AnalysisComplexity
|
|
152
|
+
): ComputeRequirements {
|
|
153
|
+
return {
|
|
154
|
+
mode: 'local',
|
|
155
|
+
complexity,
|
|
156
|
+
};
|
|
157
|
+
},
|
|
158
|
+
|
|
159
|
+
agentType: 'claude-code',
|
|
160
|
+
timeout: 120_000,
|
|
161
|
+
captureToolCalls: true,
|
|
162
|
+
};
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Solution Evaluation Template
|
|
3
|
+
*
|
|
4
|
+
* Enhances the SolutionEvaluator with workspace-based agentic evaluation
|
|
5
|
+
* for cases where programmatic verification is insufficient.
|
|
6
|
+
*
|
|
7
|
+
* - Tasks with verification spec → heuristic (programmatic verification)
|
|
8
|
+
* - Short successful trajectories → lightweight agent evaluation
|
|
9
|
+
* - Complex or failed cases → standard agent evaluation
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type { WorkspaceHandle } from 'agent-workspace';
|
|
13
|
+
import type { Trajectory, Task } from '../../types/index.js';
|
|
14
|
+
import type { EvaluationResult } from '../../search/refinement-types.js';
|
|
15
|
+
import { createEvaluationResult, scoreToQuality } from '../../search/refinement-types.js';
|
|
16
|
+
import type {
|
|
17
|
+
AgenticTaskTemplate,
|
|
18
|
+
AnalysisComplexity,
|
|
19
|
+
ResourceSpec,
|
|
20
|
+
} from '../types.js';
|
|
21
|
+
import type { ComputeRequirements } from '../../runtime/compute-provider.js';
|
|
22
|
+
|
|
23
|
+
// ============================================================
|
|
24
|
+
// Input / Output Types
|
|
25
|
+
// ============================================================
|
|
26
|
+
|
|
27
|
+
export interface SolutionEvaluationInput {
|
|
28
|
+
trajectory: Trajectory;
|
|
29
|
+
task: Task;
|
|
30
|
+
/** Optional path to the codebase for agent to inspect */
|
|
31
|
+
codebasePath?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Output: EvaluationResult (reused from search/refinement-types.ts)
|
|
35
|
+
|
|
36
|
+
// ============================================================
|
|
37
|
+
// Template Implementation
|
|
38
|
+
// ============================================================
|
|
39
|
+
|
|
40
|
+
export const solutionEvaluationTemplate: AgenticTaskTemplate<
|
|
41
|
+
SolutionEvaluationInput,
|
|
42
|
+
EvaluationResult
|
|
43
|
+
> = {
|
|
44
|
+
taskType: 'solution-evaluation',
|
|
45
|
+
domain: 'solution-evaluation',
|
|
46
|
+
description: 'Evaluate solution quality from trajectory',
|
|
47
|
+
|
|
48
|
+
assessComplexity(input: SolutionEvaluationInput): AnalysisComplexity {
|
|
49
|
+
// Programmatic verification available → heuristic path
|
|
50
|
+
if (input.task.verification) return 'heuristic';
|
|
51
|
+
// Short successful trajectories → lightweight
|
|
52
|
+
if (input.trajectory.outcome.success && input.trajectory.steps.length <= 10) {
|
|
53
|
+
return 'lightweight';
|
|
54
|
+
}
|
|
55
|
+
return 'standard';
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
async heuristicFallback(input: SolutionEvaluationInput): Promise<EvaluationResult> {
|
|
59
|
+
// Simple heuristic evaluation based on trajectory outcome
|
|
60
|
+
const score = input.trajectory.outcome.success
|
|
61
|
+
? Math.max(0.7, input.trajectory.outcome.partialScore)
|
|
62
|
+
: input.trajectory.outcome.partialScore;
|
|
63
|
+
|
|
64
|
+
return createEvaluationResult({
|
|
65
|
+
quality: scoreToQuality(score),
|
|
66
|
+
score,
|
|
67
|
+
acceptable: score >= 0.7,
|
|
68
|
+
method: 'heuristic',
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
async prepareWorkspace(
|
|
73
|
+
input: SolutionEvaluationInput,
|
|
74
|
+
handle: WorkspaceHandle
|
|
75
|
+
): Promise<void> {
|
|
76
|
+
const { trajectory, task } = input;
|
|
77
|
+
|
|
78
|
+
await handle.writeJson('input', 'task.json', {
|
|
79
|
+
description: task.description,
|
|
80
|
+
domain: task.domain,
|
|
81
|
+
verification: task.verification,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
await handle.writeJson('input', 'trajectory.json', {
|
|
85
|
+
outcome: trajectory.outcome,
|
|
86
|
+
stepCount: trajectory.steps.length,
|
|
87
|
+
wallTimeSeconds: trajectory.wallTimeSeconds,
|
|
88
|
+
solution: trajectory.outcome.solution,
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
await handle.writeJsonl('input', 'steps.jsonl',
|
|
92
|
+
trajectory.steps.map((step, i) => ({
|
|
93
|
+
index: i,
|
|
94
|
+
action: step.action,
|
|
95
|
+
observation: step.observation?.slice(0, 300),
|
|
96
|
+
}))
|
|
97
|
+
);
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
buildTaskPrompt(input: SolutionEvaluationInput): string {
|
|
101
|
+
const lines = [
|
|
102
|
+
`Evaluate the quality of this solution for: "${input.task.description.slice(0, 200)}"`,
|
|
103
|
+
'',
|
|
104
|
+
'Read input/task.json for the task requirements.',
|
|
105
|
+
'Read input/trajectory.json for the outcome and solution.',
|
|
106
|
+
'Read input/steps.jsonl for execution details.',
|
|
107
|
+
];
|
|
108
|
+
|
|
109
|
+
if (input.codebasePath) {
|
|
110
|
+
lines.push('Browse resources/codebase/ to inspect the actual code changes if relevant.');
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
lines.push(
|
|
114
|
+
'',
|
|
115
|
+
'Evaluate:',
|
|
116
|
+
'1. Does the solution address the task requirements?',
|
|
117
|
+
'2. Are there any issues (incomplete, incorrect, inefficient, errors)?',
|
|
118
|
+
'3. Overall quality score (0.0 to 1.0)',
|
|
119
|
+
'',
|
|
120
|
+
'Write to output/evaluation.json:',
|
|
121
|
+
'```json',
|
|
122
|
+
'{',
|
|
123
|
+
' "quality": "excellent" | "good" | "needs_work" | "poor",',
|
|
124
|
+
' "score": 0.0-1.0,',
|
|
125
|
+
' "acceptable": boolean,',
|
|
126
|
+
' "issues": [{ "type": "incomplete"|"incorrect"|"inefficient"|"error", "description": "...", "severity": "critical"|"major"|"minor", "suggestion": "..." }]',
|
|
127
|
+
'}',
|
|
128
|
+
'```',
|
|
129
|
+
);
|
|
130
|
+
return lines.join('\n');
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
getSkills() { return []; },
|
|
134
|
+
|
|
135
|
+
getResources(input: SolutionEvaluationInput): ResourceSpec[] {
|
|
136
|
+
if (!input.codebasePath) return [];
|
|
137
|
+
return [{
|
|
138
|
+
path: 'codebase',
|
|
139
|
+
type: 'symlink',
|
|
140
|
+
source: input.codebasePath,
|
|
141
|
+
description: 'Codebase for solution verification',
|
|
142
|
+
}];
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
outputConfig: {
|
|
146
|
+
files: [{
|
|
147
|
+
path: 'evaluation.json',
|
|
148
|
+
format: 'json' as const,
|
|
149
|
+
required: true,
|
|
150
|
+
description: 'Solution quality evaluation',
|
|
151
|
+
}],
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
async collectOutput(handle: WorkspaceHandle): Promise<EvaluationResult> {
|
|
155
|
+
const raw = await handle.readJson('output', 'evaluation.json') as Record<string, unknown>;
|
|
156
|
+
|
|
157
|
+
const score = typeof raw.score === 'number' ? Math.min(1, Math.max(0, raw.score)) : 0.5;
|
|
158
|
+
const quality = ['excellent', 'good', 'needs_work', 'poor'].includes(String(raw.quality))
|
|
159
|
+
? String(raw.quality) as EvaluationResult['quality']
|
|
160
|
+
: scoreToQuality(score);
|
|
161
|
+
|
|
162
|
+
return createEvaluationResult({
|
|
163
|
+
quality,
|
|
164
|
+
score,
|
|
165
|
+
acceptable: raw.acceptable !== undefined ? Boolean(raw.acceptable) : score >= 0.7,
|
|
166
|
+
issues: Array.isArray(raw.issues)
|
|
167
|
+
? (raw.issues as Record<string, unknown>[]).map(issue => ({
|
|
168
|
+
type: String(issue.type ?? 'error') as 'incomplete' | 'incorrect' | 'inefficient' | 'error',
|
|
169
|
+
description: String(issue.description ?? ''),
|
|
170
|
+
severity: (['critical', 'major', 'minor'].includes(String(issue.severity))
|
|
171
|
+
? String(issue.severity) : 'minor') as 'critical' | 'major' | 'minor',
|
|
172
|
+
suggestion: issue.suggestion ? String(issue.suggestion) : undefined,
|
|
173
|
+
}))
|
|
174
|
+
: [],
|
|
175
|
+
method: 'agent',
|
|
176
|
+
});
|
|
177
|
+
},
|
|
178
|
+
|
|
179
|
+
async processOutput(): Promise<void> {},
|
|
180
|
+
|
|
181
|
+
computeRequirements: {
|
|
182
|
+
mode: 'local',
|
|
183
|
+
complexity: 'standard',
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
getComputeRequirements(
|
|
187
|
+
_input: SolutionEvaluationInput,
|
|
188
|
+
complexity: AnalysisComplexity
|
|
189
|
+
): ComputeRequirements {
|
|
190
|
+
return {
|
|
191
|
+
mode: 'local',
|
|
192
|
+
complexity,
|
|
193
|
+
};
|
|
194
|
+
},
|
|
195
|
+
|
|
196
|
+
agentType: 'claude-code',
|
|
197
|
+
timeout: 120_000,
|
|
198
|
+
captureToolCalls: true,
|
|
199
|
+
};
|