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,1632 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* outcome_optimization_engine.js — Phase 10: Engineering Outcome Optimization Engine
|
|
5
|
+
* ===================================================================================
|
|
6
|
+
* Implements the core invariant:
|
|
7
|
+
*
|
|
8
|
+
* THE OUTCOME INVARIANT:
|
|
9
|
+
* Tribunal must optimize the implemented system for the actual engineering
|
|
10
|
+
* objective and constraints, not for shortest output, fastest generation,
|
|
11
|
+
* minimum code volume, or lowest immediate effort.
|
|
12
|
+
*
|
|
13
|
+
* MINIMUM NECESSARY COMPLEXITY FOR THE REQUIRED ENGINEERING OUTCOME.
|
|
14
|
+
*
|
|
15
|
+
* Core Capabilities:
|
|
16
|
+
* 1. Outcome Requirements Model (Explicit, Inferred, Default, Unknown)
|
|
17
|
+
* 2. Requirement Discovery & Multi-Category Classification
|
|
18
|
+
* 3. Requirement Prioritization (Mandatory, Important, Conditional, Optional, Unknown)
|
|
19
|
+
* 4. Engineering Option Generation & Tradeoff Evaluation (No fake winner scores)
|
|
20
|
+
* 5. Engineering Complexity Budget & Component Justification
|
|
21
|
+
* 6. Anti-Slop Architecture Guard (Overengineering Detection)
|
|
22
|
+
* 7. Under-Engineering Detection (Missing Critical Considerations)
|
|
23
|
+
* 8. Machine-Readable Engineering Decision Records (EDR)
|
|
24
|
+
* 9. End-to-End Decision Traceability
|
|
25
|
+
* 10. Assumption Engine & Unknown Handling
|
|
26
|
+
* 11. Outcome-Driven Skill Selection & Capability Depth
|
|
27
|
+
* 12. Engineering Solution Shape Construction
|
|
28
|
+
* 13. Implementation Order & Early Validation Probes
|
|
29
|
+
* 14. Multi-Objective Outcome Verification & Regression Detection
|
|
30
|
+
* 15. Adaptive Reasoning Depth & Risk Triggers
|
|
31
|
+
* 16. Reversibility & Change Blast Radius Analysis
|
|
32
|
+
* 17. Phase 10 Engineering Outcome Memory (Verified & Rejected Decisions)
|
|
33
|
+
* 18. Quality of Consideration Internal Telemetry
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
const fs = require('fs');
|
|
37
|
+
const path = require('path');
|
|
38
|
+
|
|
39
|
+
// ============================================================================
|
|
40
|
+
// 1. CONSTANTS & INVARIANTS
|
|
41
|
+
// ============================================================================
|
|
42
|
+
|
|
43
|
+
const OUTCOME_INVARIANT = `Tribunal must optimize the implemented system for the actual engineering objective and constraints, not for shortest output, fastest generation, minimum code volume, or lowest immediate effort.`;
|
|
44
|
+
|
|
45
|
+
const REQUIREMENT_SOURCES = {
|
|
46
|
+
EXPLICIT: 'EXPLICIT REQUIREMENT',
|
|
47
|
+
INFERRED: 'INFERRED REQUIREMENT',
|
|
48
|
+
DEFAULT_CONSIDERATION: 'DEFAULT ENGINEERING CONSIDERATION',
|
|
49
|
+
UNKNOWN: 'UNKNOWN',
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const REQUIREMENT_CATEGORIES = {
|
|
53
|
+
FUNCTIONAL: 'FUNCTIONAL',
|
|
54
|
+
NON_FUNCTIONAL: 'NON_FUNCTIONAL',
|
|
55
|
+
SECURITY: 'SECURITY',
|
|
56
|
+
RELIABILITY: 'RELIABILITY',
|
|
57
|
+
PERFORMANCE: 'PERFORMANCE',
|
|
58
|
+
SCALABILITY: 'SCALABILITY',
|
|
59
|
+
OPERABILITY: 'OPERABILITY',
|
|
60
|
+
COST: 'COST',
|
|
61
|
+
MAINTAINABILITY: 'MAINTAINABILITY',
|
|
62
|
+
COMPLIANCE: 'COMPLIANCE',
|
|
63
|
+
RECOVERY: 'RECOVERY',
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const REQUIREMENT_PRIORITY = {
|
|
67
|
+
MANDATORY: 'MANDATORY',
|
|
68
|
+
IMPORTANT: 'IMPORTANT',
|
|
69
|
+
CONDITIONAL: 'CONDITIONAL',
|
|
70
|
+
OPTIONAL: 'OPTIONAL',
|
|
71
|
+
UNKNOWN: 'UNKNOWN',
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const COMPLEXITY_BUDGETS = {
|
|
75
|
+
MINIMAL: 'MINIMAL', // Static website, typo, formatting, single-script
|
|
76
|
+
LOW: 'LOW', // Internal tool, basic CRUD, simple CLI
|
|
77
|
+
MODERATE: 'MODERATE', // Standard backend API, multi-user webapp
|
|
78
|
+
HIGH: 'HIGH', // Financial transactions, distributed state, multi-tenant auth
|
|
79
|
+
CRITICAL: 'CRITICAL', // Mission-critical infrastructure, banking, high-concurrency engine
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const ASSUMPTION_STATUS = {
|
|
83
|
+
VERIFIED: 'VERIFIED',
|
|
84
|
+
SUPPORTED_BY_REPOSITORY: 'SUPPORTED BY REPOSITORY',
|
|
85
|
+
INFERRED: 'INFERRED',
|
|
86
|
+
UNKNOWN: 'UNKNOWN',
|
|
87
|
+
CONTRADICTED: 'CONTRADICTED',
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const REVERSIBILITY_LEVELS = {
|
|
91
|
+
EASILY_REVERSIBLE: 'EASILY REVERSIBLE',
|
|
92
|
+
PARTIALLY_REVERSIBLE: 'PARTIALLY REVERSIBLE',
|
|
93
|
+
EXPENSIVE_TO_REVERSE: 'EXPENSIVE TO REVERSE',
|
|
94
|
+
DIFFICULT_TO_REVERSE: 'DIFFICULT TO REVERSE',
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const CAPABILITY_DEPTH = {
|
|
98
|
+
FULL: 'FULL',
|
|
99
|
+
PARTIAL: 'PARTIAL',
|
|
100
|
+
INSUFFICIENT: 'INSUFFICIENT',
|
|
101
|
+
MISSING: 'MISSING',
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const REASONING_DEPTH = {
|
|
105
|
+
SHALLOW: 'SHALLOW',
|
|
106
|
+
STANDARD: 'STANDARD',
|
|
107
|
+
DEEP: 'DEEP',
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
// ============================================================================
|
|
111
|
+
// 2. DOMAIN PATTERNS & HEURISTICS
|
|
112
|
+
// ============================================================================
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* High-risk triggers that escalate analysis depth to DEEP
|
|
116
|
+
*/
|
|
117
|
+
const HIGH_RISK_TRIGGERS = [
|
|
118
|
+
{
|
|
119
|
+
match:
|
|
120
|
+
/(?:payment|checkout|charge|billing|credit.?card|stripe|paypal|financial|refund|money|wallet)/i,
|
|
121
|
+
domain: 'financial',
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
match: /(?:auth|jwt|password|token|permission|rbac|session|oauth|login|credential)/i,
|
|
125
|
+
domain: 'authentication',
|
|
126
|
+
},
|
|
127
|
+
{ match: /(?:pii|gdpr|hipaa|ssn|secret|api.?key|encryption)/i, domain: 'pii_security' },
|
|
128
|
+
{
|
|
129
|
+
match: /(?:shell|exec|cmd|bash|spawn|subagent|sandbox|eval|untrusted)/i,
|
|
130
|
+
domain: 'command_execution',
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
match: /(?:concurren|race.?condition|mutex|distributed.?lock|atomic|deadlock)/i,
|
|
134
|
+
domain: 'concurrency',
|
|
135
|
+
},
|
|
136
|
+
{ match: /(?:multi.?tenant|tenant.?isolation|cross.?tenant)/i, domain: 'multi_tenancy' },
|
|
137
|
+
{ match: /(?:delete|truncate|drop|irreversible|purge|destroy)/i, domain: 'irreversible_data' },
|
|
138
|
+
{
|
|
139
|
+
match: /(?:scale|100k|high.?traffic|throughput|rps|qps|load.?balanc)/i,
|
|
140
|
+
domain: 'high_traffic',
|
|
141
|
+
},
|
|
142
|
+
];
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Architectural option generators for common design challenges
|
|
146
|
+
*/
|
|
147
|
+
const ARCHITECTURAL_OPTION_TEMPLATES = [
|
|
148
|
+
{
|
|
149
|
+
trigger: /(?:background.?process|worker|job.?queue|async.?task|queue)/i,
|
|
150
|
+
topic: 'Background Processing & Task Execution',
|
|
151
|
+
options: [
|
|
152
|
+
{
|
|
153
|
+
id: 'A',
|
|
154
|
+
name: 'In-Process Async Worker / Event Emitter',
|
|
155
|
+
strengths: [
|
|
156
|
+
'Zero external infrastructure dependency',
|
|
157
|
+
'Extremely low latency',
|
|
158
|
+
'Minimal deployment complexity',
|
|
159
|
+
],
|
|
160
|
+
constraints: [
|
|
161
|
+
'Weak durability',
|
|
162
|
+
'Process crash or deployment loses in-flight tasks',
|
|
163
|
+
'Cannot scale workers independently of web process',
|
|
164
|
+
],
|
|
165
|
+
fit: 'Appropriate only for non-critical, ephemeral, easily re-run background tasks',
|
|
166
|
+
complexity: 'LOW',
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
id: 'B',
|
|
170
|
+
name: 'Database-Backed Transactional Queue (e.g. Postgres SKIP LOCKED)',
|
|
171
|
+
strengths: [
|
|
172
|
+
'Atomic consistency with business state',
|
|
173
|
+
'Zero new infrastructure dependencies',
|
|
174
|
+
'Crash-resilient durability',
|
|
175
|
+
'Transactional enrollment',
|
|
176
|
+
],
|
|
177
|
+
constraints: [
|
|
178
|
+
'Increases database write IOPS',
|
|
179
|
+
'Requires row locking maintenance and queue vacuuming',
|
|
180
|
+
'Upper ceiling on throughput compared to specialized brokers',
|
|
181
|
+
],
|
|
182
|
+
fit: 'Optimal for moderate-scale systems needing transactional guarantees without operational sprawl',
|
|
183
|
+
complexity: 'MODERATE',
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
id: 'C',
|
|
187
|
+
name: 'Dedicated Redis Queue (e.g. BullMQ / Sidekiq)',
|
|
188
|
+
strengths: [
|
|
189
|
+
'High throughput (10k+ ops/sec)',
|
|
190
|
+
'Rich delayed job and retry semantics',
|
|
191
|
+
'Low latency execution',
|
|
192
|
+
],
|
|
193
|
+
constraints: [
|
|
194
|
+
'Requires operational management of Redis cluster',
|
|
195
|
+
'Persistence requires AOF/RDB configuration',
|
|
196
|
+
'Dual-write consistency challenges with database',
|
|
197
|
+
],
|
|
198
|
+
fit: 'Appropriate when task throughput exceeds database queue capacity and tasks can tolerate soft durability boundaries',
|
|
199
|
+
complexity: 'MODERATE_HIGH',
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
id: 'D',
|
|
203
|
+
name: 'Distributed Event Streaming (e.g. Kafka / Redpanda)',
|
|
204
|
+
strengths: [
|
|
205
|
+
'Massive throughput (100k+ msg/sec)',
|
|
206
|
+
'Long-term replayability and audit log',
|
|
207
|
+
'High fan-out to independent consumer groups',
|
|
208
|
+
],
|
|
209
|
+
constraints: [
|
|
210
|
+
'High operational overhead (Zookeeper/KRaft, partition management)',
|
|
211
|
+
'Complex consumer offset and ordering semantics',
|
|
212
|
+
'Severe overengineering for simple task queues',
|
|
213
|
+
],
|
|
214
|
+
fit: 'Only justified by multi-service event fanout, high-throughput analytics, or strict replay requirements',
|
|
215
|
+
complexity: 'HIGH',
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
trigger:
|
|
221
|
+
/(?:payment|checkout|charge|order|idempotenc|duplicate.?request|duplicate.?charge|at.?least.?once)/i,
|
|
222
|
+
topic: 'Idempotency & Duplicate Request Protection',
|
|
223
|
+
options: [
|
|
224
|
+
{
|
|
225
|
+
id: 'A',
|
|
226
|
+
name: 'Database Unique Constraint on Idempotency Key',
|
|
227
|
+
strengths: [
|
|
228
|
+
'Atomic transaction boundary',
|
|
229
|
+
'Survivable across server restarts',
|
|
230
|
+
'Strict consistency guaranteed by ACID database',
|
|
231
|
+
],
|
|
232
|
+
constraints: [
|
|
233
|
+
'Requires unique index storage',
|
|
234
|
+
'Database latency for key check (typically 1-5ms)',
|
|
235
|
+
],
|
|
236
|
+
fit: 'Highest reliability for financial and mutating state operations',
|
|
237
|
+
complexity: 'LOW',
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
id: 'B',
|
|
241
|
+
name: 'In-Memory Cache Deduplication (e.g. LRU / Process Map)',
|
|
242
|
+
strengths: ['Microsecond lookup latency', 'No database write overhead'],
|
|
243
|
+
constraints: [
|
|
244
|
+
'Lost immediately on process restart',
|
|
245
|
+
'Completely ineffective across multi-instance or serverless deployments',
|
|
246
|
+
],
|
|
247
|
+
fit: 'Only acceptable for read-deduplication or single-instance non-financial services',
|
|
248
|
+
complexity: 'MINIMAL',
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
id: 'C',
|
|
252
|
+
name: 'Distributed Cache (e.g. Redis SETNX + TTL)',
|
|
253
|
+
strengths: [
|
|
254
|
+
'Fast distributed deduplication',
|
|
255
|
+
'Automatic key expiration via TTL',
|
|
256
|
+
'Offloads database write traffic',
|
|
257
|
+
],
|
|
258
|
+
constraints: [
|
|
259
|
+
'Split-brain risks if Redis fails or evicts keys',
|
|
260
|
+
'Dual-write race conditions between Redis and DB',
|
|
261
|
+
],
|
|
262
|
+
fit: 'Effective for rate-limiting and high-volume non-critical mutations; secondary layer for financial transactions',
|
|
263
|
+
complexity: 'MODERATE',
|
|
264
|
+
},
|
|
265
|
+
],
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
trigger: /(?:slow.?query|postgres|query.?plan|index|optimize.?query)/i,
|
|
269
|
+
topic: 'Query Performance Optimization Strategy',
|
|
270
|
+
options: [
|
|
271
|
+
{
|
|
272
|
+
id: 'A',
|
|
273
|
+
name: 'Selective Composite B-Tree Indexing',
|
|
274
|
+
strengths: [
|
|
275
|
+
'Directly resolves sequential scans',
|
|
276
|
+
'Zero code architecture changes',
|
|
277
|
+
'Retains strong data freshness',
|
|
278
|
+
],
|
|
279
|
+
constraints: [
|
|
280
|
+
'Adds slight write amplification on INSERT/UPDATE',
|
|
281
|
+
'Consumes buffer pool RAM',
|
|
282
|
+
],
|
|
283
|
+
fit: 'Primary baseline optimization; always verify with EXPLAIN ANALYZE before adding more complexity',
|
|
284
|
+
complexity: 'LOW',
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
id: 'B',
|
|
288
|
+
name: 'Query Restructuring & Subquery Elimination',
|
|
289
|
+
strengths: [
|
|
290
|
+
'Zero storage overhead',
|
|
291
|
+
'Improves query planner selectivity and join ordering',
|
|
292
|
+
],
|
|
293
|
+
constraints: [
|
|
294
|
+
'Requires application-level code change',
|
|
295
|
+
'May require schema denormalization',
|
|
296
|
+
],
|
|
297
|
+
fit: 'Essential companion to indexing for queries suffering from N+1 or Cartesian joins',
|
|
298
|
+
complexity: 'LOW',
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
id: 'C',
|
|
302
|
+
name: 'Application Cache-Aside (e.g. Redis)',
|
|
303
|
+
strengths: [
|
|
304
|
+
'Eliminates database round-trip entirely for hot queries',
|
|
305
|
+
'Sub-millisecond read latency',
|
|
306
|
+
],
|
|
307
|
+
constraints: [
|
|
308
|
+
'Cache invalidation complexity',
|
|
309
|
+
'Risk of stale reads',
|
|
310
|
+
'Cache stampede risk on TTL expiry',
|
|
311
|
+
],
|
|
312
|
+
fit: 'Only justified after query and index optimization fail to meet read SLA under high concurrent read load',
|
|
313
|
+
complexity: 'MODERATE',
|
|
314
|
+
},
|
|
315
|
+
],
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
trigger: /(?:high.?traffic|scale|100k|throughput|scaling|rps|qps)/i,
|
|
319
|
+
topic: 'High-Traffic Scalability & Capacity Strategy',
|
|
320
|
+
options: [
|
|
321
|
+
{
|
|
322
|
+
id: 'A',
|
|
323
|
+
name: 'Stateless Scale-Out + Database Connection Pooling',
|
|
324
|
+
strengths: [
|
|
325
|
+
'Baseline horizontal scaling capability',
|
|
326
|
+
'Low infrastructure complexity',
|
|
327
|
+
'Prevents database connection saturation',
|
|
328
|
+
],
|
|
329
|
+
constraints: [
|
|
330
|
+
'Limited by database write IOPS',
|
|
331
|
+
'Does not eliminate expensive repetitive reads',
|
|
332
|
+
],
|
|
333
|
+
fit: 'Optimal baseline when exact peak RPS target is unknown; prepares system without premature clustering',
|
|
334
|
+
complexity: 'MODERATE',
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
id: 'B',
|
|
338
|
+
name: 'Read Replicas with Connection Pool Splitting',
|
|
339
|
+
strengths: [
|
|
340
|
+
'Scales read throughput linearly across read replicas',
|
|
341
|
+
'Isolates analytical queries from write path',
|
|
342
|
+
],
|
|
343
|
+
constraints: [
|
|
344
|
+
'Replication lag can cause stale reads immediately after writes',
|
|
345
|
+
'Increases infrastructure operational cost',
|
|
346
|
+
],
|
|
347
|
+
fit: 'Appropriate for high read-to-write ratio (>10:1) workloads',
|
|
348
|
+
complexity: 'MODERATE_HIGH',
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
id: 'C',
|
|
352
|
+
name: 'Distributed In-Memory Cache (Redis Cluster)',
|
|
353
|
+
strengths: [
|
|
354
|
+
'Sub-millisecond latency for hot records',
|
|
355
|
+
'Offloads 90%+ read traffic from database',
|
|
356
|
+
],
|
|
357
|
+
constraints: [
|
|
358
|
+
'Cache invalidation complexity',
|
|
359
|
+
'Memory cost at scale',
|
|
360
|
+
'Cold start thundering herd risks',
|
|
361
|
+
],
|
|
362
|
+
fit: 'Justified only when read queries dominate and measured load exceeds database IOPS budget',
|
|
363
|
+
complexity: 'HIGH',
|
|
364
|
+
},
|
|
365
|
+
],
|
|
366
|
+
},
|
|
367
|
+
];
|
|
368
|
+
|
|
369
|
+
// ============================================================================
|
|
370
|
+
// 3. REQUIREMENT DISCOVERY & MODELING
|
|
371
|
+
// ============================================================================
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Discover and structure requirements for a given task.
|
|
375
|
+
*
|
|
376
|
+
* @param {string} taskQuery
|
|
377
|
+
* @param {Object} [context]
|
|
378
|
+
* @returns {Array<Object>} Discovered requirements
|
|
379
|
+
*/
|
|
380
|
+
function discoverRequirements(taskQuery, context = {}) {
|
|
381
|
+
const q = (taskQuery || '').toLowerCase();
|
|
382
|
+
const reqs = [];
|
|
383
|
+
|
|
384
|
+
// Base functional requirement
|
|
385
|
+
reqs.push({
|
|
386
|
+
id: 'REQ-F01',
|
|
387
|
+
description: `Deliver core requested capability for: "${taskQuery}"`,
|
|
388
|
+
category: REQUIREMENT_CATEGORIES.FUNCTIONAL,
|
|
389
|
+
source: REQUIREMENT_SOURCES.EXPLICIT,
|
|
390
|
+
priority: REQUIREMENT_PRIORITY.MANDATORY,
|
|
391
|
+
rationale: 'Primary user request objective',
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
// Financial / Payment
|
|
395
|
+
if (/(?:payment|checkout|charge|billing|refund|money|wallet)/i.test(q)) {
|
|
396
|
+
reqs.push({
|
|
397
|
+
id: 'REQ-REL01',
|
|
398
|
+
description:
|
|
399
|
+
'Ensure exact-once business effect via persistent idempotency keys for all mutation requests',
|
|
400
|
+
category: REQUIREMENT_CATEGORIES.RELIABILITY,
|
|
401
|
+
source: REQUIREMENT_SOURCES.INFERRED,
|
|
402
|
+
priority: REQUIREMENT_PRIORITY.MANDATORY,
|
|
403
|
+
rationale:
|
|
404
|
+
'Financial mutations must prevent double-billing under client retries or network drops',
|
|
405
|
+
});
|
|
406
|
+
reqs.push({
|
|
407
|
+
id: 'REQ-REL02',
|
|
408
|
+
description: 'Wrap payment entity mutations in atomic transaction boundaries',
|
|
409
|
+
category: REQUIREMENT_CATEGORIES.RELIABILITY,
|
|
410
|
+
source: REQUIREMENT_SOURCES.INFERRED,
|
|
411
|
+
priority: REQUIREMENT_PRIORITY.MANDATORY,
|
|
412
|
+
rationale: 'Partial failures during payment processing must cleanly roll back state',
|
|
413
|
+
});
|
|
414
|
+
reqs.push({
|
|
415
|
+
id: 'REQ-SEC01',
|
|
416
|
+
description:
|
|
417
|
+
'Strict authentication, authorization, and TLS transport security for all payment endpoints',
|
|
418
|
+
category: REQUIREMENT_CATEGORIES.SECURITY,
|
|
419
|
+
source: REQUIREMENT_SOURCES.INFERRED,
|
|
420
|
+
priority: REQUIREMENT_PRIORITY.MANDATORY,
|
|
421
|
+
rationale: 'Financial endpoints represent high-value attack surfaces',
|
|
422
|
+
});
|
|
423
|
+
reqs.push({
|
|
424
|
+
id: 'REQ-OBS01',
|
|
425
|
+
description: 'Structured audit logging with trace ID correlation (scrubbing PAN/CVV)',
|
|
426
|
+
category: REQUIREMENT_CATEGORIES.OPERABILITY,
|
|
427
|
+
source: REQUIREMENT_SOURCES.DEFAULT_CONSIDERATION,
|
|
428
|
+
priority: REQUIREMENT_PRIORITY.IMPORTANT,
|
|
429
|
+
rationale: 'Auditability and incident triage required for financial reconciliation',
|
|
430
|
+
});
|
|
431
|
+
reqs.push({
|
|
432
|
+
id: 'REQ-REC01',
|
|
433
|
+
description:
|
|
434
|
+
'Handling external payment provider timeouts, webhooks, and asynchronous reconciliation',
|
|
435
|
+
category: REQUIREMENT_CATEGORIES.RECOVERY,
|
|
436
|
+
source: REQUIREMENT_SOURCES.INFERRED,
|
|
437
|
+
priority: REQUIREMENT_PRIORITY.IMPORTANT,
|
|
438
|
+
rationale:
|
|
439
|
+
'External payment gateways frequently experience intermittent latency spikes or timeouts',
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
// Database / Query Optimization
|
|
444
|
+
if (/(?:postgres|sql|query|database|slow.?query|index|latency)/i.test(q)) {
|
|
445
|
+
reqs.push({
|
|
446
|
+
id: 'REQ-PERF01',
|
|
447
|
+
description:
|
|
448
|
+
'Establish empirical execution baseline using EXPLAIN (ANALYZE, BUFFERS) before modifying queries',
|
|
449
|
+
category: REQUIREMENT_CATEGORIES.PERFORMANCE,
|
|
450
|
+
source: REQUIREMENT_SOURCES.INFERRED,
|
|
451
|
+
priority: REQUIREMENT_PRIORITY.MANDATORY,
|
|
452
|
+
rationale: 'Performance optimization without baseline evidence is guesswork',
|
|
453
|
+
});
|
|
454
|
+
reqs.push({
|
|
455
|
+
id: 'REQ-REL03',
|
|
456
|
+
description:
|
|
457
|
+
'Safeguard database connection pooling against exhaustion during concurrent query bursts',
|
|
458
|
+
category: REQUIREMENT_CATEGORIES.RELIABILITY,
|
|
459
|
+
source: REQUIREMENT_SOURCES.DEFAULT_CONSIDERATION,
|
|
460
|
+
priority: REQUIREMENT_PRIORITY.IMPORTANT,
|
|
461
|
+
rationale: 'Slow queries saturate pool connections, cascading into service outages',
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
// Shell / Agent / Command Execution
|
|
466
|
+
if (/(?:agent|shell|command|exec|tool|eval|sandbox)/i.test(q)) {
|
|
467
|
+
reqs.push({
|
|
468
|
+
id: 'REQ-SEC02',
|
|
469
|
+
description: 'Strict execution sandboxing and argument whitelisting for all shell operations',
|
|
470
|
+
category: REQUIREMENT_CATEGORIES.SECURITY,
|
|
471
|
+
source: REQUIREMENT_SOURCES.INFERRED,
|
|
472
|
+
priority: REQUIREMENT_PRIORITY.MANDATORY,
|
|
473
|
+
rationale:
|
|
474
|
+
'Arbitrary shell execution presents catastrophic remote code execution vulnerability',
|
|
475
|
+
});
|
|
476
|
+
reqs.push({
|
|
477
|
+
id: 'REQ-SEC03',
|
|
478
|
+
description: 'Prompt injection sanitization and delimiter isolation on user-supplied inputs',
|
|
479
|
+
category: REQUIREMENT_CATEGORIES.SECURITY,
|
|
480
|
+
source: REQUIREMENT_SOURCES.INFERRED,
|
|
481
|
+
priority: REQUIREMENT_PRIORITY.MANDATORY,
|
|
482
|
+
rationale: 'Prevents adversarial context override of tool execution guardrails',
|
|
483
|
+
});
|
|
484
|
+
reqs.push({
|
|
485
|
+
id: 'REQ-SEC04',
|
|
486
|
+
description: 'Filesystem and network egress restriction boundaries',
|
|
487
|
+
category: REQUIREMENT_CATEGORIES.SECURITY,
|
|
488
|
+
source: REQUIREMENT_SOURCES.INFERRED,
|
|
489
|
+
priority: REQUIREMENT_PRIORITY.IMPORTANT,
|
|
490
|
+
rationale: 'Restricts blast radius in case of unintended subagent commands',
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// High Traffic / Scale
|
|
495
|
+
if (/(?:high.?traffic|scale|100k|throughput|scaling|rps|qps)/i.test(q)) {
|
|
496
|
+
reqs.push({
|
|
497
|
+
id: 'REQ-SCL01',
|
|
498
|
+
description: 'Stateless request handling enabling horizontal scale-out',
|
|
499
|
+
category: REQUIREMENT_CATEGORIES.SCALABILITY,
|
|
500
|
+
source: REQUIREMENT_SOURCES.INFERRED,
|
|
501
|
+
priority: REQUIREMENT_PRIORITY.MANDATORY,
|
|
502
|
+
rationale: 'In-process session state impedes multi-instance scaling',
|
|
503
|
+
});
|
|
504
|
+
reqs.push({
|
|
505
|
+
id: 'REQ-UNK01',
|
|
506
|
+
description:
|
|
507
|
+
'Exact production peak request throughput (RPS/QPS) and p95/p99 latency SLA targets',
|
|
508
|
+
category: REQUIREMENT_CATEGORIES.PERFORMANCE,
|
|
509
|
+
source: REQUIREMENT_SOURCES.UNKNOWN,
|
|
510
|
+
priority: REQUIREMENT_PRIORITY.UNKNOWN,
|
|
511
|
+
rationale:
|
|
512
|
+
'Throughput target not specified by user; cannot justify specialized clustering without target',
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
// Static Website / Frontend
|
|
517
|
+
if (
|
|
518
|
+
/(?:static|portfolio|landing|website|html|css|ui)/i.test(q) &&
|
|
519
|
+
!/(?:payment|checkout|auth|agent)/i.test(q)
|
|
520
|
+
) {
|
|
521
|
+
reqs.push({
|
|
522
|
+
id: 'REQ-A11Y01',
|
|
523
|
+
description: 'Semantic HTML markup, ARIA compliance, and responsive viewport support',
|
|
524
|
+
category: REQUIREMENT_CATEGORIES.MAINTAINABILITY,
|
|
525
|
+
source: REQUIREMENT_SOURCES.INFERRED,
|
|
526
|
+
priority: REQUIREMENT_PRIORITY.MANDATORY,
|
|
527
|
+
rationale: 'Fundamental accessibility and cross-device rendering requirements',
|
|
528
|
+
});
|
|
529
|
+
reqs.push({
|
|
530
|
+
id: 'REQ-PERF02',
|
|
531
|
+
description: 'Zero runtime server dependency and fast static asset delivery',
|
|
532
|
+
category: REQUIREMENT_CATEGORIES.PERFORMANCE,
|
|
533
|
+
source: REQUIREMENT_SOURCES.INFERRED,
|
|
534
|
+
priority: REQUIREMENT_PRIORITY.IMPORTANT,
|
|
535
|
+
rationale:
|
|
536
|
+
'Static content should be served via static file server or CDN without backend overhead',
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
return reqs;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
// ============================================================================
|
|
544
|
+
// 4. COMPLEXITY BUDGETING & ANTI-SLOP GUARD
|
|
545
|
+
// ============================================================================
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* Determine the engineering complexity budget justified by the task.
|
|
549
|
+
*
|
|
550
|
+
* @param {string} taskQuery
|
|
551
|
+
* @param {Array<Object>} requirements
|
|
552
|
+
* @returns {Object} Complexity budget evaluation
|
|
553
|
+
*/
|
|
554
|
+
function evaluateComplexityBudget(taskQuery, requirements = []) {
|
|
555
|
+
const q = (taskQuery || '').toLowerCase();
|
|
556
|
+
|
|
557
|
+
// Trivial or purely static/frontend task
|
|
558
|
+
if (/^(?:fix\s|typo|css\s|format|rename|lint|style|readme|comment|doc)/i.test(q)) {
|
|
559
|
+
return {
|
|
560
|
+
budget: COMPLEXITY_BUDGETS.MINIMAL,
|
|
561
|
+
justification: 'Task is a localized cosmetic, stylistic, or documentation modification.',
|
|
562
|
+
max_justified_layers: 1,
|
|
563
|
+
allowed_infrastructure: ['local filesystem', 'editor / linter'],
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
if (
|
|
568
|
+
/(?:portfolio|static\s.*page|landing\s.*page|static\s.*site|simple\s.*website)/i.test(q) &&
|
|
569
|
+
!/(?:payment|checkout|auth|database|worker|microservice)/i.test(q)
|
|
570
|
+
) {
|
|
571
|
+
return {
|
|
572
|
+
budget: COMPLEXITY_BUDGETS.MINIMAL,
|
|
573
|
+
justification: 'Static website requires only markup, styling, and static asset distribution.',
|
|
574
|
+
max_justified_layers: 1,
|
|
575
|
+
allowed_infrastructure: ['static web server / CDN', 'vanilla assets / bundler'],
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
if (
|
|
580
|
+
/(?:todo|crud|notes|internal\s.*tool|simple\s.*script)/i.test(q) &&
|
|
581
|
+
!/(?:payment|distributed|100k|high.?traffic)/i.test(q)
|
|
582
|
+
) {
|
|
583
|
+
return {
|
|
584
|
+
budget: COMPLEXITY_BUDGETS.LOW,
|
|
585
|
+
justification:
|
|
586
|
+
'Standard CRUD application justified with single database and monolith service.',
|
|
587
|
+
max_justified_layers: 2,
|
|
588
|
+
allowed_infrastructure: ['relational / embedded database', 'monolithic application server'],
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
if (/(?:payment|checkout|billing|refund|financial|bank)/i.test(q)) {
|
|
593
|
+
return {
|
|
594
|
+
budget: COMPLEXITY_BUDGETS.HIGH,
|
|
595
|
+
justification:
|
|
596
|
+
'Financial transactions require atomic transactions, persistent idempotency, and audit trails.',
|
|
597
|
+
max_justified_layers: 4,
|
|
598
|
+
allowed_infrastructure: [
|
|
599
|
+
'ACID database with unique constraints',
|
|
600
|
+
'secure payment gateway client',
|
|
601
|
+
'structured audit logger',
|
|
602
|
+
'transaction manager',
|
|
603
|
+
],
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
if (/(?:100k|high.?traffic|distributed|consensus|multi.?tenant.*scale)/i.test(q)) {
|
|
608
|
+
return {
|
|
609
|
+
budget: COMPLEXITY_BUDGETS.HIGH,
|
|
610
|
+
justification:
|
|
611
|
+
'High traffic requires horizontal scaling readiness, connection pooling, and caching.',
|
|
612
|
+
max_justified_layers: 4,
|
|
613
|
+
allowed_infrastructure: [
|
|
614
|
+
'distributed cache (Redis)',
|
|
615
|
+
'connection pool manager',
|
|
616
|
+
'load balancer',
|
|
617
|
+
'horizontal replicas',
|
|
618
|
+
],
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
return {
|
|
623
|
+
budget: COMPLEXITY_BUDGETS.MODERATE,
|
|
624
|
+
justification:
|
|
625
|
+
'Standard application service with basic security, persistence, and reliability needs.',
|
|
626
|
+
max_justified_layers: 3,
|
|
627
|
+
allowed_infrastructure: ['application server', 'database', 'structured logger'],
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* Detect overengineering (Anti-Slop Guard) and underengineering.
|
|
633
|
+
*
|
|
634
|
+
* @param {string} taskQuery
|
|
635
|
+
* @param {Object} complexityBudget
|
|
636
|
+
* @param {Array<Object>} proposedComponents
|
|
637
|
+
* @returns {Object} Architecture audit result
|
|
638
|
+
*/
|
|
639
|
+
function auditArchitectureJustification(taskQuery, complexityBudget, proposedComponents = []) {
|
|
640
|
+
const q = (taskQuery || '').toLowerCase();
|
|
641
|
+
const unjustified = [];
|
|
642
|
+
const justified = [];
|
|
643
|
+
const missingCritical = [];
|
|
644
|
+
|
|
645
|
+
const isStaticOrSimple =
|
|
646
|
+
complexityBudget.budget === COMPLEXITY_BUDGETS.MINIMAL ||
|
|
647
|
+
complexityBudget.budget === COMPLEXITY_BUDGETS.LOW;
|
|
648
|
+
|
|
649
|
+
// ── Over-Engineering Checks (Anti-Slop) ──
|
|
650
|
+
const overEngineeringCandidates = [
|
|
651
|
+
{
|
|
652
|
+
name: 'Kafka / Event Streaming',
|
|
653
|
+
match: /(?:kafka|event.?stream|kinesis|redpanda)/i,
|
|
654
|
+
minBudget: COMPLEXITY_BUDGETS.HIGH,
|
|
655
|
+
reason:
|
|
656
|
+
'Event streaming introduces massive operational overhead unjustified for basic synchronous workflows',
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
name: 'Microservices Decomposition',
|
|
660
|
+
match: /(?:microservice|service.?mesh|istio)/i,
|
|
661
|
+
minBudget: COMPLEXITY_BUDGETS.HIGH,
|
|
662
|
+
reason:
|
|
663
|
+
'Microservice boundaries introduce distributed network failure modes unwarranted for simple or single-team tasks',
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
name: 'CQRS & Event Sourcing',
|
|
667
|
+
match: /(?:cqrs|event.?sourcing)/i,
|
|
668
|
+
minBudget: COMPLEXITY_BUDGETS.HIGH,
|
|
669
|
+
reason:
|
|
670
|
+
'CQRS introduces dual-model eventual consistency complexity unwarranted when standard ACID CRUD suffices',
|
|
671
|
+
},
|
|
672
|
+
{
|
|
673
|
+
name: 'Distributed Cache (Redis)',
|
|
674
|
+
match: /(?:redis|memcached)/i,
|
|
675
|
+
minBudget: COMPLEXITY_BUDGETS.MODERATE,
|
|
676
|
+
reason:
|
|
677
|
+
'Distributed caching introduces invalidation complexity; unwarranted unless measured read latency or load requires it',
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
name: 'Kubernetes / Distributed Orchestration',
|
|
681
|
+
match: /(?:kubernetes|k8s|helm)/i,
|
|
682
|
+
minBudget: COMPLEXITY_BUDGETS.HIGH,
|
|
683
|
+
reason:
|
|
684
|
+
'Container orchestration cluster unwarranted for static sites or small local applications',
|
|
685
|
+
},
|
|
686
|
+
];
|
|
687
|
+
|
|
688
|
+
for (const c of overEngineeringCandidates) {
|
|
689
|
+
if (c.match.test(q)) {
|
|
690
|
+
// If user literally asked for it, it may be explicit, but check if task justifies it
|
|
691
|
+
if (isStaticOrSimple) {
|
|
692
|
+
unjustified.push({
|
|
693
|
+
component: c.name,
|
|
694
|
+
status: 'REJECTED_UNJUSTIFIED',
|
|
695
|
+
reason: `Task complexity (${complexityBudget.budget}) does not warrant ${c.name}. ${c.reason}`,
|
|
696
|
+
recommendation: 'Use standard monolithic process or built-in idioms instead',
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
// If this is a static site or simple local app, check common slop
|
|
703
|
+
if (/(?:static|portfolio|landing\s.*page|local\s.*todo)/i.test(q)) {
|
|
704
|
+
for (const c of overEngineeringCandidates) {
|
|
705
|
+
unjustified.push({
|
|
706
|
+
component: c.name,
|
|
707
|
+
status: 'UNJUSTIFIED_DO_NOT_ADD',
|
|
708
|
+
reason: `Task is a ${q.includes('todo') ? 'local application' : 'static website'}. ${c.reason}`,
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
// ── Under-Engineering Checks (Missing Considerations) ──
|
|
714
|
+
if (/(?:payment|checkout|charge|order)/i.test(q)) {
|
|
715
|
+
justified.push({
|
|
716
|
+
component: 'Database-Backed Idempotency Table',
|
|
717
|
+
status: 'JUSTIFIED',
|
|
718
|
+
justification:
|
|
719
|
+
'Protects payment mutation against duplicate execution caused by client retries and network timeouts.',
|
|
720
|
+
});
|
|
721
|
+
justified.push({
|
|
722
|
+
component: 'Atomic Database Transaction',
|
|
723
|
+
status: 'JUSTIFIED',
|
|
724
|
+
justification:
|
|
725
|
+
'Ensures payment records and order status transition atomically with zero orphaned partial state.',
|
|
726
|
+
});
|
|
727
|
+
justified.push({
|
|
728
|
+
component: 'Structured Audit Log',
|
|
729
|
+
status: 'JUSTIFIED',
|
|
730
|
+
justification:
|
|
731
|
+
'Enables financial reconciliation and audit tracking without exposing cardholder data.',
|
|
732
|
+
});
|
|
733
|
+
|
|
734
|
+
// Check if task seems to be a naive implementation or missing critical guards
|
|
735
|
+
if (
|
|
736
|
+
/(?:naive|simple|quick|just.*insert)/i.test(q) ||
|
|
737
|
+
!/(?:idempotency|transaction)/i.test(q) ||
|
|
738
|
+
/(?:create|build).*order/i.test(q)
|
|
739
|
+
) {
|
|
740
|
+
missingCritical.push({
|
|
741
|
+
consideration: 'Idempotency Protection',
|
|
742
|
+
severity: 'CRITICAL',
|
|
743
|
+
risk: 'Risk of duplicate mutations / double-charging users during network retry storms',
|
|
744
|
+
requirement: 'Enforce unique idempotency-key constraint at API entry',
|
|
745
|
+
});
|
|
746
|
+
missingCritical.push({
|
|
747
|
+
consideration: 'Transaction Boundary',
|
|
748
|
+
severity: 'CRITICAL',
|
|
749
|
+
risk: 'Risk of orphaned records if downstream step fails after initial record insertion',
|
|
750
|
+
requirement: 'Enclose DB updates in rollback-capable transactional context',
|
|
751
|
+
});
|
|
752
|
+
missingCritical.push({
|
|
753
|
+
consideration: 'Concurrency Serialization',
|
|
754
|
+
severity: 'HIGH',
|
|
755
|
+
risk: 'Concurrent duplicate clicks can slip past in-memory checks',
|
|
756
|
+
requirement: 'Use database row-level locking or unique index constraint',
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
if (/(?:slow.?query|postgres|query.*faster)/i.test(q)) {
|
|
762
|
+
justified.push({
|
|
763
|
+
component: 'EXPLAIN (ANALYZE, BUFFERS) Profiler',
|
|
764
|
+
status: 'JUSTIFIED',
|
|
765
|
+
justification:
|
|
766
|
+
'Verifies query planner cost and identifies sequential scans vs index scans with empirical data.',
|
|
767
|
+
});
|
|
768
|
+
justified.push({
|
|
769
|
+
component: 'Selective Composite B-Tree Index',
|
|
770
|
+
status: 'JUSTIFIED',
|
|
771
|
+
justification:
|
|
772
|
+
'Targets high-cardinality columns in WHERE/JOIN clauses to eliminate full table scans.',
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
if (/(?:agent|shell.*command)/i.test(q)) {
|
|
777
|
+
justified.push({
|
|
778
|
+
component: 'Subprocess Execution Sandbox',
|
|
779
|
+
status: 'JUSTIFIED',
|
|
780
|
+
justification:
|
|
781
|
+
'Restricts shell commands to pre-approved whitelist and isolates child process execution.',
|
|
782
|
+
});
|
|
783
|
+
justified.push({
|
|
784
|
+
component: 'Prompt Injection Defense Delimiters',
|
|
785
|
+
status: 'JUSTIFIED',
|
|
786
|
+
justification:
|
|
787
|
+
'Prevents adversarial user input from escaping prompt context to invoke unauthorized tools.',
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
return {
|
|
792
|
+
complexity_budget: complexityBudget.budget,
|
|
793
|
+
justified_components: justified,
|
|
794
|
+
unjustified_components: unjustified,
|
|
795
|
+
missing_critical_considerations: missingCritical,
|
|
796
|
+
architecture_balance:
|
|
797
|
+
missingCritical.length > 0
|
|
798
|
+
? 'UNDER_ENGINEERED'
|
|
799
|
+
: unjustified.some(u => u.status === 'REJECTED_UNJUSTIFIED')
|
|
800
|
+
? 'OVER_ENGINEERED'
|
|
801
|
+
: 'APPROPRIATELY_ENGINEERED',
|
|
802
|
+
};
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
// ============================================================================
|
|
806
|
+
// 5. ENGINEERING DECISION RECORDS (EDR) & TRACEABILITY
|
|
807
|
+
// ============================================================================
|
|
808
|
+
|
|
809
|
+
/**
|
|
810
|
+
* Generate formal Engineering Decision Records for significant choices.
|
|
811
|
+
*
|
|
812
|
+
* @param {string} taskQuery
|
|
813
|
+
* @param {Array<Object>} requirements
|
|
814
|
+
* @param {Array<Object>} justifiedComponents
|
|
815
|
+
* @returns {Array<Object>} EDR records
|
|
816
|
+
*/
|
|
817
|
+
function generateDecisionRecords(taskQuery, requirements = [], justifiedComponents = []) {
|
|
818
|
+
const q = (taskQuery || '').toLowerCase();
|
|
819
|
+
const records = [];
|
|
820
|
+
|
|
821
|
+
if (/(?:payment|checkout|billing|refund)/i.test(q)) {
|
|
822
|
+
records.push({
|
|
823
|
+
id: 'EDR-001',
|
|
824
|
+
title: 'Database-Backed Idempotency Enforcement',
|
|
825
|
+
decision: 'Enforce idempotency via unique database constraint on idempotency_key',
|
|
826
|
+
reason:
|
|
827
|
+
'Payment mutations must guarantee at-most-once execution even under aggressive client retry storms',
|
|
828
|
+
alternatives: [
|
|
829
|
+
{
|
|
830
|
+
name: 'In-memory Set / Map',
|
|
831
|
+
rejected_reason:
|
|
832
|
+
'Lost on process crash or container restart; fails across distributed pods',
|
|
833
|
+
},
|
|
834
|
+
{
|
|
835
|
+
name: 'Distributed Redis TTL Cache',
|
|
836
|
+
rejected_reason:
|
|
837
|
+
'Subject to eviction under memory pressure; lacks ACID transaction enrollment with payment state',
|
|
838
|
+
},
|
|
839
|
+
],
|
|
840
|
+
constraints: [
|
|
841
|
+
'Must survive process restarts and node failovers',
|
|
842
|
+
'Must participate in or serialize ahead of the primary database transaction',
|
|
843
|
+
],
|
|
844
|
+
interactions: ['retry', 'database', 'concurrency', 'payment'],
|
|
845
|
+
validation: [
|
|
846
|
+
'Concurrent duplicate request test (10 simultaneous POSTs with same key)',
|
|
847
|
+
'Retry after 30-second simulated gateway timeout',
|
|
848
|
+
'Process kill mid-execution recovery verification',
|
|
849
|
+
],
|
|
850
|
+
reversibility: REVERSIBILITY_LEVELS.PARTIALLY_REVERSIBLE,
|
|
851
|
+
traceability_chain: {
|
|
852
|
+
user_requirement: 'Build production-ready payment API',
|
|
853
|
+
engineering_consideration: 'Duplicate execution under client retries',
|
|
854
|
+
canonical_concept: 'idempotency',
|
|
855
|
+
skill: 'backend-resilience',
|
|
856
|
+
interaction: 'retry ↔ idempotency',
|
|
857
|
+
decision: 'Database-backed unique idempotency table',
|
|
858
|
+
implementation: 'CREATE UNIQUE INDEX idx_idempotency_key ...',
|
|
859
|
+
verification:
|
|
860
|
+
'Dispatch 10 concurrent requests; assert exactly 1 charge and 9 deduplicated responses',
|
|
861
|
+
},
|
|
862
|
+
});
|
|
863
|
+
|
|
864
|
+
records.push({
|
|
865
|
+
id: 'EDR-002',
|
|
866
|
+
title: 'Explicit Transaction Boundary for Order & Payment State',
|
|
867
|
+
decision:
|
|
868
|
+
'Enclose order creation, ledger entry, and idempotency lock in an ACID transaction block',
|
|
869
|
+
reason: 'Prevents partial database writes if payment provider communication errors out',
|
|
870
|
+
alternatives: [
|
|
871
|
+
{
|
|
872
|
+
name: 'Independent uncoordinated DB updates',
|
|
873
|
+
rejected_reason: 'Leaves dangling order records when subsequent operations fail',
|
|
874
|
+
},
|
|
875
|
+
],
|
|
876
|
+
constraints: [
|
|
877
|
+
'Transaction must commit only after successful provider authorization or mark status PENDING',
|
|
878
|
+
],
|
|
879
|
+
interactions: ['database', 'external_api', 'consistency'],
|
|
880
|
+
validation: ['Simulate gateway 500 error; verify database state remains unmutated'],
|
|
881
|
+
reversibility: REVERSIBILITY_LEVELS.EASILY_REVERSIBLE,
|
|
882
|
+
traceability_chain: {
|
|
883
|
+
user_requirement: 'Build production-ready payment API',
|
|
884
|
+
engineering_consideration: 'Atomic state transitions on external failure',
|
|
885
|
+
canonical_concept: 'transactions',
|
|
886
|
+
skill: 'backend-postgresql',
|
|
887
|
+
interaction: 'database ↔ external_api',
|
|
888
|
+
decision: 'Explicit transaction boundary with rollback hook',
|
|
889
|
+
implementation: 'db.transaction(async tx => ...)',
|
|
890
|
+
verification: 'Fault injection of provider 500; assert 0 orphaned records',
|
|
891
|
+
},
|
|
892
|
+
});
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
if (/(?:slow.?query|postgres|query.*faster)/i.test(q)) {
|
|
896
|
+
records.push({
|
|
897
|
+
id: 'EDR-003',
|
|
898
|
+
title: 'Empirical Indexing Over Speculative Caching',
|
|
899
|
+
decision: 'Add targeted composite B-Tree index based on EXPLAIN ANALYZE filter predicates',
|
|
900
|
+
reason:
|
|
901
|
+
'Indexing addresses root cause of sequential scan without introducing cache invalidation bugs',
|
|
902
|
+
alternatives: [
|
|
903
|
+
{
|
|
904
|
+
name: 'Redis Cache-Aside',
|
|
905
|
+
rejected_reason:
|
|
906
|
+
'Introduces cache invalidation complexity, cache stampede risks, and stale read bugs',
|
|
907
|
+
},
|
|
908
|
+
],
|
|
909
|
+
constraints: ['Write amplification must not degrade INSERT latency by >5%'],
|
|
910
|
+
interactions: ['database', 'index', 'latency'],
|
|
911
|
+
validation: [
|
|
912
|
+
'Compare p95 read latency before and after index creation under 100 concurrent queries',
|
|
913
|
+
],
|
|
914
|
+
reversibility: REVERSIBILITY_LEVELS.EASILY_REVERSIBLE,
|
|
915
|
+
traceability_chain: {
|
|
916
|
+
user_requirement: 'Make query faster',
|
|
917
|
+
engineering_consideration: 'High query latency from full table scan',
|
|
918
|
+
canonical_concept: 'indexing',
|
|
919
|
+
skill: 'sql-pro',
|
|
920
|
+
interaction: 'database ↔ latency',
|
|
921
|
+
decision: 'Composite index on high-selectivity columns',
|
|
922
|
+
implementation: 'CREATE INDEX CONCURRENTLY ...',
|
|
923
|
+
verification: 'Run EXPLAIN (ANALYZE, BUFFERS); verify Index Scan replaces Seq Scan',
|
|
924
|
+
},
|
|
925
|
+
});
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
if (/(?:agent|shell.*command)/i.test(q)) {
|
|
929
|
+
records.push({
|
|
930
|
+
id: 'EDR-004',
|
|
931
|
+
title: 'Execution Sandbox & Strict Whitelisting',
|
|
932
|
+
decision:
|
|
933
|
+
'Restrict tool command execution to a strict binary whitelist with sanitized argument arrays',
|
|
934
|
+
reason: 'Prevents shell injection and unintended subagent command execution',
|
|
935
|
+
alternatives: [
|
|
936
|
+
{
|
|
937
|
+
name: 'Arbitrary bash string interpolation',
|
|
938
|
+
rejected_reason: 'Allows command injection via backticks, semicolons, and pipes',
|
|
939
|
+
},
|
|
940
|
+
],
|
|
941
|
+
constraints: ['No unvetted external binary execution permitted'],
|
|
942
|
+
interactions: ['agent', 'shell', 'security'],
|
|
943
|
+
validation: [
|
|
944
|
+
'Pass injection payloads (`; rm -rf /`, `$(whoami)`); assert execution rejected',
|
|
945
|
+
],
|
|
946
|
+
reversibility: REVERSIBILITY_LEVELS.EASILY_REVERSIBLE,
|
|
947
|
+
traceability_chain: {
|
|
948
|
+
user_requirement: 'Build AI agent with shell tools',
|
|
949
|
+
engineering_consideration: 'Command injection vulnerability',
|
|
950
|
+
canonical_concept: 'security-boundaries',
|
|
951
|
+
skill: 'security-auditor',
|
|
952
|
+
interaction: 'agent ↔ shell',
|
|
953
|
+
decision: 'Whitelisted binary execution via execFile with array arguments',
|
|
954
|
+
implementation: 'execFile(whitelistedPath, safeArgsArray)',
|
|
955
|
+
verification: 'Inject arbitrary bash syntax; assert exit with validation error',
|
|
956
|
+
},
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
return records;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
// ============================================================================
|
|
964
|
+
// 6. ASSUMPTIONS & UNKNOWNS ENGINE
|
|
965
|
+
// ============================================================================
|
|
966
|
+
|
|
967
|
+
/**
|
|
968
|
+
* Identify, categorize, and handle engineering assumptions and unknowns.
|
|
969
|
+
*
|
|
970
|
+
* @param {string} taskQuery
|
|
971
|
+
* @returns {Object} Explicit assumptions and critical unknowns
|
|
972
|
+
*/
|
|
973
|
+
function analyzeAssumptionsAndUnknowns(taskQuery) {
|
|
974
|
+
const q = (taskQuery || '').toLowerCase();
|
|
975
|
+
const assumptions = [];
|
|
976
|
+
const unknowns = [];
|
|
977
|
+
|
|
978
|
+
// Default assumption
|
|
979
|
+
assumptions.push({
|
|
980
|
+
assumption: 'Code executes in standard modern Node.js runtime environment',
|
|
981
|
+
status: ASSUMPTION_STATUS.SUPPORTED_BY_REPOSITORY,
|
|
982
|
+
impact: 'Enables standard ES2022+ features and built-in standard library utilities',
|
|
983
|
+
});
|
|
984
|
+
|
|
985
|
+
if (/(?:payment|checkout|billing)/i.test(q)) {
|
|
986
|
+
assumptions.push({
|
|
987
|
+
assumption: 'Downstream payment provider API supports client-generated idempotency keys',
|
|
988
|
+
status: ASSUMPTION_STATUS.INFERRED,
|
|
989
|
+
impact:
|
|
990
|
+
'If provider does not support idempotency keys, duplicate charges cannot be safely prevented at gateway level',
|
|
991
|
+
});
|
|
992
|
+
unknowns.push({
|
|
993
|
+
unknown: 'Expected peak transaction volume and currency exchange requirements',
|
|
994
|
+
impact:
|
|
995
|
+
'Cannot justify distributed multi-region database clustering or multi-currency ledger without scale requirement',
|
|
996
|
+
default_posture:
|
|
997
|
+
'Implement robust single-region ACID transaction boundaries with standard decimal precision',
|
|
998
|
+
});
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
if (/(?:high.?traffic|scale|100k|throughput)/i.test(q)) {
|
|
1002
|
+
unknowns.push({
|
|
1003
|
+
unknown: 'Exact target throughput (Requests Per Second) and latency SLA (p95 / p99)',
|
|
1004
|
+
impact:
|
|
1005
|
+
'Cannot justify complex Redis caching cluster or Kafka partitions without quantified traffic budget',
|
|
1006
|
+
default_posture:
|
|
1007
|
+
'Implement stateless architecture, database connection pooling, and benchmark load harness',
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
if (/(?:agent|shell)/i.test(q)) {
|
|
1012
|
+
assumptions.push({
|
|
1013
|
+
assumption: 'Agent will operate within a controlled developer workspace environment',
|
|
1014
|
+
status: ASSUMPTION_STATUS.INFERRED,
|
|
1015
|
+
impact:
|
|
1016
|
+
'Security boundaries focus on workspace directory containment rather than hypervisor virtualization',
|
|
1017
|
+
});
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
return { assumptions, unknowns };
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
// ============================================================================
|
|
1024
|
+
// 7. SOLUTION SHAPE & IMPLEMENTATION ORDER
|
|
1025
|
+
// ============================================================================
|
|
1026
|
+
|
|
1027
|
+
/**
|
|
1028
|
+
* Generate the comprehensive Engineering Solution Shape before code generation.
|
|
1029
|
+
*
|
|
1030
|
+
* @param {Object} params
|
|
1031
|
+
* @returns {Object} Solution shape
|
|
1032
|
+
*/
|
|
1033
|
+
function buildSolutionShape({
|
|
1034
|
+
taskQuery,
|
|
1035
|
+
requirements,
|
|
1036
|
+
complexityBudget,
|
|
1037
|
+
decisionRecords,
|
|
1038
|
+
assumptions,
|
|
1039
|
+
unknowns,
|
|
1040
|
+
crossDomainAnalysis,
|
|
1041
|
+
}) {
|
|
1042
|
+
const q = (taskQuery || '').toLowerCase();
|
|
1043
|
+
const implementationOrder = [];
|
|
1044
|
+
const earlyValidations = [];
|
|
1045
|
+
|
|
1046
|
+
if (/(?:payment|checkout|billing)/i.test(q)) {
|
|
1047
|
+
implementationOrder.push('1. Define data invariants and payment status state machine');
|
|
1048
|
+
implementationOrder.push(
|
|
1049
|
+
'2. Create idempotency table with UNIQUE constraint on idempotency_key',
|
|
1050
|
+
);
|
|
1051
|
+
implementationOrder.push(
|
|
1052
|
+
'3. Implement database transaction boundary wrapper with rollback hooks',
|
|
1053
|
+
);
|
|
1054
|
+
implementationOrder.push(
|
|
1055
|
+
'4. Implement payment provider client with timeout deadlines and exponential backoff',
|
|
1056
|
+
);
|
|
1057
|
+
implementationOrder.push('5. Implement checkout endpoint mutation handler');
|
|
1058
|
+
implementationOrder.push('6. Add structured audit logging (scrubbing sensitive card data)');
|
|
1059
|
+
implementationOrder.push(
|
|
1060
|
+
'7. Implement adversarial tests (concurrent duplicate requests, provider 500 fault injection)',
|
|
1061
|
+
);
|
|
1062
|
+
implementationOrder.push('8. Execute verification suite and assert outcome contract');
|
|
1063
|
+
|
|
1064
|
+
earlyValidations.push({
|
|
1065
|
+
step: 'Idempotency Constraint Probe',
|
|
1066
|
+
test: 'Insert duplicate idempotency key concurrently',
|
|
1067
|
+
expected: 'Database rejects second insert with UniqueConstraintViolation (409 Conflict)',
|
|
1068
|
+
early_evidence_value: 'Proves double-charge protection before writing gateway integration',
|
|
1069
|
+
});
|
|
1070
|
+
earlyValidations.push({
|
|
1071
|
+
step: 'Transaction Rollback Probe',
|
|
1072
|
+
test: 'Simulate exception midway through payment transaction block',
|
|
1073
|
+
expected: 'All prior mutations rolled back; 0 partial records in database',
|
|
1074
|
+
early_evidence_value: 'Guarantees zero ledger inconsistency upon downstream gateway drops',
|
|
1075
|
+
});
|
|
1076
|
+
} else if (/(?:slow.?query|postgres|query.*faster)/i.test(q)) {
|
|
1077
|
+
implementationOrder.push(
|
|
1078
|
+
'1. Capture baseline execution time and query plan via EXPLAIN (ANALYZE, BUFFERS)',
|
|
1079
|
+
);
|
|
1080
|
+
implementationOrder.push('2. Identify filter selectivity and sequential scan bottlenecks');
|
|
1081
|
+
implementationOrder.push('3. Create targeted composite B-Tree index concurrently');
|
|
1082
|
+
implementationOrder.push('4. Re-run query plan to verify Index Scan transition');
|
|
1083
|
+
implementationOrder.push('5. Measure read latency reduction and write amplification');
|
|
1084
|
+
implementationOrder.push('6. Regression check database memory and buffer pool utilization');
|
|
1085
|
+
|
|
1086
|
+
earlyValidations.push({
|
|
1087
|
+
step: 'Index Planner Probe',
|
|
1088
|
+
test: 'Run EXPLAIN on sample dataset',
|
|
1089
|
+
expected: 'Planner switches from Seq Scan to Index/Bitmap Scan',
|
|
1090
|
+
early_evidence_value:
|
|
1091
|
+
'Confirms query planner utilizes new index before deploying to production',
|
|
1092
|
+
});
|
|
1093
|
+
} else if (/(?:agent|shell)/i.test(q)) {
|
|
1094
|
+
implementationOrder.push('1. Define strict command and argument whitelist');
|
|
1095
|
+
implementationOrder.push(
|
|
1096
|
+
'2. Implement subprocess execFile wrapper bypassing shell interpolation',
|
|
1097
|
+
);
|
|
1098
|
+
implementationOrder.push(
|
|
1099
|
+
'3. Add directory boundary containment checks (path traversal defense)',
|
|
1100
|
+
);
|
|
1101
|
+
implementationOrder.push('4. Implement prompt injection delimiters on user-supplied context');
|
|
1102
|
+
implementationOrder.push('5. Add execution timeout and stdout/stderr buffer caps');
|
|
1103
|
+
implementationOrder.push(
|
|
1104
|
+
'6. Run security penetration test suite with adversarial shell payloads',
|
|
1105
|
+
);
|
|
1106
|
+
|
|
1107
|
+
earlyValidations.push({
|
|
1108
|
+
step: 'Shell Escape Probe',
|
|
1109
|
+
test: 'Pass malicious arguments: `test; id` and `test && whoami`',
|
|
1110
|
+
expected: 'Subprocess treats argument as literal string; zero shell expansion',
|
|
1111
|
+
early_evidence_value: 'Verifies command injection immunity before exposing tool to model',
|
|
1112
|
+
});
|
|
1113
|
+
} else {
|
|
1114
|
+
implementationOrder.push('1. Define core types, interfaces, and validation schemas');
|
|
1115
|
+
implementationOrder.push('2. Implement minimal sufficient functional logic');
|
|
1116
|
+
implementationOrder.push('3. Add error handling and edge-case boundaries');
|
|
1117
|
+
implementationOrder.push('4. Run unit and integration tests');
|
|
1118
|
+
implementationOrder.push('5. Verify baseline stability');
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
return {
|
|
1122
|
+
solution_shape: {
|
|
1123
|
+
task: taskQuery,
|
|
1124
|
+
complexity_budget: complexityBudget.budget,
|
|
1125
|
+
justified_layers: complexityBudget.max_justified_layers,
|
|
1126
|
+
architectural_boundaries: complexityBudget.allowed_infrastructure,
|
|
1127
|
+
decision_records: decisionRecords,
|
|
1128
|
+
assumptions: assumptions,
|
|
1129
|
+
unknowns: unknowns,
|
|
1130
|
+
},
|
|
1131
|
+
implementation_order: implementationOrder,
|
|
1132
|
+
early_validations: earlyValidations,
|
|
1133
|
+
};
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
// ============================================================================
|
|
1137
|
+
// 8. MULTI-OBJECTIVE OUTCOME VERIFICATION & REGRESSION DETECTION
|
|
1138
|
+
// ============================================================================
|
|
1139
|
+
|
|
1140
|
+
/**
|
|
1141
|
+
* Verify outcome against multiple engineering objectives and detect regressions.
|
|
1142
|
+
*
|
|
1143
|
+
* @param {Object} baselineMetrics - Metrics before optimization
|
|
1144
|
+
* @param {Object} currentMetrics - Metrics after implementation
|
|
1145
|
+
* @param {Array<Object>} requirements
|
|
1146
|
+
* @returns {Object} Multi-objective evaluation and regressions
|
|
1147
|
+
*/
|
|
1148
|
+
function verifyOutcomeAndRegressions(baselineMetrics = {}, currentMetrics = {}, requirements = []) {
|
|
1149
|
+
const evaluations = [];
|
|
1150
|
+
const regressions = [];
|
|
1151
|
+
|
|
1152
|
+
// Latency vs Resource Check
|
|
1153
|
+
if (baselineMetrics.p95_latency_ms !== undefined && currentMetrics.p95_latency_ms !== undefined) {
|
|
1154
|
+
const latencyImproved = currentMetrics.p95_latency_ms < baselineMetrics.p95_latency_ms;
|
|
1155
|
+
evaluations.push({
|
|
1156
|
+
dimension: 'Latency (p95)',
|
|
1157
|
+
baseline: `${baselineMetrics.p95_latency_ms}ms`,
|
|
1158
|
+
current: `${currentMetrics.p95_latency_ms}ms`,
|
|
1159
|
+
status: latencyImproved ? 'IMPROVED' : 'REGRESSED',
|
|
1160
|
+
delta_pct:
|
|
1161
|
+
(
|
|
1162
|
+
((currentMetrics.p95_latency_ms - baselineMetrics.p95_latency_ms) /
|
|
1163
|
+
baselineMetrics.p95_latency_ms) *
|
|
1164
|
+
100
|
|
1165
|
+
).toFixed(1) + '%',
|
|
1166
|
+
});
|
|
1167
|
+
|
|
1168
|
+
// Check memory regression
|
|
1169
|
+
if (baselineMetrics.memory_mb !== undefined && currentMetrics.memory_mb !== undefined) {
|
|
1170
|
+
const memorySpike = currentMetrics.memory_mb > baselineMetrics.memory_mb * 1.5;
|
|
1171
|
+
if (latencyImproved && memorySpike) {
|
|
1172
|
+
regressions.push({
|
|
1173
|
+
type: 'LATENCY_IMPROVEMENT_WITH_RESOURCE_REGRESSION',
|
|
1174
|
+
severity: 'HIGH',
|
|
1175
|
+
description: `p95 latency improved (${baselineMetrics.p95_latency_ms}ms → ${currentMetrics.p95_latency_ms}ms), but memory consumption spiked by >50% (${baselineMetrics.memory_mb}MB → ${currentMetrics.memory_mb}MB).`,
|
|
1176
|
+
recommendation: 'Evaluate cache eviction TTL or reduce buffer pool allocation.',
|
|
1177
|
+
});
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
// Cost vs Latency Check
|
|
1183
|
+
if (baselineMetrics.cost_per_req !== undefined && currentMetrics.cost_per_req !== undefined) {
|
|
1184
|
+
const costReduced = currentMetrics.cost_per_req < baselineMetrics.cost_per_req;
|
|
1185
|
+
const latencyRegressed = currentMetrics.p95_latency_ms > baselineMetrics.p95_latency_ms * 1.3;
|
|
1186
|
+
if (costReduced && latencyRegressed) {
|
|
1187
|
+
regressions.push({
|
|
1188
|
+
type: 'COST_REDUCTION_WITH_LATENCY_REGRESSION',
|
|
1189
|
+
severity: 'MEDIUM',
|
|
1190
|
+
description: `Cost reduced (${baselineMetrics.cost_per_req} → ${currentMetrics.cost_per_req}), but latency regressed by >30%.`,
|
|
1191
|
+
recommendation: 'Verify whether latency regression violates service SLA.',
|
|
1192
|
+
});
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
// Functional Test Regression Check
|
|
1197
|
+
if (currentMetrics.failing_tests && currentMetrics.failing_tests > 0) {
|
|
1198
|
+
regressions.push({
|
|
1199
|
+
type: 'FUNCTIONAL_TEST_REGRESSION',
|
|
1200
|
+
severity: 'CRITICAL',
|
|
1201
|
+
description: `${currentMetrics.failing_tests} existing tests failed after changes.`,
|
|
1202
|
+
recommendation: 'Restore baseline functional compliance before completing optimization.',
|
|
1203
|
+
});
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
return {
|
|
1207
|
+
verified: regressions.filter(r => r.severity === 'CRITICAL').length === 0,
|
|
1208
|
+
objective_evaluations: evaluations,
|
|
1209
|
+
regressions: regressions,
|
|
1210
|
+
has_regressions: regressions.length > 0,
|
|
1211
|
+
};
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
// ============================================================================
|
|
1215
|
+
// 9. PHASE 10 METRICS TRACKER
|
|
1216
|
+
// ============================================================================
|
|
1217
|
+
|
|
1218
|
+
class Phase10MetricsTracker {
|
|
1219
|
+
constructor() {
|
|
1220
|
+
this.metrics = {
|
|
1221
|
+
tasks_optimized: 0,
|
|
1222
|
+
requirements_discovered: 0,
|
|
1223
|
+
mandatory_requirements: 0,
|
|
1224
|
+
decisions_recorded: 0,
|
|
1225
|
+
options_evaluated: 0,
|
|
1226
|
+
overengineering_prevented: 0,
|
|
1227
|
+
underengineering_prevented: 0,
|
|
1228
|
+
early_validations_generated: 0,
|
|
1229
|
+
regressions_detected: 0,
|
|
1230
|
+
verified_outcomes: 0,
|
|
1231
|
+
};
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
record(metric, count = 1) {
|
|
1235
|
+
if (this.metrics[metric] !== undefined) {
|
|
1236
|
+
this.metrics[metric] += count;
|
|
1237
|
+
} else {
|
|
1238
|
+
this.metrics[metric] = count;
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
recordEvent(event, count = 1) {
|
|
1243
|
+
this.record(event, count);
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
getMetrics() {
|
|
1247
|
+
return { ...this.metrics };
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
let _phase10MetricsTracker = null;
|
|
1252
|
+
|
|
1253
|
+
function getPhase10MetricsTracker() {
|
|
1254
|
+
if (!_phase10MetricsTracker) {
|
|
1255
|
+
_phase10MetricsTracker = new Phase10MetricsTracker();
|
|
1256
|
+
}
|
|
1257
|
+
return _phase10MetricsTracker;
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
// ============================================================================
|
|
1261
|
+
// 9b. SKILL SELECTION & CAPABILITY DEPTH (Sections 16 & 17)
|
|
1262
|
+
// ============================================================================
|
|
1263
|
+
|
|
1264
|
+
/**
|
|
1265
|
+
* Filter discovered capabilities to determine which actually improve the required outcome.
|
|
1266
|
+
*
|
|
1267
|
+
* @param {Array<Object|string>} discoveredSkills
|
|
1268
|
+
* @param {Array<Object>} requirements
|
|
1269
|
+
* @param {Object} complexityBudget
|
|
1270
|
+
* @returns {Object} Categorized skills and capability depth evaluations
|
|
1271
|
+
*/
|
|
1272
|
+
function evaluateSkillSelection(discoveredSkills = [], requirements = [], complexityBudget = {}) {
|
|
1273
|
+
const isMinimal =
|
|
1274
|
+
complexityBudget.budget === COMPLEXITY_BUDGETS.MINIMAL ||
|
|
1275
|
+
complexityBudget.budget === COMPLEXITY_BUDGETS.LOW;
|
|
1276
|
+
|
|
1277
|
+
const required = [];
|
|
1278
|
+
const conditional = [];
|
|
1279
|
+
const notJustified = [];
|
|
1280
|
+
const depthAudit = [];
|
|
1281
|
+
|
|
1282
|
+
for (const skill of discoveredSkills) {
|
|
1283
|
+
const sName = (typeof skill === 'string' ? skill : skill.name || skill.id || '').toLowerCase();
|
|
1284
|
+
|
|
1285
|
+
// Check if skill represents unneeded distributed bloat for simple task
|
|
1286
|
+
if (isMinimal && /(?:distributed|kafka|k8s|kubernetes|service-mesh|cqrs|redis)/i.test(sName)) {
|
|
1287
|
+
notJustified.push({
|
|
1288
|
+
skill: sName,
|
|
1289
|
+
status: 'NOT_CURRENTLY_JUSTIFIED',
|
|
1290
|
+
reason: `Task complexity (${complexityBudget.budget}) does not justify ${sName}. Avoid premature infrastructure ceremony.`,
|
|
1291
|
+
});
|
|
1292
|
+
} else if (/(?:idempotency|resilience|transaction|security|sql|indexing)/i.test(sName)) {
|
|
1293
|
+
required.push({
|
|
1294
|
+
skill: sName,
|
|
1295
|
+
status: 'REQUIRED',
|
|
1296
|
+
reason:
|
|
1297
|
+
'Directly addresses mandatory reliability, data integrity, or security requirements.',
|
|
1298
|
+
});
|
|
1299
|
+
depthAudit.push({
|
|
1300
|
+
skill: sName,
|
|
1301
|
+
depth: CAPABILITY_DEPTH.FULL,
|
|
1302
|
+
detail: 'Skill covers the core required engineering depth.',
|
|
1303
|
+
});
|
|
1304
|
+
} else if (/(?:caching|cache)/i.test(sName)) {
|
|
1305
|
+
conditional.push({
|
|
1306
|
+
skill: sName,
|
|
1307
|
+
status: 'CONDITIONAL',
|
|
1308
|
+
reason:
|
|
1309
|
+
'Only justified if measured query latency or read load profiling demonstrates necessity.',
|
|
1310
|
+
});
|
|
1311
|
+
} else {
|
|
1312
|
+
required.push({
|
|
1313
|
+
skill: sName,
|
|
1314
|
+
status: 'REQUIRED',
|
|
1315
|
+
reason: 'Supports implementation capabilities for discovered concepts.',
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
return {
|
|
1321
|
+
required,
|
|
1322
|
+
conditional,
|
|
1323
|
+
not_justified: notJustified,
|
|
1324
|
+
capability_depth: depthAudit,
|
|
1325
|
+
};
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
// ============================================================================
|
|
1329
|
+
// 9c. PHASE 10 ENGINEERING OUTCOME MEMORY (Sections 35, 36, 37)
|
|
1330
|
+
// ============================================================================
|
|
1331
|
+
|
|
1332
|
+
class Phase10OutcomeMemory {
|
|
1333
|
+
constructor() {
|
|
1334
|
+
this.decisions = [];
|
|
1335
|
+
this.rejectedApproaches = [];
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
storeDecision(record) {
|
|
1339
|
+
if (!record || !record.decision) return;
|
|
1340
|
+
this.decisions.push({
|
|
1341
|
+
...record,
|
|
1342
|
+
stored_at: new Date().toISOString(),
|
|
1343
|
+
validated: record.validated !== undefined ? record.validated : true,
|
|
1344
|
+
});
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
storeRejectedApproach(record) {
|
|
1348
|
+
if (!record || !record.approach) return;
|
|
1349
|
+
this.rejectedApproaches.push({
|
|
1350
|
+
...record,
|
|
1351
|
+
rejected_at: new Date().toISOString(),
|
|
1352
|
+
});
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
findDecisions(queryContext = '') {
|
|
1356
|
+
const q = queryContext.toLowerCase();
|
|
1357
|
+
return this.decisions.filter(
|
|
1358
|
+
d =>
|
|
1359
|
+
(d.context && d.context.toLowerCase().includes(q)) ||
|
|
1360
|
+
(d.decision && d.decision.toLowerCase().includes(q)) ||
|
|
1361
|
+
(d.reason && d.reason.toLowerCase().includes(q)),
|
|
1362
|
+
);
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
findRejected(queryContext = '') {
|
|
1366
|
+
const q = queryContext.toLowerCase();
|
|
1367
|
+
return this.rejectedApproaches.filter(
|
|
1368
|
+
r =>
|
|
1369
|
+
(r.context && r.context.toLowerCase().includes(q)) ||
|
|
1370
|
+
(r.approach && r.approach.toLowerCase().includes(q)) ||
|
|
1371
|
+
(r.reason && r.reason.toLowerCase().includes(q)),
|
|
1372
|
+
);
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
clear() {
|
|
1376
|
+
this.decisions = [];
|
|
1377
|
+
this.rejectedApproaches = [];
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
let _phase10Memory = null;
|
|
1382
|
+
|
|
1383
|
+
function getPhase10OutcomeMemory() {
|
|
1384
|
+
if (!_phase10Memory) {
|
|
1385
|
+
_phase10Memory = new Phase10OutcomeMemory();
|
|
1386
|
+
}
|
|
1387
|
+
return _phase10Memory;
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
// ============================================================================
|
|
1391
|
+
// 9d. CANONICAL ANTI-SHORTCUT & ANTI-OVERENGINEERING BENCHMARK CHECKS
|
|
1392
|
+
// ============================================================================
|
|
1393
|
+
|
|
1394
|
+
/**
|
|
1395
|
+
* Anti-Shortcut Check (Section 39)
|
|
1396
|
+
* Given a seemingly simple mutation request ("Build an API that creates an order"),
|
|
1397
|
+
* verify that Tribunal surfaces necessary reliability and consistency considerations
|
|
1398
|
+
* rather than accepting the naive "POST -> insert -> return" shortcut.
|
|
1399
|
+
*
|
|
1400
|
+
* @param {string} taskQuery
|
|
1401
|
+
* @returns {Object} Anti-shortcut evaluation
|
|
1402
|
+
*/
|
|
1403
|
+
function runAntiShortcutCheck(taskQuery = 'Build an API that creates an order') {
|
|
1404
|
+
const result = runOutcomeOptimization(taskQuery);
|
|
1405
|
+
const audit = result.architecture_audit;
|
|
1406
|
+
const missing = audit.missing_critical_considerations || [];
|
|
1407
|
+
|
|
1408
|
+
const hasIdempotency =
|
|
1409
|
+
missing.some(m => m.consideration.includes('Idempotency')) ||
|
|
1410
|
+
audit.justified_components.some(c => c.component.includes('Idempotency'));
|
|
1411
|
+
const hasTransaction =
|
|
1412
|
+
missing.some(m => m.consideration.includes('Transaction')) ||
|
|
1413
|
+
audit.justified_components.some(c => c.component.includes('Transaction'));
|
|
1414
|
+
const hasConcurrency =
|
|
1415
|
+
missing.some(m => m.consideration.includes('Concurrency')) ||
|
|
1416
|
+
result.decision_records.some(d => d.interactions?.includes('concurrency'));
|
|
1417
|
+
|
|
1418
|
+
return {
|
|
1419
|
+
task: taskQuery,
|
|
1420
|
+
shortcut_detected: !taskQuery.toLowerCase().includes('idempotenc'),
|
|
1421
|
+
protection_surfaced: hasIdempotency && hasTransaction,
|
|
1422
|
+
critical_considerations_enforced: {
|
|
1423
|
+
idempotency: hasIdempotency,
|
|
1424
|
+
transaction_boundary: hasTransaction,
|
|
1425
|
+
concurrency_lock: hasConcurrency,
|
|
1426
|
+
},
|
|
1427
|
+
passed: hasIdempotency && hasTransaction,
|
|
1428
|
+
};
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
/**
|
|
1432
|
+
* Anti-Overengineering Check (Section 40)
|
|
1433
|
+
* Given a simple local task ("Build a local todo application" or "Build static portfolio"),
|
|
1434
|
+
* verify that Tribunal explicitly rejects unneeded distributed architecture (Kafka, K8s, microservices).
|
|
1435
|
+
*
|
|
1436
|
+
* @param {string} taskQuery
|
|
1437
|
+
* @returns {Object} Anti-overengineering evaluation
|
|
1438
|
+
*/
|
|
1439
|
+
function runAntiOverengineeringCheck(taskQuery = 'Build a local todo application') {
|
|
1440
|
+
const result = runOutcomeOptimization(taskQuery);
|
|
1441
|
+
const audit = result.architecture_audit;
|
|
1442
|
+
const unjustified = audit.unjustified_components || [];
|
|
1443
|
+
|
|
1444
|
+
const rejectedKafka = unjustified.some(u => u.component.includes('Kafka'));
|
|
1445
|
+
const rejectedMicroservices = unjustified.some(u => u.component.includes('Microservices'));
|
|
1446
|
+
const rejectedK8s = unjustified.some(u => u.component.includes('Kubernetes'));
|
|
1447
|
+
|
|
1448
|
+
return {
|
|
1449
|
+
task: taskQuery,
|
|
1450
|
+
complexity_budget: result.complexity_budget,
|
|
1451
|
+
unjustified_components_count: unjustified.length,
|
|
1452
|
+
overengineering_prevented: {
|
|
1453
|
+
kafka: rejectedKafka,
|
|
1454
|
+
microservices: rejectedMicroservices,
|
|
1455
|
+
kubernetes: rejectedK8s,
|
|
1456
|
+
},
|
|
1457
|
+
passed:
|
|
1458
|
+
result.complexity_budget === COMPLEXITY_BUDGETS.LOW ||
|
|
1459
|
+
result.complexity_budget === COMPLEXITY_BUDGETS.MINIMAL,
|
|
1460
|
+
};
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
// ============================================================================
|
|
1464
|
+
// 10. MAIN PHASE 10 ORCHESTRATOR — runOutcomeOptimization
|
|
1465
|
+
// ============================================================================
|
|
1466
|
+
|
|
1467
|
+
/**
|
|
1468
|
+
* Execute the full Phase 10 Engineering Outcome Optimization.
|
|
1469
|
+
*
|
|
1470
|
+
* @param {string} taskQuery
|
|
1471
|
+
* @param {Object} [context]
|
|
1472
|
+
* @returns {Object} Comprehensive Phase 10 Outcome Analysis
|
|
1473
|
+
*/
|
|
1474
|
+
function runOutcomeOptimization(taskQuery, context = {}) {
|
|
1475
|
+
const q = (taskQuery || '').trim();
|
|
1476
|
+
const tracker = getPhase10MetricsTracker();
|
|
1477
|
+
tracker.record('tasks_optimized');
|
|
1478
|
+
|
|
1479
|
+
// Step 1: Discover Requirements
|
|
1480
|
+
const requirements = discoverRequirements(q, context);
|
|
1481
|
+
tracker.record('requirements_discovered', requirements.length);
|
|
1482
|
+
const mandatoryCount = requirements.filter(
|
|
1483
|
+
r => r.priority === REQUIREMENT_PRIORITY.MANDATORY,
|
|
1484
|
+
).length;
|
|
1485
|
+
tracker.record('mandatory_requirements', mandatoryCount);
|
|
1486
|
+
|
|
1487
|
+
// Step 2: Evaluate Complexity Budget
|
|
1488
|
+
const complexityBudget = evaluateComplexityBudget(q, requirements);
|
|
1489
|
+
|
|
1490
|
+
// Step 3: Anti-Slop & Under-Engineering Audit
|
|
1491
|
+
const architectureAudit = auditArchitectureJustification(q, complexityBudget);
|
|
1492
|
+
if (architectureAudit.unjustified_components.length > 0) {
|
|
1493
|
+
tracker.record('overengineering_prevented', architectureAudit.unjustified_components.length);
|
|
1494
|
+
}
|
|
1495
|
+
if (architectureAudit.missing_critical_considerations.length > 0) {
|
|
1496
|
+
tracker.record(
|
|
1497
|
+
'underengineering_prevented',
|
|
1498
|
+
architectureAudit.missing_critical_considerations.length,
|
|
1499
|
+
);
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
// Step 4: Engineering Option Generation & Evaluation
|
|
1503
|
+
const optionsEvaluated = [];
|
|
1504
|
+
for (const t of ARCHITECTURAL_OPTION_TEMPLATES) {
|
|
1505
|
+
if (t.trigger.test(q)) {
|
|
1506
|
+
optionsEvaluated.push({
|
|
1507
|
+
topic: t.topic,
|
|
1508
|
+
options: t.options,
|
|
1509
|
+
});
|
|
1510
|
+
tracker.record('options_evaluated', t.options.length);
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
// Step 5: Engineering Decision Records & Traceability
|
|
1515
|
+
const decisionRecords = generateDecisionRecords(
|
|
1516
|
+
q,
|
|
1517
|
+
requirements,
|
|
1518
|
+
architectureAudit.justified_components,
|
|
1519
|
+
);
|
|
1520
|
+
tracker.record('decisions_recorded', decisionRecords.length);
|
|
1521
|
+
|
|
1522
|
+
// Step 6: Assumptions & Unknowns
|
|
1523
|
+
const { assumptions, unknowns } = analyzeAssumptionsAndUnknowns(q);
|
|
1524
|
+
|
|
1525
|
+
// Step 7: Build Solution Shape & Implementation Order
|
|
1526
|
+
const { solution_shape, implementation_order, early_validations } = buildSolutionShape({
|
|
1527
|
+
taskQuery: q,
|
|
1528
|
+
requirements,
|
|
1529
|
+
complexityBudget,
|
|
1530
|
+
decisionRecords,
|
|
1531
|
+
assumptions,
|
|
1532
|
+
unknowns,
|
|
1533
|
+
crossDomainAnalysis: context.crossDomainAnalysis,
|
|
1534
|
+
});
|
|
1535
|
+
tracker.record('early_validations_generated', early_validations.length);
|
|
1536
|
+
|
|
1537
|
+
// Step 8: Reversibility & Blast Radius Analysis
|
|
1538
|
+
const reversibility =
|
|
1539
|
+
decisionRecords.length > 0 &&
|
|
1540
|
+
decisionRecords.some(d => d.reversibility === REVERSIBILITY_LEVELS.DIFFICULT_TO_REVERSE)
|
|
1541
|
+
? REVERSIBILITY_LEVELS.DIFFICULT_TO_REVERSE
|
|
1542
|
+
: decisionRecords.some(d => d.reversibility === REVERSIBILITY_LEVELS.PARTIALLY_REVERSIBLE)
|
|
1543
|
+
? REVERSIBILITY_LEVELS.PARTIALLY_REVERSIBLE
|
|
1544
|
+
: REVERSIBILITY_LEVELS.EASILY_REVERSIBLE;
|
|
1545
|
+
|
|
1546
|
+
const blastRadius = {
|
|
1547
|
+
tier:
|
|
1548
|
+
complexityBudget.budget === COMPLEXITY_BUDGETS.HIGH
|
|
1549
|
+
? 'HIGH'
|
|
1550
|
+
: complexityBudget.budget === COMPLEXITY_BUDGETS.MODERATE
|
|
1551
|
+
? 'MEDIUM'
|
|
1552
|
+
: 'LOCAL',
|
|
1553
|
+
reversibility: reversibility,
|
|
1554
|
+
affected_subsystems: architectureAudit.justified_components.map(c => c.component),
|
|
1555
|
+
};
|
|
1556
|
+
|
|
1557
|
+
// Step 9: Synthesize Validation Requirements for Verification Plan
|
|
1558
|
+
const validationRequirements = [];
|
|
1559
|
+
for (const edr of decisionRecords) {
|
|
1560
|
+
for (const v of edr.validation || []) {
|
|
1561
|
+
validationRequirements.push({
|
|
1562
|
+
source: edr.title,
|
|
1563
|
+
test: v,
|
|
1564
|
+
reason: edr.reason,
|
|
1565
|
+
priority: 'MANDATORY',
|
|
1566
|
+
});
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
for (const mc of architectureAudit.missing_critical_considerations) {
|
|
1570
|
+
validationRequirements.push({
|
|
1571
|
+
source: mc.consideration,
|
|
1572
|
+
test: `Verify ${mc.consideration} is implemented`,
|
|
1573
|
+
reason: mc.risk,
|
|
1574
|
+
priority: 'CRITICAL',
|
|
1575
|
+
});
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
return {
|
|
1579
|
+
invariant: OUTCOME_INVARIANT,
|
|
1580
|
+
task: q,
|
|
1581
|
+
complexity_budget: complexityBudget.budget,
|
|
1582
|
+
budget_justification: complexityBudget.justification,
|
|
1583
|
+
requirements: requirements,
|
|
1584
|
+
unknowns: unknowns,
|
|
1585
|
+
assumptions: assumptions,
|
|
1586
|
+
architecture_audit: architectureAudit,
|
|
1587
|
+
engineering_options: optionsEvaluated,
|
|
1588
|
+
decision_records: decisionRecords,
|
|
1589
|
+
solution_shape: solution_shape,
|
|
1590
|
+
implementation_order: implementation_order,
|
|
1591
|
+
early_validations: early_validations,
|
|
1592
|
+
blast_radius: blastRadius,
|
|
1593
|
+
validation_requirements: validationRequirements,
|
|
1594
|
+
phase10_metrics: tracker.getMetrics(),
|
|
1595
|
+
};
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
// ============================================================================
|
|
1599
|
+
// EXPORTS
|
|
1600
|
+
// ============================================================================
|
|
1601
|
+
|
|
1602
|
+
module.exports = {
|
|
1603
|
+
OUTCOME_INVARIANT,
|
|
1604
|
+
REQUIREMENT_SOURCES,
|
|
1605
|
+
REQUIREMENT_CATEGORIES,
|
|
1606
|
+
REQUIREMENT_PRIORITY,
|
|
1607
|
+
COMPLEXITY_BUDGETS,
|
|
1608
|
+
ASSUMPTION_STATUS,
|
|
1609
|
+
REVERSIBILITY_LEVELS,
|
|
1610
|
+
CAPABILITY_DEPTH,
|
|
1611
|
+
REASONING_DEPTH,
|
|
1612
|
+
HIGH_RISK_TRIGGERS,
|
|
1613
|
+
ARCHITECTURAL_OPTION_TEMPLATES,
|
|
1614
|
+
|
|
1615
|
+
discoverRequirements,
|
|
1616
|
+
evaluateComplexityBudget,
|
|
1617
|
+
auditArchitectureJustification,
|
|
1618
|
+
generateDecisionRecords,
|
|
1619
|
+
analyzeAssumptionsAndUnknowns,
|
|
1620
|
+
buildSolutionShape,
|
|
1621
|
+
verifyOutcomeAndRegressions,
|
|
1622
|
+
runOutcomeOptimization,
|
|
1623
|
+
|
|
1624
|
+
evaluateSkillSelection,
|
|
1625
|
+
Phase10OutcomeMemory,
|
|
1626
|
+
getPhase10OutcomeMemory,
|
|
1627
|
+
runAntiShortcutCheck,
|
|
1628
|
+
runAntiOverengineeringCheck,
|
|
1629
|
+
|
|
1630
|
+
Phase10MetricsTracker,
|
|
1631
|
+
getPhase10MetricsTracker,
|
|
1632
|
+
};
|