cognitive-core 0.1.2 → 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.md +233 -0
- package/README.md +370 -54
- package/dist/atlas.d.ts +10 -10
- package/dist/atlas.d.ts.map +1 -1
- package/dist/atlas.js +79 -48
- 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/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 +7 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +37 -5
- 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 +7 -2
- package/dist/learning/index.d.ts.map +1 -1
- package/dist/learning/index.js +13 -2
- 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/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.map +1 -1
- package/dist/learning/meta-learner.js +4 -21
- package/dist/learning/meta-learner.js.map +1 -1
- package/dist/learning/pipeline.d.ts +31 -4
- package/dist/learning/pipeline.d.ts.map +1 -1
- package/dist/learning/pipeline.js +64 -12
- package/dist/learning/pipeline.js.map +1 -1
- package/dist/learning/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/trajectory-sources/entire.d.ts +8 -5
- package/dist/learning/trajectory-sources/entire.d.ts.map +1 -1
- package/dist/learning/trajectory-sources/entire.js +13 -6
- package/dist/learning/trajectory-sources/entire.js.map +1 -1
- package/dist/learning/trajectory-sources/index.d.ts +1 -1
- package/dist/learning/trajectory-sources/index.d.ts.map +1 -1
- package/dist/learning/trajectory-sources/index.js +1 -1
- package/dist/learning/trajectory-sources/index.js.map +1 -1
- package/dist/learning/trajectory-sources/pipeline.d.ts +4 -4
- package/dist/learning/trajectory-sources/pipeline.d.ts.map +1 -1
- package/dist/learning/trajectory-sources/pipeline.js +2 -2
- package/dist/learning/trajectory-sources/pipeline.js.map +1 -1
- 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/index.d.ts +7 -0
- package/dist/memory/index.d.ts.map +1 -1
- package/dist/memory/index.js +12 -0
- package/dist/memory/index.js.map +1 -1
- package/dist/memory/knowledge-bank.d.ts +14 -0
- package/dist/memory/knowledge-bank.d.ts.map +1 -1
- package/dist/memory/knowledge-bank.js +45 -0
- package/dist/memory/knowledge-bank.js.map +1 -1
- 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/system.d.ts +7 -2
- package/dist/memory/system.d.ts.map +1 -1
- package/dist/memory/system.js +19 -7
- package/dist/memory/system.js.map +1 -1
- 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/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/search/index.d.ts +1 -0
- package/dist/search/index.d.ts.map +1 -1
- package/dist/search/index.js +2 -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/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/session-bank/git-reader.d.ts +9 -4
- package/dist/session-bank/git-reader.d.ts.map +1 -1
- package/dist/session-bank/git-reader.js +22 -15
- package/dist/session-bank/git-reader.js.map +1 -1
- package/dist/session-bank/index.d.ts +2 -2
- package/dist/session-bank/index.d.ts.map +1 -1
- package/dist/session-bank/index.js +2 -2
- package/dist/session-bank/index.js.map +1 -1
- package/dist/session-bank/parser.d.ts +16 -5
- package/dist/session-bank/parser.d.ts.map +1 -1
- package/dist/session-bank/parser.js +187 -80
- package/dist/session-bank/parser.js.map +1 -1
- package/dist/session-bank/session-bank.d.ts +5 -0
- package/dist/session-bank/session-bank.d.ts.map +1 -1
- package/dist/session-bank/session-bank.js +30 -9
- package/dist/session-bank/session-bank.js.map +1 -1
- package/dist/session-bank/types.d.ts +4 -1
- package/dist/session-bank/types.d.ts.map +1 -1
- package/dist/session-bank/types.js +3 -3
- package/dist/session-bank/types.js.map +1 -1
- package/dist/surfacing/skill-publisher.d.ts.map +1 -1
- package/dist/surfacing/skill-publisher.js +15 -43
- package/dist/surfacing/skill-publisher.js.map +1 -1
- package/dist/surfacing/sqlite-storage-adapter.d.ts.map +1 -1
- package/dist/surfacing/sqlite-storage-adapter.js +13 -21
- package/dist/surfacing/sqlite-storage-adapter.js.map +1 -1
- package/dist/types/config.d.ts +100 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js +27 -0
- package/dist/types/config.js.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/index.js.map +1 -1
- 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/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/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +3 -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/runner.d.ts +3 -4
- package/dist/workspace/runner.d.ts.map +1 -1
- package/dist/workspace/runner.js.map +1 -1
- package/dist/workspace/types.d.ts +9 -2
- package/dist/workspace/types.d.ts.map +1 -1
- package/dist/workspace/types.js.map +1 -1
- package/package.json +6 -4
- 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/.sudocode/issues.jsonl +8 -0
- package/references/skill-tree/.sudocode/specs.jsonl +2 -0
- package/references/skill-tree/CLAUDE.md +56 -80
- package/references/skill-tree/README.md +188 -140
- package/references/skill-tree/examples/basic-usage.ts +95 -121
- package/references/skill-tree/package-lock.json +369 -26
- package/references/skill-tree/package.json +1 -1
- package/src/atlas.ts +97 -67
- 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/vector-store.ts +21 -9
- package/src/factory.ts +33 -16
- package/src/index.ts +109 -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 +65 -9
- package/src/learning/instant-loop.ts +357 -0
- package/src/learning/maintenance-scheduler.ts +271 -0
- package/src/learning/meta-learner.ts +5 -23
- package/src/learning/reflexion-generator.ts +273 -0
- package/src/learning/trajectory-sources/entire.ts +24 -13
- package/src/learning/trajectory-sources/index.ts +2 -2
- package/src/learning/trajectory-sources/pipeline.ts +5 -5
- 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/index.ts +43 -0
- package/src/memory/knowledge-bank.ts +57 -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/system.ts +21 -5
- 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/flows/learning.ts +25 -42
- package/src/search/index.ts +10 -0
- package/src/search/moe-gate.ts +304 -0
- package/src/search/router.ts +111 -4
- package/src/session-bank/git-reader.ts +29 -19
- package/src/session-bank/index.ts +4 -2
- package/src/session-bank/parser.ts +280 -98
- package/src/session-bank/session-bank.ts +33 -12
- package/src/session-bank/types.ts +8 -5
- package/src/surfacing/skill-publisher.ts +17 -49
- package/src/surfacing/sqlite-storage-adapter.ts +16 -32
- package/src/types/config.ts +30 -0
- package/src/types/index.ts +3 -0
- package/src/types/memory.ts +30 -0
- package/src/types/playbook.ts +4 -0
- package/src/utils/error-classifier.ts +113 -0
- package/src/utils/index.ts +18 -0
- package/src/utils/partitioned-store.ts +299 -0
- package/src/utils/trajectory-helpers.ts +79 -0
- package/src/workspace/runner.ts +3 -3
- package/src/workspace/types.ts +10 -2
- package/tests/embeddings/inverted-index.test.ts +138 -0
- package/tests/feature-toggles.test.ts +275 -0
- package/tests/gap-fixes.test.ts +17 -4
- package/tests/integration/cli-e2e.test.ts +621 -0
- package/tests/integration/e2e.test.ts +6 -5
- package/tests/integration/entire-e2e.test.ts +314 -125
- 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 +20 -14
- package/tests/integration/sessionlog-e2e.test.ts +329 -0
- package/tests/integration/unified-pipeline-e2e.test.ts +634 -0
- package/tests/learning/analyzer.test.ts +1 -1
- package/tests/learning/energy-evaluator.test.ts +180 -0
- package/tests/learning/entire-trajectory-source.test.ts +25 -25
- package/tests/learning/healing-orchestrator.test.ts +269 -0
- package/tests/learning/instant-loop.test.ts +243 -0
- package/tests/learning/maintenance-scheduler.test.ts +191 -0
- package/tests/learning/reflexion-generator.test.ts +411 -0
- package/tests/learning/trajectory-sources.test.ts +12 -4
- 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/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 +6 -1
- package/tests/memory/system.test.ts +6 -1
- 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 +6 -1
- package/tests/runtime/delegate.test.ts +6 -1
- 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/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/git-reader.test.ts +13 -13
- package/tests/session-bank/parser.test.ts +135 -3
- package/tests/session-bank/session-bank.test.ts +1 -1
- package/tests/surfacing/skill-library.test.ts +6 -1
- package/tests/surfacing/skill-publisher.test.ts +24 -58
- package/tests/surfacing/sqlite-storage-adapter.test.ts +11 -23
- package/tests/utils/partitioned-store.test.ts +230 -0
- package/tests/workspace/full-flow.test.ts +10 -4
- package/tests/workspace/runner.test.ts +10 -4
- package/docs/DESIGN-workspace-migration.md +0 -1079
- package/docs/PLAN-agentic-workspace-implementation.md +0 -717
- package/docs/PLAN-graph-migration.md +0 -299
- package/docs/PLAN-session-bank-implementation.md +0 -474
- package/src/learning/pipeline.ts +0 -323
- package/tests/learning/pipeline.test.ts +0 -176
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// ─── Session Bank Types ───────────────────────────────────────────────
|
|
2
|
-
// Standalone types for reading
|
|
3
|
-
// Zero imports from cognitive-core — this module can be
|
|
4
|
-
//
|
|
2
|
+
// Standalone types for reading SessionLog checkpoint data from orphan
|
|
3
|
+
// branches. Zero imports from cognitive-core — this module can be
|
|
4
|
+
// extracted.
|
|
5
5
|
// ─────────────────────────────────────────────────────────────────────
|
|
6
6
|
|
|
7
7
|
// ─── Content Blocks (transcript) ────────────────────────────────────
|
|
@@ -40,7 +40,7 @@ export interface TranscriptMessage {
|
|
|
40
40
|
lineIndex: number;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
// ─── Session Summary (from
|
|
43
|
+
// ─── Session Summary (from checkpoint AI summarizer) ────────────────
|
|
44
44
|
|
|
45
45
|
export interface SessionSummary {
|
|
46
46
|
intent: string;
|
|
@@ -164,10 +164,13 @@ export interface ProcessingLogEntry {
|
|
|
164
164
|
export interface SessionBankOptions {
|
|
165
165
|
/** Git repository path (default: process.cwd()) */
|
|
166
166
|
repoPath?: string;
|
|
167
|
-
/** Orphan branch name (default: '
|
|
167
|
+
/** Orphan branch name (default: 'sessionlog/checkpoints/v1'). */
|
|
168
168
|
branch?: string;
|
|
169
169
|
/** Directory to store processing state (default: '.atlas/session-bank') */
|
|
170
170
|
stateDir?: string;
|
|
171
171
|
/** Enable in-memory caching of parsed sessions (default: true) */
|
|
172
172
|
cache?: boolean;
|
|
173
|
+
/** Trailer keys to search for checkpoint IDs in commit messages.
|
|
174
|
+
* Defaults to ['Sessionlog-Checkpoint']. */
|
|
175
|
+
trailerKeys?: string[];
|
|
173
176
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* conversion at the publish boundary.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type { Skill, StorageAdapter
|
|
9
|
+
import type { Skill, StorageAdapter } from 'skill-tree';
|
|
10
10
|
import type { Playbook } from '../types/index.js';
|
|
11
11
|
import type { PublishResult, DeprecateResult } from './publisher.js';
|
|
12
12
|
import { getPlaybookSuccessRate } from '../types/playbook.js';
|
|
@@ -49,30 +49,32 @@ export function convertPlaybookToSkill(playbook: Playbook): Skill {
|
|
|
49
49
|
notesParts.push('Rollback: ' + playbook.verification.rollbackStrategy);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
// Build trigger conditions
|
|
53
|
-
const triggerConditions = extractTriggerConditions(playbook);
|
|
54
|
-
|
|
55
52
|
// Build description for semantic matching
|
|
56
53
|
const description = playbook.applicability.situations[0]
|
|
57
54
|
?? `${playbook.name}: ${playbook.guidance.strategy.slice(0, 100)}`;
|
|
58
55
|
|
|
56
|
+
// Build instructions as structured markdown combining all content
|
|
57
|
+
const instructionParts: string[] = [];
|
|
58
|
+
instructionParts.push(`## Problem\n${playbook.applicability.situations.join('. ')}`);
|
|
59
|
+
instructionParts.push(`## Solution\n${solution}`);
|
|
60
|
+
instructionParts.push(`## Verification\n${verification}`);
|
|
61
|
+
if (notesParts.length > 0) {
|
|
62
|
+
instructionParts.push(`## Notes\n${notesParts.join('\n\n')}`);
|
|
63
|
+
}
|
|
64
|
+
if (playbook.guidance.codeExample) {
|
|
65
|
+
instructionParts.push(`## Example\n\`\`\`\n${playbook.guidance.codeExample}\n\`\`\``);
|
|
66
|
+
}
|
|
67
|
+
const instructions = instructionParts.join('\n\n');
|
|
68
|
+
|
|
59
69
|
// Estimate tokens (rough: 4 chars per token)
|
|
60
|
-
const
|
|
61
|
-
const tokenEstimate = Math.ceil(fullText.length / 4);
|
|
70
|
+
const tokenEstimate = Math.ceil(instructions.length / 4);
|
|
62
71
|
|
|
63
72
|
return {
|
|
64
73
|
id: playbook.id,
|
|
65
74
|
name: playbook.name,
|
|
66
75
|
version: playbook.evolution.version,
|
|
67
76
|
description,
|
|
68
|
-
|
|
69
|
-
triggerConditions,
|
|
70
|
-
solution,
|
|
71
|
-
verification,
|
|
72
|
-
examples: playbook.guidance.codeExample
|
|
73
|
-
? [{ scenario: playbook.applicability.situations[0] ?? playbook.name, before: '', after: playbook.guidance.codeExample }]
|
|
74
|
-
: [],
|
|
75
|
-
notes: notesParts.length > 0 ? notesParts.join('\n\n') : undefined,
|
|
77
|
+
instructions,
|
|
76
78
|
author: 'cognitive-core',
|
|
77
79
|
tags: playbook.applicability.domains,
|
|
78
80
|
status: 'active',
|
|
@@ -97,40 +99,6 @@ export function convertPlaybookToSkill(playbook: Playbook): Skill {
|
|
|
97
99
|
};
|
|
98
100
|
}
|
|
99
101
|
|
|
100
|
-
/**
|
|
101
|
-
* Extract trigger conditions from playbook applicability
|
|
102
|
-
*/
|
|
103
|
-
function extractTriggerConditions(playbook: Playbook): TriggerCondition[] {
|
|
104
|
-
const triggers: TriggerCondition[] = [];
|
|
105
|
-
|
|
106
|
-
// Add situation-based triggers
|
|
107
|
-
for (const situation of playbook.applicability.situations) {
|
|
108
|
-
triggers.push({
|
|
109
|
-
type: 'context',
|
|
110
|
-
value: situation,
|
|
111
|
-
description: 'Situation trigger',
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Add explicit triggers with type detection
|
|
116
|
-
for (const trigger of playbook.applicability.triggers) {
|
|
117
|
-
let type: TriggerCondition['type'] = 'keyword';
|
|
118
|
-
if (trigger.toLowerCase().includes('error') || /^[A-Z]{2,}\d+/.test(trigger)) {
|
|
119
|
-
type = 'error';
|
|
120
|
-
} else if (trigger.startsWith('/') || trigger.includes('*')) {
|
|
121
|
-
type = 'pattern';
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
triggers.push({
|
|
125
|
-
type,
|
|
126
|
-
value: trigger,
|
|
127
|
-
description: 'Explicit trigger',
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return triggers;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
102
|
/**
|
|
135
103
|
* SkillPublisher - Manages publishing graduated playbooks to skill-tree storage
|
|
136
104
|
*/
|
|
@@ -192,7 +160,7 @@ export class SkillPublisher {
|
|
|
192
160
|
}
|
|
193
161
|
|
|
194
162
|
existing.status = 'deprecated';
|
|
195
|
-
existing.
|
|
163
|
+
existing.description = (existing.description ? existing.description + ' ' : '') + `[Deprecated: ${reason}]`;
|
|
196
164
|
existing.updatedAt = new Date();
|
|
197
165
|
await this.storage.saveSkill(existing);
|
|
198
166
|
|
|
@@ -19,18 +19,14 @@ interface SkillRow {
|
|
|
19
19
|
name: string;
|
|
20
20
|
version: string;
|
|
21
21
|
description: string | null;
|
|
22
|
-
|
|
23
|
-
solution: string;
|
|
24
|
-
verification: string | null;
|
|
25
|
-
notes: string | null;
|
|
22
|
+
instructions: string;
|
|
26
23
|
author: string | null;
|
|
27
24
|
status: string;
|
|
28
25
|
tags: string;
|
|
29
|
-
trigger_conditions: string;
|
|
30
|
-
examples: string;
|
|
31
26
|
metrics: string;
|
|
32
27
|
source: string;
|
|
33
28
|
serving: string;
|
|
29
|
+
related: string;
|
|
34
30
|
created_at: string;
|
|
35
31
|
updated_at: string;
|
|
36
32
|
}
|
|
@@ -70,18 +66,14 @@ export class SqliteStorageAdapter implements StorageAdapter {
|
|
|
70
66
|
name TEXT NOT NULL,
|
|
71
67
|
version TEXT NOT NULL,
|
|
72
68
|
description TEXT,
|
|
73
|
-
|
|
74
|
-
solution TEXT NOT NULL,
|
|
75
|
-
verification TEXT,
|
|
76
|
-
notes TEXT,
|
|
69
|
+
instructions TEXT NOT NULL DEFAULT '',
|
|
77
70
|
author TEXT,
|
|
78
71
|
status TEXT NOT NULL DEFAULT 'active',
|
|
79
72
|
tags TEXT NOT NULL DEFAULT '[]',
|
|
80
|
-
trigger_conditions TEXT NOT NULL DEFAULT '[]',
|
|
81
|
-
examples TEXT NOT NULL DEFAULT '[]',
|
|
82
73
|
metrics TEXT NOT NULL DEFAULT '{}',
|
|
83
74
|
source TEXT NOT NULL DEFAULT '{}',
|
|
84
75
|
serving TEXT NOT NULL DEFAULT '{}',
|
|
76
|
+
related TEXT NOT NULL DEFAULT '[]',
|
|
85
77
|
created_at TEXT NOT NULL,
|
|
86
78
|
updated_at TEXT NOT NULL
|
|
87
79
|
)
|
|
@@ -120,11 +112,11 @@ export class SqliteStorageAdapter implements StorageAdapter {
|
|
|
120
112
|
// Upsert the skill
|
|
121
113
|
const stmt = this.db.prepare(`
|
|
122
114
|
INSERT OR REPLACE INTO skills
|
|
123
|
-
(id, name, version, description,
|
|
124
|
-
author, status, tags,
|
|
125
|
-
serving, created_at, updated_at)
|
|
115
|
+
(id, name, version, description, instructions,
|
|
116
|
+
author, status, tags, metrics, source,
|
|
117
|
+
serving, related, created_at, updated_at)
|
|
126
118
|
VALUES
|
|
127
|
-
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
|
|
119
|
+
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
128
120
|
`);
|
|
129
121
|
|
|
130
122
|
stmt.run(
|
|
@@ -132,18 +124,14 @@ export class SqliteStorageAdapter implements StorageAdapter {
|
|
|
132
124
|
skill.name,
|
|
133
125
|
skill.version,
|
|
134
126
|
skill.description ?? null,
|
|
135
|
-
skill.
|
|
136
|
-
skill.solution,
|
|
137
|
-
skill.verification ?? null,
|
|
138
|
-
skill.notes ?? null,
|
|
127
|
+
skill.instructions,
|
|
139
128
|
skill.author ?? null,
|
|
140
129
|
skill.status,
|
|
141
130
|
JSON.stringify(skill.tags ?? []),
|
|
142
|
-
JSON.stringify(skill.triggerConditions ?? []),
|
|
143
|
-
JSON.stringify(skill.examples ?? []),
|
|
144
131
|
JSON.stringify(skill.metrics ?? {}),
|
|
145
132
|
JSON.stringify(skill.source ?? {}),
|
|
146
133
|
JSON.stringify(skill.serving ?? {}),
|
|
134
|
+
JSON.stringify(skill.related ?? []),
|
|
147
135
|
toISOString(skill.createdAt),
|
|
148
136
|
toISOString(skill.updatedAt),
|
|
149
137
|
);
|
|
@@ -226,13 +214,13 @@ export class SqliteStorageAdapter implements StorageAdapter {
|
|
|
226
214
|
}
|
|
227
215
|
|
|
228
216
|
async searchSkills(query: string): Promise<Skill[]> {
|
|
229
|
-
// Simple LIKE-based search across name, description, and
|
|
217
|
+
// Simple LIKE-based search across name, description, and instructions
|
|
230
218
|
const rows = this.db.prepare(`
|
|
231
219
|
SELECT * FROM skills
|
|
232
|
-
WHERE name LIKE ? OR description LIKE ? OR
|
|
220
|
+
WHERE name LIKE ? OR description LIKE ? OR instructions LIKE ?
|
|
233
221
|
ORDER BY updated_at DESC
|
|
234
222
|
`).all(
|
|
235
|
-
`%${query}%`, `%${query}%`, `%${query}
|
|
223
|
+
`%${query}%`, `%${query}%`, `%${query}%`
|
|
236
224
|
) as SkillRow[];
|
|
237
225
|
|
|
238
226
|
return rows.map(r => this.rowToSkill(r));
|
|
@@ -256,15 +244,11 @@ export class SqliteStorageAdapter implements StorageAdapter {
|
|
|
256
244
|
name: row.name,
|
|
257
245
|
version: row.version,
|
|
258
246
|
description: row.description ?? '',
|
|
259
|
-
|
|
260
|
-
solution: row.solution,
|
|
261
|
-
verification: row.verification ?? '',
|
|
262
|
-
notes: row.notes ?? undefined,
|
|
247
|
+
instructions: row.instructions,
|
|
263
248
|
author: row.author ?? 'unknown',
|
|
264
249
|
status: row.status as Skill['status'],
|
|
265
250
|
tags: JSON.parse(row.tags),
|
|
266
|
-
|
|
267
|
-
examples: JSON.parse(row.examples),
|
|
251
|
+
related: JSON.parse(row.related),
|
|
268
252
|
metrics: {
|
|
269
253
|
...metrics,
|
|
270
254
|
lastUsed: metrics.lastUsed ? new Date(metrics.lastUsed) : undefined,
|
|
@@ -290,7 +274,7 @@ function toISOString(value: Date | string | undefined): string {
|
|
|
290
274
|
* Simple content hash for version tracking.
|
|
291
275
|
*/
|
|
292
276
|
function hashSkill(skill: Skill): string {
|
|
293
|
-
const content = `${skill.name}:${skill.
|
|
277
|
+
const content = `${skill.name}:${skill.instructions}:${skill.version}`;
|
|
294
278
|
let hash = 0;
|
|
295
279
|
for (let i = 0; i < content.length; i++) {
|
|
296
280
|
const char = content.charCodeAt(i);
|
package/src/types/config.ts
CHANGED
|
@@ -100,6 +100,8 @@ export const StorageConfigSchema = z.object({
|
|
|
100
100
|
persistenceEnabled: z.boolean().default(true),
|
|
101
101
|
/** Auto-save interval in milliseconds */
|
|
102
102
|
autoSaveInterval: z.number().default(60000), // 1 minute
|
|
103
|
+
/** SQLite database filename (relative to baseDir) */
|
|
104
|
+
dbName: z.string().default('cognitive-core.db'),
|
|
103
105
|
});
|
|
104
106
|
|
|
105
107
|
export type StorageConfig = z.infer<typeof StorageConfigSchema>;
|
|
@@ -475,6 +477,8 @@ export const KnowledgeBankConfigSchema = z.object({
|
|
|
475
477
|
surfacing: KnowledgeSurfacingConfigSchema.default({}),
|
|
476
478
|
/** Whether to manage minimem-specific features (sync, versioning) */
|
|
477
479
|
minimemAware: z.boolean().default(true),
|
|
480
|
+
/** Enable coherence checking (contradiction detection) on note insertion */
|
|
481
|
+
coherenceChecking: z.boolean().default(true),
|
|
478
482
|
});
|
|
479
483
|
|
|
480
484
|
export type KnowledgeBankConfig = z.infer<typeof KnowledgeBankConfigSchema>;
|
|
@@ -511,6 +515,29 @@ export const SkillTreeConfigSchema = z.object({
|
|
|
511
515
|
|
|
512
516
|
export type SkillTreeConfig = z.infer<typeof SkillTreeConfigSchema>;
|
|
513
517
|
|
|
518
|
+
/**
|
|
519
|
+
* Feature toggles for ruvector-inspired subsystems.
|
|
520
|
+
*
|
|
521
|
+
* All default to `true`. Set to `false` to disable individual features
|
|
522
|
+
* without removing them from the codebase.
|
|
523
|
+
*/
|
|
524
|
+
export const FeaturesConfigSchema = z.object({
|
|
525
|
+
/** Enable instant (hot-path) learning on every trajectory (InstantLoop) */
|
|
526
|
+
instantLoop: z.boolean().default(true),
|
|
527
|
+
/** Enable reflexion episode generation and storage */
|
|
528
|
+
reflexion: z.boolean().default(true),
|
|
529
|
+
/** Enable coherence checking on knowledge note insertion */
|
|
530
|
+
coherenceChecking: z.boolean().default(true),
|
|
531
|
+
/** Enable experience clustering via ReasoningBank in batch pipeline */
|
|
532
|
+
reasoningBank: z.boolean().default(true),
|
|
533
|
+
/** Enable causal edge extraction in instant loop */
|
|
534
|
+
causalExtraction: z.boolean().default(true),
|
|
535
|
+
/** Enable temporal compression (Hot/Warm/Cold/Evict) in batch pipeline */
|
|
536
|
+
temporalCompression: z.boolean().default(true),
|
|
537
|
+
});
|
|
538
|
+
|
|
539
|
+
export type FeaturesConfig = z.infer<typeof FeaturesConfigSchema>;
|
|
540
|
+
|
|
514
541
|
/**
|
|
515
542
|
* Main Atlas configuration
|
|
516
543
|
*/
|
|
@@ -545,6 +572,8 @@ export const AtlasConfigSchema = z.object({
|
|
|
545
572
|
skillTree: SkillTreeConfigSchema.default({}),
|
|
546
573
|
/** Session bank configuration (Entire CLI integration) */
|
|
547
574
|
sessionBank: SessionBankConfigSchema.default({}),
|
|
575
|
+
/** Feature toggles for ruvector-inspired subsystems */
|
|
576
|
+
features: FeaturesConfigSchema.default({}),
|
|
548
577
|
});
|
|
549
578
|
|
|
550
579
|
export type AtlasConfig = z.infer<typeof AtlasConfigSchema>;
|
|
@@ -581,5 +610,6 @@ export function mergeConfig(
|
|
|
581
610
|
knowledgeBank: { ...base.knowledgeBank, ...overrides.knowledgeBank },
|
|
582
611
|
skillTree: { ...base.skillTree, ...overrides.skillTree },
|
|
583
612
|
sessionBank: { ...base.sessionBank, ...overrides.sessionBank },
|
|
613
|
+
features: { ...base.features, ...overrides.features },
|
|
584
614
|
});
|
|
585
615
|
}
|
package/src/types/index.ts
CHANGED
|
@@ -39,6 +39,7 @@ export {
|
|
|
39
39
|
CodeConceptSchema,
|
|
40
40
|
StrategySchema,
|
|
41
41
|
SkillSchema,
|
|
42
|
+
type ReflexionEpisode,
|
|
42
43
|
createExperience,
|
|
43
44
|
createConcept,
|
|
44
45
|
createStrategy,
|
|
@@ -250,6 +251,7 @@ export {
|
|
|
250
251
|
type DefragConfig,
|
|
251
252
|
type SkillTreeConfig,
|
|
252
253
|
type SessionBankConfig,
|
|
254
|
+
type FeaturesConfig,
|
|
253
255
|
type AtlasConfig,
|
|
254
256
|
SessionBankConfigSchema,
|
|
255
257
|
KnowledgeBankConfigSchema,
|
|
@@ -280,6 +282,7 @@ export {
|
|
|
280
282
|
TeamLearningConfigSchema,
|
|
281
283
|
AgenticTaskRunnerConfigSchema,
|
|
282
284
|
SkillTreeConfigSchema,
|
|
285
|
+
FeaturesConfigSchema,
|
|
283
286
|
AtlasConfigSchema,
|
|
284
287
|
createDefaultConfig,
|
|
285
288
|
mergeConfig,
|
package/src/types/memory.ts
CHANGED
|
@@ -22,10 +22,22 @@ export const ExperienceSchema = z.object({
|
|
|
22
22
|
trajectoryId: z.string(),
|
|
23
23
|
/** Usage statistics */
|
|
24
24
|
usageCount: z.number().default(0),
|
|
25
|
+
/** Composite access score — decays over time, bumped on retrieval/success */
|
|
26
|
+
accessScore: z.number().default(0),
|
|
27
|
+
/** Number of times this experience was a findSimilar() hit */
|
|
28
|
+
retrievalCount: z.number().default(0),
|
|
25
29
|
/** Creation timestamp */
|
|
26
30
|
createdAt: z.date().default(() => new Date()),
|
|
27
31
|
/** Last accessed timestamp */
|
|
28
32
|
lastAccessedAt: z.date().optional(),
|
|
33
|
+
/** Memory tier — determines fidelity and compression level */
|
|
34
|
+
tier: z.enum(['hot', 'warm', 'cold']).default('hot'),
|
|
35
|
+
/** Compressed representation (populated for warm/cold tiers) */
|
|
36
|
+
compressed: z.object({
|
|
37
|
+
keySteps: z.array(z.string()),
|
|
38
|
+
summary: z.string(),
|
|
39
|
+
originalStepCount: z.number(),
|
|
40
|
+
}).optional(),
|
|
29
41
|
/** Additional metadata */
|
|
30
42
|
metadata: z.record(z.unknown()).default({}),
|
|
31
43
|
});
|
|
@@ -145,6 +157,23 @@ export const SkillSchema = z.object({
|
|
|
145
157
|
|
|
146
158
|
export type Skill = z.infer<typeof SkillSchema>;
|
|
147
159
|
|
|
160
|
+
/**
|
|
161
|
+
* ReflexionEpisode — structured self-reflection on a completed trajectory.
|
|
162
|
+
* Generated by the ReflexionGenerator after each trajectory completion.
|
|
163
|
+
*/
|
|
164
|
+
export interface ReflexionEpisode {
|
|
165
|
+
id: string;
|
|
166
|
+
trajectoryId: string;
|
|
167
|
+
taskSummary: string;
|
|
168
|
+
outcome: 'success' | 'partial' | 'failure';
|
|
169
|
+
selfCritique: string;
|
|
170
|
+
keyInsights: string[];
|
|
171
|
+
strategyAssessment: string;
|
|
172
|
+
suggestedPlaybookUpdates: string[];
|
|
173
|
+
domain: string;
|
|
174
|
+
createdAt: Date;
|
|
175
|
+
}
|
|
176
|
+
|
|
148
177
|
/**
|
|
149
178
|
* Create a new experience
|
|
150
179
|
*/
|
|
@@ -168,6 +197,7 @@ export function createExperience(params: {
|
|
|
168
197
|
domain: params.domain,
|
|
169
198
|
trajectoryId: params.trajectoryId,
|
|
170
199
|
embedding: params.embedding,
|
|
200
|
+
accessScore: params.success ? 1.0 : 0.3,
|
|
171
201
|
metadata: params.metadata ?? {},
|
|
172
202
|
createdAt: new Date(),
|
|
173
203
|
});
|
package/src/types/playbook.ts
CHANGED
|
@@ -95,6 +95,10 @@ export interface PlaybookEvolution {
|
|
|
95
95
|
successCount: number;
|
|
96
96
|
failureCount: number;
|
|
97
97
|
lastUsed?: Date;
|
|
98
|
+
/** Resistance to confidence changes — grows with successful use breadth (EWC-inspired) */
|
|
99
|
+
consolidationStrength?: number; // default: 0, range [0, 10]
|
|
100
|
+
/** How many unique domains this playbook has succeeded in */
|
|
101
|
+
domainBreadth?: number; // default: 0
|
|
98
102
|
}
|
|
99
103
|
|
|
100
104
|
/**
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified error classification utility.
|
|
3
|
+
*
|
|
4
|
+
* Provides a single canonical error type mapping used by TrajectoryAnalyzer,
|
|
5
|
+
* ReflexionGenerator, KnowledgeExtractor, and other learning components.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Canonical error types recognized by the classifier.
|
|
10
|
+
*/
|
|
11
|
+
export type ErrorType =
|
|
12
|
+
| 'type-error'
|
|
13
|
+
| 'import-error'
|
|
14
|
+
| 'syntax-error'
|
|
15
|
+
| 'timeout'
|
|
16
|
+
| 'permission-error'
|
|
17
|
+
| 'not-found'
|
|
18
|
+
| 'network-error'
|
|
19
|
+
| 'test-failure'
|
|
20
|
+
| 'assertion-error'
|
|
21
|
+
| 'general-error';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Result of classifying an error string.
|
|
25
|
+
*/
|
|
26
|
+
export interface ErrorClassification {
|
|
27
|
+
/** Canonical error type */
|
|
28
|
+
type: ErrorType;
|
|
29
|
+
/** Human-readable description */
|
|
30
|
+
description: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Ordered list of error classification rules.
|
|
35
|
+
* More specific patterns come first; 'general-error' is the fallback.
|
|
36
|
+
*/
|
|
37
|
+
const ERROR_RULES: Array<{ test: (s: string) => boolean; type: ErrorType; description: string }> = [
|
|
38
|
+
{
|
|
39
|
+
test: (s) => /type\s*error/i.test(s) || (s.includes('type') && s.includes('error')),
|
|
40
|
+
type: 'type-error',
|
|
41
|
+
description: 'Type mismatch error',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
test: (s) => /import|module not found|cannot find module/i.test(s),
|
|
45
|
+
type: 'import-error',
|
|
46
|
+
description: 'Import or module resolution error',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
test: (s) => /syntax\s*error/i.test(s),
|
|
50
|
+
type: 'syntax-error',
|
|
51
|
+
description: 'Syntax error in code',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
test: (s) => /timeout|timed?\s*out/i.test(s),
|
|
55
|
+
type: 'timeout',
|
|
56
|
+
description: 'Operation timed out',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
test: (s) => /permission\s*denied|forbidden|unauthorized/i.test(s),
|
|
60
|
+
type: 'permission-error',
|
|
61
|
+
description: 'Permission denied',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
test: (s) => /not\s*found|missing|no\s*such\s*file/i.test(s),
|
|
65
|
+
type: 'not-found',
|
|
66
|
+
description: 'Resource not found',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
test: (s) => /network|connection|ECONNREFUSED|ENOTFOUND/i.test(s),
|
|
70
|
+
type: 'network-error',
|
|
71
|
+
description: 'Network or connection error',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
test: (s) => /test.*fail|fail.*test|assertion|assert/i.test(s),
|
|
75
|
+
type: 'test-failure',
|
|
76
|
+
description: 'Test or assertion failure',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
test: (s) => /assertion|assert/i.test(s),
|
|
80
|
+
type: 'assertion-error',
|
|
81
|
+
description: 'Assertion failed',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
test: (s) => /exception|error/i.test(s),
|
|
85
|
+
type: 'general-error',
|
|
86
|
+
description: 'General error',
|
|
87
|
+
},
|
|
88
|
+
];
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Classify an error message into a canonical error type.
|
|
92
|
+
* Returns `null` if no pattern matches.
|
|
93
|
+
*/
|
|
94
|
+
export function classifyError(errorInfo: string): ErrorClassification | null {
|
|
95
|
+
if (!errorInfo) return null;
|
|
96
|
+
|
|
97
|
+
for (const rule of ERROR_RULES) {
|
|
98
|
+
if (rule.test(errorInfo)) {
|
|
99
|
+
return { type: rule.type, description: rule.description };
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Get just the error type string (convenience wrapper).
|
|
108
|
+
* Returns `null` if no pattern matches.
|
|
109
|
+
*/
|
|
110
|
+
export function classifyErrorType(errorInfo: string): ErrorType | null {
|
|
111
|
+
const result = classifyError(errorInfo);
|
|
112
|
+
return result?.type ?? null;
|
|
113
|
+
}
|
package/src/utils/index.ts
CHANGED
|
@@ -19,6 +19,11 @@ export {
|
|
|
19
19
|
type StorageOptions,
|
|
20
20
|
} from './storage.js';
|
|
21
21
|
|
|
22
|
+
export {
|
|
23
|
+
PartitionedStore,
|
|
24
|
+
type PartitionedStoreOptions,
|
|
25
|
+
} from './partitioned-store.js';
|
|
26
|
+
|
|
22
27
|
export {
|
|
23
28
|
ValidationError,
|
|
24
29
|
validateString,
|
|
@@ -43,3 +48,16 @@ export {
|
|
|
43
48
|
serializeKnowledgeNote,
|
|
44
49
|
parseKnowledgeNote,
|
|
45
50
|
} from './frontmatter.js';
|
|
51
|
+
|
|
52
|
+
export {
|
|
53
|
+
classifyError,
|
|
54
|
+
classifyErrorType,
|
|
55
|
+
type ErrorType,
|
|
56
|
+
type ErrorClassification,
|
|
57
|
+
} from './error-classifier.js';
|
|
58
|
+
|
|
59
|
+
export {
|
|
60
|
+
detectRepeatedActions,
|
|
61
|
+
extractToolNames,
|
|
62
|
+
type RepeatedAction,
|
|
63
|
+
} from './trajectory-helpers.js';
|