claude-flow-novice 2.9.1 → 2.10.0
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/agents/cfn-dev-team/CLAUDE.md +1086 -0
- package/.claude/agents/cfn-dev-team/README.md +116 -0
- package/.claude/agents/cfn-dev-team/architecture/api-designer-persona.md +149 -0
- package/.claude/agents/cfn-dev-team/architecture/base-template-generator.md +196 -0
- package/.claude/agents/cfn-dev-team/architecture/goal-planner.md +183 -0
- package/.claude/agents/cfn-dev-team/architecture/planner.md +182 -0
- package/.claude/agents/cfn-dev-team/architecture/system-architect.md +162 -0
- package/.claude/agents/cfn-dev-team/coordinators/cfn-frontend-coordinator.md +540 -0
- package/.claude/agents/cfn-dev-team/coordinators/cfn-v3-coordinator.md +20 -14
- package/.claude/agents/cfn-dev-team/coordinators/consensus-builder.md +167 -0
- package/.claude/agents/cfn-dev-team/dev-ops/devops-engineer.md +148 -0
- package/.claude/agents/cfn-dev-team/dev-ops/github-commit-agent.md +118 -0
- package/.claude/agents/cfn-dev-team/dev-ops/kubernetes-specialist.md +540 -0
- package/.claude/agents/cfn-dev-team/developers/backend-dev.md +20 -0
- package/.claude/agents/cfn-dev-team/developers/data/data-engineer.md +585 -0
- package/.claude/agents/cfn-dev-team/developers/database/database-architect.md +276 -0
- package/.claude/agents/cfn-dev-team/developers/dev-backend-api.md +147 -0
- package/.claude/agents/cfn-dev-team/developers/frontend/mobile-dev.md +218 -0
- package/.claude/agents/cfn-dev-team/developers/{react-frontend-engineer.md → frontend/react-frontend-engineer.md} +53 -5
- package/.claude/agents/cfn-dev-team/developers/frontend/spec-mobile-react-native.md +199 -0
- package/.claude/agents/cfn-dev-team/developers/graphql-specialist.md +615 -0
- package/.claude/agents/cfn-dev-team/developers/rust-developer.md +174 -0
- package/.claude/agents/cfn-dev-team/documentation/README-VALIDATION.md +243 -0
- package/.claude/agents/cfn-dev-team/documentation/agent-type-guidelines.md +465 -0
- package/.claude/agents/cfn-dev-team/documentation/api-docs.md +103 -0
- package/.claude/agents/cfn-dev-team/documentation/docs-api-openapi.md +98 -0
- package/.claude/agents/cfn-dev-team/documentation/pseudocode.md +159 -0
- package/.claude/agents/cfn-dev-team/documentation/specification.md +157 -0
- package/.claude/agents/cfn-dev-team/product-owners/accessibility-advocate-persona.md +109 -0
- package/.claude/agents/cfn-dev-team/{coordinators → product-owners}/cto-agent.md +8 -6
- package/.claude/agents/cfn-dev-team/product-owners/power-user-persona.md +190 -0
- package/.claude/agents/cfn-dev-team/{coordinators → product-owners}/product-owner.md +85 -59
- package/.claude/agents/cfn-dev-team/reviewers/quality/analyze-code-quality.md +141 -0
- package/.claude/agents/cfn-dev-team/reviewers/quality/code-analyzer.md +200 -0
- package/.claude/agents/cfn-dev-team/reviewers/quality/cyclomatic-complexity-reducer.md +321 -0
- package/.claude/agents/cfn-dev-team/reviewers/quality/perf-analyzer.md +238 -0
- package/.claude/agents/cfn-dev-team/reviewers/quality/performance-benchmarker.md +101 -0
- package/.claude/agents/cfn-dev-team/reviewers/quality/quality-metrics.md +375 -0
- package/.claude/agents/cfn-dev-team/reviewers/quality/security-specialist.md +193 -0
- package/.claude/agents/cfn-dev-team/reviewers/reviewer.md +39 -0
- package/.claude/agents/cfn-dev-team/testers/interaction-tester.md +31 -0
- package/.claude/agents/cfn-dev-team/testers/load-testing-specialist.md +469 -0
- package/.claude/agents/cfn-dev-team/testers/playwright-tester.md +24 -0
- package/.claude/agents/cfn-dev-team/testers/tester.md +20 -0
- package/.claude/agents/cfn-dev-team/utility/agent-builder.md +151 -0
- package/.claude/agents/cfn-dev-team/utility/analyst.md +178 -0
- package/.claude/agents/cfn-dev-team/utility/claude-code-expert.md +1043 -0
- package/.claude/agents/cfn-dev-team/utility/code-booster.md +139 -0
- package/.claude/agents/cfn-dev-team/utility/context-curator.md +99 -0
- package/.claude/agents/cfn-dev-team/{developers → utility}/researcher.md +6 -4
- package/.claude/commands/cfn/CFN_LOOP_FRONTEND.md +741 -0
- package/.claude/commands/cfn/CFN_LOOP_TASK_MODE.md +353 -0
- package/.claude/commands/cfn/cfn-loop-frontend.md +555 -0
- package/.claude/commands/cfn/cfn-loop.md +168 -7
- package/{CFN-CLAUDE.md → .claude/root-claude-distribute/CFN-CLAUDE.md} +23 -3
- package/.claude/skills/cfn-ace-system/SKILL.md +364 -0
- package/.claude/skills/cfn-ace-system/add-bullet.sh +145 -0
- package/.claude/skills/cfn-ace-system/analyze-anti-pattern-effectiveness.sh +56 -0
- package/.claude/skills/cfn-ace-system/classify-task.sh +18 -0
- package/.claude/skills/cfn-ace-system/export-ace-metrics.sh +48 -0
- package/.claude/skills/cfn-ace-system/extract-tags.sh +385 -0
- package/.claude/skills/cfn-ace-system/format-negative-context.sh +180 -0
- package/.claude/skills/cfn-ace-system/init-indexes.sql +160 -0
- package/.claude/skills/cfn-ace-system/invoke-context-curate.sh +192 -0
- package/.claude/skills/cfn-ace-system/invoke-context-inject.sh +361 -0
- package/.claude/skills/cfn-ace-system/invoke-context-query.sh +139 -0
- package/.claude/skills/cfn-ace-system/invoke-context-reflect.sh +343 -0
- package/.claude/skills/cfn-ace-system/invoke-context-stats.sh +227 -0
- package/.claude/skills/cfn-ace-system/log-merge.sh +67 -0
- package/.claude/skills/cfn-ace-system/monitor-injection-performance.sh +138 -0
- package/.claude/skills/cfn-ace-system/optimize-injection-pipeline.sh +169 -0
- package/.claude/skills/cfn-ace-system/query-anti-patterns.sh +276 -0
- package/.claude/skills/cfn-ace-system/query-contexts.sh +150 -0
- package/.claude/skills/cfn-ace-system/query-reflections.sh +35 -0
- package/.claude/skills/cfn-ace-system/schema/001-create-context-reflections.sql +237 -0
- package/.claude/skills/cfn-ace-system/schema/README.md +723 -0
- package/.claude/skills/cfn-ace-system/schema/SCHEMA_DESIGN_SUMMARY.md +564 -0
- package/.claude/skills/cfn-ace-system/schema/populate-test-data-simple.sh +62 -0
- package/.claude/skills/cfn-ace-system/schema/populate-test-data.sh +247 -0
- package/.claude/skills/cfn-ace-system/schema/run-migration.sh +231 -0
- package/.claude/skills/cfn-ace-system/schema/validate-schema.sql +280 -0
- package/.claude/skills/cfn-ace-system/score-relevance-adapter.sh +138 -0
- package/.claude/skills/cfn-ace-system/score-relevance.sh +253 -0
- package/.claude/skills/cfn-ace-system/sprint-7-lessons.json +46 -0
- package/.claude/skills/cfn-ace-system/store-reflection.sh +46 -0
- package/.claude/skills/cfn-ace-system/test-ace-skill.sh +312 -0
- package/.claude/skills/cfn-ace-system/track-ab-test.sh +42 -0
- package/.claude/skills/cfn-ace-system/update-reflection.sh +41 -0
- package/.claude/skills/cfn-agent-discovery/SKILL.md +40 -0
- package/.claude/skills/cfn-agent-discovery/agents-registry-clean.json +0 -0
- package/.claude/skills/cfn-agent-discovery/agents-registry-fixed.json +19 -0
- package/.claude/skills/cfn-agent-discovery/agents-registry.json +718 -0
- package/.claude/skills/cfn-agent-discovery/discover-agents.py +184 -0
- package/.claude/skills/cfn-agent-discovery/discover-agents.sh +87 -0
- package/.claude/skills/cfn-agent-discovery/invoke-registry.sh +11 -0
- package/.claude/skills/cfn-agent-discovery/temp_script.py +0 -0
- package/.claude/skills/cfn-agent-execution/execute-agent.sh +126 -0
- package/.claude/skills/cfn-agent-output-processing/SKILL.md +359 -0
- package/.claude/skills/cfn-agent-selector/SKILL.md +90 -0
- package/.claude/skills/cfn-agent-selector/select-agents.sh +112 -0
- package/.claude/skills/cfn-agent-spawning/SKILL.md +135 -0
- package/.claude/skills/cfn-agent-spawning/agent-selection-guide.md +814 -0
- package/.claude/skills/cfn-agent-spawning/check-dependencies.sh +30 -0
- package/.claude/skills/cfn-agent-spawning/spawn-agent.sh +263 -0
- package/.claude/skills/cfn-agent-spawning/spawn-templates.sh +613 -0
- package/.claude/skills/cfn-analytics/description-refinement-guide.md +164 -0
- package/.claude/skills/cfn-analytics/log-skill-invocation.js +122 -0
- package/.claude/skills/cfn-analytics/run-production-criteria-tests.sh +126 -0
- package/.claude/skills/cfn-analytics/skill-analytics-dashboard.js +113 -0
- package/.claude/skills/cfn-analytics/skill-invocation-hook.sh +28 -0
- package/.claude/skills/cfn-analytics/skill-invocations.sql +58 -0
- package/.claude/skills/cfn-analytics/test-corpus.json +32 -0
- package/.claude/skills/cfn-analytics/test-data-generator.js +115 -0
- package/.claude/skills/cfn-analytics/test-manual-override-rate.js +285 -0
- package/.claude/skills/cfn-analytics/validate-skill-selection.js +188 -0
- package/.claude/skills/cfn-config-management/SKILL.md +34 -0
- package/.claude/skills/cfn-config-management/check-dependencies.sh +56 -0
- package/.claude/skills/cfn-config-management/config.json +32 -0
- package/.claude/skills/cfn-config-management/manage-config.sh +113 -0
- package/.claude/skills/cfn-event-bus/SKILL.md +412 -0
- package/.claude/skills/cfn-event-bus/config.json +111 -0
- package/.claude/skills/cfn-event-bus/eventbus-wrapper.cjs +69 -0
- package/.claude/skills/cfn-event-bus/invoke-event-publish.sh +147 -0
- package/.claude/skills/cfn-event-bus/invoke-event-subscribe.sh +171 -0
- package/.claude/skills/cfn-event-bus/invoke-lifecycle-track.sh +201 -0
- package/.claude/skills/cfn-event-bus/test-event-bus.sh +280 -0
- package/.claude/skills/cfn-fleet-manager/SKILL.md +412 -0
- package/.claude/skills/cfn-fleet-manager/config.json +60 -0
- package/.claude/skills/cfn-fleet-manager/invoke-fleet-allocate.sh +182 -0
- package/.claude/skills/cfn-fleet-manager/invoke-fleet-balance.sh +239 -0
- package/.claude/skills/cfn-fleet-manager/invoke-fleet-metrics.sh +193 -0
- package/.claude/skills/cfn-fleet-manager/invoke-fleet-register.sh +124 -0
- package/.claude/skills/cfn-fleet-manager/test-fleet-manager.sh +345 -0
- package/.claude/skills/cfn-hook-pipeline/SKILL.md +148 -0
- package/.claude/skills/cfn-hook-pipeline/auto-resolve.sh +66 -0
- package/.claude/skills/cfn-hook-pipeline/check-dependencies.sh +40 -0
- package/.claude/skills/cfn-hook-pipeline/feedback-resolver.sh +452 -0
- package/.claude/skills/cfn-hook-pipeline/post-edit-handler.sh +154 -0
- package/.claude/skills/cfn-hook-pipeline/security-scan.json +60 -0
- package/.claude/skills/cfn-hook-pipeline/security-scanner.sh +121 -0
- package/.claude/skills/cfn-hook-pipeline/test-root-warning-resolution.sh +148 -0
- package/.claude/skills/cfn-hybrid-routing/SKILL.md +46 -0
- package/.claude/skills/cfn-hybrid-routing/check-dependencies.sh +52 -0
- package/.claude/skills/cfn-hybrid-routing/config.json +26 -0
- package/.claude/skills/cfn-hybrid-routing/spawn-worker.sh +44 -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/context-injection.sh +142 -0
- package/.claude/skills/cfn-loop-orchestration/helpers/context-lookup.sh +359 -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/spawn-agents.sh +271 -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 +884 -0
- package/.claude/skills/cfn-loop-orchestration/orchestrate.sh.backup +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 +353 -0
- package/.claude/skills/cfn-loop-validation/check-dependencies.sh +31 -0
- package/.claude/skills/cfn-loop-validation/config.json +161 -0
- package/.claude/skills/cfn-loop-validation/consensus-calculator.js +477 -0
- package/.claude/skills/cfn-loop-validation/evidence-chain.sql +163 -0
- package/.claude/skills/cfn-loop-validation/examples/README.md +453 -0
- package/.claude/skills/cfn-loop-validation/examples/coordinator-full-cfn-loop.sh +234 -0
- package/.claude/skills/cfn-loop-validation/examples/coordinator-loop2-consensus.sh +132 -0
- package/.claude/skills/cfn-loop-validation/examples/coordinator-loop3-gate.sh +115 -0
- package/.claude/skills/cfn-loop-validation/examples/coordinator-redis-integration.sh +186 -0
- package/.claude/skills/cfn-loop-validation/orchestrate-cfn-loop.sh +252 -0
- package/.claude/skills/cfn-loop-validation/validate-iteration.sh +134 -0
- package/.claude/skills/cfn-process-lifecycle/SKILL.md +39 -0
- package/.claude/skills/cfn-process-lifecycle/check-dependencies.sh +58 -0
- package/.claude/skills/cfn-process-lifecycle/config.json +39 -0
- package/.claude/skills/cfn-process-lifecycle/process-manager.sh +144 -0
- package/.claude/skills/cfn-product-owner-decision/SKILL.md +332 -0
- package/.claude/skills/cfn-product-owner-decision/execute-decision.sh +176 -0
- package/.claude/skills/cfn-product-owner-decision/parse-decision.sh +66 -0
- package/.claude/skills/cfn-product-owner-decision/validate-deliverables.sh +82 -0
- package/.claude/skills/cfn-redis-coordination/AGENT_LOGGING.md +280 -0
- package/.claude/skills/cfn-redis-coordination/BZPOPMIN_FIX_SUMMARY.md +209 -0
- package/.claude/skills/cfn-redis-coordination/HEARTBEAT.md +57 -0
- package/.claude/skills/cfn-redis-coordination/HEARTBEAT_MONITORING.md +267 -0
- package/.claude/skills/cfn-redis-coordination/LOGGING.md +260 -0
- package/.claude/skills/cfn-redis-coordination/SECURITY_REVIEW.md +25 -0
- package/.claude/skills/cfn-redis-coordination/SHUTDOWN_HANDLING.md +164 -0
- package/.claude/skills/cfn-redis-coordination/SKILL.md +720 -0
- package/.claude/skills/cfn-redis-coordination/agent-log.sh +124 -0
- package/.claude/skills/cfn-redis-coordination/agent-recovery.sh +75 -0
- package/.claude/skills/cfn-redis-coordination/analyze-task-complexity.sh +277 -0
- package/.claude/skills/cfn-redis-coordination/cancel-swarm.sh +221 -0
- package/.claude/skills/cfn-redis-coordination/cfn-loop-exec.sh +468 -0
- package/.claude/skills/cfn-redis-coordination/cfn-loop-relaunch.sh +29 -0
- package/.claude/skills/cfn-redis-coordination/check-dependencies.sh +32 -0
- package/.claude/skills/cfn-redis-coordination/collect-confidence-scores.sh +179 -0
- package/.claude/skills/cfn-redis-coordination/collect-results.sh +75 -0
- package/.claude/skills/cfn-redis-coordination/complete-swarm.sh +75 -0
- package/.claude/skills/cfn-redis-coordination/config.json +61 -0
- package/.claude/skills/cfn-redis-coordination/data/cfn-loop.db +0 -0
- package/.claude/skills/cfn-redis-coordination/demos/phase4-wake-queue-test-report.md +82 -0
- package/.claude/skills/cfn-redis-coordination/demos/test-bzpopmin-fix.sh +274 -0
- package/.claude/skills/cfn-redis-coordination/demos/test-cancel-swarm.sh +276 -0
- package/.claude/skills/cfn-redis-coordination/demos/test-dlq.sh +129 -0
- package/.claude/skills/cfn-redis-coordination/demos/test-iteration-feedback.sh +320 -0
- package/.claude/skills/cfn-redis-coordination/demos/test-orchestrator.sh +249 -0
- package/.claude/skills/cfn-redis-coordination/demos/test-priority-wake-phase4-unix.sh +148 -0
- package/.claude/skills/cfn-redis-coordination/demos/test-priority-wake-phase4.sh +163 -0
- package/.claude/skills/cfn-redis-coordination/demos/test-priority-wake.sh +138 -0
- package/.claude/skills/cfn-redis-coordination/demos/test-quick-fix.sh +81 -0
- package/.claude/skills/cfn-redis-coordination/demos/test-quorum-absolute.sh +45 -0
- package/.claude/skills/cfn-redis-coordination/demos/test-quorum-fallback.sh +68 -0
- package/.claude/skills/cfn-redis-coordination/demos/test-quorum-percentage.sh +56 -0
- package/.claude/skills/cfn-redis-coordination/demos/test-quorum-with-retry.sh +81 -0
- package/.claude/skills/cfn-redis-coordination/demos/test-quorum.sh +57 -0
- package/.claude/skills/cfn-redis-coordination/demos/test-shutdown-handling.sh +187 -0
- package/.claude/skills/cfn-redis-coordination/demos/test-shutdown.sh +160 -0
- package/.claude/skills/cfn-redis-coordination/demos/test-utils-unix.sh +97 -0
- package/.claude/skills/cfn-redis-coordination/demos/test-utils.sh +97 -0
- package/.claude/skills/cfn-redis-coordination/demos/test-waiting-mode.sh +59 -0
- package/.claude/skills/cfn-redis-coordination/examples/README.md +73 -0
- package/.claude/skills/cfn-redis-coordination/examples/grafana-dashboard.json +352 -0
- package/.claude/skills/cfn-redis-coordination/examples/hierarchical-pattern.sh +127 -0
- package/.claude/skills/cfn-redis-coordination/examples/mesh-pattern.sh +171 -0
- package/.claude/skills/cfn-redis-coordination/examples/timeout-handling.sh +227 -0
- package/.claude/skills/cfn-redis-coordination/examples/waiting-mode-pattern.sh +239 -0
- package/.claude/skills/cfn-redis-coordination/execute-product-owner-decision.sh +258 -0
- package/.claude/skills/cfn-redis-coordination/get-agent-timeout.sh +177 -0
- package/.claude/skills/cfn-redis-coordination/heartbeat-functions.sh +137 -0
- package/.claude/skills/cfn-redis-coordination/heartbeat-protocol.md +106 -0
- package/.claude/skills/cfn-redis-coordination/heartbeat.sh +126 -0
- package/.claude/skills/cfn-redis-coordination/init-swarm.sh +148 -0
- package/.claude/skills/cfn-redis-coordination/invoke-redis-pattern.sh +220 -0
- package/.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh +283 -0
- package/.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh.backup-p7 +423 -0
- package/.claude/skills/cfn-redis-coordination/list-active-swarms.sh +147 -0
- package/.claude/skills/cfn-redis-coordination/log-event.sh +109 -0
- package/.claude/skills/cfn-redis-coordination/metrics-export.sh +674 -0
- package/.claude/skills/cfn-redis-coordination/metrics-schema.json +66 -0
- package/.claude/skills/cfn-redis-coordination/metrics-storage.md +31 -0
- package/.claude/skills/cfn-redis-coordination/monitor-cfn-violations.sh +391 -0
- package/.claude/skills/cfn-redis-coordination/monitor-heartbeats.sh +101 -0
- package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop-v3.sh +141 -0
- package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh +31 -0
- package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup +38 -0
- package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-1761167675 +1672 -0
- package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-p5 +1604 -0
- package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase1 +1550 -0
- package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase2 +1621 -0
- package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase3 +1621 -0
- package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.bak +0 -0
- package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.broken +1627 -0
- package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.corrupted +80 -0
- package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.deprecated +1864 -0
- package/.claude/skills/cfn-redis-coordination/priority-wake-mechanism.md +75 -0
- package/.claude/skills/cfn-redis-coordination/priority_wake.py +134 -0
- package/.claude/skills/cfn-redis-coordination/query-dlq.sh +162 -0
- package/.claude/skills/cfn-redis-coordination/query-logs.sh +103 -0
- package/.claude/skills/cfn-redis-coordination/redis-pattern.sh +619 -0
- package/.claude/skills/cfn-redis-coordination/retrieve-context.sh +58 -0
- package/.claude/skills/cfn-redis-coordination/select-specialist-agent.sh +371 -0
- package/.claude/skills/cfn-redis-coordination/semantic-match-tfidf.py +252 -0
- package/.claude/skills/cfn-redis-coordination/send-heartbeat.sh +165 -0
- package/.claude/skills/cfn-redis-coordination/signal.sh +38 -0
- package/.claude/skills/cfn-redis-coordination/store-context.sh +86 -0
- package/.claude/skills/cfn-redis-coordination/store-epic-context.sh +123 -0
- package/.claude/skills/cfn-redis-coordination/test-context-injection.sh +354 -0
- package/.claude/skills/cfn-redis-coordination/test-timeout-enforcement.sh +513 -0
- package/.claude/skills/cfn-redis-coordination/tests/convert-line-endings.sh +15 -0
- package/.claude/skills/cfn-redis-coordination/tests/dlq-functionality-test.sh +102 -0
- package/.claude/skills/cfn-redis-coordination/tests/edge-cases-test.sh +99 -0
- package/.claude/skills/cfn-redis-coordination/tests/integration-test.sh +170 -0
- package/.claude/skills/cfn-redis-coordination/tests/retry-mechanism-test.sh +82 -0
- package/.claude/skills/cfn-redis-coordination/tests/run-test-suite.sh +92 -0
- package/.claude/skills/cfn-redis-coordination/tests/run-tests.sh +4 -0
- package/.claude/skills/cfn-redis-coordination/tests/test-heartbeat-monitoring.sh +418 -0
- package/.claude/skills/cfn-redis-coordination/tests/test-heartbeat-simple.sh +124 -0
- package/.claude/skills/cfn-redis-coordination/tests/test-primitives.sh +166 -0
- package/.claude/skills/cfn-redis-coordination/tests/test-utils.sh +54 -0
- package/.claude/skills/cfn-redis-coordination/tests/test_coordination_primitives.sh.deprecated +20 -0
- package/.claude/skills/cfn-redis-coordination/tests/test_utils.sh +49 -0
- package/.claude/skills/cfn-redis-coordination/v2_modularization/core_orchestration.sh +76 -0
- package/.claude/skills/cfn-redis-coordination/validate-parameters.sh +492 -0
- package/.claude/skills/cfn-sqlite-memory/IMPLEMENTATION_REPORT.md +393 -0
- package/.claude/skills/cfn-sqlite-memory/QUICK_REFERENCE.md +204 -0
- package/.claude/skills/cfn-sqlite-memory/SKILL.md +415 -0
- package/.claude/skills/cfn-sqlite-memory/acl-queries.sql +452 -0
- package/.claude/skills/cfn-sqlite-memory/check-dependencies.sh +36 -0
- package/.claude/skills/cfn-sqlite-memory/config.json +45 -0
- package/.claude/skills/cfn-sqlite-memory/memory-cli.sh +88 -0
- package/.claude/skills/cfn-sqlite-memory/test-state-persistence.js +187 -0
- package/.claude/skills/cfn-sqlite-memory/ttl-cleanup.sh +274 -0
- package/.claude/skills/cfn-test-execution/SKILL.md +128 -0
- package/.claude/skills/cfn-test-execution/check-dependencies.sh +36 -0
- package/.claude/skills/cfn-test-execution/test-cache-reader.sh +134 -0
- package/.claude/skills/cfn-test-execution/test-concurrent-conflicts.sh +115 -0
- package/.claude/skills/cfn-test-execution/test-coordinator-pattern.sh +109 -0
- package/.claude/skills/cfn-transparency-middleware/Cargo.toml +18 -0
- package/.claude/skills/cfn-transparency-middleware/SECURITY.md +41 -0
- package/.claude/skills/cfn-transparency-middleware/SKILL.md +91 -0
- package/.claude/skills/cfn-transparency-middleware/TEST_RESULTS.md +174 -0
- package/.claude/skills/cfn-transparency-middleware/config.json +31 -0
- package/.claude/skills/cfn-transparency-middleware/examples/basic-usage.ts +39 -0
- package/.claude/skills/cfn-transparency-middleware/examples/batch-processing.ts +52 -0
- package/.claude/skills/cfn-transparency-middleware/examples/custom-filtering.ts +61 -0
- package/.claude/skills/cfn-transparency-middleware/invoke-transparency-filter.sh +98 -0
- package/.claude/skills/cfn-transparency-middleware/invoke-transparency-init.sh +224 -0
- package/.claude/skills/cfn-transparency-middleware/invoke-transparency-level.sh +333 -0
- package/.claude/skills/cfn-transparency-middleware/invoke-transparency-metrics.sh +345 -0
- package/.claude/skills/cfn-transparency-middleware/invoke-transparency-observe.sh +140 -0
- package/.claude/skills/cfn-transparency-middleware/invoke-transparency-stop.sh +235 -0
- package/.claude/skills/cfn-transparency-middleware/memory_query.rs +85 -0
- package/.claude/skills/cfn-transparency-middleware/memory_repository.rs +140 -0
- package/.claude/skills/cfn-transparency-middleware/memory_schema.rs +64 -0
- package/.claude/skills/cfn-transparency-middleware/middleware-config.sh +29 -0
- package/.claude/skills/cfn-transparency-middleware/performance-benchmark.sh +79 -0
- package/.claude/skills/cfn-transparency-middleware/test-e2e.sh +406 -0
- package/.claude/skills/cfn-transparency-middleware/test-integration.sh +162 -0
- package/.claude/skills/cfn-transparency-middleware/test-transparency-skill.sh +368 -0
- package/.claude/skills/cfn-transparency-middleware/test-transparency-skill.sh.unix +126 -0
- package/.claude/skills/cfn-transparency-middleware/tests/input-validation.sh +93 -0
- package/.claude/skills/cfn-transparency-middleware/wrap-agent.sh +132 -0
- package/.claude/skills/cfn-webapp-testing/SCREENSHOT_NAMING_CONVENTION.md +547 -0
- package/.claude/skills/cfn-webapp-testing/SKILL.md +877 -0
- package/.claude/skills/cfn-webapp-testing/capture-screenshot.sh +238 -0
- package/.claude/skills/cfn-webapp-testing/cfn-loop-integration.sh +265 -0
- package/.claude/skills/cfn-webapp-testing/compare-screenshots.sh +199 -0
- package/.claude/skills/cfn-webapp-testing/init-storage.sh +150 -0
- package/.claude/skills/cfn-webapp-testing/set-baseline.sh +196 -0
- package/.claude/skills/cfn-webapp-testing/test-webapp-testing.sh +233 -0
- package/README.md +51 -2
- package/dist/ace/ace-reflector.js +109 -10
- package/dist/ace/ace-reflector.js.map +1 -1
- package/dist/cli/agent-executor.js +1 -1
- package/dist/cli/agent-executor.js.map +1 -1
- package/package.json +43 -7
- package/readme/README.md +15 -4
- package/scripts/init-project.js +39 -2
- package/scripts/run-marketing-tests.sh +43 -0
- package/scripts/update_paths.sh +47 -0
- package/tools/install-lizard.sh +37 -0
- package/tools/simple-complexity.sh +44 -0
- package/.claude/agents/cfn-dev-team/developers/coder.md +0 -270
- package/.claude/agents/cfn-dev-team/developers/state-architect.md +0 -127
- package/.claude/agents/cfn-dev-team/reviewers/code-quality-validator.md +0 -128
- /package/.claude/agents/cfn-dev-team/developers/{ui-designer.md → frontend/ui-designer.md} +0 -0
- /package/.claude/agents/cfn-dev-team/{coordinators → product-owners}/product-owner-agent.md +0 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# Agent Logging Utility - Dual output (terminal + Redis)
|
|
4
|
+
#
|
|
5
|
+
# Usage:
|
|
6
|
+
# source agent-log.sh
|
|
7
|
+
# agent_log "info" "Message here"
|
|
8
|
+
# agent_log "error" "Error occurred"
|
|
9
|
+
#
|
|
10
|
+
# Or as standalone:
|
|
11
|
+
# ./agent-log.sh "info" "Agent started" --agent-id "researcher-1" --task-id "task-123"
|
|
12
|
+
|
|
13
|
+
set -euo pipefail
|
|
14
|
+
|
|
15
|
+
# Color codes for terminal output
|
|
16
|
+
COLOR_RESET="\033[0m"
|
|
17
|
+
COLOR_DEBUG="\033[0;36m" # Cyan
|
|
18
|
+
COLOR_INFO="\033[0;32m" # Green
|
|
19
|
+
COLOR_WARN="\033[0;33m" # Yellow
|
|
20
|
+
COLOR_ERROR="\033[0;31m" # Red
|
|
21
|
+
COLOR_AGENT="\033[0;35m" # Magenta
|
|
22
|
+
|
|
23
|
+
# Get color for log level
|
|
24
|
+
get_log_color() {
|
|
25
|
+
local level="$1"
|
|
26
|
+
case "$level" in
|
|
27
|
+
debug) echo "$COLOR_DEBUG" ;;
|
|
28
|
+
info) echo "$COLOR_INFO" ;;
|
|
29
|
+
warn) echo "$COLOR_WARN" ;;
|
|
30
|
+
error) echo "$COLOR_ERROR" ;;
|
|
31
|
+
*) echo "$COLOR_RESET" ;;
|
|
32
|
+
esac
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
# Main logging function
|
|
36
|
+
# Usage: agent_log <level> <message> [--agent-id <id>] [--task-id <id>] [--no-terminal] [--no-redis]
|
|
37
|
+
agent_log() {
|
|
38
|
+
local LEVEL="${1:-info}"
|
|
39
|
+
local MESSAGE="${2:-}"
|
|
40
|
+
local AGENT_ID="${AGENT_ID:-unknown}"
|
|
41
|
+
local TASK_ID="${TASK_ID:-unknown}"
|
|
42
|
+
local REPOSITORY=$(basename "$(pwd)")
|
|
43
|
+
local NO_TERMINAL=false
|
|
44
|
+
local NO_REDIS=false
|
|
45
|
+
|
|
46
|
+
# Parse optional arguments
|
|
47
|
+
shift 2 || true
|
|
48
|
+
while [[ $# -gt 0 ]]; do
|
|
49
|
+
case "$1" in
|
|
50
|
+
--agent-id)
|
|
51
|
+
AGENT_ID="$2"
|
|
52
|
+
shift 2
|
|
53
|
+
;;
|
|
54
|
+
--task-id)
|
|
55
|
+
TASK_ID="$2"
|
|
56
|
+
shift 2
|
|
57
|
+
;;
|
|
58
|
+
--no-terminal)
|
|
59
|
+
NO_TERMINAL=true
|
|
60
|
+
shift
|
|
61
|
+
;;
|
|
62
|
+
--no-redis)
|
|
63
|
+
NO_REDIS=true
|
|
64
|
+
shift
|
|
65
|
+
;;
|
|
66
|
+
*)
|
|
67
|
+
shift
|
|
68
|
+
;;
|
|
69
|
+
esac
|
|
70
|
+
done
|
|
71
|
+
|
|
72
|
+
local TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
73
|
+
local COLOR=$(get_log_color "$LEVEL")
|
|
74
|
+
|
|
75
|
+
# 1. Terminal output (with colors)
|
|
76
|
+
if [ "$NO_TERMINAL" = false ]; then
|
|
77
|
+
echo -e "${COLOR}[${LEVEL^^}]${COLOR_RESET} ${COLOR_AGENT}[${AGENT_ID}]${COLOR_RESET} ${MESSAGE}"
|
|
78
|
+
fi
|
|
79
|
+
|
|
80
|
+
# 2. File output (no colors, in /tmp)
|
|
81
|
+
local LOG_FILE="/tmp/agent-${AGENT_ID}.log"
|
|
82
|
+
echo "[${TIMESTAMP}] [${LEVEL^^}] [${AGENT_ID}] ${MESSAGE}" >> "$LOG_FILE"
|
|
83
|
+
|
|
84
|
+
# 3. Redis pub/sub (for portal)
|
|
85
|
+
if [ "$NO_REDIS" = false ]; then
|
|
86
|
+
local LOG_PAYLOAD=$(cat <<EOF
|
|
87
|
+
{
|
|
88
|
+
"level": "${LEVEL}",
|
|
89
|
+
"message": "${MESSAGE}",
|
|
90
|
+
"agentId": "${AGENT_ID}",
|
|
91
|
+
"taskId": "${TASK_ID}",
|
|
92
|
+
"repository": "${REPOSITORY}",
|
|
93
|
+
"timestamp": "${TIMESTAMP}"
|
|
94
|
+
}
|
|
95
|
+
EOF
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
# Publish to Redis channel: swarm:<task-id>:logs
|
|
99
|
+
redis-cli publish "swarm:${TASK_ID}:logs" "$LOG_PAYLOAD" > /dev/null 2>&1 || true
|
|
100
|
+
|
|
101
|
+
# Also add to sorted set for persistence (with timestamp as score)
|
|
102
|
+
local SCORE=$(date +%s)
|
|
103
|
+
redis-cli zadd "swarm:${TASK_ID}:logs:history" "$SCORE" "$LOG_PAYLOAD" > /dev/null 2>&1 || true
|
|
104
|
+
|
|
105
|
+
# Set TTL on history (7 days)
|
|
106
|
+
redis-cli expire "swarm:${TASK_ID}:logs:history" 604800 > /dev/null 2>&1 || true
|
|
107
|
+
fi
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
# If script is executed directly (not sourced)
|
|
111
|
+
if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
|
|
112
|
+
if [ $# -lt 2 ]; then
|
|
113
|
+
echo "Usage: $0 <level> <message> [--agent-id <id>] [--task-id <id>]"
|
|
114
|
+
echo ""
|
|
115
|
+
echo "Levels: debug, info, warn, error"
|
|
116
|
+
echo ""
|
|
117
|
+
echo "Examples:"
|
|
118
|
+
echo " $0 info \"Agent started\" --agent-id researcher-1 --task-id task-123"
|
|
119
|
+
echo " $0 error \"Connection failed\" --agent-id reviewer-2 --task-id task-456"
|
|
120
|
+
exit 1
|
|
121
|
+
fi
|
|
122
|
+
|
|
123
|
+
agent_log "$@"
|
|
124
|
+
fi
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Redis Coordination Skill - Agent Emergency Recovery
|
|
3
|
+
# Version: 1.0.0
|
|
4
|
+
# Last Updated: 2025-10-19
|
|
5
|
+
|
|
6
|
+
# Strict error handling
|
|
7
|
+
set -euo pipefail
|
|
8
|
+
|
|
9
|
+
# Default values
|
|
10
|
+
TASK_ID=""
|
|
11
|
+
AGENT_ID=""
|
|
12
|
+
RECOVERY_MODE="soft" # Options: soft, hard
|
|
13
|
+
|
|
14
|
+
# Parse command-line arguments
|
|
15
|
+
while [[ $# -gt 0 ]]; do
|
|
16
|
+
case "$1" in
|
|
17
|
+
--task-id)
|
|
18
|
+
TASK_ID="$2"
|
|
19
|
+
shift 2
|
|
20
|
+
;;
|
|
21
|
+
--agent-id)
|
|
22
|
+
AGENT_ID="$2"
|
|
23
|
+
shift 2
|
|
24
|
+
;;
|
|
25
|
+
--mode)
|
|
26
|
+
RECOVERY_MODE="$2"
|
|
27
|
+
shift 2
|
|
28
|
+
;;
|
|
29
|
+
*)
|
|
30
|
+
echo "Unknown parameter: $1"
|
|
31
|
+
exit 1
|
|
32
|
+
;;
|
|
33
|
+
esac
|
|
34
|
+
done
|
|
35
|
+
|
|
36
|
+
# Validate required parameters
|
|
37
|
+
if [[ -z "$TASK_ID" || -z "$AGENT_ID" ]]; then
|
|
38
|
+
echo "Error: task-id and agent-id are required"
|
|
39
|
+
exit 1
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
# Log recovery attempt
|
|
43
|
+
echo "[$(date -u)] Attempting ${RECOVERY_MODE} recovery for agent: ${AGENT_ID}" >> /var/log/claude-flow/agent-recovery.log
|
|
44
|
+
|
|
45
|
+
# Retrieve agent context before recovery
|
|
46
|
+
AGENT_CONTEXT=$(redis-cli get "swarm:${TASK_ID}:${AGENT_ID}:context")
|
|
47
|
+
|
|
48
|
+
# Recovery actions based on mode
|
|
49
|
+
case "$RECOVERY_MODE" in
|
|
50
|
+
"soft")
|
|
51
|
+
# Soft recovery: Spawn new agent with previous context
|
|
52
|
+
npx claude-flow@alpha spawn "$AGENT_ID" \
|
|
53
|
+
--task-id "$TASK_ID" \
|
|
54
|
+
--recovery-context "$AGENT_CONTEXT"
|
|
55
|
+
;;
|
|
56
|
+
"hard")
|
|
57
|
+
# Hard recovery: Full agent replacement
|
|
58
|
+
npx claude-flow@alpha spawn "$AGENT_ID" \
|
|
59
|
+
--task-id "$TASK_ID" \
|
|
60
|
+
--mode replace \
|
|
61
|
+
--recovery-context "$AGENT_CONTEXT"
|
|
62
|
+
;;
|
|
63
|
+
*)
|
|
64
|
+
echo "Invalid recovery mode: ${RECOVERY_MODE}"
|
|
65
|
+
exit 1
|
|
66
|
+
;;
|
|
67
|
+
esac
|
|
68
|
+
|
|
69
|
+
# Update active agents set
|
|
70
|
+
redis-cli sadd "swarm:${TASK_ID}:active-agents" "$AGENT_ID"
|
|
71
|
+
|
|
72
|
+
# Log recovery completion
|
|
73
|
+
echo "[$(date -u)] Recovery completed for agent: ${AGENT_ID}" >> /var/log/claude-flow/agent-recovery.log
|
|
74
|
+
|
|
75
|
+
exit 0
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
##############################################################################
|
|
3
|
+
# Task Complexity Analyzer
|
|
4
|
+
#
|
|
5
|
+
# Purpose: Deterministically analyze task complexity and determine optimal
|
|
6
|
+
# number of Loop 3 agents needed.
|
|
7
|
+
#
|
|
8
|
+
# Usage:
|
|
9
|
+
# ./analyze-task-complexity.sh --task "Build React dashboard" [--difficulty auto]
|
|
10
|
+
#
|
|
11
|
+
# Output (JSON):
|
|
12
|
+
# {
|
|
13
|
+
# "complexity_score": 7.5,
|
|
14
|
+
# "difficulty": "standard",
|
|
15
|
+
# "domains": ["frontend", "backend"],
|
|
16
|
+
# "suggested_agents": {
|
|
17
|
+
# "loop3_count": 3,
|
|
18
|
+
# "loop2_count": 4
|
|
19
|
+
# },
|
|
20
|
+
# "reasoning": "Multi-domain task with moderate scope"
|
|
21
|
+
# }
|
|
22
|
+
##############################################################################
|
|
23
|
+
|
|
24
|
+
set -euo pipefail
|
|
25
|
+
|
|
26
|
+
# Configuration
|
|
27
|
+
TASK_DESCRIPTION=""
|
|
28
|
+
DIFFICULTY="auto" # auto | simple | standard | complex | enterprise
|
|
29
|
+
|
|
30
|
+
# Parse arguments
|
|
31
|
+
while [[ $# -gt 0 ]]; do
|
|
32
|
+
case $1 in
|
|
33
|
+
--task)
|
|
34
|
+
TASK_DESCRIPTION="$2"
|
|
35
|
+
shift 2
|
|
36
|
+
;;
|
|
37
|
+
--difficulty)
|
|
38
|
+
DIFFICULTY="$2"
|
|
39
|
+
shift 2
|
|
40
|
+
;;
|
|
41
|
+
*)
|
|
42
|
+
echo "Unknown option: $1" >&2
|
|
43
|
+
exit 1
|
|
44
|
+
;;
|
|
45
|
+
esac
|
|
46
|
+
done
|
|
47
|
+
|
|
48
|
+
if [ -z "$TASK_DESCRIPTION" ]; then
|
|
49
|
+
echo "Error: --task required" >&2
|
|
50
|
+
exit 1
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
##############################################################################
|
|
54
|
+
# Complexity Scoring Algorithm
|
|
55
|
+
##############################################################################
|
|
56
|
+
|
|
57
|
+
TASK_LOWER=$(echo "$TASK_DESCRIPTION" | tr '[:upper:]' '[:lower:]')
|
|
58
|
+
COMPLEXITY_SCORE=0
|
|
59
|
+
DETECTED_DOMAINS=()
|
|
60
|
+
REASONING=""
|
|
61
|
+
|
|
62
|
+
# 1. Word Count (longer = more complex)
|
|
63
|
+
WORD_COUNT=$(echo "$TASK_DESCRIPTION" | wc -w)
|
|
64
|
+
if [ "$WORD_COUNT" -lt 5 ]; then
|
|
65
|
+
WORD_SCORE=1
|
|
66
|
+
elif [ "$WORD_COUNT" -lt 10 ]; then
|
|
67
|
+
WORD_SCORE=2
|
|
68
|
+
elif [ "$WORD_COUNT" -lt 20 ]; then
|
|
69
|
+
WORD_SCORE=3
|
|
70
|
+
else
|
|
71
|
+
WORD_SCORE=4
|
|
72
|
+
fi
|
|
73
|
+
COMPLEXITY_SCORE=$((COMPLEXITY_SCORE + WORD_SCORE))
|
|
74
|
+
|
|
75
|
+
# 2. Domain Detection (multi-domain = more complex)
|
|
76
|
+
DOMAIN_COUNT=0
|
|
77
|
+
|
|
78
|
+
if [[ "$TASK_LOWER" =~ react|frontend|ui|component|dashboard ]]; then
|
|
79
|
+
DETECTED_DOMAINS+=("frontend")
|
|
80
|
+
DOMAIN_COUNT=$((DOMAIN_COUNT + 1))
|
|
81
|
+
fi
|
|
82
|
+
|
|
83
|
+
if [[ "$TASK_LOWER" =~ api|backend|server|endpoint|rest|graphql ]]; then
|
|
84
|
+
DETECTED_DOMAINS+=("backend")
|
|
85
|
+
DOMAIN_COUNT=$((DOMAIN_COUNT + 1))
|
|
86
|
+
fi
|
|
87
|
+
|
|
88
|
+
if [[ "$TASK_LOWER" =~ database|db|sql|postgres|mongo|redis ]]; then
|
|
89
|
+
DETECTED_DOMAINS+=("database")
|
|
90
|
+
DOMAIN_COUNT=$((DOMAIN_COUNT + 1))
|
|
91
|
+
fi
|
|
92
|
+
|
|
93
|
+
if [[ "$TASK_LOWER" =~ deploy|infra|docker|k8s|kubernetes|aws|cloud ]]; then
|
|
94
|
+
DETECTED_DOMAINS+=("infrastructure")
|
|
95
|
+
DOMAIN_COUNT=$((DOMAIN_COUNT + 1))
|
|
96
|
+
fi
|
|
97
|
+
|
|
98
|
+
if [[ "$TASK_LOWER" =~ auth|security|encrypt|permission|rbac ]]; then
|
|
99
|
+
DETECTED_DOMAINS+=("security")
|
|
100
|
+
DOMAIN_COUNT=$((DOMAIN_COUNT + 1))
|
|
101
|
+
fi
|
|
102
|
+
|
|
103
|
+
if [[ "$TASK_LOWER" =~ test|qa|validation|coverage ]]; then
|
|
104
|
+
DETECTED_DOMAINS+=("testing")
|
|
105
|
+
DOMAIN_COUNT=$((DOMAIN_COUNT + 1))
|
|
106
|
+
fi
|
|
107
|
+
|
|
108
|
+
if [[ "$TASK_LOWER" =~ architect|design|pattern|system ]]; then
|
|
109
|
+
DETECTED_DOMAINS+=("architecture")
|
|
110
|
+
DOMAIN_COUNT=$((DOMAIN_COUNT + 1))
|
|
111
|
+
fi
|
|
112
|
+
|
|
113
|
+
if [[ "$TASK_LOWER" =~ rust|cargo|tokio ]]; then
|
|
114
|
+
DETECTED_DOMAINS+=("rust")
|
|
115
|
+
DOMAIN_COUNT=$((DOMAIN_COUNT + 1))
|
|
116
|
+
fi
|
|
117
|
+
|
|
118
|
+
# Domain score: 2 points per domain
|
|
119
|
+
DOMAIN_SCORE=$((DOMAIN_COUNT * 2))
|
|
120
|
+
COMPLEXITY_SCORE=$((COMPLEXITY_SCORE + DOMAIN_SCORE))
|
|
121
|
+
|
|
122
|
+
# 3. Explicit Scope Indicators
|
|
123
|
+
if [[ "$TASK_LOWER" =~ simple|quick|small|basic|minimal|mvp ]]; then
|
|
124
|
+
SCOPE_MODIFIER=-2
|
|
125
|
+
SCOPE_LABEL="reduced (MVP scope detected)"
|
|
126
|
+
elif [[ "$TASK_LOWER" =~ production|enterprise|scalable|robust|complete|full ]]; then
|
|
127
|
+
SCOPE_MODIFIER=3
|
|
128
|
+
SCOPE_LABEL="increased (enterprise scope detected)"
|
|
129
|
+
elif [[ "$TASK_LOWER" =~ prototype|poc|proof.of.concept ]]; then
|
|
130
|
+
SCOPE_MODIFIER=-1
|
|
131
|
+
SCOPE_LABEL="slightly reduced (prototype scope)"
|
|
132
|
+
else
|
|
133
|
+
SCOPE_MODIFIER=0
|
|
134
|
+
SCOPE_LABEL="standard"
|
|
135
|
+
fi
|
|
136
|
+
COMPLEXITY_SCORE=$((COMPLEXITY_SCORE + SCOPE_MODIFIER))
|
|
137
|
+
|
|
138
|
+
# 4. Feature Counting (and, with, includes, etc.)
|
|
139
|
+
FEATURE_COUNT=0
|
|
140
|
+
if [[ "$TASK_LOWER" =~ " and " ]]; then
|
|
141
|
+
FEATURE_COUNT=$((FEATURE_COUNT + 1))
|
|
142
|
+
fi
|
|
143
|
+
if [[ "$TASK_LOWER" =~ " with " ]]; then
|
|
144
|
+
FEATURE_COUNT=$((FEATURE_COUNT + 1))
|
|
145
|
+
fi
|
|
146
|
+
if [[ "$TASK_LOWER" =~ " including " ]]; then
|
|
147
|
+
FEATURE_COUNT=$((FEATURE_COUNT + 1))
|
|
148
|
+
fi
|
|
149
|
+
|
|
150
|
+
FEATURE_SCORE=$((FEATURE_COUNT))
|
|
151
|
+
COMPLEXITY_SCORE=$((COMPLEXITY_SCORE + FEATURE_SCORE))
|
|
152
|
+
|
|
153
|
+
# 5. Integration Keywords (increases complexity)
|
|
154
|
+
INTEGRATION_COUNT=0
|
|
155
|
+
if [[ "$TASK_LOWER" =~ integrat|connect|sync|webhook ]]; then
|
|
156
|
+
INTEGRATION_COUNT=$((INTEGRATION_COUNT + 1))
|
|
157
|
+
fi
|
|
158
|
+
if [[ "$TASK_LOWER" =~ third.party|external|api ]]; then
|
|
159
|
+
INTEGRATION_COUNT=$((INTEGRATION_COUNT + 1))
|
|
160
|
+
fi
|
|
161
|
+
|
|
162
|
+
INTEGRATION_SCORE=$((INTEGRATION_COUNT))
|
|
163
|
+
COMPLEXITY_SCORE=$((COMPLEXITY_SCORE + INTEGRATION_SCORE))
|
|
164
|
+
|
|
165
|
+
##############################################################################
|
|
166
|
+
# Difficulty Classification
|
|
167
|
+
##############################################################################
|
|
168
|
+
|
|
169
|
+
if [ "$DIFFICULTY" = "auto" ]; then
|
|
170
|
+
if [ "$COMPLEXITY_SCORE" -le 3 ]; then
|
|
171
|
+
DIFFICULTY="simple"
|
|
172
|
+
elif [ "$COMPLEXITY_SCORE" -le 7 ]; then
|
|
173
|
+
DIFFICULTY="standard"
|
|
174
|
+
elif [ "$COMPLEXITY_SCORE" -le 12 ]; then
|
|
175
|
+
DIFFICULTY="complex"
|
|
176
|
+
else
|
|
177
|
+
DIFFICULTY="enterprise"
|
|
178
|
+
fi
|
|
179
|
+
fi
|
|
180
|
+
|
|
181
|
+
##############################################################################
|
|
182
|
+
# Agent Count Calculation
|
|
183
|
+
##############################################################################
|
|
184
|
+
|
|
185
|
+
case "$DIFFICULTY" in
|
|
186
|
+
simple)
|
|
187
|
+
# MVP/Simple: 1-2 Loop 3 agents
|
|
188
|
+
BASE_LOOP3=1
|
|
189
|
+
BASE_LOOP2=2
|
|
190
|
+
REASONING="Simple task with minimal scope"
|
|
191
|
+
;;
|
|
192
|
+
standard)
|
|
193
|
+
# Standard: 2-3 Loop 3 agents
|
|
194
|
+
BASE_LOOP3=2
|
|
195
|
+
BASE_LOOP2=3
|
|
196
|
+
REASONING="Standard task with moderate complexity"
|
|
197
|
+
;;
|
|
198
|
+
complex)
|
|
199
|
+
# Complex: 3-5 Loop 3 agents
|
|
200
|
+
BASE_LOOP3=3
|
|
201
|
+
BASE_LOOP2=4
|
|
202
|
+
REASONING="Complex task with multiple domains"
|
|
203
|
+
;;
|
|
204
|
+
enterprise)
|
|
205
|
+
# Enterprise: 5-8 Loop 3 agents
|
|
206
|
+
BASE_LOOP3=5
|
|
207
|
+
BASE_LOOP2=5
|
|
208
|
+
REASONING="Enterprise-grade task with high complexity"
|
|
209
|
+
;;
|
|
210
|
+
*)
|
|
211
|
+
echo "Error: Invalid difficulty: $DIFFICULTY" >&2
|
|
212
|
+
exit 1
|
|
213
|
+
;;
|
|
214
|
+
esac
|
|
215
|
+
|
|
216
|
+
# Scale by domain count (1 extra agent per additional domain beyond 2)
|
|
217
|
+
if [ "$DOMAIN_COUNT" -gt 2 ]; then
|
|
218
|
+
EXTRA_AGENTS=$((DOMAIN_COUNT - 2))
|
|
219
|
+
LOOP3_COUNT=$((BASE_LOOP3 + EXTRA_AGENTS))
|
|
220
|
+
else
|
|
221
|
+
LOOP3_COUNT=$BASE_LOOP3
|
|
222
|
+
fi
|
|
223
|
+
|
|
224
|
+
# Cap at reasonable limits
|
|
225
|
+
if [ "$LOOP3_COUNT" -gt 8 ]; then
|
|
226
|
+
LOOP3_COUNT=8
|
|
227
|
+
fi
|
|
228
|
+
|
|
229
|
+
# Loop 2 scales with Loop 3 (but slower: +1 validator per 2 implementers)
|
|
230
|
+
LOOP2_COUNT=$((BASE_LOOP2 + (LOOP3_COUNT - BASE_LOOP3) / 2))
|
|
231
|
+
if [ "$LOOP2_COUNT" -gt 6 ]; then
|
|
232
|
+
LOOP2_COUNT=6
|
|
233
|
+
fi
|
|
234
|
+
|
|
235
|
+
# Ensure minimum validators
|
|
236
|
+
if [ "$LOOP2_COUNT" -lt 2 ]; then
|
|
237
|
+
LOOP2_COUNT=2
|
|
238
|
+
fi
|
|
239
|
+
|
|
240
|
+
##############################################################################
|
|
241
|
+
# Build Reasoning String
|
|
242
|
+
##############################################################################
|
|
243
|
+
|
|
244
|
+
REASONING_DETAILS="$REASONING (complexity score: $COMPLEXITY_SCORE, domains: $DOMAIN_COUNT, scope: $SCOPE_LABEL)"
|
|
245
|
+
|
|
246
|
+
##############################################################################
|
|
247
|
+
# Output JSON
|
|
248
|
+
##############################################################################
|
|
249
|
+
|
|
250
|
+
# Convert array to JSON array
|
|
251
|
+
DOMAINS_JSON=$(printf '%s\n' "${DETECTED_DOMAINS[@]}" | jq -R . | jq -s .)
|
|
252
|
+
|
|
253
|
+
jq -nc \
|
|
254
|
+
--arg complexity "$COMPLEXITY_SCORE" \
|
|
255
|
+
--arg difficulty "$DIFFICULTY" \
|
|
256
|
+
--argjson domains "$DOMAINS_JSON" \
|
|
257
|
+
--arg loop3 "$LOOP3_COUNT" \
|
|
258
|
+
--arg loop2 "$LOOP2_COUNT" \
|
|
259
|
+
--arg reasoning "$REASONING_DETAILS" \
|
|
260
|
+
--arg word_count "$WORD_COUNT" \
|
|
261
|
+
--arg domain_count "$DOMAIN_COUNT" \
|
|
262
|
+
--arg feature_count "$FEATURE_COUNT" \
|
|
263
|
+
'{
|
|
264
|
+
complexity_score: ($complexity | tonumber),
|
|
265
|
+
difficulty: $difficulty,
|
|
266
|
+
domains: $domains,
|
|
267
|
+
suggested_agents: {
|
|
268
|
+
loop3_count: ($loop3 | tonumber),
|
|
269
|
+
loop2_count: ($loop2 | tonumber)
|
|
270
|
+
},
|
|
271
|
+
reasoning: $reasoning,
|
|
272
|
+
analysis: {
|
|
273
|
+
word_count: ($word_count | tonumber),
|
|
274
|
+
domain_count: ($domain_count | tonumber),
|
|
275
|
+
feature_count: ($feature_count | tonumber)
|
|
276
|
+
}
|
|
277
|
+
}'
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
##############################################################################
|
|
4
|
+
# Cancel Swarm - Graceful shutdown for all agents in a swarm
|
|
5
|
+
#
|
|
6
|
+
# Publishes shutdown signals to all active agents via their wake channels,
|
|
7
|
+
# marks swarm status as cancelled, and reports cancellation metrics.
|
|
8
|
+
#
|
|
9
|
+
# Usage:
|
|
10
|
+
# ./cancel-swarm.sh --task-id <id> \
|
|
11
|
+
# [--reason <text>] \
|
|
12
|
+
# [--initiator <name>] \
|
|
13
|
+
# [--force]
|
|
14
|
+
#
|
|
15
|
+
# Options:
|
|
16
|
+
# --task-id Task/swarm identifier (required)
|
|
17
|
+
# --reason Cancellation reason (default: user_requested_cancellation)
|
|
18
|
+
# --initiator Who initiated cancellation (default: main-chat)
|
|
19
|
+
# --force Skip confirmation prompt
|
|
20
|
+
#
|
|
21
|
+
# Shutdown Signal Format (broadcasted to shutdown channel):
|
|
22
|
+
# {
|
|
23
|
+
# "reason": "user_requested_cancellation",
|
|
24
|
+
# "timestamp": 1760896218,
|
|
25
|
+
# "initiator": "main-chat"
|
|
26
|
+
# }
|
|
27
|
+
#
|
|
28
|
+
# How It Works:
|
|
29
|
+
# 1. Broadcasts a single shutdown message to swarm:${TASK_ID}:shutdown
|
|
30
|
+
# 2. All agents in waiting mode poll this key every 1 second
|
|
31
|
+
# 3. When agents detect the shutdown signal, they exit gracefully (exit 130)
|
|
32
|
+
# 4. Swarm metadata is updated to status="cancelled" with metrics
|
|
33
|
+
#
|
|
34
|
+
# Benefits:
|
|
35
|
+
# - Graceful agent termination (agents receive explicit shutdown signal)
|
|
36
|
+
# - Prevents orphaned BLPOP operations
|
|
37
|
+
# - Audit trail (cancellation reason + timestamp)
|
|
38
|
+
# - Cleanup coordination (all agents notified simultaneously)
|
|
39
|
+
##############################################################################
|
|
40
|
+
|
|
41
|
+
set -euo pipefail
|
|
42
|
+
|
|
43
|
+
# Configuration
|
|
44
|
+
TASK_ID=""
|
|
45
|
+
REASON="user_requested_cancellation"
|
|
46
|
+
INITIATOR="main-chat"
|
|
47
|
+
FORCE=false
|
|
48
|
+
|
|
49
|
+
# Parse arguments
|
|
50
|
+
while [[ $# -gt 0 ]]; do
|
|
51
|
+
case $1 in
|
|
52
|
+
--task-id)
|
|
53
|
+
TASK_ID="$2"
|
|
54
|
+
shift 2
|
|
55
|
+
;;
|
|
56
|
+
--reason)
|
|
57
|
+
REASON="$2"
|
|
58
|
+
shift 2
|
|
59
|
+
;;
|
|
60
|
+
--initiator)
|
|
61
|
+
INITIATOR="$2"
|
|
62
|
+
shift 2
|
|
63
|
+
;;
|
|
64
|
+
--force)
|
|
65
|
+
FORCE=true
|
|
66
|
+
shift
|
|
67
|
+
;;
|
|
68
|
+
*)
|
|
69
|
+
echo "Unknown option: $1"
|
|
70
|
+
echo "Usage: $0 --task-id <id> [--reason <text>] [--initiator <name>] [--force]"
|
|
71
|
+
exit 1
|
|
72
|
+
;;
|
|
73
|
+
esac
|
|
74
|
+
done
|
|
75
|
+
|
|
76
|
+
# Validation
|
|
77
|
+
if [ -z "$TASK_ID" ]; then
|
|
78
|
+
echo "Error: --task-id required"
|
|
79
|
+
echo "Usage: $0 --task-id <id>"
|
|
80
|
+
exit 1
|
|
81
|
+
fi
|
|
82
|
+
|
|
83
|
+
# Look for swarm metadata (try both task-id and swarm-id patterns)
|
|
84
|
+
METADATA_KEY="swarm:${TASK_ID}:metadata"
|
|
85
|
+
SWARM_ID_KEY=""
|
|
86
|
+
|
|
87
|
+
# Check if metadata exists with task-id
|
|
88
|
+
if redis-cli exists "$METADATA_KEY" | grep -q "1"; then
|
|
89
|
+
SWARM_ID_KEY="$METADATA_KEY"
|
|
90
|
+
else
|
|
91
|
+
# Try to find swarm by task_id field
|
|
92
|
+
SWARM_KEYS=$(redis-cli --scan --pattern "swarm:*:metadata" 2>/dev/null || echo "")
|
|
93
|
+
|
|
94
|
+
if [ -n "$SWARM_KEYS" ]; then
|
|
95
|
+
for KEY in $SWARM_KEYS; do
|
|
96
|
+
TASK_VAL=$(redis-cli hget "$KEY" task_id 2>/dev/null || echo "")
|
|
97
|
+
if [ "$TASK_VAL" = "$TASK_ID" ]; then
|
|
98
|
+
SWARM_ID_KEY="$KEY"
|
|
99
|
+
break
|
|
100
|
+
fi
|
|
101
|
+
done
|
|
102
|
+
fi
|
|
103
|
+
fi
|
|
104
|
+
|
|
105
|
+
# Validate swarm exists
|
|
106
|
+
if [ -z "$SWARM_ID_KEY" ]; then
|
|
107
|
+
echo "Error: No swarm found for task-id: $TASK_ID"
|
|
108
|
+
echo "Hint: Verify task-id or check 'list-active-swarms.sh' for active swarms"
|
|
109
|
+
exit 1
|
|
110
|
+
fi
|
|
111
|
+
|
|
112
|
+
# Extract swarm_id from key
|
|
113
|
+
SWARM_ID=$(redis-cli hget "$SWARM_ID_KEY" swarm_id)
|
|
114
|
+
|
|
115
|
+
# Get agent list
|
|
116
|
+
AGENTS_STR=$(redis-cli hget "$SWARM_ID_KEY" agents)
|
|
117
|
+
if [ -z "$AGENTS_STR" ] || [ "$AGENTS_STR" = "(nil)" ]; then
|
|
118
|
+
echo "Warning: No agents found in swarm metadata"
|
|
119
|
+
AGENTS_STR=""
|
|
120
|
+
fi
|
|
121
|
+
|
|
122
|
+
# Get current swarm status
|
|
123
|
+
CURRENT_STATUS=$(redis-cli hget "$SWARM_ID_KEY" status)
|
|
124
|
+
|
|
125
|
+
echo "========================================="
|
|
126
|
+
echo "Swarm Cancellation Request"
|
|
127
|
+
echo "========================================="
|
|
128
|
+
echo "Swarm ID: $SWARM_ID"
|
|
129
|
+
echo "Task ID: $TASK_ID"
|
|
130
|
+
echo "Current Status: $CURRENT_STATUS"
|
|
131
|
+
echo "Agents: $AGENTS_STR"
|
|
132
|
+
echo "Reason: $REASON"
|
|
133
|
+
echo "Initiator: $INITIATOR"
|
|
134
|
+
echo "========================================="
|
|
135
|
+
|
|
136
|
+
# Confirmation prompt (unless --force)
|
|
137
|
+
if [ "$FORCE" = false ]; then
|
|
138
|
+
read -p "Proceed with cancellation? (yes/no): " CONFIRM
|
|
139
|
+
if [ "$CONFIRM" != "yes" ]; then
|
|
140
|
+
echo "Cancellation aborted by user."
|
|
141
|
+
exit 0
|
|
142
|
+
fi
|
|
143
|
+
fi
|
|
144
|
+
|
|
145
|
+
echo ""
|
|
146
|
+
echo "[Cancel] Starting graceful shutdown..."
|
|
147
|
+
|
|
148
|
+
# Build shutdown message
|
|
149
|
+
TIMESTAMP=$(date +%s)
|
|
150
|
+
SHUTDOWN_MSG=$(jq -n \
|
|
151
|
+
--arg reason "$REASON" \
|
|
152
|
+
--arg ts "$TIMESTAMP" \
|
|
153
|
+
--arg init "$INITIATOR" \
|
|
154
|
+
'{
|
|
155
|
+
reason: $reason,
|
|
156
|
+
timestamp: ($ts | tonumber),
|
|
157
|
+
initiator: $init
|
|
158
|
+
}')
|
|
159
|
+
|
|
160
|
+
# Broadcast shutdown signal to all waiting agents
|
|
161
|
+
SHUTDOWN_KEY="swarm:${TASK_ID}:shutdown"
|
|
162
|
+
|
|
163
|
+
# Use LPUSH to add shutdown signal (all agents in waiting mode will check this key)
|
|
164
|
+
if echo "$SHUTDOWN_MSG" | redis-cli -x LPUSH "$SHUTDOWN_KEY" > /dev/null 2>&1; then
|
|
165
|
+
echo "[Cancel] ✓ Shutdown signal broadcasted to: $SHUTDOWN_KEY"
|
|
166
|
+
else
|
|
167
|
+
echo "[Cancel] ✗ Failed to broadcast shutdown signal"
|
|
168
|
+
exit 1
|
|
169
|
+
fi
|
|
170
|
+
|
|
171
|
+
# Set TTL on shutdown key to prevent indefinite retention
|
|
172
|
+
redis-cli expire "$SHUTDOWN_KEY" 3600 > /dev/null 2>&1 || true
|
|
173
|
+
|
|
174
|
+
# Counter for agent list (for metrics)
|
|
175
|
+
AGENT_COUNT=0
|
|
176
|
+
if [ -n "$AGENTS_STR" ]; then
|
|
177
|
+
IFS=',' read -ra AGENT_ARRAY <<< "$AGENTS_STR"
|
|
178
|
+
AGENT_COUNT=${#AGENT_ARRAY[@]}
|
|
179
|
+
|
|
180
|
+
echo "[Cancel] Agents in swarm: $AGENT_COUNT"
|
|
181
|
+
for AGENT_ID in "${AGENT_ARRAY[@]}"; do
|
|
182
|
+
AGENT_ID=$(echo "$AGENT_ID" | xargs)
|
|
183
|
+
if [ -n "$AGENT_ID" ]; then
|
|
184
|
+
echo "[Cancel] - $AGENT_ID (will receive shutdown on next poll)"
|
|
185
|
+
fi
|
|
186
|
+
done
|
|
187
|
+
else
|
|
188
|
+
echo "[Cancel] No agents in swarm"
|
|
189
|
+
fi
|
|
190
|
+
|
|
191
|
+
# Note: We broadcast once to all agents instead of individual notifications
|
|
192
|
+
# This is more efficient and follows the same pattern as invoke-waiting-mode.sh shutdown command
|
|
193
|
+
NOTIFIED_COUNT="$AGENT_COUNT"
|
|
194
|
+
FAILED_COUNT=0
|
|
195
|
+
|
|
196
|
+
# Update swarm metadata
|
|
197
|
+
redis-cli hset "$SWARM_ID_KEY" \
|
|
198
|
+
status "cancelled" \
|
|
199
|
+
cancelled_at "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
|
|
200
|
+
cancellation_reason "$REASON" \
|
|
201
|
+
cancellation_initiator "$INITIATOR" \
|
|
202
|
+
agents_notified "$NOTIFIED_COUNT" \
|
|
203
|
+
agents_failed "$FAILED_COUNT" > /dev/null
|
|
204
|
+
|
|
205
|
+
echo ""
|
|
206
|
+
echo "========================================="
|
|
207
|
+
echo "Cancellation Summary"
|
|
208
|
+
echo "========================================="
|
|
209
|
+
echo "Swarm ID: $SWARM_ID"
|
|
210
|
+
echo "Status: cancelled"
|
|
211
|
+
echo "Agents in Swarm: $NOTIFIED_COUNT"
|
|
212
|
+
echo "Shutdown Broadcast: Sent to $SHUTDOWN_KEY"
|
|
213
|
+
echo ""
|
|
214
|
+
echo "Note: All agents in waiting mode will receive"
|
|
215
|
+
echo " the shutdown signal on their next poll"
|
|
216
|
+
echo " cycle (max 1 second delay)."
|
|
217
|
+
echo "========================================="
|
|
218
|
+
echo ""
|
|
219
|
+
|
|
220
|
+
echo "[Cancel] ✅ Graceful shutdown complete"
|
|
221
|
+
exit 0
|