cognitive-core 0.1.0 → 0.2.0
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/CLAUDE.md +233 -0
- package/README.md +841 -255
- package/dist/atlas.d.ts +150 -12
- package/dist/atlas.d.ts.map +1 -1
- package/dist/atlas.js +391 -31
- package/dist/atlas.js.map +1 -1
- package/dist/bin/cli-utils.d.ts +37 -0
- package/dist/bin/cli-utils.d.ts.map +1 -0
- package/dist/bin/cli-utils.js +176 -0
- package/dist/bin/cli-utils.js.map +1 -0
- package/dist/bin/cognitive-core.d.ts +2 -12
- package/dist/bin/cognitive-core.d.ts.map +1 -1
- package/dist/bin/cognitive-core.js +76 -351
- package/dist/bin/cognitive-core.js.map +1 -1
- package/dist/bin/commands/kb.d.ts +6 -0
- package/dist/bin/commands/kb.d.ts.map +1 -0
- package/dist/bin/commands/kb.js +240 -0
- package/dist/bin/commands/kb.js.map +1 -0
- package/dist/bin/commands/learn.d.ts +6 -0
- package/dist/bin/commands/learn.d.ts.map +1 -0
- package/dist/bin/commands/learn.js +91 -0
- package/dist/bin/commands/learn.js.map +1 -0
- package/dist/bin/commands/legacy.d.ts +12 -0
- package/dist/bin/commands/legacy.d.ts.map +1 -0
- package/dist/bin/commands/legacy.js +142 -0
- package/dist/bin/commands/legacy.js.map +1 -0
- package/dist/bin/commands/run.d.ts +3 -0
- package/dist/bin/commands/run.d.ts.map +1 -0
- package/dist/bin/commands/run.js +99 -0
- package/dist/bin/commands/run.js.map +1 -0
- package/dist/bin/commands/sessions.d.ts +9 -0
- package/dist/bin/commands/sessions.d.ts.map +1 -0
- package/dist/bin/commands/sessions.js +183 -0
- package/dist/bin/commands/sessions.js.map +1 -0
- package/dist/bin/commands/skills.d.ts +6 -0
- package/dist/bin/commands/skills.d.ts.map +1 -0
- package/dist/bin/commands/skills.js +135 -0
- package/dist/bin/commands/skills.js.map +1 -0
- package/dist/embeddings/index.d.ts +1 -0
- package/dist/embeddings/index.d.ts.map +1 -1
- package/dist/embeddings/index.js +2 -0
- package/dist/embeddings/index.js.map +1 -1
- package/dist/embeddings/inverted-index.d.ts +47 -0
- package/dist/embeddings/inverted-index.d.ts.map +1 -0
- package/dist/embeddings/inverted-index.js +122 -0
- package/dist/embeddings/inverted-index.js.map +1 -0
- package/dist/embeddings/manager.d.ts +3 -1
- package/dist/embeddings/manager.d.ts.map +1 -1
- package/dist/embeddings/manager.js +12 -7
- package/dist/embeddings/manager.js.map +1 -1
- package/dist/embeddings/provider.d.ts.map +1 -1
- package/dist/embeddings/provider.js +6 -3
- package/dist/embeddings/provider.js.map +1 -1
- package/dist/embeddings/vector-store.d.ts +7 -3
- package/dist/embeddings/vector-store.d.ts.map +1 -1
- package/dist/embeddings/vector-store.js +22 -6
- package/dist/embeddings/vector-store.js.map +1 -1
- package/dist/factory.d.ts +11 -12
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +20 -7
- package/dist/factory.js.map +1 -1
- package/dist/index.d.ts +11 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +71 -8
- package/dist/index.js.map +1 -1
- package/dist/learning/analyzer.d.ts.map +1 -1
- package/dist/learning/analyzer.js +17 -35
- package/dist/learning/analyzer.js.map +1 -1
- package/dist/learning/energy-evaluator.d.ts +128 -0
- package/dist/learning/energy-evaluator.d.ts.map +1 -0
- package/dist/learning/energy-evaluator.js +175 -0
- package/dist/learning/energy-evaluator.js.map +1 -0
- package/dist/learning/healing-orchestrator.d.ts +182 -0
- package/dist/learning/healing-orchestrator.d.ts.map +1 -0
- package/dist/learning/healing-orchestrator.js +250 -0
- package/dist/learning/healing-orchestrator.js.map +1 -0
- package/dist/learning/index.d.ts +11 -2
- package/dist/learning/index.d.ts.map +1 -1
- package/dist/learning/index.js +20 -3
- package/dist/learning/index.js.map +1 -1
- package/dist/learning/instant-loop.d.ts +87 -0
- package/dist/learning/instant-loop.d.ts.map +1 -0
- package/dist/learning/instant-loop.js +264 -0
- package/dist/learning/instant-loop.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/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 +141 -0
- package/dist/learning/maintenance-scheduler.d.ts.map +1 -0
- package/dist/learning/maintenance-scheduler.js +186 -0
- package/dist/learning/maintenance-scheduler.js.map +1 -0
- package/dist/learning/meta-learner.d.ts +7 -0
- package/dist/learning/meta-learner.d.ts.map +1 -1
- package/dist/learning/meta-learner.js +47 -21
- package/dist/learning/meta-learner.js.map +1 -1
- package/dist/learning/pipeline.d.ts +55 -4
- package/dist/learning/pipeline.d.ts.map +1 -1
- package/dist/learning/pipeline.js +134 -16
- package/dist/learning/pipeline.js.map +1 -1
- package/dist/learning/reflexion-generator.d.ts +64 -0
- package/dist/learning/reflexion-generator.d.ts.map +1 -0
- package/dist/learning/reflexion-generator.js +194 -0
- package/dist/learning/reflexion-generator.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 +31 -0
- package/dist/learning/trajectory-sources/entire.d.ts.map +1 -0
- package/dist/learning/trajectory-sources/entire.js +189 -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/unified-pipeline.d.ts +281 -0
- package/dist/learning/unified-pipeline.d.ts.map +1 -0
- package/dist/learning/unified-pipeline.js +637 -0
- package/dist/learning/unified-pipeline.js.map +1 -0
- package/dist/memory/candidate-retrieval.d.ts +43 -0
- package/dist/memory/candidate-retrieval.d.ts.map +1 -0
- package/dist/memory/candidate-retrieval.js +41 -0
- package/dist/memory/candidate-retrieval.js.map +1 -0
- package/dist/memory/causal-store.d.ts +97 -0
- package/dist/memory/causal-store.d.ts.map +1 -0
- package/dist/memory/causal-store.js +209 -0
- package/dist/memory/causal-store.js.map +1 -0
- package/dist/memory/coherence.d.ts +71 -0
- package/dist/memory/coherence.d.ts.map +1 -0
- package/dist/memory/coherence.js +176 -0
- package/dist/memory/coherence.js.map +1 -0
- package/dist/memory/experience.d.ts +39 -6
- package/dist/memory/experience.d.ts.map +1 -1
- package/dist/memory/experience.js +193 -49
- package/dist/memory/experience.js.map +1 -1
- 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 +15 -0
- package/dist/memory/index.d.ts.map +1 -1
- package/dist/memory/index.js +22 -0
- package/dist/memory/index.js.map +1 -1
- package/dist/memory/knowledge-bank.d.ts +234 -0
- package/dist/memory/knowledge-bank.d.ts.map +1 -0
- package/dist/memory/knowledge-bank.js +1048 -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 +7 -8
- package/dist/memory/meta.d.ts.map +1 -1
- package/dist/memory/meta.js +73 -79
- package/dist/memory/meta.js.map +1 -1
- package/dist/memory/playbook.d.ts +26 -9
- package/dist/memory/playbook.d.ts.map +1 -1
- package/dist/memory/playbook.js +198 -74
- package/dist/memory/playbook.js.map +1 -1
- package/dist/memory/reasoning-bank.d.ts +130 -0
- package/dist/memory/reasoning-bank.d.ts.map +1 -0
- package/dist/memory/reasoning-bank.js +342 -0
- package/dist/memory/reasoning-bank.js.map +1 -0
- package/dist/memory/reflexion.d.ts +59 -0
- package/dist/memory/reflexion.d.ts.map +1 -0
- package/dist/memory/reflexion.js +96 -0
- package/dist/memory/reflexion.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 +20 -3
- package/dist/memory/system.d.ts.map +1 -1
- package/dist/memory/system.js +61 -11
- package/dist/memory/system.js.map +1 -1
- 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/memory/temporal-compressor.d.ts +126 -0
- package/dist/memory/temporal-compressor.d.ts.map +1 -0
- package/dist/memory/temporal-compressor.js +335 -0
- package/dist/memory/temporal-compressor.js.map +1 -0
- package/dist/persistence/index.d.ts +11 -0
- package/dist/persistence/index.d.ts.map +1 -0
- package/dist/persistence/index.js +11 -0
- package/dist/persistence/index.js.map +1 -0
- package/dist/persistence/migrator.d.ts +40 -0
- package/dist/persistence/migrator.d.ts.map +1 -0
- package/dist/persistence/migrator.js +238 -0
- package/dist/persistence/migrator.js.map +1 -0
- package/dist/persistence/serializers.d.ts +45 -0
- package/dist/persistence/serializers.d.ts.map +1 -0
- package/dist/persistence/serializers.js +80 -0
- package/dist/persistence/serializers.js.map +1 -0
- package/dist/persistence/sqlite-persistence.d.ts +228 -0
- package/dist/persistence/sqlite-persistence.d.ts.map +1 -0
- package/dist/persistence/sqlite-persistence.js +588 -0
- package/dist/persistence/sqlite-persistence.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 +26 -26
- package/dist/runtime/backends/acp.d.ts.map +1 -1
- package/dist/runtime/backends/acp.js +32 -156
- package/dist/runtime/backends/acp.js.map +1 -1
- package/dist/runtime/backends/index.d.ts +3 -1
- package/dist/runtime/backends/index.d.ts.map +1 -1
- package/dist/runtime/backends/index.js +3 -1
- package/dist/runtime/backends/index.js.map +1 -1
- 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/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 +10 -12
- package/dist/runtime/flows/learning.d.ts.map +1 -1
- package/dist/runtime/flows/learning.js +10 -23
- package/dist/runtime/flows/learning.js.map +1 -1
- package/dist/runtime/index.d.ts +3 -2
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +3 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/manager.d.ts +37 -4
- package/dist/runtime/manager.d.ts.map +1 -1
- package/dist/runtime/manager.js +139 -20
- package/dist/runtime/manager.js.map +1 -1
- package/dist/runtime/types.d.ts +38 -0
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/search/evaluator.d.ts +7 -0
- package/dist/search/evaluator.d.ts.map +1 -1
- package/dist/search/evaluator.js +24 -4
- package/dist/search/evaluator.js.map +1 -1
- package/dist/search/index.d.ts +2 -0
- package/dist/search/index.d.ts.map +1 -1
- package/dist/search/index.js +4 -0
- package/dist/search/index.js.map +1 -1
- package/dist/search/moe-gate.d.ts +124 -0
- package/dist/search/moe-gate.d.ts.map +1 -0
- package/dist/search/moe-gate.js +234 -0
- package/dist/search/moe-gate.js.map +1 -0
- package/dist/search/refinement-loop.d.ts +17 -0
- package/dist/search/refinement-loop.d.ts.map +1 -1
- package/dist/search/refinement-loop.js +77 -6
- package/dist/search/refinement-loop.js.map +1 -1
- package/dist/search/refinement-types.d.ts +2 -2
- package/dist/search/router.d.ts +32 -2
- package/dist/search/router.d.ts.map +1 -1
- package/dist/search/router.js +87 -4
- package/dist/search/router.js.map +1 -1
- 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/session-bank/git-reader.d.ts +44 -0
- package/dist/session-bank/git-reader.d.ts.map +1 -0
- package/dist/session-bank/git-reader.js +172 -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 +50 -0
- package/dist/session-bank/parser.d.ts.map +1 -0
- package/dist/session-bank/parser.js +338 -0
- package/dist/session-bank/parser.js.map +1 -0
- package/dist/session-bank/session-bank.d.ts +40 -0
- package/dist/session-bank/session-bank.d.ts.map +1 -0
- package/dist/session-bank/session-bank.js +347 -0
- package/dist/session-bank/session-bank.js.map +1 -0
- package/dist/session-bank/types.d.ts +132 -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 +4 -0
- package/dist/surfacing/index.d.ts.map +1 -1
- package/dist/surfacing/index.js +3 -0
- package/dist/surfacing/index.js.map +1 -1
- 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 +12 -0
- package/dist/surfacing/skill-library.d.ts.map +1 -1
- package/dist/surfacing/skill-library.js +26 -0
- package/dist/surfacing/skill-library.js.map +1 -1
- 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 +169 -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 +199 -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 +1318 -44
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js +243 -0
- package/dist/types/config.js.map +1 -1
- 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 +9 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +13 -1
- package/dist/types/index.js.map +1 -1
- 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 +52 -0
- package/dist/types/memory.d.ts.map +1 -1
- package/dist/types/memory.js +13 -0
- package/dist/types/memory.js.map +1 -1
- package/dist/types/playbook.d.ts +4 -0
- package/dist/types/playbook.d.ts.map +1 -1
- package/dist/types/playbook.js.map +1 -1
- 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/utils/error-classifier.d.ts +30 -0
- package/dist/utils/error-classifier.d.ts.map +1 -0
- package/dist/utils/error-classifier.js +85 -0
- package/dist/utils/error-classifier.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 +4 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +4 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/partitioned-store.d.ts +93 -0
- package/dist/utils/partitioned-store.d.ts.map +1 -0
- package/dist/utils/partitioned-store.js +251 -0
- package/dist/utils/partitioned-store.js.map +1 -0
- package/dist/utils/trajectory-helpers.d.ts +39 -0
- package/dist/utils/trajectory-helpers.d.ts.map +1 -0
- package/dist/utils/trajectory-helpers.js +57 -0
- package/dist/utils/trajectory-helpers.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 +49 -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 +152 -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/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 +27 -7
- 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/sessionlog/.husky/pre-commit +1 -0
- package/references/sessionlog/.lintstagedrc.json +4 -0
- package/references/sessionlog/.prettierignore +4 -0
- package/references/sessionlog/.prettierrc.json +11 -0
- package/references/sessionlog/LICENSE +21 -0
- package/references/sessionlog/README.md +453 -0
- package/references/sessionlog/eslint.config.js +58 -0
- package/references/sessionlog/package-lock.json +3672 -0
- package/references/sessionlog/package.json +65 -0
- package/references/sessionlog/src/__tests__/agent-hooks.test.ts +570 -0
- package/references/sessionlog/src/__tests__/agent-registry.test.ts +127 -0
- package/references/sessionlog/src/__tests__/claude-code-hooks.test.ts +225 -0
- package/references/sessionlog/src/__tests__/claude-generator.test.ts +46 -0
- package/references/sessionlog/src/__tests__/commit-msg.test.ts +86 -0
- package/references/sessionlog/src/__tests__/cursor-agent.test.ts +224 -0
- package/references/sessionlog/src/__tests__/e2e-live.test.ts +890 -0
- package/references/sessionlog/src/__tests__/event-log.test.ts +183 -0
- package/references/sessionlog/src/__tests__/flush-sentinel.test.ts +105 -0
- package/references/sessionlog/src/__tests__/gemini-agent.test.ts +375 -0
- package/references/sessionlog/src/__tests__/git-hooks.test.ts +78 -0
- package/references/sessionlog/src/__tests__/hook-managers.test.ts +121 -0
- package/references/sessionlog/src/__tests__/lifecycle-tasks.test.ts +759 -0
- package/references/sessionlog/src/__tests__/opencode-agent.test.ts +338 -0
- package/references/sessionlog/src/__tests__/redaction.test.ts +136 -0
- package/references/sessionlog/src/__tests__/session-repo.test.ts +353 -0
- package/references/sessionlog/src/__tests__/session-store.test.ts +166 -0
- package/references/sessionlog/src/__tests__/setup-ccweb.test.ts +466 -0
- package/references/sessionlog/src/__tests__/skill-live.test.ts +461 -0
- package/references/sessionlog/src/__tests__/summarize.test.ts +348 -0
- package/references/sessionlog/src/__tests__/task-plan-e2e.test.ts +610 -0
- package/references/sessionlog/src/__tests__/task-plan-live.test.ts +632 -0
- package/references/sessionlog/src/__tests__/transcript-timestamp.test.ts +121 -0
- package/references/sessionlog/src/__tests__/types.test.ts +166 -0
- package/references/sessionlog/src/__tests__/utils.test.ts +333 -0
- package/references/sessionlog/src/__tests__/validation.test.ts +103 -0
- package/references/sessionlog/src/__tests__/worktree.test.ts +57 -0
- package/references/sessionlog/src/agent/agents/claude-code.ts +1089 -0
- package/references/sessionlog/src/agent/agents/cursor.ts +361 -0
- package/references/sessionlog/src/agent/agents/gemini-cli.ts +632 -0
- package/references/sessionlog/src/agent/agents/opencode.ts +540 -0
- package/references/sessionlog/src/agent/registry.ts +143 -0
- package/references/sessionlog/src/agent/session-types.ts +113 -0
- package/references/sessionlog/src/agent/types.ts +220 -0
- package/references/sessionlog/src/cli.ts +597 -0
- package/references/sessionlog/src/commands/clean.ts +133 -0
- package/references/sessionlog/src/commands/disable.ts +84 -0
- package/references/sessionlog/src/commands/doctor.ts +145 -0
- package/references/sessionlog/src/commands/enable.ts +202 -0
- package/references/sessionlog/src/commands/explain.ts +261 -0
- package/references/sessionlog/src/commands/reset.ts +105 -0
- package/references/sessionlog/src/commands/resume.ts +180 -0
- package/references/sessionlog/src/commands/rewind.ts +195 -0
- package/references/sessionlog/src/commands/setup-ccweb.ts +275 -0
- package/references/sessionlog/src/commands/status.ts +172 -0
- package/references/sessionlog/src/config.ts +165 -0
- package/references/sessionlog/src/events/event-log.ts +126 -0
- package/references/sessionlog/src/git-operations.ts +558 -0
- package/references/sessionlog/src/hooks/git-hooks.ts +165 -0
- package/references/sessionlog/src/hooks/lifecycle.ts +391 -0
- package/references/sessionlog/src/index.ts +650 -0
- package/references/sessionlog/src/security/redaction.ts +283 -0
- package/references/sessionlog/src/session/state-machine.ts +452 -0
- package/references/sessionlog/src/store/checkpoint-store.ts +509 -0
- package/references/sessionlog/src/store/native-store.ts +173 -0
- package/references/sessionlog/src/store/provider-types.ts +99 -0
- package/references/sessionlog/src/store/session-store.ts +266 -0
- package/references/sessionlog/src/strategy/attribution.ts +296 -0
- package/references/sessionlog/src/strategy/common.ts +207 -0
- package/references/sessionlog/src/strategy/content-overlap.ts +228 -0
- package/references/sessionlog/src/strategy/manual-commit.ts +988 -0
- package/references/sessionlog/src/strategy/types.ts +279 -0
- package/references/sessionlog/src/summarize/claude-generator.ts +115 -0
- package/references/sessionlog/src/summarize/summarize.ts +432 -0
- package/references/sessionlog/src/types.ts +508 -0
- package/references/sessionlog/src/utils/chunk-files.ts +49 -0
- package/references/sessionlog/src/utils/commit-message.ts +65 -0
- package/references/sessionlog/src/utils/detect-agent.ts +36 -0
- package/references/sessionlog/src/utils/hook-managers.ts +125 -0
- package/references/sessionlog/src/utils/ide-tags.ts +32 -0
- package/references/sessionlog/src/utils/paths.ts +79 -0
- package/references/sessionlog/src/utils/preview-rewind.ts +80 -0
- package/references/sessionlog/src/utils/rewind-conflict.ts +121 -0
- package/references/sessionlog/src/utils/shadow-branch.ts +109 -0
- package/references/sessionlog/src/utils/string-utils.ts +46 -0
- package/references/sessionlog/src/utils/todo-extract.ts +188 -0
- package/references/sessionlog/src/utils/trailers.ts +187 -0
- package/references/sessionlog/src/utils/transcript-parse.ts +177 -0
- package/references/sessionlog/src/utils/transcript-timestamp.ts +59 -0
- package/references/sessionlog/src/utils/tree-ops.ts +219 -0
- package/references/sessionlog/src/utils/tty.ts +72 -0
- package/references/sessionlog/src/utils/validation.ts +65 -0
- package/references/sessionlog/src/utils/worktree.ts +58 -0
- package/references/sessionlog/src/wire-types.ts +59 -0
- package/references/sessionlog/templates/setup-env.sh +153 -0
- package/references/sessionlog/tsconfig.json +18 -0
- package/references/sessionlog/vitest.config.ts +12 -0
- package/references/skill-tree/.claude/settings.json +6 -0
- package/references/skill-tree/.sudocode/issues.jsonl +19 -0
- package/references/skill-tree/.sudocode/specs.jsonl +3 -0
- package/references/skill-tree/CLAUDE.md +126 -0
- package/references/skill-tree/README.md +372 -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 +164 -0
- package/references/skill-tree/package-lock.json +1852 -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/src/atlas.ts +583 -41
- package/src/bin/cli-utils.ts +220 -0
- package/src/bin/cognitive-core.ts +84 -392
- package/src/bin/commands/kb.ts +266 -0
- package/src/bin/commands/learn.ts +100 -0
- package/src/bin/commands/legacy.ts +182 -0
- package/src/bin/commands/run.ts +113 -0
- package/src/bin/commands/sessions.ts +221 -0
- package/src/bin/commands/skills.ts +146 -0
- package/src/embeddings/index.ts +3 -0
- package/src/embeddings/inverted-index.ts +134 -0
- package/src/embeddings/manager.ts +13 -8
- package/src/embeddings/provider.ts +10 -3
- package/src/embeddings/vector-store.ts +21 -9
- package/src/factory.ts +33 -16
- package/src/index.ts +231 -9
- package/src/learning/analyzer.ts +21 -37
- package/src/learning/energy-evaluator.ts +282 -0
- package/src/learning/healing-orchestrator.ts +383 -0
- package/src/learning/index.ts +104 -13
- package/src/learning/instant-loop.ts +357 -0
- package/src/learning/knowledge-extractor.ts +470 -0
- package/src/learning/maintenance-scheduler.ts +271 -0
- package/src/learning/meta-learner.ts +59 -23
- package/src/learning/reflexion-generator.ts +273 -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 +251 -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/unified-pipeline.ts +921 -0
- package/src/memory/candidate-retrieval.ts +71 -0
- package/src/memory/causal-store.ts +273 -0
- package/src/memory/coherence.ts +252 -0
- package/src/memory/experience.ts +217 -50
- 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 +88 -0
- package/src/memory/knowledge-bank.ts +1317 -0
- package/src/memory/knowledge-defrag.ts +329 -0
- package/src/memory/knowledge-graph.ts +361 -0
- package/src/memory/meta.ts +78 -96
- package/src/memory/playbook.ts +239 -75
- package/src/memory/reasoning-bank.ts +458 -0
- package/src/memory/reflexion.ts +122 -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 +80 -11
- package/src/memory/team-experience.ts +604 -0
- package/src/memory/temporal-compressor.ts +409 -0
- package/src/persistence/index.ts +37 -0
- package/src/persistence/migrator.ts +298 -0
- package/src/persistence/serializers.ts +79 -0
- package/src/persistence/sqlite-persistence.ts +925 -0
- package/src/runtime/backends/acp-protocol.ts +231 -0
- package/src/runtime/backends/acp.ts +57 -196
- package/src/runtime/backends/index.ts +14 -0
- package/src/runtime/backends/macro-agent.ts +177 -0
- package/src/runtime/compute-provider.ts +206 -0
- package/src/runtime/flows/learning.ts +25 -42
- package/src/runtime/index.ts +22 -0
- package/src/runtime/manager.ts +167 -23
- package/src/runtime/types.ts +41 -0
- package/src/search/evaluator.ts +29 -4
- package/src/search/index.ts +19 -0
- package/src/search/moe-gate.ts +304 -0
- package/src/search/refinement-loop.ts +106 -12
- package/src/search/router.ts +111 -4
- package/src/search/team-router.ts +459 -0
- package/src/session-bank/git-reader.ts +200 -0
- package/src/session-bank/index.ts +26 -0
- package/src/session-bank/parser.ts +548 -0
- package/src/session-bank/session-bank.ts +485 -0
- package/src/session-bank/types.ts +176 -0
- package/src/surfacing/index.ts +23 -0
- package/src/surfacing/publisher.ts +23 -0
- package/src/surfacing/skill-library.ts +31 -0
- package/src/surfacing/skill-publisher.ts +191 -0
- package/src/surfacing/sqlite-storage-adapter.ts +285 -0
- package/src/surfacing/team-skill-library.ts +610 -0
- package/src/types/config.ts +282 -0
- package/src/types/dataclaw.ts +99 -0
- package/src/types/huggingface-transformers.d.ts +12 -0
- package/src/types/index.ts +159 -0
- package/src/types/knowledge-graph.ts +246 -0
- package/src/types/knowledge.ts +388 -0
- package/src/types/memory.ts +30 -0
- package/src/types/playbook.ts +4 -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/utils/error-classifier.ts +113 -0
- package/src/utils/frontmatter.ts +118 -0
- package/src/utils/index.ts +25 -0
- package/src/utils/partitioned-store.ts +299 -0
- package/src/utils/trajectory-helpers.ts +79 -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 +241 -0
- package/tests/atlas-knowledge.test.ts +165 -0
- package/tests/embeddings/inverted-index.test.ts +138 -0
- package/tests/feature-toggles.test.ts +275 -0
- package/tests/gap-fixes.test.ts +1116 -0
- package/tests/integration/cli-e2e.test.ts +621 -0
- package/tests/integration/dataclaw-e2e.test.ts +559 -0
- package/tests/integration/e2e.test.ts +412 -4
- package/tests/integration/entire-e2e.test.ts +376 -0
- package/tests/integration/huggingface-e2e.test.ts +627 -0
- package/tests/integration/persistence-e2e.test.ts +741 -0
- package/tests/integration/phase-e2e.test.ts +1143 -0
- package/tests/integration/session-bank.test.ts +231 -0
- package/tests/integration/sessionlog-e2e.test.ts +329 -0
- package/tests/integration/skill-tree-wiring.test.ts +152 -0
- package/tests/integration/unified-pipeline-e2e.test.ts +634 -0
- package/tests/learning/analyzer.test.ts +1 -1
- package/tests/learning/dataclaw-trajectory-source.test.ts +642 -0
- package/tests/learning/energy-evaluator.test.ts +180 -0
- package/tests/learning/entire-trajectory-source.test.ts +380 -0
- package/tests/learning/healing-orchestrator.test.ts +269 -0
- package/tests/learning/huggingface-trajectory-source.test.ts +817 -0
- package/tests/learning/instant-loop.test.ts +243 -0
- package/tests/learning/knowledge-extractor.test.ts +491 -0
- package/tests/learning/maintenance-scheduler.test.ts +191 -0
- package/tests/learning/reflexion-generator.test.ts +411 -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 +320 -0
- package/tests/learning/unified-pipeline.test.ts +322 -0
- package/tests/mcp/playbook-server.test.ts +6 -1
- package/tests/memory/causal-store.test.ts +276 -0
- package/tests/memory/coherence.test.ts +232 -0
- package/tests/memory/experience.test.ts +8 -3
- 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 +307 -1
- package/tests/memory/provenance.test.ts +11 -2
- package/tests/memory/reasoning-bank.test.ts +239 -0
- package/tests/memory/reflexion.test.ts +166 -0
- package/tests/memory/skill-exporter.test.ts +475 -0
- package/tests/memory/system.test.ts +6 -1
- package/tests/memory/team-experience.test.ts +411 -0
- package/tests/memory/temporal-compressor.test.ts +318 -0
- package/tests/persistence/migrator.test.ts +1009 -0
- package/tests/persistence/sqlite-persistence.test.ts +635 -0
- package/tests/runtime/agent-manager.test.ts +7 -2
- package/tests/runtime/compute-provider.test.ts +288 -0
- package/tests/runtime/delegate.test.ts +354 -0
- package/tests/runtime/macro-agent-backend.test.ts +266 -0
- package/tests/search/moe-gate.test.ts +250 -0
- package/tests/search/refinement-loop.test.ts +11 -2
- package/tests/search/router.test.ts +81 -2
- 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/sessionlog-root-metadata.json +16 -0
- package/tests/session-bank/fixtures/sessionlog-session/full.jsonl +6 -0
- package/tests/session-bank/fixtures/sessionlog-session/metadata.json +55 -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 +453 -0
- package/tests/session-bank/session-bank.test.ts +546 -0
- package/tests/surfacing/skill-library.test.ts +6 -1
- package/tests/surfacing/skill-publisher.test.ts +364 -0
- package/tests/surfacing/sqlite-storage-adapter.test.ts +206 -0
- package/tests/surfacing/team-skill-library.test.ts +444 -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/utils/frontmatter.test.ts +208 -0
- package/tests/utils/partitioned-store.test.ts +230 -0
- package/tests/workspace/full-flow.test.ts +845 -0
- package/tests/workspace/manager.test.ts +215 -0
- package/tests/workspace/runner.test.ts +336 -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/src/learning/llm-extractor.ts +0 -542
- package/src/learning/pipeline.ts +0 -244
- package/tests/learning/pipeline.test.ts +0 -176
|
@@ -0,0 +1,1369 @@
|
|
|
1
|
+
# Design: Team Knowledge Extraction Pipeline
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This document describes the pipeline that transforms raw multi-agent team execution data into reusable knowledge. It builds on the research findings in `RESEARCH-team-trajectory-learning.md` and the team-aware learning proposal in `PROPOSAL-team-aware-learning.md`.
|
|
6
|
+
|
|
7
|
+
The pipeline mirrors the existing individual learning pipeline (`LearningPipeline.processTrajectory()` → `TrajectoryAnalyzer` → `PlaybookExtractor`), but operates on a **graph of interconnected trajectories** rather than a single linear trajectory, and uses **agentic analysis** rather than direct LLM calls.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Core Design Decisions
|
|
12
|
+
|
|
13
|
+
### 1. Team trajectory as a graph, not a flat event stream
|
|
14
|
+
|
|
15
|
+
A team trajectory is a set of individual `Trajectory` objects (nodes) connected by `AgentInteraction` edges. Individual trajectories are the existing type, unchanged. The interactions form a causal DAG overlaid on the linear trajectories.
|
|
16
|
+
|
|
17
|
+
### 2. Agentic analysis, not raw LLM calls
|
|
18
|
+
|
|
19
|
+
The analysis phases spawn full agents (via the existing `AgentManager`) with filesystem workspaces, tool access, and injected knowledge. This allows iterative, tool-assisted analysis rather than single-prompt extraction. The analysis agents' own trajectories are captured for meta-learning.
|
|
20
|
+
|
|
21
|
+
### 3. Three playbook types emerge from team analysis
|
|
22
|
+
|
|
23
|
+
- **Role playbooks**: How to be effective in a specific team role (surfaced to agents when assigned roles)
|
|
24
|
+
- **Team coordination playbooks**: How to compose and coordinate a team (surfaced during team formation)
|
|
25
|
+
- **Meta-learning signals**: Observations about team formation decisions and analysis quality (fed back into routing and future analysis)
|
|
26
|
+
|
|
27
|
+
### 4. Compression and critical step identification combined
|
|
28
|
+
|
|
29
|
+
A single computational pass reduces the data before expensive agentic analysis. Simple structural methods first (pattern stripping, step folding), LLM summarization only as fallback.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Phase 1-2: Ingest, Compress, Prepare Workspace
|
|
34
|
+
|
|
35
|
+
### Input
|
|
36
|
+
|
|
37
|
+
The entry point receives individual trajectories tagged with interaction metadata at runtime by OpenTeams:
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
interface TeamTrajectoryInput {
|
|
41
|
+
/** High-level objective */
|
|
42
|
+
objective: string;
|
|
43
|
+
domain: string;
|
|
44
|
+
complexity: 'simple' | 'moderate' | 'complex' | 'epic';
|
|
45
|
+
|
|
46
|
+
/** Team structure snapshot */
|
|
47
|
+
teamName: string;
|
|
48
|
+
templateName: string;
|
|
49
|
+
topologyType: 'hierarchical' | 'flat' | 'wave' | 'custom';
|
|
50
|
+
enforcement: 'strict' | 'permissive' | 'audit';
|
|
51
|
+
|
|
52
|
+
/** Individual trajectories with interaction tags in step metadata */
|
|
53
|
+
memberTrajectories: {
|
|
54
|
+
agentId: string;
|
|
55
|
+
role: string;
|
|
56
|
+
trajectory: Trajectory; // existing type, unchanged
|
|
57
|
+
}[];
|
|
58
|
+
|
|
59
|
+
/** Declared expected interaction patterns from team.yaml */
|
|
60
|
+
expectedPatterns?: ExpectedInteractionPattern[];
|
|
61
|
+
|
|
62
|
+
/** Team-level outcome */
|
|
63
|
+
outcome: TeamOutcome;
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Runtime interaction tagging ensures each cross-agent step has metadata:
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
// Present in step.metadata when the step involves another agent
|
|
71
|
+
interface InteractionTag {
|
|
72
|
+
interactionId: string; // shared ID linking source + target
|
|
73
|
+
interactionType: InteractionType;
|
|
74
|
+
counterpartAgentId: string;
|
|
75
|
+
stepRole: 'source' | 'target';
|
|
76
|
+
channel?: string; // for signal interactions
|
|
77
|
+
signal?: string; // for signal interactions
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
type InteractionType =
|
|
81
|
+
| 'delegation'
|
|
82
|
+
| 'result_return'
|
|
83
|
+
| 'message'
|
|
84
|
+
| 'signal'
|
|
85
|
+
| 'spawn'
|
|
86
|
+
| 'escalation';
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Processing
|
|
90
|
+
|
|
91
|
+
This phase is entirely computational — no LLM calls.
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
class TeamTrajectoryIngester {
|
|
95
|
+
/**
|
|
96
|
+
* Build graph, compress, identify critical moments, prepare workspace.
|
|
97
|
+
* Combines what was previously Phases 1-3 into a single pass.
|
|
98
|
+
*/
|
|
99
|
+
async ingest(input: TeamTrajectoryInput): Promise<AnalysisWorkspace> {
|
|
100
|
+
|
|
101
|
+
// 1. BUILD INTERACTION GRAPH
|
|
102
|
+
// - Extract interaction tags from all member step metadata
|
|
103
|
+
// - Group by interactionId, link source step to target step
|
|
104
|
+
// - Validate: no dangling edges, timestamps monotonic
|
|
105
|
+
// - Flag interactions as expected vs emergent
|
|
106
|
+
// (compare to input.expectedPatterns)
|
|
107
|
+
|
|
108
|
+
// 2. COMPUTE STRUCTURAL METRICS
|
|
109
|
+
// - Per-agent: step count, tool calls, tokens, outcome
|
|
110
|
+
// - Per-interaction: latency, content length, type distribution
|
|
111
|
+
// - Graph-level: interaction density, max in/out degree,
|
|
112
|
+
// bottleneck detection, parallelism ratio
|
|
113
|
+
|
|
114
|
+
// 3. COMPRESS PER-AGENT TRAJECTORIES
|
|
115
|
+
// - Identify interaction boundary steps (tagged with interactionId)
|
|
116
|
+
// → always preserve at full fidelity
|
|
117
|
+
// - Between boundaries, fold internal steps:
|
|
118
|
+
// structural first (strip verbose output, collapse consecutive
|
|
119
|
+
// non-key steps), LLM fallback only if still over budget
|
|
120
|
+
// - Remove token waste: repeated failed attempts (keep first + last),
|
|
121
|
+
// full file contents in observations, long stack traces
|
|
122
|
+
|
|
123
|
+
// 4. SCORE STEPS AND INTERACTIONS
|
|
124
|
+
// - Step scores: promise (position-based) + progress (action type)
|
|
125
|
+
// + interaction bonus (boundary steps score higher)
|
|
126
|
+
// - Interaction scores: downstream success + latency penalty
|
|
127
|
+
// + expected pattern bonus + information density
|
|
128
|
+
// - Mark top ~20% as critical
|
|
129
|
+
|
|
130
|
+
// 5. PREPARE WORKSPACE FILESYSTEM
|
|
131
|
+
// - Write compressed trajectories, interaction graph, metrics,
|
|
132
|
+
// team config, outcome, and critical moment annotations
|
|
133
|
+
// to a temporary workspace directory
|
|
134
|
+
|
|
135
|
+
return workspace;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Output: The Analysis Workspace
|
|
141
|
+
|
|
142
|
+
The workspace is a filesystem directory that the analysis agent will use as its working environment:
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
/tmp/team-analysis-{id}/
|
|
146
|
+
├── input/ # Read-only context for the agent
|
|
147
|
+
│ ├── objective.md # Team objective + domain + complexity
|
|
148
|
+
│ ├── team-config.json # Topology, roles, expected patterns,
|
|
149
|
+
│ │ # enforcement mode
|
|
150
|
+
│ ├── outcome.json # Team outcome + per-member outcomes
|
|
151
|
+
│ ├── structural-metrics.json # Graph-level metrics computed above
|
|
152
|
+
│ ├── critical-moments.json # Annotated critical steps/interactions
|
|
153
|
+
│ │ # with scores
|
|
154
|
+
│ ├── trajectories/
|
|
155
|
+
│ │ ├── planner.json # Compressed trajectory for planner
|
|
156
|
+
│ │ ├── executor-1.json # Compressed trajectory for executor-1
|
|
157
|
+
│ │ ├── executor-2.json # etc.
|
|
158
|
+
│ │ └── verifier.json
|
|
159
|
+
│ └── interactions/
|
|
160
|
+
│ ├── graph.json # Interaction edges with timing, content,
|
|
161
|
+
│ │ # expected/emergent flags
|
|
162
|
+
│ └── timeline.json # Same interactions in chronological order
|
|
163
|
+
│
|
|
164
|
+
├── workspace/ # Agent's scratch space (read-write)
|
|
165
|
+
│ └── (agent creates notes, intermediate analysis, etc.)
|
|
166
|
+
│
|
|
167
|
+
└── output/ # Agent writes structured results here
|
|
168
|
+
├── agent-credits.json # Per-agent contribution assessment
|
|
169
|
+
├── interaction-credits.json # Per-interaction value assessment
|
|
170
|
+
├── coordination-assessment.json # Overall pattern analysis
|
|
171
|
+
├── role-lessons/ # Per-role insights
|
|
172
|
+
│ ├── planner.json
|
|
173
|
+
│ ├── executor.json
|
|
174
|
+
│ └── verifier.json
|
|
175
|
+
├── team-lessons.json # Team-level coordination insights
|
|
176
|
+
└── meta-observations.json # Observations about team formation
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Key Types
|
|
180
|
+
|
|
181
|
+
```typescript
|
|
182
|
+
interface AnalysisWorkspace {
|
|
183
|
+
/** Workspace root directory */
|
|
184
|
+
path: string;
|
|
185
|
+
|
|
186
|
+
/** The built team trajectory (full graph structure) */
|
|
187
|
+
teamTrajectory: TeamTrajectory;
|
|
188
|
+
|
|
189
|
+
/** Compression statistics */
|
|
190
|
+
compressionStats: {
|
|
191
|
+
originalTokens: number;
|
|
192
|
+
compressedTokens: number;
|
|
193
|
+
ratio: number;
|
|
194
|
+
stepsPreserved: number;
|
|
195
|
+
stepsFolded: number;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
/** Critical moment annotations */
|
|
199
|
+
criticalMoments: {
|
|
200
|
+
criticalSteps: Map<string, CriticalStep[]>;
|
|
201
|
+
criticalInteractions: CriticalInteraction[];
|
|
202
|
+
totalSteps: number;
|
|
203
|
+
criticalRatio: number;
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
interface TeamTrajectory {
|
|
208
|
+
id: string;
|
|
209
|
+
objective: string;
|
|
210
|
+
domain: string;
|
|
211
|
+
complexity: 'simple' | 'moderate' | 'complex' | 'epic';
|
|
212
|
+
|
|
213
|
+
teamName: string;
|
|
214
|
+
templateName: string;
|
|
215
|
+
topologyType: 'hierarchical' | 'flat' | 'wave' | 'custom';
|
|
216
|
+
|
|
217
|
+
members: MemberTrajectory[];
|
|
218
|
+
interactions: AgentInteraction[];
|
|
219
|
+
expectedPatterns: ExpectedInteractionPattern[];
|
|
220
|
+
|
|
221
|
+
outcome: TeamOutcome;
|
|
222
|
+
structuralMetrics: StructuralMetrics;
|
|
223
|
+
|
|
224
|
+
timestamp: Date;
|
|
225
|
+
metadata: Record<string, unknown>;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
interface MemberTrajectory {
|
|
229
|
+
agentId: string;
|
|
230
|
+
role: string;
|
|
231
|
+
trajectory: Trajectory; // existing cognitive-core type
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
interface AgentInteraction {
|
|
235
|
+
id: string;
|
|
236
|
+
type: InteractionType;
|
|
237
|
+
from: { agentId: string; role: string; stepIndex: number };
|
|
238
|
+
to: { agentId: string; role: string; stepIndex: number };
|
|
239
|
+
content: string;
|
|
240
|
+
channel?: string;
|
|
241
|
+
signal?: string;
|
|
242
|
+
timestamp: Date;
|
|
243
|
+
latencyMs?: number;
|
|
244
|
+
wasExpected: boolean;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
interface StructuralMetrics {
|
|
248
|
+
teamSize: number;
|
|
249
|
+
totalSteps: number;
|
|
250
|
+
totalInteractions: number;
|
|
251
|
+
interactionDensity: number; // interactions / steps
|
|
252
|
+
maxInDegree: { agentId: string; count: number };
|
|
253
|
+
maxOutDegree: { agentId: string; count: number };
|
|
254
|
+
parallelismRatio: number;
|
|
255
|
+
totalWallTimeSeconds: number;
|
|
256
|
+
totalTokens: number;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
interface CriticalStep {
|
|
260
|
+
agentId: string;
|
|
261
|
+
role: string;
|
|
262
|
+
stepIndex: number;
|
|
263
|
+
step: Step;
|
|
264
|
+
scores: {
|
|
265
|
+
promise: number;
|
|
266
|
+
progress: number;
|
|
267
|
+
interactionBonus: number;
|
|
268
|
+
total: number;
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
interface CriticalInteraction {
|
|
273
|
+
interaction: AgentInteraction;
|
|
274
|
+
scores: {
|
|
275
|
+
downstreamSuccess: number;
|
|
276
|
+
latencyPenalty: number;
|
|
277
|
+
expectedBonus: number;
|
|
278
|
+
informationDensity: number;
|
|
279
|
+
total: number;
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### Compression Configuration
|
|
285
|
+
|
|
286
|
+
```typescript
|
|
287
|
+
interface CompressionConfig {
|
|
288
|
+
/** Max tokens per agent trajectory after compression */
|
|
289
|
+
maxTokensPerAgent: number; // default: 5000
|
|
290
|
+
|
|
291
|
+
/** Always preserve steps at interaction boundaries */
|
|
292
|
+
preserveInteractionBoundaries: boolean; // default: true
|
|
293
|
+
|
|
294
|
+
/** Max consecutive non-interaction steps before folding */
|
|
295
|
+
foldThreshold: number; // default: 5
|
|
296
|
+
|
|
297
|
+
/** Patterns to strip from observations (verbose tool output, etc.) */
|
|
298
|
+
stripPatterns: RegExp[]; // default: common verbose patterns
|
|
299
|
+
|
|
300
|
+
/** Fraction of steps to mark as critical */
|
|
301
|
+
maxCriticalRatio: number; // default: 0.25
|
|
302
|
+
|
|
303
|
+
/** Minimum score threshold for critical steps */
|
|
304
|
+
criticalStepThreshold: number; // default: 0.3
|
|
305
|
+
|
|
306
|
+
/** Minimum score threshold for critical interactions */
|
|
307
|
+
criticalInteractionThreshold: number; // default: 0.3
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## Phase 3: Agentic Analysis
|
|
314
|
+
|
|
315
|
+
### Design Philosophy
|
|
316
|
+
|
|
317
|
+
Instead of `llmClient.complete(prompt)` returning structured JSON, we spawn a full agent via the existing `AgentManager`. The analysis agent gets:
|
|
318
|
+
|
|
319
|
+
- A **filesystem workspace** with the trajectory data as files it can selectively read
|
|
320
|
+
- **Tool access** to search, read, write, and compute — the same tools any Claude Code agent has
|
|
321
|
+
- **Injected knowledge** from past team analysis (team playbooks, analysis meta-playbooks, similar team experiences)
|
|
322
|
+
- **Trajectory capture** — the agent's own execution is recorded and fed through the individual learning pipeline, producing meta-learning about how to analyze teams
|
|
323
|
+
|
|
324
|
+
This uses the exact same infrastructure as task-solving agents. The only difference is the "task" is analysis rather than implementation.
|
|
325
|
+
|
|
326
|
+
### Agent Spawn Configuration
|
|
327
|
+
|
|
328
|
+
Maps directly to the existing `AgentSpawnConfig`:
|
|
329
|
+
|
|
330
|
+
```typescript
|
|
331
|
+
function buildAnalysisSpawnConfig(
|
|
332
|
+
workspace: AnalysisWorkspace,
|
|
333
|
+
injectedKnowledge: MemoryQueryResultV2
|
|
334
|
+
): AgentSpawnConfig {
|
|
335
|
+
return {
|
|
336
|
+
agentType: 'claude-code',
|
|
337
|
+
|
|
338
|
+
task: {
|
|
339
|
+
id: `team-analysis-${workspace.teamTrajectory.id}`,
|
|
340
|
+
domain: 'team-analysis',
|
|
341
|
+
description: ANALYSIS_TASK_PROMPT, // see below
|
|
342
|
+
context: {
|
|
343
|
+
teamTrajectoryId: workspace.teamTrajectory.id,
|
|
344
|
+
objective: workspace.teamTrajectory.objective,
|
|
345
|
+
teamSize: workspace.teamTrajectory.members.length,
|
|
346
|
+
topologyType: workspace.teamTrajectory.topologyType,
|
|
347
|
+
outcome: workspace.teamTrajectory.outcome,
|
|
348
|
+
compressionRatio: workspace.compressionStats.ratio,
|
|
349
|
+
criticalRatio: workspace.criticalMoments.criticalRatio,
|
|
350
|
+
},
|
|
351
|
+
},
|
|
352
|
+
|
|
353
|
+
cwd: workspace.path,
|
|
354
|
+
injectedKnowledge,
|
|
355
|
+
captureToolCalls: true,
|
|
356
|
+
timeout: 300_000, // 5 minutes for analysis
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
### Analysis Task Prompt
|
|
362
|
+
|
|
363
|
+
The agent receives a task description that explains the workspace layout and expected output:
|
|
364
|
+
|
|
365
|
+
```typescript
|
|
366
|
+
const ANALYSIS_TASK_PROMPT = `
|
|
367
|
+
Analyze a multi-agent team execution and extract learning signals.
|
|
368
|
+
|
|
369
|
+
## Workspace Layout
|
|
370
|
+
|
|
371
|
+
input/ - Read-only team execution data
|
|
372
|
+
objective.md - What the team was trying to accomplish
|
|
373
|
+
team-config.json - Team structure and expected interaction patterns
|
|
374
|
+
outcome.json - Team and per-member outcomes
|
|
375
|
+
structural-metrics.json - Pre-computed graph metrics
|
|
376
|
+
critical-moments.json - Steps and interactions flagged as high-impact
|
|
377
|
+
trajectories/ - Per-agent compressed execution traces
|
|
378
|
+
interactions/
|
|
379
|
+
graph.json - Interaction edges between agents
|
|
380
|
+
timeline.json - Chronological interaction sequence
|
|
381
|
+
|
|
382
|
+
workspace/ - Your scratch space for notes and analysis
|
|
383
|
+
|
|
384
|
+
output/ - Write your structured analysis here
|
|
385
|
+
|
|
386
|
+
## Your Task
|
|
387
|
+
|
|
388
|
+
1. Read the objective, outcome, and team config to understand the context.
|
|
389
|
+
|
|
390
|
+
2. Examine the interaction graph and structural metrics to identify
|
|
391
|
+
coordination patterns, bottlenecks, and communication efficiency.
|
|
392
|
+
|
|
393
|
+
3. Read the critical moments annotations, then selectively read the
|
|
394
|
+
relevant compressed trajectories to understand what happened at
|
|
395
|
+
each critical step.
|
|
396
|
+
|
|
397
|
+
4. For each agent/role, assess their contribution to the team outcome.
|
|
398
|
+
Write per-agent credit assessments to output/agent-credits.json.
|
|
399
|
+
|
|
400
|
+
5. For each critical interaction, assess whether it was helpful, neutral,
|
|
401
|
+
or harmful. Write to output/interaction-credits.json.
|
|
402
|
+
|
|
403
|
+
6. Identify coordination patterns (both designed and emergent) and
|
|
404
|
+
anti-patterns. Write to output/coordination-assessment.json.
|
|
405
|
+
|
|
406
|
+
7. Extract role-specific lessons — what each role did well and what
|
|
407
|
+
could improve. Write to output/role-lessons/{role}.json.
|
|
408
|
+
|
|
409
|
+
8. Extract team-level lessons about composition and coordination.
|
|
410
|
+
Write to output/team-lessons.json.
|
|
411
|
+
|
|
412
|
+
9. Record observations about the team formation decision itself.
|
|
413
|
+
Write to output/meta-observations.json.
|
|
414
|
+
|
|
415
|
+
Use the workspace/ directory for any intermediate notes or analysis.
|
|
416
|
+
Refer to critical-moments.json to focus your analysis on the steps
|
|
417
|
+
and interactions that most influenced the outcome.
|
|
418
|
+
`;
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
### Knowledge Injection
|
|
422
|
+
|
|
423
|
+
The analysis agent receives three types of injected knowledge:
|
|
424
|
+
|
|
425
|
+
```typescript
|
|
426
|
+
async function getAnalysisKnowledge(
|
|
427
|
+
memory: MemorySystem,
|
|
428
|
+
teamMemory: TeamMemorySystem,
|
|
429
|
+
workspace: AnalysisWorkspace
|
|
430
|
+
): Promise<MemoryQueryResultV2> {
|
|
431
|
+
|
|
432
|
+
// 1. Team playbooks for similar task types
|
|
433
|
+
// So the agent knows what "good" team coordination looks like
|
|
434
|
+
const teamPlaybooks = await teamMemory.findMatchingTeamPlaybooks({
|
|
435
|
+
taskType: workspace.teamTrajectory.objective,
|
|
436
|
+
domain: workspace.teamTrajectory.domain,
|
|
437
|
+
topology: workspace.teamTrajectory.topologyType,
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
// 2. Past team analysis experiences
|
|
441
|
+
// So the agent can see how similar teams were analyzed before
|
|
442
|
+
const pastAnalyses = await teamMemory.findSimilarTeamExperiences({
|
|
443
|
+
objective: workspace.teamTrajectory.objective,
|
|
444
|
+
domain: workspace.teamTrajectory.domain,
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
// 3. Analysis meta-playbooks
|
|
448
|
+
// Playbooks about HOW to analyze (learned from past analysis agents)
|
|
449
|
+
// These live in the regular playbook library under domain "team-analysis"
|
|
450
|
+
const analysisPlaybooks = await memory.queryV2(
|
|
451
|
+
'analyze multi-agent team execution extract learning signals',
|
|
452
|
+
{ domains: ['team-analysis'] }
|
|
453
|
+
);
|
|
454
|
+
|
|
455
|
+
return mergeKnowledge(teamPlaybooks, pastAnalyses, analysisPlaybooks);
|
|
456
|
+
}
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
The agent's system prompt includes both task-specific team playbooks and analysis meta-playbooks:
|
|
460
|
+
|
|
461
|
+
```markdown
|
|
462
|
+
## Atlas Knowledge
|
|
463
|
+
|
|
464
|
+
### Applicable Team Playbooks
|
|
465
|
+
#### wave-parallel-feature-development (78% match)
|
|
466
|
+
**Composition:** planner + executors + verifier in wave topology
|
|
467
|
+
**Key Patterns:**
|
|
468
|
+
- plan-then-execute: Planner creates all tasks before executors start
|
|
469
|
+
- direct-verifier-subscription: Verifier subscribes to executor output
|
|
470
|
+
**Success Indicators:**
|
|
471
|
+
- coordination overhead < 25%
|
|
472
|
+
- all wave tasks complete before next wave
|
|
473
|
+
|
|
474
|
+
### Analysis Guidance
|
|
475
|
+
#### team-bottleneck-detection (92% confidence)
|
|
476
|
+
**Strategy:** For teams with >4 agents, check interaction graph
|
|
477
|
+
in-degree first to identify bottleneck agents
|
|
478
|
+
**Tactics:**
|
|
479
|
+
- Read structural-metrics.json maxInDegree before trajectories
|
|
480
|
+
- Compare actual interaction patterns to expected patterns
|
|
481
|
+
- Bottleneck agents often have >40% of inbound interactions
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
### The Meta-Learning Feedback Loop
|
|
485
|
+
|
|
486
|
+
The analysis agent's own trajectory is captured via the existing `DefaultTrajectoryExtractor` and fed through the individual `LearningPipeline`:
|
|
487
|
+
|
|
488
|
+
```
|
|
489
|
+
Analysis agent executes
|
|
490
|
+
│
|
|
491
|
+
├─ AgentManager.spawn() → AgentSession
|
|
492
|
+
├─ DefaultTrajectoryExtractor.extract() → Trajectory
|
|
493
|
+
│ (domain: "team-analysis")
|
|
494
|
+
│
|
|
495
|
+
├─ LearningPipeline.processTrajectory()
|
|
496
|
+
│ → TrajectoryAnalyzer.analyze()
|
|
497
|
+
│ → ExperienceMemory.store()
|
|
498
|
+
│ → accumulate for batch learning
|
|
499
|
+
│
|
|
500
|
+
└─ Eventually: PlaybookExtractor.extract()
|
|
501
|
+
→ Playbooks in domain "team-analysis"
|
|
502
|
+
→ Injected into FUTURE analysis agents
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
Over time, the system learns how to analyze teams better:
|
|
506
|
+
|
|
507
|
+
- "Reading structural-metrics.json before trajectories leads to faster bottleneck identification"
|
|
508
|
+
- "Writing notes in workspace/notes.md before producing output improves analysis quality"
|
|
509
|
+
- "For large teams (>5 agents), focus on interaction graph topology before individual trajectories"
|
|
510
|
+
|
|
511
|
+
These become playbooks in the "team-analysis" domain, surfaced via the existing `SkillLibrary` to future analysis agents.
|
|
512
|
+
|
|
513
|
+
### Output Schema
|
|
514
|
+
|
|
515
|
+
The analysis agent writes JSON files to the `output/` directory. The pipeline reads and validates them after the agent completes.
|
|
516
|
+
|
|
517
|
+
```typescript
|
|
518
|
+
// output/agent-credits.json
|
|
519
|
+
interface AgentCreditOutput {
|
|
520
|
+
credits: AgentCredit[];
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
interface AgentCredit {
|
|
524
|
+
agentId: string;
|
|
525
|
+
role: string;
|
|
526
|
+
/** Overall contribution to team outcome, 0-1 */
|
|
527
|
+
contributionScore: number;
|
|
528
|
+
/** Natural language assessment of this agent's performance */
|
|
529
|
+
assessment: string;
|
|
530
|
+
/** Per-critical-step attribution with reasoning */
|
|
531
|
+
stepAttributions: {
|
|
532
|
+
stepIndex: number;
|
|
533
|
+
attribution: number; // -1 to 1
|
|
534
|
+
reasoning: string;
|
|
535
|
+
}[];
|
|
536
|
+
/** Was this role necessary for this task? */
|
|
537
|
+
roleAssessment: 'essential' | 'helpful' | 'neutral' | 'redundant';
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
// output/interaction-credits.json
|
|
541
|
+
interface InteractionCreditOutput {
|
|
542
|
+
credits: InteractionCredit[];
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
interface InteractionCredit {
|
|
546
|
+
interactionId: string;
|
|
547
|
+
type: InteractionType;
|
|
548
|
+
fromRole: string;
|
|
549
|
+
toRole: string;
|
|
550
|
+
/** Was this interaction helpful, neutral, or harmful? */
|
|
551
|
+
value: 'helpful' | 'neutral' | 'harmful';
|
|
552
|
+
/** Credit score, -1 to 1 */
|
|
553
|
+
creditScore: number;
|
|
554
|
+
/** Natural language explanation */
|
|
555
|
+
reasoning: string;
|
|
556
|
+
/** Was this interaction necessary? */
|
|
557
|
+
necessity: 'critical' | 'useful' | 'unnecessary' | 'harmful';
|
|
558
|
+
/** How well-specified was the exchanged information? 0-1 */
|
|
559
|
+
contentQuality: number;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
// output/coordination-assessment.json
|
|
563
|
+
interface CoordinationAssessmentOutput {
|
|
564
|
+
/** Overall coordination quality */
|
|
565
|
+
quality: 'excellent' | 'good' | 'acceptable' | 'poor';
|
|
566
|
+
/** Coordination patterns observed */
|
|
567
|
+
observedPatterns: {
|
|
568
|
+
name: string;
|
|
569
|
+
description: string;
|
|
570
|
+
roles: string[];
|
|
571
|
+
interactionIds: string[];
|
|
572
|
+
correlatedWithSuccess: boolean;
|
|
573
|
+
}[];
|
|
574
|
+
/** Anti-patterns observed */
|
|
575
|
+
observedAntiPatterns: {
|
|
576
|
+
name: string;
|
|
577
|
+
description: string;
|
|
578
|
+
roles: string[];
|
|
579
|
+
interactionIds: string[];
|
|
580
|
+
impact: string;
|
|
581
|
+
suggestedFix: string;
|
|
582
|
+
}[];
|
|
583
|
+
/** Comparison to expected patterns from team.yaml */
|
|
584
|
+
patternComparison: {
|
|
585
|
+
expected: string;
|
|
586
|
+
observed: 'followed' | 'deviated' | 'absent';
|
|
587
|
+
impact: string;
|
|
588
|
+
}[];
|
|
589
|
+
/** Emergent coordination not declared but observed */
|
|
590
|
+
emergentCoordination: {
|
|
591
|
+
description: string;
|
|
592
|
+
wasHelpful: boolean;
|
|
593
|
+
shouldBeFormalized: boolean;
|
|
594
|
+
}[];
|
|
595
|
+
/** 2-3 paragraph narrative summary */
|
|
596
|
+
narrative: string;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
// output/role-lessons/{role}.json
|
|
600
|
+
interface RoleLessonOutput {
|
|
601
|
+
role: string;
|
|
602
|
+
agentId: string;
|
|
603
|
+
/** What this role did well */
|
|
604
|
+
strengths: string[];
|
|
605
|
+
/** What this role could improve */
|
|
606
|
+
improvements: string[];
|
|
607
|
+
/** Role necessity for this type of task */
|
|
608
|
+
roleAssessment: 'essential' | 'helpful' | 'neutral' | 'redundant';
|
|
609
|
+
/** How this role interacted with other roles */
|
|
610
|
+
interactionAssessment: {
|
|
611
|
+
withRole: string;
|
|
612
|
+
interactionType: InteractionType;
|
|
613
|
+
quality: 'effective' | 'adequate' | 'poor';
|
|
614
|
+
observation: string;
|
|
615
|
+
recommendation: string;
|
|
616
|
+
}[];
|
|
617
|
+
/** Evidence from the trajectory */
|
|
618
|
+
evidence: {
|
|
619
|
+
stepIndex: number;
|
|
620
|
+
description: string;
|
|
621
|
+
}[];
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
// output/team-lessons.json
|
|
625
|
+
interface TeamLessonsOutput {
|
|
626
|
+
/** Lessons about team composition */
|
|
627
|
+
compositionLessons: {
|
|
628
|
+
category: 'role-necessity' | 'team-size' | 'topology' | 'model-selection';
|
|
629
|
+
lesson: string;
|
|
630
|
+
evidence: string;
|
|
631
|
+
confidence: number;
|
|
632
|
+
}[];
|
|
633
|
+
/** Lessons about coordination */
|
|
634
|
+
coordinationLessons: {
|
|
635
|
+
category: 'delegation' | 'communication' | 'synchronization' | 'escalation';
|
|
636
|
+
lesson: string;
|
|
637
|
+
evidence: string;
|
|
638
|
+
confidence: number;
|
|
639
|
+
}[];
|
|
640
|
+
/** What the team should do differently */
|
|
641
|
+
recommendations: string[];
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
// output/meta-observations.json
|
|
645
|
+
interface TeamMetaObservationOutput {
|
|
646
|
+
/** Was the team formation effective? */
|
|
647
|
+
formation: {
|
|
648
|
+
wasEffective: boolean;
|
|
649
|
+
reasoning: string;
|
|
650
|
+
};
|
|
651
|
+
/** Was the composition right? */
|
|
652
|
+
composition: {
|
|
653
|
+
roleUtilization: Record<string, number>;
|
|
654
|
+
missingRoles: string[];
|
|
655
|
+
redundantRoles: string[];
|
|
656
|
+
teamSizeAssessment: 'too-small' | 'right-sized' | 'too-large';
|
|
657
|
+
};
|
|
658
|
+
/** Was the coordination approach right? */
|
|
659
|
+
coordination: {
|
|
660
|
+
topologyAssessment: 'effective' | 'neutral' | 'hindering';
|
|
661
|
+
enforcementAssessment: 'too-strict' | 'appropriate' | 'too-loose';
|
|
662
|
+
emergentPatterns: string[];
|
|
663
|
+
};
|
|
664
|
+
/** Suggestions for future team formation */
|
|
665
|
+
formationSuggestions: string[];
|
|
666
|
+
coordinationSuggestions: string[];
|
|
667
|
+
}
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
---
|
|
671
|
+
|
|
672
|
+
## Phase 4: Collect, Store, Accumulate
|
|
673
|
+
|
|
674
|
+
After the analysis agent completes, the pipeline reads the output files, validates them, and stores the results.
|
|
675
|
+
|
|
676
|
+
```typescript
|
|
677
|
+
class TeamAnalysisCollector {
|
|
678
|
+
async collect(
|
|
679
|
+
workspace: AnalysisWorkspace,
|
|
680
|
+
analysisAgentResult: AgentResult
|
|
681
|
+
): Promise<TeamAnalysisResult> {
|
|
682
|
+
|
|
683
|
+
// 1. READ AND VALIDATE agent output files
|
|
684
|
+
const agentCredits = await this.readAndValidate<AgentCreditOutput>(
|
|
685
|
+
`${workspace.path}/output/agent-credits.json`
|
|
686
|
+
);
|
|
687
|
+
const interactionCredits = await this.readAndValidate<InteractionCreditOutput>(
|
|
688
|
+
`${workspace.path}/output/interaction-credits.json`
|
|
689
|
+
);
|
|
690
|
+
const coordination = await this.readAndValidate<CoordinationAssessmentOutput>(
|
|
691
|
+
`${workspace.path}/output/coordination-assessment.json`
|
|
692
|
+
);
|
|
693
|
+
const roleLessons = await this.readRoleLessons(
|
|
694
|
+
`${workspace.path}/output/role-lessons/`
|
|
695
|
+
);
|
|
696
|
+
const teamLessons = await this.readAndValidate<TeamLessonsOutput>(
|
|
697
|
+
`${workspace.path}/output/team-lessons.json`
|
|
698
|
+
);
|
|
699
|
+
const metaObs = await this.readAndValidate<TeamMetaObservationOutput>(
|
|
700
|
+
`${workspace.path}/output/meta-observations.json`
|
|
701
|
+
);
|
|
702
|
+
|
|
703
|
+
// 2. ASSEMBLE into TeamAnalysisResult
|
|
704
|
+
const result: TeamAnalysisResult = {
|
|
705
|
+
teamTrajectoryId: workspace.teamTrajectory.id,
|
|
706
|
+
agentCredits: agentCredits.credits,
|
|
707
|
+
interactionCredits: interactionCredits.credits,
|
|
708
|
+
coordinationAssessment: coordination,
|
|
709
|
+
roleLessons,
|
|
710
|
+
teamLessons,
|
|
711
|
+
metaObservation: metaObs,
|
|
712
|
+
analysisMetrics: {
|
|
713
|
+
analysisTokens: analysisAgentResult.metrics.tokenEstimate ?? 0,
|
|
714
|
+
analysisTimeMs: analysisAgentResult.metrics.totalTime,
|
|
715
|
+
analysisToolCalls: analysisAgentResult.metrics.toolCallCount,
|
|
716
|
+
},
|
|
717
|
+
};
|
|
718
|
+
|
|
719
|
+
// 3. STORE in TeamExperienceMemory
|
|
720
|
+
await this.teamMemory.storeTeamExperience({
|
|
721
|
+
teamTrajectory: workspace.teamTrajectory,
|
|
722
|
+
analysis: result,
|
|
723
|
+
});
|
|
724
|
+
|
|
725
|
+
// 4. RECORD TeamMetaObservation
|
|
726
|
+
await this.teamMemory.recordMetaObservation({
|
|
727
|
+
teamTrajectoryId: workspace.teamTrajectory.id,
|
|
728
|
+
...metaObs,
|
|
729
|
+
outcome: {
|
|
730
|
+
success: workspace.teamTrajectory.outcome.success,
|
|
731
|
+
quality: this.assessQuality(workspace.teamTrajectory.outcome),
|
|
732
|
+
},
|
|
733
|
+
timestamp: new Date(),
|
|
734
|
+
});
|
|
735
|
+
|
|
736
|
+
// 5. ACCUMULATE lessons for batch playbook extraction
|
|
737
|
+
this.accumulated.push({
|
|
738
|
+
teamTrajectoryId: workspace.teamTrajectory.id,
|
|
739
|
+
objective: workspace.teamTrajectory.objective,
|
|
740
|
+
domain: workspace.teamTrajectory.domain,
|
|
741
|
+
topologyType: workspace.teamTrajectory.topologyType,
|
|
742
|
+
outcome: workspace.teamTrajectory.outcome,
|
|
743
|
+
roleLessons,
|
|
744
|
+
teamLessons,
|
|
745
|
+
coordinationAssessment: coordination,
|
|
746
|
+
agentCredits: agentCredits.credits,
|
|
747
|
+
});
|
|
748
|
+
|
|
749
|
+
// 6. PROCESS ANALYSIS AGENT'S OWN TRAJECTORY
|
|
750
|
+
// through existing individual learning pipeline
|
|
751
|
+
await this.individualPipeline.processTrajectory(
|
|
752
|
+
analysisAgentResult.trajectory
|
|
753
|
+
);
|
|
754
|
+
|
|
755
|
+
// 7. CLEANUP workspace
|
|
756
|
+
await this.cleanupWorkspace(workspace.path);
|
|
757
|
+
|
|
758
|
+
return result;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
```
|
|
762
|
+
|
|
763
|
+
---
|
|
764
|
+
|
|
765
|
+
## Phase 5: Batch Playbook Distillation
|
|
766
|
+
|
|
767
|
+
Triggered when enough team lessons have accumulated (configurable threshold, default 5). This phase also uses agentic analysis — a playbook extraction agent examines the batch and produces/updates playbooks.
|
|
768
|
+
|
|
769
|
+
### Three Playbook Types
|
|
770
|
+
|
|
771
|
+
#### Type 1: Role-Specific Playbooks
|
|
772
|
+
|
|
773
|
+
*"How to be effective in this role within this type of team."*
|
|
774
|
+
|
|
775
|
+
These are distinct from individual task playbooks (which are about solving problems alone) and from team coordination playbooks (which are about team composition). Role playbooks capture **teamwork behavior from a single agent's perspective**.
|
|
776
|
+
|
|
777
|
+
```typescript
|
|
778
|
+
interface RolePlaybook {
|
|
779
|
+
id: string;
|
|
780
|
+
name: string; // e.g., "effective-wave-planner"
|
|
781
|
+
|
|
782
|
+
// === APPLICABILITY ===
|
|
783
|
+
/** Which role this applies to */
|
|
784
|
+
role: string;
|
|
785
|
+
/** Team contexts where this guidance is relevant */
|
|
786
|
+
teamContext: {
|
|
787
|
+
topologies: ('hierarchical' | 'flat' | 'wave' | 'custom')[];
|
|
788
|
+
teamSizeRange: { min: number; max: number };
|
|
789
|
+
taskTypes: string[];
|
|
790
|
+
domains: string[];
|
|
791
|
+
};
|
|
792
|
+
|
|
793
|
+
// === ROLE GUIDANCE ===
|
|
794
|
+
guidance: {
|
|
795
|
+
/** Core responsibilities when playing this role */
|
|
796
|
+
responsibilities: string[];
|
|
797
|
+
|
|
798
|
+
/** How to interact with each other role */
|
|
799
|
+
interactionGuidance: RoleInteractionGuidance[];
|
|
800
|
+
|
|
801
|
+
/** Decision frameworks specific to this role */
|
|
802
|
+
decisionFrameworks: {
|
|
803
|
+
name: string;
|
|
804
|
+
when: string;
|
|
805
|
+
guidance: string;
|
|
806
|
+
}[];
|
|
807
|
+
|
|
808
|
+
/** Common mistakes in this role */
|
|
809
|
+
antiPatterns: string[];
|
|
810
|
+
};
|
|
811
|
+
|
|
812
|
+
// === EVOLUTION ===
|
|
813
|
+
evolution: {
|
|
814
|
+
version: string;
|
|
815
|
+
createdFrom: string[]; // team trajectory IDs
|
|
816
|
+
refinements: Refinement[];
|
|
817
|
+
successCount: number;
|
|
818
|
+
failureCount: number;
|
|
819
|
+
lastUsed?: Date;
|
|
820
|
+
};
|
|
821
|
+
confidence: number;
|
|
822
|
+
createdAt: Date;
|
|
823
|
+
updatedAt: Date;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
interface RoleInteractionGuidance {
|
|
827
|
+
/** Which other role */
|
|
828
|
+
withRole: string;
|
|
829
|
+
/** What type of interaction */
|
|
830
|
+
interactionType: InteractionType;
|
|
831
|
+
/** How to do it effectively */
|
|
832
|
+
guidance: string;
|
|
833
|
+
/** Concrete examples from successful executions */
|
|
834
|
+
examples: string[];
|
|
835
|
+
/** What NOT to do */
|
|
836
|
+
antiPatterns: string[];
|
|
837
|
+
}
|
|
838
|
+
```
|
|
839
|
+
|
|
840
|
+
**Example:**
|
|
841
|
+
|
|
842
|
+
```yaml
|
|
843
|
+
name: effective-wave-executor
|
|
844
|
+
role: executor
|
|
845
|
+
teamContext:
|
|
846
|
+
topologies: [wave]
|
|
847
|
+
teamSizeRange: { min: 3, max: 6 }
|
|
848
|
+
taskTypes: [full-stack-feature, multi-component-feature]
|
|
849
|
+
|
|
850
|
+
guidance:
|
|
851
|
+
responsibilities:
|
|
852
|
+
- "Implement assigned vertical slice independently"
|
|
853
|
+
- "Signal completion on execution_events channel immediately"
|
|
854
|
+
- "Include test results in result_return to verifier"
|
|
855
|
+
|
|
856
|
+
interactionGuidance:
|
|
857
|
+
- withRole: planner
|
|
858
|
+
interactionType: result_return
|
|
859
|
+
guidance: >
|
|
860
|
+
When returning results, include: (1) files changed with brief
|
|
861
|
+
description, (2) test results summary, (3) any deviations from
|
|
862
|
+
the delegated spec and why.
|
|
863
|
+
examples:
|
|
864
|
+
- "Completed login form. Changed: src/components/LoginForm.tsx
|
|
865
|
+
(new), src/api/auth.ts (modified). Tests: 4/4 passing.
|
|
866
|
+
Deviation: used react-hook-form instead of controlled
|
|
867
|
+
inputs for better validation UX."
|
|
868
|
+
antiPatterns:
|
|
869
|
+
- "Sending just 'done' without artifact details"
|
|
870
|
+
|
|
871
|
+
- withRole: verifier
|
|
872
|
+
interactionType: signal
|
|
873
|
+
guidance: >
|
|
874
|
+
Signal TASK_DONE on execution_events as soon as tests pass.
|
|
875
|
+
Don't wait for planner acknowledgment. Verifier subscribes
|
|
876
|
+
directly and can begin review immediately.
|
|
877
|
+
antiPatterns:
|
|
878
|
+
- "Only signaling after planner confirms receipt"
|
|
879
|
+
|
|
880
|
+
decisionFrameworks:
|
|
881
|
+
- name: blocked-decision
|
|
882
|
+
when: "Blocked on unclear spec or missing context"
|
|
883
|
+
guidance: >
|
|
884
|
+
If blocked for <2 minutes of reasoning, make a reasonable
|
|
885
|
+
assumption and document it in result_return. If blocked on
|
|
886
|
+
fundamental ambiguity (e.g., which API to use), escalate
|
|
887
|
+
immediately rather than guessing.
|
|
888
|
+
|
|
889
|
+
antiPatterns:
|
|
890
|
+
- "Asking planner for clarification on every detail"
|
|
891
|
+
- "Implementing beyond the delegated scope"
|
|
892
|
+
- "Not including test evidence in completion signal"
|
|
893
|
+
```
|
|
894
|
+
|
|
895
|
+
**How role playbooks are surfaced:**
|
|
896
|
+
|
|
897
|
+
When an agent is assigned a team role, role playbooks are injected alongside individual task playbooks. The agent's system prompt gains a "Team Role Guidance" section:
|
|
898
|
+
|
|
899
|
+
```typescript
|
|
900
|
+
// Extension to AgentManager for team member spawning
|
|
901
|
+
async spawnTeamMember(config: TeamMemberSpawnConfig): Promise<AgentResult> {
|
|
902
|
+
// Individual task playbooks (existing SkillLibrary)
|
|
903
|
+
const taskKnowledge = await this.memory.queryV2(config.task.description, {
|
|
904
|
+
domains: [config.task.domain],
|
|
905
|
+
});
|
|
906
|
+
|
|
907
|
+
// Role playbooks (new RolePlaybookLibrary)
|
|
908
|
+
const rolePlaybooks = await this.rolePlaybookLibrary.findMatching({
|
|
909
|
+
role: config.role,
|
|
910
|
+
topology: config.teamTopology,
|
|
911
|
+
taskType: config.taskType,
|
|
912
|
+
domain: config.task.domain,
|
|
913
|
+
});
|
|
914
|
+
|
|
915
|
+
// Format both into system prompt
|
|
916
|
+
const systemPrompt = [
|
|
917
|
+
this.injector.format(taskKnowledge, config.agentType),
|
|
918
|
+
this.formatRoleGuidance(rolePlaybooks, config.role),
|
|
919
|
+
].join('\n\n');
|
|
920
|
+
|
|
921
|
+
return this.spawn({
|
|
922
|
+
...config,
|
|
923
|
+
systemPromptAdditions: systemPrompt,
|
|
924
|
+
});
|
|
925
|
+
}
|
|
926
|
+
```
|
|
927
|
+
|
|
928
|
+
Rendered in the agent's system prompt as:
|
|
929
|
+
|
|
930
|
+
```markdown
|
|
931
|
+
## Task Skills
|
|
932
|
+
### fix-typescript-errors (90% confidence)
|
|
933
|
+
**Strategy:** Use dynamic analysis to trace type errors...
|
|
934
|
+
|
|
935
|
+
## Team Role Guidance
|
|
936
|
+
### effective-wave-executor (82% confidence)
|
|
937
|
+
**Your Role:** executor in wave-parallel team
|
|
938
|
+
**Responsibilities:**
|
|
939
|
+
- Implement assigned vertical slice independently
|
|
940
|
+
- Signal completion immediately on execution_events
|
|
941
|
+
**Working with planner:**
|
|
942
|
+
- When returning results, include files changed + test results...
|
|
943
|
+
**Working with verifier:**
|
|
944
|
+
- Signal TASK_DONE as soon as tests pass, don't wait for planner...
|
|
945
|
+
**Avoid:**
|
|
946
|
+
- Asking planner for clarification on every detail
|
|
947
|
+
- Implementing beyond the delegated scope
|
|
948
|
+
```
|
|
949
|
+
|
|
950
|
+
#### Type 2: Team Coordination Playbooks
|
|
951
|
+
|
|
952
|
+
These are the `TeamPlaybook` type from `PROPOSAL-team-aware-learning.md` — unchanged. They describe how to compose and coordinate a team for a given task type. Surfaced when `atlas.recommendTeam()` is called during team formation.
|
|
953
|
+
|
|
954
|
+
#### Type 3: Team Meta-Observations and Meta-Strategies
|
|
955
|
+
|
|
956
|
+
Team meta-learning parallels the existing individual `MetaLearner` → `MetaStrategy` pattern. It observes patterns about team formation decisions and produces strategies that adjust future team recommendations.
|
|
957
|
+
|
|
958
|
+
```typescript
|
|
959
|
+
interface TeamMetaObservation {
|
|
960
|
+
id: string;
|
|
961
|
+
teamTrajectoryId: string;
|
|
962
|
+
|
|
963
|
+
/** Formation decision assessment */
|
|
964
|
+
formation: {
|
|
965
|
+
playbookUsed?: string;
|
|
966
|
+
formationMethod: 'template' | 'playbook' | 'manual' | 'adaptive';
|
|
967
|
+
wasEffective: boolean;
|
|
968
|
+
reasoning: string;
|
|
969
|
+
};
|
|
970
|
+
|
|
971
|
+
/** Composition effectiveness */
|
|
972
|
+
composition: {
|
|
973
|
+
roleUtilization: Record<string, number>;
|
|
974
|
+
missingRoles: string[];
|
|
975
|
+
redundantRoles: string[];
|
|
976
|
+
teamSizeAssessment: 'too-small' | 'right-sized' | 'too-large';
|
|
977
|
+
};
|
|
978
|
+
|
|
979
|
+
/** Coordination effectiveness */
|
|
980
|
+
coordination: {
|
|
981
|
+
topologyAssessment: 'effective' | 'neutral' | 'hindering';
|
|
982
|
+
enforcementAssessment: 'too-strict' | 'appropriate' | 'too-loose';
|
|
983
|
+
emergentPatterns: string[];
|
|
984
|
+
};
|
|
985
|
+
|
|
986
|
+
/** Outcome */
|
|
987
|
+
outcome: {
|
|
988
|
+
success: boolean;
|
|
989
|
+
quality: 'excellent' | 'good' | 'acceptable' | 'poor';
|
|
990
|
+
speedupEstimate: number;
|
|
991
|
+
costEfficiency: number;
|
|
992
|
+
};
|
|
993
|
+
|
|
994
|
+
/** Lessons */
|
|
995
|
+
lessons: {
|
|
996
|
+
formationSuggestions: string[];
|
|
997
|
+
coordinationSuggestions: string[];
|
|
998
|
+
roleSuggestions: string[];
|
|
999
|
+
};
|
|
1000
|
+
|
|
1001
|
+
timestamp: Date;
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
interface TeamMetaStrategy {
|
|
1005
|
+
id: string;
|
|
1006
|
+
name: string;
|
|
1007
|
+
|
|
1008
|
+
/** When to apply this meta-strategy */
|
|
1009
|
+
condition: {
|
|
1010
|
+
taskCharacteristics: string[];
|
|
1011
|
+
resourceConstraints: string[];
|
|
1012
|
+
domains: string[];
|
|
1013
|
+
};
|
|
1014
|
+
|
|
1015
|
+
/** What adjustment to make during team formation */
|
|
1016
|
+
adjustment: {
|
|
1017
|
+
topologyBias?: Record<string, number>;
|
|
1018
|
+
teamSizeAdjustment: 'increase' | 'decrease' | 'maintain';
|
|
1019
|
+
roleAdjustments: string[];
|
|
1020
|
+
coordinationHints: string[];
|
|
1021
|
+
enforcementBias?: 'strict' | 'permissive' | 'audit';
|
|
1022
|
+
};
|
|
1023
|
+
|
|
1024
|
+
applicationCount: number;
|
|
1025
|
+
successRate: number;
|
|
1026
|
+
createdAt: Date;
|
|
1027
|
+
updatedAt: Date;
|
|
1028
|
+
}
|
|
1029
|
+
```
|
|
1030
|
+
|
|
1031
|
+
**Meta-strategy generation** follows the same pattern as individual meta-learning:
|
|
1032
|
+
|
|
1033
|
+
```
|
|
1034
|
+
1. TeamMetaObservations accumulate (threshold: 5)
|
|
1035
|
+
2. Periodically analyze:
|
|
1036
|
+
- Which topologies succeed for which task types?
|
|
1037
|
+
- Which team sizes work for which complexity levels?
|
|
1038
|
+
- Which role compositions correlate with success?
|
|
1039
|
+
3. Generate TeamMetaStrategies from patterns
|
|
1040
|
+
4. Apply during atlas.recommendTeam() to adjust recommendations
|
|
1041
|
+
```
|
|
1042
|
+
|
|
1043
|
+
### Batch Extraction Agent
|
|
1044
|
+
|
|
1045
|
+
Like Phase 3, batch extraction uses an agentic approach:
|
|
1046
|
+
|
|
1047
|
+
```typescript
|
|
1048
|
+
async runBatchLearning(): Promise<TeamBatchResult> {
|
|
1049
|
+
if (this.accumulated.length < this.config.minTeamTrajectories) {
|
|
1050
|
+
return { ready: false };
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
// Prepare extraction workspace
|
|
1054
|
+
const workspace = await this.prepareExtractionWorkspace(this.accumulated);
|
|
1055
|
+
|
|
1056
|
+
// Get existing playbooks for deduplication
|
|
1057
|
+
const existingTeamPlaybooks = await this.teamMemory.getTeamPlaybooks();
|
|
1058
|
+
const existingRolePlaybooks = await this.teamMemory.getRolePlaybooks();
|
|
1059
|
+
|
|
1060
|
+
// Inject existing playbooks + extraction meta-playbooks
|
|
1061
|
+
const knowledge = await this.getExtractionKnowledge(
|
|
1062
|
+
existingTeamPlaybooks,
|
|
1063
|
+
existingRolePlaybooks
|
|
1064
|
+
);
|
|
1065
|
+
|
|
1066
|
+
// Spawn extraction agent
|
|
1067
|
+
const result = await this.agentManager.spawn({
|
|
1068
|
+
agentType: 'claude-code',
|
|
1069
|
+
task: {
|
|
1070
|
+
id: `team-extraction-${Date.now()}`,
|
|
1071
|
+
domain: 'team-playbook-extraction',
|
|
1072
|
+
description: EXTRACTION_TASK_PROMPT,
|
|
1073
|
+
},
|
|
1074
|
+
cwd: workspace.path,
|
|
1075
|
+
injectedKnowledge: knowledge,
|
|
1076
|
+
captureToolCalls: true,
|
|
1077
|
+
});
|
|
1078
|
+
|
|
1079
|
+
// Read extraction agent's output
|
|
1080
|
+
const newTeamPlaybooks = await this.readPlaybooks(
|
|
1081
|
+
`${workspace.path}/output/team-playbooks/`
|
|
1082
|
+
);
|
|
1083
|
+
const newRolePlaybooks = await this.readPlaybooks(
|
|
1084
|
+
`${workspace.path}/output/role-playbooks/`
|
|
1085
|
+
);
|
|
1086
|
+
const playbookUpdates = await this.readUpdates(
|
|
1087
|
+
`${workspace.path}/output/updates/`
|
|
1088
|
+
);
|
|
1089
|
+
const metaStrategies = await this.readMetaStrategies(
|
|
1090
|
+
`${workspace.path}/output/meta-strategies/`
|
|
1091
|
+
);
|
|
1092
|
+
|
|
1093
|
+
// Store results
|
|
1094
|
+
for (const pb of newTeamPlaybooks) await this.teamMemory.storeTeamPlaybook(pb);
|
|
1095
|
+
for (const pb of newRolePlaybooks) await this.teamMemory.storeRolePlaybook(pb);
|
|
1096
|
+
for (const upd of playbookUpdates) await this.teamMemory.updatePlaybook(upd);
|
|
1097
|
+
for (const ms of metaStrategies) await this.teamMemory.storeMetaStrategy(ms);
|
|
1098
|
+
|
|
1099
|
+
// Process extraction agent's own trajectory for meta-learning
|
|
1100
|
+
await this.individualPipeline.processTrajectory(result.trajectory);
|
|
1101
|
+
|
|
1102
|
+
this.accumulated = [];
|
|
1103
|
+
|
|
1104
|
+
return {
|
|
1105
|
+
ready: true,
|
|
1106
|
+
teamPlaybooksCreated: newTeamPlaybooks.length,
|
|
1107
|
+
rolePlaybooksCreated: newRolePlaybooks.length,
|
|
1108
|
+
playbooksUpdated: playbookUpdates.length,
|
|
1109
|
+
metaStrategiesCreated: metaStrategies.length,
|
|
1110
|
+
};
|
|
1111
|
+
}
|
|
1112
|
+
```
|
|
1113
|
+
|
|
1114
|
+
The extraction workspace contains the batch of accumulated lessons:
|
|
1115
|
+
|
|
1116
|
+
```
|
|
1117
|
+
/tmp/team-extraction-{id}/
|
|
1118
|
+
├── input/
|
|
1119
|
+
│ ├── lesson-batches/
|
|
1120
|
+
│ │ ├── team-exec-001.json # Lessons from team execution 1
|
|
1121
|
+
│ │ ├── team-exec-002.json # Lessons from team execution 2
|
|
1122
|
+
│ │ └── ...
|
|
1123
|
+
│ ├── existing-team-playbooks/
|
|
1124
|
+
│ │ └── *.json # For deduplication
|
|
1125
|
+
│ └── existing-role-playbooks/
|
|
1126
|
+
│ └── *.json # For deduplication
|
|
1127
|
+
│
|
|
1128
|
+
├── workspace/ # Scratch space
|
|
1129
|
+
│
|
|
1130
|
+
└── output/
|
|
1131
|
+
├── team-playbooks/ # New team coordination playbooks
|
|
1132
|
+
├── role-playbooks/ # New role-specific playbooks
|
|
1133
|
+
├── updates/ # Updates to existing playbooks
|
|
1134
|
+
└── meta-strategies/ # New team meta-strategies
|
|
1135
|
+
```
|
|
1136
|
+
|
|
1137
|
+
---
|
|
1138
|
+
|
|
1139
|
+
## Full Pipeline Orchestration
|
|
1140
|
+
|
|
1141
|
+
The `TeamLearningPipeline` class ties everything together:
|
|
1142
|
+
|
|
1143
|
+
```typescript
|
|
1144
|
+
class TeamLearningPipeline {
|
|
1145
|
+
private ingester: TeamTrajectoryIngester;
|
|
1146
|
+
private agentManager: AgentManager;
|
|
1147
|
+
private collector: TeamAnalysisCollector;
|
|
1148
|
+
private individualPipeline: LearningPipeline;
|
|
1149
|
+
private teamMemory: TeamMemorySystem;
|
|
1150
|
+
private memory: MemorySystem;
|
|
1151
|
+
|
|
1152
|
+
private accumulated: AccumulatedTeamLessons[] = [];
|
|
1153
|
+
|
|
1154
|
+
/**
|
|
1155
|
+
* Process a single team execution.
|
|
1156
|
+
* Phases 1-4: ingest → agentic analysis → collect.
|
|
1157
|
+
*
|
|
1158
|
+
* Mirrors LearningPipeline.processTrajectory().
|
|
1159
|
+
*/
|
|
1160
|
+
async processTeamTrajectory(
|
|
1161
|
+
input: TeamTrajectoryInput
|
|
1162
|
+
): Promise<TeamProcessResult> {
|
|
1163
|
+
|
|
1164
|
+
// Phase 1-2: Ingest, compress, prepare workspace
|
|
1165
|
+
const workspace = await this.ingester.ingest(input);
|
|
1166
|
+
|
|
1167
|
+
// Phase 3: Agentic analysis
|
|
1168
|
+
const knowledge = await this.getAnalysisKnowledge(workspace);
|
|
1169
|
+
const spawnConfig = buildAnalysisSpawnConfig(workspace, knowledge);
|
|
1170
|
+
const agentResult = await this.agentManager.spawn(spawnConfig);
|
|
1171
|
+
|
|
1172
|
+
// Phase 4: Collect, store, accumulate
|
|
1173
|
+
const analysisResult = await this.collector.collect(
|
|
1174
|
+
workspace, agentResult
|
|
1175
|
+
);
|
|
1176
|
+
|
|
1177
|
+
return {
|
|
1178
|
+
teamTrajectoryId: workspace.teamTrajectory.id,
|
|
1179
|
+
analysis: analysisResult,
|
|
1180
|
+
compressionStats: workspace.compressionStats,
|
|
1181
|
+
analysisMetrics: analysisResult.analysisMetrics,
|
|
1182
|
+
};
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
/**
|
|
1186
|
+
* Run batch playbook extraction on accumulated lessons.
|
|
1187
|
+
* Phase 5.
|
|
1188
|
+
*
|
|
1189
|
+
* Mirrors LearningPipeline.runBatchLearning().
|
|
1190
|
+
*/
|
|
1191
|
+
async runBatchLearning(): Promise<TeamBatchResult> {
|
|
1192
|
+
if (this.accumulated.length < this.config.minTeamTrajectories) {
|
|
1193
|
+
return { ready: false };
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
// ... extraction agent workspace + spawn (see Phase 5 above)
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
/**
|
|
1200
|
+
* Check if batch learning is ready.
|
|
1201
|
+
*/
|
|
1202
|
+
isBatchReady(): boolean {
|
|
1203
|
+
return this.accumulated.length >= this.config.minTeamTrajectories;
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
/**
|
|
1207
|
+
* Get accumulated lesson count.
|
|
1208
|
+
*/
|
|
1209
|
+
getAccumulatedCount(): number {
|
|
1210
|
+
return this.accumulated.length;
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
```
|
|
1214
|
+
|
|
1215
|
+
### Configuration
|
|
1216
|
+
|
|
1217
|
+
```typescript
|
|
1218
|
+
interface TeamLearningConfig {
|
|
1219
|
+
/** Enable team-aware learning */
|
|
1220
|
+
enabled: boolean; // default: false
|
|
1221
|
+
|
|
1222
|
+
/** Compression settings */
|
|
1223
|
+
compression: CompressionConfig;
|
|
1224
|
+
|
|
1225
|
+
/** Minimum team executions before batch extraction */
|
|
1226
|
+
minTeamTrajectories: number; // default: 5
|
|
1227
|
+
|
|
1228
|
+
/** Similarity threshold for playbook deduplication */
|
|
1229
|
+
deduplicationThreshold: number; // default: 0.85
|
|
1230
|
+
|
|
1231
|
+
/** Maximum team experiences to store */
|
|
1232
|
+
maxTeamExperiences: number; // default: 200
|
|
1233
|
+
|
|
1234
|
+
/** Maximum team playbooks */
|
|
1235
|
+
maxTeamPlaybooks: number; // default: 50
|
|
1236
|
+
|
|
1237
|
+
/** Maximum role playbooks */
|
|
1238
|
+
maxRolePlaybooks: number; // default: 100
|
|
1239
|
+
|
|
1240
|
+
/** Analysis agent timeout */
|
|
1241
|
+
analysisTimeout: number; // default: 300_000 (5 minutes)
|
|
1242
|
+
|
|
1243
|
+
/** Extraction agent timeout */
|
|
1244
|
+
extractionTimeout: number; // default: 600_000 (10 minutes)
|
|
1245
|
+
}
|
|
1246
|
+
```
|
|
1247
|
+
|
|
1248
|
+
---
|
|
1249
|
+
|
|
1250
|
+
## Integration with Atlas
|
|
1251
|
+
|
|
1252
|
+
New methods on the `Atlas` class:
|
|
1253
|
+
|
|
1254
|
+
```typescript
|
|
1255
|
+
class Atlas {
|
|
1256
|
+
// ... existing methods ...
|
|
1257
|
+
|
|
1258
|
+
/**
|
|
1259
|
+
* Process a team trajectory for learning.
|
|
1260
|
+
* Team-level analog of processTrajectory().
|
|
1261
|
+
*/
|
|
1262
|
+
async processTeamTrajectory(
|
|
1263
|
+
input: TeamTrajectoryInput
|
|
1264
|
+
): Promise<TeamProcessResult> {
|
|
1265
|
+
return this.teamPipeline.processTeamTrajectory(input);
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
/**
|
|
1269
|
+
* Recommend a team composition for a given task.
|
|
1270
|
+
* Uses team playbooks + role playbooks + meta-strategies.
|
|
1271
|
+
*/
|
|
1272
|
+
async recommendTeam(task: {
|
|
1273
|
+
description: string;
|
|
1274
|
+
domain: string;
|
|
1275
|
+
complexity: 'simple' | 'moderate' | 'complex' | 'epic';
|
|
1276
|
+
constraints?: {
|
|
1277
|
+
maxAgents?: number;
|
|
1278
|
+
maxTokenBudget?: number;
|
|
1279
|
+
preferredTopology?: string;
|
|
1280
|
+
};
|
|
1281
|
+
}): Promise<TeamRecommendation> {
|
|
1282
|
+
// 1. Find matching team playbooks
|
|
1283
|
+
// 2. Apply team meta-strategies
|
|
1284
|
+
// 3. Include relevant role playbooks for each recommended role
|
|
1285
|
+
// 4. Return recommendation with asTeamYaml() export
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
/**
|
|
1289
|
+
* Spawn a team member with both task knowledge and role guidance.
|
|
1290
|
+
*/
|
|
1291
|
+
async spawnTeamMember(config: TeamMemberSpawnConfig): Promise<AgentResult> {
|
|
1292
|
+
// 1. Get task playbooks from individual SkillLibrary
|
|
1293
|
+
// 2. Get role playbooks from RolePlaybookLibrary
|
|
1294
|
+
// 3. Inject both into agent's system prompt
|
|
1295
|
+
// 4. Spawn via AgentManager
|
|
1296
|
+
// 5. Capture trajectory with interaction tags
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
/**
|
|
1300
|
+
* Run batch team learning.
|
|
1301
|
+
*/
|
|
1302
|
+
async runTeamBatchLearning(): Promise<TeamBatchResult> {
|
|
1303
|
+
return this.teamPipeline.runBatchLearning();
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
```
|
|
1307
|
+
|
|
1308
|
+
---
|
|
1309
|
+
|
|
1310
|
+
## Storage Layout
|
|
1311
|
+
|
|
1312
|
+
```
|
|
1313
|
+
.atlas/
|
|
1314
|
+
├── experiences/ # Individual agent experiences (existing)
|
|
1315
|
+
├── playbooks/ # Individual task playbooks (existing)
|
|
1316
|
+
├── meta-observations/ # Individual meta-observations (existing)
|
|
1317
|
+
├── meta-strategies/ # Individual meta-strategies (existing)
|
|
1318
|
+
│
|
|
1319
|
+
├── team-experiences/ # Team trajectory experiences + analysis
|
|
1320
|
+
├── team-playbooks/ # Team coordination playbooks
|
|
1321
|
+
├── role-playbooks/ # Role-specific playbooks (new type)
|
|
1322
|
+
├── team-meta-observations/ # Team formation observations
|
|
1323
|
+
├── team-meta-strategies/ # Team formation meta-strategies
|
|
1324
|
+
│
|
|
1325
|
+
└── vectors.db # Vector store (extended with team embeddings)
|
|
1326
|
+
```
|
|
1327
|
+
|
|
1328
|
+
---
|
|
1329
|
+
|
|
1330
|
+
## The Recursive Learning Architecture
|
|
1331
|
+
|
|
1332
|
+
The full system has three learning loops, all using the same infrastructure:
|
|
1333
|
+
|
|
1334
|
+
```
|
|
1335
|
+
LOOP 1: Individual Learning (existing)
|
|
1336
|
+
Agent solves task → trajectory → playbooks about task-solving
|
|
1337
|
+
|
|
1338
|
+
LOOP 2: Team Learning (new)
|
|
1339
|
+
Team executes task → team trajectory → team/role playbooks about coordination
|
|
1340
|
+
Analysis agent analyzes → its trajectory → playbooks about analysis (LOOP 1)
|
|
1341
|
+
|
|
1342
|
+
LOOP 3: Meta-Learning (extended)
|
|
1343
|
+
Individual meta-observations → routing meta-strategies (existing)
|
|
1344
|
+
Team meta-observations → formation meta-strategies (new)
|
|
1345
|
+
Analysis meta-observations → analysis improvement (via LOOP 1)
|
|
1346
|
+
```
|
|
1347
|
+
|
|
1348
|
+
All three loops use the same `AgentManager`, `MemorySystem`, `LearningPipeline`, and `SkillLibrary` infrastructure. The team layer is purely additive — no existing components are modified.
|
|
1349
|
+
|
|
1350
|
+
---
|
|
1351
|
+
|
|
1352
|
+
## Toward a Reusable Agentic Workspace
|
|
1353
|
+
|
|
1354
|
+
The workspace pattern used here — filesystem directory with input/workspace/output structure, agent spawned with tools and injected knowledge, trajectory captured for meta-learning — is not specific to team analysis. It is a general pattern for any cognitive-core analysis task:
|
|
1355
|
+
|
|
1356
|
+
- **Playbook extraction**: Input = trajectory batch. Output = new playbooks.
|
|
1357
|
+
- **Meta-learning analysis**: Input = observation batch. Output = meta-strategies.
|
|
1358
|
+
- **Trajectory evaluation**: Input = trajectory. Output = quality assessment.
|
|
1359
|
+
- **Experience curation**: Input = experience store. Output = pruning recommendations.
|
|
1360
|
+
|
|
1361
|
+
A reusable `AnalysisWorkspaceManager` could standardize this pattern across all cognitive-core analysis tasks, providing:
|
|
1362
|
+
|
|
1363
|
+
1. **Workspace lifecycle**: Create, populate, cleanup temporary directories
|
|
1364
|
+
2. **Schema validation**: Validate agent output against expected schemas
|
|
1365
|
+
3. **Knowledge injection**: Query appropriate playbooks for the analysis domain
|
|
1366
|
+
4. **Trajectory capture**: Automatically route analysis agent trajectories through the learning pipeline
|
|
1367
|
+
5. **Error handling**: Retry or fallback if the analysis agent fails to produce valid output
|
|
1368
|
+
|
|
1369
|
+
This is discussed further in the agentic workspace design (separate document).
|