sinapse-ai 1.19.2 → 1.20.1
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/CLAUDE.md +2 -2
- package/.claude/hooks/enforce-delegation.cjs +32 -36
- package/.claude/rules/agent-handoff.md +10 -21
- package/.claude/rules/mandatory-delegation.md +1 -1
- package/.claude/rules/token-economy.md +12 -5
- package/.sinapse-ai/constitution.md +2 -0
- package/.sinapse-ai/core/atlas/flows-pt.js +6 -0
- package/.sinapse-ai/core/atlas/flows.js +7 -0
- package/.sinapse-ai/core/atlas/render-html.js +10 -8
- package/.sinapse-ai/core/atlas/render-markdown.js +8 -0
- package/.sinapse-ai/core/doctor/checks/constitution-consistency.js +7 -0
- package/.sinapse-ai/core/execution/autonomous-build-loop.js +10 -4
- package/.sinapse-ai/core/execution/build-orchestrator.js +73 -2
- package/.sinapse-ai/core/execution/rate-limit-manager.js +2 -0
- package/.sinapse-ai/core/execution/result-aggregator.js +2 -0
- package/.sinapse-ai/core/health-check/checks/project/constitution-consistency.js +12 -1
- package/.sinapse-ai/core/orchestration/cli-commands.js +121 -4
- package/.sinapse-ai/core/orchestration/executors/epic-4-executor.js +10 -2
- package/.sinapse-ai/core/orchestration/executors/epic-6-executor.js +53 -2
- package/.sinapse-ai/core/orchestration/index.js +3 -0
- package/.sinapse-ai/core/orchestration/master-orchestrator.js +116 -18
- package/.sinapse-ai/core/registry/service-registry.json +2 -32
- package/.sinapse-ai/core/synapse/context/context-tracker.js +118 -11
- package/.sinapse-ai/core/synapse/engine.js +18 -3
- package/.sinapse-ai/core/synapse/layers/l0-constitution.js +189 -8
- package/.sinapse-ai/core/synapse/output/formatter.js +65 -25
- package/.sinapse-ai/core-config.yaml +8 -1
- package/.sinapse-ai/data/entity-registry.yaml +492 -246
- package/.sinapse-ai/development/agents/analyst.md +18 -34
- package/.sinapse-ai/development/agents/architect.md +18 -34
- package/.sinapse-ai/development/agents/data-engineer.md +15 -28
- package/.sinapse-ai/development/agents/developer.md +18 -40
- package/.sinapse-ai/development/agents/devops.md +15 -28
- package/.sinapse-ai/development/agents/product-lead.md +18 -34
- package/.sinapse-ai/development/agents/project-lead.md +18 -34
- package/.sinapse-ai/development/agents/quality-gate.md +18 -34
- package/.sinapse-ai/development/agents/snps-orqx.md +5 -5
- package/.sinapse-ai/development/agents/sprint-lead.md +20 -36
- package/.sinapse-ai/development/agents/squad-creator.md +15 -27
- package/.sinapse-ai/development/agents/ux-design-expert.md +15 -27
- package/.sinapse-ai/development/scripts/agent-exit-hooks.js +13 -4
- package/.sinapse-ai/development/scripts/populate-entity-registry.js +3 -0
- package/.sinapse-ai/development/tasks/execute-epic-plan.md +0 -4
- package/.sinapse-ai/development/workflows/epic-orchestration.yaml +0 -1
- package/.sinapse-ai/git-hooks/lib/staged-secret-scan.js +3 -1
- package/.sinapse-ai/infrastructure/integrations/ai-providers/README.md +2 -2
- package/.sinapse-ai/install-manifest.yaml +94 -126
- package/.sinapse-ai/product/templates/activation-instructions-template.md +72 -185
- package/.sinapse-ai/product/templates/ide-rules/claude-rules.md +45 -274
- package/.sinapse-ai/product/templates/personalized-agent-template.md +3 -5
- package/.sinapse-ai/product/templates/statusline/agent-badges.json +2 -2
- package/.sinapse-ai/product/templates/statusline/statusline-script.js +5 -3
- package/.sinapse-ai/workflow-intelligence/index.js +3 -21
- package/AGENTS.md +2 -2
- package/CHANGELOG.md +50 -2
- package/README.md +10 -0
- package/bin/cli.js +29 -0
- package/bin/commands/help.js +5 -0
- package/bin/commands/install.js +5 -4
- package/bin/commands/uninstall.js +5 -0
- package/bin/lib/command-generator.js +4 -4
- package/bin/lib/fs-utils.js +18 -0
- package/bin/lib/setup-statusline.js +3 -1
- package/bin/modules/chrome-brain-installer.js +5 -3
- package/bin/modules/mcp-installer.js +3 -6
- package/bin/postinstall.js +9 -1
- package/bin/sinapse-init.js +8 -9
- package/bin/sinapse.js +152 -2
- package/bin/utils/staged-secret-scan.js +3 -1
- package/docs/framework/atlas/OPERATING-ATLAS.md +3 -3
- package/docs/framework/atlas/atlas-data.json +27 -27
- package/docs/framework/atlas/atlas.html +12 -10
- package/docs/framework/source-tree.md +2 -3
- package/docs/framework/workflow-engine-status.md +70 -0
- package/docs/guides/ade-guide.md +4 -2
- package/docs/guides/api-reference.md +2 -0
- package/docs/guides/permission-modes.md +2 -0
- package/docs/guides/user-guide.md +21 -7
- package/docs/guides/workflows/AUTO-WORKTREE-WORKFLOW.md +2 -2
- package/docs/pt/architecture/ade-architecture.md +2 -0
- package/docs/pt/architecture/high-level-architecture.md +1 -1
- package/docs/pt/guides/ade-guide.md +4 -2
- package/docs/pt/guides/api-reference.md +2 -0
- package/docs/pt/guides/permission-modes.md +2 -0
- package/docs/pt/guides/user-guide.md +21 -7
- package/docs/pt/platforms/claude-code.md +2 -2
- package/docs/sinapse-workflows/auto-worktree-workflow.md +2 -2
- package/package.json +1 -1
- package/packages/installer/src/config/configure-environment.js +14 -6
- package/packages/installer/src/config/templates/core-config-template.js +43 -1
- package/packages/installer/src/installer/brownfield-upgrader.js +5 -3
- package/packages/installer/src/installer/file-hasher.js +29 -21
- package/packages/installer/src/installer/manifest-signature.js +61 -49
- package/packages/installer/src/installer/post-install-validator.js +24 -17
- package/packages/installer/src/installer/synapse-runtime-installer.js +148 -0
- package/packages/installer/src/merger/parsers/markdown-section-parser.js +3 -2
- package/packages/installer/src/updater/index.js +7 -1
- package/packages/installer/src/utils/atomic-write.js +35 -0
- package/packages/installer/src/wizard/i18n.js +294 -0
- package/packages/installer/src/wizard/index.js +31 -3
- package/packages/installer/src/wizard/validation/troubleshooting-system.js +60 -131
- package/packages/sinapse-install/src/capabilities/chrome-brain.js +5 -3
- package/packages/sinapse-install/src/installer.js +3 -1
- package/packages/sinapse-install/src/utils/atomic-write.js +67 -0
- package/scripts/apply-persona-disclaimer.js +2 -1
- package/scripts/bracket-report.js +103 -0
- package/scripts/sinapse-patch.js +2 -1
- package/scripts/sync-squad-yaml-components.js +2 -1
- package/scripts/validate-agent-codenames.js +168 -37
- package/scripts/validate-agents-md.js +2 -1
- package/scripts/validate-article-xi.js +10 -8
- package/scripts/validate-install-docs.js +23 -2
- package/scripts/validate-no-external-refs.js +14 -8
- package/sinapse/agents/sinapse-orqx.md +3 -3
- package/sinapse/agents/snps-orqx.md +3 -3
- package/sinapse/knowledge-base/routing-catalog.md +1 -1
- package/sinapse/tasks/diagnose-and-route.md +1 -1
- package/squads/claude-code-mastery/CHANGELOG.md +1 -1
- package/squads/claude-code-mastery/README.md +6 -6
- package/squads/claude-code-mastery/agents/claude-mastery-chief.md +10 -15
- package/squads/claude-code-mastery/agents/config-engineer.md +5 -12
- package/squads/claude-code-mastery/agents/hooks-architect.md +5 -11
- package/squads/claude-code-mastery/agents/mcp-integrator.md +5 -12
- package/squads/claude-code-mastery/agents/project-integrator.md +5 -12
- package/squads/claude-code-mastery/agents/roadmap-sentinel.md +14 -21
- package/squads/claude-code-mastery/agents/skill-craftsman.md +5 -11
- package/squads/claude-code-mastery/agents/swarm-orqx.md +20 -33
- package/squads/claude-code-mastery/data/claude-code-quick-ref.yaml +1 -1
- package/squads/claude-code-mastery/knowledge-base/claude-code-internals-deep.md +4 -4
- package/squads/claude-code-mastery/knowledge-base/claude-code-internals-reference.md +4 -4
- package/squads/claude-code-mastery/tasks/create-agent-definition.md +6 -6
- package/squads/claude-code-mastery/tasks/create-team-topology.md +3 -3
- package/squads/claude-code-mastery/tasks/diagnose.md +1 -1
- package/squads/claude-code-mastery/tasks/parallel-decomposition.md +1 -1
- package/squads/claude-code-mastery/tasks/worktree-strategy.md +1 -1
- package/squads/squad-animations/README.md +1 -1
- package/squads/squad-animations/agents/animation-interpreter.md +5 -5
- package/squads/squad-animations/agents/animations-orqx.md +6 -6
- package/squads/squad-animations/squad.yaml +1 -1
- package/squads/squad-animations/tasks/analyze-reference-animation.md +1 -1
- package/squads/squad-animations/tasks/build-animation-brief.md +1 -1
- package/squads/squad-animations/tasks/create-animation-storyboard.md +1 -1
- package/squads/squad-animations/tasks/cross-reference-brand-system.md +1 -1
- package/squads/squad-animations/tasks/extract-animation-intent.md +1 -1
- package/squads/squad-animations/tasks/generate-motion-vocabulary.md +1 -1
- package/squads/squad-animations/tasks/identify-website-animation.md +1 -1
- package/squads/squad-animations/tasks/interpret-animation-prompt.md +1 -1
- package/squads/squad-animations/tasks/refine-animation-specification.md +1 -1
- package/squads/squad-animations/tasks/translate-feeling-to-parameters.md +1 -1
- package/squads/squad-animations/tasks/validate-animation-feasibility.md +1 -1
- package/squads/squad-animations/workflows/prompt-to-animation-cycle.yaml +2 -2
- package/squads/squad-brand/agents/brand-auditor.md +1 -1
- package/squads/squad-brand/agents/brand-compiler.md +1 -1
- package/squads/squad-brand/agents/brand-motion-vfx.md +5 -5
- package/squads/squad-brand/agents/brand-orqx.md +2 -2
- package/squads/squad-brand/agents/brand-sonic-designer.md +1 -1
- package/squads/squad-brand/squad.yaml +1 -1
- package/squads/squad-brand/tasks/create-animation-library.md +1 -1
- package/squads/squad-brand/tasks/create-brand-characters.md +2 -2
- package/squads/squad-brand/tasks/create-event-branding.md +2 -2
- package/squads/squad-brand/tasks/create-micro-interactions.md +1 -1
- package/squads/squad-brand/tasks/create-page-transitions.md +1 -1
- package/squads/squad-brand/tasks/create-video-templates.md +1 -1
- package/squads/squad-brand/tasks/create-web-templates.md +1 -1
- package/squads/squad-brand/tasks/define-motion-language.md +1 -1
- package/squads/squad-brand/tasks/design-dynamic-identity-system.md +2 -2
- package/squads/squad-brand/tasks/design-illustration-system.md +1 -1
- package/squads/squad-commercial/README.md +3 -3
- package/squads/squad-commercial/agents/commercial-orqx.md +8 -8
- package/squads/squad-commercial/agents/cs-crm-specialist.md +3 -3
- package/squads/squad-commercial/agents/cs-revops-analyst.md +3 -3
- package/squads/squad-commercial/agents/cs-sales-closer.md +1 -1
- package/squads/squad-commercial/knowledge-base/commercial-analytics-reporting.md +7 -7
- package/squads/squad-commercial/knowledge-base/sales-revenue-master-reference.md +1 -1
- package/squads/squad-commercial/squad.yaml +3 -3
- package/squads/squad-commercial/tasks/analyze-revenue-leaks.md +2 -2
- package/squads/squad-commercial/tasks/audit-commercial-tech-stack.md +1 -1
- package/squads/squad-commercial/tasks/audit-crm-data.md +1 -1
- package/squads/squad-commercial/tasks/build-deal-scoring-model.md +1 -1
- package/squads/squad-commercial/tasks/build-forecasting-model.md +1 -1
- package/squads/squad-commercial/tasks/build-pipeline-dashboard.md +2 -2
- package/squads/squad-commercial/tasks/build-unit-economics-model.md +1 -1
- package/squads/squad-commercial/tasks/conduct-commercial-retrospective.md +2 -2
- package/squads/squad-commercial/tasks/conduct-deal-review.md +1 -1
- package/squads/squad-commercial/tasks/conduct-win-loss-analysis.md +1 -1
- package/squads/squad-commercial/tasks/configure-activity-tracking.md +1 -1
- package/squads/squad-commercial/tasks/configure-crm-integrations.md +1 -1
- package/squads/squad-commercial/tasks/configure-pipeline-stages.md +1 -1
- package/squads/squad-commercial/tasks/coordinate-revenue-cycle.md +1 -1
- package/squads/squad-commercial/tasks/create-commercial-brief.md +2 -2
- package/squads/squad-commercial/tasks/create-revenue-dashboard.md +1 -1
- package/squads/squad-commercial/tasks/design-lead-routing.md +1 -1
- package/squads/squad-commercial/tasks/design-quota-model.md +1 -1
- package/squads/squad-commercial/tasks/execute-save-play.md +1 -1
- package/squads/squad-commercial/tasks/manage-commercial-handoffs.md +1 -1
- package/squads/squad-commercial/tasks/manage-pipeline-forecast.md +3 -3
- package/squads/squad-commercial/tasks/monitor-pipeline-health.md +1 -1
- package/squads/squad-commercial/tasks/monitor-saas-metrics.md +1 -1
- package/squads/squad-commercial/tasks/plan-sales-capacity.md +1 -1
- package/squads/squad-commercial/tasks/plan-territory-mapping.md +1 -1
- package/squads/squad-commercial/tasks/review-revenue-architecture.md +2 -2
- package/squads/squad-commercial/tasks/run-quarterly-commercial-review.md +3 -3
- package/squads/squad-commercial/tasks/select-commercial-workflow.md +1 -1
- package/squads/squad-commercial/tasks/setup-outreach-sequences.md +1 -1
- package/squads/squad-commercial/templates/offer-brief-template.md +2 -2
- package/squads/squad-commercial/workflows/new-offer-launch.yaml +2 -2
- package/squads/squad-commercial/workflows/quarterly-commercial-review.yaml +1 -1
- package/squads/squad-commercial/workflows/revenue-forecasting-cycle.yaml +2 -2
- package/squads/squad-content/README.md +1 -1
- package/squads/squad-content/agents/content-analyst.md +4 -4
- package/squads/squad-content/agents/content-engineer.md +2 -2
- package/squads/squad-content/agents/content-governor.md +1 -1
- package/squads/squad-content/agents/content-orqx.md +6 -6
- package/squads/squad-content/agents/editorial-strategist.md +5 -5
- package/squads/squad-content/agents/platform-specialist.md +1 -1
- package/squads/squad-content/agents/signal-intelligence.md +4 -4
- package/squads/squad-content/checklists/editorial-planning-checklist.md +1 -1
- package/squads/squad-content/checklists/onboarding-setup-checklist.md +2 -2
- package/squads/squad-content/knowledge-base/ai-native-content-loop.md +2 -2
- package/squads/squad-content/knowledge-base/content-governance-principles.md +2 -2
- package/squads/squad-content/knowledge-base/cross-squad-integration-protocol.md +1 -1
- package/squads/squad-content/knowledge-base/signal-intelligence-v2.md +1 -1
- package/squads/squad-content/knowledge-base/task-ownership-map.md +5 -5
- package/squads/squad-content/squad.yaml +2 -2
- package/squads/squad-content/tasks/alert-opportunity-windows.md +6 -6
- package/squads/squad-content/tasks/analyze-content-performance.md +2 -2
- package/squads/squad-content/tasks/batch-content-production.md +1 -1
- package/squads/squad-content/tasks/benchmark-against-competitors.md +1 -1
- package/squads/squad-content/tasks/coordinate-cross-squad.md +1 -1
- package/squads/squad-content/tasks/create-content-governance.md +1 -1
- package/squads/squad-content/tasks/create-editorial-calendar.md +1 -1
- package/squads/squad-content/tasks/curate-ugc-signals.md +2 -2
- package/squads/squad-content/tasks/define-big-idea.md +1 -1
- package/squads/squad-content/tasks/define-content-kpis.md +1 -1
- package/squads/squad-content/tasks/flag-content-for-amplification.md +2 -2
- package/squads/squad-content/tasks/generate-content-report.md +3 -3
- package/squads/squad-content/tasks/manage-content-sprint.md +1 -1
- package/squads/squad-content/tasks/measure-content-roi.md +3 -3
- package/squads/squad-content/tasks/orchestrate-content-pipeline.md +2 -2
- package/squads/squad-content/tasks/plan-content-sprint.md +3 -3
- package/squads/squad-content/tasks/predict-content-performance.md +2 -2
- package/squads/squad-content/tasks/scan-daily-signals.md +2 -2
- package/squads/squad-content/tasks/triage-content-requests.md +1 -1
- package/squads/squad-content/tasks/triage-urgent-signal.md +1 -1
- package/squads/squad-content/templates/signal-alert-template.md +2 -2
- package/squads/squad-content/templates/weekly-briefing-template.md +1 -1
- package/squads/squad-content/workflows/content-audit-cycle.yaml +1 -1
- package/squads/squad-content/workflows/content-creation-cycle.yaml +3 -3
- package/squads/squad-content/workflows/editorial-planning-cycle.yaml +3 -3
- package/squads/squad-content/workflows/onboarding-content-cycle.yaml +3 -3
- package/squads/squad-content/workflows/performance-feedback-loop.yaml +3 -3
- package/squads/squad-content/workflows/signal-to-content-cycle.yaml +5 -5
- package/squads/squad-copy/README.md +4 -4
- package/squads/squad-copy/agents/ad-copywriter.md +4 -4
- package/squads/squad-copy/agents/copy-orqx.md +3 -3
- package/squads/squad-copy/agents/copy-strategist.md +5 -5
- package/squads/squad-copy/agents/direct-response-writer.md +3 -3
- package/squads/squad-copy/agents/email-sequence-strategist.md +1 -1
- package/squads/squad-copy/agents/funnel-copywriter.md +3 -3
- package/squads/squad-copy/agents/headline-specialist.md +1 -1
- package/squads/squad-copy/agents/proof-architect.md +3 -3
- package/squads/squad-copy/squad.yaml +3 -3
- package/squads/squad-copy/tasks/build-proof-stack.md +3 -3
- package/squads/squad-copy/tasks/craft-cta-variations.md +2 -2
- package/squads/squad-copy/tasks/craft-email-nurture-sequence.md +2 -2
- package/squads/squad-copy/tasks/craft-objection-handlers.md +1 -1
- package/squads/squad-copy/tasks/craft-social-media-hooks.md +1 -1
- package/squads/squad-copy/tasks/create-cart-abandonment-sequence.md +2 -2
- package/squads/squad-copy/tasks/create-customer-story.md +2 -2
- package/squads/squad-copy/tasks/create-email-campaign.md +2 -2
- package/squads/squad-copy/tasks/create-mechanism-copy.md +4 -4
- package/squads/squad-copy/tasks/create-opening-hooks.md +1 -1
- package/squads/squad-copy/tasks/create-ugc-script.md +2 -2
- package/squads/squad-copy/tasks/create-urgency-scarcity-framework.md +1 -1
- package/squads/squad-copy/tasks/create-welcome-sequence.md +2 -2
- package/squads/squad-copy/tasks/design-headline-ab-tests.md +1 -1
- package/squads/squad-copy/tasks/design-trigger-sequence.md +1 -1
- package/squads/squad-copy/tasks/design-welcome-series.md +2 -2
- package/squads/squad-copy/tasks/optimize-existing-copy.md +2 -2
- package/squads/squad-copy/tasks/optimize-funnel-conversion-copy.md +2 -2
- package/squads/squad-copy/tasks/optimize-pricing-framing.md +2 -2
- package/squads/squad-copy/tasks/write-ad-copy-google.md +2 -2
- package/squads/squad-copy/tasks/write-ad-copy-social.md +2 -2
- package/squads/squad-copy/tasks/write-ad-copy-variations.md +4 -4
- package/squads/squad-copy/tasks/write-case-study.md +2 -2
- package/squads/squad-copy/tasks/write-comparison-piece.md +2 -2
- package/squads/squad-copy/tasks/write-email-sequence.md +1 -1
- package/squads/squad-copy/tasks/write-email-subject-lines.md +1 -1
- package/squads/squad-copy/tasks/write-funnel-copy-sequence.md +4 -4
- package/squads/squad-copy/tasks/write-landing-page-copy.md +2 -2
- package/squads/squad-copy/tasks/write-launch-sequence.md +2 -2
- package/squads/squad-copy/tasks/write-opt-in-page.md +2 -2
- package/squads/squad-copy/tasks/write-product-narrative.md +2 -2
- package/squads/squad-copy/tasks/write-retargeting-copy.md +2 -2
- package/squads/squad-copy/tasks/write-sales-letter.md +1 -1
- package/squads/squad-copy/tasks/write-social-proof-section.md +1 -1
- package/squads/squad-copy/tasks/write-subheadlines-and-deck-copy.md +1 -1
- package/squads/squad-copy/tasks/write-upsell-copy.md +2 -2
- package/squads/squad-copy/tasks/write-vsl-script.md +3 -3
- package/squads/squad-copy/tasks/write-whitepaper-persuasive.md +2 -2
- package/squads/squad-copy/workflows/campaign-copy-cycle.yaml +4 -4
- package/squads/squad-copy/workflows/conversion-copy-sprint.yaml +6 -6
- package/squads/squad-copy/workflows/sales-copy-pipeline.yaml +4 -4
- package/squads/squad-design/README.md +6 -6
- package/squads/squad-design/agents/cro-persuasion.md +3 -3
- package/squads/squad-design/agents/design-orqx.md +17 -17
- package/squads/squad-design/agents/dx-accessibility-specialist.md +5 -5
- package/squads/squad-design/agents/dx-design-system-architect.md +8 -8
- package/squads/squad-design/agents/dx-frontend-engineer.md +7 -7
- package/squads/squad-design/agents/dx-interaction-designer.md +6 -6
- package/squads/squad-design/agents/dx-performance-engineer.md +3 -3
- package/squads/squad-design/agents/dx-ui-designer.md +7 -7
- package/squads/squad-design/agents/dx-ux-strategist.md +7 -7
- package/squads/squad-design/agents/platform-aesthetic-director.md +11 -11
- package/squads/squad-design/agents/premium-packaging-strategist.md +2 -2
- package/squads/squad-design/agents/product-surface-director.md +1 -1
- package/squads/squad-design/squad.yaml +6 -6
- package/squads/squad-design/tasks/analyze-javascript-bundles.md +1 -1
- package/squads/squad-design/tasks/audit-core-web-vitals.md +1 -1
- package/squads/squad-design/tasks/audit-design-system-health.md +1 -1
- package/squads/squad-design/tasks/audit-motion-performance.md +1 -1
- package/squads/squad-design/tasks/certify-accessibility-compliance.md +2 -2
- package/squads/squad-design/tasks/compose-screen-layouts.md +3 -3
- package/squads/squad-design/tasks/conduct-competitive-ux-analysis.md +1 -1
- package/squads/squad-design/tasks/conduct-dx-quality-gate.md +3 -3
- package/squads/squad-design/tasks/conduct-usability-heuristic-review.md +1 -1
- package/squads/squad-design/tasks/conduct-visual-qa.md +1 -1
- package/squads/squad-design/tasks/conduct-wcag-audit.md +1 -1
- package/squads/squad-design/tasks/configure-cdn-strategy.md +1 -1
- package/squads/squad-design/tasks/configure-token-export-pipeline.md +1 -1
- package/squads/squad-design/tasks/create-a11y-remediation-plan.md +4 -4
- package/squads/squad-design/tasks/create-color-system.md +2 -2
- package/squads/squad-design/tasks/create-component-governance.md +1 -1
- package/squads/squad-design/tasks/create-component-tokens.md +2 -2
- package/squads/squad-design/tasks/create-dark-light-themes.md +3 -3
- package/squads/squad-design/tasks/create-easing-curve-library.md +1 -1
- package/squads/squad-design/tasks/create-empty-error-states.md +1 -1
- package/squads/squad-design/tasks/create-error-boundary-patterns.md +1 -1
- package/squads/squad-design/tasks/create-illustration-style.md +1 -1
- package/squads/squad-design/tasks/create-mobile-first-designs.md +2 -2
- package/squads/squad-design/tasks/create-motion-documentation.md +1 -1
- package/squads/squad-design/tasks/create-motion-tokens.md +2 -2
- package/squads/squad-design/tasks/create-primitive-tokens.md +1 -1
- package/squads/squad-design/tasks/create-responsive-grid-system.md +1 -1
- package/squads/squad-design/tasks/create-screen-reader-specs.md +1 -1
- package/squads/squad-design/tasks/create-scroll-animation-patterns.md +1 -1
- package/squads/squad-design/tasks/create-semantic-tokens.md +1 -1
- package/squads/squad-design/tasks/create-storybook-documentation-standards.md +1 -1
- package/squads/squad-design/tasks/create-user-personas.md +1 -1
- package/squads/squad-design/tasks/create-ux-principles.md +1 -1
- package/squads/squad-design/tasks/create-wireframe-brief.md +2 -2
- package/squads/squad-design/tasks/define-atomic-hierarchy.md +2 -2
- package/squads/squad-design/tasks/define-content-hierarchy.md +2 -2
- package/squads/squad-design/tasks/define-motion-principles.md +4 -4
- package/squads/squad-design/tasks/define-performance-budgets.md +1 -1
- package/squads/squad-design/tasks/define-token-taxonomy.md +2 -2
- package/squads/squad-design/tasks/design-accessible-form-patterns.md +2 -2
- package/squads/squad-design/tasks/design-component-api-contracts.md +3 -3
- package/squads/squad-design/tasks/design-component-visual-states.md +4 -4
- package/squads/squad-design/tasks/design-dashboard-layouts.md +1 -1
- package/squads/squad-design/tasks/design-duration-scale.md +1 -1
- package/squads/squad-design/tasks/design-feedback-animations.md +2 -2
- package/squads/squad-design/tasks/design-focus-management.md +1 -1
- package/squads/squad-design/tasks/design-form-patterns.md +2 -2
- package/squads/squad-design/tasks/design-icon-system.md +1 -1
- package/squads/squad-design/tasks/design-information-architecture.md +2 -2
- package/squads/squad-design/tasks/design-landing-page-ui.md +3 -3
- package/squads/squad-design/tasks/design-loading-choreography.md +1 -1
- package/squads/squad-design/tasks/design-multi-brand-theming.md +1 -1
- package/squads/squad-design/tasks/design-page-transitions.md +1 -1
- package/squads/squad-design/tasks/design-spacing-scale.md +3 -3
- package/squads/squad-design/tasks/design-typography-scale.md +3 -3
- package/squads/squad-design/tasks/design-user-flows.md +2 -2
- package/squads/squad-design/tasks/design-visual-hierarchy.md +2 -2
- package/squads/squad-design/tasks/eliminate-render-blocking.md +1 -1
- package/squads/squad-design/tasks/extract-critical-css.md +1 -1
- package/squads/squad-design/tasks/govern-third-party-scripts.md +1 -1
- package/squads/squad-design/tasks/implement-authentication-ui.md +1 -1
- package/squads/squad-design/tasks/implement-component-library.md +4 -4
- package/squads/squad-design/tasks/implement-form-system.md +2 -2
- package/squads/squad-design/tasks/implement-reduced-motion.md +3 -3
- package/squads/squad-design/tasks/implement-responsive-layouts.md +1 -1
- package/squads/squad-design/tasks/implement-routing-strategy.md +1 -1
- package/squads/squad-design/tasks/map-dark-mode-tokens.md +3 -3
- package/squads/squad-design/tasks/map-user-journeys.md +2 -2
- package/squads/squad-design/tasks/migrate-legacy-design-system.md +1 -1
- package/squads/squad-design/tasks/monitor-performance-regression.md +1 -1
- package/squads/squad-design/tasks/optimize-font-loading.md +1 -1
- package/squads/squad-design/tasks/optimize-image-pipeline.md +1 -1
- package/squads/squad-design/tasks/orchestrate-dx-pipeline.md +2 -2
- package/squads/squad-design/tasks/plan-ux-research-sprint.md +1 -1
- package/squads/squad-design/tasks/produce-design-handoff-specs.md +4 -4
- package/squads/squad-design/tasks/review-aria-patterns.md +1 -1
- package/squads/squad-design/tasks/setup-performance-ci-gates.md +1 -1
- package/squads/squad-design/tasks/setup-storybook-integration.md +1 -1
- package/squads/squad-design/tasks/spec-gesture-interactions.md +1 -1
- package/squads/squad-design/tasks/spec-micro-interactions.md +2 -2
- package/squads/squad-design/tasks/synthesize-user-research.md +2 -2
- package/squads/squad-design/tasks/test-keyboard-navigation.md +1 -1
- package/squads/squad-design/tasks/validate-ux-with-testing.md +1 -1
- package/squads/squad-design/tasks/verify-color-contrast.md +2 -2
- package/squads/squad-design/templates/a11y-audit-report-template.md +1 -1
- package/squads/squad-design/templates/design-handoff-template.md +1 -1
- package/squads/squad-design/templates/performance-budget-template.md +1 -1
- package/squads/squad-design/templates/ux-research-plan-template.md +1 -1
- package/squads/squad-design/workflows/a11y-compliance-cycle.yaml +8 -8
- package/squads/squad-design/workflows/design-system-build-cycle.yaml +12 -12
- package/squads/squad-design/workflows/landing-page-sprint.yaml +10 -10
- package/squads/squad-design/workflows/performance-remediation-cycle.yaml +6 -6
- package/squads/squad-design/workflows/ux-research-sprint.yaml +8 -8
- package/squads/squad-design/workflows/zero-to-digital-product-cycle.yaml +16 -16
- package/squads/squad-finance/README.md +1 -1
- package/squads/squad-finance/agents/budget-controller.md +1 -1
- package/squads/squad-finance/agents/cost-optimizer.md +2 -2
- package/squads/squad-finance/agents/finance-orqx.md +4 -4
- package/squads/squad-finance/agents/fiscal-compliance-br.md +4 -4
- package/squads/squad-finance/agents/forecast-strategist.md +6 -6
- package/squads/squad-finance/agents/pricing-strategist.md +3 -3
- package/squads/squad-finance/agents/profitability-analyst.md +1 -1
- package/squads/squad-finance/agents/revenue-analyst.md +1 -1
- package/squads/squad-finance/checklists/monthly-close-checklist.md +1 -1
- package/squads/squad-finance/checklists/quarterly-review-checklist.md +1 -1
- package/squads/squad-finance/squad.yaml +2 -2
- package/squads/squad-finance/tasks/analyze-price-sensitivity.md +1 -1
- package/squads/squad-finance/tasks/benchmark-competitor-pricing.md +1 -1
- package/squads/squad-finance/tasks/calculate-rate-card.md +1 -1
- package/squads/squad-finance/tasks/coordinate-quarterly-review.md +2 -2
- package/squads/squad-finance/tasks/create-proposal-pricing.md +1 -1
- package/squads/squad-finance/tasks/design-service-tiers.md +1 -1
- package/squads/squad-finance/tasks/design-value-based-pricing.md +1 -1
- package/squads/squad-finance/tasks/manage-financial-calendar.md +1 -1
- package/squads/squad-finance/tasks/model-pricing-scenario.md +1 -1
- package/squads/squad-finance/tasks/optimize-rate-realization.md +1 -1
- package/squads/squad-finance/tasks/simulate-pricing-impact.md +1 -1
- package/squads/squad-finance/tasks/track-pricing-performance.md +1 -1
- package/squads/squad-paidmedia/README.md +4 -4
- package/squads/squad-paidmedia/agents/campaign-analyst.md +6 -6
- package/squads/squad-paidmedia/agents/creative-strategist.md +2 -2
- package/squads/squad-paidmedia/agents/cro-specialist.md +5 -5
- package/squads/squad-paidmedia/agents/google-ads-specialist.md +2 -2
- package/squads/squad-paidmedia/agents/meta-ads-specialist.md +6 -6
- package/squads/squad-paidmedia/agents/paidmedia-orqx.md +6 -6
- package/squads/squad-paidmedia/agents/performance-engineer.md +2 -2
- package/squads/squad-paidmedia/agents/pm-creative-performance-analyst.md +2 -2
- package/squads/squad-paidmedia/knowledge-base/routing-catalog.md +21 -21
- package/squads/squad-paidmedia/squad.yaml +4 -4
- package/squads/squad-paidmedia/tasks/allocate-cross-channel-budget.md +1 -1
- package/squads/squad-paidmedia/tasks/allocate-meta-budget.md +2 -2
- package/squads/squad-paidmedia/tasks/analyze-audience-performance.md +1 -1
- package/squads/squad-paidmedia/tasks/analyze-content-performance.md +1 -1
- package/squads/squad-paidmedia/tasks/analyze-conversion-funnel.md +2 -2
- package/squads/squad-paidmedia/tasks/analyze-creative-effectiveness.md +1 -1
- package/squads/squad-paidmedia/tasks/analyze-keyword-rankings.md +1 -1
- package/squads/squad-paidmedia/tasks/analyze-landing-page.md +1 -1
- package/squads/squad-paidmedia/tasks/analyze-local-keywords.md +1 -1
- package/squads/squad-paidmedia/tasks/analyze-local-market.md +1 -1
- package/squads/squad-paidmedia/tasks/analyze-reviews-strategy.md +1 -1
- package/squads/squad-paidmedia/tasks/analyze-top-pages.md +1 -1
- package/squads/squad-paidmedia/tasks/analyze-traffic-sources.md +1 -1
- package/squads/squad-paidmedia/tasks/analyze-user-behavior.md +1 -1
- package/squads/squad-paidmedia/tasks/audit-conversion-tracking.md +1 -1
- package/squads/squad-paidmedia/tasks/audit-gmb-location.md +1 -1
- package/squads/squad-paidmedia/tasks/audit-meta-ads-account.md +1 -1
- package/squads/squad-paidmedia/tasks/audit-sitemap-health.md +1 -1
- package/squads/squad-paidmedia/tasks/build-audience-architecture.md +2 -2
- package/squads/squad-paidmedia/tasks/build-creative-scorecard.md +1 -1
- package/squads/squad-paidmedia/tasks/calculate-sample-size.md +1 -1
- package/squads/squad-paidmedia/tasks/check-indexing-status.md +1 -1
- package/squads/squad-paidmedia/tasks/create-scaling-roadmap.md +1 -1
- package/squads/squad-paidmedia/tasks/design-campaign-structure.md +2 -2
- package/squads/squad-paidmedia/tasks/design-progressive-profiling.md +1 -1
- package/squads/squad-paidmedia/tasks/detect-creative-fatigue.md +1 -1
- package/squads/squad-paidmedia/tasks/execute-launch-checklist.md +1 -1
- package/squads/squad-paidmedia/tasks/generate-monthly-report.md +1 -1
- package/squads/squad-paidmedia/tasks/generate-search-performance-overview.md +1 -1
- package/squads/squad-paidmedia/tasks/generate-weekly-summary.md +1 -1
- package/squads/squad-paidmedia/tasks/manage-pixel-capi-health.md +1 -1
- package/squads/squad-paidmedia/tasks/manage-scaling-roadmap.md +1 -1
- package/squads/squad-paidmedia/tasks/measure-activation-rate.md +1 -1
- package/squads/squad-paidmedia/tasks/optimize-ad-set-targeting.md +2 -2
- package/squads/squad-paidmedia/tasks/optimize-form-conversion.md +1 -1
- package/squads/squad-paidmedia/tasks/optimize-onboarding-activation.md +1 -1
- package/squads/squad-paidmedia/tasks/optimize-page-conversion.md +1 -1
- package/squads/squad-paidmedia/tasks/optimize-signup-flow.md +1 -1
- package/squads/squad-paidmedia/tasks/plan-customer-engagement.md +1 -1
- package/squads/squad-paidmedia/tasks/run-ab-test.md +1 -1
- package/squads/squad-paidmedia/tasks/run-creative-test.md +1 -1
- package/squads/squad-paidmedia/tasks/track-gmb-performance-trends.md +1 -1
- package/squads/squad-paidmedia/tasks/triage-campaign-issues.md +1 -1
- package/squads/squad-product/README.md +2 -2
- package/squads/squad-product/agents/product-orqx.md +4 -4
- package/squads/squad-product/agents/ps-delivery-manager.md +2 -2
- package/squads/squad-product/agents/ps-product-ops-specialist.md +2 -2
- package/squads/squad-product/squad.yaml +2 -2
- package/squads/squad-product/tasks/audit-product-tool-stack.md +1 -1
- package/squads/squad-product/tasks/build-product-knowledge-base.md +1 -1
- package/squads/squad-product/tasks/calculate-sprint-velocity.md +1 -1
- package/squads/squad-product/tasks/configure-feature-flag-rollout.md +1 -1
- package/squads/squad-product/tasks/create-product-artifact-template.md +1 -1
- package/squads/squad-product/tasks/create-product-onboarding-runbook.md +3 -3
- package/squads/squad-product/tasks/create-product-playbook.md +2 -2
- package/squads/squad-product/tasks/document-product-process.md +1 -1
- package/squads/squad-product/tasks/execute-feature-launch-checklist.md +1 -1
- package/squads/squad-product/tasks/facilitate-sprint-retrospective.md +1 -1
- package/squads/squad-product/tasks/generate-product-health-report.md +2 -2
- package/squads/squad-product/tasks/maintain-decision-log-system.md +1 -1
- package/squads/squad-product/tasks/manage-sprint-capacity-planning.md +1 -1
- package/squads/squad-product/tasks/map-cross-functional-dependencies.md +1 -1
- package/squads/squad-product/tasks/prepare-product-handoff-package.md +4 -4
- package/squads/squad-product/tasks/run-product-operations-audit.md +1 -1
- package/squads/squad-product/tasks/run-shape-up-betting-table.md +1 -1
- package/squads/squad-product/tasks/run-sprint-planning-session.md +1 -1
- package/squads/squad-product/tasks/scope-agency-mvp.md +1 -1
- package/squads/squad-product/tasks/setup-new-client-product-operations.md +1 -1
- package/squads/squad-product/tasks/standardize-cross-client-metrics.md +1 -1
- package/squads/squad-product/tasks/triage-technical-debt-backlog.md +1 -1
- package/squads/squad-product/tasks/write-release-notes.md +1 -1
- package/squads/squad-research/README.md +3 -3
- package/squads/squad-research/agents/audience-intelligence.md +9 -9
- package/squads/squad-research/agents/competitive-intelligence.md +1 -1
- package/squads/squad-research/agents/data-synthesizer.md +11 -11
- package/squads/squad-research/agents/deep-researcher.md +2 -2
- package/squads/squad-research/agents/market-analyst.md +9 -9
- package/squads/squad-research/agents/research-orqx.md +4 -4
- package/squads/squad-research/agents/trend-forecaster.md +2 -2
- package/squads/squad-research/knowledge-base/agentic-second-brain-reference.md +1 -1
- package/squads/squad-research/knowledge-base/community-platforms-reference.md +1 -1
- package/squads/squad-research/knowledge-base/cross-squad-integration-protocol.md +1 -1
- package/squads/squad-research/knowledge-base/multi-agent-research-methodology.md +3 -3
- package/squads/squad-research/squad.yaml +3 -3
- package/squads/squad-research/tasks/analyze-audience-behavior.md +2 -2
- package/squads/squad-research/tasks/analyze-audience-psychographics.md +2 -2
- package/squads/squad-research/tasks/analyze-competitor-pricing.md +1 -1
- package/squads/squad-research/tasks/analyze-industry-trends.md +2 -2
- package/squads/squad-research/tasks/analyze-macro-forces.md +1 -1
- package/squads/squad-research/tasks/analyze-pricing-landscape.md +2 -2
- package/squads/squad-research/tasks/analyze-social-listening.md +2 -2
- package/squads/squad-research/tasks/analyze-value-chain.md +2 -2
- package/squads/squad-research/tasks/answer-strategic-question.md +1 -1
- package/squads/squad-research/tasks/assess-market-maturity.md +2 -2
- package/squads/squad-research/tasks/build-audience-persona.md +2 -2
- package/squads/squad-research/tasks/build-data-narrative.md +2 -2
- package/squads/squad-research/tasks/compile-competitive-dossier.md +2 -2
- package/squads/squad-research/tasks/conduct-deep-research.md +1 -1
- package/squads/squad-research/tasks/conduct-jobs-to-be-done.md +2 -2
- package/squads/squad-research/tasks/create-empathy-map.md +2 -2
- package/squads/squad-research/tasks/create-executive-briefing.md +2 -2
- package/squads/squad-research/tasks/create-insight-deck.md +2 -2
- package/squads/squad-research/tasks/create-research-dossier.md +1 -1
- package/squads/squad-research/tasks/create-research-repository.md +2 -2
- package/squads/squad-research/tasks/create-swot-analysis.md +4 -4
- package/squads/squad-research/tasks/design-survey.md +2 -2
- package/squads/squad-research/tasks/evaluate-market-entry.md +2 -2
- package/squads/squad-research/tasks/evaluate-regulatory-landscape.md +2 -2
- package/squads/squad-research/tasks/forecast-industry-trends.md +2 -2
- package/squads/squad-research/tasks/forecast-market-growth.md +2 -2
- package/squads/squad-research/tasks/generate-actionable-recommendations.md +2 -2
- package/squads/squad-research/tasks/identify-market-segments.md +3 -3
- package/squads/squad-research/tasks/map-audience-ecosystem.md +2 -2
- package/squads/squad-research/tasks/map-audience-journey.md +2 -2
- package/squads/squad-research/tasks/map-industry-ecosystem.md +2 -2
- package/squads/squad-research/tasks/map-market-opportunity.md +2 -2
- package/squads/squad-research/tasks/map-pain-gain-matrix.md +2 -2
- package/squads/squad-research/tasks/map-strategic-implications.md +2 -2
- package/squads/squad-research/tasks/orchestrate-research-pipeline.md +4 -4
- package/squads/squad-research/tasks/predict-market-shifts.md +1 -1
- package/squads/squad-research/tasks/profile-ideal-customer.md +2 -2
- package/squads/squad-research/tasks/run-porter-five-forces.md +1 -1
- package/squads/squad-research/tasks/run-scenario-planning.md +1 -1
- package/squads/squad-research/tasks/segment-audience.md +2 -2
- package/squads/squad-research/tasks/size-market-tam-sam-som.md +2 -2
- package/squads/squad-research/tasks/synthesize-multi-source.md +1 -1
- package/squads/squad-research/tasks/synthesize-research-report.md +2 -2
- package/squads/squad-research/tasks/validate-persona-with-data.md +2 -2
- package/squads/squad-research/tasks/visualize-research-data.md +2 -2
- package/squads/squad-research/templates/audience-persona-template.md +1 -1
- package/squads/squad-research/templates/competitive-dossier-template.md +1 -1
- package/squads/squad-research/templates/market-analysis-template.md +1 -1
- package/squads/squad-research/workflows/audience-intelligence-cycle.yaml +12 -12
- package/squads/squad-research/workflows/competitive-intelligence-cycle.yaml +2 -2
- package/squads/squad-research/workflows/deep-research-cycle.yaml +2 -2
- package/squads/squad-research/workflows/full-research-sprint.yaml +8 -8
- package/squads/squad-research/workflows/market-analysis-cycle.yaml +12 -12
- package/squads/squad-research/workflows/trend-forecasting-cycle.yaml +2 -2
- package/.sinapse-ai/core/execution/context-injector.js +0 -537
- package/.sinapse-ai/core/execution/parallel-executor.js +0 -299
- package/.sinapse-ai/core/execution/parallel-monitor.js +0 -430
- package/.sinapse-ai/core/execution/semantic-merge-engine.js +0 -1748
- package/.sinapse-ai/core/execution/wave-executor.js +0 -401
- package/.sinapse-ai/development/tasks/waves.md +0 -205
- package/.sinapse-ai/lib/build.json +0 -1
- package/.sinapse-ai/workflow-intelligence/engine/wave-analyzer.js +0 -684
|
@@ -1,537 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Context Injector
|
|
3
|
-
* Story 10.3 - Parallel Agent Execution
|
|
4
|
-
*
|
|
5
|
-
* Injects rich context into subagent prompts including:
|
|
6
|
-
* - Project context
|
|
7
|
-
* - Relevant files
|
|
8
|
-
* - Memory/patterns
|
|
9
|
-
* - Gotchas
|
|
10
|
-
* - Recent decisions
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
const fs = require('fs');
|
|
14
|
-
const path = require('path');
|
|
15
|
-
|
|
16
|
-
// Import dependencies with fallbacks
|
|
17
|
-
let MemoryQuery, GotchasMemory, SessionMemory;
|
|
18
|
-
try {
|
|
19
|
-
MemoryQuery = require('../memory/memory-query');
|
|
20
|
-
} catch {
|
|
21
|
-
MemoryQuery = null;
|
|
22
|
-
}
|
|
23
|
-
try {
|
|
24
|
-
GotchasMemory = require('../memory/gotchas-memory');
|
|
25
|
-
} catch {
|
|
26
|
-
GotchasMemory = null;
|
|
27
|
-
}
|
|
28
|
-
try {
|
|
29
|
-
SessionMemory = require('../memory/session-memory');
|
|
30
|
-
} catch {
|
|
31
|
-
SessionMemory = null;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
class ContextInjector {
|
|
35
|
-
constructor(config = {}) {
|
|
36
|
-
// Token budget for context (prevents overwhelming the LLM)
|
|
37
|
-
this.tokenBudget = config.tokenBudget || 4000;
|
|
38
|
-
|
|
39
|
-
// Approximate characters per token
|
|
40
|
-
this.charsPerToken = config.charsPerToken || 4;
|
|
41
|
-
|
|
42
|
-
// Cache TTL (5 minutes)
|
|
43
|
-
this.cacheTTL = config.cacheTTL || 5 * 60 * 1000;
|
|
44
|
-
|
|
45
|
-
// Context cache
|
|
46
|
-
this.cache = new Map();
|
|
47
|
-
|
|
48
|
-
// Dependencies
|
|
49
|
-
this.memoryQuery = config.memoryQuery || (MemoryQuery ? new MemoryQuery() : null);
|
|
50
|
-
this.gotchasMemory = config.gotchasMemory || (GotchasMemory ? new GotchasMemory() : null);
|
|
51
|
-
this.sessionMemory = config.sessionMemory || (SessionMemory ? new SessionMemory() : null);
|
|
52
|
-
|
|
53
|
-
// Root path
|
|
54
|
-
this.rootPath = config.rootPath || process.cwd();
|
|
55
|
-
|
|
56
|
-
// Metrics
|
|
57
|
-
this.metrics = {
|
|
58
|
-
injections: 0,
|
|
59
|
-
cacheHits: 0,
|
|
60
|
-
avgContextSize: 0,
|
|
61
|
-
avgInjectionTime: 0,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Inject context for a task
|
|
67
|
-
* @param {Object} task - Task to inject context for
|
|
68
|
-
* @param {Object} baseContext - Base context
|
|
69
|
-
* @returns {Promise<string>} - Formatted context string
|
|
70
|
-
*/
|
|
71
|
-
async inject(task, _baseContext = {}) {
|
|
72
|
-
const startTime = Date.now();
|
|
73
|
-
const cacheKey = this.getCacheKey(task);
|
|
74
|
-
|
|
75
|
-
// Build injection payload
|
|
76
|
-
const injection = {
|
|
77
|
-
// 1. Task description (required)
|
|
78
|
-
task: {
|
|
79
|
-
id: task.id,
|
|
80
|
-
description: task.description,
|
|
81
|
-
acceptanceCriteria: task.acceptanceCriteria || [],
|
|
82
|
-
verification: task.verification,
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
// 2. Project context (from cache or fresh)
|
|
86
|
-
project: await this.getProjectContext(cacheKey),
|
|
87
|
-
|
|
88
|
-
// 3. Relevant files (task-specific)
|
|
89
|
-
files: await this.getRelevantFiles(task),
|
|
90
|
-
|
|
91
|
-
// 4. Memory context
|
|
92
|
-
memory: await this.getRelevantMemory(task),
|
|
93
|
-
|
|
94
|
-
// 5. Gotchas
|
|
95
|
-
gotchas: await this.getRelevantGotchas(task),
|
|
96
|
-
|
|
97
|
-
// 6. Recent decisions
|
|
98
|
-
decisions: await this.getRecentDecisions(),
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
// Format for LLM consumption
|
|
102
|
-
const formatted = this.formatForLLM(injection);
|
|
103
|
-
|
|
104
|
-
// Ensure within token budget
|
|
105
|
-
const trimmed = this.trimToTokenBudget(formatted, this.tokenBudget);
|
|
106
|
-
|
|
107
|
-
// Update metrics
|
|
108
|
-
const injectionTime = Date.now() - startTime;
|
|
109
|
-
this.updateMetrics(trimmed, injectionTime);
|
|
110
|
-
|
|
111
|
-
return trimmed;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Get cache key for a task
|
|
116
|
-
* @param {Object} task - Task
|
|
117
|
-
* @returns {string} - Cache key
|
|
118
|
-
*/
|
|
119
|
-
getCacheKey(task) {
|
|
120
|
-
return `${task.type || 'default'}-${task.service || 'core'}`;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Get cached value if valid
|
|
125
|
-
* @param {string} key - Cache key
|
|
126
|
-
* @returns {any|null} - Cached value or null
|
|
127
|
-
*/
|
|
128
|
-
getCached(key) {
|
|
129
|
-
const cached = this.cache.get(key);
|
|
130
|
-
if (!cached) return null;
|
|
131
|
-
|
|
132
|
-
if (Date.now() - cached.timestamp > this.cacheTTL) {
|
|
133
|
-
this.cache.delete(key);
|
|
134
|
-
return null;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
this.metrics.cacheHits++;
|
|
138
|
-
return cached.value;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Set cache value
|
|
143
|
-
* @param {string} key - Cache key
|
|
144
|
-
* @param {any} value - Value to cache
|
|
145
|
-
*/
|
|
146
|
-
setCache(key, value) {
|
|
147
|
-
this.cache.set(key, {
|
|
148
|
-
value,
|
|
149
|
-
timestamp: Date.now(),
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Get project context
|
|
155
|
-
* @param {string} cacheKey - Cache key for type-specific context
|
|
156
|
-
* @returns {Promise<Object>} - Project context
|
|
157
|
-
*/
|
|
158
|
-
async getProjectContext(cacheKey) {
|
|
159
|
-
// Check cache
|
|
160
|
-
const cached = this.getCached(`project-${cacheKey}`);
|
|
161
|
-
if (cached) return cached;
|
|
162
|
-
|
|
163
|
-
const context = {
|
|
164
|
-
name: 'unknown',
|
|
165
|
-
framework: null,
|
|
166
|
-
patterns: [],
|
|
167
|
-
conventions: [],
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
try {
|
|
171
|
-
// Try to read codebase map
|
|
172
|
-
const codebaseMapPath = path.join(this.rootPath, '.sinapse', 'codebase-map.json');
|
|
173
|
-
if (fs.existsSync(codebaseMapPath)) {
|
|
174
|
-
const codebaseMap = JSON.parse(fs.readFileSync(codebaseMapPath, 'utf8'));
|
|
175
|
-
context.name = codebaseMap.name || codebaseMap.projectName || 'project';
|
|
176
|
-
context.framework = codebaseMap.framework || codebaseMap.mainFramework;
|
|
177
|
-
context.patterns = codebaseMap.patterns || [];
|
|
178
|
-
context.entryPoints = codebaseMap.entryPoints || [];
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// Try to read package.json
|
|
182
|
-
const packagePath = path.join(this.rootPath, 'package.json');
|
|
183
|
-
if (fs.existsSync(packagePath)) {
|
|
184
|
-
const pkg = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
|
|
185
|
-
context.name = pkg.name || context.name;
|
|
186
|
-
context.version = pkg.version;
|
|
187
|
-
context.dependencies = Object.keys(pkg.dependencies || {}).slice(0, 10);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// Try to detect conventions
|
|
191
|
-
context.conventions = await this.detectConventions();
|
|
192
|
-
} catch (_error) {
|
|
193
|
-
// Silently fail - context is optional enhancement
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
// Cache the result
|
|
197
|
-
this.setCache(`project-${cacheKey}`, context);
|
|
198
|
-
|
|
199
|
-
return context;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Detect project conventions
|
|
204
|
-
* @returns {Promise<Array>} - Detected conventions
|
|
205
|
-
*/
|
|
206
|
-
async detectConventions() {
|
|
207
|
-
const conventions = [];
|
|
208
|
-
|
|
209
|
-
try {
|
|
210
|
-
// Check for TypeScript
|
|
211
|
-
if (fs.existsSync(path.join(this.rootPath, 'tsconfig.json'))) {
|
|
212
|
-
conventions.push('TypeScript project');
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// Check for ESLint
|
|
216
|
-
const eslintFiles = ['.eslintrc.js', '.eslintrc.json', '.eslintrc.yaml'];
|
|
217
|
-
if (eslintFiles.some((f) => fs.existsSync(path.join(this.rootPath, f)))) {
|
|
218
|
-
conventions.push('Uses ESLint');
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
// Check for Prettier
|
|
222
|
-
if (fs.existsSync(path.join(this.rootPath, '.prettierrc'))) {
|
|
223
|
-
conventions.push('Uses Prettier');
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
// Check for tests directory
|
|
227
|
-
if (fs.existsSync(path.join(this.rootPath, 'tests'))) {
|
|
228
|
-
conventions.push('Tests in /tests directory');
|
|
229
|
-
} else if (fs.existsSync(path.join(this.rootPath, '__tests__'))) {
|
|
230
|
-
conventions.push('Tests in /__tests__ directory');
|
|
231
|
-
}
|
|
232
|
-
} catch (_error) {
|
|
233
|
-
// Ignore errors
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
return conventions;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Get relevant files for a task
|
|
241
|
-
* @param {Object} task - Task
|
|
242
|
-
* @returns {Promise<Array>} - Relevant files
|
|
243
|
-
*/
|
|
244
|
-
async getRelevantFiles(task) {
|
|
245
|
-
const files = [];
|
|
246
|
-
|
|
247
|
-
// Add explicitly specified files
|
|
248
|
-
if (task.files) {
|
|
249
|
-
for (const file of task.files) {
|
|
250
|
-
files.push({
|
|
251
|
-
path: file,
|
|
252
|
-
purpose: 'Specified in task',
|
|
253
|
-
exists: fs.existsSync(path.join(this.rootPath, file)),
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
// Infer files from task description
|
|
259
|
-
const inferredFiles = this.inferFilesFromDescription(task.description);
|
|
260
|
-
for (const file of inferredFiles) {
|
|
261
|
-
if (!files.some((f) => f.path === file)) {
|
|
262
|
-
files.push({
|
|
263
|
-
path: file,
|
|
264
|
-
purpose: 'Inferred from description',
|
|
265
|
-
exists: fs.existsSync(path.join(this.rootPath, file)),
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
return files.slice(0, 10); // Limit to 10 files
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* Infer files from task description
|
|
275
|
-
* @param {string} description - Task description
|
|
276
|
-
* @returns {Array<string>} - Inferred file paths
|
|
277
|
-
*/
|
|
278
|
-
inferFilesFromDescription(description) {
|
|
279
|
-
if (!description) return [];
|
|
280
|
-
|
|
281
|
-
const files = [];
|
|
282
|
-
|
|
283
|
-
// Match file paths in backticks
|
|
284
|
-
const backtickMatches = description.match(/`([^`]+\.[a-zA-Z]+)`/g) || [];
|
|
285
|
-
for (const match of backtickMatches) {
|
|
286
|
-
files.push(match.replace(/`/g, ''));
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
// Match quoted paths
|
|
290
|
-
const quotedMatches = description.match(/['"]([^'"]+\.[a-zA-Z]+)['"]/g) || [];
|
|
291
|
-
for (const match of quotedMatches) {
|
|
292
|
-
files.push(match.replace(/['"]/g, ''));
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
return [...new Set(files)];
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Get relevant memory for a task
|
|
300
|
-
* @param {Object} task - Task
|
|
301
|
-
* @returns {Promise<Array>} - Relevant memory entries
|
|
302
|
-
*/
|
|
303
|
-
async getRelevantMemory(task) {
|
|
304
|
-
if (!this.memoryQuery) return [];
|
|
305
|
-
|
|
306
|
-
try {
|
|
307
|
-
const query = task.description || task.id;
|
|
308
|
-
const results = await this.memoryQuery.query(query, { limit: 5 });
|
|
309
|
-
return results.map((r) => ({
|
|
310
|
-
type: r.type,
|
|
311
|
-
content: r.content || r.summary,
|
|
312
|
-
relevance: r.score || r.relevance,
|
|
313
|
-
}));
|
|
314
|
-
} catch (_error) {
|
|
315
|
-
return [];
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* Get relevant gotchas for a task
|
|
321
|
-
* @param {Object} task - Task
|
|
322
|
-
* @returns {Promise<Array>} - Relevant gotchas
|
|
323
|
-
*/
|
|
324
|
-
async getRelevantGotchas(task) {
|
|
325
|
-
if (!this.gotchasMemory) return [];
|
|
326
|
-
|
|
327
|
-
try {
|
|
328
|
-
return await this.gotchasMemory.getContextForTask(task.description || task.id);
|
|
329
|
-
} catch (_error) {
|
|
330
|
-
return [];
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* Get recent decisions from session memory
|
|
336
|
-
* @returns {Promise<Array>} - Recent decisions
|
|
337
|
-
*/
|
|
338
|
-
async getRecentDecisions() {
|
|
339
|
-
if (!this.sessionMemory) return [];
|
|
340
|
-
|
|
341
|
-
try {
|
|
342
|
-
const decisions = await this.sessionMemory.getDecisions({ limit: 5 });
|
|
343
|
-
return decisions.map((d) => ({
|
|
344
|
-
decision: d.decision || d.content,
|
|
345
|
-
reason: d.reason,
|
|
346
|
-
timestamp: d.timestamp,
|
|
347
|
-
}));
|
|
348
|
-
} catch (_error) {
|
|
349
|
-
return [];
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
/**
|
|
354
|
-
* Format injection payload for LLM consumption
|
|
355
|
-
* @param {Object} injection - Injection payload
|
|
356
|
-
* @returns {string} - Formatted markdown
|
|
357
|
-
*/
|
|
358
|
-
formatForLLM(injection) {
|
|
359
|
-
let output = '';
|
|
360
|
-
|
|
361
|
-
// Task section (always included)
|
|
362
|
-
output += '## Task Context\n\n';
|
|
363
|
-
output += '### Current Task\n';
|
|
364
|
-
output += `**ID:** ${injection.task.id}\n`;
|
|
365
|
-
output += `**Description:** ${injection.task.description}\n\n`;
|
|
366
|
-
|
|
367
|
-
// Acceptance Criteria
|
|
368
|
-
if (injection.task.acceptanceCriteria && injection.task.acceptanceCriteria.length > 0) {
|
|
369
|
-
output += '### Acceptance Criteria\n';
|
|
370
|
-
const criteria = Array.isArray(injection.task.acceptanceCriteria)
|
|
371
|
-
? injection.task.acceptanceCriteria
|
|
372
|
-
: [injection.task.acceptanceCriteria];
|
|
373
|
-
criteria.forEach((ac, i) => {
|
|
374
|
-
output += `${i + 1}. ${ac}\n`;
|
|
375
|
-
});
|
|
376
|
-
output += '\n';
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
// Relevant Files
|
|
380
|
-
if (injection.files && injection.files.length > 0) {
|
|
381
|
-
output += '### Relevant Files\n';
|
|
382
|
-
injection.files.forEach((f) => {
|
|
383
|
-
const status = f.exists ? '✓' : '?';
|
|
384
|
-
output += `- [${status}] \`${f.path}\`: ${f.purpose}\n`;
|
|
385
|
-
});
|
|
386
|
-
output += '\n';
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
// Project Patterns
|
|
390
|
-
if (injection.project.patterns && injection.project.patterns.length > 0) {
|
|
391
|
-
output += '### Project Patterns\n';
|
|
392
|
-
injection.project.patterns.slice(0, 5).forEach((p) => {
|
|
393
|
-
const name = typeof p === 'string' ? p : p.name;
|
|
394
|
-
output += `- ${name}\n`;
|
|
395
|
-
});
|
|
396
|
-
output += '\n';
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
// Conventions
|
|
400
|
-
if (injection.project.conventions && injection.project.conventions.length > 0) {
|
|
401
|
-
output += '### Conventions\n';
|
|
402
|
-
injection.project.conventions.forEach((c) => {
|
|
403
|
-
output += `- ${c}\n`;
|
|
404
|
-
});
|
|
405
|
-
output += '\n';
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
// Active Gotchas
|
|
409
|
-
if (injection.gotchas && injection.gotchas.length > 0) {
|
|
410
|
-
output += '### Active Gotchas (Avoid These)\n';
|
|
411
|
-
injection.gotchas.slice(0, 5).forEach((g) => {
|
|
412
|
-
const title = g.title || g.pattern || 'Warning';
|
|
413
|
-
const workaround = g.workaround || g.description || 'Be careful';
|
|
414
|
-
output += `⚠️ **${title}**: ${workaround}\n\n`;
|
|
415
|
-
});
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
// Recent Decisions
|
|
419
|
-
if (injection.decisions && injection.decisions.length > 0) {
|
|
420
|
-
output += '### Recent Decisions\n';
|
|
421
|
-
injection.decisions.slice(0, 3).forEach((d) => {
|
|
422
|
-
output += `- ${d.decision}`;
|
|
423
|
-
if (d.reason) output += ` (${d.reason})`;
|
|
424
|
-
output += '\n';
|
|
425
|
-
});
|
|
426
|
-
output += '\n';
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
// Relevant Memory
|
|
430
|
-
if (injection.memory && injection.memory.length > 0) {
|
|
431
|
-
output += '### Relevant Context from Memory\n';
|
|
432
|
-
injection.memory.slice(0, 3).forEach((m) => {
|
|
433
|
-
output += `- [${m.type}] ${m.content}\n`;
|
|
434
|
-
});
|
|
435
|
-
output += '\n';
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
return output;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
/**
|
|
442
|
-
* Trim content to fit token budget
|
|
443
|
-
* @param {string} content - Content to trim
|
|
444
|
-
* @param {number} tokenBudget - Maximum tokens
|
|
445
|
-
* @returns {string} - Trimmed content
|
|
446
|
-
*/
|
|
447
|
-
trimToTokenBudget(content, tokenBudget) {
|
|
448
|
-
const maxChars = tokenBudget * this.charsPerToken;
|
|
449
|
-
|
|
450
|
-
if (content.length <= maxChars) {
|
|
451
|
-
return content;
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
// Try to trim intelligently by sections
|
|
455
|
-
const sections = content.split(/(?=###)/);
|
|
456
|
-
let trimmed = '';
|
|
457
|
-
|
|
458
|
-
// Always include the task section
|
|
459
|
-
if (sections[0]) {
|
|
460
|
-
trimmed = sections[0];
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
// Add other sections until budget is reached
|
|
464
|
-
for (let i = 1; i < sections.length; i++) {
|
|
465
|
-
if (trimmed.length + sections[i].length <= maxChars) {
|
|
466
|
-
trimmed += sections[i];
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
// If still too long, hard truncate
|
|
471
|
-
if (trimmed.length > maxChars) {
|
|
472
|
-
trimmed = trimmed.substring(0, maxChars - 50) + '\n\n[Context truncated for token budget]\n';
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
return trimmed;
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
/**
|
|
479
|
-
* Update metrics
|
|
480
|
-
* @param {string} context - Generated context
|
|
481
|
-
* @param {number} time - Injection time
|
|
482
|
-
*/
|
|
483
|
-
updateMetrics(context, time) {
|
|
484
|
-
this.metrics.injections++;
|
|
485
|
-
this.metrics.avgContextSize =
|
|
486
|
-
(this.metrics.avgContextSize * (this.metrics.injections - 1) + context.length) /
|
|
487
|
-
this.metrics.injections;
|
|
488
|
-
this.metrics.avgInjectionTime =
|
|
489
|
-
(this.metrics.avgInjectionTime * (this.metrics.injections - 1) + time) /
|
|
490
|
-
this.metrics.injections;
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
/**
|
|
494
|
-
* Get metrics
|
|
495
|
-
* @returns {Object} - Current metrics
|
|
496
|
-
*/
|
|
497
|
-
getMetrics() {
|
|
498
|
-
return {
|
|
499
|
-
...this.metrics,
|
|
500
|
-
avgContextSize: Math.round(this.metrics.avgContextSize),
|
|
501
|
-
avgInjectionTime: Math.round(this.metrics.avgInjectionTime),
|
|
502
|
-
cacheSize: this.cache.size,
|
|
503
|
-
};
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
/**
|
|
507
|
-
* Clear cache
|
|
508
|
-
*/
|
|
509
|
-
clearCache() {
|
|
510
|
-
this.cache.clear();
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
/**
|
|
514
|
-
* Format status for CLI
|
|
515
|
-
* @returns {string} - Formatted status
|
|
516
|
-
*/
|
|
517
|
-
formatStatus() {
|
|
518
|
-
const metrics = this.getMetrics();
|
|
519
|
-
|
|
520
|
-
let output = '💉 Context Injector Status\n';
|
|
521
|
-
output += '━'.repeat(40) + '\n\n';
|
|
522
|
-
|
|
523
|
-
output += '**Metrics:**\n';
|
|
524
|
-
output += ` Total Injections: ${metrics.injections}\n`;
|
|
525
|
-
output += ` Cache Hits: ${metrics.cacheHits}\n`;
|
|
526
|
-
output += ` Cache Size: ${metrics.cacheSize}\n`;
|
|
527
|
-
output += ` Avg Context Size: ${metrics.avgContextSize} chars\n`;
|
|
528
|
-
output += ` Avg Injection Time: ${metrics.avgInjectionTime}ms\n`;
|
|
529
|
-
output += ` Token Budget: ${this.tokenBudget}\n`;
|
|
530
|
-
|
|
531
|
-
return output;
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
module.exports = ContextInjector;
|
|
536
|
-
module.exports.ContextInjector = ContextInjector;
|
|
537
|
-
|