claude-flow-novice 2.5.2 → 2.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/adaptive-context/cfn-v3-reflection.json +21 -0
- package/.claude/agents/AGENT_LIFECYCLE.md +495 -0
- package/.claude/agents/CLAUDE.md +1002 -1233
- package/.claude/agents/accessibility-advocate.md +457 -0
- package/.claude/agents/agent-principles/README.md +226 -226
- package/.claude/agents/agent-principles/agent-type-guidelines.md +10 -0
- package/.claude/agents/agent-principles/format-selection.md +10 -0
- package/.claude/agents/agent-principles/phase4-template-optimization.md +502 -494
- package/.claude/agents/agent-principles/prompt-engineering.md +8 -0
- package/.claude/agents/agent-principles/quality-metrics.md +8 -0
- package/.claude/agents/analysis/code-analyzer.md +7 -17
- package/.claude/agents/analysis/code-review/analyze-code-quality.md +2 -104
- package/.claude/agents/analysis/perf-analyzer.md +2 -196
- package/.claude/agents/context/context-curator.md +78 -84
- package/.claude/agents/context/context-reflector.md +27 -81
- package/.claude/agents/coordinators/README.md +42 -0
- package/.claude/agents/coordinators/cfn-v3-coordinator.md +440 -0
- package/.claude/agents/{product-owner-team → coordinators}/cto-agent.md +154 -187
- package/.claude/agents/coordinators/multi-sprint-coordinator.md +50 -0
- package/.claude/agents/{product-owner-team → coordinators}/product-owner-agent.md +6 -39
- package/.claude/agents/{cfn-loop → coordinators}/product-owner.md +72 -17
- package/.claude/agents/core-agents/reviewer.md +114 -135
- package/.claude/agents/custom/agent-builder.md +637 -0
- package/.claude/agents/developers/README.md +69 -0
- package/.claude/agents/developers/backend-dev.md +77 -0
- package/.claude/agents/{core-agents → developers}/coder.md +131 -26
- package/.claude/agents/developers/react-frontend-engineer.md +121 -0
- package/.claude/agents/{frontend → developers}/state-architect.md +1 -0
- package/.claude/agents/{frontend → developers}/ui-designer.md +1 -0
- package/.claude/agents/development/backend/dev-backend-api.md +0 -29
- package/.claude/agents/development/npm-package-specialist.md +355 -347
- package/.claude/agents/documentation/api-docs/docs-api-openapi.md +8 -0
- package/.claude/agents/documentation/api-docs.md +8 -0
- package/.claude/agents/github/github-commit-agent.md +125 -117
- package/.claude/agents/goal/goal-planner.md +8 -0
- package/.claude/agents/infrastructure/README.md +100 -0
- package/.claude/agents/{specialized → infrastructure}/devops-engineer.md +131 -150
- package/.claude/agents/planners/README.md +94 -0
- package/.claude/agents/{core-agents → planners}/analyst.md +1 -22
- package/.claude/agents/{planning-team → planners}/api-designer-persona.md +8 -0
- package/.claude/agents/{core-agents → planners}/architect.md +7 -20
- package/.claude/agents/{core-agents → planners}/planner.md +0 -21
- package/.claude/agents/{planning-team → planners}/security-architect-persona.md +8 -28
- package/.claude/agents/{planning-team → planners}/system-architect-persona.md +6 -38
- package/.claude/agents/{architecture → planners}/system-architect.md +12 -17
- package/.claude/agents/product-owner-team/accessibility-advocate-persona.md +132 -161
- package/.claude/agents/product-owner-team/power-user-persona.md +149 -182
- package/.claude/agents/retrospective-analyst.md +84 -0
- package/.claude/agents/reviewers/README.md +58 -0
- package/.claude/agents/{analysis → reviewers}/code-quality-validator.md +8 -17
- package/.claude/agents/reviewers/reviewer.md +181 -0
- package/.claude/agents/sparc/architecture.md +6 -25
- package/.claude/agents/sparc/pseudocode.md +6 -0
- package/.claude/agents/sparc/refinement.md +6 -0
- package/.claude/agents/sparc/specification.md +1 -0
- package/.claude/agents/specialists/README.md +60 -0
- package/.claude/agents/{core-agents → specialists}/base-template-generator.md +8 -21
- package/.claude/agents/{specialized → specialists}/cli-agent-optimizer.md +1 -1
- package/.claude/agents/{specialized → specialists}/code-booster.md +1 -0
- package/.claude/agents/{consensus → specialists}/consensus-builder.md +1 -17
- package/.claude/agents/{specialized/mobile → specialists}/mobile-dev.md +0 -20
- package/.claude/agents/{core-agents → specialists}/performance-benchmarker.md +134 -148
- package/.claude/agents/{specialized → specialists}/rust-developer.md +1 -20
- package/.claude/agents/{specialized → specialists}/rust-enterprise-developer.md +1 -20
- package/.claude/agents/{specialized → specialists}/rust-mvp-developer.md +1 -20
- package/.claude/agents/{core-agents → specialists}/security-manager.md +68 -88
- package/.claude/agents/{security → specialists}/security-specialist-existing.md +6 -57
- package/.claude/agents/{security → specialists}/security-specialist.md +6 -30
- package/.claude/agents/{specialized/mobile → specialists}/spec-mobile-react-native.md +2 -21
- package/.claude/agents/testers/README.md +94 -0
- package/.claude/agents/{testing → testers}/e2e/playwright-agent.md +1 -20
- package/.claude/agents/{testing → testers}/interaction-tester.md +1 -20
- package/.claude/agents/{testing → testers}/playwright-tester.md +1 -1
- package/.claude/agents/testers/tester.md +139 -0
- package/.claude/agents/testers/unit/tdd-london-swarm.md +49 -0
- package/.claude/agents/testers/validation/production-validator.md +33 -0
- package/.claude/agents-ignore/cfn-loop-coordinator.md +157 -0
- package/.claude/agents-ignore/cfn-loop-coordinator.md.backup +156 -0
- package/.claude/agents-ignore/coordinator.md.backup +182 -0
- package/.claude/agents-ignore/cost-savings-cfn-loop-coordinator.md +760 -0
- package/.claude/agents-ignore/cost-savings-coordinator.md +173 -0
- package/.claude/artifacts/ace-reflections/REFLECT-001-summary.json +39 -0
- package/.claude/artifacts/ace-reflections/sprint-7_$(date -u +/"%Y%m%d_%H%M%S/").json" +47 -0
- package/.claude/artifacts/reflection-merge-logs/cli-agent-spawning-v2.5.2-merge-report.md +61 -0
- package/.claude/commands/CFN_COORDINATOR_PARAMETERS.md +10 -10
- package/.claude/commands/cfn-loop-epic.md +43 -19
- package/.claude/commands/cfn-loop-single.md +3 -3
- package/.claude/commands/cfn-loop-sprints.md +1 -1
- package/.claude/commands/cfn-loop.md +45 -32
- package/.claude/commands/cfn-mode.md +20 -0
- package/.claude/commands/custom-routing-activate.md +37 -123
- package/.claude/commands/custom-routing-deactivate.md +27 -124
- package/.claude/commands/switch-api.md +41 -16
- package/.claude/commands/write-plan.md +104 -0
- package/.claude/data/cfn-loop.db +0 -0
- package/.claude/data/cfn_loop_logs.db +0 -0
- package/.claude/hooks/BACKUP_USAGE.md +243 -0
- package/.claude/hooks/post-edit-cfn-retrospective.sh +79 -0
- package/.claude/hooks/post-edit.sh +21 -0
- package/.claude/hooks/pre-edit-backup.sh +71 -0
- package/.claude/hooks/restore-from-backup.sh +37 -0
- package/.claude/prompts/cfn-loop-context.md +115 -0
- package/.claude/prompts/loop-specific/loop2.md +50 -0
- package/.claude/prompts/loop-specific/loop3.md +43 -0
- package/.claude/prompts/loop-specific/loop4.md +54 -0
- package/.claude/root-claude-distribute/CLAUDE.md +76 -2
- package/.claude/skills/ace-system/sprint-7-lessons.json +46 -0
- package/.claude/skills/ace-system/store-reflection.sh +33 -136
- package/.claude/skills/agent-discovery/SKILL.md +40 -0
- package/.claude/skills/agent-discovery/agents-registry-clean.json +0 -0
- package/.claude/skills/agent-discovery/agents-registry-fixed.json +19 -0
- package/.claude/skills/agent-discovery/agents-registry.json +718 -0
- package/.claude/skills/agent-discovery/discover-agents.py +175 -0
- package/.claude/skills/agent-discovery/discover-agents.sh +87 -0
- package/.claude/skills/agent-discovery/invoke-registry.sh +11 -0
- package/.claude/skills/agent-discovery/temp_script.py +0 -0
- package/.claude/skills/agent-execution/execute-agent.sh +126 -0
- package/.claude/skills/agent-output-processing/SKILL.md +359 -0
- package/.claude/skills/agent-selector/SKILL.md +90 -0
- package/.claude/skills/agent-selector/select-agents.sh +96 -0
- package/.claude/skills/agent-spawning/agent-selection-guide.md +1 -1
- package/.claude/skills/agent-swap/SKILL.md +36 -0
- package/.claude/skills/agent-swap/recommend-swap.sh +60 -0
- package/.claude/skills/api-validation/test-endpoints.sh +54 -0
- package/.claude/skills/automatic-memory-persistence/SKILL.md +73 -0
- package/.claude/skills/automatic-memory-persistence/persist-agent-output.sh +49 -0
- package/.claude/skills/automatic-memory-persistence/query-agent-history.sh +35 -0
- package/.claude/skills/automatic-memory-persistence/test-memory-persistence.sh +235 -0
- package/.claude/skills/cfn-loop-orchestration/README.md +41 -0
- package/.claude/skills/cfn-loop-orchestration/SKILL.md +299 -0
- package/.claude/skills/cfn-loop-orchestration/helpers/auto-tune-timeouts.sh +228 -0
- package/.claude/skills/cfn-loop-orchestration/helpers/consensus.sh +84 -0
- package/.claude/skills/cfn-loop-orchestration/helpers/deliverable-verifier.sh +71 -0
- package/.claude/skills/cfn-loop-orchestration/helpers/gate-check.sh +90 -0
- package/.claude/skills/cfn-loop-orchestration/helpers/iteration-manager.sh +87 -0
- package/.claude/skills/cfn-loop-orchestration/helpers/timeout-calculator.sh +51 -0
- package/.claude/skills/cfn-loop-orchestration/inject-loop-context.sh +41 -0
- package/.claude/skills/cfn-loop-orchestration/monitor-execution.sh +156 -0
- package/.claude/skills/cfn-loop-orchestration/orchestrate.sh +840 -0
- package/.claude/skills/cfn-loop-orchestration/security_utils.sh +99 -0
- package/.claude/skills/cfn-loop-orchestration/test-cfn-orchestration.sh +281 -0
- package/.claude/skills/cfn-loop-orchestration/test-edge-cases.sh +188 -0
- package/.claude/skills/cfn-loop-validation/SKILL.md +307 -217
- package/.claude/skills/complexity-estimator/SKILL.md +96 -0
- package/.claude/skills/complexity-estimator/estimate-complexity.sh +144 -0
- package/.claude/skills/context-pruner/SKILL.md +75 -0
- package/.claude/skills/context-pruner/prune-context.sh +73 -0
- package/.claude/skills/defense-in-depth/SKILL.md +133 -0
- package/.claude/skills/dependency-extractor/SKILL.md +35 -0
- package/.claude/skills/dependency-extractor/extract-dependencies.sh +66 -0
- package/.claude/skills/epic-decomposer/SKILL.md +44 -0
- package/.claude/skills/epic-decomposer/decompose-epic.sh +104 -0
- package/.claude/skills/improvement-recommender/SKILL.md +33 -0
- package/.claude/skills/improvement-recommender/recommend-improvements.sh +92 -0
- package/.claude/skills/intervention-detector/SKILL.md +39 -0
- package/.claude/skills/intervention-detector/detect-intervention.sh +111 -0
- package/.claude/skills/intervention-orchestrator/SKILL.md +43 -0
- package/.claude/skills/intervention-orchestrator/execute-intervention.sh +59 -0
- package/.claude/skills/loop2-output-processing/SKILL.md +163 -0
- package/.claude/skills/loop2-output-processing/execute-and-extract.sh +77 -0
- package/.claude/skills/loop2-output-processing/execute-and-extract.sh.backup +36 -0
- package/.claude/skills/loop2-output-processing/parse-feedback.sh +147 -0
- package/.claude/skills/loop2-output-processing/process-validator-output.sh +275 -0
- package/.claude/skills/loop2-output-processing/test-bug27-fix.sh +200 -0
- package/.claude/skills/loop2-output-processing/test-loop2-processing.sh +113 -0
- package/.claude/skills/loop3-output-processing/AGENT_COMPLETION_PROTOCOL.md +206 -0
- package/.claude/skills/loop3-output-processing/SKILL.md +421 -0
- package/.claude/skills/loop3-output-processing/calculate-confidence.sh +28 -0
- package/.claude/skills/loop3-output-processing/execute-and-extract.sh +85 -0
- package/.claude/skills/loop3-output-processing/parse-confidence.sh +31 -0
- package/.claude/skills/loop3-output-processing/test-agent-timeout.sh +327 -0
- package/.claude/skills/loop3-output-processing/test-loop3-processing.sh +155 -0
- package/.claude/skills/loop3-output-processing/verify-deliverables.sh +42 -0
- package/.claude/skills/pattern-extraction/SKILL.md +30 -0
- package/.claude/skills/pattern-extraction/extract-patterns.sh +80 -0
- package/.claude/skills/playbook/SKILL.md +113 -0
- package/.claude/skills/playbook/init-playbook.sh +54 -0
- package/.claude/skills/playbook/playbook.db +0 -0
- package/.claude/skills/playbook/query-playbook.sh +79 -0
- package/.claude/skills/playbook/update-playbook.sh +69 -0
- package/.claude/skills/playbook-auto-update/SKILL.md +29 -0
- package/.claude/skills/playbook-auto-update/auto-update-playbook.sh +86 -0
- package/.claude/skills/product-owner-decision/SKILL.md +332 -0
- package/.claude/skills/product-owner-decision/execute-decision.sh +176 -0
- package/.claude/skills/product-owner-decision/parse-decision.sh +66 -0
- package/.claude/skills/product-owner-decision/validate-deliverables.sh +82 -0
- package/.claude/skills/redis-coordination/AGENT_LOGGING.md +280 -0
- package/.claude/skills/redis-coordination/LOGGING.md +260 -0
- package/.claude/skills/redis-coordination/README.md +30 -29
- package/.claude/skills/redis-coordination/SKILL.md +685 -83
- package/.claude/skills/redis-coordination/agent-log.sh +124 -0
- package/.claude/skills/redis-coordination/analyze-task-complexity.sh +277 -0
- package/.claude/skills/redis-coordination/cfn-loop-exec.sh +468 -0
- package/.claude/skills/redis-coordination/collect-confidence-scores.sh +179 -0
- package/.claude/skills/redis-coordination/collect-results.sh +75 -0
- package/.claude/skills/redis-coordination/data/cfn-loop.db +0 -0
- package/.claude/skills/redis-coordination/demos/test-iteration-feedback.sh +320 -0
- package/.claude/skills/redis-coordination/{test-orchestrator.sh → demos/test-orchestrator.sh} +25 -0
- package/.claude/skills/redis-coordination/execute-product-owner-decision.sh +258 -0
- package/.claude/skills/redis-coordination/get-agent-timeout.sh +176 -176
- package/.claude/skills/redis-coordination/init-swarm.sh +6 -1
- package/.claude/skills/redis-coordination/invoke-waiting-mode.sh +106 -183
- package/.claude/skills/redis-coordination/invoke-waiting-mode.sh.backup-p7 +423 -0
- package/.claude/skills/redis-coordination/log-event.sh +109 -0
- package/.claude/skills/redis-coordination/monitor-cfn-violations.sh +391 -0
- package/.claude/skills/redis-coordination/orchestrate-cfn-loop-v3.sh +141 -0
- package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh +31 -933
- package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.backup +38 -0
- package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.backup-1761167675 +1672 -0
- package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.backup-p5 +1604 -0
- package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.backup-phase1 +1550 -0
- package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.backup-phase2 +1621 -0
- package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.backup-phase3 +1621 -0
- package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.bak +0 -0
- package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.broken +1627 -0
- package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.corrupted +80 -0
- package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.deprecated +1864 -0
- package/.claude/skills/redis-coordination/query-logs.sh +103 -0
- package/.claude/skills/redis-coordination/retrieve-context.sh +58 -0
- package/.claude/skills/redis-coordination/select-specialist-agent.sh +371 -0
- package/.claude/skills/redis-coordination/semantic-match-tfidf.py +252 -0
- package/.claude/skills/redis-coordination/send-heartbeat.sh +164 -72
- package/.claude/skills/redis-coordination/signal.sh +38 -0
- package/.claude/skills/redis-coordination/store-context.sh +86 -0
- package/.claude/skills/redis-coordination/store-epic-context.sh +123 -0
- package/.claude/skills/redis-coordination/test-context-injection.sh +354 -0
- package/.claude/skills/redis-coordination/test-timeout-enforcement.sh +513 -0
- package/.claude/skills/redis-coordination/tests/convert-line-endings.sh +15 -0
- package/.claude/skills/redis-coordination/tests/dlq-functionality-test.sh +101 -101
- package/.claude/skills/redis-coordination/tests/edge-cases-test.sh +98 -98
- package/.claude/skills/redis-coordination/tests/integration-test.sh +169 -169
- package/.claude/skills/redis-coordination/tests/retry-mechanism-test.sh +81 -81
- package/.claude/skills/redis-coordination/tests/run-test-suite.sh +91 -91
- package/.claude/skills/redis-coordination/tests/run-tests.sh +4 -0
- package/.claude/skills/redis-coordination/tests/test-primitives.sh +166 -0
- package/.claude/skills/redis-coordination/tests/test-utils.sh +53 -121
- package/.claude/skills/redis-coordination/tests/test_coordination_primitives.sh.deprecated +20 -0
- package/.claude/skills/redis-coordination/tests/test_utils.sh +49 -0
- package/.claude/skills/redis-coordination/v2_modularization/core_orchestration.sh +76 -0
- package/.claude/skills/redis-coordination/validate-parameters.sh +492 -0
- package/.claude/skills/retrospective-report/SKILL.md +31 -0
- package/.claude/skills/retrospective-report/generate-report.sh +101 -0
- package/.claude/skills/run-all-skill-tests.sh +124 -0
- package/.claude/skills/scope-simplifier/SKILL.md +37 -0
- package/.claude/skills/scope-simplifier/simplify-scope.sh +68 -0
- package/.claude/skills/simplified-agent-lifecycle/COST_ANALYSIS.md +49 -0
- package/.claude/skills/simplified-agent-lifecycle/DESIGN.md +98 -0
- package/.claude/skills/simplified-agent-lifecycle/MIGRATION_PLAN.md +74 -0
- package/.claude/skills/skill-builder/SKILL.md +910 -0
- package/.claude/skills/specialist-injection/SKILL.md +41 -0
- package/.claude/skills/specialist-injection/recommend-specialist.sh +57 -0
- package/.claude/skills/sprint-execution/SKILL.md +27 -0
- package/.claude/skills/sprint-execution/execute-sprint-task.sh +59 -0
- package/.claude/skills/sprint-execution/execute-sprint.sh +65 -0
- package/.claude/skills/sprint-planner/SKILL.md +37 -0
- package/.claude/skills/sprint-planner/plan-sprint.sh +85 -0
- package/.claude/skills/standardized-error-handling/SKILL.md +56 -0
- package/.claude/skills/standardized-error-handling/capture-agent-error.sh +87 -0
- package/.claude/skills/standardized-error-handling/test-error-handling.sh +166 -0
- package/.claude/skills/task-classifier/SKILL.md +94 -0
- package/.claude/skills/task-classifier/classify-task.sh +115 -0
- package/.claude/skills/validation-templates/SKILL.md +47 -0
- package/.claude/skills/validation-templates/content.json +38 -0
- package/.claude/skills/validation-templates/data.json +38 -0
- package/.claude/skills/validation-templates/design.json +38 -0
- package/.claude/skills/validation-templates/infrastructure.json +38 -0
- package/.claude/skills/validation-templates/research.json +38 -0
- package/.claude/skills/validation-templates/software.json +38 -0
- package/.claude/skills/webapp-testing/README.md +142 -0
- package/.claude/skills/webapp-testing/SCREENSHOT_NAMING_CONVENTION.md +547 -0
- package/.claude/skills/webapp-testing/SKILL.md +877 -0
- package/.claude/skills/webapp-testing/capture-screenshot.sh +238 -0
- package/.claude/skills/webapp-testing/cfn-loop-integration.sh +265 -0
- package/.claude/skills/webapp-testing/compare-screenshots.sh +199 -0
- package/.claude/skills/webapp-testing/init-storage.sh +150 -0
- package/.claude/skills/webapp-testing/set-baseline.sh +196 -0
- package/.claude/skills/webapp-testing/test-webapp-testing.sh +233 -0
- package/.claude/spawn-pattern-examples.md +3 -3
- package/CLAUDE.md +364 -16
- package/README.md +598 -251
- package/dist/agents/agent-loader.js +146 -165
- package/dist/agents/agent-loader.js.map +1 -1
- package/dist/cli/agent-command.js +153 -0
- package/dist/cli/agent-command.js.map +1 -0
- package/dist/cli/agent-definition-parser.js +183 -0
- package/dist/cli/agent-definition-parser.js.map +1 -0
- package/dist/cli/agent-executor.js +310 -0
- package/dist/cli/agent-executor.js.map +1 -0
- package/dist/cli/agent-prompt-builder.js +268 -0
- package/dist/cli/agent-prompt-builder.js.map +1 -0
- package/dist/cli/agent-spawn.js +56 -2
- package/dist/cli/agent-spawn.js.map +1 -1
- package/dist/cli/anthropic-client.js +421 -0
- package/dist/cli/anthropic-client.js.map +1 -0
- package/dist/cli/cfn-context.js +150 -0
- package/dist/cli/cfn-context.js.map +1 -1
- package/dist/cli/cfn-fork.js +159 -0
- package/dist/cli/cfn-fork.js.map +1 -0
- package/dist/cli/cli-agent-context.js +358 -0
- package/dist/cli/cli-agent-context.js.map +1 -0
- package/dist/cli/config-manager.js +109 -91
- package/dist/cli/config-manager.js.map +1 -1
- package/dist/cli/conversation-fork.js +201 -0
- package/dist/cli/conversation-fork.js.map +1 -0
- package/dist/cli/index.js +119 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/iteration-history.js +188 -0
- package/dist/cli/iteration-history.js.map +1 -0
- package/dist/cli/tool-definitions.js +263 -0
- package/dist/cli/tool-definitions.js.map +1 -0
- package/dist/cli/tool-executor.js +247 -0
- package/dist/cli/tool-executor.js.map +1 -0
- package/dist/hello.js +8 -0
- package/dist/hello.js.map +1 -0
- package/package.json +16 -6
- package/scripts/README.md +68 -0
- package/scripts/cfn-intervention-example.sh +21 -0
- package/scripts/migrate-test-infrastructure.sh +40 -0
- package/scripts/switch-api.sh +233 -0
- package/scripts/validate-test-migration.sh +49 -0
- package/scripts/verify-no-secrets.sh +55 -0
- package/.claude/agents/architecture/system-architect.md.backup +0 -603
- package/.claude/agents/code-booster.md +0 -131
- package/.claude/agents/consensus/performance-benchmarker.md +0 -101
- package/.claude/agents/consensus/security-manager.md +0 -107
- package/.claude/agents/context-curator.md +0 -167
- package/.claude/agents/context-reflector.md +0 -65
- package/.claude/agents/core-agents/cfn-loop-coordinator.md +0 -134
- package/.claude/agents/core-agents/code-quality-validator.md +0 -149
- package/.claude/agents/core-agents/context-curator.md +0 -452
- package/.claude/agents/core-agents/context-reflector.md +0 -273
- package/.claude/agents/core-agents/cost-savings-cfn-loop-coordinator.md +0 -190
- package/.claude/agents/core-agents/tester.md +0 -170
- package/.claude/agents/development/backend-dev.md +0 -165
- package/.claude/agents/devops/devops-engineer.md +0 -148
- package/.claude/agents/frontend/interaction-tester.md +0 -139
- package/.claude/agents/frontend/react-frontend-engineer.md +0 -9
- package/.claude/agents/personas/accessibility-advocate-persona.md +0 -107
- package/.claude/agents/testing/production-validator.md +0 -179
- package/.claude/agents/testing/tdd-london-swarm.md +0 -209
- package/.claude/agents/testing/unit/tdd-london-swarm.md +0 -43
- package/.claude/agents/testing/validation/production-validator.md +0 -43
- package/dist/coordination/fleet-manager.test.js +0 -141
- package/dist/coordination/fleet-manager.test.js.map +0 -1
- package/dist/middleware/transparency-middleware.test.js +0 -184
- package/dist/middleware/transparency-middleware.test.js.map +0 -1
- /package/.claude/agents/{core-agents → developers}/researcher.md +0 -0
- /package/.claude/agents/{consensus → specialists}/crdt-synchronizer.md +0 -0
- /package/.claude/agents/{consensus → specialists}/quorum-manager.md +0 -0
- /package/.claude/agents/{consensus → specialists}/raft-manager.md +0 -0
- /package/.claude/{agents/core-agents → agents-ignore}/coordinator.md +0 -0
- /package/.claude/{agents/core-agents/cost-savings-coordinator.md → agents-ignore/cost-savings-coordinator.md.backup} +0 -0
- /package/.claude/skills/redis-coordination/{phase4-wake-queue-test-report.md → demos/phase4-wake-queue-test-report.md} +0 -0
- /package/.claude/skills/redis-coordination/{test-bzpopmin-fix.sh → demos/test-bzpopmin-fix.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-cancel-swarm.sh → demos/test-cancel-swarm.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-dlq.sh → demos/test-dlq.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-priority-wake-phase4-unix.sh → demos/test-priority-wake-phase4-unix.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-priority-wake-phase4.sh → demos/test-priority-wake-phase4.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-priority-wake.sh → demos/test-priority-wake.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-quick-fix.sh → demos/test-quick-fix.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-quorum-absolute.sh → demos/test-quorum-absolute.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-quorum-fallback.sh → demos/test-quorum-fallback.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-quorum-percentage.sh → demos/test-quorum-percentage.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-quorum-with-retry.sh → demos/test-quorum-with-retry.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-quorum.sh → demos/test-quorum.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-shutdown-handling.sh → demos/test-shutdown-handling.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-shutdown.sh → demos/test-shutdown.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-utils-unix.sh → demos/test-utils-unix.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-utils.sh → demos/test-utils.sh} +0 -0
- /package/.claude/skills/redis-coordination/{test-waiting-mode.sh → demos/test-waiting-mode.sh} +0 -0
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# monitor-cfn-violations.sh - Real-time CFN Loop violation detector
|
|
3
|
+
# Part of Redis Coordination Skill
|
|
4
|
+
#
|
|
5
|
+
# Monitors active CFN Loop executions and detects common violations:
|
|
6
|
+
# - Orchestrator never started
|
|
7
|
+
# - Loop 2 started before Loop 3 complete (gate bypass)
|
|
8
|
+
# - Missing agent completion signals
|
|
9
|
+
# - Heartbeat monitoring not started
|
|
10
|
+
# - Product Owner not consulted
|
|
11
|
+
# - Coordinator timeout issues
|
|
12
|
+
#
|
|
13
|
+
# Alerts sent via Redis pub/sub and WebSocket (web portal integration)
|
|
14
|
+
#
|
|
15
|
+
# Usage: ./monitor-cfn-violations.sh [--interval 30] [--websocket-port 3001]
|
|
16
|
+
#
|
|
17
|
+
# Version: 1.0.0
|
|
18
|
+
# Last Updated: 2025-10-20
|
|
19
|
+
|
|
20
|
+
set -euo pipefail
|
|
21
|
+
|
|
22
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
23
|
+
REDIS_HOST="${REDIS_HOST:-localhost}"
|
|
24
|
+
REDIS_PORT="${REDIS_PORT:-6379}"
|
|
25
|
+
CHECK_INTERVAL=30 # seconds between checks
|
|
26
|
+
WEBSOCKET_PORT=3001
|
|
27
|
+
VIOLATION_LOG="/tmp/cfn-violations.log"
|
|
28
|
+
|
|
29
|
+
# Parse arguments
|
|
30
|
+
while [[ $# -gt 0 ]]; do
|
|
31
|
+
case $1 in
|
|
32
|
+
--interval)
|
|
33
|
+
CHECK_INTERVAL="$2"
|
|
34
|
+
shift 2
|
|
35
|
+
;;
|
|
36
|
+
--websocket-port)
|
|
37
|
+
WEBSOCKET_PORT="$2"
|
|
38
|
+
shift 2
|
|
39
|
+
;;
|
|
40
|
+
*)
|
|
41
|
+
echo "Unknown argument: $1"
|
|
42
|
+
exit 1
|
|
43
|
+
;;
|
|
44
|
+
esac
|
|
45
|
+
done
|
|
46
|
+
|
|
47
|
+
echo "=== CFN Loop Violation Monitor ==="
|
|
48
|
+
echo "Redis: ${REDIS_HOST}:${REDIS_PORT}"
|
|
49
|
+
echo "Check interval: ${CHECK_INTERVAL}s"
|
|
50
|
+
echo "WebSocket port: ${WEBSOCKET_PORT}"
|
|
51
|
+
echo "Log: ${VIOLATION_LOG}"
|
|
52
|
+
echo ""
|
|
53
|
+
|
|
54
|
+
# Initialize violation log
|
|
55
|
+
echo "[$(date -Iseconds)] Monitor started" > "$VIOLATION_LOG"
|
|
56
|
+
|
|
57
|
+
# Function: Send violation alert via Redis pub/sub
|
|
58
|
+
send_violation_alert() {
|
|
59
|
+
local task_id="$1"
|
|
60
|
+
local violation_type="$2"
|
|
61
|
+
local severity="$3" # critical, warning, info
|
|
62
|
+
local description="$4"
|
|
63
|
+
local recommendation="$5"
|
|
64
|
+
local evidence="$6" # JSON string
|
|
65
|
+
|
|
66
|
+
local timestamp=$(date -Iseconds)
|
|
67
|
+
|
|
68
|
+
# Build JSON alert
|
|
69
|
+
local alert=$(jq -nc \
|
|
70
|
+
--arg ts "$timestamp" \
|
|
71
|
+
--arg tid "$task_id" \
|
|
72
|
+
--arg vtype "$violation_type" \
|
|
73
|
+
--arg sev "$severity" \
|
|
74
|
+
--arg desc "$description" \
|
|
75
|
+
--arg rec "$recommendation" \
|
|
76
|
+
--argjson ev "$evidence" \
|
|
77
|
+
'{
|
|
78
|
+
timestamp: $ts,
|
|
79
|
+
task_id: $tid,
|
|
80
|
+
violation_type: $vtype,
|
|
81
|
+
severity: $sev,
|
|
82
|
+
description: $desc,
|
|
83
|
+
recommendation: $rec,
|
|
84
|
+
evidence: $ev
|
|
85
|
+
}')
|
|
86
|
+
|
|
87
|
+
# Publish to task-specific channel
|
|
88
|
+
echo "$alert" | redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" \
|
|
89
|
+
PUBLISH "swarm:${task_id}:violations" >/dev/null
|
|
90
|
+
|
|
91
|
+
# Publish to global violations channel (for web portal)
|
|
92
|
+
echo "$alert" | redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" \
|
|
93
|
+
PUBLISH "cfn:violations:all" >/dev/null
|
|
94
|
+
|
|
95
|
+
# Log violation
|
|
96
|
+
echo "[$(date -Iseconds)] [$severity] $violation_type: $description (task: $task_id)" >> "$VIOLATION_LOG"
|
|
97
|
+
|
|
98
|
+
# Send to WebSocket server if available
|
|
99
|
+
if command -v curl &>/dev/null; then
|
|
100
|
+
curl -s -X POST "http://localhost:${WEBSOCKET_PORT}/api/violations" \
|
|
101
|
+
-H "Content-Type: application/json" \
|
|
102
|
+
-d "$alert" >/dev/null 2>&1 || true
|
|
103
|
+
fi
|
|
104
|
+
|
|
105
|
+
echo " 🚨 [$severity] $violation_type: $description"
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
# Function: Check if orchestrator never started
|
|
109
|
+
check_orchestrator_not_started() {
|
|
110
|
+
local swarm_id="$1"
|
|
111
|
+
|
|
112
|
+
# Get swarm metadata
|
|
113
|
+
local created_at=$(redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" \
|
|
114
|
+
HGET "$swarm_id" created_at 2>/dev/null || echo "")
|
|
115
|
+
|
|
116
|
+
if [ -z "$created_at" ]; then
|
|
117
|
+
return 0 # Swarm doesn't exist, skip
|
|
118
|
+
fi
|
|
119
|
+
|
|
120
|
+
# Calculate time elapsed
|
|
121
|
+
local created_ts=$(date -d "$created_at" +%s 2>/dev/null || echo "0")
|
|
122
|
+
local now_ts=$(date +%s)
|
|
123
|
+
local elapsed=$((now_ts - created_ts))
|
|
124
|
+
|
|
125
|
+
# If swarm exists >2 minutes but no status key, orchestrator never started
|
|
126
|
+
if [ $elapsed -gt 120 ]; then
|
|
127
|
+
local task_id=$(redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" \
|
|
128
|
+
HGET "$swarm_id" task_id 2>/dev/null || echo "unknown")
|
|
129
|
+
|
|
130
|
+
local status_key="swarm:${task_id}:status"
|
|
131
|
+
local status=$(redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" \
|
|
132
|
+
GET "$status_key" 2>/dev/null || echo "")
|
|
133
|
+
|
|
134
|
+
if [ -z "$status" ]; then
|
|
135
|
+
# Check if already alerted
|
|
136
|
+
local alert_key="violation:${task_id}:orchestrator_not_started"
|
|
137
|
+
if ! redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" EXISTS "$alert_key" | grep -q "1"; then
|
|
138
|
+
local evidence=$(jq -nc \
|
|
139
|
+
--arg created "$created_at" \
|
|
140
|
+
--arg elapsed "$elapsed" \
|
|
141
|
+
--arg status_exists "false" \
|
|
142
|
+
'{
|
|
143
|
+
swarm_created_at: $created,
|
|
144
|
+
time_elapsed_seconds: ($elapsed | tonumber),
|
|
145
|
+
status_key_exists: ($status_exists == "true"),
|
|
146
|
+
agent_keys_count: 0
|
|
147
|
+
}')
|
|
148
|
+
|
|
149
|
+
send_violation_alert \
|
|
150
|
+
"$task_id" \
|
|
151
|
+
"orchestrator_never_started" \
|
|
152
|
+
"critical" \
|
|
153
|
+
"Orchestrator was never spawned after ${elapsed}s. Coordinator may have failed at Step 2." \
|
|
154
|
+
"Check coordinator logs. Ensure orchestrator spawned with run_in_background: true" \
|
|
155
|
+
"$evidence"
|
|
156
|
+
|
|
157
|
+
# Mark as alerted (TTL 1 hour)
|
|
158
|
+
redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" \
|
|
159
|
+
SETEX "$alert_key" 3600 "alerted" >/dev/null
|
|
160
|
+
fi
|
|
161
|
+
fi
|
|
162
|
+
fi
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
# Function: Check if Loop 2 started before Loop 3 completed (gate bypass)
|
|
166
|
+
check_gate_bypass() {
|
|
167
|
+
local task_id="$1"
|
|
168
|
+
|
|
169
|
+
# Check if Loop 2 started
|
|
170
|
+
local loop2_start=$(redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" \
|
|
171
|
+
GET "swarm:${task_id}:loop2:started" 2>/dev/null || echo "")
|
|
172
|
+
|
|
173
|
+
if [ -n "$loop2_start" ]; then
|
|
174
|
+
# Check if Loop 3 completed
|
|
175
|
+
local loop3_complete=$(redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" \
|
|
176
|
+
GET "swarm:${task_id}:loop3:complete" 2>/dev/null || echo "")
|
|
177
|
+
|
|
178
|
+
if [ -z "$loop3_complete" ]; then
|
|
179
|
+
local alert_key="violation:${task_id}:gate_bypass"
|
|
180
|
+
if ! redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" EXISTS "$alert_key" | grep -q "1"; then
|
|
181
|
+
local evidence=$(jq -nc \
|
|
182
|
+
--arg loop2_start "$loop2_start" \
|
|
183
|
+
'{
|
|
184
|
+
loop2_started_at: $loop2_start,
|
|
185
|
+
loop3_complete: false,
|
|
186
|
+
gate_passed: false
|
|
187
|
+
}')
|
|
188
|
+
|
|
189
|
+
send_violation_alert \
|
|
190
|
+
"$task_id" \
|
|
191
|
+
"gate_bypass_violation" \
|
|
192
|
+
"critical" \
|
|
193
|
+
"Loop 2 validators started before Loop 3 gate passed. This violates CFN Loop protocol." \
|
|
194
|
+
"Check orchestrator gate check logic. Loop 2 must BLPOP on gate-passed signal." \
|
|
195
|
+
"$evidence"
|
|
196
|
+
|
|
197
|
+
redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" \
|
|
198
|
+
SETEX "$alert_key" 3600 "alerted" >/dev/null
|
|
199
|
+
fi
|
|
200
|
+
fi
|
|
201
|
+
fi
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
# Function: Check if agents completed but orchestrator hung
|
|
205
|
+
check_orchestrator_hang() {
|
|
206
|
+
local task_id="$1"
|
|
207
|
+
|
|
208
|
+
# Get orchestrator status
|
|
209
|
+
local status=$(redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" \
|
|
210
|
+
GET "swarm:${task_id}:status" 2>/dev/null || echo "")
|
|
211
|
+
|
|
212
|
+
# Check if status indicates waiting for agents
|
|
213
|
+
if [[ "$status" =~ loop3_waiting|loop2_waiting ]]; then
|
|
214
|
+
# Count done signals
|
|
215
|
+
local done_keys=$(redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" \
|
|
216
|
+
KEYS "swarm:${task_id}:*:done" 2>/dev/null | wc -l)
|
|
217
|
+
|
|
218
|
+
# Get expected agent count
|
|
219
|
+
local swarm_id=$(redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" \
|
|
220
|
+
GET "task:${task_id}:swarm" 2>/dev/null || echo "swarm:swarm-${task_id}")
|
|
221
|
+
local expected=$(redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" \
|
|
222
|
+
HGET "${swarm_id}:metadata" max_agents 2>/dev/null || echo "0")
|
|
223
|
+
|
|
224
|
+
if [ "$done_keys" -ge "$expected" ] && [ "$expected" -gt 0 ]; then
|
|
225
|
+
# Agents completed but orchestrator still waiting
|
|
226
|
+
local alert_key="violation:${task_id}:orchestrator_hang"
|
|
227
|
+
if ! redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" EXISTS "$alert_key" | grep -q "1"; then
|
|
228
|
+
local evidence=$(jq -nc \
|
|
229
|
+
--arg status "$status" \
|
|
230
|
+
--arg done "$done_keys" \
|
|
231
|
+
--arg expected "$expected" \
|
|
232
|
+
'{
|
|
233
|
+
orchestrator_status: $status,
|
|
234
|
+
done_signals_count: ($done | tonumber),
|
|
235
|
+
expected_agents: ($expected | tonumber)
|
|
236
|
+
}')
|
|
237
|
+
|
|
238
|
+
send_violation_alert \
|
|
239
|
+
"$task_id" \
|
|
240
|
+
"orchestrator_hang_with_complete_agents" \
|
|
241
|
+
"critical" \
|
|
242
|
+
"All agents signaled completion but orchestrator still waiting. Possible BLPOP key mismatch." \
|
|
243
|
+
"Check orchestrator DONE_KEY construction. Verify agent IDs match (with iteration suffix)." \
|
|
244
|
+
"$evidence"
|
|
245
|
+
|
|
246
|
+
redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" \
|
|
247
|
+
SETEX "$alert_key" 3600 "alerted" >/dev/null
|
|
248
|
+
fi
|
|
249
|
+
fi
|
|
250
|
+
fi
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
# Function: Check if coordinator monitoring with timeout
|
|
254
|
+
check_coordinator_timeout_pattern() {
|
|
255
|
+
local task_id="$1"
|
|
256
|
+
|
|
257
|
+
# Check if swarm created but status never updated (5+ min)
|
|
258
|
+
local swarm_id=$(redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" \
|
|
259
|
+
GET "task:${task_id}:swarm" 2>/dev/null || echo "swarm:swarm-${task_id}")
|
|
260
|
+
|
|
261
|
+
local created_at=$(redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" \
|
|
262
|
+
HGET "${swarm_id}:metadata" created_at 2>/dev/null || echo "")
|
|
263
|
+
|
|
264
|
+
if [ -n "$created_at" ]; then
|
|
265
|
+
local created_ts=$(date -d "$created_at" +%s 2>/dev/null || echo "0")
|
|
266
|
+
local now_ts=$(date +%s)
|
|
267
|
+
local elapsed=$((now_ts - created_ts))
|
|
268
|
+
|
|
269
|
+
# Check if swarm cancelled with SIGTERM after ~5-10 minutes
|
|
270
|
+
local status=$(redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" \
|
|
271
|
+
HGET "${swarm_id}:metadata" status 2>/dev/null || echo "")
|
|
272
|
+
local shutdown_reason=$(redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" \
|
|
273
|
+
HGET "${swarm_id}:metadata" shutdown_reason 2>/dev/null || echo "")
|
|
274
|
+
|
|
275
|
+
if [ "$status" = "cancelled" ] && [ "$shutdown_reason" = "SIGTERM_received" ] && [ $elapsed -ge 300 ] && [ $elapsed -le 600 ]; then
|
|
276
|
+
local alert_key="violation:${task_id}:coordinator_timeout"
|
|
277
|
+
if ! redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" EXISTS "$alert_key" | grep -q "1"; then
|
|
278
|
+
local evidence=$(jq -nc \
|
|
279
|
+
--arg created "$created_at" \
|
|
280
|
+
--arg elapsed "$elapsed" \
|
|
281
|
+
--arg reason "$shutdown_reason" \
|
|
282
|
+
'{
|
|
283
|
+
swarm_created_at: $created,
|
|
284
|
+
cancelled_after_seconds: ($elapsed | tonumber),
|
|
285
|
+
shutdown_reason: $reason,
|
|
286
|
+
likely_cause: "coordinator_monitoring_with_bash_timeout"
|
|
287
|
+
}')
|
|
288
|
+
|
|
289
|
+
send_violation_alert \
|
|
290
|
+
"$task_id" \
|
|
291
|
+
"coordinator_monitoring_timeout" \
|
|
292
|
+
"critical" \
|
|
293
|
+
"Coordinator cancelled after ${elapsed}s with SIGTERM. Likely wrapped monitoring in Bash() with timeout." \
|
|
294
|
+
"Check coordinator template. Monitoring must use multiple tool calls in coordinator's own message loop, NOT single Bash() call." \
|
|
295
|
+
"$evidence"
|
|
296
|
+
|
|
297
|
+
redis-cli -h "$REDIS_HOST" -p "$REDIS_HOST" \
|
|
298
|
+
SETEX "$alert_key" 3600 "alerted" >/dev/null
|
|
299
|
+
fi
|
|
300
|
+
fi
|
|
301
|
+
fi
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
# Function: Check if Product Owner skipped
|
|
305
|
+
check_product_owner_skipped() {
|
|
306
|
+
local task_id="$1"
|
|
307
|
+
|
|
308
|
+
# Check if Loop 2 completed
|
|
309
|
+
local loop2_complete=$(redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" \
|
|
310
|
+
GET "swarm:${task_id}:loop2:complete" 2>/dev/null || echo "")
|
|
311
|
+
|
|
312
|
+
if [ -n "$loop2_complete" ]; then
|
|
313
|
+
# Check if Product Owner was consulted
|
|
314
|
+
local po_consulted=$(redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" \
|
|
315
|
+
GET "swarm:${task_id}:product_owner:consulted" 2>/dev/null || echo "")
|
|
316
|
+
|
|
317
|
+
if [ -z "$po_consulted" ]; then
|
|
318
|
+
# Wait 60s after Loop 2 complete to allow time for PO spawn
|
|
319
|
+
local loop2_ts=$(date -d "$loop2_complete" +%s 2>/dev/null || echo "0")
|
|
320
|
+
local now_ts=$(date +%s)
|
|
321
|
+
local elapsed=$((now_ts - loop2_ts))
|
|
322
|
+
|
|
323
|
+
if [ $elapsed -gt 60 ]; then
|
|
324
|
+
local alert_key="violation:${task_id}:po_skipped"
|
|
325
|
+
if ! redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" EXISTS "$alert_key" | grep -q "1"; then
|
|
326
|
+
local evidence=$(jq -nc \
|
|
327
|
+
--arg loop2_complete "$loop2_complete" \
|
|
328
|
+
--arg elapsed "$elapsed" \
|
|
329
|
+
'{
|
|
330
|
+
loop2_completed_at: $loop2_complete,
|
|
331
|
+
time_since_loop2_seconds: ($elapsed | tonumber),
|
|
332
|
+
product_owner_consulted: false
|
|
333
|
+
}')
|
|
334
|
+
|
|
335
|
+
send_violation_alert \
|
|
336
|
+
"$task_id" \
|
|
337
|
+
"product_owner_not_consulted" \
|
|
338
|
+
"warning" \
|
|
339
|
+
"Loop 2 completed ${elapsed}s ago but Product Owner not consulted. Strategic decision skipped." \
|
|
340
|
+
"Check orchestrator Product Owner spawning logic. PO should be spawned after Loop 2 consensus check." \
|
|
341
|
+
"$evidence"
|
|
342
|
+
|
|
343
|
+
redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" \
|
|
344
|
+
SETEX "$alert_key" 3600 "alerted" >/dev/null
|
|
345
|
+
fi
|
|
346
|
+
fi
|
|
347
|
+
fi
|
|
348
|
+
fi
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
# Main monitoring loop
|
|
352
|
+
echo "Starting violation monitoring..."
|
|
353
|
+
echo ""
|
|
354
|
+
|
|
355
|
+
ITERATION=0
|
|
356
|
+
while true; do
|
|
357
|
+
ITERATION=$((ITERATION + 1))
|
|
358
|
+
echo "[Check #${ITERATION}] $(date '+%H:%M:%S')"
|
|
359
|
+
|
|
360
|
+
# Find all active swarm metadata keys
|
|
361
|
+
SWARM_KEYS=$(redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" \
|
|
362
|
+
KEYS "swarm:*:metadata" 2>/dev/null || echo "")
|
|
363
|
+
|
|
364
|
+
if [ -z "$SWARM_KEYS" ]; then
|
|
365
|
+
echo " No active swarms found"
|
|
366
|
+
else
|
|
367
|
+
SWARM_COUNT=$(echo "$SWARM_KEYS" | wc -l)
|
|
368
|
+
echo " Monitoring $SWARM_COUNT swarm(s)..."
|
|
369
|
+
|
|
370
|
+
for SWARM_KEY in $SWARM_KEYS; do
|
|
371
|
+
# Extract task ID
|
|
372
|
+
TASK_ID=$(redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" \
|
|
373
|
+
HGET "$SWARM_KEY" task_id 2>/dev/null || echo "")
|
|
374
|
+
|
|
375
|
+
if [ -z "$TASK_ID" ]; then
|
|
376
|
+
continue
|
|
377
|
+
fi
|
|
378
|
+
|
|
379
|
+
# Run violation checks
|
|
380
|
+
check_orchestrator_not_started "$SWARM_KEY"
|
|
381
|
+
check_gate_bypass "$TASK_ID"
|
|
382
|
+
check_orchestrator_hang "$TASK_ID"
|
|
383
|
+
check_coordinator_timeout_pattern "$TASK_ID"
|
|
384
|
+
check_product_owner_skipped "$TASK_ID"
|
|
385
|
+
done
|
|
386
|
+
fi
|
|
387
|
+
|
|
388
|
+
echo " Sleeping ${CHECK_INTERVAL}s..."
|
|
389
|
+
echo ""
|
|
390
|
+
sleep "$CHECK_INTERVAL"
|
|
391
|
+
done
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
##############################################################################
|
|
4
|
+
# CFN Loop Orchestration v3.0.0
|
|
5
|
+
# Advanced multi-agent coordination with enhanced Redis context retrieval,
|
|
6
|
+
# validation template support, intervention detection, and retrospective capabilities
|
|
7
|
+
#
|
|
8
|
+
# Key Enhancements:
|
|
9
|
+
# - Redis-first context retrieval
|
|
10
|
+
# - Domain-specific validation thresholds
|
|
11
|
+
# - Real-time intervention detection
|
|
12
|
+
# - Automatic playbook update
|
|
13
|
+
# - Retrospective trigger
|
|
14
|
+
# - Z.ai provider routing
|
|
15
|
+
##############################################################################
|
|
16
|
+
|
|
17
|
+
set -euo pipefail
|
|
18
|
+
|
|
19
|
+
# V3 Specific Configuration
|
|
20
|
+
TASK_ID=""
|
|
21
|
+
MODE="standard"
|
|
22
|
+
V3_VALIDATION_TEMPLATE=""
|
|
23
|
+
INTERVENTION_THRESHOLD=0.75
|
|
24
|
+
RETROSPECTIVE_ENABLED=1
|
|
25
|
+
|
|
26
|
+
# Import common v2 functions
|
|
27
|
+
# shellcheck source=./orchestrate-cfn-loop.sh
|
|
28
|
+
source "$(dirname "$0")/orchestrate-cfn-loop.sh"
|
|
29
|
+
|
|
30
|
+
# V3 Specific Configuration Loading
|
|
31
|
+
function load_v3_configuration() {
|
|
32
|
+
# Load configuration from Redis using task context
|
|
33
|
+
V3_CONFIG=$(redis-cli HGETALL "cfn_loop:task:${TASK_ID}:v3_config" 2>/dev/null)
|
|
34
|
+
|
|
35
|
+
# Parse configuration
|
|
36
|
+
while read -r key value; do
|
|
37
|
+
case "$key" in
|
|
38
|
+
"validation_template")
|
|
39
|
+
V3_VALIDATION_TEMPLATE="$value"
|
|
40
|
+
;;
|
|
41
|
+
"intervention_threshold")
|
|
42
|
+
INTERVENTION_THRESHOLD="$value"
|
|
43
|
+
;;
|
|
44
|
+
"retrospective_enabled")
|
|
45
|
+
RETROSPECTIVE_ENABLED="$value"
|
|
46
|
+
;;
|
|
47
|
+
esac
|
|
48
|
+
done <<< "$V3_CONFIG"
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
# Domain-Specific Validation Template Loader
|
|
52
|
+
function load_validation_template() {
|
|
53
|
+
local template_path="$1"
|
|
54
|
+
|
|
55
|
+
if [ ! -f "$template_path" ]; then
|
|
56
|
+
echo "Error: Validation template not found at $template_path"
|
|
57
|
+
return 1
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
# Load and parse validation template
|
|
61
|
+
VALIDATION_CONFIG=$(jq '.' "$template_path")
|
|
62
|
+
|
|
63
|
+
# Extract domain-specific thresholds
|
|
64
|
+
DOMAIN_GATE_THRESHOLD=$(echo "$VALIDATION_CONFIG" | jq -r '.gate_threshold // 0.75')
|
|
65
|
+
DOMAIN_CONSENSUS_THRESHOLD=$(echo "$VALIDATION_CONFIG" | jq -r '.consensus_threshold // 0.90')
|
|
66
|
+
|
|
67
|
+
# Override default thresholds
|
|
68
|
+
GATE=${DOMAIN_GATE_THRESHOLD}
|
|
69
|
+
CONSENSUS=${DOMAIN_CONSENSUS_THRESHOLD}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
# Intervention Detection Function
|
|
73
|
+
function detect_intervention_needed() {
|
|
74
|
+
local confidence_scores=("$@")
|
|
75
|
+
local intervention_triggered=0
|
|
76
|
+
|
|
77
|
+
for score in "${confidence_scores[@]}"; do
|
|
78
|
+
if (( $(echo "$score < $INTERVENTION_THRESHOLD" | bc -l) )); then
|
|
79
|
+
intervention_triggered=1
|
|
80
|
+
break
|
|
81
|
+
fi
|
|
82
|
+
done
|
|
83
|
+
|
|
84
|
+
return $intervention_triggered
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
# Trigger Retrospective Analysis
|
|
88
|
+
function trigger_retrospective() {
|
|
89
|
+
if [ "$RETROSPECTIVE_ENABLED" -eq 1 ]; then
|
|
90
|
+
npx cfn-spawn agent retrospective-analyst \
|
|
91
|
+
--task-id "$TASK_ID" \
|
|
92
|
+
--mode "post_execution" \
|
|
93
|
+
--context "{\"task_id\": \"$TASK_ID\", \"mode\": \"$MODE\"}"
|
|
94
|
+
fi
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
# Automatic Playbook Update
|
|
98
|
+
function update_playbook() {
|
|
99
|
+
./.claude/skills/playbook-auto-update/update.sh \
|
|
100
|
+
--task-id "$TASK_ID" \
|
|
101
|
+
--mode "$MODE" \
|
|
102
|
+
--context "$CFN_METADATA"
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
# Override Main Iteration Logic
|
|
106
|
+
function main_iteration_logic() {
|
|
107
|
+
# V3: Load Redis context first
|
|
108
|
+
load_v3_configuration
|
|
109
|
+
|
|
110
|
+
# Load domain-specific validation template if specified
|
|
111
|
+
if [ -n "$V3_VALIDATION_TEMPLATE" ]; then
|
|
112
|
+
load_validation_template "$V3_VALIDATION_TEMPLATE"
|
|
113
|
+
fi
|
|
114
|
+
|
|
115
|
+
# Original v2 iteration logic with V3 enhancements
|
|
116
|
+
for ITERATION in $(seq 1 $MAX_ITERATIONS); do
|
|
117
|
+
# Existing iteration loop logic here...
|
|
118
|
+
|
|
119
|
+
# V3: Intervention Detection
|
|
120
|
+
if detect_intervention_needed "${AGENT_CONFIDENCE_SCORES[@]}"; then
|
|
121
|
+
echo "[V3 Intervention] Confidence threshold not met. Spawning specialist agent..."
|
|
122
|
+
# Spawn specialist agent to address low-confidence areas
|
|
123
|
+
npx cfn-spawn agent specialist \
|
|
124
|
+
--task-id "$TASK_ID" \
|
|
125
|
+
--mode intervention \
|
|
126
|
+
--context "{\"iteration\": $ITERATION}"
|
|
127
|
+
fi
|
|
128
|
+
|
|
129
|
+
# Continue with existing iteration logic...
|
|
130
|
+
done
|
|
131
|
+
|
|
132
|
+
# Finalization: Trigger Retrospective and Update Playbook
|
|
133
|
+
trigger_retrospective
|
|
134
|
+
update_playbook
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
# Execute Main Logic
|
|
138
|
+
main_iteration_logic
|
|
139
|
+
|
|
140
|
+
# Existing cleanup and exit logic from v2 script
|
|
141
|
+
cleanup_and_exit 0 "cfn_loop_v3_complete"
|