@dragonflymcp/plugin 1.0.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-plugin/plugin.json +26 -0
- package/LICENSE +21 -0
- package/README.md +126 -0
- package/dist/core/annotations.d.ts +71 -0
- package/dist/core/annotations.d.ts.map +1 -0
- package/dist/core/annotations.js +61 -0
- package/dist/core/annotations.js.map +1 -0
- package/dist/core/config.d.ts +66 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +131 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/dispatcher.d.ts +77 -0
- package/dist/core/dispatcher.d.ts.map +1 -0
- package/dist/core/dispatcher.js +132 -0
- package/dist/core/dispatcher.js.map +1 -0
- package/dist/core/server.d.ts +24 -0
- package/dist/core/server.d.ts.map +1 -0
- package/dist/core/server.js +41 -0
- package/dist/core/server.js.map +1 -0
- package/dist/core/store.d.ts +91 -0
- package/dist/core/store.d.ts.map +1 -0
- package/dist/core/store.js +157 -0
- package/dist/core/store.js.map +1 -0
- package/dist/core/types.d.ts +128 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +5 -0
- package/dist/core/types.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +81 -0
- package/dist/index.js.map +1 -0
- package/dist/test-utils/store-harness.d.ts +41 -0
- package/dist/test-utils/store-harness.d.ts.map +1 -0
- package/dist/test-utils/store-harness.js +61 -0
- package/dist/test-utils/store-harness.js.map +1 -0
- package/dist/tools/analytics/aggregators.d.ts +18 -0
- package/dist/tools/analytics/aggregators.d.ts.map +1 -0
- package/dist/tools/analytics/aggregators.js +260 -0
- package/dist/tools/analytics/aggregators.js.map +1 -0
- package/dist/tools/analytics/aggregators.test.d.ts +2 -0
- package/dist/tools/analytics/aggregators.test.d.ts.map +1 -0
- package/dist/tools/analytics/aggregators.test.js +177 -0
- package/dist/tools/analytics/aggregators.test.js.map +1 -0
- package/dist/tools/analytics/drift.d.ts +15 -0
- package/dist/tools/analytics/drift.d.ts.map +1 -0
- package/dist/tools/analytics/drift.js +135 -0
- package/dist/tools/analytics/drift.js.map +1 -0
- package/dist/tools/analytics/drift.test.d.ts +2 -0
- package/dist/tools/analytics/drift.test.d.ts.map +1 -0
- package/dist/tools/analytics/drift.test.js +99 -0
- package/dist/tools/analytics/drift.test.js.map +1 -0
- package/dist/tools/analytics/index.d.ts +10 -0
- package/dist/tools/analytics/index.d.ts.map +1 -0
- package/dist/tools/analytics/index.js +192 -0
- package/dist/tools/analytics/index.js.map +1 -0
- package/dist/tools/analytics/learner.d.ts +29 -0
- package/dist/tools/analytics/learner.d.ts.map +1 -0
- package/dist/tools/analytics/learner.js +135 -0
- package/dist/tools/analytics/learner.js.map +1 -0
- package/dist/tools/analytics/learner.test.d.ts +2 -0
- package/dist/tools/analytics/learner.test.d.ts.map +1 -0
- package/dist/tools/analytics/learner.test.js +118 -0
- package/dist/tools/analytics/learner.test.js.map +1 -0
- package/dist/tools/analytics/observe.d.ts +22 -0
- package/dist/tools/analytics/observe.d.ts.map +1 -0
- package/dist/tools/analytics/observe.js +143 -0
- package/dist/tools/analytics/observe.js.map +1 -0
- package/dist/tools/analytics/observe.test.d.ts +2 -0
- package/dist/tools/analytics/observe.test.d.ts.map +1 -0
- package/dist/tools/analytics/observe.test.js +95 -0
- package/dist/tools/analytics/observe.test.js.map +1 -0
- package/dist/tools/analytics/store.d.ts +29 -0
- package/dist/tools/analytics/store.d.ts.map +1 -0
- package/dist/tools/analytics/store.js +192 -0
- package/dist/tools/analytics/store.js.map +1 -0
- package/dist/tools/analytics/types.d.ts +290 -0
- package/dist/tools/analytics/types.d.ts.map +1 -0
- package/dist/tools/analytics/types.js +7 -0
- package/dist/tools/analytics/types.js.map +1 -0
- package/dist/tools/ast/index.d.ts +8 -0
- package/dist/tools/ast/index.d.ts.map +1 -0
- package/dist/tools/ast/index.js +242 -0
- package/dist/tools/ast/index.js.map +1 -0
- package/dist/tools/ast/indexer.d.ts +41 -0
- package/dist/tools/ast/indexer.d.ts.map +1 -0
- package/dist/tools/ast/indexer.js +617 -0
- package/dist/tools/ast/indexer.js.map +1 -0
- package/dist/tools/ast/store.d.ts +87 -0
- package/dist/tools/ast/store.d.ts.map +1 -0
- package/dist/tools/ast/store.js +280 -0
- package/dist/tools/ast/store.js.map +1 -0
- package/dist/tools/ast/store.test.d.ts +6 -0
- package/dist/tools/ast/store.test.d.ts.map +1 -0
- package/dist/tools/ast/store.test.js +257 -0
- package/dist/tools/ast/store.test.js.map +1 -0
- package/dist/tools/bridge/bridge.d.ts +37 -0
- package/dist/tools/bridge/bridge.d.ts.map +1 -0
- package/dist/tools/bridge/bridge.js +82 -0
- package/dist/tools/bridge/bridge.js.map +1 -0
- package/dist/tools/bridge/bridge.test.d.ts +2 -0
- package/dist/tools/bridge/bridge.test.d.ts.map +1 -0
- package/dist/tools/bridge/bridge.test.js +119 -0
- package/dist/tools/bridge/bridge.test.js.map +1 -0
- package/dist/tools/bridge/index.d.ts +8 -0
- package/dist/tools/bridge/index.d.ts.map +1 -0
- package/dist/tools/bridge/index.js +153 -0
- package/dist/tools/bridge/index.js.map +1 -0
- package/dist/tools/bridge/store.d.ts +45 -0
- package/dist/tools/bridge/store.d.ts.map +1 -0
- package/dist/tools/bridge/store.js +307 -0
- package/dist/tools/bridge/store.js.map +1 -0
- package/dist/tools/bridge/store.test.d.ts +2 -0
- package/dist/tools/bridge/store.test.d.ts.map +1 -0
- package/dist/tools/bridge/store.test.js +180 -0
- package/dist/tools/bridge/store.test.js.map +1 -0
- package/dist/tools/bridge/types.d.ts +44 -0
- package/dist/tools/bridge/types.d.ts.map +1 -0
- package/dist/tools/bridge/types.js +6 -0
- package/dist/tools/bridge/types.js.map +1 -0
- package/dist/tools/evolve/algorithm.d.ts +33 -0
- package/dist/tools/evolve/algorithm.d.ts.map +1 -0
- package/dist/tools/evolve/algorithm.js +64 -0
- package/dist/tools/evolve/algorithm.js.map +1 -0
- package/dist/tools/evolve/algorithm.test.d.ts +6 -0
- package/dist/tools/evolve/algorithm.test.d.ts.map +1 -0
- package/dist/tools/evolve/algorithm.test.js +138 -0
- package/dist/tools/evolve/algorithm.test.js.map +1 -0
- package/dist/tools/evolve/index.d.ts +11 -0
- package/dist/tools/evolve/index.d.ts.map +1 -0
- package/dist/tools/evolve/index.js +300 -0
- package/dist/tools/evolve/index.js.map +1 -0
- package/dist/tools/evolve/store.d.ts +27 -0
- package/dist/tools/evolve/store.d.ts.map +1 -0
- package/dist/tools/evolve/store.js +147 -0
- package/dist/tools/evolve/store.js.map +1 -0
- package/dist/tools/evolve/store.test.d.ts +6 -0
- package/dist/tools/evolve/store.test.d.ts.map +1 -0
- package/dist/tools/evolve/store.test.js +162 -0
- package/dist/tools/evolve/store.test.js.map +1 -0
- package/dist/tools/evolve/types.d.ts +38 -0
- package/dist/tools/evolve/types.d.ts.map +1 -0
- package/dist/tools/evolve/types.js +6 -0
- package/dist/tools/evolve/types.js.map +1 -0
- package/dist/tools/framework/content-loader.d.ts +45 -0
- package/dist/tools/framework/content-loader.d.ts.map +1 -0
- package/dist/tools/framework/content-loader.js +258 -0
- package/dist/tools/framework/content-loader.js.map +1 -0
- package/dist/tools/framework/content-loader.test.d.ts +5 -0
- package/dist/tools/framework/content-loader.test.d.ts.map +1 -0
- package/dist/tools/framework/content-loader.test.js +262 -0
- package/dist/tools/framework/content-loader.test.js.map +1 -0
- package/dist/tools/framework/index.d.ts +30 -0
- package/dist/tools/framework/index.d.ts.map +1 -0
- package/dist/tools/framework/index.js +517 -0
- package/dist/tools/framework/index.js.map +1 -0
- package/dist/tools/framework/session.d.ts +85 -0
- package/dist/tools/framework/session.d.ts.map +1 -0
- package/dist/tools/framework/session.js +311 -0
- package/dist/tools/framework/session.js.map +1 -0
- package/dist/tools/framework/session.test.d.ts +5 -0
- package/dist/tools/framework/session.test.d.ts.map +1 -0
- package/dist/tools/framework/session.test.js +291 -0
- package/dist/tools/framework/session.test.js.map +1 -0
- package/dist/tools/framework/sync-evaluator.d.ts +41 -0
- package/dist/tools/framework/sync-evaluator.d.ts.map +1 -0
- package/dist/tools/framework/sync-evaluator.js +298 -0
- package/dist/tools/framework/sync-evaluator.js.map +1 -0
- package/dist/tools/framework/sync-evaluator.test.d.ts +5 -0
- package/dist/tools/framework/sync-evaluator.test.d.ts.map +1 -0
- package/dist/tools/framework/sync-evaluator.test.js +288 -0
- package/dist/tools/framework/sync-evaluator.test.js.map +1 -0
- package/dist/tools/framework/types.d.ts +279 -0
- package/dist/tools/framework/types.d.ts.map +1 -0
- package/dist/tools/framework/types.js +6 -0
- package/dist/tools/framework/types.js.map +1 -0
- package/dist/tools/framework/workflow-intelligence.d.ts +55 -0
- package/dist/tools/framework/workflow-intelligence.d.ts.map +1 -0
- package/dist/tools/framework/workflow-intelligence.js +199 -0
- package/dist/tools/framework/workflow-intelligence.js.map +1 -0
- package/dist/tools/framework/workflow-intelligence.test.d.ts +6 -0
- package/dist/tools/framework/workflow-intelligence.test.d.ts.map +1 -0
- package/dist/tools/framework/workflow-intelligence.test.js +257 -0
- package/dist/tools/framework/workflow-intelligence.test.js.map +1 -0
- package/dist/tools/framework/workflow-planner.d.ts +10 -0
- package/dist/tools/framework/workflow-planner.d.ts.map +1 -0
- package/dist/tools/framework/workflow-planner.js +214 -0
- package/dist/tools/framework/workflow-planner.js.map +1 -0
- package/dist/tools/framework/workflow-planner.test.d.ts +5 -0
- package/dist/tools/framework/workflow-planner.test.d.ts.map +1 -0
- package/dist/tools/framework/workflow-planner.test.js +137 -0
- package/dist/tools/framework/workflow-planner.test.js.map +1 -0
- package/dist/tools/knowledge/bridge.d.ts +34 -0
- package/dist/tools/knowledge/bridge.d.ts.map +1 -0
- package/dist/tools/knowledge/bridge.js +249 -0
- package/dist/tools/knowledge/bridge.js.map +1 -0
- package/dist/tools/knowledge/bridge.test.d.ts +5 -0
- package/dist/tools/knowledge/bridge.test.d.ts.map +1 -0
- package/dist/tools/knowledge/bridge.test.js +221 -0
- package/dist/tools/knowledge/bridge.test.js.map +1 -0
- package/dist/tools/knowledge/extractor.d.ts +22 -0
- package/dist/tools/knowledge/extractor.d.ts.map +1 -0
- package/dist/tools/knowledge/extractor.js +154 -0
- package/dist/tools/knowledge/extractor.js.map +1 -0
- package/dist/tools/knowledge/index.d.ts +12 -0
- package/dist/tools/knowledge/index.d.ts.map +1 -0
- package/dist/tools/knowledge/index.js +505 -0
- package/dist/tools/knowledge/index.js.map +1 -0
- package/dist/tools/knowledge/retrieval.d.ts +28 -0
- package/dist/tools/knowledge/retrieval.d.ts.map +1 -0
- package/dist/tools/knowledge/retrieval.js +164 -0
- package/dist/tools/knowledge/retrieval.js.map +1 -0
- package/dist/tools/knowledge/store.d.ts +96 -0
- package/dist/tools/knowledge/store.d.ts.map +1 -0
- package/dist/tools/knowledge/store.js +562 -0
- package/dist/tools/knowledge/store.js.map +1 -0
- package/dist/tools/knowledge/store.test.d.ts +6 -0
- package/dist/tools/knowledge/store.test.d.ts.map +1 -0
- package/dist/tools/knowledge/store.test.js +385 -0
- package/dist/tools/knowledge/store.test.js.map +1 -0
- package/dist/tools/knowledge/types.d.ts +168 -0
- package/dist/tools/knowledge/types.d.ts.map +1 -0
- package/dist/tools/knowledge/types.js +6 -0
- package/dist/tools/knowledge/types.js.map +1 -0
- package/dist/tools/memory/evolution.d.ts +31 -0
- package/dist/tools/memory/evolution.d.ts.map +1 -0
- package/dist/tools/memory/evolution.js +130 -0
- package/dist/tools/memory/evolution.js.map +1 -0
- package/dist/tools/memory/index.d.ts +11 -0
- package/dist/tools/memory/index.d.ts.map +1 -0
- package/dist/tools/memory/index.js +239 -0
- package/dist/tools/memory/index.js.map +1 -0
- package/dist/tools/memory/store.d.ts +75 -0
- package/dist/tools/memory/store.d.ts.map +1 -0
- package/dist/tools/memory/store.js +398 -0
- package/dist/tools/memory/store.js.map +1 -0
- package/dist/tools/memory/store.test.d.ts +6 -0
- package/dist/tools/memory/store.test.d.ts.map +1 -0
- package/dist/tools/memory/store.test.js +429 -0
- package/dist/tools/memory/store.test.js.map +1 -0
- package/dist/tools/memory/types.d.ts +171 -0
- package/dist/tools/memory/types.d.ts.map +1 -0
- package/dist/tools/memory/types.js +6 -0
- package/dist/tools/memory/types.js.map +1 -0
- package/dist/tools/pipeline/composer.d.ts +29 -0
- package/dist/tools/pipeline/composer.d.ts.map +1 -0
- package/dist/tools/pipeline/composer.js +225 -0
- package/dist/tools/pipeline/composer.js.map +1 -0
- package/dist/tools/pipeline/composer.test.d.ts +2 -0
- package/dist/tools/pipeline/composer.test.d.ts.map +1 -0
- package/dist/tools/pipeline/composer.test.js +162 -0
- package/dist/tools/pipeline/composer.test.js.map +1 -0
- package/dist/tools/pipeline/index.d.ts +8 -0
- package/dist/tools/pipeline/index.d.ts.map +1 -0
- package/dist/tools/pipeline/index.js +102 -0
- package/dist/tools/pipeline/index.js.map +1 -0
- package/dist/tools/pipeline/planner.d.ts +10 -0
- package/dist/tools/pipeline/planner.d.ts.map +1 -0
- package/dist/tools/pipeline/planner.js +147 -0
- package/dist/tools/pipeline/planner.js.map +1 -0
- package/dist/tools/pipeline/planner.test.d.ts +2 -0
- package/dist/tools/pipeline/planner.test.d.ts.map +1 -0
- package/dist/tools/pipeline/planner.test.js +96 -0
- package/dist/tools/pipeline/planner.test.js.map +1 -0
- package/dist/tools/pipeline/preconditions.d.ts +14 -0
- package/dist/tools/pipeline/preconditions.d.ts.map +1 -0
- package/dist/tools/pipeline/preconditions.js +65 -0
- package/dist/tools/pipeline/preconditions.js.map +1 -0
- package/dist/tools/pipeline/preconditions.test.d.ts +2 -0
- package/dist/tools/pipeline/preconditions.test.d.ts.map +1 -0
- package/dist/tools/pipeline/preconditions.test.js +74 -0
- package/dist/tools/pipeline/preconditions.test.js.map +1 -0
- package/dist/tools/pipeline/types.d.ts +105 -0
- package/dist/tools/pipeline/types.d.ts.map +1 -0
- package/dist/tools/pipeline/types.js +6 -0
- package/dist/tools/pipeline/types.js.map +1 -0
- package/dist/tools/repair/index.d.ts +8 -0
- package/dist/tools/repair/index.d.ts.map +1 -0
- package/dist/tools/repair/index.js +384 -0
- package/dist/tools/repair/index.js.map +1 -0
- package/dist/tools/repair/repairer.d.ts +67 -0
- package/dist/tools/repair/repairer.d.ts.map +1 -0
- package/dist/tools/repair/repairer.js +257 -0
- package/dist/tools/repair/repairer.js.map +1 -0
- package/dist/tools/repair/repairer.test.d.ts +6 -0
- package/dist/tools/repair/repairer.test.d.ts.map +1 -0
- package/dist/tools/repair/repairer.test.js +159 -0
- package/dist/tools/repair/repairer.test.js.map +1 -0
- package/dist/tools/semantic/chunker.d.ts +23 -0
- package/dist/tools/semantic/chunker.d.ts.map +1 -0
- package/dist/tools/semantic/chunker.js +244 -0
- package/dist/tools/semantic/chunker.js.map +1 -0
- package/dist/tools/semantic/embedder.d.ts +16 -0
- package/dist/tools/semantic/embedder.d.ts.map +1 -0
- package/dist/tools/semantic/embedder.js +88 -0
- package/dist/tools/semantic/embedder.js.map +1 -0
- package/dist/tools/semantic/index.d.ts +8 -0
- package/dist/tools/semantic/index.d.ts.map +1 -0
- package/dist/tools/semantic/index.js +144 -0
- package/dist/tools/semantic/index.js.map +1 -0
- package/dist/tools/semantic/store.d.ts +31 -0
- package/dist/tools/semantic/store.d.ts.map +1 -0
- package/dist/tools/semantic/store.js +168 -0
- package/dist/tools/semantic/store.js.map +1 -0
- package/dist/tools/semantic/store.test.d.ts +6 -0
- package/dist/tools/semantic/store.test.d.ts.map +1 -0
- package/dist/tools/semantic/store.test.js +240 -0
- package/dist/tools/semantic/store.test.js.map +1 -0
- package/dist/tools/spec/generator.d.ts +32 -0
- package/dist/tools/spec/generator.d.ts.map +1 -0
- package/dist/tools/spec/generator.js +278 -0
- package/dist/tools/spec/generator.js.map +1 -0
- package/dist/tools/spec/generator.test.d.ts +6 -0
- package/dist/tools/spec/generator.test.d.ts.map +1 -0
- package/dist/tools/spec/generator.test.js +208 -0
- package/dist/tools/spec/generator.test.js.map +1 -0
- package/dist/tools/spec/index.d.ts +11 -0
- package/dist/tools/spec/index.d.ts.map +1 -0
- package/dist/tools/spec/index.js +426 -0
- package/dist/tools/spec/index.js.map +1 -0
- package/dist/tools/spec/store.d.ts +24 -0
- package/dist/tools/spec/store.d.ts.map +1 -0
- package/dist/tools/spec/store.js +104 -0
- package/dist/tools/spec/store.js.map +1 -0
- package/dist/tools/spec/store.test.d.ts +6 -0
- package/dist/tools/spec/store.test.d.ts.map +1 -0
- package/dist/tools/spec/store.test.js +173 -0
- package/dist/tools/spec/store.test.js.map +1 -0
- package/dist/tools/spec/types.d.ts +61 -0
- package/dist/tools/spec/types.d.ts.map +1 -0
- package/dist/tools/spec/types.js +6 -0
- package/dist/tools/spec/types.js.map +1 -0
- package/dist/tools/state/index.d.ts +11 -0
- package/dist/tools/state/index.d.ts.map +1 -0
- package/dist/tools/state/index.js +386 -0
- package/dist/tools/state/index.js.map +1 -0
- package/dist/tools/state/migrate.d.ts +39 -0
- package/dist/tools/state/migrate.d.ts.map +1 -0
- package/dist/tools/state/migrate.js +242 -0
- package/dist/tools/state/migrate.js.map +1 -0
- package/dist/tools/state/migrate.test.d.ts +2 -0
- package/dist/tools/state/migrate.test.d.ts.map +1 -0
- package/dist/tools/state/migrate.test.js +265 -0
- package/dist/tools/state/migrate.test.js.map +1 -0
- package/dist/tools/state/store.d.ts +107 -0
- package/dist/tools/state/store.d.ts.map +1 -0
- package/dist/tools/state/store.js +365 -0
- package/dist/tools/state/store.js.map +1 -0
- package/dist/tools/state/store.test.d.ts +5 -0
- package/dist/tools/state/store.test.d.ts.map +1 -0
- package/dist/tools/state/store.test.js +293 -0
- package/dist/tools/state/store.test.js.map +1 -0
- package/dist/tools/state/types.d.ts +90 -0
- package/dist/tools/state/types.d.ts.map +1 -0
- package/dist/tools/state/types.js +6 -0
- package/dist/tools/state/types.js.map +1 -0
- package/dist/tools/testing/analyzer.d.ts +44 -0
- package/dist/tools/testing/analyzer.d.ts.map +1 -0
- package/dist/tools/testing/analyzer.js +280 -0
- package/dist/tools/testing/analyzer.js.map +1 -0
- package/dist/tools/testing/generator.d.ts +57 -0
- package/dist/tools/testing/generator.d.ts.map +1 -0
- package/dist/tools/testing/generator.js +478 -0
- package/dist/tools/testing/generator.js.map +1 -0
- package/dist/tools/testing/generator.test.d.ts +6 -0
- package/dist/tools/testing/generator.test.d.ts.map +1 -0
- package/dist/tools/testing/generator.test.js +285 -0
- package/dist/tools/testing/generator.test.js.map +1 -0
- package/dist/tools/testing/index.d.ts +8 -0
- package/dist/tools/testing/index.d.ts.map +1 -0
- package/dist/tools/testing/index.js +373 -0
- package/dist/tools/testing/index.js.map +1 -0
- package/dist/utils/embedder.d.ts +7 -0
- package/dist/utils/embedder.d.ts.map +1 -0
- package/dist/utils/embedder.js +13 -0
- package/dist/utils/embedder.js.map +1 -0
- package/dist/utils/execution.d.ts +68 -0
- package/dist/utils/execution.d.ts.map +1 -0
- package/dist/utils/execution.js +467 -0
- package/dist/utils/execution.js.map +1 -0
- package/dist/utils/graph.d.ts +26 -0
- package/dist/utils/graph.d.ts.map +1 -0
- package/dist/utils/graph.js +32 -0
- package/dist/utils/graph.js.map +1 -0
- package/dist/utils/guards.d.ts +32 -0
- package/dist/utils/guards.d.ts.map +1 -0
- package/dist/utils/guards.js +40 -0
- package/dist/utils/guards.js.map +1 -0
- package/dist/utils/ids.d.ts +5 -0
- package/dist/utils/ids.d.ts.map +1 -0
- package/dist/utils/ids.js +7 -0
- package/dist/utils/ids.js.map +1 -0
- package/dist/utils/languages.d.ts +34 -0
- package/dist/utils/languages.d.ts.map +1 -0
- package/dist/utils/languages.js +153 -0
- package/dist/utils/languages.js.map +1 -0
- package/dist/utils/lazy.d.ts +17 -0
- package/dist/utils/lazy.d.ts.map +1 -0
- package/dist/utils/lazy.js +35 -0
- package/dist/utils/lazy.js.map +1 -0
- package/dist/utils/project.d.ts +41 -0
- package/dist/utils/project.d.ts.map +1 -0
- package/dist/utils/project.js +82 -0
- package/dist/utils/project.js.map +1 -0
- package/dist/utils/responses.d.ts +27 -0
- package/dist/utils/responses.d.ts.map +1 -0
- package/dist/utils/responses.js +72 -0
- package/dist/utils/responses.js.map +1 -0
- package/dist/utils/vectors.d.ts +33 -0
- package/dist/utils/vectors.d.ts.map +1 -0
- package/dist/utils/vectors.js +80 -0
- package/dist/utils/vectors.js.map +1 -0
- package/dist/utils/vectors.test.d.ts +6 -0
- package/dist/utils/vectors.test.d.ts.map +1 -0
- package/dist/utils/vectors.test.js +96 -0
- package/dist/utils/vectors.test.js.map +1 -0
- package/package.json +69 -0
- package/scripts/init.js +142 -0
- package/templates/CLAUDE.md.template +96 -0
- package/templates/agents/architecture-concept.md +237 -0
- package/templates/agents/checkpoint-concept.md +218 -0
- package/templates/agents/code-analysis-concept.md +171 -0
- package/templates/agents/compete-control.md +44 -0
- package/templates/agents/compete-evaluator.md +87 -0
- package/templates/agents/compete-treatment.md +55 -0
- package/templates/agents/context-concept.md +254 -0
- package/templates/agents/debate-advocate.md +127 -0
- package/templates/agents/debate-critic.md +119 -0
- package/templates/agents/debate-synthesis.md +160 -0
- package/templates/agents/documentation-concept.md +294 -0
- package/templates/agents/implementation-concept.md +165 -0
- package/templates/agents/quality-concept.md +299 -0
- package/templates/agents/research-concept.md +169 -0
- package/templates/agents/security-concept.md +255 -0
- package/templates/agents/story-concept.md +207 -0
- package/templates/agents/verification-concept.md +456 -0
- package/templates/agents/version-concept.md +163 -0
- package/templates/anchors/directory.anchor.yaml.template +53 -0
- package/templates/anchors/rules.anchor.yaml.template +70 -0
- package/templates/anchors/safety.anchor.yaml.template +96 -0
- package/templates/claude-md-managed.template +105 -0
- package/templates/commands/cache.md.template +439 -0
- package/templates/commands/checkpoint.md.template +121 -0
- package/templates/commands/classify.md.template +138 -0
- package/templates/commands/compete.md.template +90 -0
- package/templates/commands/costs.md.template +111 -0
- package/templates/commands/estimate.md.template +196 -0
- package/templates/commands/explore.md.template +186 -0
- package/templates/commands/feature.md.template +216 -0
- package/templates/commands/forget.md.template +104 -0
- package/templates/commands/global-recall.md.template +250 -0
- package/templates/commands/global-remember.md.template +187 -0
- package/templates/commands/health.md.template +107 -0
- package/templates/commands/help.md.template +253 -0
- package/templates/commands/observe.md.template +211 -0
- package/templates/commands/pr-review.md.template +164 -0
- package/templates/commands/predict-cost.md.template +251 -0
- package/templates/commands/profile.md.template +142 -0
- package/templates/commands/reasoning.md.template +228 -0
- package/templates/commands/recall.md.template +197 -0
- package/templates/commands/remember.md.template +148 -0
- package/templates/commands/replay.md.template +449 -0
- package/templates/commands/restore.md.template +87 -0
- package/templates/commands/retrospective.md.template +47 -0
- package/templates/commands/slo.md.template +286 -0
- package/templates/commands/spec.md.template +164 -0
- package/templates/commands/status.md.template +53 -0
- package/templates/commands/sync.md.template +321 -0
- package/templates/commands/task.md.template +86 -0
- package/templates/commands/trace.md.template +86 -0
- package/templates/commands/visualize.md.template +216 -0
- package/templates/commands/workflow.md.template +375 -0
- package/templates/concepts/README.md +329 -0
- package/templates/concepts/architecture.md.template +74 -0
- package/templates/concepts/code-analysis.md.template +186 -0
- package/templates/concepts/context-compactor.md.template +393 -0
- package/templates/concepts/context.md.template +62 -0
- package/templates/concepts/documentation.md.template +452 -0
- package/templates/concepts/estimator.md.template +214 -0
- package/templates/concepts/exploration.md.template +257 -0
- package/templates/concepts/global-memory.md.template +222 -0
- package/templates/concepts/implementation.md.template +62 -0
- package/templates/concepts/pr-review.md.template +277 -0
- package/templates/concepts/project-profile.md.template +358 -0
- package/templates/concepts/quality.md.template +63 -0
- package/templates/concepts/react-fallback.md.template +286 -0
- package/templates/concepts/research.md.template +221 -0
- package/templates/concepts/retrospective.md.template +93 -0
- package/templates/concepts/security.md.template +442 -0
- package/templates/concepts/slo.md.template +274 -0
- package/templates/concepts/spec.md.template +71 -0
- package/templates/concepts/story.md.template +50 -0
- package/templates/concepts/tool-router.md.template +289 -0
- package/templates/concepts/verification-synthesizer.md.template +279 -0
- package/templates/concepts/version.md.template +61 -0
- package/templates/config.yaml.template +347 -0
- package/templates/examples/README.md +77 -0
- package/templates/examples/architecture/api-design.yaml.template +286 -0
- package/templates/examples/architecture/oauth-authentication.yaml.template +305 -0
- package/templates/health/status.yaml.template +120 -0
- package/templates/hooks/concept-complete.sh.template +45 -0
- package/templates/hooks/lib/common.sh.template +160 -0
- package/templates/hooks/post-commit.sh.template +37 -0
- package/templates/hooks/post-concept-action.template +39 -0
- package/templates/hooks/post-tool-structure-check.sh.template +138 -0
- package/templates/hooks/post-tool-use.sh.template +51 -0
- package/templates/hooks/pre-compact.sh.template +48 -0
- package/templates/hooks/pre-tool-grounding.template +148 -0
- package/templates/hooks/session-exit-checkpoint.sh.template +35 -0
- package/templates/hooks/session-start.sh.template +67 -0
- package/templates/hooks/statusline.sh.template +148 -0
- package/templates/hooks/stop.sh.template +45 -0
- package/templates/hooks/subagent-stop.sh.template +40 -0
- package/templates/hooks/sync-blocked.sh.template +45 -0
- package/templates/hooks/timeout.sh.template +48 -0
- package/templates/hooks/user-prompt-submit.sh.template +68 -0
- package/templates/koan/README.md +58 -0
- package/templates/memory/index.yaml.template +48 -0
- package/templates/memory/procedural/debugging.yaml.template +24 -0
- package/templates/memory/procedural/workflows.yaml.template +22 -0
- package/templates/memory/semantic/architecture.yaml.template +21 -0
- package/templates/memory/semantic/conventions.yaml.template +18 -0
- package/templates/memory/semantic/patterns.yaml.template +21 -0
- package/templates/memory/semantic/preferences.yaml.template +18 -0
- package/templates/prompts/architecture.yaml.template +349 -0
- package/templates/prompts/context.yaml.template +384 -0
- package/templates/prompts/implementation.yaml.template +365 -0
- package/templates/prompts/planning.yaml.template +303 -0
- package/templates/prompts/quality.yaml.template +345 -0
- package/templates/prompts/retrospective.yaml.template +231 -0
- package/templates/prompts/slo.yaml.template +360 -0
- package/templates/prompts/story.yaml.template +236 -0
- package/templates/prompts/tree-of-thoughts.yaml.template +299 -0
- package/templates/prompts/verification.yaml.template +286 -0
- package/templates/prompts/version.yaml.template +279 -0
- package/templates/schemas/agent-schema.json +98 -0
- package/templates/schemas/architecture.schema.json +69 -0
- package/templates/schemas/config-schema.json +165 -0
- package/templates/schemas/implementation.schema.json +75 -0
- package/templates/schemas/planning.schema.json +243 -0
- package/templates/schemas/provenance.schema.json +111 -0
- package/templates/schemas/retrospective.schema.json +174 -0
- package/templates/schemas/review.schema.json +284 -0
- package/templates/schemas/slo.schema.json +443 -0
- package/templates/schemas/story.schema.json +68 -0
- package/templates/schemas/sync-schema.json +196 -0
- package/templates/schemas/task.schema.json +127 -0
- package/templates/schemas/tree-of-thoughts.schema.json +175 -0
- package/templates/schemas/verification.schema.json +106 -0
- package/templates/settings.full.json.template +135 -0
- package/templates/settings.minimal.json.template +68 -0
- package/templates/settings.standard.json.template +135 -0
- package/templates/skills/acceptance-criteria-generation.md.template +330 -0
- package/templates/skills/accessibility-checking.md.template +341 -0
- package/templates/skills/api-design-patterns.md.template +395 -0
- package/templates/skills/batch-processing.md.template +605 -0
- package/templates/skills/branch-strategy.md.template +362 -0
- package/templates/skills/changelog-generation.md.template +403 -0
- package/templates/skills/code-coverage-analysis.md.template +362 -0
- package/templates/skills/code-style-enforcement.md.template +294 -0
- package/templates/skills/code-template-patterns.md.template +419 -0
- package/templates/skills/concept-development.md.template +159 -0
- package/templates/skills/context-prioritization.md.template +306 -0
- package/templates/skills/cost-optimization.md.template +482 -0
- package/templates/skills/cross-project-knowledge.md.template +316 -0
- package/templates/skills/dependency-impact-analysis.md.template +263 -0
- package/templates/skills/documentation-generation.md.template +409 -0
- package/templates/skills/effort-estimation.md.template +350 -0
- package/templates/skills/error-classification.md.template +709 -0
- package/templates/skills/error-messages.md.template +339 -0
- package/templates/skills/ide-diagnostics.md.template +480 -0
- package/templates/skills/incremental-loading.md.template +574 -0
- package/templates/skills/output-caching.md.template +524 -0
- package/templates/skills/performance-estimation.md.template +325 -0
- package/templates/skills/performance-testing-patterns.md.template +341 -0
- package/templates/skills/phase2-optimizations-summary.md.template +458 -0
- package/templates/skills/progressive-disclosure-pattern.md.template +190 -0
- package/templates/skills/project-structure.md.template +372 -0
- package/templates/skills/provenance-analysis.md.template +609 -0
- package/templates/skills/react-executor.md.template +366 -0
- package/templates/skills/refactoring-patterns.md.template +422 -0
- package/templates/skills/release-management.md.template +373 -0
- package/templates/skills/requirement-prioritization.md.template +357 -0
- package/templates/skills/schema-validation.md.template +321 -0
- package/templates/skills/security-design-patterns.md.template +692 -0
- package/templates/skills/security-vulnerability-scanning.md.template +663 -0
- package/templates/skills/semantic-memory.md.template +266 -0
- package/templates/skills/semantic-versioning.md.template +371 -0
- package/templates/skills/smart-retry.md.template +676 -0
- package/templates/skills/smart-summarization.md.template +358 -0
- package/templates/skills/story-decomposition.md.template +278 -0
- package/templates/skills/synchronization-patterns.md.template +303 -0
- package/templates/skills/test-generation-strategy.md.template +247 -0
- package/templates/skills/workflow-replay.md.template +478 -0
- package/templates/skills/wysiwid-principles.md.template +364 -0
- package/templates/skills-manifest.yaml.template +526 -0
- package/templates/stubs/agents/architecture-concept.md +20 -0
- package/templates/stubs/agents/checkpoint-concept.md +19 -0
- package/templates/stubs/agents/code-analysis-concept.md +36 -0
- package/templates/stubs/agents/context-concept.md +37 -0
- package/templates/stubs/agents/debate-advocate.md +12 -0
- package/templates/stubs/agents/debate-critic.md +12 -0
- package/templates/stubs/agents/debate-synthesis.md +12 -0
- package/templates/stubs/agents/documentation-concept.md +39 -0
- package/templates/stubs/agents/implementation-concept.md +41 -0
- package/templates/stubs/agents/quality-concept.md +41 -0
- package/templates/stubs/agents/research-concept.md +35 -0
- package/templates/stubs/agents/security-concept.md +40 -0
- package/templates/stubs/agents/spec-concept.md +35 -0
- package/templates/stubs/agents/story-concept.md +36 -0
- package/templates/stubs/agents/verification-concept.md +39 -0
- package/templates/stubs/agents/version-concept.md +37 -0
- package/templates/stubs/commands/cache.md.template +2 -0
- package/templates/stubs/commands/checkpoint.md.template +2 -0
- package/templates/stubs/commands/classify.md.template +2 -0
- package/templates/stubs/commands/compete.md.template +2 -0
- package/templates/stubs/commands/costs.md.template +2 -0
- package/templates/stubs/commands/estimate.md.template +2 -0
- package/templates/stubs/commands/explore.md.template +2 -0
- package/templates/stubs/commands/feature.md.template +2 -0
- package/templates/stubs/commands/forget.md.template +2 -0
- package/templates/stubs/commands/global-recall.md.template +2 -0
- package/templates/stubs/commands/global-remember.md.template +2 -0
- package/templates/stubs/commands/health.md.template +2 -0
- package/templates/stubs/commands/help.md.template +2 -0
- package/templates/stubs/commands/observe.md.template +2 -0
- package/templates/stubs/commands/pr-review.md.template +2 -0
- package/templates/stubs/commands/predict-cost.md.template +2 -0
- package/templates/stubs/commands/profile.md.template +2 -0
- package/templates/stubs/commands/reasoning.md.template +2 -0
- package/templates/stubs/commands/recall.md.template +2 -0
- package/templates/stubs/commands/remember.md.template +2 -0
- package/templates/stubs/commands/replay.md.template +2 -0
- package/templates/stubs/commands/restore.md.template +2 -0
- package/templates/stubs/commands/retrospective.md.template +2 -0
- package/templates/stubs/commands/slo.md.template +2 -0
- package/templates/stubs/commands/spec.md.template +2 -0
- package/templates/stubs/commands/sync.md.template +2 -0
- package/templates/stubs/commands/task.md.template +2 -0
- package/templates/stubs/commands/trace.md.template +2 -0
- package/templates/stubs/commands/visualize.md.template +2 -0
- package/templates/stubs/commands/workflow.md.template +2 -0
- package/templates/synchronizations/archive/adaptive-learning.yaml.template +595 -0
- package/templates/synchronizations/archive/code-understanding-flow.yaml.template +533 -0
- package/templates/synchronizations/archive/collaboration-flow.yaml.template +521 -0
- package/templates/synchronizations/archive/context-folding.yaml.template +353 -0
- package/templates/synchronizations/archive/dead-letter-queue.yaml.template +530 -0
- package/templates/synchronizations/archive/documentation-flow.yaml.template +560 -0
- package/templates/synchronizations/archive/error-recovery-flow.yaml.template +1031 -0
- package/templates/synchronizations/archive/execution-loop.yaml.template +336 -0
- package/templates/synchronizations/archive/exploration-flow.yaml.template +369 -0
- package/templates/synchronizations/archive/feature-development.yaml.template +2145 -0
- package/templates/synchronizations/archive/learning-loop.yaml.template +657 -0
- package/templates/synchronizations/archive/multi-verify.yaml.template +346 -0
- package/templates/synchronizations/archive/planning-flow.yaml.template +312 -0
- package/templates/synchronizations/archive/retrospective-flow.yaml.template +277 -0
- package/templates/synchronizations/archive/security-flow.yaml.template +477 -0
- package/templates/synchronizations/archive/slo-monitoring.yaml.template +209 -0
- package/templates/synchronizations/archive/task-routing.yaml.template +489 -0
- package/templates/synchronizations/archive/test-driven.yaml.template +291 -0
- package/templates/synchronizations/archive/tool-routing.yaml.template +326 -0
- package/templates/synchronizations/archive/verification-flow.yaml.template +407 -0
- package/templates/synchronizations/error-policy.yaml.template +188 -0
- package/templates/synchronizations/main.sync.template +319 -0
- package/templates/synchronizations/slo-registry.yaml.template +229 -0
- package/templates/tasks/task.yaml.template +67 -0
- package/templates/zen-profile.yaml.template +14 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: architecture
|
|
3
|
+
type: concept
|
|
4
|
+
model: opus
|
|
5
|
+
state_location: "koan/architecture/"
|
|
6
|
+
execution: task-tool
|
|
7
|
+
cost_tier: high
|
|
8
|
+
purpose: "Design system architecture and make technical decisions"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Architecture Concept
|
|
12
|
+
|
|
13
|
+
> **Note**: This is a reference file. The authoritative documentation is in `.claude/agents/architecture-concept.md`.
|
|
14
|
+
|
|
15
|
+
**Model Assignment**: Opus 4.5 (deep reasoning for complex design decisions)
|
|
16
|
+
**Cost per Action**: ~$0.015
|
|
17
|
+
**State Location**: `koan/architecture/`
|
|
18
|
+
**Never Calls**: No other concepts (pure design work)
|
|
19
|
+
|
|
20
|
+
## Quick Reference
|
|
21
|
+
|
|
22
|
+
### Actions
|
|
23
|
+
- `design(story_id, context)` - Creates technical architecture for a requirement
|
|
24
|
+
- `revise(arch_id, feedback)` - Updates architecture based on feedback
|
|
25
|
+
- `evaluate_tradeoffs(options)` - Deep analysis of technical alternatives
|
|
26
|
+
|
|
27
|
+
### State File Format
|
|
28
|
+
```yaml
|
|
29
|
+
# koan/architecture/arch-{id}.yaml
|
|
30
|
+
arch_id: "arch-001"
|
|
31
|
+
status: "completed" # draft, in_review, completed, blocked
|
|
32
|
+
summary: "One-line summary of approach"
|
|
33
|
+
|
|
34
|
+
details:
|
|
35
|
+
approach: "High-level approach description"
|
|
36
|
+
decisions:
|
|
37
|
+
- decision: "Key decision"
|
|
38
|
+
rationale: "Why this choice"
|
|
39
|
+
alternatives: []
|
|
40
|
+
components: []
|
|
41
|
+
risks: []
|
|
42
|
+
metadata:
|
|
43
|
+
created_at: "ISO-8601"
|
|
44
|
+
concept: "architecture"
|
|
45
|
+
model: "opus"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Integration
|
|
49
|
+
- **Triggered by**: `story-to-arch` sync when story.status="ready"
|
|
50
|
+
- **Triggers**: Implementation via `arch-to-impl` sync when risk!="high"
|
|
51
|
+
|
|
52
|
+
## Why Opus 4.5?
|
|
53
|
+
|
|
54
|
+
Architecture is the ONLY concept using Opus because it requires:
|
|
55
|
+
- Complex trade-off analysis
|
|
56
|
+
- Novel problem solving
|
|
57
|
+
- Pattern synthesis across domains
|
|
58
|
+
- Risk evaluation
|
|
59
|
+
- Long-term impact assessment
|
|
60
|
+
|
|
61
|
+
This accounts for ~91% of a typical feature's AI cost, but prevents costly mistakes downstream.
|
|
62
|
+
|
|
63
|
+
## Full Documentation
|
|
64
|
+
|
|
65
|
+
See `.claude/agents/architecture-concept.md` for:
|
|
66
|
+
- Sequential thinking process
|
|
67
|
+
- Incremental loading with MCP
|
|
68
|
+
- Decision documentation format
|
|
69
|
+
- Risk assessment guidelines
|
|
70
|
+
- Example architectures
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
**See also**: [Agent Definition](.claude/agents/architecture-concept.md)
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# Code Analysis Concept
|
|
2
|
+
|
|
3
|
+
You are a Code Analysis agent that uses MCP tools to understand codebases.
|
|
4
|
+
Your role is to gather contextual information before major decisions.
|
|
5
|
+
|
|
6
|
+
## Purpose
|
|
7
|
+
|
|
8
|
+
Provide intelligent code context for:
|
|
9
|
+
- Architecture decisions (find existing patterns)
|
|
10
|
+
- Refactoring (impact analysis via call graphs)
|
|
11
|
+
- Implementation (find similar code)
|
|
12
|
+
- Performance (identify bottlenecks)
|
|
13
|
+
|
|
14
|
+
## Available MCP Tools
|
|
15
|
+
|
|
16
|
+
### AST Index Tools
|
|
17
|
+
- `index_project` - Build/rebuild the AST index
|
|
18
|
+
- `find_symbol` - Search symbols by name (fuzzy matching)
|
|
19
|
+
- `get_symbol_info` - Get detailed info about a symbol
|
|
20
|
+
- `find_references` - Find all references to a symbol
|
|
21
|
+
- `get_call_graph` - Trace function call relationships
|
|
22
|
+
- `find_implementations` - Find interface implementations
|
|
23
|
+
- `get_file_symbols` - List all symbols in a file
|
|
24
|
+
- `search_by_signature` - Find functions by parameter/return types
|
|
25
|
+
|
|
26
|
+
### Semantic RAG Tools
|
|
27
|
+
- `embed_project` - Create semantic embeddings
|
|
28
|
+
- `semantic_search` - Search code by meaning/description
|
|
29
|
+
- `find_similar_code` - Find similar code snippets
|
|
30
|
+
|
|
31
|
+
## Actions
|
|
32
|
+
|
|
33
|
+
### context
|
|
34
|
+
Gather context for a new feature or task.
|
|
35
|
+
|
|
36
|
+
**Inputs:**
|
|
37
|
+
- `description`: Task or feature description
|
|
38
|
+
- `keywords`: Technical keywords to search for
|
|
39
|
+
- `scope`: Directory scope to limit search (optional)
|
|
40
|
+
|
|
41
|
+
**Process:**
|
|
42
|
+
1. Use `semantic_search` to find conceptually related code
|
|
43
|
+
2. Use `find_symbol` to locate relevant symbols
|
|
44
|
+
3. Build a context summary for downstream concepts
|
|
45
|
+
|
|
46
|
+
**Output:** `koan/context/analysis-{id}.yaml`
|
|
47
|
+
```yaml
|
|
48
|
+
analysis_id: "analysis-{timestamp}"
|
|
49
|
+
task: "{description}"
|
|
50
|
+
findings:
|
|
51
|
+
existing_patterns:
|
|
52
|
+
- symbol: "AuthService"
|
|
53
|
+
file: "src/auth/service.ts"
|
|
54
|
+
relevance: "Existing auth implementation"
|
|
55
|
+
- symbol: "useAuth"
|
|
56
|
+
file: "src/hooks/useAuth.ts"
|
|
57
|
+
relevance: "React hook pattern"
|
|
58
|
+
|
|
59
|
+
similar_implementations:
|
|
60
|
+
- file: "src/features/oauth.ts"
|
|
61
|
+
similarity: 0.85
|
|
62
|
+
description: "OAuth implementation"
|
|
63
|
+
- file: "src/features/jwt.ts"
|
|
64
|
+
similarity: 0.72
|
|
65
|
+
description: "JWT handling"
|
|
66
|
+
|
|
67
|
+
recommended_approach:
|
|
68
|
+
- "Extend existing AuthService"
|
|
69
|
+
- "Follow useAuth hook pattern"
|
|
70
|
+
- "Reference oauth.ts for provider integration"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### impact
|
|
74
|
+
Analyze impact of changes for refactoring.
|
|
75
|
+
|
|
76
|
+
**Inputs:**
|
|
77
|
+
- `target_symbols`: Symbols to be modified
|
|
78
|
+
- `entry_points`: Starting points for call graph
|
|
79
|
+
- `depth`: How deep to trace (default: 3)
|
|
80
|
+
|
|
81
|
+
**Process:**
|
|
82
|
+
1. Use `find_references` for each target symbol
|
|
83
|
+
2. Use `get_call_graph` from entry points
|
|
84
|
+
3. Identify all affected files and functions
|
|
85
|
+
4. Assess risk level based on impact scope
|
|
86
|
+
|
|
87
|
+
**Output:** `koan/context/impact-{id}.yaml`
|
|
88
|
+
```yaml
|
|
89
|
+
impact_id: "impact-{timestamp}"
|
|
90
|
+
target_symbols: ["{symbols}"]
|
|
91
|
+
analysis:
|
|
92
|
+
direct_references:
|
|
93
|
+
- symbol: "getUserById"
|
|
94
|
+
reference_count: 15
|
|
95
|
+
files: ["api.ts", "service.ts", "controller.ts"]
|
|
96
|
+
|
|
97
|
+
call_graph:
|
|
98
|
+
depth_1: 8 functions
|
|
99
|
+
depth_2: 23 functions
|
|
100
|
+
depth_3: 47 functions
|
|
101
|
+
|
|
102
|
+
affected_files:
|
|
103
|
+
high_impact:
|
|
104
|
+
- "src/api/users.ts"
|
|
105
|
+
- "src/services/auth.ts"
|
|
106
|
+
medium_impact:
|
|
107
|
+
- "src/controllers/user.ts"
|
|
108
|
+
low_impact:
|
|
109
|
+
- "src/utils/helpers.ts"
|
|
110
|
+
|
|
111
|
+
risk_assessment:
|
|
112
|
+
level: "medium"
|
|
113
|
+
reason: "15 direct references across 3 core files"
|
|
114
|
+
recommendations:
|
|
115
|
+
- "Add integration tests before refactoring"
|
|
116
|
+
- "Refactor in stages, not all at once"
|
|
117
|
+
- "Consider feature flag for gradual rollout"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### profile
|
|
121
|
+
Gather performance-related context.
|
|
122
|
+
|
|
123
|
+
**Inputs:**
|
|
124
|
+
- `area`: Performance area (e.g., "database queries", "API calls")
|
|
125
|
+
- `scope`: Directory or file scope
|
|
126
|
+
|
|
127
|
+
**Process:**
|
|
128
|
+
1. Use `semantic_search` to find performance-related code
|
|
129
|
+
2. Use `find_similar_code` to find existing optimizations
|
|
130
|
+
3. Identify patterns and anti-patterns
|
|
131
|
+
|
|
132
|
+
**Output:** `koan/context/profile-{id}.yaml`
|
|
133
|
+
|
|
134
|
+
## Model Selection
|
|
135
|
+
|
|
136
|
+
- **Default:** Sonnet (fast context gathering)
|
|
137
|
+
- **Complex analysis:** Sonnet (when deep reasoning needed)
|
|
138
|
+
|
|
139
|
+
## SLO Expectations
|
|
140
|
+
|
|
141
|
+
```yaml
|
|
142
|
+
slo_expectations:
|
|
143
|
+
context:
|
|
144
|
+
duration: "< 30 seconds"
|
|
145
|
+
cost: "< $0.002"
|
|
146
|
+
impact:
|
|
147
|
+
duration: "< 45 seconds"
|
|
148
|
+
cost: "< $0.003"
|
|
149
|
+
profile:
|
|
150
|
+
duration: "< 30 seconds"
|
|
151
|
+
cost: "< $0.002"
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Integration Points
|
|
155
|
+
|
|
156
|
+
This concept outputs context that feeds into:
|
|
157
|
+
- **Architecture:** `context_includes` in architecture prompts
|
|
158
|
+
- **Implementation:** Similar code patterns for reference
|
|
159
|
+
- **Quality:** Impact scope for test coverage
|
|
160
|
+
|
|
161
|
+
## Example Usage
|
|
162
|
+
|
|
163
|
+
```yaml
|
|
164
|
+
# In feature-development.yaml
|
|
165
|
+
- id: gather-context-before-arch
|
|
166
|
+
when:
|
|
167
|
+
concept: story
|
|
168
|
+
action: create
|
|
169
|
+
status: completed
|
|
170
|
+
then:
|
|
171
|
+
concept: code-analysis
|
|
172
|
+
action: context
|
|
173
|
+
model: sonnet
|
|
174
|
+
inputs:
|
|
175
|
+
description: "$story.description"
|
|
176
|
+
keywords: "$story.technical_keywords"
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## WYSIWID Principle
|
|
180
|
+
|
|
181
|
+
This file defines exactly how code analysis works:
|
|
182
|
+
- What MCP tools are used
|
|
183
|
+
- What outputs are generated
|
|
184
|
+
- How results feed into other concepts
|
|
185
|
+
|
|
186
|
+
Reading this tells you precisely what context-gathering will do.
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: context-compactor
|
|
3
|
+
type: concept
|
|
4
|
+
model: sonnet
|
|
5
|
+
purpose: "Manage context window by intelligently compacting completed work"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Context Compactor Concept
|
|
9
|
+
|
|
10
|
+
The Context Compactor manages context window health by integrating Claude Code's native `/compact` command with Zen's superior retention rules. This hybrid approach provides:
|
|
11
|
+
|
|
12
|
+
- Zen's research-backed retention strategies (what to keep vs summarize)
|
|
13
|
+
- Claude Code's optimized compaction engine (fast, accurate)
|
|
14
|
+
- Pre-compact checkpointing for safety
|
|
15
|
+
- Context health monitoring and auto-compaction
|
|
16
|
+
- Enabling 250+ turn sessions without context degradation
|
|
17
|
+
|
|
18
|
+
## Architecture: Native Integration with Smart Retention
|
|
19
|
+
|
|
20
|
+
**Key Design Principle:** Use native `/compact` for the actual compaction, but Zen controls WHAT to compact based on workflow state and retention rules.
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
Context Health Monitor → Retention Rules → Pre-compact Hook → Native /compact
|
|
24
|
+
(80% warning) (what to keep) (checkpoint) (actual work)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Research Foundation
|
|
28
|
+
|
|
29
|
+
Based on:
|
|
30
|
+
- **JetBrains Research (2025)**: Observation masking with window of latest 10 turns
|
|
31
|
+
- **Anthropic Context Engineering**: Compaction and structured note-taking
|
|
32
|
+
- **Context-Folding Agents**: Sub-trajectory summarization
|
|
33
|
+
- **Claude Code Native**: Fast, accurate compaction with retention hints
|
|
34
|
+
|
|
35
|
+
## Actions
|
|
36
|
+
|
|
37
|
+
### prepare_compact
|
|
38
|
+
|
|
39
|
+
Prepare for native `/compact` by creating checkpoint and applying retention rules.
|
|
40
|
+
|
|
41
|
+
**Inputs:**
|
|
42
|
+
- `trigger`: "manual" | "threshold_warning" | "threshold_critical" | "phase_complete"
|
|
43
|
+
- `current_context_tokens`: Estimated token count
|
|
44
|
+
- `workflow_state`: Current story/phase/files in progress
|
|
45
|
+
|
|
46
|
+
**Process:**
|
|
47
|
+
1. Load retention rules from `koan/context/retention-rules.yaml`
|
|
48
|
+
2. Identify critical context based on rules:
|
|
49
|
+
- Active story and architecture decisions
|
|
50
|
+
- In-progress implementations
|
|
51
|
+
- Recent test failures
|
|
52
|
+
- Security requirements
|
|
53
|
+
3. Create pre-compact checkpoint with critical context
|
|
54
|
+
4. Emit `pre-compact` event for hooks
|
|
55
|
+
5. Delegate to native `/compact` command
|
|
56
|
+
6. Track compaction metrics
|
|
57
|
+
|
|
58
|
+
**Output Format:**
|
|
59
|
+
```yaml
|
|
60
|
+
compact_preparation:
|
|
61
|
+
checkpoint_id: "ckpt-pre-compact-1769640000"
|
|
62
|
+
critical_context_preserved:
|
|
63
|
+
active_story: "story-042"
|
|
64
|
+
architecture_decisions: ["arch-042"]
|
|
65
|
+
files_in_progress: ["src/auth.ts", "tests/auth.test.ts"]
|
|
66
|
+
test_failures: []
|
|
67
|
+
security_requirements: ["OAuth2 token security"]
|
|
68
|
+
retention_summary:
|
|
69
|
+
always_retain_count: 5
|
|
70
|
+
summarize_count: 12
|
|
71
|
+
drop_count: 8
|
|
72
|
+
ready_for_compact: true
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### check_context_health
|
|
76
|
+
|
|
77
|
+
Monitor context usage and trigger warnings/auto-compaction.
|
|
78
|
+
|
|
79
|
+
**Inputs:**
|
|
80
|
+
- `current_tokens`: Estimated or actual token count
|
|
81
|
+
- `budget_tokens`: Maximum context window (default: 200000)
|
|
82
|
+
|
|
83
|
+
**Process:**
|
|
84
|
+
1. Calculate usage percentage
|
|
85
|
+
2. Check against thresholds (80%, 90%)
|
|
86
|
+
3. If >= 80%: Emit warning + suggest `/compact`
|
|
87
|
+
4. If >= 90%: Auto-checkpoint + recommend immediate compaction
|
|
88
|
+
5. Track health metrics over time
|
|
89
|
+
|
|
90
|
+
**Output Format:**
|
|
91
|
+
```yaml
|
|
92
|
+
context_health:
|
|
93
|
+
usage_tokens: 165000
|
|
94
|
+
budget_tokens: 200000
|
|
95
|
+
usage_percentage: 82.5
|
|
96
|
+
status: "warning" # healthy | warning | critical
|
|
97
|
+
recommendation: "Consider running /compact to reduce context"
|
|
98
|
+
auto_checkpoint_created: true
|
|
99
|
+
checkpoint_id: "ckpt-safety-1769640100"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### apply_retention_rules
|
|
103
|
+
|
|
104
|
+
Apply intelligent retention rules before compaction.
|
|
105
|
+
|
|
106
|
+
**Inputs:**
|
|
107
|
+
- `workflow_state`: Current workflow position (story/arch/impl/quality/commit)
|
|
108
|
+
- `retention_rules`: Loaded from `koan/context/retention-rules.yaml`
|
|
109
|
+
|
|
110
|
+
**Process:**
|
|
111
|
+
1. Categorize all context items by retention policy:
|
|
112
|
+
- **always_retain**: Keep verbatim (active work, recent errors)
|
|
113
|
+
- **summarize**: Compress to key points (completed phases, discussions)
|
|
114
|
+
- **drop**: Safe to remove (verbose outputs, intermediate searches)
|
|
115
|
+
2. Create retention hints for native `/compact`
|
|
116
|
+
3. Ensure workflow continuity across compaction
|
|
117
|
+
|
|
118
|
+
**Retention Categories:**
|
|
119
|
+
|
|
120
|
+
**Always Retain (HIGH priority):**
|
|
121
|
+
- Current story ID and requirements
|
|
122
|
+
- Active architecture decisions (current story only)
|
|
123
|
+
- Files currently being modified
|
|
124
|
+
- Recent test failures (< 1 hour)
|
|
125
|
+
- Security requirements for current feature
|
|
126
|
+
- Critical errors not yet resolved
|
|
127
|
+
|
|
128
|
+
**Summarize (MEDIUM priority):**
|
|
129
|
+
- Completed implementation details (tests passing)
|
|
130
|
+
- Resolved discussions and decisions
|
|
131
|
+
- Historical architecture (previous stories)
|
|
132
|
+
- Successful test runs
|
|
133
|
+
- Code review comments (addressed)
|
|
134
|
+
|
|
135
|
+
**Drop (LOW priority):**
|
|
136
|
+
- Verbose tool outputs (full file reads, long search results)
|
|
137
|
+
- Intermediate search iterations
|
|
138
|
+
- Exploratory paths not taken
|
|
139
|
+
- Resolved errors
|
|
140
|
+
- Duplicate information
|
|
141
|
+
|
|
142
|
+
**Output Format:**
|
|
143
|
+
```yaml
|
|
144
|
+
retention_applied:
|
|
145
|
+
always_retain:
|
|
146
|
+
- type: "story_active"
|
|
147
|
+
id: "story-042"
|
|
148
|
+
reason: "Current active story"
|
|
149
|
+
- type: "architecture_decision"
|
|
150
|
+
id: "arch-042"
|
|
151
|
+
reason: "Active architecture for current story"
|
|
152
|
+
- type: "file_in_progress"
|
|
153
|
+
path: "src/auth.ts"
|
|
154
|
+
reason: "Currently being implemented"
|
|
155
|
+
|
|
156
|
+
summarize:
|
|
157
|
+
- type: "completed_phase"
|
|
158
|
+
phase: "code-analysis"
|
|
159
|
+
summary: "Analyzed existing auth patterns, found passport.js usage"
|
|
160
|
+
- type: "resolved_discussion"
|
|
161
|
+
topic: "Token storage approach"
|
|
162
|
+
decision: "Use PostgreSQL with encrypted columns"
|
|
163
|
+
|
|
164
|
+
drop:
|
|
165
|
+
- type: "verbose_output"
|
|
166
|
+
source: "file_read"
|
|
167
|
+
reason: "Full package.json content (not needed)"
|
|
168
|
+
- type: "search_iteration"
|
|
169
|
+
query: "oauth implementations"
|
|
170
|
+
reason: "Found answer, intermediate results not needed"
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### create_mini_checkpoint
|
|
174
|
+
|
|
175
|
+
Create a lightweight checkpoint for recovery.
|
|
176
|
+
|
|
177
|
+
**Inputs:**
|
|
178
|
+
- `checkpoint_type`: "pre_operation" | "phase_complete" | "manual"
|
|
179
|
+
- `include_state`: Include current workflow state
|
|
180
|
+
- `include_recent_files`: Number of recently modified files to track
|
|
181
|
+
|
|
182
|
+
**Output Format:**
|
|
183
|
+
```yaml
|
|
184
|
+
checkpoint:
|
|
185
|
+
id: "ckpt-20251207-231500"
|
|
186
|
+
type: "pre_operation"
|
|
187
|
+
context_tokens: 52000
|
|
188
|
+
workflow_state:
|
|
189
|
+
current_phase: "implementation"
|
|
190
|
+
story_id: "story-042"
|
|
191
|
+
files_in_progress: ["src/auth.ts"]
|
|
192
|
+
recent_context_summary: |
|
|
193
|
+
Working on OAuth implementation.
|
|
194
|
+
Architecture decided on passport.js.
|
|
195
|
+
Currently implementing token refresh.
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### restore_checkpoint
|
|
199
|
+
|
|
200
|
+
Restore context from a checkpoint.
|
|
201
|
+
|
|
202
|
+
**Inputs:**
|
|
203
|
+
- `checkpoint_type`: "latest" | "specific"
|
|
204
|
+
- `checkpoint_id`: Specific checkpoint ID (if type is "specific")
|
|
205
|
+
- `restore_mode`: "full" | "state_only" | "context_only"
|
|
206
|
+
|
|
207
|
+
**Process:**
|
|
208
|
+
1. Load checkpoint data
|
|
209
|
+
2. Restore workflow state
|
|
210
|
+
3. Inject summary of work done since checkpoint
|
|
211
|
+
4. Resume from checkpoint state
|
|
212
|
+
|
|
213
|
+
### apply_retention_policy
|
|
214
|
+
|
|
215
|
+
Apply smart retention rules during folding.
|
|
216
|
+
|
|
217
|
+
**Inputs:**
|
|
218
|
+
- `retention_rules`: Array of rules with type, priority, and summary format
|
|
219
|
+
|
|
220
|
+
**Retention Priority Levels:**
|
|
221
|
+
- **high**: Keep in full or with minimal summarization
|
|
222
|
+
- **medium**: Keep key details, summarize context
|
|
223
|
+
- **low**: Heavily summarize or omit if space constrained
|
|
224
|
+
|
|
225
|
+
**Default Retention Rules:**
|
|
226
|
+
1. Error messages (high) - Keep full error with location
|
|
227
|
+
2. Architectural decisions (high) - Keep decision + rationale
|
|
228
|
+
3. File modifications (medium) - Keep path + change type
|
|
229
|
+
4. Search results (low) - Keep only what was selected
|
|
230
|
+
5. Exploration paths (low) - Keep only final chosen path
|
|
231
|
+
|
|
232
|
+
## Token Estimation
|
|
233
|
+
|
|
234
|
+
Uses a simple heuristic for token estimation:
|
|
235
|
+
- Average 4 characters per token
|
|
236
|
+
- Add 10% overhead for formatting
|
|
237
|
+
- Track actual vs estimated for calibration
|
|
238
|
+
|
|
239
|
+
```typescript
|
|
240
|
+
function estimateTokens(text: string): number {
|
|
241
|
+
const chars = text.length;
|
|
242
|
+
const baseTokens = chars / 4;
|
|
243
|
+
return Math.ceil(baseTokens * 1.1);
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## Native `/compact` Integration
|
|
248
|
+
|
|
249
|
+
### How It Works
|
|
250
|
+
|
|
251
|
+
1. **Context Health Monitor** tracks token usage continuously
|
|
252
|
+
2. **Warning at 80%** suggests running `/compact`
|
|
253
|
+
3. **Auto-checkpoint at 90%** creates safety checkpoint
|
|
254
|
+
4. **Pre-compact hook** runs before `/compact`:
|
|
255
|
+
- Loads retention rules
|
|
256
|
+
- Creates checkpoint with critical context
|
|
257
|
+
- Emits event for tracking
|
|
258
|
+
5. **Native `/compact`** does the actual compaction
|
|
259
|
+
6. **Post-compact verification** ensures workflow continuity
|
|
260
|
+
|
|
261
|
+
### Advantages of Hybrid Approach
|
|
262
|
+
|
|
263
|
+
| Aspect | Zen Provides | Native Provides |
|
|
264
|
+
|--------|-------------|-----------------|
|
|
265
|
+
| **Retention logic** | Research-backed rules, workflow-aware | N/A |
|
|
266
|
+
| **Compaction engine** | N/A | Fast, accurate, optimized |
|
|
267
|
+
| **Safety** | Pre-compact checkpoints | Built-in safeguards |
|
|
268
|
+
| **Monitoring** | Proactive warnings, auto-checkpoint | Token counting |
|
|
269
|
+
| **Recovery** | Workflow state preservation | Session continuity |
|
|
270
|
+
|
|
271
|
+
**Result:** Best of both worlds - Zen's intelligence + Native's performance
|
|
272
|
+
|
|
273
|
+
## Integration Points
|
|
274
|
+
|
|
275
|
+
### With Native `/compact`
|
|
276
|
+
- Pre-compact hook saves critical context
|
|
277
|
+
- Retention rules guide what to preserve
|
|
278
|
+
- Post-compact verification checks workflow state
|
|
279
|
+
- Metrics track compaction effectiveness
|
|
280
|
+
|
|
281
|
+
### With Checkpoint System
|
|
282
|
+
- Auto-checkpoint at 90% usage
|
|
283
|
+
- Pre-compact safety checkpoint
|
|
284
|
+
- Recovery points for workflow continuity
|
|
285
|
+
- Syncs with `/checkpoint` and `/restore` commands
|
|
286
|
+
|
|
287
|
+
### With Workflow System
|
|
288
|
+
- Phase-aware retention (keep active, summarize completed)
|
|
289
|
+
- Story-scoped context preservation
|
|
290
|
+
- File-in-progress tracking
|
|
291
|
+
- Maintains workflow continuity across compactions
|
|
292
|
+
|
|
293
|
+
### With Event System
|
|
294
|
+
- Emits `context-threshold` events at 80%, 90%
|
|
295
|
+
- Emits `pre-compact` event before compaction
|
|
296
|
+
- Emits `post-compact` event with metrics
|
|
297
|
+
- Enables hook automation
|
|
298
|
+
|
|
299
|
+
## Configuration
|
|
300
|
+
|
|
301
|
+
Default thresholds (can be customized in `.claude/config.yaml`):
|
|
302
|
+
|
|
303
|
+
```yaml
|
|
304
|
+
context_folding:
|
|
305
|
+
auto_fold_threshold: 80000 # tokens
|
|
306
|
+
critical_threshold: 120000 # tokens
|
|
307
|
+
tool_call_threshold: 30 # calls since last fold
|
|
308
|
+
preserve_recent_default: 10 # turns
|
|
309
|
+
summarize_window_default: 20 # turns
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
## Metrics
|
|
313
|
+
|
|
314
|
+
Track compaction effectiveness:
|
|
315
|
+
- Context usage trends (tokens over time)
|
|
316
|
+
- Compaction frequency and triggers
|
|
317
|
+
- Compression ratios achieved
|
|
318
|
+
- Workflow continuity (no breaks after compact)
|
|
319
|
+
- Recovery frequency
|
|
320
|
+
- Session length enabled
|
|
321
|
+
|
|
322
|
+
Stored in: `koan/health/context-metrics.yaml`
|
|
323
|
+
|
|
324
|
+
Example metrics:
|
|
325
|
+
```yaml
|
|
326
|
+
context_metrics:
|
|
327
|
+
session_id: "session-2026-01-30"
|
|
328
|
+
compactions:
|
|
329
|
+
- timestamp: "2026-01-30T15:00:00Z"
|
|
330
|
+
trigger: "threshold_warning"
|
|
331
|
+
tokens_before: 165000
|
|
332
|
+
tokens_after: 75000
|
|
333
|
+
compression_ratio: 0.45
|
|
334
|
+
critical_context_preserved: 5
|
|
335
|
+
workflow_phase: "implementation"
|
|
336
|
+
continuity_verified: true
|
|
337
|
+
|
|
338
|
+
health_checks:
|
|
339
|
+
- timestamp: "2026-01-30T14:30:00Z"
|
|
340
|
+
usage_percentage: 82.5
|
|
341
|
+
status: "warning"
|
|
342
|
+
action: "checkpoint_created"
|
|
343
|
+
- timestamp: "2026-01-30T15:01:00Z"
|
|
344
|
+
usage_percentage: 37.5
|
|
345
|
+
status: "healthy"
|
|
346
|
+
action: "none"
|
|
347
|
+
|
|
348
|
+
summary:
|
|
349
|
+
total_compactions: 3
|
|
350
|
+
avg_compression_ratio: 0.48
|
|
351
|
+
max_usage_reached: 89.2
|
|
352
|
+
workflow_breaks: 0
|
|
353
|
+
session_duration_minutes: 180
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
## Example Usage
|
|
357
|
+
|
|
358
|
+
### Scenario: Approaching Context Limit
|
|
359
|
+
|
|
360
|
+
```yaml
|
|
361
|
+
# Context reaches 80% during implementation
|
|
362
|
+
Context Health Check:
|
|
363
|
+
usage: 160000 / 200000 tokens (80%)
|
|
364
|
+
status: warning
|
|
365
|
+
action: checkpoint_created
|
|
366
|
+
checkpoint: ckpt-safety-1769640100
|
|
367
|
+
recommendation: "Consider /compact after current task"
|
|
368
|
+
|
|
369
|
+
# User continues work, reaches 90%
|
|
370
|
+
Context Health Check:
|
|
371
|
+
usage: 180000 / 200000 tokens (90%)
|
|
372
|
+
status: critical
|
|
373
|
+
action: auto_checkpoint
|
|
374
|
+
checkpoint: ckpt-pre-compact-1769640200
|
|
375
|
+
recommendation: "Recommend /compact now to prevent context overflow"
|
|
376
|
+
|
|
377
|
+
# User runs /compact
|
|
378
|
+
Pre-compact Hook:
|
|
379
|
+
1. Load retention rules
|
|
380
|
+
2. Identify critical context (story-042, arch-042, src/auth.ts)
|
|
381
|
+
3. Create checkpoint with critical context
|
|
382
|
+
4. Emit pre-compact event
|
|
383
|
+
|
|
384
|
+
Native /compact:
|
|
385
|
+
[Claude Code performs compaction]
|
|
386
|
+
|
|
387
|
+
Post-compact Verification:
|
|
388
|
+
workflow_state: intact
|
|
389
|
+
story_id: story-042 (preserved)
|
|
390
|
+
files_in_progress: ["src/auth.ts"] (preserved)
|
|
391
|
+
tokens_after: 70000
|
|
392
|
+
usage: 35% (healthy)
|
|
393
|
+
```
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: context
|
|
3
|
+
type: concept
|
|
4
|
+
model: sonnet
|
|
5
|
+
state_location: "koan/context/"
|
|
6
|
+
execution: task-tool
|
|
7
|
+
cost_tier: low
|
|
8
|
+
purpose: "Manage context window usage and compression"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Context Concept
|
|
12
|
+
|
|
13
|
+
> **Note**: This is a reference file. The authoritative documentation is in `.claude/agents/context-concept.md`.
|
|
14
|
+
|
|
15
|
+
**Model Assignment**: Sonnet 4.5 (context management and compression)
|
|
16
|
+
**Cost per Action**: ~$0.003
|
|
17
|
+
**State Location**: `koan/context/`
|
|
18
|
+
**Never Calls**: No other concepts (pure context management)
|
|
19
|
+
|
|
20
|
+
## Quick Reference
|
|
21
|
+
|
|
22
|
+
### Actions
|
|
23
|
+
- `monitor()` - Tracks current context window usage
|
|
24
|
+
- `compress()` - Reduces context by summarizing
|
|
25
|
+
- `checkpoint()` - Saves current state for restoration
|
|
26
|
+
- `restore(checkpoint_id)` - Restores from checkpoint
|
|
27
|
+
|
|
28
|
+
### State File Format
|
|
29
|
+
```yaml
|
|
30
|
+
# koan/context/context-{id}.yaml
|
|
31
|
+
context_id: "ctx-001"
|
|
32
|
+
status: "healthy" # healthy, warning, critical
|
|
33
|
+
summary: "One-line summary"
|
|
34
|
+
|
|
35
|
+
details:
|
|
36
|
+
usage_percent: 45
|
|
37
|
+
tokens_used: 90000
|
|
38
|
+
tokens_available: 200000
|
|
39
|
+
checkpoints: []
|
|
40
|
+
compressions: 0
|
|
41
|
+
metadata:
|
|
42
|
+
created_at: "ISO-8601"
|
|
43
|
+
concept: "context"
|
|
44
|
+
model: "sonnet"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Integration
|
|
48
|
+
- **Triggered by**: Automatic monitoring, `/checkpoint` command
|
|
49
|
+
- **Triggers**: Compression when usage >= 75%, checkpoint before compression
|
|
50
|
+
|
|
51
|
+
## Full Documentation
|
|
52
|
+
|
|
53
|
+
See `.claude/agents/context-concept.md` for:
|
|
54
|
+
- Context budget management
|
|
55
|
+
- Compression strategies
|
|
56
|
+
- Checkpoint format
|
|
57
|
+
- Restoration process
|
|
58
|
+
- Health monitoring
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
**See also**: [Agent Definition](.claude/agents/context-concept.md)
|