specweave 0.4.1 → 0.6.3
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/README.md +312 -0
- package/.claude-plugin/marketplace.json +210 -0
- package/CLAUDE.md +952 -609
- package/README.md +179 -761
- package/bin/install-agents.sh +1 -1
- package/bin/install-commands.sh +66 -14
- package/bin/install-hooks.sh +1 -1
- package/bin/install-skills.sh +1 -1
- package/bin/specweave.js +2 -0
- package/dist/adapters/claude/adapter.d.ts +49 -11
- package/dist/adapters/claude/adapter.d.ts.map +1 -1
- package/dist/adapters/claude/adapter.js +175 -42
- package/dist/adapters/claude/adapter.js.map +1 -1
- package/dist/adapters/copilot/adapter.d.ts +20 -2
- package/dist/adapters/copilot/adapter.d.ts.map +1 -1
- package/dist/adapters/copilot/adapter.js +117 -7
- package/dist/adapters/copilot/adapter.js.map +1 -1
- package/dist/adapters/cursor/adapter.d.ts +18 -0
- package/dist/adapters/cursor/adapter.d.ts.map +1 -1
- package/dist/adapters/cursor/adapter.js +55 -3
- package/dist/adapters/cursor/adapter.js.map +1 -1
- package/dist/adapters/generic/adapter.d.ts +18 -0
- package/dist/adapters/generic/adapter.d.ts.map +1 -1
- package/dist/adapters/generic/adapter.js +55 -3
- package/dist/adapters/generic/adapter.js.map +1 -1
- package/dist/cli/commands/init.d.ts +1 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +521 -185
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/install.d.ts +2 -0
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +28 -25
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/list.d.ts +2 -0
- package/dist/cli/commands/list.d.ts.map +1 -1
- package/dist/cli/commands/list.js +26 -24
- package/dist/cli/commands/list.js.map +1 -1
- package/dist/cli/commands/plugin.d.ts +23 -6
- package/dist/cli/commands/plugin.d.ts.map +1 -1
- package/dist/cli/commands/plugin.js +92 -66
- package/dist/cli/commands/plugin.js.map +1 -1
- package/dist/core/i18n/language-detector.d.ts +29 -0
- package/dist/core/i18n/language-detector.d.ts.map +1 -0
- package/dist/core/i18n/language-detector.js +143 -0
- package/dist/core/i18n/language-detector.js.map +1 -0
- package/dist/core/i18n/language-manager.d.ts +101 -0
- package/dist/core/i18n/language-manager.d.ts.map +1 -0
- package/dist/core/i18n/language-manager.js +232 -0
- package/dist/core/i18n/language-manager.js.map +1 -0
- package/dist/core/i18n/language-registry.d.ts +44 -0
- package/dist/core/i18n/language-registry.d.ts.map +1 -0
- package/dist/core/i18n/language-registry.js +234 -0
- package/dist/core/i18n/language-registry.js.map +1 -0
- package/dist/core/i18n/locale-manager.d.ts +62 -0
- package/dist/core/i18n/locale-manager.d.ts.map +1 -0
- package/dist/core/i18n/locale-manager.js +137 -0
- package/dist/core/i18n/locale-manager.js.map +1 -0
- package/dist/core/i18n/system-prompt-injector.d.ts +33 -0
- package/dist/core/i18n/system-prompt-injector.d.ts.map +1 -0
- package/dist/core/i18n/system-prompt-injector.js +131 -0
- package/dist/core/i18n/system-prompt-injector.js.map +1 -0
- package/dist/core/i18n/types.d.ts +151 -0
- package/dist/core/i18n/types.d.ts.map +1 -0
- package/dist/core/i18n/types.js +11 -0
- package/dist/core/i18n/types.js.map +1 -0
- package/dist/core/increment-status.d.ts +72 -0
- package/dist/core/increment-status.d.ts.map +1 -0
- package/dist/core/increment-status.js +227 -0
- package/dist/core/increment-status.js.map +1 -0
- package/dist/core/plugin-loader.d.ts +33 -13
- package/dist/core/plugin-loader.d.ts.map +1 -1
- package/dist/core/plugin-loader.js +145 -43
- package/dist/core/plugin-loader.js.map +1 -1
- package/dist/core/types/config.d.ts +51 -0
- package/dist/core/types/config.d.ts.map +1 -0
- package/dist/core/types/config.js +21 -0
- package/dist/core/types/config.js.map +1 -0
- package/dist/core/types/plugin.d.ts +73 -42
- package/dist/core/types/plugin.d.ts.map +1 -1
- package/dist/core/types/plugin.js +4 -3
- package/dist/core/types/plugin.js.map +1 -1
- package/dist/hooks/lib/sync-living-docs.d.ts +27 -0
- package/dist/hooks/lib/sync-living-docs.d.ts.map +1 -0
- package/dist/hooks/lib/sync-living-docs.js +116 -0
- package/dist/hooks/lib/sync-living-docs.js.map +1 -0
- package/dist/hooks/lib/translate-living-docs.d.ts +13 -0
- package/dist/hooks/lib/translate-living-docs.d.ts.map +1 -0
- package/dist/hooks/lib/translate-living-docs.js +166 -0
- package/dist/hooks/lib/translate-living-docs.js.map +1 -0
- package/dist/hooks/lib/update-tasks-md.d.ts +29 -0
- package/dist/hooks/lib/update-tasks-md.d.ts.map +1 -0
- package/dist/hooks/lib/update-tasks-md.js +203 -0
- package/dist/hooks/lib/update-tasks-md.js.map +1 -0
- package/dist/integrations/jira/jira-incremental-mapper.js.map +1 -1
- package/dist/integrations/jira/jira-mapper.js.map +1 -1
- package/dist/locales/de/.gitkeep +0 -0
- package/dist/locales/de/cli.json +108 -0
- package/dist/locales/en/cli.json +285 -0
- package/dist/locales/en/errors.json +7 -0
- package/dist/locales/en/templates.json +6 -0
- package/dist/locales/es/.gitkeep +0 -0
- package/dist/locales/es/cli.json +41 -0
- package/dist/locales/fr/.gitkeep +0 -0
- package/dist/locales/fr/cli.json +108 -0
- package/dist/locales/ja/.gitkeep +0 -0
- package/dist/locales/ja/cli.json +108 -0
- package/dist/locales/ko/.gitkeep +0 -0
- package/dist/locales/ko/cli.json +108 -0
- package/dist/locales/pt/.gitkeep +0 -0
- package/dist/locales/pt/cli.json +108 -0
- package/dist/locales/ru/.gitkeep +0 -0
- package/dist/locales/ru/cli.json +269 -0
- package/dist/locales/zh/.gitkeep +0 -0
- package/dist/locales/zh/cli.json +108 -0
- package/dist/plugins/specweave-github/lib/github-client.d.ts +86 -0
- package/dist/plugins/specweave-github/lib/github-client.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-client.js +275 -0
- package/dist/plugins/specweave-github/lib/github-client.js.map +1 -0
- package/dist/plugins/specweave-github/lib/index.d.ts +10 -0
- package/dist/plugins/specweave-github/lib/index.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/index.js +10 -0
- package/dist/plugins/specweave-github/lib/index.js.map +1 -0
- package/dist/plugins/specweave-github/lib/subtask-sync.d.ts +51 -0
- package/dist/plugins/specweave-github/lib/subtask-sync.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/subtask-sync.js +147 -0
- package/dist/plugins/specweave-github/lib/subtask-sync.js.map +1 -0
- package/dist/plugins/specweave-github/lib/task-parser.d.ts +37 -0
- package/dist/plugins/specweave-github/lib/task-parser.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/task-parser.js +211 -0
- package/dist/plugins/specweave-github/lib/task-parser.js.map +1 -0
- package/dist/plugins/specweave-github/lib/task-sync.d.ts +51 -0
- package/dist/plugins/specweave-github/lib/task-sync.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/task-sync.js +332 -0
- package/dist/plugins/specweave-github/lib/task-sync.js.map +1 -0
- package/dist/plugins/specweave-github/lib/types.d.ts +80 -0
- package/dist/plugins/specweave-github/lib/types.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/types.js +5 -0
- package/dist/plugins/specweave-github/lib/types.js.map +1 -0
- package/dist/utils/agents-md-compiler.d.ts +68 -0
- package/dist/utils/agents-md-compiler.d.ts.map +1 -0
- package/dist/utils/agents-md-compiler.js +420 -0
- package/dist/utils/agents-md-compiler.js.map +1 -0
- package/dist/utils/execFileNoThrow.d.ts +97 -0
- package/dist/utils/execFileNoThrow.d.ts.map +1 -0
- package/dist/utils/execFileNoThrow.js +130 -0
- package/dist/utils/execFileNoThrow.js.map +1 -0
- package/dist/utils/generate-skills-index.js +4 -4
- package/dist/utils/generate-skills-index.js.map +1 -1
- package/package.json +13 -14
- package/plugins/.specweave/logs/hooks-debug.log +24 -0
- package/plugins/.specweave/logs/last-hook-fire +1 -0
- package/plugins/.specweave/logs/last-todowrite-time +1 -0
- package/plugins/.specweave/logs/tasks.log +6 -0
- package/plugins/specweave/.claude-plugin/plugin.json +22 -0
- package/{src → plugins/specweave}/agents/pm/AGENT.md +80 -0
- package/plugins/specweave/agents/translator/AGENT.md +282 -0
- package/{src → plugins/specweave}/commands/README.md +11 -11
- package/{src/commands/specweave.costs.md → plugins/specweave/commands/costs.md} +8 -8
- package/{src/commands/specweave.do.md → plugins/specweave/commands/do.md} +35 -8
- package/{src/commands/specweave.done.md → plugins/specweave/commands/done.md} +1 -1
- package/{src/commands/specweave.inc.md → plugins/specweave/commands/inc.md} +1 -1
- package/{src/commands/specweave.increment.md → plugins/specweave/commands/increment.md} +84 -19
- package/{src/commands/specweave.next.md → plugins/specweave/commands/next.md} +1 -1
- package/{src/commands/specweave.progress.md → plugins/specweave/commands/progress.md} +1 -1
- package/{src → plugins/specweave}/commands/specweave.md +57 -25
- package/{src/commands/specweave.sync-docs.md → plugins/specweave/commands/sync-docs.md} +6 -6
- package/plugins/specweave/commands/translate.md +425 -0
- package/{src/commands/specweave.validate.md → plugins/specweave/commands/validate.md} +2 -2
- package/plugins/specweave/hooks/hooks.json +15 -0
- package/plugins/specweave/hooks/post-task-completion.sh +265 -0
- package/plugins/specweave/skills/SKILLS-INDEX.md +229 -0
- package/{src → plugins/specweave}/skills/brownfield-analyzer/SKILL.md +66 -24
- package/{src → plugins/specweave}/skills/context-loader/SKILL.md +1 -1
- package/plugins/specweave/skills/context-optimizer/SKILL.md +588 -0
- package/plugins/specweave/skills/docs-updater/SKILL.md +0 -0
- package/{src → plugins/specweave}/skills/increment-planner/SKILL.md +81 -4
- package/plugins/specweave/skills/plugin-detector/SKILL.md +211 -0
- package/{src → plugins/specweave}/skills/project-kickstarter/SKILL.md +7 -7
- package/plugins/specweave/skills/rfc-generator/SKILL.md +369 -0
- package/{src → plugins/specweave}/skills/specweave-detector/SKILL.md +2 -2
- package/plugins/specweave/skills/specweave-framework/SKILL.md +498 -0
- package/plugins/specweave/skills/specweave-framework/test-cases/test-1-increment-naming.yaml +11 -0
- package/plugins/specweave/skills/specweave-framework/test-cases/test-2-source-of-truth.yaml +11 -0
- package/plugins/specweave/skills/specweave-framework/test-cases/test-3-increment-discipline.yaml +12 -0
- package/plugins/specweave/skills/specweave-framework/test-cases/test-4-file-placement.yaml +11 -0
- package/{src → plugins/specweave}/skills/tdd-workflow/SKILL.md +21 -21
- package/plugins/specweave/skills/translator/SKILL.md +172 -0
- package/plugins/specweave-ado/.claude-plugin/plugin.json +8 -0
- package/plugins/specweave-alternatives/.claude-plugin/plugin.json +8 -0
- package/plugins/specweave-alternatives/skills/bmad-method-expert/SKILL.md +626 -0
- package/plugins/specweave-alternatives/skills/bmad-method-expert/scripts/analyze-project.js +318 -0
- package/plugins/specweave-alternatives/skills/bmad-method-expert/scripts/check-setup.js +208 -0
- package/plugins/specweave-alternatives/skills/bmad-method-expert/scripts/generate-template.js +1149 -0
- package/plugins/specweave-alternatives/skills/bmad-method-expert/scripts/validate-documents.js +340 -0
- package/plugins/specweave-alternatives/skills/spec-kit-expert/SKILL.md +1010 -0
- package/plugins/specweave-backend/.claude-plugin/plugin.json +8 -0
- package/plugins/specweave-cost-optimizer/.claude-plugin/plugin.json +8 -0
- package/plugins/specweave-diagrams/.claude-plugin/plugin.json +8 -0
- package/plugins/specweave-docs/.claude-plugin/plugin.json +8 -0
- package/plugins/specweave-docs/skills/docusaurus/SKILL.md +526 -0
- package/plugins/specweave-figma/.claude-plugin/.mcp.json +12 -0
- package/plugins/specweave-figma/.claude-plugin/plugin.json +8 -0
- package/plugins/specweave-figma/ARCHITECTURE.md +453 -0
- package/plugins/specweave-figma/README.md +728 -0
- package/plugins/specweave-figma/skills/figma-to-code/SKILL.md +632 -0
- package/plugins/specweave-figma/skills/figma-to-code/test-1-token-generation.yaml +29 -0
- package/plugins/specweave-figma/skills/figma-to-code/test-2-component-generation.yaml +27 -0
- package/plugins/specweave-figma/skills/figma-to-code/test-3-typescript-generation.yaml +28 -0
- package/plugins/specweave-frontend/.claude-plugin/plugin.json +8 -0
- package/plugins/specweave-github/.claude-plugin/plugin.json +19 -0
- package/plugins/specweave-github/agents/github-manager/AGENT.md +651 -0
- package/plugins/specweave-github/commands/github-close-issue.md +418 -0
- package/plugins/specweave-github/commands/github-create-issue.md +307 -0
- package/plugins/specweave-github/commands/github-status.md +533 -0
- package/plugins/specweave-github/commands/github-sync-tasks.md +530 -0
- package/plugins/specweave-github/commands/github-sync.md +443 -0
- package/plugins/specweave-github/lib/github-client.ts +330 -0
- package/plugins/specweave-github/lib/index.ts +10 -0
- package/plugins/specweave-github/lib/subtask-sync.ts +225 -0
- package/plugins/specweave-github/lib/task-parser.ts +246 -0
- package/plugins/specweave-github/lib/task-sync.ts +402 -0
- package/plugins/specweave-github/lib/types.ts +86 -0
- package/plugins/specweave-github/skills/github-issue-tracker/SKILL.md +497 -0
- package/plugins/specweave-github/skills/github-sync/SKILL.md +461 -0
- package/plugins/specweave-infrastructure/.claude-plugin/plugin.json +8 -0
- package/plugins/specweave-jira/.claude-plugin/plugin.json +8 -0
- package/{src → plugins/specweave-jira}/commands/specweave.sync-jira.md +18 -18
- package/plugins/specweave-kubernetes/.claude-plugin/plugin.json +8 -0
- package/plugins/specweave-ml/.claude-plugin/plugin.json +38 -0
- package/plugins/specweave-ml/README.md +885 -0
- package/plugins/specweave-ml/agents/ml-engineer/AGENT.md +402 -0
- package/plugins/specweave-ml/commands/ml-deploy.md +116 -0
- package/plugins/specweave-ml/commands/ml-evaluate.md +87 -0
- package/plugins/specweave-ml/commands/ml-explain.md +83 -0
- package/plugins/specweave-ml/skills/anomaly-detector/SKILL.md +559 -0
- package/plugins/specweave-ml/skills/automl-optimizer/SKILL.md +485 -0
- package/plugins/specweave-ml/skills/cv-pipeline-builder/SKILL.md +157 -0
- package/plugins/specweave-ml/skills/data-visualizer/SKILL.md +521 -0
- package/plugins/specweave-ml/skills/experiment-tracker/SKILL.md +535 -0
- package/plugins/specweave-ml/skills/feature-engineer/SKILL.md +566 -0
- package/plugins/specweave-ml/skills/ml-deployment-helper/SKILL.md +345 -0
- package/plugins/specweave-ml/skills/ml-pipeline-orchestrator/SKILL.md +518 -0
- package/plugins/specweave-ml/skills/model-evaluator/SKILL.md +155 -0
- package/plugins/specweave-ml/skills/model-explainer/SKILL.md +227 -0
- package/plugins/specweave-ml/skills/model-registry/SKILL.md +541 -0
- package/plugins/specweave-ml/skills/nlp-pipeline-builder/SKILL.md +180 -0
- package/plugins/specweave-ml/skills/time-series-forecaster/SKILL.md +569 -0
- package/plugins/specweave-payments/.claude-plugin/plugin.json +8 -0
- package/plugins/specweave-testing/.claude-plugin/plugin.json +8 -0
- package/plugins/specweave-tooling/.claude-plugin/plugin.json +8 -0
- package/plugins/specweave-ui/.claude-plugin/plugin.json +26 -0
- package/plugins/specweave-ui/.mcp.json +14 -0
- package/plugins/specweave-ui/README.md +386 -0
- package/src/adapters/claude/adapter.ts +193 -46
- package/src/adapters/copilot/adapter.ts +132 -7
- package/src/adapters/cursor/adapter.ts +62 -3
- package/src/adapters/generic/adapter.ts +62 -3
- package/src/templates/AGENTS.md.template +170 -1
- package/src/templates/CLAUDE.md.template +122 -24
- package/src/templates/tasks.md.template +261 -0
- package/src/agents/ml-engineer/AGENT.md +0 -150
- package/src/commands/specweave.sync-github.md +0 -269
- package/src/hooks/post-task-completion.sh +0 -121
- package/src/skills/SKILLS-INDEX.md +0 -444
- package/src/skills/github-sync/SKILL.md +0 -234
- /package/{src → plugins/specweave}/agents/architect/AGENT.md +0 -0
- /package/{src → plugins/specweave}/agents/code-reviewer.md +0 -0
- /package/{src → plugins/specweave}/agents/docs-writer/AGENT.md +0 -0
- /package/{src → plugins/specweave}/agents/performance/AGENT.md +0 -0
- /package/{src → plugins/specweave}/agents/qa-lead/AGENT.md +0 -0
- /package/{src → plugins/specweave}/agents/security/AGENT.md +0 -0
- /package/{src → plugins/specweave}/agents/tdd-orchestrator/AGENT.md +0 -0
- /package/{src → plugins/specweave}/agents/tech-lead/AGENT.md +0 -0
- /package/{src/commands/specweave.list-increments.md → plugins/specweave/commands/list-increments.md} +0 -0
- /package/{src/commands/specweave.tdd-cycle.md → plugins/specweave/commands/tdd-cycle.md} +0 -0
- /package/{src/commands/specweave.tdd-green.md → plugins/specweave/commands/tdd-green.md} +0 -0
- /package/{src/commands/specweave.tdd-red.md → plugins/specweave/commands/tdd-red.md} +0 -0
- /package/{src/commands/specweave.tdd-refactor.md → plugins/specweave/commands/tdd-refactor.md} +0 -0
- /package/{src → plugins/specweave}/hooks/README.md +0 -0
- /package/{src → plugins/specweave}/hooks/docs-changed.sh +0 -0
- /package/{src → plugins/specweave}/hooks/human-input-required.sh +0 -0
- /package/{src → plugins/specweave}/hooks/post-increment-plugin-detect.sh +0 -0
- /package/{src → plugins/specweave}/hooks/pre-implementation.sh +0 -0
- /package/{src → plugins/specweave}/hooks/pre-task-plugin-detect.sh +0 -0
- /package/{src → plugins/specweave}/skills/brownfield-onboarder/SKILL.md +0 -0
- /package/{src → plugins/specweave}/skills/docs-updater/README.md +0 -0
- /package/{src → plugins/specweave}/skills/increment-planner/scripts/feature-utils.js +0 -0
- /package/{src → plugins/specweave}/skills/increment-quality-judge/SKILL.md +0 -0
- /package/{src → plugins/specweave}/skills/project-kickstarter/test-cases/test-1-high-confidence-full-product.yaml +0 -0
- /package/{src → plugins/specweave}/skills/project-kickstarter/test-cases/test-2-medium-confidence-partial.yaml +0 -0
- /package/{src → plugins/specweave}/skills/project-kickstarter/test-cases/test-3-low-confidence-technical-question.yaml +0 -0
- /package/{src → plugins/specweave}/skills/project-kickstarter/test-cases/test-4-opt-out-explicit.yaml +0 -0
- /package/{src → plugins/specweave}/skills/role-orchestrator/README.md +0 -0
- /package/{src → plugins/specweave}/skills/role-orchestrator/SKILL.md +0 -0
- /package/{src → plugins/specweave}/skills/task-builder/README.md +0 -0
- /package/{src → plugins/specweave-ado}/skills/ado-sync/README.md +0 -0
- /package/{src → plugins/specweave-ado}/skills/ado-sync/SKILL.md +0 -0
- /package/{src → plugins/specweave-ado}/skills/specweave-ado-mapper/SKILL.md +0 -0
- /package/{src → plugins/specweave-backend}/agents/database-optimizer/AGENT.md +0 -0
- /package/{src → plugins/specweave-backend}/skills/dotnet-backend/SKILL.md +0 -0
- /package/{src → plugins/specweave-backend}/skills/nodejs-backend/SKILL.md +0 -0
- /package/{src → plugins/specweave-backend}/skills/python-backend/SKILL.md +0 -0
- /package/{src → plugins/specweave-cost-optimizer}/skills/cost-optimizer/SKILL.md +0 -0
- /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/AGENT.md +0 -0
- /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/templates/c4-component-template.mmd +0 -0
- /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/templates/c4-container-template.mmd +0 -0
- /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/templates/c4-context-template.mmd +0 -0
- /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/templates/deployment-template.mmd +0 -0
- /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/templates/er-diagram-template.mmd +0 -0
- /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/templates/sequence-template.mmd +0 -0
- /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/test-cases/test-1-c4-context.yaml +0 -0
- /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/test-cases/test-2-sequence.yaml +0 -0
- /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/test-cases/test-3-er-diagram.yaml +0 -0
- /package/{src → plugins/specweave-diagrams}/skills/diagrams-architect/SKILL.md +0 -0
- /package/{src → plugins/specweave-diagrams}/skills/diagrams-generator/SKILL.md +0 -0
- /package/{src → plugins/specweave-docs}/skills/spec-driven-brainstorming/README.md +0 -0
- /package/{src → plugins/specweave-docs}/skills/spec-driven-brainstorming/SKILL.md +0 -0
- /package/{src → plugins/specweave-docs}/skills/spec-driven-debugging/README.md +0 -0
- /package/{src → plugins/specweave-docs}/skills/spec-driven-debugging/SKILL.md +0 -0
- /package/{src → plugins/specweave-frontend}/skills/design-system-architect/SKILL.md +0 -0
- /package/{src → plugins/specweave-frontend}/skills/frontend/SKILL.md +0 -0
- /package/{src → plugins/specweave-frontend}/skills/nextjs/SKILL.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/devops/AGENT.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/network-engineer/AGENT.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/observability-engineer/AGENT.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/performance-engineer/AGENT.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/AGENT.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/modules/backend-diagnostics.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/modules/database-diagnostics.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/modules/infrastructure.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/modules/monitoring.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/modules/security-incidents.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/modules/ui-diagnostics.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/01-high-cpu-usage.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/02-database-deadlock.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/03-memory-leak.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/04-slow-api-response.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/05-ddos-attack.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/06-disk-full.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/07-service-down.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/08-data-corruption.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/09-cascade-failure.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/10-rate-limit-exceeded.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/scripts/health-check.sh +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/scripts/log-analyzer.py +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/scripts/metrics-collector.sh +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/scripts/trace-analyzer.js +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/templates/incident-report.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/templates/mitigation-plan.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/templates/post-mortem.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/templates/runbook-template.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/commands/specweave.monitor-setup.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/commands/specweave.slo-implement.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/skills/distributed-tracing/SKILL.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/skills/grafana-dashboards/SKILL.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/skills/hetzner-provisioner/README.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/skills/hetzner-provisioner/SKILL.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/skills/prometheus-configuration/SKILL.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/skills/slo-implementation/SKILL.md +0 -0
- /package/{src → plugins/specweave-jira}/skills/jira-sync/README.md +0 -0
- /package/{src → plugins/specweave-jira}/skills/jira-sync/SKILL.md +0 -0
- /package/{src → plugins/specweave-jira}/skills/specweave-jira-mapper/SKILL.md +0 -0
- /package/{src → plugins/specweave-kubernetes}/agents/kubernetes-architect/AGENT.md +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/gitops-workflow/SKILL.md +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/gitops-workflow/references/argocd-setup.md +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/gitops-workflow/references/sync-policies.md +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/helm-chart-scaffolding/SKILL.md +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/helm-chart-scaffolding/assets/Chart.yaml.template +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/helm-chart-scaffolding/assets/values.yaml.template +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/helm-chart-scaffolding/references/chart-structure.md +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/helm-chart-scaffolding/scripts/validate-chart.sh +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/k8s-manifest-generator/SKILL.md +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/k8s-manifest-generator/assets/configmap-template.yaml +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/k8s-manifest-generator/assets/deployment-template.yaml +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/k8s-manifest-generator/assets/service-template.yaml +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/k8s-manifest-generator/references/deployment-spec.md +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/k8s-manifest-generator/references/service-spec.md +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/k8s-security-policies/SKILL.md +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/k8s-security-policies/assets/network-policy-template.yaml +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/k8s-security-policies/references/rbac-patterns.md +0 -0
- /package/{src → plugins/specweave-ml}/agents/data-scientist/AGENT.md +0 -0
- /package/{src → plugins/specweave-ml}/agents/mlops-engineer/AGENT.md +0 -0
- /package/{src → plugins/specweave-ml}/commands/specweave.ml-pipeline.md +0 -0
- /package/{src → plugins/specweave-ml}/skills/ml-pipeline-workflow/SKILL.md +0 -0
- /package/{src → plugins/specweave-payments}/agents/payment-integration/AGENT.md +0 -0
- /package/{src → plugins/specweave-payments}/skills/billing-automation/SKILL.md +0 -0
- /package/{src → plugins/specweave-payments}/skills/paypal-integration/SKILL.md +0 -0
- /package/{src → plugins/specweave-payments}/skills/pci-compliance/SKILL.md +0 -0
- /package/{src → plugins/specweave-payments}/skills/stripe-integration/SKILL.md +0 -0
- /package/{src → plugins/specweave-testing}/skills/e2e-playwright/README.md +0 -0
- /package/{src → plugins/specweave-testing}/skills/e2e-playwright/SKILL.md +0 -0
- /package/{src → plugins/specweave-testing}/skills/e2e-playwright/execute.js +0 -0
- /package/{src → plugins/specweave-testing}/skills/e2e-playwright/lib/utils.js +0 -0
- /package/{src → plugins/specweave-testing}/skills/e2e-playwright/package.json +0 -0
- /package/{src → plugins/specweave-tooling}/skills/skill-creator/LICENSE.txt +0 -0
- /package/{src → plugins/specweave-tooling}/skills/skill-creator/SKILL.md +0 -0
- /package/{src → plugins/specweave-tooling}/skills/skill-creator/scripts/init_skill.py +0 -0
- /package/{src → plugins/specweave-tooling}/skills/skill-creator/scripts/package_skill.py +0 -0
- /package/{src → plugins/specweave-tooling}/skills/skill-creator/scripts/quick_validate.py +0 -0
- /package/{src → plugins/specweave-tooling}/skills/skill-router/SKILL.md +0 -0
|
@@ -0,0 +1,588 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: context-optimizer
|
|
3
|
+
description: Second-pass context optimization that analyzes user prompts and removes irrelevant specs, agents, and skills from loaded context. Achieves 80%+ token reduction through smart cleanup. Activates for optimize context, reduce tokens, clean context, smart context, precision loading.
|
|
4
|
+
allowed-tools: Read, Grep, Glob
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Context Optimizer
|
|
8
|
+
|
|
9
|
+
Second-pass context optimization that analyzes user intent and surgically removes irrelevant content from loaded context, achieving 80%+ total token reduction.
|
|
10
|
+
|
|
11
|
+
## Purpose
|
|
12
|
+
|
|
13
|
+
After `context-loader` loads context based on manifest (70% reduction), `context-optimizer` performs intelligent analysis of the user's specific prompt to remove sections that aren't needed for that particular task.
|
|
14
|
+
|
|
15
|
+
## The Two-Pass Strategy
|
|
16
|
+
|
|
17
|
+
### Pass 1: Context Loader (Manifest-Based)
|
|
18
|
+
```yaml
|
|
19
|
+
# context-manifest.yaml
|
|
20
|
+
spec_sections:
|
|
21
|
+
- auth-spec.md
|
|
22
|
+
- payment-spec.md
|
|
23
|
+
- user-management-spec.md
|
|
24
|
+
|
|
25
|
+
Result: Load only relevant specs (70% reduction)
|
|
26
|
+
Before: 150k tokens → After: 45k tokens
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Pass 2: Context Optimizer (Intent-Based)
|
|
30
|
+
```typescript
|
|
31
|
+
User: "Fix authentication bug in login endpoint"
|
|
32
|
+
|
|
33
|
+
Analyzer detects:
|
|
34
|
+
• Task type: Bug fix (not new feature)
|
|
35
|
+
• Domain: Backend auth
|
|
36
|
+
• Scope: Single endpoint
|
|
37
|
+
|
|
38
|
+
Removes:
|
|
39
|
+
❌ payment-spec.md (different domain)
|
|
40
|
+
❌ user-management-spec.md (different domain)
|
|
41
|
+
❌ PM agent description (not needed for bug fix)
|
|
42
|
+
❌ Frontend skills (backend task)
|
|
43
|
+
❌ DevOps skills (not deploying)
|
|
44
|
+
|
|
45
|
+
Keeps:
|
|
46
|
+
✅ auth-spec.md (directly relevant)
|
|
47
|
+
✅ architecture/security/ (auth considerations)
|
|
48
|
+
✅ nodejs-backend skill (implementation)
|
|
49
|
+
✅ Tech Lead agent (code review)
|
|
50
|
+
|
|
51
|
+
Result: Additional 40% reduction
|
|
52
|
+
After Pass 1: 45k tokens → After Pass 2: 27k tokens
|
|
53
|
+
Total reduction: 82% (150k → 27k)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## When to Use
|
|
57
|
+
|
|
58
|
+
**Activates automatically** after context-loader when:
|
|
59
|
+
- User prompt is specific (mentions feature, bug, file)
|
|
60
|
+
- Loaded context > 20k tokens
|
|
61
|
+
- Task is focused (not "build full product")
|
|
62
|
+
|
|
63
|
+
**Manual activation:**
|
|
64
|
+
- "optimize context"
|
|
65
|
+
- "reduce tokens"
|
|
66
|
+
- "clean context"
|
|
67
|
+
|
|
68
|
+
**Skip when:**
|
|
69
|
+
- Context already small (<10k tokens)
|
|
70
|
+
- User asks broad questions ("explain architecture")
|
|
71
|
+
- Planning new features (need full context)
|
|
72
|
+
|
|
73
|
+
## What It Does
|
|
74
|
+
|
|
75
|
+
### 1. User Intent Analysis
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
interface IntentAnalysis {
|
|
79
|
+
task_type: TaskType;
|
|
80
|
+
domains: Domain[];
|
|
81
|
+
scope: Scope;
|
|
82
|
+
needs_full_context: boolean;
|
|
83
|
+
confidence: number;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
enum TaskType {
|
|
87
|
+
BUG_FIX = "bug-fix", // Narrow scope
|
|
88
|
+
FEATURE = "feature", // Medium scope
|
|
89
|
+
REFACTOR = "refactor", // Medium scope
|
|
90
|
+
ARCHITECTURE = "architecture", // Broad scope
|
|
91
|
+
DOCUMENTATION = "documentation", // Medium scope
|
|
92
|
+
TESTING = "testing" // Medium scope
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
enum Domain {
|
|
96
|
+
FRONTEND = "frontend",
|
|
97
|
+
BACKEND = "backend",
|
|
98
|
+
DATABASE = "database",
|
|
99
|
+
INFRASTRUCTURE = "infrastructure",
|
|
100
|
+
SECURITY = "security",
|
|
101
|
+
AUTH = "auth",
|
|
102
|
+
PAYMENT = "payment",
|
|
103
|
+
// ... project-specific domains
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
enum Scope {
|
|
107
|
+
NARROW = "narrow", // Single file/function
|
|
108
|
+
FOCUSED = "focused", // Single module
|
|
109
|
+
BROAD = "broad" // Multiple modules
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Analysis Examples:**
|
|
114
|
+
|
|
115
|
+
| User Prompt | Task Type | Domains | Scope | Needs Full? |
|
|
116
|
+
|-------------|-----------|---------|-------|-------------|
|
|
117
|
+
| "Fix login bug" | BUG_FIX | [AUTH, BACKEND] | NARROW | No |
|
|
118
|
+
| "Add payment feature" | FEATURE | [PAYMENT, BACKEND] | FOCUSED | No |
|
|
119
|
+
| "Refactor auth module" | REFACTOR | [AUTH, BACKEND] | FOCUSED | No |
|
|
120
|
+
| "Design system architecture" | ARCHITECTURE | [ALL] | BROAD | Yes |
|
|
121
|
+
| "Explain how payments work" | DOCUMENTATION | [PAYMENT] | FOCUSED | No |
|
|
122
|
+
|
|
123
|
+
### 2. Context Filtering Rules
|
|
124
|
+
|
|
125
|
+
```yaml
|
|
126
|
+
rules:
|
|
127
|
+
# Rule 1: Task-Specific Specs
|
|
128
|
+
bug_fix:
|
|
129
|
+
keep_specs:
|
|
130
|
+
- Related to mentioned domain
|
|
131
|
+
- Architecture docs for that domain
|
|
132
|
+
remove_specs:
|
|
133
|
+
- Unrelated domains
|
|
134
|
+
- Strategic docs (PRD, business specs)
|
|
135
|
+
- Future roadmap
|
|
136
|
+
|
|
137
|
+
feature_development:
|
|
138
|
+
keep_specs:
|
|
139
|
+
- Related domain specs
|
|
140
|
+
- Architecture for integration points
|
|
141
|
+
- Related ADRs
|
|
142
|
+
remove_specs:
|
|
143
|
+
- Unrelated domains
|
|
144
|
+
- Completed features (unless mentioned)
|
|
145
|
+
|
|
146
|
+
architecture_review:
|
|
147
|
+
keep_specs:
|
|
148
|
+
- ALL (needs full context)
|
|
149
|
+
|
|
150
|
+
# Rule 2: Agent/Skill Filtering
|
|
151
|
+
backend_task:
|
|
152
|
+
keep_skills:
|
|
153
|
+
- Backend skills (nodejs, python, dotnet)
|
|
154
|
+
- Tech Lead
|
|
155
|
+
- QA Lead
|
|
156
|
+
remove_skills:
|
|
157
|
+
- Frontend skills
|
|
158
|
+
- DevOps (unless "deploy" mentioned)
|
|
159
|
+
- PM agent (unless "requirements" mentioned)
|
|
160
|
+
|
|
161
|
+
frontend_task:
|
|
162
|
+
keep_skills:
|
|
163
|
+
- Frontend skills (React, Next.js)
|
|
164
|
+
- UI/UX skills
|
|
165
|
+
remove_skills:
|
|
166
|
+
- Backend skills
|
|
167
|
+
- Database skills
|
|
168
|
+
|
|
169
|
+
# Rule 3: Documentation Filtering
|
|
170
|
+
implementation_task:
|
|
171
|
+
keep_docs:
|
|
172
|
+
- Technical specs (HLD, LLD)
|
|
173
|
+
- ADRs
|
|
174
|
+
- Implementation guides
|
|
175
|
+
remove_docs:
|
|
176
|
+
- Strategic docs (PRD, business cases)
|
|
177
|
+
- Operations runbooks
|
|
178
|
+
- Deployment guides
|
|
179
|
+
|
|
180
|
+
planning_task:
|
|
181
|
+
keep_docs:
|
|
182
|
+
- Strategic docs (PRD)
|
|
183
|
+
- Architecture overview
|
|
184
|
+
- ADRs
|
|
185
|
+
remove_docs:
|
|
186
|
+
- Implementation details
|
|
187
|
+
- Code comments
|
|
188
|
+
- Test cases
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### 3. Optimization Algorithm
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
async function optimizeContext(
|
|
195
|
+
userPrompt: string,
|
|
196
|
+
loadedContext: Context
|
|
197
|
+
): Promise<OptimizedContext> {
|
|
198
|
+
|
|
199
|
+
// Step 1: Analyze intent
|
|
200
|
+
const intent = await analyzeIntent(userPrompt);
|
|
201
|
+
|
|
202
|
+
// Step 2: If broad scope, keep all
|
|
203
|
+
if (intent.needs_full_context) {
|
|
204
|
+
return {
|
|
205
|
+
context: loadedContext,
|
|
206
|
+
removed: [],
|
|
207
|
+
kept: Object.keys(loadedContext),
|
|
208
|
+
reason: "Broad scope requires full context"
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// Step 3: Apply filtering rules
|
|
213
|
+
const filtered = {
|
|
214
|
+
specs: filterByDomain(loadedContext.specs, intent.domains),
|
|
215
|
+
agents: filterByTaskType(loadedContext.agents, intent.task_type),
|
|
216
|
+
skills: filterByDomain(loadedContext.skills, intent.domains),
|
|
217
|
+
docs: filterByScope(loadedContext.docs, intent.scope)
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
// Step 4: Calculate savings
|
|
221
|
+
const before = calculateTokens(loadedContext);
|
|
222
|
+
const after = calculateTokens(filtered);
|
|
223
|
+
const savings = ((before - after) / before * 100).toFixed(0);
|
|
224
|
+
|
|
225
|
+
// Step 5: Return optimized context
|
|
226
|
+
return {
|
|
227
|
+
context: filtered,
|
|
228
|
+
removed: diff(loadedContext, filtered),
|
|
229
|
+
kept: Object.keys(filtered),
|
|
230
|
+
savings: `${savings}%`,
|
|
231
|
+
tokens_before: before,
|
|
232
|
+
tokens_after: after
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Usage Examples
|
|
238
|
+
|
|
239
|
+
### Example 1: Bug Fix (Narrow Scope)
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
# Pass 1: context-loader loads from manifest
|
|
243
|
+
Loaded context: 45k tokens (auth, payment, user specs)
|
|
244
|
+
|
|
245
|
+
# User prompt
|
|
246
|
+
User: "Fix bug where login fails with expired JWT"
|
|
247
|
+
|
|
248
|
+
# Pass 2: context-optimizer analyzes
|
|
249
|
+
🔍 Analyzing task requirements...
|
|
250
|
+
|
|
251
|
+
Detected:
|
|
252
|
+
Task Type: Bug Fix
|
|
253
|
+
Domains: [AUTH, BACKEND]
|
|
254
|
+
Scope: Narrow (single endpoint)
|
|
255
|
+
Full Context Needed: No
|
|
256
|
+
|
|
257
|
+
Optimizing context...
|
|
258
|
+
|
|
259
|
+
Removed (18k tokens):
|
|
260
|
+
❌ payment-spec.md (9k tokens) - Unrelated domain
|
|
261
|
+
❌ user-management-spec.md (7k tokens) - Unrelated domain
|
|
262
|
+
❌ PM agent description (1k tokens) - Not needed for bug fix
|
|
263
|
+
❌ Frontend skills (1k tokens) - Backend task
|
|
264
|
+
|
|
265
|
+
Kept (27k tokens):
|
|
266
|
+
✅ auth-spec.md (12k tokens) - Core domain
|
|
267
|
+
✅ architecture/security/jwt-handling.md (5k tokens) - Relevant
|
|
268
|
+
✅ nodejs-backend skill (8k tokens) - Implementation
|
|
269
|
+
✅ Tech Lead agent (2k tokens) - Code review
|
|
270
|
+
|
|
271
|
+
Result: 45k → 27k tokens (40% additional reduction)
|
|
272
|
+
Total: 150k → 27k (82% total reduction)
|
|
273
|
+
|
|
274
|
+
Ready to proceed with optimized context.
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### Example 2: Feature Development (Focused Scope)
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
User: "Add subscription billing to payment module"
|
|
281
|
+
|
|
282
|
+
🔍 Analyzing task requirements...
|
|
283
|
+
|
|
284
|
+
Detected:
|
|
285
|
+
Task Type: Feature Development
|
|
286
|
+
Domains: [PAYMENT, BACKEND]
|
|
287
|
+
Scope: Focused (single module)
|
|
288
|
+
Full Context Needed: No
|
|
289
|
+
|
|
290
|
+
Optimizing context...
|
|
291
|
+
|
|
292
|
+
Removed (15k tokens):
|
|
293
|
+
❌ auth-spec.md (12k tokens) - Unrelated domain
|
|
294
|
+
❌ user-management-spec.md (7k tokens) - Unrelated
|
|
295
|
+
❌ DevOps agent (2k tokens) - Not deploying yet
|
|
296
|
+
|
|
297
|
+
Kept (30k tokens):
|
|
298
|
+
✅ payment-spec.md (9k tokens) - Core domain
|
|
299
|
+
✅ architecture/payment-integration.md (6k tokens) - Integration points
|
|
300
|
+
✅ architecture/adr/0015-payment-provider.md (3k tokens) - Context
|
|
301
|
+
✅ PM agent (2k tokens) - Requirements clarification
|
|
302
|
+
✅ nodejs-backend skill (8k tokens) - Implementation
|
|
303
|
+
✅ Tech Lead agent (2k tokens) - Planning
|
|
304
|
+
|
|
305
|
+
Result: 45k → 30k tokens (33% additional reduction)
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### Example 3: Architecture Review (Broad Scope)
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
User: "Review overall system architecture"
|
|
312
|
+
|
|
313
|
+
🔍 Analyzing task requirements...
|
|
314
|
+
|
|
315
|
+
Detected:
|
|
316
|
+
Task Type: Architecture Review
|
|
317
|
+
Domains: [ALL]
|
|
318
|
+
Scope: Broad (system-wide)
|
|
319
|
+
Full Context Needed: Yes
|
|
320
|
+
|
|
321
|
+
Skipping optimization - broad scope requires full context.
|
|
322
|
+
|
|
323
|
+
Loaded context: 45k tokens (all specs retained)
|
|
324
|
+
|
|
325
|
+
Rationale: Architecture review needs visibility across all domains
|
|
326
|
+
to identify integration issues, dependencies, and design patterns.
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### Example 4: Manual Optimization
|
|
330
|
+
|
|
331
|
+
```bash
|
|
332
|
+
User: "Optimize context for payment work"
|
|
333
|
+
|
|
334
|
+
context-optimizer:
|
|
335
|
+
|
|
336
|
+
🔍 Analyzing for payment domain...
|
|
337
|
+
|
|
338
|
+
Removed (25k tokens):
|
|
339
|
+
❌ auth-spec.md
|
|
340
|
+
❌ user-management-spec.md
|
|
341
|
+
❌ Frontend skills
|
|
342
|
+
❌ Strategic docs
|
|
343
|
+
|
|
344
|
+
Kept (20k tokens):
|
|
345
|
+
✅ payment-spec.md
|
|
346
|
+
✅ Payment architecture
|
|
347
|
+
✅ Backend skills
|
|
348
|
+
✅ Integration guides
|
|
349
|
+
|
|
350
|
+
Result: 45k → 20k tokens (56% reduction)
|
|
351
|
+
|
|
352
|
+
You can now work on payment features with optimized context.
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
## Configuration
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
## Integration with Context Loader
|
|
360
|
+
|
|
361
|
+
### Workflow
|
|
362
|
+
|
|
363
|
+
```typescript
|
|
364
|
+
// 1. User asks to work on feature
|
|
365
|
+
User: "Fix authentication bug"
|
|
366
|
+
|
|
367
|
+
// 2. context-loader loads from manifest
|
|
368
|
+
context-loader.load({
|
|
369
|
+
increment: "0001-authentication",
|
|
370
|
+
manifest: "context-manifest.yaml"
|
|
371
|
+
})
|
|
372
|
+
// Result: 150k → 45k tokens (70% reduction)
|
|
373
|
+
|
|
374
|
+
// 3. context-optimizer analyzes user prompt
|
|
375
|
+
context-optimizer.analyze(userPrompt: "Fix authentication bug")
|
|
376
|
+
// Detects: bug-fix, auth domain, narrow scope
|
|
377
|
+
|
|
378
|
+
// 4. context-optimizer removes unneeded sections
|
|
379
|
+
context-optimizer.filter(loadedContext, analysis)
|
|
380
|
+
// Result: 45k → 27k tokens (40% additional reduction)
|
|
381
|
+
|
|
382
|
+
// 5. Return optimized context to main session
|
|
383
|
+
return optimizedContext
|
|
384
|
+
// Total: 150k → 27k (82% reduction)
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
### Configuration in Increment
|
|
388
|
+
|
|
389
|
+
```yaml
|
|
390
|
+
# .specweave/increments/0001-auth/context-manifest.yaml
|
|
391
|
+
spec_sections:
|
|
392
|
+
- .specweave/docs/internal/strategy/auth/spec.md
|
|
393
|
+
- .specweave/docs/internal/strategy/payment/spec.md
|
|
394
|
+
- .specweave/docs/internal/strategy/users/spec.md
|
|
395
|
+
|
|
396
|
+
documentation:
|
|
397
|
+
- .specweave/docs/internal/architecture/auth-design.md
|
|
398
|
+
- .specweave/docs/internal/architecture/payment-integration.md
|
|
399
|
+
|
|
400
|
+
max_context_tokens: 50000
|
|
401
|
+
|
|
402
|
+
# NEW: Optimization hints
|
|
403
|
+
optimization:
|
|
404
|
+
domains:
|
|
405
|
+
auth: ["auth-spec.md", "auth-design.md"]
|
|
406
|
+
payment: ["payment/spec.md", "payment-integration.md"]
|
|
407
|
+
users: ["users/spec.md"]
|
|
408
|
+
|
|
409
|
+
# Suggest which domains to keep for common tasks
|
|
410
|
+
task_hints:
|
|
411
|
+
"login": ["auth"]
|
|
412
|
+
"payment": ["payment"]
|
|
413
|
+
"billing": ["payment"]
|
|
414
|
+
"user profile": ["users", "auth"]
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
## Token Savings Examples
|
|
418
|
+
|
|
419
|
+
### Realistic Project (500-page spec)
|
|
420
|
+
|
|
421
|
+
**Without SpecWeave:**
|
|
422
|
+
- Full spec loaded: 500 pages × 300 tokens = 150,000 tokens
|
|
423
|
+
- Every query uses 150k tokens
|
|
424
|
+
- Cost: $0.015 × 150 = $2.25 per query
|
|
425
|
+
|
|
426
|
+
**With Context Loader (Pass 1):**
|
|
427
|
+
- Manifest loads only auth section: 50 pages = 15,000 tokens (90% reduction)
|
|
428
|
+
- Cost: $0.015 × 15 = $0.225 per query
|
|
429
|
+
|
|
430
|
+
**With Context Optimizer (Pass 2):**
|
|
431
|
+
- Further refine to login endpoint: 30 pages = 9,000 tokens (94% total reduction)
|
|
432
|
+
- Cost: $0.015 × 9 = $0.135 per query
|
|
433
|
+
|
|
434
|
+
**Savings: $2.25 → $0.135 (94% cost reduction)**
|
|
435
|
+
|
|
436
|
+
### Session Example (10 queries)
|
|
437
|
+
|
|
438
|
+
**Scenario:** Fix 3 auth bugs, 2 payment bugs, 1 user bug
|
|
439
|
+
|
|
440
|
+
| Query | Without | Pass 1 | Pass 2 | Savings |
|
|
441
|
+
|-------|---------|--------|--------|---------|
|
|
442
|
+
| Auth bug 1 | 150k | 45k (auth+pay+user) | 27k (auth only) | 82% |
|
|
443
|
+
| Auth bug 2 | 150k | 45k | 27k | 82% |
|
|
444
|
+
| Auth bug 3 | 150k | 45k | 27k | 82% |
|
|
445
|
+
| Payment bug 1 | 150k | 45k | 28k (payment only) | 81% |
|
|
446
|
+
| Payment bug 2 | 150k | 45k | 28k | 81% |
|
|
447
|
+
| User bug 1 | 150k | 45k | 30k (user only) | 80% |
|
|
448
|
+
|
|
449
|
+
**Total tokens:**
|
|
450
|
+
- Without: 900k tokens
|
|
451
|
+
- Pass 1 only: 270k tokens (70% reduction)
|
|
452
|
+
- Pass 2: 167k tokens (81% reduction)
|
|
453
|
+
|
|
454
|
+
**Cost savings:**
|
|
455
|
+
- Without: $13.50
|
|
456
|
+
- Pass 1 only: $4.05
|
|
457
|
+
- Pass 2: $2.50
|
|
458
|
+
|
|
459
|
+
**Additional savings: $1.55 per session (38% on top of Pass 1)**
|
|
460
|
+
|
|
461
|
+
## Best Practices
|
|
462
|
+
|
|
463
|
+
### 1. Let It Run Automatically
|
|
464
|
+
|
|
465
|
+
Default mode: auto-optimize after context-loader
|
|
466
|
+
- No manual intervention
|
|
467
|
+
- Adapts to each query
|
|
468
|
+
- Restores full context if needed
|
|
469
|
+
|
|
470
|
+
### 2. Review Removals for Critical Tasks
|
|
471
|
+
|
|
472
|
+
For production deploys, security reviews:
|
|
473
|
+
```bash
|
|
474
|
+
User: "Review security before deployment"
|
|
475
|
+
|
|
476
|
+
context-optimizer:
|
|
477
|
+
⚠️ Keeping full context (critical task detected)
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
### 3. Use Conservative Buffer for Complex Tasks
|
|
481
|
+
|
|
482
|
+
```yaml
|
|
483
|
+
buffer_strategy: "conservative"
|
|
484
|
+
```
|
|
485
|
+
- Keeps adjacent domains
|
|
486
|
+
- Includes integration points
|
|
487
|
+
- Safer for refactoring
|
|
488
|
+
|
|
489
|
+
### 4. Custom Domains for Your Project
|
|
490
|
+
|
|
491
|
+
```yaml
|
|
492
|
+
custom_domains:
|
|
493
|
+
- "payment-processing"
|
|
494
|
+
- "real-time-notifications"
|
|
495
|
+
- "analytics-pipeline"
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
Helps optimizer understand your project structure.
|
|
499
|
+
|
|
500
|
+
### 5. Monitor Optimization Accuracy
|
|
501
|
+
|
|
502
|
+
If optimizer removes needed context:
|
|
503
|
+
- Lower `min_confidence` threshold
|
|
504
|
+
- Add `always_keep` rules
|
|
505
|
+
- Use `conservative` buffer
|
|
506
|
+
|
|
507
|
+
## Limitations
|
|
508
|
+
|
|
509
|
+
**What context-optimizer CAN'T do:**
|
|
510
|
+
- ❌ Predict future conversation needs (only analyzes current prompt)
|
|
511
|
+
- ❌ Understand implicit domain relationships (unless configured)
|
|
512
|
+
- ❌ Read your mind (if prompt is vague, keeps more context)
|
|
513
|
+
|
|
514
|
+
**What context-optimizer CAN do:**
|
|
515
|
+
- ✅ Analyze task type and domain from prompt
|
|
516
|
+
- ✅ Remove obviously unrelated specs/agents
|
|
517
|
+
- ✅ Restore removed context if later needed
|
|
518
|
+
- ✅ Learn from always_keep/custom_domains config
|
|
519
|
+
|
|
520
|
+
## Test Cases
|
|
521
|
+
|
|
522
|
+
### TC-001: Bug Fix Optimization
|
|
523
|
+
**Given:** Context with auth+payment+user specs (45k tokens)
|
|
524
|
+
**When:** User says "Fix login bug"
|
|
525
|
+
**Then:** Keeps only auth spec (27k tokens, 40% reduction)
|
|
526
|
+
|
|
527
|
+
### TC-002: Feature Development
|
|
528
|
+
**Given:** Context with multiple domains
|
|
529
|
+
**When:** User says "Add subscription billing"
|
|
530
|
+
**Then:** Keeps payment + integration specs (33% reduction)
|
|
531
|
+
|
|
532
|
+
### TC-003: Architecture Review (Broad)
|
|
533
|
+
**Given:** Context with all specs
|
|
534
|
+
**When:** User says "Review architecture"
|
|
535
|
+
**Then:** Keeps all specs (0% reduction, full context needed)
|
|
536
|
+
|
|
537
|
+
### TC-004: Vague Prompt
|
|
538
|
+
**Given:** Context with multiple specs
|
|
539
|
+
**When:** User says "Help me"
|
|
540
|
+
**Then:** Keeps all (low confidence, plays safe)
|
|
541
|
+
|
|
542
|
+
### TC-005: Manual Domain Specification
|
|
543
|
+
**Given:** Context with all specs
|
|
544
|
+
**When:** User says "Optimize for payment work"
|
|
545
|
+
**Then:** Keeps only payment domain (50%+ reduction)
|
|
546
|
+
|
|
547
|
+
## Future Enhancements
|
|
548
|
+
|
|
549
|
+
### Phase 2: Conversation History Analysis
|
|
550
|
+
- Track which context was actually used
|
|
551
|
+
- Remove sections never referenced
|
|
552
|
+
- Learn user patterns
|
|
553
|
+
|
|
554
|
+
### Phase 3: Dynamic Context Expansion
|
|
555
|
+
- Start with minimal context
|
|
556
|
+
- Add sections on-demand when mentioned
|
|
557
|
+
- "Just-in-time" context loading
|
|
558
|
+
|
|
559
|
+
### Phase 4: Cross-Increment Context
|
|
560
|
+
- Detect dependencies across increments
|
|
561
|
+
- Load context from multiple increments intelligently
|
|
562
|
+
- Maintain coherence across features
|
|
563
|
+
|
|
564
|
+
## Resources
|
|
565
|
+
|
|
566
|
+
- [Retrieval-Augmented Generation (RAG)](https://arxiv.org/abs/2005.11401) - Context retrieval patterns
|
|
567
|
+
- [LongRAG: Large Context Optimization](https://arxiv.org/abs/2310.03025) - Long context handling
|
|
568
|
+
- [Anthropic Context Windows](https://docs.anthropic.com/claude/docs/context-windows) - Best practices
|
|
569
|
+
|
|
570
|
+
---
|
|
571
|
+
|
|
572
|
+
## Summary
|
|
573
|
+
|
|
574
|
+
**context-optimizer** provides second-pass context optimization:
|
|
575
|
+
|
|
576
|
+
✅ **Intent-driven filtering** (analyzes user prompt)
|
|
577
|
+
✅ **Domain-aware** (removes unrelated specs)
|
|
578
|
+
✅ **Task-type specific** (bug fix vs feature vs architecture)
|
|
579
|
+
✅ **80%+ total reduction** (on top of context-loader's 70%)
|
|
580
|
+
✅ **Automatic** (runs after context-loader)
|
|
581
|
+
✅ **Safe** (restores context if needed)
|
|
582
|
+
✅ **Configurable** (custom domains, buffer strategy)
|
|
583
|
+
|
|
584
|
+
**Use it when:** Working with large specs (500+ pages) where even manifest-based loading results in 30k+ tokens.
|
|
585
|
+
|
|
586
|
+
**Skip it when:** Context already small (<10k), broad architectural questions, or planning new features from scratch.
|
|
587
|
+
|
|
588
|
+
**The result:** From 150k tokens → 27k tokens = 82% total reduction, enabling work on enterprise-scale specs within Claude's context window.
|
|
File without changes
|
|
@@ -345,7 +345,84 @@ created: YYYY-MM-DD
|
|
|
345
345
|
- Measurable acceptance criteria
|
|
346
346
|
- Prioritized user stories (P1/P2/P3)
|
|
347
347
|
|
|
348
|
-
### Step 6:
|
|
348
|
+
### Step 6: Detect Required Plugins (INTELLIGENT AUTO-LOADING)
|
|
349
|
+
|
|
350
|
+
**Purpose**: Analyze spec content to identify required SpecWeave plugins and suggest installation.
|
|
351
|
+
|
|
352
|
+
**Why This Matters**: SpecWeave's plugin system enables context efficiency (70%+ reduction) by loading only relevant capabilities. This step ensures users have the right tools before implementation begins.
|
|
353
|
+
|
|
354
|
+
**Detection Algorithm**:
|
|
355
|
+
|
|
356
|
+
1. **Scan spec.md for keywords**:
|
|
357
|
+
```
|
|
358
|
+
Keywords → Plugin Mapping:
|
|
359
|
+
- "GitHub", "issue", "pull request", "PR" → specweave-github
|
|
360
|
+
- "Kubernetes", "K8s", "Helm", "kubectl" → specweave-kubernetes
|
|
361
|
+
- "Figma", "design system", "design tokens" → specweave-figma
|
|
362
|
+
- "Stripe", "PayPal", "billing", "subscriptions" → specweave-payments
|
|
363
|
+
- "React", "Next.js", "Vue", "Angular" → specweave-frontend
|
|
364
|
+
- "Express", "Fastify", "NestJS", "FastAPI" → specweave-backend
|
|
365
|
+
- "TensorFlow", "PyTorch", "ML", "training" → specweave-ml
|
|
366
|
+
- "Prometheus", "Grafana", "monitoring" → specweave-infrastructure
|
|
367
|
+
- "Playwright", "E2E", "browser tests" → specweave-testing
|
|
368
|
+
- "Mermaid", "C4", "diagrams", "architecture diagrams" → specweave-diagrams
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
2. **Check if plugins are already installed**:
|
|
372
|
+
- For Claude Code: Check if plugin available via `/plugin list --installed`
|
|
373
|
+
- Skip already-installed plugins
|
|
374
|
+
|
|
375
|
+
3. **Suggest installation** (if plugins detected):
|
|
376
|
+
```
|
|
377
|
+
🔌 This increment requires additional plugins:
|
|
378
|
+
|
|
379
|
+
Required:
|
|
380
|
+
• specweave-github - GitHub integration (detected: "sync tasks to GitHub issues")
|
|
381
|
+
• specweave-kubernetes - K8s deployment (detected: "deploy to production cluster")
|
|
382
|
+
|
|
383
|
+
Optional:
|
|
384
|
+
• specweave-diagrams - Architecture diagrams (helpful for "system architecture")
|
|
385
|
+
|
|
386
|
+
📦 Install plugins:
|
|
387
|
+
/plugin install specweave-github@specweave
|
|
388
|
+
/plugin install specweave-kubernetes@specweave
|
|
389
|
+
/plugin install specweave-diagrams@specweave
|
|
390
|
+
|
|
391
|
+
💡 Plugins will auto-activate during implementation!
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
4. **Wait for user to install** (don't block, but remind):
|
|
395
|
+
- If user proceeds without installing, remind them before task execution
|
|
396
|
+
- Skills from uninstalled plugins won't be available
|
|
397
|
+
- User can install later: plugins activate on next Claude Code session
|
|
398
|
+
|
|
399
|
+
**When to Suggest**:
|
|
400
|
+
- ✅ After spec.md generation (Step 5 complete)
|
|
401
|
+
- ✅ Before plan.md generation (gives context for planning)
|
|
402
|
+
- ❌ Don't block increment creation (plugins optional, not required)
|
|
403
|
+
|
|
404
|
+
**Example Output**:
|
|
405
|
+
|
|
406
|
+
```
|
|
407
|
+
📝 Spec created: .specweave/increments/0007-github-sync/spec.md
|
|
408
|
+
|
|
409
|
+
🔌 Plugin Detection:
|
|
410
|
+
Detected: "GitHub Issues", "bidirectional sync"
|
|
411
|
+
→ Suggested: specweave-github
|
|
412
|
+
|
|
413
|
+
To install: /plugin install specweave-github@specweave
|
|
414
|
+
Or continue without it (can install later)
|
|
415
|
+
|
|
416
|
+
Continue with plan.md generation? [Y/n]
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
**Integration with Existing Workflow**:
|
|
420
|
+
- This is a **suggestion step**, not a blocking requirement
|
|
421
|
+
- Increment creation continues regardless of plugin installation
|
|
422
|
+
- Plugins can be installed any time (they auto-activate when needed)
|
|
423
|
+
- This implements the "load on demand" philosophy
|
|
424
|
+
|
|
425
|
+
### Step 7: Generate plan.md
|
|
349
426
|
|
|
350
427
|
**Purpose**: Define HOW to implement the feature technically.
|
|
351
428
|
|
|
@@ -424,7 +501,7 @@ created: YYYY-MM-DD
|
|
|
424
501
|
- Challenges and solutions identified
|
|
425
502
|
- Constitutional compliance checked
|
|
426
503
|
|
|
427
|
-
### Step
|
|
504
|
+
### Step 8: Generate tasks.md
|
|
428
505
|
|
|
429
506
|
**Purpose**: Break down implementation into executable steps with intelligent model selection.
|
|
430
507
|
|
|
@@ -519,7 +596,7 @@ T051 depends on T050 (integration must pass first)
|
|
|
519
596
|
- Performance-critical algorithms
|
|
520
597
|
- Novel problem-solving required
|
|
521
598
|
|
|
522
|
-
### Step
|
|
599
|
+
### Step 9: Generate tests.md
|
|
523
600
|
|
|
524
601
|
**Purpose**: Define comprehensive testing strategy and test cases.
|
|
525
602
|
|
|
@@ -611,7 +688,7 @@ For brownfield modifications:
|
|
|
611
688
|
- Regression prevention for brownfield
|
|
612
689
|
- Measurable success criteria
|
|
613
690
|
|
|
614
|
-
### Step
|
|
691
|
+
### Step 10: Generate context-manifest.yaml
|
|
615
692
|
|
|
616
693
|
**Purpose**: Declare exactly what specifications, architecture docs, and ADRs are needed for this feature.
|
|
617
694
|
|