tribunal-kit 9.2.6 → 9.2.8
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/.agent/ARCHITECTURE.md +4 -4
- package/.agent/data/skill_certification_ledger.jsonl +40 -0
- package/.agent/data/skill_ontology.json +138 -0
- package/.agent/history/architecture-intelligence.html +1487 -401
- package/.agent/history/architecture-model.json +16130 -5802
- package/.agent/history/architecture-verification.json +6 -6
- package/.agent/routing_index.json +656 -1566
- package/.agent/rules/GEMINI.md +1 -1
- package/.agent/scripts/adaptive_execution.js +704 -0
- package/.agent/scripts/architecture_diff.js +60 -17
- package/.agent/scripts/architecture_extractor.js +60 -21
- package/.agent/scripts/architecture_health.js +58 -21
- package/.agent/scripts/architecture_intelligence.js +3100 -0
- package/.agent/scripts/architecture_verifier.js +46 -13
- package/.agent/scripts/architecture_visualizer.js +1536 -421
- package/.agent/scripts/blast_radius_engine.js +64 -24
- package/.agent/scripts/capability_evolution.js +555 -0
- package/.agent/scripts/concept_extractor.js +240 -0
- package/.agent/scripts/consideration_engine.js +284 -0
- package/.agent/scripts/context_broker.js +397 -31
- package/.agent/scripts/corpus_certification_orchestrator.js +502 -0
- package/.agent/scripts/corpus_validation_engine.js +311 -0
- package/.agent/scripts/coverage_engine.js +102 -0
- package/.agent/scripts/cross_domain_engine.js +1883 -0
- package/.agent/scripts/engineering_memory.js +1442 -0
- package/.agent/scripts/final_corpus_validation_engine.js +405 -0
- package/.agent/scripts/integrity_manifest.js +1 -5
- package/.agent/scripts/intent_extractor.js +130 -0
- package/.agent/scripts/judgment_engine.js +790 -0
- package/.agent/scripts/materiality_engine.js +251 -0
- package/.agent/scripts/outcome_engine.js +639 -0
- package/.agent/scripts/outcome_optimization_engine.js +1632 -0
- package/.agent/scripts/routing_evaluation_engine.js +184 -0
- package/.agent/scripts/simulation_engine.js +1478 -0
- package/.agent/scripts/skill_behavior_classifier.js +90 -0
- package/.agent/scripts/skill_behavior_harness.js +105 -0
- package/.agent/scripts/skill_certification_engine.js +586 -0
- package/.agent/scripts/skill_contract_engine.js +424 -0
- package/.agent/scripts/skill_coverage_expansion_engine.js +505 -0
- package/.agent/scripts/skill_evidence_acquisition_engine.js +535 -0
- package/.agent/scripts/skill_evidence_engine.js +83 -0
- package/.agent/scripts/skill_expectation_engine.js +38 -0
- package/.agent/scripts/skill_fixture_engine.js +24 -0
- package/.agent/scripts/skill_human_validation.js +32 -0
- package/.agent/scripts/skill_intelligence.js +1300 -0
- package/.agent/scripts/skill_observation_engine.js +25 -0
- package/.agent/scripts/skill_ontology_engine.js +83 -0
- package/.agent/scripts/skill_quality_engine.js +343 -0
- package/.agent/scripts/skill_reconstruction_engine.js +164 -0
- package/.agent/scripts/skill_remediation_engine.js +326 -0
- package/.agent/scripts/skill_scenario_engine.js +108 -0
- package/.agent/scripts/skill_test_authoring_engine.js +1011 -0
- package/.agent/scripts/verification_auditor.js +346 -0
- package/.agent/skill-intelligence/taxonomy/engineering-concepts.json +555 -0
- package/.agent/skill_topic_map.json +15 -55
- package/.agent/skills/12-principles-of-animation/SKILL.md +9 -0
- package/.agent/skills/60fps-animation/SKILL.md +14 -0
- package/.agent/skills/accessible-animation/SKILL.md +9 -0
- package/.agent/skills/adapt/SKILL.md +8 -0
- package/.agent/skills/adr-generation/SKILL.md +9 -0
- package/.agent/skills/advanced-rag-pipelines/SKILL.md +9 -0
- package/.agent/skills/agent-organizer/SKILL.md +8 -0
- package/.agent/skills/agent-syscall-guidelines/SKILL.md +10 -0
- package/.agent/skills/agentic-patterns/SKILL.md +9 -0
- package/.agent/skills/agentic-workflows-2026/SKILL.md +8 -0
- package/.agent/skills/agentshield-security/SKILL.md +16 -0
- package/.agent/skills/ai-app-hardening/SKILL.md +7 -0
- package/.agent/skills/ai-prompt-injection-defense/SKILL.md +9 -0
- package/.agent/skills/animation-on-scroll/SKILL.md +9 -0
- package/.agent/skills/animation-systems/SKILL.md +8 -0
- package/.agent/skills/antfu-conventions/SKILL.md +9 -0
- package/.agent/skills/anti-slop-enforcement/SKILL.md +11 -0
- package/.agent/skills/api-patterns/SKILL.md +9 -0
- package/.agent/skills/api-security-auditor/SKILL.md +10 -0
- package/.agent/skills/app-builder/SKILL.md +8 -0
- package/.agent/skills/appflow-wireframe/SKILL.md +9 -0
- package/.agent/skills/apple-design/SKILL.md +8 -0
- package/.agent/skills/architecture/SKILL.md +8 -0
- package/.agent/skills/architecture-drift/SKILL.md +9 -0
- package/.agent/skills/architecture-intelligence/SKILL.md +17 -0
- package/.agent/skills/audit-and-fix/SKILL.md +8 -0
- package/.agent/skills/authentication-best-practices/SKILL.md +10 -0
- package/.agent/skills/autonomous-execution/SKILL.md +9 -0
- package/.agent/skills/backend-alembic/SKILL.md +16 -0
- package/.agent/skills/backend-architecture-auditor/SKILL.md +16 -0
- package/.agent/skills/backend-mongodb/SKILL.md +10 -0
- package/.agent/skills/backend-mysql/SKILL.md +16 -0
- package/.agent/skills/backend-performance-auditor/SKILL.md +10 -0
- package/.agent/skills/backend-postgresql/SKILL.md +10 -0
- package/.agent/skills/backend-redis/SKILL.md +10 -0
- package/.agent/skills/backend-security-expert/SKILL.md +10 -0
- package/.agent/skills/backend-sqlalchemy/SKILL.md +10 -0
- package/.agent/skills/backend-sqlite/SKILL.md +10 -0
- package/.agent/skills/backend-testing-auditor/SKILL.md +15 -0
- package/.agent/skills/baseline-ui/SKILL.md +8 -0
- package/.agent/skills/bash-linux/SKILL.md +9 -0
- package/.agent/skills/behavioral-modes/SKILL.md +9 -0
- package/.agent/skills/better-colors/SKILL.md +9 -0
- package/.agent/skills/better-typography/SKILL.md +9 -0
- package/.agent/skills/better-ui/SKILL.md +8 -0
- package/.agent/skills/bolder/SKILL.md +8 -0
- package/.agent/skills/brainstorming/SKILL.md +8 -0
- package/.agent/skills/browser-audit/SKILL.md +9 -0
- package/.agent/skills/browser-native-ai/SKILL.md +8 -0
- package/.agent/skills/build-primitive/SKILL.md +8 -0
- package/.agent/skills/building-native-ui/SKILL.md +7 -0
- package/.agent/skills/cicd-pro/SKILL.md +9 -0
- package/.agent/skills/clarify/SKILL.md +8 -0
- package/.agent/skills/clean-code/SKILL.md +8 -0
- package/.agent/skills/cloud-architect/SKILL.md +8 -0
- package/.agent/skills/cobejs/SKILL.md +8 -0
- package/.agent/skills/code-review-checklist/SKILL.md +9 -0
- package/.agent/skills/codebase-design/SKILL.md +14 -0
- package/.agent/skills/colorize/SKILL.md +8 -0
- package/.agent/skills/compact-landing/SKILL.md +9 -0
- package/.agent/skills/company-logos/SKILL.md +9 -0
- package/.agent/skills/config-validator/SKILL.md +9 -0
- package/.agent/skills/containerization-pro/SKILL.md +9 -0
- package/.agent/skills/context-engineering-pro/SKILL.md +10 -0
- package/.agent/skills/create-design-md/SKILL.md +7 -0
- package/.agent/skills/critique/SKILL.md +8 -0
- package/.agent/skills/csharp-developer/SKILL.md +9 -0
- package/.agent/skills/data-validation-schemas/SKILL.md +8 -0
- package/.agent/skills/database-design/SKILL.md +8 -0
- package/.agent/skills/delight/SKILL.md +8 -0
- package/.agent/skills/deployment-procedures/SKILL.md +9 -0
- package/.agent/skills/design-lab/SKILL.md +8 -0
- package/.agent/skills/devops-engineer/SKILL.md +9 -0
- package/.agent/skills/devops-incident-responder/SKILL.md +16 -0
- package/.agent/skills/diagnosing-bugs/SKILL.md +9 -0
- package/.agent/skills/distill/SKILL.md +8 -0
- package/.agent/skills/documentation-templates/SKILL.md +9 -0
- package/.agent/skills/domain-modeling/SKILL.md +9 -0
- package/.agent/skills/duckdb-analytical-sql/SKILL.md +10 -0
- package/.agent/skills/edge-ai-mobile/SKILL.md +8 -0
- package/.agent/skills/edge-computing/SKILL.md +9 -0
- package/.agent/skills/emil-design-eng/SKILL.md +9 -0
- package/.agent/skills/error-resilience/SKILL.md +8 -0
- package/.agent/skills/expo-router-v4/SKILL.md +9 -0
- package/.agent/skills/extract-design-system/SKILL.md +9 -0
- package/.agent/skills/fabel-protocol/SKILL.md +9 -0
- package/.agent/skills/failure-mode-analysis/SKILL.md +10 -0
- package/.agent/skills/fastapi-pro/SKILL.md +9 -0
- package/.agent/skills/fixing-accessibility/SKILL.md +9 -0
- package/.agent/skills/fixing-metadata/SKILL.md +9 -0
- package/.agent/skills/fixing-motion-performance/SKILL.md +9 -0
- package/.agent/skills/framer-motion-expert/SKILL.md +9 -0
- package/.agent/skills/frontend-design/SKILL.md +7 -0
- package/.agent/skills/frontend-security-expert/SKILL.md +9 -0
- package/.agent/skills/game-design-expert/SKILL.md +9 -0
- package/.agent/skills/game-engineering-expert/SKILL.md +16 -0
- package/.agent/skills/generative-ui-expert/SKILL.md +9 -0
- package/.agent/skills/geo-fundamentals/SKILL.md +9 -0
- package/.agent/skills/git-pro/SKILL.md +9 -0
- package/.agent/skills/github-operations/SKILL.md +9 -0
- package/.agent/skills/gpt-taste/SKILL.md +9 -0
- package/.agent/skills/graph-engineering/SKILL.md +16 -0
- package/.agent/skills/gsap-core/SKILL.md +9 -0
- package/.agent/skills/gsap-frameworks/SKILL.md +9 -0
- package/.agent/skills/gsap-performance/SKILL.md +9 -0
- package/.agent/skills/gsap-plugins/SKILL.md +9 -0
- package/.agent/skills/gsap-react/SKILL.md +9 -0
- package/.agent/skills/gsap-scrolltrigger/SKILL.md +9 -0
- package/.agent/skills/gsap-timeline/SKILL.md +9 -0
- package/.agent/skills/gsap-utils/SKILL.md +9 -0
- package/.agent/skills/harden/SKILL.md +8 -0
- package/.agent/skills/harness-protocol/SKILL.md +9 -0
- package/.agent/skills/hf-cli/SKILL.md +11 -0
- package/.agent/skills/hf-cloud-aws-context-discovery/SKILL.md +10 -0
- package/.agent/skills/hf-cloud-python-env-setup/SKILL.md +10 -0
- package/.agent/skills/hf-cloud-sagemaker-deployment-planner/SKILL.md +10 -0
- package/.agent/skills/hf-cloud-sagemaker-iam-preflight/SKILL.md +10 -0
- package/.agent/skills/hf-cloud-sagemaker-production-defaults/SKILL.md +10 -0
- package/.agent/skills/hf-cloud-serving-image-selection/SKILL.md +10 -0
- package/.agent/skills/hf-mem/SKILL.md +11 -0
- package/.agent/skills/huggingface-best/SKILL.md +9 -0
- package/.agent/skills/huggingface-community-evals/SKILL.md +11 -0
- package/.agent/skills/huggingface-datasets/SKILL.md +10 -0
- package/.agent/skills/huggingface-gradio/SKILL.md +10 -0
- package/.agent/skills/huggingface-llm-trainer/SKILL.md +10 -0
- package/.agent/skills/huggingface-local-models/SKILL.md +10 -0
- package/.agent/skills/huggingface-lora-space-builder/SKILL.md +11 -0
- package/.agent/skills/huggingface-paper-publisher/SKILL.md +11 -0
- package/.agent/skills/huggingface-papers/SKILL.md +11 -0
- package/.agent/skills/huggingface-spaces/SKILL.md +10 -0
- package/.agent/skills/huggingface-tool-builder/SKILL.md +11 -0
- package/.agent/skills/huggingface-trackio/SKILL.md +11 -0
- package/.agent/skills/huggingface-vision-trainer/SKILL.md +11 -0
- package/.agent/skills/huggingface-zerogpu/SKILL.md +11 -0
- package/.agent/skills/human-gate-negotiation/SKILL.md +11 -0
- package/.agent/skills/i18n-localization/SKILL.md +9 -0
- package/.agent/skills/impeccable/SKILL.md +8 -0
- package/.agent/skills/improve-codebase-architecture/SKILL.md +10 -0
- package/.agent/skills/improve-ui/SKILL.md +8 -0
- package/.agent/skills/intelligent-routing/SKILL.md +9 -0
- package/.agent/skills/knowledge-graph/SKILL.md +9 -0
- package/.agent/skills/landing-page/SKILL.md +9 -0
- package/.agent/skills/lint-and-validate/SKILL.md +9 -0
- package/.agent/skills/llm-engineering/SKILL.md +9 -0
- package/.agent/skills/local-first/SKILL.md +10 -0
- package/.agent/skills/lottie-animation/SKILL.md +9 -0
- package/.agent/skills/marquee-loop/SKILL.md +9 -0
- package/.agent/skills/masked-reveal/SKILL.md +9 -0
- package/.agent/skills/mcp-builder/SKILL.md +9 -0
- package/.agent/skills/micro-interaction/SKILL.md +9 -0
- package/.agent/skills/mobile-design/SKILL.md +7 -0
- package/.agent/skills/monorepo-management/SKILL.md +9 -0
- package/.agent/skills/morphing-icons/SKILL.md +9 -0
- package/.agent/skills/motion-engineering/SKILL.md +8 -0
- package/.agent/skills/nextjs-react-expert/SKILL.md +10 -0
- package/.agent/skills/nodejs-best-practices/SKILL.md +16 -0
- package/.agent/skills/observability/SKILL.md +8 -0
- package/.agent/skills/opentelemetry-observability/SKILL.md +9 -0
- package/.agent/skills/page-transition-animation/SKILL.md +10 -0
- package/.agent/skills/parallel-agents/SKILL.md +15 -0
- package/.agent/skills/performance-profiling/SKILL.md +9 -0
- package/.agent/skills/plan-writing/SKILL.md +8 -0
- package/.agent/skills/platform-engineer/SKILL.md +9 -0
- package/.agent/skills/platform-engineering-opentofu/SKILL.md +10 -0
- package/.agent/skills/playwright-ai-e2e/SKILL.md +9 -0
- package/.agent/skills/playwright-best-practices/SKILL.md +16 -0
- package/.agent/skills/polish/SKILL.md +8 -0
- package/.agent/skills/powershell-windows/SKILL.md +9 -0
- package/.agent/skills/pricing-page/SKILL.md +9 -0
- package/.agent/skills/product-aware-heuristics/SKILL.md +10 -0
- package/.agent/skills/progressive-blur/SKILL.md +9 -0
- package/.agent/skills/project-idioms/SKILL.md +8 -0
- package/.agent/skills/property-based-testing/SKILL.md +9 -0
- package/.agent/skills/python-patterns/SKILL.md +9 -0
- package/.agent/skills/python-pro/SKILL.md +9 -0
- package/.agent/skills/quieter/SKILL.md +8 -0
- package/.agent/skills/react-doctor/SKILL.md +9 -0
- package/.agent/skills/react-specialist/SKILL.md +9 -0
- package/.agent/skills/readme-builder/SKILL.md +9 -0
- package/.agent/skills/realtime-patterns/SKILL.md +9 -0
- package/.agent/skills/red-team-tactics/SKILL.md +16 -0
- package/.agent/skills/redesign-skill/SKILL.md +9 -0
- package/.agent/skills/review-animations/SKILL.md +8 -0
- package/.agent/skills/rust-pro/SKILL.md +9 -0
- package/.agent/skills/semantic-filesystem-navigation/SKILL.md +11 -0
- package/.agent/skills/seo-fundamentals/SKILL.md +9 -0
- package/.agent/skills/server-management/SKILL.md +8 -0
- package/.agent/skills/session-log-interrogation/SKILL.md +11 -0
- package/.agent/skills/shadcn-ui-expert/SKILL.md +9 -0
- package/.agent/skills/shape/SKILL.md +8 -0
- package/.agent/skills/skill-creator/SKILL.md +9 -0
- package/.agent/skills/soft-skill/SKILL.md +9 -0
- package/.agent/skills/sounds-on-the-web/SKILL.md +9 -0
- package/.agent/skills/sql-pro/SKILL.md +9 -0
- package/.agent/skills/subagent-driven-development/SKILL.md +11 -0
- package/.agent/skills/supabase-postgres-best-practices/SKILL.md +17 -0
- package/.agent/skills/svg-animation/SKILL.md +9 -0
- package/.agent/skills/swiftui-expert/SKILL.md +9 -0
- package/.agent/skills/swiss-design/SKILL.md +8 -0
- package/.agent/skills/system-design-pro/SKILL.md +9 -0
- package/.agent/skills/systematic-debugging/SKILL.md +14 -0
- package/.agent/skills/tailwind-patterns/SKILL.md +9 -0
- package/.agent/skills/taste-skill/SKILL.md +9 -0
- package/.agent/skills/tdd-workflow/SKILL.md +9 -0
- package/.agent/skills/test-result-analyzer/SKILL.md +9 -0
- package/.agent/skills/testing-patterns/SKILL.md +8 -0
- package/.agent/skills/thermo-nuclear-code-quality-review/SKILL.md +11 -0
- package/.agent/skills/thinking-protocol/SKILL.md +10 -0
- package/.agent/skills/to-spring-or-not-to-spring/SKILL.md +9 -0
- package/.agent/skills/train-sentence-transformers/SKILL.md +10 -0
- package/.agent/skills/transformers-js/SKILL.md +8 -0
- package/.agent/skills/transitions-dev/SKILL.md +8 -0
- package/.agent/skills/trend-researcher/SKILL.md +9 -0
- package/.agent/skills/tribunal-instincts-memory/SKILL.md +11 -0
- package/.agent/skills/trl-training/SKILL.md +9 -0
- package/.agent/skills/typescript-advanced/SKILL.md +9 -0
- package/.agent/skills/typeset/SKILL.md +8 -0
- package/.agent/skills/ui-reasoning-engine/SKILL.md +9 -0
- package/.agent/skills/ui-skill-packs/SKILL.md +9 -0
- package/.agent/skills/ui-skills-root/SKILL.md +9 -0
- package/.agent/skills/ui-ux-pro-max/SKILL.md +9 -0
- package/.agent/skills/ui-ux-researcher/SKILL.md +8 -0
- package/.agent/skills/vector-search-pgvector/SKILL.md +10 -0
- package/.agent/skills/verification-before-completion/SKILL.md +9 -0
- package/.agent/skills/vue-expert/SKILL.md +9 -0
- package/.agent/skills/vulnerability-scanner/SKILL.md +9 -0
- package/.agent/skills/web-accessibility-auditor/SKILL.md +16 -0
- package/.agent/skills/web-design-guidelines/SKILL.md +9 -0
- package/.agent/skills/web-quality-audit/SKILL.md +10 -0
- package/.agent/skills/webapp-testing/SKILL.md +8 -0
- package/.agent/skills/webgpu-performance/SKILL.md +9 -0
- package/.agent/skills/whimsy-injector/SKILL.md +9 -0
- package/.agent/skills/workflow-optimizer/SKILL.md +9 -0
- package/.agent/skills/zero-trust-passkeys/SKILL.md +10 -0
- package/.agent/skills_inventory.json +502 -3167
- package/.agent/workflows/arch.md +96 -80
- package/.agent/workflows/skill-intelligence.md +216 -0
- package/.agents/skills/12-principles-of-animation/SKILL.md +9 -0
- package/.agents/skills/60fps-animation/SKILL.md +14 -0
- package/.agents/skills/accessible-animation/SKILL.md +9 -0
- package/.agents/skills/adapt/SKILL.md +8 -0
- package/.agents/skills/adr-generation/SKILL.md +9 -0
- package/.agents/skills/advanced-rag-pipelines/SKILL.md +9 -0
- package/.agents/skills/agent-organizer/SKILL.md +8 -0
- package/.agents/skills/agent-syscall-guidelines/SKILL.md +10 -0
- package/.agents/skills/agentic-patterns/SKILL.md +9 -0
- package/.agents/skills/agentic-workflows-2026/SKILL.md +8 -0
- package/.agents/skills/agentshield-security/SKILL.md +16 -0
- package/.agents/skills/ai-app-hardening/SKILL.md +7 -0
- package/.agents/skills/ai-prompt-injection-defense/SKILL.md +9 -0
- package/.agents/skills/animation-on-scroll/SKILL.md +9 -0
- package/.agents/skills/animation-systems/SKILL.md +8 -0
- package/.agents/skills/antfu-conventions/SKILL.md +9 -0
- package/.agents/skills/anti-slop-enforcement/SKILL.md +11 -0
- package/.agents/skills/api-patterns/SKILL.md +9 -0
- package/.agents/skills/api-security-auditor/SKILL.md +10 -0
- package/.agents/skills/app-builder/SKILL.md +8 -0
- package/.agents/skills/appflow-wireframe/SKILL.md +9 -0
- package/.agents/skills/apple-design/SKILL.md +8 -0
- package/.agents/skills/architecture/SKILL.md +8 -0
- package/.agents/skills/architecture-drift/SKILL.md +9 -0
- package/.agents/skills/architecture-intelligence/SKILL.md +17 -0
- package/.agents/skills/audit-and-fix/SKILL.md +8 -0
- package/.agents/skills/authentication-best-practices/SKILL.md +10 -0
- package/.agents/skills/autonomous-execution/SKILL.md +9 -0
- package/.agents/skills/backend-alembic/SKILL.md +16 -0
- package/.agents/skills/backend-architecture-auditor/SKILL.md +16 -0
- package/.agents/skills/backend-mongodb/SKILL.md +10 -0
- package/.agents/skills/backend-mysql/SKILL.md +16 -0
- package/.agents/skills/backend-performance-auditor/SKILL.md +10 -0
- package/.agents/skills/backend-postgresql/SKILL.md +10 -0
- package/.agents/skills/backend-redis/SKILL.md +10 -0
- package/.agents/skills/backend-security-expert/SKILL.md +10 -0
- package/.agents/skills/backend-sqlalchemy/SKILL.md +10 -0
- package/.agents/skills/backend-sqlite/SKILL.md +10 -0
- package/.agents/skills/backend-testing-auditor/SKILL.md +15 -0
- package/.agents/skills/baseline-ui/SKILL.md +8 -0
- package/.agents/skills/bash-linux/SKILL.md +9 -0
- package/.agents/skills/behavioral-modes/SKILL.md +9 -0
- package/.agents/skills/better-colors/SKILL.md +9 -0
- package/.agents/skills/better-typography/SKILL.md +9 -0
- package/.agents/skills/better-ui/SKILL.md +8 -0
- package/.agents/skills/bolder/SKILL.md +8 -0
- package/.agents/skills/brainstorming/SKILL.md +8 -0
- package/.agents/skills/browser-audit/SKILL.md +9 -0
- package/.agents/skills/browser-native-ai/SKILL.md +8 -0
- package/.agents/skills/build-primitive/SKILL.md +8 -0
- package/.agents/skills/building-native-ui/SKILL.md +7 -0
- package/.agents/skills/cicd-pro/SKILL.md +9 -0
- package/.agents/skills/clarify/SKILL.md +8 -0
- package/.agents/skills/clean-code/SKILL.md +8 -0
- package/.agents/skills/cloud-architect/SKILL.md +8 -0
- package/.agents/skills/cobejs/SKILL.md +8 -0
- package/.agents/skills/code-review-checklist/SKILL.md +9 -0
- package/.agents/skills/codebase-design/SKILL.md +14 -0
- package/.agents/skills/colorize/SKILL.md +8 -0
- package/.agents/skills/compact-landing/SKILL.md +9 -0
- package/.agents/skills/company-logos/SKILL.md +9 -0
- package/.agents/skills/config-validator/SKILL.md +9 -0
- package/.agents/skills/containerization-pro/SKILL.md +9 -0
- package/.agents/skills/context-engineering-pro/SKILL.md +10 -0
- package/.agents/skills/create-design-md/SKILL.md +7 -0
- package/.agents/skills/critique/SKILL.md +8 -0
- package/.agents/skills/csharp-developer/SKILL.md +9 -0
- package/.agents/skills/data-validation-schemas/SKILL.md +8 -0
- package/.agents/skills/database-design/SKILL.md +8 -0
- package/.agents/skills/delight/SKILL.md +8 -0
- package/.agents/skills/deployment-procedures/SKILL.md +9 -0
- package/.agents/skills/design-lab/SKILL.md +8 -0
- package/.agents/skills/devops-engineer/SKILL.md +9 -0
- package/.agents/skills/devops-incident-responder/SKILL.md +16 -0
- package/.agents/skills/diagnosing-bugs/SKILL.md +9 -0
- package/.agents/skills/distill/SKILL.md +8 -0
- package/.agents/skills/documentation-templates/SKILL.md +9 -0
- package/.agents/skills/domain-modeling/SKILL.md +9 -0
- package/.agents/skills/duckdb-analytical-sql/SKILL.md +10 -0
- package/.agents/skills/edge-ai-mobile/SKILL.md +8 -0
- package/.agents/skills/edge-computing/SKILL.md +9 -0
- package/.agents/skills/emil-design-eng/SKILL.md +9 -0
- package/.agents/skills/error-resilience/SKILL.md +8 -0
- package/.agents/skills/expo-router-v4/SKILL.md +9 -0
- package/.agents/skills/extract-design-system/SKILL.md +9 -0
- package/.agents/skills/fabel-protocol/SKILL.md +9 -0
- package/.agents/skills/failure-mode-analysis/SKILL.md +10 -0
- package/.agents/skills/fastapi-pro/SKILL.md +9 -0
- package/.agents/skills/fixing-accessibility/SKILL.md +9 -0
- package/.agents/skills/fixing-metadata/SKILL.md +9 -0
- package/.agents/skills/fixing-motion-performance/SKILL.md +9 -0
- package/.agents/skills/framer-motion-expert/SKILL.md +9 -0
- package/.agents/skills/frontend-design/SKILL.md +7 -0
- package/.agents/skills/frontend-security-expert/SKILL.md +9 -0
- package/.agents/skills/game-design-expert/SKILL.md +9 -0
- package/.agents/skills/game-engineering-expert/SKILL.md +16 -0
- package/.agents/skills/generative-ui-expert/SKILL.md +9 -0
- package/.agents/skills/geo-fundamentals/SKILL.md +9 -0
- package/.agents/skills/git-pro/SKILL.md +9 -0
- package/.agents/skills/github-operations/SKILL.md +9 -0
- package/.agents/skills/gpt-taste/SKILL.md +9 -0
- package/.agents/skills/graph-engineering/SKILL.md +16 -0
- package/.agents/skills/gsap-core/SKILL.md +9 -0
- package/.agents/skills/gsap-frameworks/SKILL.md +9 -0
- package/.agents/skills/gsap-performance/SKILL.md +9 -0
- package/.agents/skills/gsap-plugins/SKILL.md +9 -0
- package/.agents/skills/gsap-react/SKILL.md +9 -0
- package/.agents/skills/gsap-scrolltrigger/SKILL.md +9 -0
- package/.agents/skills/gsap-timeline/SKILL.md +9 -0
- package/.agents/skills/gsap-utils/SKILL.md +9 -0
- package/.agents/skills/harden/SKILL.md +8 -0
- package/.agents/skills/harness-protocol/SKILL.md +9 -0
- package/.agents/skills/hf-cli/SKILL.md +11 -0
- package/.agents/skills/hf-cloud-aws-context-discovery/SKILL.md +10 -0
- package/.agents/skills/hf-cloud-python-env-setup/SKILL.md +10 -0
- package/.agents/skills/hf-cloud-sagemaker-deployment-planner/SKILL.md +10 -0
- package/.agents/skills/hf-cloud-sagemaker-iam-preflight/SKILL.md +10 -0
- package/.agents/skills/hf-cloud-sagemaker-production-defaults/SKILL.md +10 -0
- package/.agents/skills/hf-cloud-serving-image-selection/SKILL.md +10 -0
- package/.agents/skills/hf-mem/SKILL.md +11 -0
- package/.agents/skills/huggingface-best/SKILL.md +9 -0
- package/.agents/skills/huggingface-community-evals/SKILL.md +11 -0
- package/.agents/skills/huggingface-datasets/SKILL.md +10 -0
- package/.agents/skills/huggingface-gradio/SKILL.md +10 -0
- package/.agents/skills/huggingface-llm-trainer/SKILL.md +10 -0
- package/.agents/skills/huggingface-local-models/SKILL.md +10 -0
- package/.agents/skills/huggingface-lora-space-builder/SKILL.md +11 -0
- package/.agents/skills/huggingface-paper-publisher/SKILL.md +11 -0
- package/.agents/skills/huggingface-papers/SKILL.md +11 -0
- package/.agents/skills/huggingface-spaces/SKILL.md +10 -0
- package/.agents/skills/huggingface-tool-builder/SKILL.md +11 -0
- package/.agents/skills/huggingface-trackio/SKILL.md +11 -0
- package/.agents/skills/huggingface-vision-trainer/SKILL.md +11 -0
- package/.agents/skills/huggingface-zerogpu/SKILL.md +11 -0
- package/.agents/skills/human-gate-negotiation/SKILL.md +11 -0
- package/.agents/skills/i18n-localization/SKILL.md +9 -0
- package/.agents/skills/impeccable/SKILL.md +8 -0
- package/.agents/skills/improve-codebase-architecture/SKILL.md +10 -0
- package/.agents/skills/improve-ui/SKILL.md +8 -0
- package/.agents/skills/intelligent-routing/SKILL.md +9 -0
- package/.agents/skills/knowledge-graph/SKILL.md +9 -0
- package/.agents/skills/landing-page/SKILL.md +9 -0
- package/.agents/skills/lint-and-validate/SKILL.md +9 -0
- package/.agents/skills/llm-engineering/SKILL.md +9 -0
- package/.agents/skills/local-first/SKILL.md +10 -0
- package/.agents/skills/lottie-animation/SKILL.md +9 -0
- package/.agents/skills/marquee-loop/SKILL.md +9 -0
- package/.agents/skills/masked-reveal/SKILL.md +9 -0
- package/.agents/skills/mcp-builder/SKILL.md +9 -0
- package/.agents/skills/micro-interaction/SKILL.md +9 -0
- package/.agents/skills/mobile-design/SKILL.md +7 -0
- package/.agents/skills/monorepo-management/SKILL.md +9 -0
- package/.agents/skills/morphing-icons/SKILL.md +9 -0
- package/.agents/skills/motion-engineering/SKILL.md +8 -0
- package/.agents/skills/nextjs-react-expert/SKILL.md +10 -0
- package/.agents/skills/nodejs-best-practices/SKILL.md +16 -0
- package/.agents/skills/observability/SKILL.md +8 -0
- package/.agents/skills/opentelemetry-observability/SKILL.md +9 -0
- package/.agents/skills/page-transition-animation/SKILL.md +10 -0
- package/.agents/skills/parallel-agents/SKILL.md +15 -0
- package/.agents/skills/performance-profiling/SKILL.md +9 -0
- package/.agents/skills/plan-writing/SKILL.md +8 -0
- package/.agents/skills/platform-engineer/SKILL.md +9 -0
- package/.agents/skills/platform-engineering-opentofu/SKILL.md +10 -0
- package/.agents/skills/playwright-ai-e2e/SKILL.md +9 -0
- package/.agents/skills/playwright-best-practices/SKILL.md +16 -0
- package/.agents/skills/polish/SKILL.md +8 -0
- package/.agents/skills/powershell-windows/SKILL.md +9 -0
- package/.agents/skills/pricing-page/SKILL.md +9 -0
- package/.agents/skills/product-aware-heuristics/SKILL.md +10 -0
- package/.agents/skills/progressive-blur/SKILL.md +9 -0
- package/.agents/skills/project-idioms/SKILL.md +8 -0
- package/.agents/skills/property-based-testing/SKILL.md +9 -0
- package/.agents/skills/python-patterns/SKILL.md +9 -0
- package/.agents/skills/python-pro/SKILL.md +9 -0
- package/.agents/skills/quieter/SKILL.md +8 -0
- package/.agents/skills/react-doctor/SKILL.md +9 -0
- package/.agents/skills/react-specialist/SKILL.md +9 -0
- package/.agents/skills/readme-builder/SKILL.md +9 -0
- package/.agents/skills/realtime-patterns/SKILL.md +9 -0
- package/.agents/skills/red-team-tactics/SKILL.md +16 -0
- package/.agents/skills/redesign-skill/SKILL.md +9 -0
- package/.agents/skills/review-animations/SKILL.md +8 -0
- package/.agents/skills/rust-pro/SKILL.md +9 -0
- package/.agents/skills/semantic-filesystem-navigation/SKILL.md +11 -0
- package/.agents/skills/seo-fundamentals/SKILL.md +9 -0
- package/.agents/skills/server-management/SKILL.md +8 -0
- package/.agents/skills/session-log-interrogation/SKILL.md +11 -0
- package/.agents/skills/shadcn-ui-expert/SKILL.md +9 -0
- package/.agents/skills/shape/SKILL.md +8 -0
- package/.agents/skills/skill-creator/SKILL.md +9 -0
- package/.agents/skills/soft-skill/SKILL.md +9 -0
- package/.agents/skills/sounds-on-the-web/SKILL.md +9 -0
- package/.agents/skills/sql-pro/SKILL.md +9 -0
- package/.agents/skills/subagent-driven-development/SKILL.md +11 -0
- package/.agents/skills/supabase-postgres-best-practices/SKILL.md +17 -0
- package/.agents/skills/svg-animation/SKILL.md +9 -0
- package/.agents/skills/swiftui-expert/SKILL.md +9 -0
- package/.agents/skills/swiss-design/SKILL.md +8 -0
- package/.agents/skills/system-design-pro/SKILL.md +9 -0
- package/.agents/skills/systematic-debugging/SKILL.md +14 -0
- package/.agents/skills/tailwind-patterns/SKILL.md +9 -0
- package/.agents/skills/taste-skill/SKILL.md +9 -0
- package/.agents/skills/tdd-workflow/SKILL.md +9 -0
- package/.agents/skills/test-result-analyzer/SKILL.md +9 -0
- package/.agents/skills/testing-patterns/SKILL.md +8 -0
- package/.agents/skills/thermo-nuclear-code-quality-review/SKILL.md +11 -0
- package/.agents/skills/thinking-protocol/SKILL.md +10 -0
- package/.agents/skills/to-spring-or-not-to-spring/SKILL.md +9 -0
- package/.agents/skills/train-sentence-transformers/SKILL.md +10 -0
- package/.agents/skills/transformers-js/SKILL.md +8 -0
- package/.agents/skills/transitions-dev/SKILL.md +8 -0
- package/.agents/skills/trend-researcher/SKILL.md +9 -0
- package/.agents/skills/tribunal-instincts-memory/SKILL.md +11 -0
- package/.agents/skills/trl-training/SKILL.md +9 -0
- package/.agents/skills/typescript-advanced/SKILL.md +9 -0
- package/.agents/skills/typeset/SKILL.md +8 -0
- package/.agents/skills/ui-reasoning-engine/SKILL.md +9 -0
- package/.agents/skills/ui-skill-packs/SKILL.md +9 -0
- package/.agents/skills/ui-skills-root/SKILL.md +9 -0
- package/.agents/skills/ui-ux-pro-max/SKILL.md +9 -0
- package/.agents/skills/ui-ux-researcher/SKILL.md +8 -0
- package/.agents/skills/vector-search-pgvector/SKILL.md +10 -0
- package/.agents/skills/verification-before-completion/SKILL.md +9 -0
- package/.agents/skills/vue-expert/SKILL.md +9 -0
- package/.agents/skills/vulnerability-scanner/SKILL.md +9 -0
- package/.agents/skills/web-accessibility-auditor/SKILL.md +16 -0
- package/.agents/skills/web-design-guidelines/SKILL.md +9 -0
- package/.agents/skills/web-quality-audit/SKILL.md +10 -0
- package/.agents/skills/webapp-testing/SKILL.md +8 -0
- package/.agents/skills/webgpu-performance/SKILL.md +9 -0
- package/.agents/skills/whimsy-injector/SKILL.md +9 -0
- package/.agents/skills/workflow-optimizer/SKILL.md +9 -0
- package/.agents/skills/zero-trust-passkeys/SKILL.md +10 -0
- package/CONTRIBUTING.md +2 -2
- package/README.md +25 -25
- package/bin/adapter-install.js +1 -1
- package/bin/mcp-server.js +249 -0
- package/package.json +11 -8
- package/plugins/core-plugin.json +1 -1
- package/plugins/gemini/extension.json +1 -1
- package/skills/12-principles-of-animation/SKILL.md +9 -0
- package/skills/60fps-animation/SKILL.md +14 -0
- package/skills/accessible-animation/SKILL.md +9 -0
- package/skills/adapt/SKILL.md +8 -0
- package/skills/adr-generation/SKILL.md +9 -0
- package/skills/advanced-rag-pipelines/SKILL.md +9 -0
- package/skills/agent-organizer/SKILL.md +8 -0
- package/skills/agent-syscall-guidelines/SKILL.md +10 -0
- package/skills/agentic-patterns/SKILL.md +9 -0
- package/skills/agentic-workflows-2026/SKILL.md +8 -0
- package/skills/agentshield-security/SKILL.md +16 -0
- package/skills/ai-app-hardening/SKILL.md +7 -0
- package/skills/ai-prompt-injection-defense/SKILL.md +9 -0
- package/skills/animation-on-scroll/SKILL.md +9 -0
- package/skills/animation-systems/SKILL.md +8 -0
- package/skills/antfu-conventions/SKILL.md +9 -0
- package/skills/anti-slop-enforcement/SKILL.md +11 -0
- package/skills/api-patterns/SKILL.md +9 -0
- package/skills/api-security-auditor/SKILL.md +10 -0
- package/skills/app-builder/SKILL.md +8 -0
- package/skills/appflow-wireframe/SKILL.md +9 -0
- package/skills/apple-design/SKILL.md +8 -0
- package/skills/architecture/SKILL.md +8 -0
- package/skills/architecture-drift/SKILL.md +9 -0
- package/skills/architecture-intelligence/SKILL.md +17 -0
- package/skills/audit-and-fix/SKILL.md +8 -0
- package/skills/authentication-best-practices/SKILL.md +10 -0
- package/skills/autonomous-execution/SKILL.md +9 -0
- package/skills/backend-alembic/SKILL.md +16 -0
- package/skills/backend-architecture-auditor/SKILL.md +16 -0
- package/skills/backend-mongodb/SKILL.md +10 -0
- package/skills/backend-mysql/SKILL.md +16 -0
- package/skills/backend-performance-auditor/SKILL.md +10 -0
- package/skills/backend-postgresql/SKILL.md +10 -0
- package/skills/backend-redis/SKILL.md +10 -0
- package/skills/backend-security-expert/SKILL.md +10 -0
- package/skills/backend-sqlalchemy/SKILL.md +10 -0
- package/skills/backend-sqlite/SKILL.md +10 -0
- package/skills/backend-testing-auditor/SKILL.md +15 -0
- package/skills/baseline-ui/SKILL.md +8 -0
- package/skills/bash-linux/SKILL.md +9 -0
- package/skills/behavioral-modes/SKILL.md +9 -0
- package/skills/better-colors/SKILL.md +9 -0
- package/skills/better-typography/SKILL.md +9 -0
- package/skills/better-ui/SKILL.md +8 -0
- package/skills/bolder/SKILL.md +8 -0
- package/skills/brainstorming/SKILL.md +8 -0
- package/skills/browser-audit/SKILL.md +9 -0
- package/skills/browser-native-ai/SKILL.md +8 -0
- package/skills/build-primitive/SKILL.md +8 -0
- package/skills/building-native-ui/SKILL.md +7 -0
- package/skills/cicd-pro/SKILL.md +9 -0
- package/skills/clarify/SKILL.md +8 -0
- package/skills/clean-code/SKILL.md +8 -0
- package/skills/cloud-architect/SKILL.md +8 -0
- package/skills/cobejs/SKILL.md +8 -0
- package/skills/code-review-checklist/SKILL.md +9 -0
- package/skills/codebase-design/SKILL.md +14 -0
- package/skills/colorize/SKILL.md +8 -0
- package/skills/compact-landing/SKILL.md +9 -0
- package/skills/company-logos/SKILL.md +9 -0
- package/skills/config-validator/SKILL.md +9 -0
- package/skills/containerization-pro/SKILL.md +9 -0
- package/skills/context-engineering-pro/SKILL.md +10 -0
- package/skills/create-design-md/SKILL.md +7 -0
- package/skills/critique/SKILL.md +8 -0
- package/skills/csharp-developer/SKILL.md +9 -0
- package/skills/data-validation-schemas/SKILL.md +8 -0
- package/skills/database-design/SKILL.md +8 -0
- package/skills/delight/SKILL.md +8 -0
- package/skills/deployment-procedures/SKILL.md +9 -0
- package/skills/design-lab/SKILL.md +8 -0
- package/skills/devops-engineer/SKILL.md +9 -0
- package/skills/devops-incident-responder/SKILL.md +16 -0
- package/skills/diagnosing-bugs/SKILL.md +9 -0
- package/skills/distill/SKILL.md +8 -0
- package/skills/documentation-templates/SKILL.md +9 -0
- package/skills/domain-modeling/SKILL.md +9 -0
- package/skills/duckdb-analytical-sql/SKILL.md +10 -0
- package/skills/edge-ai-mobile/SKILL.md +8 -0
- package/skills/edge-computing/SKILL.md +9 -0
- package/skills/emil-design-eng/SKILL.md +9 -0
- package/skills/error-resilience/SKILL.md +8 -0
- package/skills/expo-router-v4/SKILL.md +9 -0
- package/skills/extract-design-system/SKILL.md +9 -0
- package/skills/fabel-protocol/SKILL.md +9 -0
- package/skills/failure-mode-analysis/SKILL.md +10 -0
- package/skills/fastapi-pro/SKILL.md +9 -0
- package/skills/fixing-accessibility/SKILL.md +9 -0
- package/skills/fixing-metadata/SKILL.md +9 -0
- package/skills/fixing-motion-performance/SKILL.md +9 -0
- package/skills/framer-motion-expert/SKILL.md +9 -0
- package/skills/frontend-design/SKILL.md +7 -0
- package/skills/frontend-security-expert/SKILL.md +9 -0
- package/skills/game-design-expert/SKILL.md +9 -0
- package/skills/game-engineering-expert/SKILL.md +16 -0
- package/skills/generative-ui-expert/SKILL.md +9 -0
- package/skills/geo-fundamentals/SKILL.md +9 -0
- package/skills/git-pro/SKILL.md +9 -0
- package/skills/github-operations/SKILL.md +9 -0
- package/skills/gpt-taste/SKILL.md +9 -0
- package/skills/graph-engineering/SKILL.md +16 -0
- package/skills/gsap-core/SKILL.md +9 -0
- package/skills/gsap-frameworks/SKILL.md +9 -0
- package/skills/gsap-performance/SKILL.md +9 -0
- package/skills/gsap-plugins/SKILL.md +9 -0
- package/skills/gsap-react/SKILL.md +9 -0
- package/skills/gsap-scrolltrigger/SKILL.md +9 -0
- package/skills/gsap-timeline/SKILL.md +9 -0
- package/skills/gsap-utils/SKILL.md +9 -0
- package/skills/harden/SKILL.md +8 -0
- package/skills/harness-protocol/SKILL.md +9 -0
- package/skills/hf-cli/SKILL.md +11 -0
- package/skills/hf-cloud-aws-context-discovery/SKILL.md +10 -0
- package/skills/hf-cloud-python-env-setup/SKILL.md +10 -0
- package/skills/hf-cloud-sagemaker-deployment-planner/SKILL.md +10 -0
- package/skills/hf-cloud-sagemaker-iam-preflight/SKILL.md +10 -0
- package/skills/hf-cloud-sagemaker-production-defaults/SKILL.md +10 -0
- package/skills/hf-cloud-serving-image-selection/SKILL.md +10 -0
- package/skills/hf-mem/SKILL.md +11 -0
- package/skills/huggingface-best/SKILL.md +9 -0
- package/skills/huggingface-community-evals/SKILL.md +11 -0
- package/skills/huggingface-datasets/SKILL.md +10 -0
- package/skills/huggingface-gradio/SKILL.md +10 -0
- package/skills/huggingface-llm-trainer/SKILL.md +10 -0
- package/skills/huggingface-local-models/SKILL.md +10 -0
- package/skills/huggingface-lora-space-builder/SKILL.md +11 -0
- package/skills/huggingface-paper-publisher/SKILL.md +11 -0
- package/skills/huggingface-papers/SKILL.md +11 -0
- package/skills/huggingface-spaces/SKILL.md +10 -0
- package/skills/huggingface-tool-builder/SKILL.md +11 -0
- package/skills/huggingface-trackio/SKILL.md +11 -0
- package/skills/huggingface-vision-trainer/SKILL.md +11 -0
- package/skills/huggingface-zerogpu/SKILL.md +11 -0
- package/skills/human-gate-negotiation/SKILL.md +11 -0
- package/skills/i18n-localization/SKILL.md +9 -0
- package/skills/impeccable/SKILL.md +8 -0
- package/skills/improve-codebase-architecture/SKILL.md +10 -0
- package/skills/improve-ui/SKILL.md +8 -0
- package/skills/intelligent-routing/SKILL.md +9 -0
- package/skills/knowledge-graph/SKILL.md +9 -0
- package/skills/landing-page/SKILL.md +9 -0
- package/skills/lint-and-validate/SKILL.md +9 -0
- package/skills/llm-engineering/SKILL.md +9 -0
- package/skills/local-first/SKILL.md +10 -0
- package/skills/lottie-animation/SKILL.md +9 -0
- package/skills/marquee-loop/SKILL.md +9 -0
- package/skills/masked-reveal/SKILL.md +9 -0
- package/skills/mcp-builder/SKILL.md +9 -0
- package/skills/micro-interaction/SKILL.md +9 -0
- package/skills/mobile-design/SKILL.md +7 -0
- package/skills/monorepo-management/SKILL.md +9 -0
- package/skills/morphing-icons/SKILL.md +9 -0
- package/skills/motion-engineering/SKILL.md +8 -0
- package/skills/nextjs-react-expert/SKILL.md +10 -0
- package/skills/nodejs-best-practices/SKILL.md +16 -0
- package/skills/observability/SKILL.md +8 -0
- package/skills/opentelemetry-observability/SKILL.md +9 -0
- package/skills/page-transition-animation/SKILL.md +10 -0
- package/skills/parallel-agents/SKILL.md +15 -0
- package/skills/performance-profiling/SKILL.md +9 -0
- package/skills/plan-writing/SKILL.md +8 -0
- package/skills/platform-engineer/SKILL.md +9 -0
- package/skills/platform-engineering-opentofu/SKILL.md +10 -0
- package/skills/playwright-ai-e2e/SKILL.md +9 -0
- package/skills/playwright-best-practices/SKILL.md +16 -0
- package/skills/polish/SKILL.md +8 -0
- package/skills/powershell-windows/SKILL.md +9 -0
- package/skills/pricing-page/SKILL.md +9 -0
- package/skills/product-aware-heuristics/SKILL.md +10 -0
- package/skills/progressive-blur/SKILL.md +9 -0
- package/skills/project-idioms/SKILL.md +8 -0
- package/skills/property-based-testing/SKILL.md +9 -0
- package/skills/python-patterns/SKILL.md +9 -0
- package/skills/python-pro/SKILL.md +9 -0
- package/skills/quieter/SKILL.md +8 -0
- package/skills/react-doctor/SKILL.md +9 -0
- package/skills/react-specialist/SKILL.md +9 -0
- package/skills/readme-builder/SKILL.md +9 -0
- package/skills/realtime-patterns/SKILL.md +9 -0
- package/skills/red-team-tactics/SKILL.md +16 -0
- package/skills/redesign-skill/SKILL.md +9 -0
- package/skills/review-animations/SKILL.md +8 -0
- package/skills/rust-pro/SKILL.md +9 -0
- package/skills/semantic-filesystem-navigation/SKILL.md +11 -0
- package/skills/seo-fundamentals/SKILL.md +9 -0
- package/skills/server-management/SKILL.md +8 -0
- package/skills/session-log-interrogation/SKILL.md +11 -0
- package/skills/shadcn-ui-expert/SKILL.md +9 -0
- package/skills/shape/SKILL.md +8 -0
- package/skills/skill-creator/SKILL.md +9 -0
- package/skills/soft-skill/SKILL.md +9 -0
- package/skills/sounds-on-the-web/SKILL.md +9 -0
- package/skills/sql-pro/SKILL.md +9 -0
- package/skills/subagent-driven-development/SKILL.md +11 -0
- package/skills/supabase-postgres-best-practices/SKILL.md +17 -0
- package/skills/svg-animation/SKILL.md +9 -0
- package/skills/swiftui-expert/SKILL.md +9 -0
- package/skills/swiss-design/SKILL.md +8 -0
- package/skills/system-design-pro/SKILL.md +9 -0
- package/skills/systematic-debugging/SKILL.md +14 -0
- package/skills/tailwind-patterns/SKILL.md +9 -0
- package/skills/taste-skill/SKILL.md +9 -0
- package/skills/tdd-workflow/SKILL.md +9 -0
- package/skills/test-result-analyzer/SKILL.md +9 -0
- package/skills/testing-patterns/SKILL.md +8 -0
- package/skills/thermo-nuclear-code-quality-review/SKILL.md +11 -0
- package/skills/thinking-protocol/SKILL.md +10 -0
- package/skills/to-spring-or-not-to-spring/SKILL.md +9 -0
- package/skills/train-sentence-transformers/SKILL.md +10 -0
- package/skills/transformers-js/SKILL.md +8 -0
- package/skills/transitions-dev/SKILL.md +8 -0
- package/skills/trend-researcher/SKILL.md +9 -0
- package/skills/tribunal-instincts-memory/SKILL.md +11 -0
- package/skills/trl-training/SKILL.md +9 -0
- package/skills/typescript-advanced/SKILL.md +9 -0
- package/skills/typeset/SKILL.md +8 -0
- package/skills/ui-reasoning-engine/SKILL.md +9 -0
- package/skills/ui-skill-packs/SKILL.md +9 -0
- package/skills/ui-skills-root/SKILL.md +9 -0
- package/skills/ui-ux-pro-max/SKILL.md +9 -0
- package/skills/ui-ux-researcher/SKILL.md +8 -0
- package/skills/vector-search-pgvector/SKILL.md +10 -0
- package/skills/verification-before-completion/SKILL.md +9 -0
- package/skills/vue-expert/SKILL.md +9 -0
- package/skills/vulnerability-scanner/SKILL.md +9 -0
- package/skills/web-accessibility-auditor/SKILL.md +16 -0
- package/skills/web-design-guidelines/SKILL.md +9 -0
- package/skills/web-quality-audit/SKILL.md +10 -0
- package/skills/webapp-testing/SKILL.md +8 -0
- package/skills/webgpu-performance/SKILL.md +9 -0
- package/skills/whimsy-injector/SKILL.md +9 -0
- package/skills/workflow-optimizer/SKILL.md +9 -0
- package/skills/zero-trust-passkeys/SKILL.md +10 -0
- package/src/browser/index.js +2 -1
- package/src/browser/launcher.js +41 -1
- package/src/cli.js +21 -1
- package/src/commands/arch.js +261 -172
- package/src/commands/context.js +27 -8
- package/src/commands/init.js +538 -462
- package/src/commands/intelligence.js +86 -0
- package/src/commands/learn.js +21 -6
- package/src/commands/memory.js +10 -1
- package/src/commands/native.js +12 -3
- package/src/commands/review.js +235 -1
- package/src/commands/skill-intelligence.js +1165 -0
- package/src/commands/system1.js +562 -312
- package/src/context/ranker.js +337 -339
- package/src/evaluation/evaluation_runner.js +207 -0
- package/src/evaluation/scenario_registry.js +82 -0
- package/src/evolution/engine.js +296 -295
- package/src/execution/agent_correction_engine.js +76 -0
- package/src/execution/controlled_write_service.js +301 -0
- package/src/execution/correction_run_engine.js +234 -0
- package/src/execution/correction_verifier.js +85 -0
- package/src/execution/evidence_aggregator.js +54 -0
- package/src/execution/finding_diff_engine.js +59 -0
- package/src/execution/index.js +42 -0
- package/src/execution/prompt_isolator.js +145 -0
- package/src/execution/provider_adapter.js +495 -0
- package/src/execution/resolution_certificate.js +53 -0
- package/src/execution/resolution_policy.js +70 -0
- package/src/execution/review_executor.js +335 -0
- package/src/execution/reviewer_registry.js +137 -0
- package/src/execution/schemas.js +298 -0
- package/src/execution/transaction_manager.js +237 -0
- package/src/execution/validation_runner.js +174 -0
- package/src/execution/verdict_aggregator.js +181 -0
- package/src/execution/write_policy_engine.js +95 -0
- package/src/intelligence/adaptive_correction.js +72 -0
- package/src/intelligence/adaptive_reviewer_orchestrator.js +123 -0
- package/src/intelligence/case_indexer.js +166 -0
- package/src/intelligence/case_memory.js +149 -0
- package/src/intelligence/case_similarity.js +86 -0
- package/src/intelligence/cbr_engine.js +90 -0
- package/src/intelligence/evidence_optimization.js +106 -0
- package/src/intelligence/failure_intelligence.js +95 -0
- package/src/intelligence/governance_drift_detector.js +75 -0
- package/src/intelligence/governance_simulator.js +115 -0
- package/src/intelligence/human_intelligence.js +46 -0
- package/src/intelligence/mcp_tools.js +87 -0
- package/src/intelligence/reviewer_performance.js +94 -0
- package/src/intelligence/risk_prediction_engine.js +92 -0
- package/src/intelligence/token_intelligence.js +73 -0
- package/src/synthesis/claim_check_separator.js +294 -271
- package/src/system1/browser_intelligence.js +300 -0
- package/src/system1/constants.js +49 -0
- package/src/system1/decision_engine.js +498 -0
- package/src/system1/evidence_engine.js +602 -0
- package/src/system1/evolution_pipeline.js +581 -0
- package/src/system1/index.d.ts +114 -0
- package/src/system1/index.js +102 -0
- package/src/system1/reviewer_orchestrator.js +477 -0
- package/src/tui/banner.js +26 -47
- package/src/tui/index.js +4 -0
- package/src/tui/panel.js +55 -0
- package/src/tui/progress.js +42 -0
- package/src/tui/reviewer-grid.js +9 -10
- package/src/tui/theme.js +59 -16
- package/src/tui/tree.js +57 -29
- package/src/tui/wizard.js +22 -18
- package/src/utils/fs.js +27 -0
- package/.agent/skills/local-first-architecture/SKILL.md +0 -123
|
@@ -0,0 +1,1883 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* cross_domain_engine.js — Tribunal Kit Phase 9: Cross-Domain Engineering Intelligence
|
|
4
|
+
* ====================================================================================
|
|
5
|
+
* Core Invariant:
|
|
6
|
+
* DISCOVER FIRST. COMPOSE SECOND. CREATE ONLY WHEN NECESSARY.
|
|
7
|
+
* VERIFY ALWAYS. TRACE INTERACTIONS.
|
|
8
|
+
*
|
|
9
|
+
* Added Invariant:
|
|
10
|
+
* CROSS-DOMAIN INTERACTION INVARIANT:
|
|
11
|
+
* An engineering decision must not be evaluated only within
|
|
12
|
+
* the domain in which it appears.
|
|
13
|
+
*
|
|
14
|
+
* Pipeline:
|
|
15
|
+
* CONCEPTS → DOMAINS → INTERACTION GRAPH → SECOND-ORDER EFFECTS
|
|
16
|
+
* → FAILURE PROPAGATION → RESOURCE CONTENTION → SECURITY BOUNDARIES
|
|
17
|
+
* → CONSTRAINT CONFLICTS → TRADEOFFS → VALIDATION REQUIREMENTS
|
|
18
|
+
* → ENGINEERING MEMORY FEEDBACK
|
|
19
|
+
*
|
|
20
|
+
* This module:
|
|
21
|
+
* - USES existing concept_extractor.js for concept + domain discovery
|
|
22
|
+
* - USES existing consideration_engine.js for per-concept considerations
|
|
23
|
+
* - USES existing simulation_engine.js for failure chains + blast radius
|
|
24
|
+
* - USES existing engineering_memory.js for historical failure reuse
|
|
25
|
+
* - EXTENDS analysis with cross-domain interaction graph
|
|
26
|
+
* - EXTENDS analysis with second-order effect chains
|
|
27
|
+
* - EXTENDS analysis with failure propagation graphs
|
|
28
|
+
* - EXTENDS analysis with cross-domain validation requirements
|
|
29
|
+
* - DOES NOT duplicate concept extraction or failure taxonomy
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
'use strict';
|
|
33
|
+
|
|
34
|
+
// ============================================================================
|
|
35
|
+
// 1. RELATIONSHIP TAXONOMY (Section 5)
|
|
36
|
+
// ============================================================================
|
|
37
|
+
|
|
38
|
+
const RELATIONSHIP_TYPES = {
|
|
39
|
+
DEPENDENCY: 'DEPENDENCY',
|
|
40
|
+
CONFLICT: 'CONFLICT',
|
|
41
|
+
TRADEOFF: 'TRADEOFF',
|
|
42
|
+
AMPLIFICATION: 'AMPLIFICATION',
|
|
43
|
+
MITIGATION: 'MITIGATION',
|
|
44
|
+
COUPLING: 'COUPLING',
|
|
45
|
+
CONSTRAINT: 'CONSTRAINT',
|
|
46
|
+
SIDE_EFFECT: 'SIDE_EFFECT',
|
|
47
|
+
FAILURE_PROPAGATION: 'FAILURE_PROPAGATION',
|
|
48
|
+
RESOURCE_CONTENTION: 'RESOURCE_CONTENTION',
|
|
49
|
+
SECURITY_BOUNDARY: 'SECURITY_BOUNDARY',
|
|
50
|
+
CONSISTENCY_INTERACTION: 'CONSISTENCY_INTERACTION',
|
|
51
|
+
PERFORMANCE_INTERACTION: 'PERFORMANCE_INTERACTION',
|
|
52
|
+
COST_INTERACTION: 'COST_INTERACTION',
|
|
53
|
+
OPERATIONAL_DEPENDENCY: 'OPERATIONAL_DEPENDENCY',
|
|
54
|
+
RECOVERY_DEPENDENCY: 'RECOVERY_DEPENDENCY',
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const INTERACTION_PRIORITY = {
|
|
58
|
+
CRITICAL: 'CRITICAL',
|
|
59
|
+
HIGH: 'HIGH',
|
|
60
|
+
MEDIUM: 'MEDIUM',
|
|
61
|
+
LOW: 'LOW',
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const INTERACTION_CONFIDENCE = {
|
|
65
|
+
VERIFIED: 'VERIFIED',
|
|
66
|
+
HIGH: 'HIGH',
|
|
67
|
+
MODERATE: 'MODERATE',
|
|
68
|
+
SPECULATIVE: 'SPECULATIVE',
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// ============================================================================
|
|
72
|
+
// 2. CROSS-DOMAIN INTERACTION GRAPH (Sections 4, 7)
|
|
73
|
+
// ============================================================================
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Canonical interaction rules.
|
|
77
|
+
* Each rule defines a relationship between two concepts (or concept domains).
|
|
78
|
+
* These are reusable, evidence-backed engineering relationships.
|
|
79
|
+
*
|
|
80
|
+
* Format:
|
|
81
|
+
* { a, b, relationship, effect, priority, confidence, reason, domains, validation }
|
|
82
|
+
*
|
|
83
|
+
* "a" and "b" can be concept IDs (matching taxonomy) or domain patterns.
|
|
84
|
+
*/
|
|
85
|
+
const INTERACTION_RULES = [
|
|
86
|
+
// ── Retry Domain ──
|
|
87
|
+
{
|
|
88
|
+
a: 'retry',
|
|
89
|
+
b: 'idempotency',
|
|
90
|
+
relationship: RELATIONSHIP_TYPES.DEPENDENCY,
|
|
91
|
+
effect: 'Retried requests may duplicate side effects without idempotency protection',
|
|
92
|
+
priority: INTERACTION_PRIORITY.CRITICAL,
|
|
93
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
94
|
+
reason:
|
|
95
|
+
'Any retried mutation that lacks an idempotency guard can execute the business effect twice',
|
|
96
|
+
domains: ['reliability', 'backend', 'data-integrity'],
|
|
97
|
+
validation: ['duplicate_request_test', 'idempotency_key_enforcement'],
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
a: 'retry',
|
|
101
|
+
b: 'database',
|
|
102
|
+
relationship: RELATIONSHIP_TYPES.AMPLIFICATION,
|
|
103
|
+
effect: 'Retries amplify database load proportionally to retry count',
|
|
104
|
+
priority: INTERACTION_PRIORITY.HIGH,
|
|
105
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
106
|
+
reason:
|
|
107
|
+
'Each retry attempt creates additional database queries, consuming connection pool resources',
|
|
108
|
+
domains: ['reliability', 'database', 'performance'],
|
|
109
|
+
validation: ['connection_pool_saturation_test', 'load_test_under_retry'],
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
a: 'retry',
|
|
113
|
+
b: 'rate_limiting',
|
|
114
|
+
relationship: RELATIONSHIP_TYPES.AMPLIFICATION,
|
|
115
|
+
effect: 'Retries consume rate-limit budget, potentially blocking legitimate traffic',
|
|
116
|
+
priority: INTERACTION_PRIORITY.HIGH,
|
|
117
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
118
|
+
reason: 'Retried requests are counted against the same rate-limit bucket as original requests',
|
|
119
|
+
domains: ['reliability', 'security', 'networking'],
|
|
120
|
+
validation: ['rate_limit_budget_test'],
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
a: 'retry',
|
|
124
|
+
b: 'circuit_breaker',
|
|
125
|
+
relationship: RELATIONSHIP_TYPES.MITIGATION,
|
|
126
|
+
effect: 'Circuit breaker prevents retry storms from overwhelming recovering services',
|
|
127
|
+
priority: INTERACTION_PRIORITY.HIGH,
|
|
128
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
129
|
+
reason:
|
|
130
|
+
'Without circuit breaking, retries during outage compound the failure instead of containing it',
|
|
131
|
+
domains: ['reliability', 'distributed-systems'],
|
|
132
|
+
validation: ['circuit_breaker_open_test'],
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
a: 'retry',
|
|
136
|
+
b: 'timeout',
|
|
137
|
+
relationship: RELATIONSHIP_TYPES.AMPLIFICATION,
|
|
138
|
+
effect: 'Timeout + retry creates multiplicative latency and load amplification',
|
|
139
|
+
priority: INTERACTION_PRIORITY.HIGH,
|
|
140
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
141
|
+
reason:
|
|
142
|
+
'Each retry waits for the full timeout before retrying, creating n * timeout total delay',
|
|
143
|
+
domains: ['reliability', 'performance'],
|
|
144
|
+
validation: ['timeout_retry_amplification_test'],
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
a: 'retry',
|
|
148
|
+
b: 'external_api',
|
|
149
|
+
relationship: RELATIONSHIP_TYPES.COST_INTERACTION,
|
|
150
|
+
effect: 'Retries multiply external API call costs (tokens, quotas, charges)',
|
|
151
|
+
priority: INTERACTION_PRIORITY.MEDIUM,
|
|
152
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
153
|
+
reason: 'Each retry is billed as a separate API call by the external provider',
|
|
154
|
+
domains: ['cost', 'reliability'],
|
|
155
|
+
validation: ['cost_under_retry_analysis'],
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
// ── Cache Domain ──
|
|
159
|
+
{
|
|
160
|
+
a: 'cache',
|
|
161
|
+
b: 'consistency',
|
|
162
|
+
relationship: RELATIONSHIP_TYPES.CONFLICT,
|
|
163
|
+
effect: 'Cache introduces potential data staleness for reads',
|
|
164
|
+
priority: INTERACTION_PRIORITY.HIGH,
|
|
165
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
166
|
+
reason: 'Cached values may become stale after the source of truth is updated',
|
|
167
|
+
domains: ['performance', 'data-integrity'],
|
|
168
|
+
validation: ['cache_invalidation_test', 'stale_read_detection_test'],
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
a: 'cache',
|
|
172
|
+
b: 'authorization',
|
|
173
|
+
relationship: RELATIONSHIP_TYPES.SECURITY_BOUNDARY,
|
|
174
|
+
effect: 'Cached authorization data may persist after permission revocation',
|
|
175
|
+
priority: INTERACTION_PRIORITY.CRITICAL,
|
|
176
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
177
|
+
reason:
|
|
178
|
+
'If authorization decisions are cached, a revoked permission remains active until cache expires',
|
|
179
|
+
domains: ['security', 'performance'],
|
|
180
|
+
validation: ['permission_revocation_propagation_test'],
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
a: 'cache',
|
|
184
|
+
b: 'multi_tenancy',
|
|
185
|
+
relationship: RELATIONSHIP_TYPES.SECURITY_BOUNDARY,
|
|
186
|
+
effect: 'Cache key without tenant scope can leak data across tenants',
|
|
187
|
+
priority: INTERACTION_PRIORITY.CRITICAL,
|
|
188
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
189
|
+
reason: 'Shared cache keys not scoped by tenant ID return data belonging to other tenants',
|
|
190
|
+
domains: ['security', 'performance', 'isolation'],
|
|
191
|
+
validation: ['cross_tenant_cache_leakage_test'],
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
a: 'cache',
|
|
195
|
+
b: 'database',
|
|
196
|
+
relationship: RELATIONSHIP_TYPES.TRADEOFF,
|
|
197
|
+
effect: 'Cache reduces database load but introduces invalidation complexity',
|
|
198
|
+
priority: INTERACTION_PRIORITY.MEDIUM,
|
|
199
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
200
|
+
reason:
|
|
201
|
+
'Trade: lower DB queries and latency vs. invalidation engineering and potential stale reads',
|
|
202
|
+
domains: ['performance', 'database'],
|
|
203
|
+
validation: ['cache_hit_rate_test', 'invalidation_correctness_test'],
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
a: 'cache',
|
|
207
|
+
b: 'availability',
|
|
208
|
+
relationship: RELATIONSHIP_TYPES.DEPENDENCY,
|
|
209
|
+
effect: 'If cache is required for performance, cache outage degrades the entire application',
|
|
210
|
+
priority: INTERACTION_PRIORITY.HIGH,
|
|
211
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
212
|
+
reason: 'Systems that depend on cache for acceptable latency fail during cache unavailability',
|
|
213
|
+
domains: ['reliability', 'performance'],
|
|
214
|
+
validation: ['cache_outage_fallback_test'],
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
a: 'cache',
|
|
218
|
+
b: 'cost',
|
|
219
|
+
relationship: RELATIONSHIP_TYPES.TRADEOFF,
|
|
220
|
+
effect: 'Cache reduces database cost but adds infrastructure cost (Redis memory)',
|
|
221
|
+
priority: INTERACTION_PRIORITY.MEDIUM,
|
|
222
|
+
confidence: INTERACTION_CONFIDENCE.MODERATE,
|
|
223
|
+
reason: 'Redis memory is more expensive per GB than database storage',
|
|
224
|
+
domains: ['cost', 'infrastructure'],
|
|
225
|
+
validation: ['cost_analysis'],
|
|
226
|
+
},
|
|
227
|
+
|
|
228
|
+
// ── Database Domain ──
|
|
229
|
+
{
|
|
230
|
+
a: 'database',
|
|
231
|
+
b: 'concurrency',
|
|
232
|
+
relationship: RELATIONSHIP_TYPES.RESOURCE_CONTENTION,
|
|
233
|
+
effect: 'Concurrent writes to the same row can cause deadlocks or lost updates',
|
|
234
|
+
priority: INTERACTION_PRIORITY.CRITICAL,
|
|
235
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
236
|
+
reason:
|
|
237
|
+
'Without proper locking or optimistic concurrency, concurrent transactions overwrite each other',
|
|
238
|
+
domains: ['database', 'concurrency'],
|
|
239
|
+
validation: ['concurrent_write_test', 'deadlock_detection_test'],
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
a: 'database_index',
|
|
243
|
+
b: 'write_performance',
|
|
244
|
+
relationship: RELATIONSHIP_TYPES.TRADEOFF,
|
|
245
|
+
effect: 'Indexes speed reads but slow writes and increase storage',
|
|
246
|
+
priority: INTERACTION_PRIORITY.MEDIUM,
|
|
247
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
248
|
+
reason:
|
|
249
|
+
'Each write must update all affected indexes, adding latency proportional to index count',
|
|
250
|
+
domains: ['database', 'performance'],
|
|
251
|
+
validation: ['write_latency_with_indexes_test'],
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
a: 'database',
|
|
255
|
+
b: 'connection_pool',
|
|
256
|
+
relationship: RELATIONSHIP_TYPES.RESOURCE_CONTENTION,
|
|
257
|
+
effect: 'Connection pool exhaustion blocks all database operations',
|
|
258
|
+
priority: INTERACTION_PRIORITY.HIGH,
|
|
259
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
260
|
+
reason: 'Fixed-size connection pool under high concurrency causes request queuing or rejection',
|
|
261
|
+
domains: ['database', 'scalability', 'reliability'],
|
|
262
|
+
validation: ['connection_pool_exhaustion_test'],
|
|
263
|
+
},
|
|
264
|
+
|
|
265
|
+
// ── Payment Domain ──
|
|
266
|
+
{
|
|
267
|
+
a: 'payment',
|
|
268
|
+
b: 'idempotency',
|
|
269
|
+
relationship: RELATIONSHIP_TYPES.DEPENDENCY,
|
|
270
|
+
effect: 'Payment operations require idempotency to prevent double charges',
|
|
271
|
+
priority: INTERACTION_PRIORITY.CRITICAL,
|
|
272
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
273
|
+
reason:
|
|
274
|
+
'Network retries, client timeouts, and infrastructure failures can cause duplicate payment execution',
|
|
275
|
+
domains: ['financial', 'reliability', 'data-integrity'],
|
|
276
|
+
validation: ['payment_idempotency_test', 'duplicate_charge_prevention_test'],
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
a: 'payment',
|
|
280
|
+
b: 'observability',
|
|
281
|
+
relationship: RELATIONSHIP_TYPES.DEPENDENCY,
|
|
282
|
+
effect: 'Payment operations require correlation IDs for audit and debugging',
|
|
283
|
+
priority: INTERACTION_PRIORITY.HIGH,
|
|
284
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
285
|
+
reason:
|
|
286
|
+
'Financial transactions must be traceable across all system components for compliance and debugging',
|
|
287
|
+
domains: ['financial', 'observability'],
|
|
288
|
+
validation: ['correlation_id_propagation_test'],
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
a: 'payment',
|
|
292
|
+
b: 'security',
|
|
293
|
+
relationship: RELATIONSHIP_TYPES.DEPENDENCY,
|
|
294
|
+
effect: 'Payment requires authentication and authorization at every step',
|
|
295
|
+
priority: INTERACTION_PRIORITY.CRITICAL,
|
|
296
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
297
|
+
reason: 'Unauthenticated or improperly authorized payment operations lead to financial fraud',
|
|
298
|
+
domains: ['financial', 'security'],
|
|
299
|
+
validation: ['payment_auth_test'],
|
|
300
|
+
},
|
|
301
|
+
|
|
302
|
+
// ── Messaging / Queue Domain ──
|
|
303
|
+
{
|
|
304
|
+
a: 'queue',
|
|
305
|
+
b: 'idempotency',
|
|
306
|
+
relationship: RELATIONSHIP_TYPES.DEPENDENCY,
|
|
307
|
+
effect: 'At-least-once delivery requires idempotent consumers',
|
|
308
|
+
priority: INTERACTION_PRIORITY.CRITICAL,
|
|
309
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
310
|
+
reason: 'Message brokers guarantee at-least-once, meaning consumers will receive duplicates',
|
|
311
|
+
domains: ['messaging', 'reliability', 'data-integrity'],
|
|
312
|
+
validation: ['duplicate_message_test', 'idempotent_consumer_test'],
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
a: 'queue',
|
|
316
|
+
b: 'ordering',
|
|
317
|
+
relationship: RELATIONSHIP_TYPES.CONSTRAINT,
|
|
318
|
+
effect: 'Message ordering is not guaranteed across partitions',
|
|
319
|
+
priority: INTERACTION_PRIORITY.HIGH,
|
|
320
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
321
|
+
reason:
|
|
322
|
+
'Distributed message systems partition for scale, breaking cross-partition ordering guarantees',
|
|
323
|
+
domains: ['messaging', 'distributed-systems'],
|
|
324
|
+
validation: ['out_of_order_message_test'],
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
a: 'queue',
|
|
328
|
+
b: 'database',
|
|
329
|
+
relationship: RELATIONSHIP_TYPES.CONSISTENCY_INTERACTION,
|
|
330
|
+
effect: 'Database write + message publish is not atomic without transactional outbox',
|
|
331
|
+
priority: INTERACTION_PRIORITY.HIGH,
|
|
332
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
333
|
+
reason:
|
|
334
|
+
'Writing to DB and publishing to queue in sequence can lose the event if the process crashes between operations',
|
|
335
|
+
domains: ['messaging', 'database', 'data-integrity'],
|
|
336
|
+
validation: ['dual_write_consistency_test'],
|
|
337
|
+
},
|
|
338
|
+
|
|
339
|
+
// ── Microservices Domain ──
|
|
340
|
+
{
|
|
341
|
+
a: 'microservices',
|
|
342
|
+
b: 'network',
|
|
343
|
+
relationship: RELATIONSHIP_TYPES.FAILURE_PROPAGATION,
|
|
344
|
+
effect: 'Service decomposition introduces network failure modes',
|
|
345
|
+
priority: INTERACTION_PRIORITY.HIGH,
|
|
346
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
347
|
+
reason:
|
|
348
|
+
'Every service-to-service call is a potential failure point: timeouts, DNS failures, TLS errors',
|
|
349
|
+
domains: ['architecture', 'networking', 'distributed-systems'],
|
|
350
|
+
validation: ['network_failure_injection_test'],
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
a: 'microservices',
|
|
354
|
+
b: 'consistency',
|
|
355
|
+
relationship: RELATIONSHIP_TYPES.TRADEOFF,
|
|
356
|
+
effect: 'Service decomposition weakens data consistency guarantees',
|
|
357
|
+
priority: INTERACTION_PRIORITY.HIGH,
|
|
358
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
359
|
+
reason:
|
|
360
|
+
'Distributed data ownership means cross-service transactions require saga/outbox patterns',
|
|
361
|
+
domains: ['architecture', 'database', 'data-integrity'],
|
|
362
|
+
validation: ['distributed_consistency_test'],
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
a: 'microservices',
|
|
366
|
+
b: 'observability',
|
|
367
|
+
relationship: RELATIONSHIP_TYPES.OPERATIONAL_DEPENDENCY,
|
|
368
|
+
effect: 'Distributed services require distributed tracing to debug issues',
|
|
369
|
+
priority: INTERACTION_PRIORITY.HIGH,
|
|
370
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
371
|
+
reason: 'Without trace propagation, failures across service boundaries become invisible',
|
|
372
|
+
domains: ['architecture', 'observability'],
|
|
373
|
+
validation: ['trace_propagation_test'],
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
a: 'microservices',
|
|
377
|
+
b: 'cost',
|
|
378
|
+
relationship: RELATIONSHIP_TYPES.COST_INTERACTION,
|
|
379
|
+
effect: 'More services = more infrastructure, more monitoring, more operational overhead',
|
|
380
|
+
priority: INTERACTION_PRIORITY.MEDIUM,
|
|
381
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
382
|
+
reason:
|
|
383
|
+
'Each service needs its own deployment, logging, monitoring, and alerting infrastructure',
|
|
384
|
+
domains: ['architecture', 'cost', 'operations'],
|
|
385
|
+
validation: ['infrastructure_cost_analysis'],
|
|
386
|
+
},
|
|
387
|
+
|
|
388
|
+
// ── AI / Agent Domain ──
|
|
389
|
+
{
|
|
390
|
+
a: 'llm',
|
|
391
|
+
b: 'prompt_injection',
|
|
392
|
+
relationship: RELATIONSHIP_TYPES.SECURITY_BOUNDARY,
|
|
393
|
+
effect: 'User input concatenated into prompts enables prompt injection',
|
|
394
|
+
priority: INTERACTION_PRIORITY.CRITICAL,
|
|
395
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
396
|
+
reason: 'User-controlled text in system prompts can override AI instructions',
|
|
397
|
+
domains: ['ai', 'security'],
|
|
398
|
+
validation: ['prompt_injection_test'],
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
a: 'agent',
|
|
402
|
+
b: 'tool_execution',
|
|
403
|
+
relationship: RELATIONSHIP_TYPES.SECURITY_BOUNDARY,
|
|
404
|
+
effect: 'AI agent with tool access can execute unauthorized system operations',
|
|
405
|
+
priority: INTERACTION_PRIORITY.CRITICAL,
|
|
406
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
407
|
+
reason:
|
|
408
|
+
'An agent with shell/file access can read credentials, write arbitrary files, or exfiltrate data',
|
|
409
|
+
domains: ['ai', 'security'],
|
|
410
|
+
validation: ['agent_tool_sandbox_test', 'credential_exposure_test'],
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
a: 'llm',
|
|
414
|
+
b: 'cost',
|
|
415
|
+
relationship: RELATIONSHIP_TYPES.COST_INTERACTION,
|
|
416
|
+
effect: 'LLM retries and long contexts create runaway token costs',
|
|
417
|
+
priority: INTERACTION_PRIORITY.HIGH,
|
|
418
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
419
|
+
reason:
|
|
420
|
+
'Each LLM call is billed per token; retries, long prompts, and streaming multiply costs rapidly',
|
|
421
|
+
domains: ['ai', 'cost'],
|
|
422
|
+
validation: ['token_cost_analysis'],
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
a: 'llm',
|
|
426
|
+
b: 'latency',
|
|
427
|
+
relationship: RELATIONSHIP_TYPES.PERFORMANCE_INTERACTION,
|
|
428
|
+
effect: 'LLM inference adds 500ms–30s latency to request paths',
|
|
429
|
+
priority: INTERACTION_PRIORITY.HIGH,
|
|
430
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
431
|
+
reason: 'LLM inference is orders of magnitude slower than traditional API calls',
|
|
432
|
+
domains: ['ai', 'performance'],
|
|
433
|
+
validation: ['llm_latency_budget_test'],
|
|
434
|
+
},
|
|
435
|
+
|
|
436
|
+
// ── Autoscaling Domain ──
|
|
437
|
+
{
|
|
438
|
+
a: 'autoscaling',
|
|
439
|
+
b: 'cold_start',
|
|
440
|
+
relationship: RELATIONSHIP_TYPES.AMPLIFICATION,
|
|
441
|
+
effect: 'Autoscaling under traffic burst introduces cold-start latency',
|
|
442
|
+
priority: INTERACTION_PRIORITY.HIGH,
|
|
443
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
444
|
+
reason:
|
|
445
|
+
'New instances take time to initialize; during burst, all new capacity has cold-start latency',
|
|
446
|
+
domains: ['scalability', 'performance'],
|
|
447
|
+
validation: ['cold_start_under_burst_test'],
|
|
448
|
+
},
|
|
449
|
+
|
|
450
|
+
// ── Rate Limiting Domain ──
|
|
451
|
+
{
|
|
452
|
+
a: 'rate_limiting',
|
|
453
|
+
b: 'distributed_systems',
|
|
454
|
+
relationship: RELATIONSHIP_TYPES.CONSISTENCY_INTERACTION,
|
|
455
|
+
effect: 'Distributed rate limiting requires shared state or accepts inconsistency',
|
|
456
|
+
priority: INTERACTION_PRIORITY.MEDIUM,
|
|
457
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
458
|
+
reason:
|
|
459
|
+
'Local counters are inconsistent across instances; shared counters add latency and availability dependency',
|
|
460
|
+
domains: ['security', 'distributed-systems', 'performance'],
|
|
461
|
+
validation: ['distributed_rate_limit_consistency_test'],
|
|
462
|
+
},
|
|
463
|
+
|
|
464
|
+
// ── Authentication Domain ──
|
|
465
|
+
{
|
|
466
|
+
a: 'authentication',
|
|
467
|
+
b: 'session',
|
|
468
|
+
relationship: RELATIONSHIP_TYPES.CONSISTENCY_INTERACTION,
|
|
469
|
+
effect: 'Session state must be consistently available across replicas',
|
|
470
|
+
priority: INTERACTION_PRIORITY.HIGH,
|
|
471
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
472
|
+
reason: 'Sticky sessions or centralized session store required for horizontal scaling',
|
|
473
|
+
domains: ['security', 'scalability'],
|
|
474
|
+
validation: ['session_consistency_test'],
|
|
475
|
+
},
|
|
476
|
+
|
|
477
|
+
// ── Encryption Domain ──
|
|
478
|
+
{
|
|
479
|
+
a: 'encryption',
|
|
480
|
+
b: 'search',
|
|
481
|
+
relationship: RELATIONSHIP_TYPES.CONFLICT,
|
|
482
|
+
effect: 'Encrypted data cannot be searched without specialized techniques',
|
|
483
|
+
priority: INTERACTION_PRIORITY.MEDIUM,
|
|
484
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
485
|
+
reason:
|
|
486
|
+
'Full-text search on encrypted fields requires homomorphic encryption or search-specific indexes',
|
|
487
|
+
domains: ['security', 'search'],
|
|
488
|
+
validation: ['encrypted_search_capability_test'],
|
|
489
|
+
},
|
|
490
|
+
|
|
491
|
+
// ── Multi-Tenancy Domain ──
|
|
492
|
+
{
|
|
493
|
+
a: 'multi_tenancy',
|
|
494
|
+
b: 'database',
|
|
495
|
+
relationship: RELATIONSHIP_TYPES.SECURITY_BOUNDARY,
|
|
496
|
+
effect: 'Every database query must include tenant scoping to prevent cross-tenant data access',
|
|
497
|
+
priority: INTERACTION_PRIORITY.CRITICAL,
|
|
498
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
499
|
+
reason: "Missing WHERE tenant_id = ? clause exposes all tenants' data",
|
|
500
|
+
domains: ['security', 'database'],
|
|
501
|
+
validation: ['cross_tenant_query_test'],
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
a: 'multi_tenancy',
|
|
505
|
+
b: 'queue',
|
|
506
|
+
relationship: RELATIONSHIP_TYPES.SECURITY_BOUNDARY,
|
|
507
|
+
effect: 'Queue messages must carry and validate tenant context',
|
|
508
|
+
priority: INTERACTION_PRIORITY.HIGH,
|
|
509
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
510
|
+
reason: "Workers processing jobs without tenant context may operate on the wrong tenant's data",
|
|
511
|
+
domains: ['security', 'messaging'],
|
|
512
|
+
validation: ['tenant_context_propagation_test'],
|
|
513
|
+
},
|
|
514
|
+
|
|
515
|
+
// ── File Upload Domain ──
|
|
516
|
+
{
|
|
517
|
+
a: 'file_upload',
|
|
518
|
+
b: 'storage',
|
|
519
|
+
relationship: RELATIONSHIP_TYPES.RESOURCE_CONTENTION,
|
|
520
|
+
effect: 'Unrestricted file uploads can exhaust storage capacity',
|
|
521
|
+
priority: INTERACTION_PRIORITY.HIGH,
|
|
522
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
523
|
+
reason: 'Without size limits and quotas, storage grows unbounded and costs escalate',
|
|
524
|
+
domains: ['storage', 'cost', 'security'],
|
|
525
|
+
validation: ['storage_quota_test'],
|
|
526
|
+
},
|
|
527
|
+
|
|
528
|
+
// ── Replication Domain ──
|
|
529
|
+
{
|
|
530
|
+
a: 'replication',
|
|
531
|
+
b: 'read_consistency',
|
|
532
|
+
relationship: RELATIONSHIP_TYPES.CONSISTENCY_INTERACTION,
|
|
533
|
+
effect: 'Read replicas serve stale data during replication lag',
|
|
534
|
+
priority: INTERACTION_PRIORITY.HIGH,
|
|
535
|
+
confidence: INTERACTION_CONFIDENCE.HIGH,
|
|
536
|
+
reason: 'Async replication creates a window where reads from replicas return outdated data',
|
|
537
|
+
domains: ['database', 'consistency'],
|
|
538
|
+
validation: ['replication_lag_read_test'],
|
|
539
|
+
},
|
|
540
|
+
];
|
|
541
|
+
|
|
542
|
+
// ============================================================================
|
|
543
|
+
// 3. CONCEPT-TO-INTERACTION MATCHER (Section 7)
|
|
544
|
+
// ============================================================================
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* Normalize a concept identifier for matching against interaction rules.
|
|
548
|
+
*/
|
|
549
|
+
function normalizeConceptId(id) {
|
|
550
|
+
return (id || '')
|
|
551
|
+
.toLowerCase()
|
|
552
|
+
.replace(/-/g, '_')
|
|
553
|
+
.replace(/\s+/g, '_')
|
|
554
|
+
.replace(/and_/g, '')
|
|
555
|
+
.replace(/_and$/g, '');
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* Map concept IDs from the taxonomy to interaction rule tokens.
|
|
560
|
+
*/
|
|
561
|
+
const CONCEPT_TO_RULE_MAP = {
|
|
562
|
+
'retry-and-backoff': ['retry', 'circuit_breaker', 'timeout'],
|
|
563
|
+
idempotency: ['idempotency'],
|
|
564
|
+
'transaction-integrity': ['database', 'consistency'],
|
|
565
|
+
'concurrency-control': ['concurrency', 'database'],
|
|
566
|
+
'query-optimization': ['database', 'database_index'],
|
|
567
|
+
'caching-and-invalidation': ['cache'],
|
|
568
|
+
'authentication-and-authorization': ['authentication', 'authorization', 'security'],
|
|
569
|
+
'input-validation-and-sanitization': ['security'],
|
|
570
|
+
'structured-observability': ['observability'],
|
|
571
|
+
'file-upload-and-storage': ['file_upload', 'storage'],
|
|
572
|
+
'ai-agent-security-and-sandboxing': ['agent', 'tool_execution', 'llm'],
|
|
573
|
+
'realtime-collaboration-and-sync': ['consistency'],
|
|
574
|
+
'cicd-and-deployment-safety': ['deployment'],
|
|
575
|
+
'distributed-job-processing': ['queue', 'ordering'],
|
|
576
|
+
'rag-and-vector-retrieval': ['llm', 'search'],
|
|
577
|
+
'event-driven-data-pipelines': ['queue', 'ordering'],
|
|
578
|
+
'notification-delivery-and-dispatch': ['queue', 'rate_limiting'],
|
|
579
|
+
'search-indexing-and-ranking': ['search', 'database_index'],
|
|
580
|
+
'multi-region-consistency-and-replication': ['replication', 'consistency', 'read_consistency'],
|
|
581
|
+
'responsive-ui-and-accessibility': [],
|
|
582
|
+
};
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* Additional concept token extraction from task query keywords.
|
|
586
|
+
*/
|
|
587
|
+
const TASK_TOKEN_PATTERNS = [
|
|
588
|
+
{
|
|
589
|
+
match: /(?:retry|backoff|circuit.?break|timeout)/i,
|
|
590
|
+
tokens: ['retry', 'timeout', 'circuit_breaker'],
|
|
591
|
+
},
|
|
592
|
+
{ match: /(?:cache|redis|memcache|cdn)/i, tokens: ['cache'] },
|
|
593
|
+
{ match: /(?:idempoten)/i, tokens: ['idempotency'] },
|
|
594
|
+
{ match: /(?:payment|charge|checkout|billing|invoice)/i, tokens: ['payment'] },
|
|
595
|
+
{ match: /(?:queue|kafka|rabbitmq|sqs|worker|job|event.?driven)/i, tokens: ['queue'] },
|
|
596
|
+
{ match: /(?:microservice|micro.?service|service.?mesh)/i, tokens: ['microservices'] },
|
|
597
|
+
{ match: /(?:auth|login|jwt|session|oauth|sso)/i, tokens: ['authentication'] },
|
|
598
|
+
{ match: /(?:permission|role|rbac|acl|authorization)/i, tokens: ['authorization'] },
|
|
599
|
+
{ match: /(?:encrypt|tls|ssl)/i, tokens: ['encryption'] },
|
|
600
|
+
{ match: /(?:multi.?tenant|tenant|workspace)/i, tokens: ['multi_tenancy'] },
|
|
601
|
+
{ match: /(?:llm|gpt|claude|openai|anthropic|prompt|rag|vector)/i, tokens: ['llm'] },
|
|
602
|
+
{
|
|
603
|
+
match: /(?:agent|tool.?call|function.?call|shell|sandbox)/i,
|
|
604
|
+
tokens: ['agent', 'tool_execution'],
|
|
605
|
+
},
|
|
606
|
+
{ match: /(?:upload|file|attachment|media)/i, tokens: ['file_upload'] },
|
|
607
|
+
{ match: /(?:index|covering.?index)/i, tokens: ['database_index'] },
|
|
608
|
+
{ match: /(?:rate.?limit|throttl)/i, tokens: ['rate_limiting'] },
|
|
609
|
+
{ match: /(?:autoscal|auto.?scale|elastic)/i, tokens: ['autoscaling'] },
|
|
610
|
+
{ match: /(?:replica|replication|read.?replica)/i, tokens: ['replication'] },
|
|
611
|
+
{ match: /(?:search|elastic|algolia|full.?text)/i, tokens: ['search'] },
|
|
612
|
+
{ match: /(?:concurrent|race|parallel|lock|mutex)/i, tokens: ['concurrency'] },
|
|
613
|
+
{ match: /(?:database|sql|postgres|mysql|query|table)/i, tokens: ['database'] },
|
|
614
|
+
{ match: /(?:observab|monitor|trace|log|metric)/i, tokens: ['observability'] },
|
|
615
|
+
{ match: /(?:api|endpoint|rest|graphql)/i, tokens: ['external_api'] },
|
|
616
|
+
{ match: /(?:cost|budget|billing.?optim|token.?cost)/i, tokens: ['cost'] },
|
|
617
|
+
{ match: /(?:deploy|rollback|canary|blue.?green)/i, tokens: ['deployment'] },
|
|
618
|
+
{ match: /(?:consistent|consisten|acid|transaction)/i, tokens: ['consistency'] },
|
|
619
|
+
{ match: /(?:connection.?pool)/i, tokens: ['connection_pool'] },
|
|
620
|
+
{ match: /(?:cold.?start|warm.?up|startup.?time)/i, tokens: ['cold_start'] },
|
|
621
|
+
{ match: /(?:session|cookie)/i, tokens: ['session'] },
|
|
622
|
+
{ match: /(?:network|dns|tcp|http)/i, tokens: ['network'] },
|
|
623
|
+
{ match: /(?:latency|p99|p95|response.?time)/i, tokens: ['latency'] },
|
|
624
|
+
{ match: /(?:storage|s3|blob|disk)/i, tokens: ['storage'] },
|
|
625
|
+
{ match: /(?:order|ordering|sequence|fifo)/i, tokens: ['ordering'] },
|
|
626
|
+
{ match: /(?:security|owasp|injection|xss|csrf)/i, tokens: ['security'] },
|
|
627
|
+
{ match: /(?:prompt.?inject)/i, tokens: ['prompt_injection'] },
|
|
628
|
+
{
|
|
629
|
+
match: /(?:scale|scaling|100k|10k|1m|high.?traffic|throughput|requests?.?per?.?sec|rps|qps)/i,
|
|
630
|
+
tokens: ['autoscaling', 'database', 'cache', 'connection_pool', 'observability'],
|
|
631
|
+
},
|
|
632
|
+
{ match: /(?:load.?balanc)/i, tokens: ['network', 'autoscaling'] },
|
|
633
|
+
{ match: /(?:monolith|split|decompos|extract.?service)/i, tokens: ['microservices'] },
|
|
634
|
+
{
|
|
635
|
+
match: /(?:performance|optimi[sz]|faster|speed|latency.?reduc)/i,
|
|
636
|
+
tokens: ['cache', 'database_index', 'database'],
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
match: /(?:availability|sla|uptime|nine.?nine|99\.9)/i,
|
|
640
|
+
tokens: ['autoscaling', 'cache', 'replication'],
|
|
641
|
+
},
|
|
642
|
+
{ match: /(?:worker|background.?job|cron|async.?process)/i, tokens: ['queue', 'database'] },
|
|
643
|
+
{ match: /(?:webhook|callback)/i, tokens: ['external_api', 'retry', 'idempotency'] },
|
|
644
|
+
];
|
|
645
|
+
|
|
646
|
+
/**
|
|
647
|
+
* Extract interaction-relevant tokens from concepts + task query.
|
|
648
|
+
*
|
|
649
|
+
* @param {Array} concepts - Extracted concept objects (from concept_extractor)
|
|
650
|
+
* @param {string} taskQuery
|
|
651
|
+
* @returns {Set<string>} Unique tokens
|
|
652
|
+
*/
|
|
653
|
+
function extractInteractionTokens(concepts, taskQuery) {
|
|
654
|
+
const tokens = new Set();
|
|
655
|
+
|
|
656
|
+
// From concept IDs via mapping
|
|
657
|
+
for (const c of concepts || []) {
|
|
658
|
+
const mapped = CONCEPT_TO_RULE_MAP[c.id];
|
|
659
|
+
if (mapped) {
|
|
660
|
+
for (const t of mapped) tokens.add(t);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
// From task query keywords
|
|
665
|
+
const q = (taskQuery || '').toLowerCase();
|
|
666
|
+
for (const p of TASK_TOKEN_PATTERNS) {
|
|
667
|
+
if (p.match.test(q)) {
|
|
668
|
+
for (const t of p.tokens) tokens.add(t);
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
return tokens;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* Discover relevant interactions for a set of tokens.
|
|
677
|
+
* Only returns interactions where BOTH sides are present in the token set.
|
|
678
|
+
* This prevents irrelevant interaction noise.
|
|
679
|
+
*
|
|
680
|
+
* @param {Set<string>} tokens
|
|
681
|
+
* @returns {Array<Object>} Matching interactions
|
|
682
|
+
*/
|
|
683
|
+
function discoverInteractions(tokens) {
|
|
684
|
+
const interactions = [];
|
|
685
|
+
const seen = new Set();
|
|
686
|
+
|
|
687
|
+
for (const rule of INTERACTION_RULES) {
|
|
688
|
+
const aMatch = tokens.has(rule.a);
|
|
689
|
+
const bMatch = tokens.has(rule.b);
|
|
690
|
+
|
|
691
|
+
if (aMatch && bMatch) {
|
|
692
|
+
const key = `${rule.a}↔${rule.b}`;
|
|
693
|
+
if (!seen.has(key)) {
|
|
694
|
+
seen.add(key);
|
|
695
|
+
interactions.push({ ...rule, source: rule.a, target: rule.b, match_type: 'BOTH_PRESENT' });
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
return interactions;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* Discover interactions where one side is present and the other
|
|
705
|
+
* is a high-risk implicit concern (e.g., "payment" implies "idempotency").
|
|
706
|
+
* These are INFERRED interactions — still relevant but lower confidence.
|
|
707
|
+
*
|
|
708
|
+
* @param {Set<string>} tokens
|
|
709
|
+
* @param {string} taskQuery
|
|
710
|
+
* @returns {Array<Object>} Inferred interactions
|
|
711
|
+
*/
|
|
712
|
+
function discoverInferredInteractions(tokens, taskQuery) {
|
|
713
|
+
const inferred = [];
|
|
714
|
+
const seen = new Set();
|
|
715
|
+
|
|
716
|
+
// Only infer for high-impact domains
|
|
717
|
+
const inferenceRules = [
|
|
718
|
+
// If payment is present but idempotency is not explicitly mentioned, still surface it
|
|
719
|
+
{
|
|
720
|
+
trigger: 'payment',
|
|
721
|
+
implies: 'idempotency',
|
|
722
|
+
reason: 'Payment operations always require idempotency protection',
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
trigger: 'payment',
|
|
726
|
+
implies: 'observability',
|
|
727
|
+
reason: 'Financial transactions require audit trails',
|
|
728
|
+
},
|
|
729
|
+
{
|
|
730
|
+
trigger: 'payment',
|
|
731
|
+
implies: 'security',
|
|
732
|
+
reason: 'Financial operations require strict authentication',
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
trigger: 'queue',
|
|
736
|
+
implies: 'idempotency',
|
|
737
|
+
reason: 'At-least-once delivery requires idempotent consumers',
|
|
738
|
+
},
|
|
739
|
+
{
|
|
740
|
+
trigger: 'retry',
|
|
741
|
+
implies: 'idempotency',
|
|
742
|
+
reason: 'Retry without idempotency creates duplicate side effects',
|
|
743
|
+
},
|
|
744
|
+
{ trigger: 'cache', implies: 'consistency', reason: 'Caching introduces staleness concerns' },
|
|
745
|
+
{
|
|
746
|
+
trigger: 'multi_tenancy',
|
|
747
|
+
implies: 'security',
|
|
748
|
+
reason: 'Multi-tenant systems require tenant isolation at every boundary',
|
|
749
|
+
},
|
|
750
|
+
{
|
|
751
|
+
trigger: 'agent',
|
|
752
|
+
implies: 'security',
|
|
753
|
+
reason: 'AI agents with tool access require sandboxing',
|
|
754
|
+
},
|
|
755
|
+
{ trigger: 'llm', implies: 'cost', reason: 'LLM inference costs scale with usage' },
|
|
756
|
+
{
|
|
757
|
+
trigger: 'microservices',
|
|
758
|
+
implies: 'observability',
|
|
759
|
+
reason: 'Distributed services require distributed tracing',
|
|
760
|
+
},
|
|
761
|
+
{
|
|
762
|
+
trigger: 'database',
|
|
763
|
+
implies: 'connection_pool',
|
|
764
|
+
reason: 'Database connections are a finite shared resource',
|
|
765
|
+
},
|
|
766
|
+
];
|
|
767
|
+
|
|
768
|
+
for (const ir of inferenceRules) {
|
|
769
|
+
if (tokens.has(ir.trigger) && !tokens.has(ir.implies)) {
|
|
770
|
+
// Find matching interaction rules for the implied pair
|
|
771
|
+
for (const rule of INTERACTION_RULES) {
|
|
772
|
+
const matches =
|
|
773
|
+
(rule.a === ir.trigger && rule.b === ir.implies) ||
|
|
774
|
+
(rule.b === ir.trigger && rule.a === ir.implies);
|
|
775
|
+
if (matches) {
|
|
776
|
+
const key = `${rule.a}↔${rule.b}`;
|
|
777
|
+
if (!seen.has(key)) {
|
|
778
|
+
seen.add(key);
|
|
779
|
+
inferred.push({
|
|
780
|
+
...rule,
|
|
781
|
+
source: rule.a,
|
|
782
|
+
target: rule.b,
|
|
783
|
+
match_type: 'INFERRED',
|
|
784
|
+
inference_reason: ir.reason,
|
|
785
|
+
confidence: INTERACTION_CONFIDENCE.MODERATE,
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
return inferred;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
// ============================================================================
|
|
797
|
+
// 4. SECOND-ORDER EFFECT ENGINE (Section 8)
|
|
798
|
+
// ============================================================================
|
|
799
|
+
|
|
800
|
+
/**
|
|
801
|
+
* Second-order effect chain templates.
|
|
802
|
+
* Each chain describes a cascading consequence sequence.
|
|
803
|
+
*/
|
|
804
|
+
const EFFECT_CHAINS = [
|
|
805
|
+
{
|
|
806
|
+
trigger: 'retry',
|
|
807
|
+
chain: [
|
|
808
|
+
{ step: 'Retry configured', domain: 'reliability' },
|
|
809
|
+
{ step: 'Additional requests to downstream', domain: 'networking' },
|
|
810
|
+
{ step: 'Increased database load', domain: 'database' },
|
|
811
|
+
{ step: 'Connection pool pressure', domain: 'database' },
|
|
812
|
+
{ step: 'Higher latency for all requests', domain: 'performance' },
|
|
813
|
+
{ step: 'More request timeouts', domain: 'reliability' },
|
|
814
|
+
{ step: 'More retries triggered', domain: 'reliability' },
|
|
815
|
+
{ step: 'Retry storm (positive feedback loop)', domain: 'reliability' },
|
|
816
|
+
],
|
|
817
|
+
severity: 'CRITICAL',
|
|
818
|
+
name: 'Retry Amplification Cascade',
|
|
819
|
+
mitigation: 'Exponential backoff with jitter + circuit breaker + max retry limit',
|
|
820
|
+
},
|
|
821
|
+
{
|
|
822
|
+
trigger: 'cache',
|
|
823
|
+
chain: [
|
|
824
|
+
{ step: 'Cache added for performance', domain: 'performance' },
|
|
825
|
+
{ step: 'Stale data possible after source update', domain: 'consistency' },
|
|
826
|
+
{ step: 'Invalidation logic required', domain: 'data-integrity' },
|
|
827
|
+
{ step: 'Invalidation race condition possible', domain: 'concurrency' },
|
|
828
|
+
{ step: 'Authorization data may be stale', domain: 'security' },
|
|
829
|
+
{ step: 'Cross-tenant data leakage if cache key not scoped', domain: 'security' },
|
|
830
|
+
{ step: 'Cache memory pressure under load', domain: 'infrastructure' },
|
|
831
|
+
{ step: 'Cache outage cascades to database', domain: 'reliability' },
|
|
832
|
+
],
|
|
833
|
+
severity: 'HIGH',
|
|
834
|
+
name: 'Cache Side-Effect Cascade',
|
|
835
|
+
mitigation: 'Tenant-scoped keys + event-driven invalidation + cache fallback strategy',
|
|
836
|
+
},
|
|
837
|
+
{
|
|
838
|
+
trigger: 'database_index',
|
|
839
|
+
chain: [
|
|
840
|
+
{ step: 'Index added to speed up reads', domain: 'performance' },
|
|
841
|
+
{ step: 'Write latency increases', domain: 'performance' },
|
|
842
|
+
{ step: 'More storage consumed', domain: 'storage' },
|
|
843
|
+
{ step: 'Larger replication workload', domain: 'database' },
|
|
844
|
+
{ step: 'Longer migration times', domain: 'operations' },
|
|
845
|
+
],
|
|
846
|
+
severity: 'MEDIUM',
|
|
847
|
+
name: 'Index Write-Amplification Chain',
|
|
848
|
+
mitigation: 'Selective indexing, composite indexes, and partial indexes where appropriate',
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
trigger: 'microservices',
|
|
852
|
+
chain: [
|
|
853
|
+
{ step: 'Monolith split into services', domain: 'architecture' },
|
|
854
|
+
{ step: 'In-process calls become network calls', domain: 'networking' },
|
|
855
|
+
{ step: 'Network failure modes introduced', domain: 'reliability' },
|
|
856
|
+
{ step: 'Distributed tracing required', domain: 'observability' },
|
|
857
|
+
{ step: 'Data consistency weakened', domain: 'data-integrity' },
|
|
858
|
+
{ step: 'More infrastructure to manage', domain: 'operations' },
|
|
859
|
+
{ step: 'Higher operational cost', domain: 'cost' },
|
|
860
|
+
],
|
|
861
|
+
severity: 'HIGH',
|
|
862
|
+
name: 'Microservices Complexity Cascade',
|
|
863
|
+
mitigation:
|
|
864
|
+
'Start with modular monolith, extract services only when justified by scale/team needs',
|
|
865
|
+
},
|
|
866
|
+
{
|
|
867
|
+
trigger: 'llm',
|
|
868
|
+
chain: [
|
|
869
|
+
{ step: 'LLM integrated into request path', domain: 'ai' },
|
|
870
|
+
{ step: 'High inference latency (500ms–30s)', domain: 'performance' },
|
|
871
|
+
{ step: 'Token cost per request', domain: 'cost' },
|
|
872
|
+
{ step: 'Retry on LLM timeout multiplies cost', domain: 'cost' },
|
|
873
|
+
{ step: 'Prompt injection risk from user input', domain: 'security' },
|
|
874
|
+
{ step: 'Hallucination risk in output', domain: 'data-integrity' },
|
|
875
|
+
],
|
|
876
|
+
severity: 'HIGH',
|
|
877
|
+
name: 'LLM Integration Side-Effects',
|
|
878
|
+
mitigation: 'Streaming responses, cost caps, input sanitization, output validation',
|
|
879
|
+
},
|
|
880
|
+
{
|
|
881
|
+
trigger: 'agent',
|
|
882
|
+
chain: [
|
|
883
|
+
{ step: 'AI agent has tool/shell access', domain: 'ai' },
|
|
884
|
+
{ step: 'Prompt injection can trigger tool invocation', domain: 'security' },
|
|
885
|
+
{ step: 'Tool executes filesystem/network operations', domain: 'security' },
|
|
886
|
+
{ step: 'Credential files accessible', domain: 'security' },
|
|
887
|
+
{ step: 'Data exfiltration possible', domain: 'security' },
|
|
888
|
+
{ step: 'Lateral movement within infrastructure', domain: 'security' },
|
|
889
|
+
],
|
|
890
|
+
severity: 'CRITICAL',
|
|
891
|
+
name: 'Agent Privilege Escalation Cascade',
|
|
892
|
+
mitigation: 'Sandboxing, allowlisted tools only, network policy, credential isolation',
|
|
893
|
+
},
|
|
894
|
+
{
|
|
895
|
+
trigger: 'autoscaling',
|
|
896
|
+
chain: [
|
|
897
|
+
{ step: 'Autoscaling configured for traffic bursts', domain: 'scalability' },
|
|
898
|
+
{ step: 'Traffic burst arrives', domain: 'performance' },
|
|
899
|
+
{ step: 'New instances provisioned', domain: 'infrastructure' },
|
|
900
|
+
{ step: 'Cold start latency for all new instances', domain: 'performance' },
|
|
901
|
+
{ step: 'Capacity lag during scale-up window', domain: 'reliability' },
|
|
902
|
+
{ step: 'Users experience degraded performance during burst', domain: 'performance' },
|
|
903
|
+
],
|
|
904
|
+
severity: 'MEDIUM',
|
|
905
|
+
name: 'Autoscaling Capacity Lag',
|
|
906
|
+
mitigation: 'Pre-warmed instances, predictive scaling, provisioned capacity floor',
|
|
907
|
+
},
|
|
908
|
+
{
|
|
909
|
+
trigger: 'rate_limiting',
|
|
910
|
+
chain: [
|
|
911
|
+
{ step: 'Rate limiting added for protection', domain: 'security' },
|
|
912
|
+
{ step: 'Distributed rate limiter requires shared state', domain: 'distributed-systems' },
|
|
913
|
+
{ step: 'Shared state adds network dependency', domain: 'networking' },
|
|
914
|
+
{ step: 'Network dependency increases latency', domain: 'performance' },
|
|
915
|
+
{ step: 'Rate limiter outage blocks all traffic', domain: 'availability' },
|
|
916
|
+
],
|
|
917
|
+
severity: 'MEDIUM',
|
|
918
|
+
name: 'Rate Limiter Availability Coupling',
|
|
919
|
+
mitigation: 'Local rate limiter with periodic sync, graceful degradation on limiter failure',
|
|
920
|
+
},
|
|
921
|
+
{
|
|
922
|
+
trigger: 'payment',
|
|
923
|
+
chain: [
|
|
924
|
+
{ step: 'Client sends payment request', domain: 'financial' },
|
|
925
|
+
{ step: 'Request times out (network issue)', domain: 'networking' },
|
|
926
|
+
{ step: 'Client retries with same payment intent', domain: 'reliability' },
|
|
927
|
+
{ step: 'Server executes payment again (no idempotency)', domain: 'financial' },
|
|
928
|
+
{ step: 'External payment provider charges twice', domain: 'financial' },
|
|
929
|
+
{ step: 'Duplicate event published to queue', domain: 'messaging' },
|
|
930
|
+
{ step: 'Duplicate notification sent to user', domain: 'communication' },
|
|
931
|
+
],
|
|
932
|
+
severity: 'CRITICAL',
|
|
933
|
+
name: 'Payment Double-Charge Cascade',
|
|
934
|
+
mitigation:
|
|
935
|
+
'Database-enforced idempotency key + external provider dedup + transactional outbox',
|
|
936
|
+
},
|
|
937
|
+
{
|
|
938
|
+
trigger: 'queue',
|
|
939
|
+
chain: [
|
|
940
|
+
{ step: 'Message published to queue', domain: 'messaging' },
|
|
941
|
+
{ step: 'Consumer processes message', domain: 'backend' },
|
|
942
|
+
{ step: 'Consumer crashes mid-processing', domain: 'reliability' },
|
|
943
|
+
{ step: 'Broker redelivers message', domain: 'messaging' },
|
|
944
|
+
{ step: 'Non-idempotent consumer executes side effect again', domain: 'data-integrity' },
|
|
945
|
+
{ step: 'Duplicate database writes / notifications', domain: 'data-integrity' },
|
|
946
|
+
],
|
|
947
|
+
severity: 'HIGH',
|
|
948
|
+
name: 'Message Redelivery Side-Effect Chain',
|
|
949
|
+
mitigation: 'Idempotent consumer pattern + processed message dedup table + DLQ',
|
|
950
|
+
},
|
|
951
|
+
{
|
|
952
|
+
trigger: 'replication',
|
|
953
|
+
chain: [
|
|
954
|
+
{ step: 'Write committed to primary', domain: 'database' },
|
|
955
|
+
{ step: 'Async replication to read replica', domain: 'database' },
|
|
956
|
+
{ step: 'Client reads from replica before sync', domain: 'data-integrity' },
|
|
957
|
+
{ step: 'Stale data returned', domain: 'consistency' },
|
|
958
|
+
{ step: 'Client makes decision on stale data', domain: 'functional' },
|
|
959
|
+
],
|
|
960
|
+
severity: 'HIGH',
|
|
961
|
+
name: 'Replication Lag Read Staleness',
|
|
962
|
+
mitigation:
|
|
963
|
+
'Read-after-write from primary, causal consistency tokens, or sync replication for critical reads',
|
|
964
|
+
},
|
|
965
|
+
];
|
|
966
|
+
|
|
967
|
+
/**
|
|
968
|
+
* Discover second-order effect chains triggered by present tokens.
|
|
969
|
+
*
|
|
970
|
+
* @param {Set<string>} tokens
|
|
971
|
+
* @returns {Array<Object>} Matched chains
|
|
972
|
+
*/
|
|
973
|
+
function discoverSecondOrderEffects(tokens) {
|
|
974
|
+
const effects = [];
|
|
975
|
+
const seen = new Set();
|
|
976
|
+
|
|
977
|
+
for (const chain of EFFECT_CHAINS) {
|
|
978
|
+
if (tokens.has(chain.trigger) && !seen.has(chain.trigger)) {
|
|
979
|
+
seen.add(chain.trigger);
|
|
980
|
+
effects.push({
|
|
981
|
+
name: chain.name,
|
|
982
|
+
trigger: chain.trigger,
|
|
983
|
+
severity: chain.severity,
|
|
984
|
+
chain: chain.chain,
|
|
985
|
+
depth: chain.chain.length,
|
|
986
|
+
mitigation: chain.mitigation,
|
|
987
|
+
domains_affected: [...new Set(chain.chain.map(s => s.domain))],
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
return effects;
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
// ============================================================================
|
|
996
|
+
// 5. FAILURE PROPAGATION GRAPH (Section 17)
|
|
997
|
+
// ============================================================================
|
|
998
|
+
|
|
999
|
+
/**
|
|
1000
|
+
* Failure propagation rules.
|
|
1001
|
+
* Models how a failure in one component cascades to others.
|
|
1002
|
+
*/
|
|
1003
|
+
const FAILURE_PROPAGATION_RULES = [
|
|
1004
|
+
{
|
|
1005
|
+
source: 'cache',
|
|
1006
|
+
failure: 'Cache outage (Redis down)',
|
|
1007
|
+
propagation: [
|
|
1008
|
+
{
|
|
1009
|
+
target: 'database',
|
|
1010
|
+
effect: 'Traffic spike as all requests hit database',
|
|
1011
|
+
severity: 'HIGH',
|
|
1012
|
+
},
|
|
1013
|
+
{ target: 'api', effect: 'Latency spike from cache miss', severity: 'HIGH' },
|
|
1014
|
+
{ target: 'client', effect: 'Degraded response time', severity: 'MEDIUM' },
|
|
1015
|
+
],
|
|
1016
|
+
},
|
|
1017
|
+
{
|
|
1018
|
+
source: 'database',
|
|
1019
|
+
failure: 'Database saturation',
|
|
1020
|
+
propagation: [
|
|
1021
|
+
{ target: 'api', effect: 'Connection wait → request timeouts', severity: 'CRITICAL' },
|
|
1022
|
+
{
|
|
1023
|
+
target: 'queue_worker',
|
|
1024
|
+
effect: 'Worker jobs fail due to DB connection errors',
|
|
1025
|
+
severity: 'HIGH',
|
|
1026
|
+
},
|
|
1027
|
+
{ target: 'client', effect: 'HTTP 500 / 503 responses', severity: 'CRITICAL' },
|
|
1028
|
+
],
|
|
1029
|
+
},
|
|
1030
|
+
{
|
|
1031
|
+
source: 'external_api',
|
|
1032
|
+
failure: 'External API outage / degradation',
|
|
1033
|
+
propagation: [
|
|
1034
|
+
{ target: 'api', effect: 'Requests block waiting for external response', severity: 'HIGH' },
|
|
1035
|
+
{
|
|
1036
|
+
target: 'database',
|
|
1037
|
+
effect: 'Open transactions held longer, consuming connections',
|
|
1038
|
+
severity: 'MEDIUM',
|
|
1039
|
+
},
|
|
1040
|
+
{ target: 'client', effect: 'Timeout or partial failure visible to user', severity: 'HIGH' },
|
|
1041
|
+
],
|
|
1042
|
+
},
|
|
1043
|
+
{
|
|
1044
|
+
source: 'queue',
|
|
1045
|
+
failure: 'Message broker outage',
|
|
1046
|
+
propagation: [
|
|
1047
|
+
{ target: 'api', effect: 'Async operations fail silently or block', severity: 'HIGH' },
|
|
1048
|
+
{ target: 'queue_worker', effect: 'Workers idle, backlog accumulates', severity: 'HIGH' },
|
|
1049
|
+
{
|
|
1050
|
+
target: 'database',
|
|
1051
|
+
effect: 'If synchronous fallback, DB load increases',
|
|
1052
|
+
severity: 'MEDIUM',
|
|
1053
|
+
},
|
|
1054
|
+
],
|
|
1055
|
+
},
|
|
1056
|
+
{
|
|
1057
|
+
source: 'network',
|
|
1058
|
+
failure: 'Network partition between services',
|
|
1059
|
+
propagation: [
|
|
1060
|
+
{ target: 'microservices', effect: 'Service-to-service calls fail', severity: 'CRITICAL' },
|
|
1061
|
+
{ target: 'database', effect: 'If multi-region, replication may halt', severity: 'HIGH' },
|
|
1062
|
+
{ target: 'cache', effect: 'Cache cluster may split-brain', severity: 'HIGH' },
|
|
1063
|
+
],
|
|
1064
|
+
},
|
|
1065
|
+
{
|
|
1066
|
+
source: 'llm',
|
|
1067
|
+
failure: 'LLM provider outage / rate limit',
|
|
1068
|
+
propagation: [
|
|
1069
|
+
{ target: 'api', effect: 'AI-dependent endpoints fail', severity: 'HIGH' },
|
|
1070
|
+
{ target: 'queue_worker', effect: 'AI processing jobs pile up in queue', severity: 'MEDIUM' },
|
|
1071
|
+
{ target: 'client', effect: 'AI features unavailable', severity: 'MEDIUM' },
|
|
1072
|
+
],
|
|
1073
|
+
},
|
|
1074
|
+
];
|
|
1075
|
+
|
|
1076
|
+
/**
|
|
1077
|
+
* Discover relevant failure propagation paths based on present tokens.
|
|
1078
|
+
*
|
|
1079
|
+
* @param {Set<string>} tokens
|
|
1080
|
+
* @returns {Array<Object>} Matched propagation paths
|
|
1081
|
+
*/
|
|
1082
|
+
function discoverFailurePropagation(tokens) {
|
|
1083
|
+
const paths = [];
|
|
1084
|
+
|
|
1085
|
+
for (const rule of FAILURE_PROPAGATION_RULES) {
|
|
1086
|
+
if (tokens.has(rule.source)) {
|
|
1087
|
+
paths.push({
|
|
1088
|
+
source: rule.source,
|
|
1089
|
+
failure: rule.failure,
|
|
1090
|
+
cascading_effects: rule.propagation,
|
|
1091
|
+
severity: rule.propagation[0]?.severity || 'MEDIUM',
|
|
1092
|
+
domains: [rule.source, ...rule.propagation.map(p => p.target)],
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
return paths;
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
// ============================================================================
|
|
1101
|
+
// 6. RESOURCE CONTENTION ANALYSIS (Section 18)
|
|
1102
|
+
// ============================================================================
|
|
1103
|
+
|
|
1104
|
+
const SHARED_RESOURCES = [
|
|
1105
|
+
{
|
|
1106
|
+
resource: 'Database Connection Pool',
|
|
1107
|
+
match: ['database', 'connection_pool'],
|
|
1108
|
+
contenders: ['api_requests', 'background_workers', 'retry_logic', 'health_checks'],
|
|
1109
|
+
risk: 'Pool exhaustion blocks all database operations',
|
|
1110
|
+
mitigation: 'Separate pools for API and workers, connection limits per component',
|
|
1111
|
+
},
|
|
1112
|
+
{
|
|
1113
|
+
resource: 'CPU',
|
|
1114
|
+
match: ['llm', 'search', 'encryption'],
|
|
1115
|
+
contenders: ['llm_inference', 'search_indexing', 'encryption_operations', 'request_processing'],
|
|
1116
|
+
risk: 'CPU-intensive operations starve request processing threads',
|
|
1117
|
+
mitigation: 'Isolate CPU-intensive workloads to dedicated workers/pods',
|
|
1118
|
+
},
|
|
1119
|
+
{
|
|
1120
|
+
resource: 'Memory',
|
|
1121
|
+
match: ['cache', 'llm', 'file_upload'],
|
|
1122
|
+
contenders: ['cache_storage', 'llm_context', 'file_buffers', 'request_bodies'],
|
|
1123
|
+
risk: 'Memory exhaustion (OOM) crashes the process',
|
|
1124
|
+
mitigation: 'Memory limits, streaming processing, bounded cache eviction',
|
|
1125
|
+
},
|
|
1126
|
+
{
|
|
1127
|
+
resource: 'Network Bandwidth',
|
|
1128
|
+
match: ['replication', 'file_upload', 'llm'],
|
|
1129
|
+
contenders: ['database_replication', 'file_transfers', 'llm_streaming', 'client_traffic'],
|
|
1130
|
+
risk: 'Bandwidth saturation increases latency for all traffic',
|
|
1131
|
+
mitigation: 'Traffic shaping, compression, CDN for static assets',
|
|
1132
|
+
},
|
|
1133
|
+
{
|
|
1134
|
+
resource: 'API Quota',
|
|
1135
|
+
match: ['external_api', 'llm', 'payment'],
|
|
1136
|
+
contenders: ['user_requests', 'retry_logic', 'background_processing'],
|
|
1137
|
+
risk: 'Quota exhaustion blocks all external API calls',
|
|
1138
|
+
mitigation: 'Quota-aware rate limiting, request batching, caching API responses',
|
|
1139
|
+
},
|
|
1140
|
+
{
|
|
1141
|
+
resource: 'Queue Capacity',
|
|
1142
|
+
match: ['queue'],
|
|
1143
|
+
contenders: ['producers', 'retry_requeue', 'dead_letter_overflow'],
|
|
1144
|
+
risk: 'Queue backlog growth causes memory pressure on broker',
|
|
1145
|
+
mitigation: 'Backpressure, consumer auto-scaling, queue depth monitoring',
|
|
1146
|
+
},
|
|
1147
|
+
];
|
|
1148
|
+
|
|
1149
|
+
/**
|
|
1150
|
+
* Identify shared resource contention risks.
|
|
1151
|
+
*
|
|
1152
|
+
* @param {Set<string>} tokens
|
|
1153
|
+
* @returns {Array<Object>} Contention risks
|
|
1154
|
+
*/
|
|
1155
|
+
function analyzeResourceContention(tokens) {
|
|
1156
|
+
const risks = [];
|
|
1157
|
+
|
|
1158
|
+
for (const sr of SHARED_RESOURCES) {
|
|
1159
|
+
const matching = sr.match.filter(m => tokens.has(m));
|
|
1160
|
+
if (matching.length >= 1) {
|
|
1161
|
+
risks.push({
|
|
1162
|
+
resource: sr.resource,
|
|
1163
|
+
triggered_by: matching,
|
|
1164
|
+
contenders: sr.contenders,
|
|
1165
|
+
risk: sr.risk,
|
|
1166
|
+
mitigation: sr.mitigation,
|
|
1167
|
+
severity: matching.length >= 2 ? INTERACTION_PRIORITY.HIGH : INTERACTION_PRIORITY.MEDIUM,
|
|
1168
|
+
});
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
return risks;
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
// ============================================================================
|
|
1176
|
+
// 7. SECURITY BOUNDARY ANALYSIS (Section 19)
|
|
1177
|
+
// ============================================================================
|
|
1178
|
+
|
|
1179
|
+
/**
|
|
1180
|
+
* Analyze security boundary propagation.
|
|
1181
|
+
*
|
|
1182
|
+
* @param {Set<string>} tokens
|
|
1183
|
+
* @param {string} taskQuery
|
|
1184
|
+
* @returns {Object} Security boundary analysis
|
|
1185
|
+
*/
|
|
1186
|
+
function analyzeSecurityBoundaries(tokens, taskQuery) {
|
|
1187
|
+
const concerns = [];
|
|
1188
|
+
|
|
1189
|
+
if (tokens.has('multi_tenancy')) {
|
|
1190
|
+
concerns.push({
|
|
1191
|
+
boundary: 'Tenant Isolation',
|
|
1192
|
+
question:
|
|
1193
|
+
'Does tenant identity propagate through ALL system components (DB, cache, queue, workers)?',
|
|
1194
|
+
risk: 'Missing tenant scoping at any boundary enables cross-tenant data access',
|
|
1195
|
+
priority: INTERACTION_PRIORITY.CRITICAL,
|
|
1196
|
+
components_to_verify: [
|
|
1197
|
+
'database queries',
|
|
1198
|
+
'cache keys',
|
|
1199
|
+
'queue messages',
|
|
1200
|
+
'worker context',
|
|
1201
|
+
'API responses',
|
|
1202
|
+
],
|
|
1203
|
+
});
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
if (tokens.has('authentication') || tokens.has('authorization')) {
|
|
1207
|
+
concerns.push({
|
|
1208
|
+
boundary: 'Authentication/Authorization',
|
|
1209
|
+
question: 'Is auth enforced BEFORE business logic at every endpoint?',
|
|
1210
|
+
risk: 'Auth bypass allows unauthorized access to protected resources',
|
|
1211
|
+
priority: INTERACTION_PRIORITY.CRITICAL,
|
|
1212
|
+
components_to_verify: [
|
|
1213
|
+
'API middleware',
|
|
1214
|
+
'WebSocket connections',
|
|
1215
|
+
'background jobs',
|
|
1216
|
+
'webhook handlers',
|
|
1217
|
+
],
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
if (tokens.has('agent') || tokens.has('tool_execution')) {
|
|
1222
|
+
concerns.push({
|
|
1223
|
+
boundary: 'AI Agent Sandbox',
|
|
1224
|
+
question: 'Can the agent execute operations outside its permitted scope?',
|
|
1225
|
+
risk: 'Prompt injection → tool invocation → unauthorized system access',
|
|
1226
|
+
priority: INTERACTION_PRIORITY.CRITICAL,
|
|
1227
|
+
components_to_verify: [
|
|
1228
|
+
'tool allowlist',
|
|
1229
|
+
'filesystem access policy',
|
|
1230
|
+
'network access policy',
|
|
1231
|
+
'credential isolation',
|
|
1232
|
+
],
|
|
1233
|
+
});
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
if (tokens.has('cache') && (tokens.has('authorization') || tokens.has('multi_tenancy'))) {
|
|
1237
|
+
concerns.push({
|
|
1238
|
+
boundary: 'Cache Security',
|
|
1239
|
+
question: 'Can cached data leak across authorization or tenant boundaries?',
|
|
1240
|
+
risk: 'Shared cache keys return data belonging to other users/tenants',
|
|
1241
|
+
priority: INTERACTION_PRIORITY.CRITICAL,
|
|
1242
|
+
components_to_verify: [
|
|
1243
|
+
'cache key format includes tenant/user scope',
|
|
1244
|
+
'cache TTL for auth data',
|
|
1245
|
+
'invalidation on permission change',
|
|
1246
|
+
],
|
|
1247
|
+
});
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
if (tokens.has('queue') && tokens.has('multi_tenancy')) {
|
|
1251
|
+
concerns.push({
|
|
1252
|
+
boundary: 'Queue Tenant Propagation',
|
|
1253
|
+
question: 'Do queue messages carry and validate tenant context?',
|
|
1254
|
+
risk: 'Workers processing jobs without tenant context operate on wrong tenant data',
|
|
1255
|
+
priority: INTERACTION_PRIORITY.HIGH,
|
|
1256
|
+
components_to_verify: [
|
|
1257
|
+
'message payload includes tenant_id',
|
|
1258
|
+
'worker validates tenant context before DB access',
|
|
1259
|
+
],
|
|
1260
|
+
});
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
return {
|
|
1264
|
+
concerns,
|
|
1265
|
+
total: concerns.length,
|
|
1266
|
+
has_critical: concerns.some(c => c.priority === INTERACTION_PRIORITY.CRITICAL),
|
|
1267
|
+
};
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
// ============================================================================
|
|
1271
|
+
// 8. CONSTRAINT CONFLICT DETECTION (Section 15)
|
|
1272
|
+
// ============================================================================
|
|
1273
|
+
|
|
1274
|
+
const CONSTRAINT_CONFLICTS = [
|
|
1275
|
+
{
|
|
1276
|
+
a: 'security',
|
|
1277
|
+
b: 'performance',
|
|
1278
|
+
conflict: 'Security controls (encryption, auth checks, input validation) add latency',
|
|
1279
|
+
resolution:
|
|
1280
|
+
'Cannot eliminate — quantify the cost and set latency budget that includes security overhead',
|
|
1281
|
+
},
|
|
1282
|
+
{
|
|
1283
|
+
a: 'consistency',
|
|
1284
|
+
b: 'availability',
|
|
1285
|
+
conflict: 'Strong consistency requires coordination that reduces availability (CAP theorem)',
|
|
1286
|
+
resolution: 'Choose consistency model per use case: strong for payments, eventual for feeds',
|
|
1287
|
+
},
|
|
1288
|
+
{
|
|
1289
|
+
a: 'consistency',
|
|
1290
|
+
b: 'performance',
|
|
1291
|
+
conflict: 'Strong consistency (serializable transactions) reduces throughput',
|
|
1292
|
+
resolution: 'Use minimum sufficient isolation level per operation',
|
|
1293
|
+
},
|
|
1294
|
+
{
|
|
1295
|
+
a: 'cost',
|
|
1296
|
+
b: 'performance',
|
|
1297
|
+
conflict: 'Lower latency requires more infrastructure (caching, CDN, replicas)',
|
|
1298
|
+
resolution: 'Set performance targets, then optimize cost to meet them — not the reverse',
|
|
1299
|
+
},
|
|
1300
|
+
{
|
|
1301
|
+
a: 'cost',
|
|
1302
|
+
b: 'reliability',
|
|
1303
|
+
conflict: 'Higher reliability requires redundancy, which increases cost',
|
|
1304
|
+
resolution: 'Define SLA targets and design redundancy to meet them',
|
|
1305
|
+
},
|
|
1306
|
+
{
|
|
1307
|
+
a: 'security',
|
|
1308
|
+
b: 'cost',
|
|
1309
|
+
conflict: 'Security controls (WAF, encryption, audit logging) add infrastructure cost',
|
|
1310
|
+
resolution: 'Security is non-negotiable for regulated data; budget accordingly',
|
|
1311
|
+
},
|
|
1312
|
+
{
|
|
1313
|
+
a: 'scalability',
|
|
1314
|
+
b: 'consistency',
|
|
1315
|
+
conflict: 'Horizontal scaling requires data partitioning that complicates consistency',
|
|
1316
|
+
resolution:
|
|
1317
|
+
'Partition by bounded context; use strong consistency within partition, eventual across',
|
|
1318
|
+
},
|
|
1319
|
+
{
|
|
1320
|
+
a: 'observability',
|
|
1321
|
+
b: 'performance',
|
|
1322
|
+
conflict: 'Detailed tracing and logging add overhead to every request',
|
|
1323
|
+
resolution: 'Sample traces at high volume; always log errors and critical paths',
|
|
1324
|
+
},
|
|
1325
|
+
];
|
|
1326
|
+
|
|
1327
|
+
/**
|
|
1328
|
+
* Detect constraint conflicts from tokens.
|
|
1329
|
+
*
|
|
1330
|
+
* @param {Set<string>} tokens
|
|
1331
|
+
* @returns {Array<Object>} Detected conflicts
|
|
1332
|
+
*/
|
|
1333
|
+
function detectConstraintConflicts(tokens) {
|
|
1334
|
+
const conflicts = [];
|
|
1335
|
+
|
|
1336
|
+
for (const cc of CONSTRAINT_CONFLICTS) {
|
|
1337
|
+
const aPresent = tokens.has(cc.a) || tokens.has(cc.a.replace(/_/g, ''));
|
|
1338
|
+
const bPresent = tokens.has(cc.b) || tokens.has(cc.b.replace(/_/g, ''));
|
|
1339
|
+
|
|
1340
|
+
if (aPresent && bPresent) {
|
|
1341
|
+
conflicts.push({
|
|
1342
|
+
constraint_a: cc.a,
|
|
1343
|
+
constraint_b: cc.b,
|
|
1344
|
+
conflict: cc.conflict,
|
|
1345
|
+
resolution: cc.resolution,
|
|
1346
|
+
priority: INTERACTION_PRIORITY.HIGH,
|
|
1347
|
+
});
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
return conflicts;
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
// ============================================================================
|
|
1355
|
+
// 9. TRADEOFF GRAPH (Section 16)
|
|
1356
|
+
// ============================================================================
|
|
1357
|
+
|
|
1358
|
+
/**
|
|
1359
|
+
* Build decision tradeoff representations.
|
|
1360
|
+
*
|
|
1361
|
+
* @param {Array} interactions
|
|
1362
|
+
* @param {Array} secondOrderEffects
|
|
1363
|
+
* @returns {Array<Object>} Tradeoff decisions
|
|
1364
|
+
*/
|
|
1365
|
+
function buildTradeoffGraph(interactions, secondOrderEffects) {
|
|
1366
|
+
const tradeoffs = [];
|
|
1367
|
+
|
|
1368
|
+
// Extract tradeoff-type interactions
|
|
1369
|
+
for (const i of interactions || []) {
|
|
1370
|
+
if (i.relationship === RELATIONSHIP_TYPES.TRADEOFF) {
|
|
1371
|
+
tradeoffs.push({
|
|
1372
|
+
decision: `${i.a} ↔ ${i.b}`,
|
|
1373
|
+
relationship: RELATIONSHIP_TYPES.TRADEOFF,
|
|
1374
|
+
benefits: [i.effect.split(' but ')[0] || i.effect],
|
|
1375
|
+
costs: i.effect.includes(' but ') ? [i.effect.split(' but ')[1]] : [],
|
|
1376
|
+
risks: [],
|
|
1377
|
+
domains: i.domains,
|
|
1378
|
+
priority: i.priority,
|
|
1379
|
+
});
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
// Extract tradeoffs from second-order effects
|
|
1384
|
+
for (const soe of secondOrderEffects || []) {
|
|
1385
|
+
const benefits = soe.chain.slice(0, 1).map(s => s.step);
|
|
1386
|
+
const costs = soe.chain.slice(1).map(s => s.step);
|
|
1387
|
+
tradeoffs.push({
|
|
1388
|
+
decision: soe.trigger,
|
|
1389
|
+
relationship: 'SECOND_ORDER',
|
|
1390
|
+
benefits,
|
|
1391
|
+
costs,
|
|
1392
|
+
risks: [soe.chain[soe.chain.length - 1]?.step || ''],
|
|
1393
|
+
domains: soe.domains_affected,
|
|
1394
|
+
priority:
|
|
1395
|
+
soe.severity === 'CRITICAL' ? INTERACTION_PRIORITY.CRITICAL : INTERACTION_PRIORITY.HIGH,
|
|
1396
|
+
mitigation: soe.mitigation,
|
|
1397
|
+
});
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
return tradeoffs;
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
// ============================================================================
|
|
1404
|
+
// 10. CROSS-DOMAIN VALIDATION REQUIREMENTS (Section 31)
|
|
1405
|
+
// ============================================================================
|
|
1406
|
+
|
|
1407
|
+
/**
|
|
1408
|
+
* Generate Phase 8 validation requirements from detected interactions.
|
|
1409
|
+
*
|
|
1410
|
+
* @param {Array} interactions
|
|
1411
|
+
* @param {Array} secondOrderEffects
|
|
1412
|
+
* @param {Array} failurePropagation
|
|
1413
|
+
* @param {Object} securityBoundaries
|
|
1414
|
+
* @returns {Array<Object>} Validation requirements for Phase 8
|
|
1415
|
+
*/
|
|
1416
|
+
function generateValidationRequirements(
|
|
1417
|
+
interactions,
|
|
1418
|
+
secondOrderEffects,
|
|
1419
|
+
failurePropagation,
|
|
1420
|
+
securityBoundaries,
|
|
1421
|
+
) {
|
|
1422
|
+
const requirements = [];
|
|
1423
|
+
const seen = new Set();
|
|
1424
|
+
|
|
1425
|
+
// From interactions
|
|
1426
|
+
for (const i of interactions || []) {
|
|
1427
|
+
if (i.validation) {
|
|
1428
|
+
for (const v of i.validation) {
|
|
1429
|
+
if (!seen.has(v)) {
|
|
1430
|
+
seen.add(v);
|
|
1431
|
+
requirements.push({
|
|
1432
|
+
test: v,
|
|
1433
|
+
source: `interaction:${i.a}↔${i.b}`,
|
|
1434
|
+
priority: i.priority,
|
|
1435
|
+
reason: i.effect,
|
|
1436
|
+
type: 'interaction',
|
|
1437
|
+
});
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
// From second-order effects
|
|
1444
|
+
for (const soe of secondOrderEffects || []) {
|
|
1445
|
+
const testName = `second_order_${soe.trigger}_cascade_test`;
|
|
1446
|
+
if (!seen.has(testName)) {
|
|
1447
|
+
seen.add(testName);
|
|
1448
|
+
requirements.push({
|
|
1449
|
+
test: testName,
|
|
1450
|
+
source: `second_order:${soe.name}`,
|
|
1451
|
+
priority:
|
|
1452
|
+
soe.severity === 'CRITICAL' ? INTERACTION_PRIORITY.CRITICAL : INTERACTION_PRIORITY.HIGH,
|
|
1453
|
+
reason: `Verify ${soe.name} cascade does not materialize under load`,
|
|
1454
|
+
type: 'second_order',
|
|
1455
|
+
});
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
// From failure propagation
|
|
1460
|
+
for (const fp of failurePropagation || []) {
|
|
1461
|
+
const testName = `failure_propagation_${fp.source}_test`;
|
|
1462
|
+
if (!seen.has(testName)) {
|
|
1463
|
+
seen.add(testName);
|
|
1464
|
+
requirements.push({
|
|
1465
|
+
test: testName,
|
|
1466
|
+
source: `failure_propagation:${fp.source}`,
|
|
1467
|
+
priority:
|
|
1468
|
+
fp.severity === 'CRITICAL' ? INTERACTION_PRIORITY.CRITICAL : INTERACTION_PRIORITY.HIGH,
|
|
1469
|
+
reason: `Verify graceful degradation when ${fp.source} fails: ${fp.failure}`,
|
|
1470
|
+
type: 'failure_propagation',
|
|
1471
|
+
});
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
// From security boundaries
|
|
1476
|
+
for (const sb of (securityBoundaries && securityBoundaries.concerns) || []) {
|
|
1477
|
+
for (const component of sb.components_to_verify) {
|
|
1478
|
+
const testName = `security_boundary_${sb.boundary.toLowerCase().replace(/\s+/g, '_')}_${component.replace(/\s+/g, '_')}`;
|
|
1479
|
+
if (!seen.has(testName)) {
|
|
1480
|
+
seen.add(testName);
|
|
1481
|
+
requirements.push({
|
|
1482
|
+
test: testName,
|
|
1483
|
+
source: `security_boundary:${sb.boundary}`,
|
|
1484
|
+
priority: sb.priority,
|
|
1485
|
+
reason: sb.question,
|
|
1486
|
+
type: 'security_boundary',
|
|
1487
|
+
});
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
return requirements;
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
// ============================================================================
|
|
1496
|
+
// 11. BLIND SPOT DETECTION (Section 38)
|
|
1497
|
+
// ============================================================================
|
|
1498
|
+
|
|
1499
|
+
/**
|
|
1500
|
+
* Detect domains that are relevant but have no skill coverage or interaction analysis.
|
|
1501
|
+
*
|
|
1502
|
+
* @param {Array} concepts
|
|
1503
|
+
* @param {Array} interactions
|
|
1504
|
+
* @param {Set<string>} tokens
|
|
1505
|
+
* @returns {Array<Object>} Blind spots
|
|
1506
|
+
*/
|
|
1507
|
+
function detectBlindSpots(concepts, interactions, tokens) {
|
|
1508
|
+
const blindSpots = [];
|
|
1509
|
+
|
|
1510
|
+
// Domains that should be considered based on token presence
|
|
1511
|
+
const expectedDomains = new Set();
|
|
1512
|
+
if (tokens.has('payment') || tokens.has('database')) expectedDomains.add('data-integrity');
|
|
1513
|
+
if (tokens.has('api') || tokens.has('external_api')) expectedDomains.add('rate_limiting');
|
|
1514
|
+
if (tokens.has('llm') || tokens.has('agent')) expectedDomains.add('cost');
|
|
1515
|
+
if (tokens.has('database') || tokens.has('cache')) expectedDomains.add('observability');
|
|
1516
|
+
if (tokens.has('queue') || tokens.has('microservices')) expectedDomains.add('observability');
|
|
1517
|
+
if (tokens.has('file_upload')) expectedDomains.add('storage_exhaustion');
|
|
1518
|
+
if (tokens.has('multi_tenancy')) expectedDomains.add('data_isolation');
|
|
1519
|
+
if (tokens.has('retry')) expectedDomains.add('idempotency');
|
|
1520
|
+
|
|
1521
|
+
// Check which expected domains aren't covered by concepts or interactions
|
|
1522
|
+
const coveredDomains = new Set([
|
|
1523
|
+
...(concepts || []).map(c => c.domain),
|
|
1524
|
+
...(interactions || []).flatMap(i => i.domains || []),
|
|
1525
|
+
]);
|
|
1526
|
+
|
|
1527
|
+
for (const expected of expectedDomains) {
|
|
1528
|
+
if (!coveredDomains.has(expected) && !tokens.has(expected)) {
|
|
1529
|
+
blindSpots.push({
|
|
1530
|
+
domain: expected,
|
|
1531
|
+
status: 'CAPABILITY_GAP',
|
|
1532
|
+
reason: `Domain "${expected}" is likely relevant but has no explicit consideration`,
|
|
1533
|
+
recommendation:
|
|
1534
|
+
'Review whether this domain needs skill coverage or explicit interaction analysis',
|
|
1535
|
+
});
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
return blindSpots;
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
// ============================================================================
|
|
1543
|
+
// 12. EMERGENT FAILURE PATTERNS (Section 25)
|
|
1544
|
+
// ============================================================================
|
|
1545
|
+
|
|
1546
|
+
const EMERGENT_FAILURE_PATTERNS = [
|
|
1547
|
+
{
|
|
1548
|
+
components: ['retry', 'timeout', 'rate_limiting'],
|
|
1549
|
+
pattern: 'Retry Amplification',
|
|
1550
|
+
description:
|
|
1551
|
+
'Retries consume rate-limit budget, causing legitimate traffic to be throttled, triggering more timeouts and retries',
|
|
1552
|
+
severity: 'CRITICAL',
|
|
1553
|
+
},
|
|
1554
|
+
{
|
|
1555
|
+
components: ['cache', 'authorization', 'multi_tenancy'],
|
|
1556
|
+
pattern: 'Cross-Tenant Cache Leakage',
|
|
1557
|
+
description:
|
|
1558
|
+
'Cached authorization data with insufficient tenant scoping leaks permissions across tenants',
|
|
1559
|
+
severity: 'CRITICAL',
|
|
1560
|
+
},
|
|
1561
|
+
{
|
|
1562
|
+
components: ['queue', 'idempotency'],
|
|
1563
|
+
pattern: 'Duplicate Side Effects',
|
|
1564
|
+
description:
|
|
1565
|
+
'At-least-once delivery with non-idempotent consumers produces duplicate business effects',
|
|
1566
|
+
severity: 'HIGH',
|
|
1567
|
+
},
|
|
1568
|
+
{
|
|
1569
|
+
components: ['autoscaling', 'cold_start'],
|
|
1570
|
+
pattern: 'Capacity Lag',
|
|
1571
|
+
description:
|
|
1572
|
+
'Autoscaling during traffic burst introduces cold-start latency, failing to meet SLA during scale-up window',
|
|
1573
|
+
severity: 'MEDIUM',
|
|
1574
|
+
},
|
|
1575
|
+
{
|
|
1576
|
+
components: ['llm', 'agent', 'prompt_injection'],
|
|
1577
|
+
pattern: 'Agent Privilege Escalation via Injection',
|
|
1578
|
+
description:
|
|
1579
|
+
'Prompt injection tricks agent into executing unauthorized tools, accessing credentials or exfiltrating data',
|
|
1580
|
+
severity: 'CRITICAL',
|
|
1581
|
+
},
|
|
1582
|
+
{
|
|
1583
|
+
components: ['database', 'cache', 'consistency'],
|
|
1584
|
+
pattern: 'Dual Source of Truth',
|
|
1585
|
+
description:
|
|
1586
|
+
'Cache and database diverge; reads from cache return stale data while database has the correct state',
|
|
1587
|
+
severity: 'HIGH',
|
|
1588
|
+
},
|
|
1589
|
+
{
|
|
1590
|
+
components: ['retry', 'external_api', 'cost'],
|
|
1591
|
+
pattern: 'Runaway API Cost',
|
|
1592
|
+
description:
|
|
1593
|
+
'Aggressive retries against expensive external API (LLM, payment) multiply per-request cost',
|
|
1594
|
+
severity: 'HIGH',
|
|
1595
|
+
},
|
|
1596
|
+
{
|
|
1597
|
+
components: ['database', 'retry', 'connection_pool'],
|
|
1598
|
+
pattern: 'Connection Pool Starvation',
|
|
1599
|
+
description:
|
|
1600
|
+
'Retries hold database connections longer, starving other requests and creating cascading failures',
|
|
1601
|
+
severity: 'HIGH',
|
|
1602
|
+
},
|
|
1603
|
+
{
|
|
1604
|
+
components: ['encryption', 'search'],
|
|
1605
|
+
pattern: 'Encrypted Data Unsearchable',
|
|
1606
|
+
description:
|
|
1607
|
+
'Full-text search cannot index encrypted fields without specialized searchable encryption',
|
|
1608
|
+
severity: 'MEDIUM',
|
|
1609
|
+
},
|
|
1610
|
+
{
|
|
1611
|
+
components: ['multi_tenancy', 'queue'],
|
|
1612
|
+
pattern: 'Noisy Neighbor Queue Starvation',
|
|
1613
|
+
description: "One tenant's high-volume queue production starves processing for other tenants",
|
|
1614
|
+
severity: 'HIGH',
|
|
1615
|
+
},
|
|
1616
|
+
];
|
|
1617
|
+
|
|
1618
|
+
/**
|
|
1619
|
+
* Detect emergent failure patterns from present tokens.
|
|
1620
|
+
*
|
|
1621
|
+
* @param {Set<string>} tokens
|
|
1622
|
+
* @returns {Array<Object>} Detected emergent failures
|
|
1623
|
+
*/
|
|
1624
|
+
function detectEmergentFailures(tokens) {
|
|
1625
|
+
const detected = [];
|
|
1626
|
+
|
|
1627
|
+
for (const pattern of EMERGENT_FAILURE_PATTERNS) {
|
|
1628
|
+
// At least 2 of the components must be present
|
|
1629
|
+
const presentCount = pattern.components.filter(c => tokens.has(c)).length;
|
|
1630
|
+
if (presentCount >= 2) {
|
|
1631
|
+
detected.push({
|
|
1632
|
+
pattern: pattern.pattern,
|
|
1633
|
+
description: pattern.description,
|
|
1634
|
+
severity: pattern.severity,
|
|
1635
|
+
components_present: pattern.components.filter(c => tokens.has(c)),
|
|
1636
|
+
components_total: pattern.components,
|
|
1637
|
+
completeness: presentCount / pattern.components.length,
|
|
1638
|
+
evidence: `${presentCount}/${pattern.components.length} components detected in task`,
|
|
1639
|
+
});
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
return detected;
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
// ============================================================================
|
|
1647
|
+
// 13. PHASE 9 METRICS TRACKER (Section 43)
|
|
1648
|
+
// ============================================================================
|
|
1649
|
+
|
|
1650
|
+
class Phase9MetricsTracker {
|
|
1651
|
+
constructor() {
|
|
1652
|
+
this.metrics = {
|
|
1653
|
+
tasks_analyzed: 0,
|
|
1654
|
+
interactions_discovered: 0,
|
|
1655
|
+
inferred_interactions: 0,
|
|
1656
|
+
second_order_effects: 0,
|
|
1657
|
+
failure_propagations: 0,
|
|
1658
|
+
resource_contentions: 0,
|
|
1659
|
+
security_concerns: 0,
|
|
1660
|
+
constraint_conflicts: 0,
|
|
1661
|
+
emergent_failures: 0,
|
|
1662
|
+
blind_spots: 0,
|
|
1663
|
+
validation_requirements_generated: 0,
|
|
1664
|
+
false_positives: 0,
|
|
1665
|
+
true_positives: 0,
|
|
1666
|
+
};
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
record(metric, count = 1) {
|
|
1670
|
+
if (this.metrics[metric] !== undefined) {
|
|
1671
|
+
this.metrics[metric] += count;
|
|
1672
|
+
} else {
|
|
1673
|
+
this.metrics[metric] = count;
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
recordEvent(event, count = 1) {
|
|
1678
|
+
this.record(event, count);
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1681
|
+
getMetrics() {
|
|
1682
|
+
return { ...this.metrics };
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1685
|
+
getPrecision() {
|
|
1686
|
+
const total = (this.metrics.true_positives || 0) + (this.metrics.false_positives || 0);
|
|
1687
|
+
return total > 0 ? (this.metrics.true_positives || 0) / total : 1;
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
let _phase9MetricsTracker = null;
|
|
1692
|
+
|
|
1693
|
+
function getPhase9MetricsTracker() {
|
|
1694
|
+
if (!_phase9MetricsTracker) {
|
|
1695
|
+
_phase9MetricsTracker = new Phase9MetricsTracker();
|
|
1696
|
+
}
|
|
1697
|
+
return _phase9MetricsTracker;
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1700
|
+
// ============================================================================
|
|
1701
|
+
// 14. MAIN ORCHESTRATOR — runCrossDomainAnalysis
|
|
1702
|
+
// ============================================================================
|
|
1703
|
+
|
|
1704
|
+
/**
|
|
1705
|
+
* Run the full Phase 9 cross-domain interaction analysis.
|
|
1706
|
+
*
|
|
1707
|
+
* @param {string} taskQuery
|
|
1708
|
+
* @param {Object} [conceptData] - Output from concept_extractor.extractConcepts()
|
|
1709
|
+
* @param {Object} [options]
|
|
1710
|
+
* @returns {Object} Full cross-domain analysis
|
|
1711
|
+
*/
|
|
1712
|
+
function runCrossDomainAnalysis(taskQuery, conceptData, options = {}) {
|
|
1713
|
+
const q = (taskQuery || '').trim();
|
|
1714
|
+
const tracker = getPhase9MetricsTracker();
|
|
1715
|
+
tracker.record('tasks_analyzed');
|
|
1716
|
+
|
|
1717
|
+
// Step 0: Quick bail for trivial tasks
|
|
1718
|
+
if (/^(?:fix\s|typo|css\s|format|rename|lint|style|readme|comment|doc)/i.test(q)) {
|
|
1719
|
+
return {
|
|
1720
|
+
task: q,
|
|
1721
|
+
skipped: true,
|
|
1722
|
+
reason: 'Task does not require cross-domain analysis',
|
|
1723
|
+
interactions: [],
|
|
1724
|
+
second_order_effects: [],
|
|
1725
|
+
failure_propagation: [],
|
|
1726
|
+
resource_contention: [],
|
|
1727
|
+
security_boundaries: { concerns: [], total: 0 },
|
|
1728
|
+
constraint_conflicts: [],
|
|
1729
|
+
emergent_failures: [],
|
|
1730
|
+
tradeoffs: [],
|
|
1731
|
+
blind_spots: [],
|
|
1732
|
+
validation_requirements: [],
|
|
1733
|
+
};
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
// Step 1: Extract interaction tokens
|
|
1737
|
+
let concepts = [];
|
|
1738
|
+
if (conceptData && conceptData.all_concepts) {
|
|
1739
|
+
concepts = conceptData.all_concepts;
|
|
1740
|
+
} else if (Array.isArray(conceptData)) {
|
|
1741
|
+
concepts = conceptData;
|
|
1742
|
+
} else {
|
|
1743
|
+
try {
|
|
1744
|
+
const { extractConcepts } = require('./concept_extractor');
|
|
1745
|
+
const extracted = extractConcepts(q, process.cwd());
|
|
1746
|
+
concepts = extracted ? extracted.all_concepts || [] : [];
|
|
1747
|
+
} catch {
|
|
1748
|
+
concepts = [];
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
const tokens = extractInteractionTokens(concepts, taskQuery);
|
|
1752
|
+
|
|
1753
|
+
// Step 2: Discover direct interactions
|
|
1754
|
+
const directInteractions = discoverInteractions(tokens);
|
|
1755
|
+
tracker.record('interactions_discovered', directInteractions.length);
|
|
1756
|
+
|
|
1757
|
+
// Step 3: Discover inferred interactions
|
|
1758
|
+
const inferredInteractions = discoverInferredInteractions(tokens, taskQuery);
|
|
1759
|
+
tracker.record('inferred_interactions', inferredInteractions.length);
|
|
1760
|
+
|
|
1761
|
+
const allInteractions = [...directInteractions, ...inferredInteractions];
|
|
1762
|
+
|
|
1763
|
+
// Step 4: Discover second-order effects
|
|
1764
|
+
const secondOrderEffects = discoverSecondOrderEffects(tokens);
|
|
1765
|
+
tracker.record('second_order_effects', secondOrderEffects.length);
|
|
1766
|
+
|
|
1767
|
+
// Step 5: Discover failure propagation
|
|
1768
|
+
const failurePropagation = discoverFailurePropagation(tokens);
|
|
1769
|
+
tracker.record('failure_propagations', failurePropagation.length);
|
|
1770
|
+
|
|
1771
|
+
// Step 6: Analyze resource contention
|
|
1772
|
+
const resourceContention = analyzeResourceContention(tokens);
|
|
1773
|
+
tracker.record('resource_contentions', resourceContention.length);
|
|
1774
|
+
|
|
1775
|
+
// Step 7: Analyze security boundaries
|
|
1776
|
+
const securityBoundaries = analyzeSecurityBoundaries(tokens, taskQuery);
|
|
1777
|
+
tracker.record('security_concerns', securityBoundaries.total);
|
|
1778
|
+
|
|
1779
|
+
// Step 8: Detect constraint conflicts
|
|
1780
|
+
const constraintConflicts = detectConstraintConflicts(tokens);
|
|
1781
|
+
tracker.record('constraint_conflicts', constraintConflicts.length);
|
|
1782
|
+
|
|
1783
|
+
// Step 9: Detect emergent failures
|
|
1784
|
+
const emergentFailures = detectEmergentFailures(tokens);
|
|
1785
|
+
tracker.record('emergent_failures', emergentFailures.length);
|
|
1786
|
+
|
|
1787
|
+
// Step 10: Build tradeoff graph
|
|
1788
|
+
const tradeoffs = buildTradeoffGraph(allInteractions, secondOrderEffects);
|
|
1789
|
+
|
|
1790
|
+
// Step 11: Detect blind spots
|
|
1791
|
+
const blindSpots = detectBlindSpots(concepts, allInteractions, tokens);
|
|
1792
|
+
tracker.record('blind_spots', blindSpots.length);
|
|
1793
|
+
|
|
1794
|
+
// Step 12: Generate validation requirements for Phase 8
|
|
1795
|
+
const validationRequirements = generateValidationRequirements(
|
|
1796
|
+
allInteractions,
|
|
1797
|
+
secondOrderEffects,
|
|
1798
|
+
failurePropagation,
|
|
1799
|
+
securityBoundaries,
|
|
1800
|
+
);
|
|
1801
|
+
tracker.record('validation_requirements_generated', validationRequirements.length);
|
|
1802
|
+
|
|
1803
|
+
// Step 13: Compute summary domains
|
|
1804
|
+
const allDomains = new Set();
|
|
1805
|
+
for (const i of allInteractions) (i.domains || []).forEach(d => allDomains.add(d));
|
|
1806
|
+
for (const soe of secondOrderEffects)
|
|
1807
|
+
(soe.domains_affected || []).forEach(d => allDomains.add(d));
|
|
1808
|
+
|
|
1809
|
+
return {
|
|
1810
|
+
task: q,
|
|
1811
|
+
skipped: false,
|
|
1812
|
+
tokens: [...tokens],
|
|
1813
|
+
domains: [...allDomains],
|
|
1814
|
+
interactions: {
|
|
1815
|
+
direct: directInteractions,
|
|
1816
|
+
inferred: inferredInteractions,
|
|
1817
|
+
total: allInteractions.length,
|
|
1818
|
+
all: allInteractions,
|
|
1819
|
+
},
|
|
1820
|
+
second_order_effects: secondOrderEffects,
|
|
1821
|
+
failure_propagation: failurePropagation,
|
|
1822
|
+
resource_contention: resourceContention,
|
|
1823
|
+
security_boundaries: securityBoundaries,
|
|
1824
|
+
constraint_conflicts: constraintConflicts,
|
|
1825
|
+
emergent_failures: emergentFailures,
|
|
1826
|
+
tradeoffs,
|
|
1827
|
+
blind_spots: blindSpots,
|
|
1828
|
+
validation_requirements: validationRequirements,
|
|
1829
|
+
summary: {
|
|
1830
|
+
total_interactions: allInteractions.length,
|
|
1831
|
+
critical_interactions: allInteractions.filter(
|
|
1832
|
+
i => i.priority === INTERACTION_PRIORITY.CRITICAL,
|
|
1833
|
+
).length,
|
|
1834
|
+
second_order_chains: secondOrderEffects.length,
|
|
1835
|
+
failure_propagation_paths: failurePropagation.length,
|
|
1836
|
+
resource_contention_risks: resourceContention.length,
|
|
1837
|
+
security_boundary_concerns: securityBoundaries.total,
|
|
1838
|
+
constraint_conflicts: constraintConflicts.length,
|
|
1839
|
+
emergent_failures: emergentFailures.length,
|
|
1840
|
+
blind_spots: blindSpots.length,
|
|
1841
|
+
validation_tests_generated: validationRequirements.length,
|
|
1842
|
+
},
|
|
1843
|
+
phase9_metrics: tracker.getMetrics(),
|
|
1844
|
+
};
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
// ============================================================================
|
|
1848
|
+
// EXPORTS
|
|
1849
|
+
// ============================================================================
|
|
1850
|
+
|
|
1851
|
+
module.exports = {
|
|
1852
|
+
// Constants
|
|
1853
|
+
RELATIONSHIP_TYPES,
|
|
1854
|
+
INTERACTION_PRIORITY,
|
|
1855
|
+
INTERACTION_CONFIDENCE,
|
|
1856
|
+
INTERACTION_RULES,
|
|
1857
|
+
EFFECT_CHAINS,
|
|
1858
|
+
FAILURE_PROPAGATION_RULES,
|
|
1859
|
+
SHARED_RESOURCES,
|
|
1860
|
+
CONSTRAINT_CONFLICTS,
|
|
1861
|
+
EMERGENT_FAILURE_PATTERNS,
|
|
1862
|
+
|
|
1863
|
+
// Core Functions
|
|
1864
|
+
extractInteractionTokens,
|
|
1865
|
+
discoverInteractions,
|
|
1866
|
+
discoverInferredInteractions,
|
|
1867
|
+
discoverSecondOrderEffects,
|
|
1868
|
+
discoverFailurePropagation,
|
|
1869
|
+
analyzeResourceContention,
|
|
1870
|
+
analyzeSecurityBoundaries,
|
|
1871
|
+
detectConstraintConflicts,
|
|
1872
|
+
buildTradeoffGraph,
|
|
1873
|
+
generateValidationRequirements,
|
|
1874
|
+
detectBlindSpots,
|
|
1875
|
+
detectEmergentFailures,
|
|
1876
|
+
|
|
1877
|
+
// Metrics
|
|
1878
|
+
Phase9MetricsTracker,
|
|
1879
|
+
getPhase9MetricsTracker,
|
|
1880
|
+
|
|
1881
|
+
// Main Orchestrator
|
|
1882
|
+
runCrossDomainAnalysis,
|
|
1883
|
+
};
|