specweave 0.1.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/INSTALL.md +848 -0
- package/LICENSE +21 -0
- package/README.md +675 -0
- package/SPECWEAVE.md +665 -0
- package/bin/install-agents.sh +57 -0
- package/bin/install-all.sh +49 -0
- package/bin/install-commands.sh +56 -0
- package/bin/install-skills.sh +57 -0
- package/bin/specweave.js +81 -0
- package/dist/adapters/adapter-base.d.ts +50 -0
- package/dist/adapters/adapter-base.d.ts.map +1 -0
- package/dist/adapters/adapter-base.js +146 -0
- package/dist/adapters/adapter-base.js.map +1 -0
- package/dist/adapters/adapter-interface.d.ts +108 -0
- package/dist/adapters/adapter-interface.d.ts.map +1 -0
- package/dist/adapters/adapter-interface.js +9 -0
- package/dist/adapters/adapter-interface.js.map +1 -0
- package/dist/adapters/claude/adapter.d.ts +54 -0
- package/dist/adapters/claude/adapter.d.ts.map +1 -0
- package/dist/adapters/claude/adapter.js +184 -0
- package/dist/adapters/claude/adapter.js.map +1 -0
- package/dist/adapters/copilot/adapter.d.ts +42 -0
- package/dist/adapters/copilot/adapter.d.ts.map +1 -0
- package/dist/adapters/copilot/adapter.js +239 -0
- package/dist/adapters/copilot/adapter.js.map +1 -0
- package/dist/adapters/cursor/adapter.d.ts +42 -0
- package/dist/adapters/cursor/adapter.d.ts.map +1 -0
- package/dist/adapters/cursor/adapter.js +297 -0
- package/dist/adapters/cursor/adapter.js.map +1 -0
- package/dist/adapters/generic/adapter.d.ts +40 -0
- package/dist/adapters/generic/adapter.d.ts.map +1 -0
- package/dist/adapters/generic/adapter.js +155 -0
- package/dist/adapters/generic/adapter.js.map +1 -0
- package/dist/cli/commands/init.d.ts +6 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +247 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/install.d.ts +7 -0
- package/dist/cli/commands/install.d.ts.map +1 -0
- package/dist/cli/commands/install.js +160 -0
- package/dist/cli/commands/install.js.map +1 -0
- package/dist/cli/commands/list.d.ts +6 -0
- package/dist/cli/commands/list.d.ts.map +1 -0
- package/dist/cli/commands/list.js +154 -0
- package/dist/cli/commands/list.js.map +1 -0
- package/package.json +90 -0
- package/src/adapters/README.md +312 -0
- package/src/adapters/adapter-base.ts +146 -0
- package/src/adapters/adapter-interface.ts +120 -0
- package/src/adapters/claude/README.md +241 -0
- package/src/adapters/claude/adapter.ts +157 -0
- package/src/adapters/copilot/.github/copilot/instructions.md +376 -0
- package/src/adapters/copilot/README.md +200 -0
- package/src/adapters/copilot/adapter.ts +210 -0
- package/src/adapters/cursor/.cursor/context/docs-context.md +62 -0
- package/src/adapters/cursor/.cursor/context/increments-context.md +71 -0
- package/src/adapters/cursor/.cursor/context/strategy-context.md +73 -0
- package/src/adapters/cursor/.cursor/context/tests-context.md +89 -0
- package/src/adapters/cursor/.cursorrules +325 -0
- package/src/adapters/cursor/README.md +243 -0
- package/src/adapters/cursor/adapter.ts +268 -0
- package/src/adapters/generic/README.md +277 -0
- package/src/adapters/generic/SPECWEAVE-MANUAL.md +676 -0
- package/src/adapters/generic/adapter.ts +159 -0
- package/src/adapters/registry.yaml +126 -0
- package/src/agents/architect/AGENT.md +416 -0
- package/src/agents/devops/AGENT.md +1738 -0
- package/src/agents/docs-writer/AGENT.md +239 -0
- package/src/agents/performance/AGENT.md +228 -0
- package/src/agents/pm/AGENT.md +751 -0
- package/src/agents/qa-lead/AGENT.md +150 -0
- package/src/agents/security/AGENT.md +179 -0
- package/src/agents/sre/AGENT.md +582 -0
- package/src/agents/sre/modules/backend-diagnostics.md +481 -0
- package/src/agents/sre/modules/database-diagnostics.md +509 -0
- package/src/agents/sre/modules/infrastructure.md +561 -0
- package/src/agents/sre/modules/monitoring.md +439 -0
- package/src/agents/sre/modules/security-incidents.md +421 -0
- package/src/agents/sre/modules/ui-diagnostics.md +302 -0
- package/src/agents/sre/playbooks/01-high-cpu-usage.md +204 -0
- package/src/agents/sre/playbooks/02-database-deadlock.md +241 -0
- package/src/agents/sre/playbooks/03-memory-leak.md +252 -0
- package/src/agents/sre/playbooks/04-slow-api-response.md +269 -0
- package/src/agents/sre/playbooks/05-ddos-attack.md +293 -0
- package/src/agents/sre/playbooks/06-disk-full.md +314 -0
- package/src/agents/sre/playbooks/07-service-down.md +333 -0
- package/src/agents/sre/playbooks/08-data-corruption.md +337 -0
- package/src/agents/sre/playbooks/09-cascade-failure.md +430 -0
- package/src/agents/sre/playbooks/10-rate-limit-exceeded.md +464 -0
- package/src/agents/sre/scripts/health-check.sh +230 -0
- package/src/agents/sre/scripts/log-analyzer.py +213 -0
- package/src/agents/sre/scripts/metrics-collector.sh +294 -0
- package/src/agents/sre/scripts/trace-analyzer.js +257 -0
- package/src/agents/sre/templates/incident-report.md +249 -0
- package/src/agents/sre/templates/mitigation-plan.md +375 -0
- package/src/agents/sre/templates/post-mortem.md +418 -0
- package/src/agents/sre/templates/runbook-template.md +412 -0
- package/src/agents/tech-lead/AGENT.md +263 -0
- package/src/commands/add-tasks.md +176 -0
- package/src/commands/close-increment.md +347 -0
- package/src/commands/create-increment.md +223 -0
- package/src/commands/create-project.md +528 -0
- package/src/commands/generate-docs.md +623 -0
- package/src/commands/list-increments.md +180 -0
- package/src/commands/review-docs.md +331 -0
- package/src/commands/start-increment.md +139 -0
- package/src/commands/sync-github.md +115 -0
- package/src/commands/validate-increment.md +800 -0
- package/src/hooks/README.md +252 -0
- package/src/hooks/docs-changed.sh +59 -0
- package/src/hooks/human-input-required.sh +55 -0
- package/src/hooks/post-task-completion.sh +57 -0
- package/src/hooks/pre-implementation.sh +47 -0
- package/src/skills/ado-sync/README.md +449 -0
- package/src/skills/ado-sync/SKILL.md +245 -0
- package/src/skills/ado-sync/test-cases/test-1.yaml +9 -0
- package/src/skills/ado-sync/test-cases/test-2.yaml +8 -0
- package/src/skills/ado-sync/test-cases/test-3.yaml +9 -0
- package/src/skills/bmad-method-expert/SKILL.md +628 -0
- package/src/skills/bmad-method-expert/scripts/analyze-project.js +318 -0
- package/src/skills/bmad-method-expert/scripts/check-setup.js +208 -0
- package/src/skills/bmad-method-expert/scripts/generate-template.js +1149 -0
- package/src/skills/bmad-method-expert/scripts/validate-documents.js +340 -0
- package/src/skills/bmad-method-expert/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/bmad-method-expert/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/bmad-method-expert/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/brownfield-analyzer/SKILL.md +523 -0
- package/src/skills/brownfield-analyzer/test-cases/test-1-basic-analysis.yaml +48 -0
- package/src/skills/brownfield-analyzer/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/brownfield-analyzer/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/brownfield-onboarder/SKILL.md +625 -0
- package/src/skills/brownfield-onboarder/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/brownfield-onboarder/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/brownfield-onboarder/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/calendar-system/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/calendar-system/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/calendar-system/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/context-loader/SKILL.md +734 -0
- package/src/skills/context-loader/test-cases/test-1-basic-loading.yaml +39 -0
- package/src/skills/context-loader/test-cases/test-2-token-budget-exceeded.yaml +44 -0
- package/src/skills/context-loader/test-cases/test-3-section-anchors.yaml +45 -0
- package/src/skills/context-optimizer/SKILL.md +618 -0
- package/src/skills/context-optimizer/test-cases/test-1-bug-fix-narrow.yaml +97 -0
- package/src/skills/context-optimizer/test-cases/test-2-feature-focused.yaml +109 -0
- package/src/skills/context-optimizer/test-cases/test-3-architecture-broad.yaml +98 -0
- package/src/skills/cost-optimizer/SKILL.md +190 -0
- package/src/skills/cost-optimizer/test-cases/test-1-basic-comparison.yaml +75 -0
- package/src/skills/cost-optimizer/test-cases/test-2-budget-constraint.yaml +52 -0
- package/src/skills/cost-optimizer/test-cases/test-3-scale-requirement.yaml +63 -0
- package/src/skills/cost-optimizer/test-results/README.md +46 -0
- package/src/skills/design-system-architect/SKILL.md +107 -0
- package/src/skills/design-system-architect/test-cases/test-1-token-structure.yaml +23 -0
- package/src/skills/design-system-architect/test-cases/test-2-component-hierarchy.yaml +24 -0
- package/src/skills/design-system-architect/test-cases/test-3-accessibility-checklist.yaml +23 -0
- package/src/skills/diagrams-architect/SKILL.md +763 -0
- package/src/skills/diagrams-generator/SKILL.md +25 -0
- package/src/skills/diagrams-generator/test-cases/test-1.yaml +9 -0
- package/src/skills/diagrams-generator/test-cases/test-2.yaml +9 -0
- package/src/skills/diagrams-generator/test-cases/test-3.yaml +8 -0
- package/src/skills/docs-updater/README.md +48 -0
- package/src/skills/docs-updater/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/docs-updater/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/docs-updater/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/dotnet-backend/SKILL.md +250 -0
- package/src/skills/e2e-playwright/README.md +506 -0
- package/src/skills/e2e-playwright/SKILL.md +457 -0
- package/src/skills/e2e-playwright/execute.js +373 -0
- package/src/skills/e2e-playwright/lib/utils.js +514 -0
- package/src/skills/e2e-playwright/package.json +33 -0
- package/src/skills/e2e-playwright/test-cases/TC-001-basic-navigation.yaml +54 -0
- package/src/skills/e2e-playwright/test-cases/TC-002-form-interaction.yaml +64 -0
- package/src/skills/e2e-playwright/test-cases/TC-003-specweave-integration.yaml +74 -0
- package/src/skills/e2e-playwright/test-cases/TC-004-accessibility-check.yaml +98 -0
- package/src/skills/figma-designer/SKILL.md +149 -0
- package/src/skills/figma-implementer/SKILL.md +148 -0
- package/src/skills/figma-mcp-connector/SKILL.md +136 -0
- package/src/skills/figma-mcp-connector/test-cases/test-1-read-file-desktop.yaml +22 -0
- package/src/skills/figma-mcp-connector/test-cases/test-2-read-file-framelink.yaml +21 -0
- package/src/skills/figma-mcp-connector/test-cases/test-3-error-handling.yaml +18 -0
- package/src/skills/figma-to-code/SKILL.md +128 -0
- package/src/skills/figma-to-code/test-cases/test-1-token-generation.yaml +29 -0
- package/src/skills/figma-to-code/test-cases/test-2-component-generation.yaml +27 -0
- package/src/skills/figma-to-code/test-cases/test-3-typescript-generation.yaml +28 -0
- package/src/skills/frontend/SKILL.md +177 -0
- package/src/skills/github-sync/SKILL.md +252 -0
- package/src/skills/github-sync/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/github-sync/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/github-sync/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/hetzner-provisioner/README.md +308 -0
- package/src/skills/hetzner-provisioner/SKILL.md +251 -0
- package/src/skills/hetzner-provisioner/test-cases/test-1-basic-provision.yaml +71 -0
- package/src/skills/hetzner-provisioner/test-cases/test-2-postgres-provision.yaml +85 -0
- package/src/skills/hetzner-provisioner/test-cases/test-3-ssl-config.yaml +126 -0
- package/src/skills/hetzner-provisioner/test-results/README.md +259 -0
- package/src/skills/increment-planner/SKILL.md +889 -0
- package/src/skills/increment-planner/scripts/feature-utils.js +250 -0
- package/src/skills/increment-planner/test-cases/test-1-basic-feature.yaml +27 -0
- package/src/skills/increment-planner/test-cases/test-2-complex-feature.yaml +30 -0
- package/src/skills/increment-planner/test-cases/test-3-auto-numbering.yaml +24 -0
- package/src/skills/increment-quality-judge/SKILL.md +566 -0
- package/src/skills/increment-quality-judge/test-cases/test-1-good-spec.yaml +95 -0
- package/src/skills/increment-quality-judge/test-cases/test-2-poor-spec.yaml +108 -0
- package/src/skills/increment-quality-judge/test-cases/test-3-export-suggestions.yaml +87 -0
- package/src/skills/jira-sync/README.md +328 -0
- package/src/skills/jira-sync/SKILL.md +209 -0
- package/src/skills/jira-sync/test-cases/test-1.yaml +9 -0
- package/src/skills/jira-sync/test-cases/test-2.yaml +9 -0
- package/src/skills/jira-sync/test-cases/test-3.yaml +10 -0
- package/src/skills/nextjs/SKILL.md +176 -0
- package/src/skills/nodejs-backend/SKILL.md +181 -0
- package/src/skills/notification-system/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/notification-system/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/notification-system/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/python-backend/SKILL.md +226 -0
- package/src/skills/role-orchestrator/README.md +197 -0
- package/src/skills/role-orchestrator/SKILL.md +1184 -0
- package/src/skills/role-orchestrator/test-cases/test-1-simple-product.yaml +98 -0
- package/src/skills/role-orchestrator/test-cases/test-2-quality-gate-failure.yaml +73 -0
- package/src/skills/role-orchestrator/test-cases/test-3-security-workflow.yaml +121 -0
- package/src/skills/role-orchestrator/test-cases/test-4-parallel-execution.yaml +145 -0
- package/src/skills/role-orchestrator/test-cases/test-5-feedback-loops.yaml +149 -0
- package/src/skills/skill-creator/LICENSE.txt +202 -0
- package/src/skills/skill-creator/SKILL.md +209 -0
- package/src/skills/skill-creator/scripts/init_skill.py +303 -0
- package/src/skills/skill-creator/scripts/package_skill.py +110 -0
- package/src/skills/skill-creator/scripts/quick_validate.py +65 -0
- package/src/skills/skill-creator/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/skill-creator/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/skill-creator/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/skill-router/SKILL.md +497 -0
- package/src/skills/skill-router/test-cases/test-1-basic-routing.yaml +33 -0
- package/src/skills/skill-router/test-cases/test-2-ambiguous-request.yaml +42 -0
- package/src/skills/skill-router/test-cases/test-3-nested-orchestration.yaml +50 -0
- package/src/skills/spec-driven-brainstorming/README.md +264 -0
- package/src/skills/spec-driven-brainstorming/SKILL.md +439 -0
- package/src/skills/spec-driven-brainstorming/test-cases/TC-001-simple-idea-to-design.yaml +148 -0
- package/src/skills/spec-driven-brainstorming/test-cases/TC-002-complex-ultrathink-design.yaml +190 -0
- package/src/skills/spec-driven-brainstorming/test-cases/TC-003-unclear-requirements-socratic.yaml +233 -0
- package/src/skills/spec-driven-debugging/README.md +479 -0
- package/src/skills/spec-driven-debugging/SKILL.md +652 -0
- package/src/skills/spec-driven-debugging/test-cases/TC-001-simple-auth-bug.yaml +212 -0
- package/src/skills/spec-driven-debugging/test-cases/TC-002-race-condition-ultrathink.yaml +461 -0
- package/src/skills/spec-driven-debugging/test-cases/TC-003-brownfield-missing-spec.yaml +366 -0
- package/src/skills/spec-kit-expert/SKILL.md +1012 -0
- package/src/skills/spec-kit-expert/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/spec-kit-expert/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/spec-kit-expert/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/specweave-ado-mapper/SKILL.md +501 -0
- package/src/skills/specweave-detector/SKILL.md +420 -0
- package/src/skills/specweave-detector/test-cases/test-1-basic-detection.yaml +37 -0
- package/src/skills/specweave-detector/test-cases/test-2-missing-config.yaml +37 -0
- package/src/skills/specweave-detector/test-cases/test-3-non-specweave-project.yaml +34 -0
- package/src/skills/specweave-jira-mapper/SKILL.md +500 -0
- package/src/skills/stripe-integrator/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/stripe-integrator/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/stripe-integrator/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/task-builder/README.md +90 -0
- package/src/skills/task-builder/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/task-builder/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/task-builder/test-cases/test-3-placeholder.yaml +12 -0
- package/src/templates/.env.example +144 -0
- package/src/templates/.gitignore.template +81 -0
- package/src/templates/CLAUDE.md.template +383 -0
- package/src/templates/README.md.template +240 -0
- package/src/templates/config.yaml +333 -0
- package/src/templates/docs/README.md +124 -0
- package/src/templates/docs/adr-template.md +118 -0
- package/src/templates/docs/hld-template.md +220 -0
- package/src/templates/docs/lld-template.md +580 -0
- package/src/templates/docs/prd-template.md +132 -0
- package/src/templates/docs/rfc-template.md +229 -0
- package/src/templates/docs/runbook-template.md +298 -0
- package/src/templates/environments/minimal/.env.production +16 -0
- package/src/templates/environments/minimal/README.md +54 -0
- package/src/templates/environments/minimal/deploy-production.yml +52 -0
- package/src/templates/environments/progressive/.env.qa +28 -0
- package/src/templates/environments/progressive/README.md +129 -0
- package/src/templates/environments/progressive/deploy-production.yml +93 -0
- package/src/templates/environments/progressive/deploy-qa.yml +62 -0
- package/src/templates/environments/progressive/deploy-staging.yml +67 -0
- package/src/templates/environments/standard/.env.development +20 -0
- package/src/templates/environments/standard/.env.production +30 -0
- package/src/templates/environments/standard/.env.staging +23 -0
- package/src/templates/environments/standard/README.md +97 -0
- package/src/templates/environments/standard/deploy-production.yml +68 -0
- package/src/templates/environments/standard/deploy-staging.yml +61 -0
- package/src/templates/environments/standard/docker-compose.yml +43 -0
- package/src/templates/increment-metadata-template.yaml +138 -0
|
@@ -0,0 +1,1184 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: role-orchestrator
|
|
3
|
+
description: Multi-agent orchestration system that coordinates specialized agents (PM, Architect, DevOps, QA, Tech Lead, Security) to work together on complex tasks. Implements hierarchical orchestrator-worker pattern. Activates for complex multi-step requests requiring multiple roles/skills. Keywords: build product, create SaaS, full implementation, end-to-end, multi-agent, orchestrate, coordinate roles, complex project.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Role Orchestrator - Multi-Agent Coordination System
|
|
7
|
+
|
|
8
|
+
**Purpose**: Coordinate multiple specialized agents to solve complex, multi-step problems through intelligent task decomposition and role assignment.
|
|
9
|
+
|
|
10
|
+
## Architecture Pattern
|
|
11
|
+
|
|
12
|
+
The role-orchestrator implements the **Hierarchical Orchestrator-Worker Pattern** from multi-agent systems research:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
User Request
|
|
16
|
+
↓
|
|
17
|
+
Role Orchestrator (this skill)
|
|
18
|
+
↓
|
|
19
|
+
├── Task Decomposition (PM Agent)
|
|
20
|
+
├── Architecture Design (Architect Agent)
|
|
21
|
+
├── Technical Planning (Tech Lead Agent)
|
|
22
|
+
├── Security Review (Security Agent)
|
|
23
|
+
├── QA Strategy (QA Lead Agent)
|
|
24
|
+
├── Implementation (Backend/Frontend Agents)
|
|
25
|
+
└── Deployment (DevOps Agent)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## When to Activate
|
|
29
|
+
|
|
30
|
+
This skill activates for requests that require **3+ agents** or **full product development**:
|
|
31
|
+
|
|
32
|
+
| User Says | Agents Needed | Orchestration Pattern |
|
|
33
|
+
|-----------|---------------|---------------------|
|
|
34
|
+
| "Build a SaaS for project management" | PM → Architect → Tech Lead → Implement → QA → DevOps | Sequential with feedback loops |
|
|
35
|
+
| "Create real-time chat feature" | Architect → Tech Lead → Backend → Frontend → QA | Parallel (Backend + Frontend) |
|
|
36
|
+
| "Secure our authentication system" | Security → Tech Lead → Backend → QA | Sequential validation |
|
|
37
|
+
| "Deploy to production" | DevOps → QA → Backend → Tech Lead | Pre-flight checks |
|
|
38
|
+
| "Optimize system performance" | Tech Lead → Performance → Backend → DevOps → QA | Iterative optimization |
|
|
39
|
+
|
|
40
|
+
## Agent Roles & Responsibilities
|
|
41
|
+
|
|
42
|
+
### Strategic Layer
|
|
43
|
+
|
|
44
|
+
**1. PM Agent (pm-agent)**
|
|
45
|
+
- Product strategy and requirements
|
|
46
|
+
- User story creation
|
|
47
|
+
- Feature prioritization
|
|
48
|
+
- Stakeholder communication
|
|
49
|
+
- **When**: Starting new products/features
|
|
50
|
+
|
|
51
|
+
**2. Architect Agent (architect-agent)**
|
|
52
|
+
- System design and architecture
|
|
53
|
+
- Technology stack decisions
|
|
54
|
+
- Create Architecture Decision Records (ADRs)
|
|
55
|
+
- Component design
|
|
56
|
+
- **When**: Designing new systems or major features
|
|
57
|
+
|
|
58
|
+
### Execution Layer
|
|
59
|
+
|
|
60
|
+
**3. Tech Lead Agent (tech-lead-agent)**
|
|
61
|
+
- Technical planning and estimation
|
|
62
|
+
- Code review and quality standards
|
|
63
|
+
- Team guidance
|
|
64
|
+
- Technology mentorship
|
|
65
|
+
- **When**: Complex technical decisions needed
|
|
66
|
+
|
|
67
|
+
**4. Backend Developers**
|
|
68
|
+
- nodejs-backend: Node.js/TypeScript implementation
|
|
69
|
+
- python-backend: Python/FastAPI implementation
|
|
70
|
+
- dotnet-backend: C#/.NET implementation
|
|
71
|
+
- **When**: Implementing server-side logic
|
|
72
|
+
|
|
73
|
+
**5. Frontend Agent (frontend-agent)**
|
|
74
|
+
- React/Next.js implementation
|
|
75
|
+
- UI/UX implementation
|
|
76
|
+
- Client-side logic
|
|
77
|
+
- **When**: Building user interfaces
|
|
78
|
+
|
|
79
|
+
### Quality & Operations Layer
|
|
80
|
+
|
|
81
|
+
**6. QA Lead Agent (qa-lead-agent)**
|
|
82
|
+
- Test strategy creation
|
|
83
|
+
- Quality assurance
|
|
84
|
+
- Test case design
|
|
85
|
+
- Test coverage analysis
|
|
86
|
+
- **When**: Defining testing approach
|
|
87
|
+
|
|
88
|
+
**7. Security Agent (security-agent)**
|
|
89
|
+
- Security architecture review
|
|
90
|
+
- Threat modeling
|
|
91
|
+
- Penetration testing
|
|
92
|
+
- Compliance validation (OWASP, PCI-DSS)
|
|
93
|
+
- **When**: Security-critical features
|
|
94
|
+
|
|
95
|
+
**8. DevOps Agent (devops-agent)**
|
|
96
|
+
- Infrastructure provisioning
|
|
97
|
+
- CI/CD pipeline setup
|
|
98
|
+
- Deployment automation
|
|
99
|
+
- Monitoring and observability
|
|
100
|
+
- **When**: Deployment and operations tasks
|
|
101
|
+
|
|
102
|
+
## ⚠️ CRITICAL: Increment Creation FIRST
|
|
103
|
+
|
|
104
|
+
**MANDATORY FIRST STEP**: Before invoking ANY agents, the role-orchestrator MUST create an increment folder.
|
|
105
|
+
|
|
106
|
+
### Phase 0: Create Increment Structure
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
async function createIncrementFirst(userRequest: string): Promise<IncrementInfo> {
|
|
110
|
+
// 1. Parse user request to extract project name
|
|
111
|
+
const projectName = extractProjectName(userRequest);
|
|
112
|
+
// e.g., "event management" → "event-management"
|
|
113
|
+
|
|
114
|
+
// 2. Auto-number increment (scan .specweave/increments/ for highest)
|
|
115
|
+
const nextNumber = await getNextIncrementNumber();
|
|
116
|
+
// e.g., 0001, 0002, 0003
|
|
117
|
+
|
|
118
|
+
// 3. Create increment folder
|
|
119
|
+
const incrementPath = `.specweave/increments/${nextNumber}-${projectName}/`;
|
|
120
|
+
await mkdir(incrementPath, { recursive: true });
|
|
121
|
+
|
|
122
|
+
// 4. Create subdirectories
|
|
123
|
+
await mkdir(`${incrementPath}logs/`);
|
|
124
|
+
await mkdir(`${incrementPath}scripts/`);
|
|
125
|
+
await mkdir(`${incrementPath}reports/`);
|
|
126
|
+
|
|
127
|
+
// 5. Create placeholder files
|
|
128
|
+
await writeFile(`${incrementPath}spec.md`, SPEC_TEMPLATE);
|
|
129
|
+
await writeFile(`${incrementPath}tasks.md`, TASKS_TEMPLATE);
|
|
130
|
+
await writeFile(`${incrementPath}tests.md`, TESTS_TEMPLATE);
|
|
131
|
+
await writeFile(`${incrementPath}context-manifest.yaml`, CONTEXT_MANIFEST_TEMPLATE);
|
|
132
|
+
|
|
133
|
+
// 6. Return increment info for agents
|
|
134
|
+
return {
|
|
135
|
+
id: `${nextNumber}-${projectName}`,
|
|
136
|
+
path: incrementPath,
|
|
137
|
+
number: nextNumber,
|
|
138
|
+
name: projectName
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**Templates**:
|
|
144
|
+
|
|
145
|
+
```yaml
|
|
146
|
+
# spec.md frontmatter
|
|
147
|
+
---
|
|
148
|
+
increment: 0001-event-management
|
|
149
|
+
title: "Event Management SaaS"
|
|
150
|
+
priority: P1
|
|
151
|
+
status: planned
|
|
152
|
+
created: 2025-10-26
|
|
153
|
+
structure: user-stories
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
# Event Management SaaS
|
|
157
|
+
|
|
158
|
+
## Overview
|
|
159
|
+
|
|
160
|
+
(To be filled by PM Agent)
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
```yaml
|
|
164
|
+
# context-manifest.yaml
|
|
165
|
+
---
|
|
166
|
+
spec_sections:
|
|
167
|
+
- .specweave/docs/internal/strategy/README.md
|
|
168
|
+
|
|
169
|
+
documentation:
|
|
170
|
+
- .specweave/docs/internal/architecture/README.md
|
|
171
|
+
|
|
172
|
+
max_context_tokens: 10000
|
|
173
|
+
priority: high
|
|
174
|
+
auto_refresh: false
|
|
175
|
+
---
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Then pass increment path to ALL agents**:
|
|
179
|
+
```typescript
|
|
180
|
+
const increment = await createIncrementFirst(userRequest);
|
|
181
|
+
|
|
182
|
+
// Now invoke agents with increment path
|
|
183
|
+
await invokeAgent('pm', {
|
|
184
|
+
task: 'Define product requirements',
|
|
185
|
+
outputPath: `${increment.path}reports/pm-analysis.md`,
|
|
186
|
+
incrementId: increment.id
|
|
187
|
+
});
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### ⚠️ CRITICAL: File Reading Instructions for Agents
|
|
191
|
+
|
|
192
|
+
When invoking agents, provide clear instructions to **read FILES, not DIRECTORIES**:
|
|
193
|
+
|
|
194
|
+
**❌ WRONG**:
|
|
195
|
+
```typescript
|
|
196
|
+
await invokeAgent('architect', {
|
|
197
|
+
task: 'Read .specweave/docs/internal/strategy and design architecture'
|
|
198
|
+
});
|
|
199
|
+
```
|
|
200
|
+
This will fail with `EISDIR: illegal operation on a directory, read`
|
|
201
|
+
|
|
202
|
+
**✅ CORRECT**:
|
|
203
|
+
```typescript
|
|
204
|
+
await invokeAgent('architect', {
|
|
205
|
+
task: `Read .specweave/docs/internal/strategy/README.md for existing strategy.
|
|
206
|
+
Use Glob to find additional files: .specweave/docs/internal/strategy/**/*.md
|
|
207
|
+
Then design system architecture.`
|
|
208
|
+
});
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
**Best Practice**:
|
|
212
|
+
- Always specify **file paths** (`.md` extension), NOT directory paths
|
|
213
|
+
- Use `Glob` tool for pattern matching (`**/*.md`)
|
|
214
|
+
- Read `README.md` files for directory overviews
|
|
215
|
+
- List specific files to read
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Orchestration Workflows
|
|
220
|
+
|
|
221
|
+
### Workflow 1: New Product Development
|
|
222
|
+
|
|
223
|
+
```yaml
|
|
224
|
+
name: "Build SaaS Product"
|
|
225
|
+
pattern: sequential_with_gates
|
|
226
|
+
agents:
|
|
227
|
+
- role: pm-agent
|
|
228
|
+
task: "Define product requirements and user stories"
|
|
229
|
+
output: specifications/product.md
|
|
230
|
+
gate: user_approval_required
|
|
231
|
+
|
|
232
|
+
- role: architect-agent
|
|
233
|
+
task: "Design system architecture"
|
|
234
|
+
input: specifications/product.md
|
|
235
|
+
output: .specweave/docs/architecture/system-design.md
|
|
236
|
+
gate: tech_review_required
|
|
237
|
+
|
|
238
|
+
- role: tech-lead-agent
|
|
239
|
+
task: "Create technical implementation plan"
|
|
240
|
+
input: .specweave/docs/architecture/system-design.md
|
|
241
|
+
output: .specweave/increments/####-product/plan.md
|
|
242
|
+
|
|
243
|
+
- role: security-agent
|
|
244
|
+
task: "Security architecture review"
|
|
245
|
+
input: .specweave/docs/architecture/system-design.md
|
|
246
|
+
output: .specweave/docs/architecture/security/threat-model.md
|
|
247
|
+
gate: security_approval
|
|
248
|
+
|
|
249
|
+
- role: qa-lead-agent
|
|
250
|
+
task: "Define test strategy"
|
|
251
|
+
input: specifications/product.md
|
|
252
|
+
output: .specweave/increments/####-product/tests.md
|
|
253
|
+
|
|
254
|
+
- role: [nodejs-backend, frontend-agent]
|
|
255
|
+
task: "Implement features"
|
|
256
|
+
pattern: parallel
|
|
257
|
+
input: .specweave/increments/####-product/plan.md
|
|
258
|
+
|
|
259
|
+
- role: qa-lead-agent
|
|
260
|
+
task: "Execute tests"
|
|
261
|
+
input: .specweave/increments/####-product/tests.md
|
|
262
|
+
gate: all_tests_pass
|
|
263
|
+
|
|
264
|
+
- role: devops-agent
|
|
265
|
+
task: "Deploy to production"
|
|
266
|
+
input: .specweave/increments/####-product/plan.md#deployment
|
|
267
|
+
gate: deployment_approval
|
|
268
|
+
|
|
269
|
+
success_criteria:
|
|
270
|
+
- All gates passed
|
|
271
|
+
- Tests passing (>80% coverage)
|
|
272
|
+
- Security review approved
|
|
273
|
+
- Deployed successfully
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### Workflow 2: Feature Addition (Brownfield)
|
|
277
|
+
|
|
278
|
+
```yaml
|
|
279
|
+
name: "Add Feature to Existing System"
|
|
280
|
+
pattern: analyze_then_build
|
|
281
|
+
agents:
|
|
282
|
+
- role: tech-lead-agent
|
|
283
|
+
task: "Analyze existing codebase"
|
|
284
|
+
output: .specweave/increments/####-feature/analysis.md
|
|
285
|
+
|
|
286
|
+
- role: architect-agent
|
|
287
|
+
task: "Design integration approach"
|
|
288
|
+
input: .specweave/increments/####-feature/analysis.md
|
|
289
|
+
output: .specweave/increments/####-feature/plan.md
|
|
290
|
+
|
|
291
|
+
- role: qa-lead-agent
|
|
292
|
+
task: "Create regression test suite"
|
|
293
|
+
input: .specweave/increments/####-feature/analysis.md
|
|
294
|
+
output: .specweave/increments/####-feature/regression-tests.md
|
|
295
|
+
gate: user_validates_tests
|
|
296
|
+
|
|
297
|
+
- role: [backend-agent, frontend-agent]
|
|
298
|
+
task: "Implement feature"
|
|
299
|
+
pattern: parallel
|
|
300
|
+
|
|
301
|
+
- role: qa-lead-agent
|
|
302
|
+
task: "Run regression + new tests"
|
|
303
|
+
gate: no_regressions_detected
|
|
304
|
+
|
|
305
|
+
- role: devops-agent
|
|
306
|
+
task: "Deploy with canary release"
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Workflow 3: Security Hardening
|
|
310
|
+
|
|
311
|
+
```yaml
|
|
312
|
+
name: "Secure Existing System"
|
|
313
|
+
pattern: assess_fix_verify
|
|
314
|
+
agents:
|
|
315
|
+
- role: security-agent
|
|
316
|
+
task: "Threat modeling and security assessment"
|
|
317
|
+
output: .specweave/docs/architecture/security/assessment.md
|
|
318
|
+
|
|
319
|
+
- role: tech-lead-agent
|
|
320
|
+
task: "Prioritize security issues"
|
|
321
|
+
input: .specweave/docs/architecture/security/assessment.md
|
|
322
|
+
output: work/issues/###-security-fixes/
|
|
323
|
+
|
|
324
|
+
- role: [backend-agent, frontend-agent]
|
|
325
|
+
task: "Implement security fixes"
|
|
326
|
+
pattern: parallel
|
|
327
|
+
|
|
328
|
+
- role: security-agent
|
|
329
|
+
task: "Penetration testing"
|
|
330
|
+
gate: no_critical_vulns
|
|
331
|
+
|
|
332
|
+
- role: qa-lead-agent
|
|
333
|
+
task: "Security regression tests"
|
|
334
|
+
gate: all_tests_pass
|
|
335
|
+
|
|
336
|
+
- role: devops-agent
|
|
337
|
+
task: "Deploy with zero-downtime"
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### Workflow 4: Performance Optimization
|
|
341
|
+
|
|
342
|
+
```yaml
|
|
343
|
+
name: "Optimize System Performance"
|
|
344
|
+
pattern: measure_optimize_verify
|
|
345
|
+
agents:
|
|
346
|
+
- role: tech-lead-agent
|
|
347
|
+
task: "Profile and identify bottlenecks"
|
|
348
|
+
output: work/issues/###-performance/analysis.md
|
|
349
|
+
|
|
350
|
+
- role: architect-agent
|
|
351
|
+
task: "Design optimization strategy"
|
|
352
|
+
input: work/issues/###-performance/analysis.md
|
|
353
|
+
|
|
354
|
+
- role: [backend-agent, frontend-agent, devops-agent]
|
|
355
|
+
task: "Implement optimizations"
|
|
356
|
+
pattern: parallel
|
|
357
|
+
|
|
358
|
+
- role: qa-lead-agent
|
|
359
|
+
task: "Performance regression tests"
|
|
360
|
+
gate: performance_targets_met
|
|
361
|
+
|
|
362
|
+
- role: devops-agent
|
|
363
|
+
task: "Deploy with traffic shaping"
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
## Task Decomposition Strategy
|
|
367
|
+
|
|
368
|
+
### 1. Analyze Request Complexity
|
|
369
|
+
|
|
370
|
+
```typescript
|
|
371
|
+
interface ComplexityAnalysis {
|
|
372
|
+
scope: 'single-feature' | 'multi-feature' | 'full-product' | 'system-wide';
|
|
373
|
+
domains: string[]; // ['backend', 'frontend', 'database', 'infrastructure']
|
|
374
|
+
phases: number; // Number of sequential phases
|
|
375
|
+
agents_needed: string[];
|
|
376
|
+
estimated_effort: 'small' | 'medium' | 'large' | 'xl';
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
function analyzeComplexity(userRequest: string): ComplexityAnalysis {
|
|
380
|
+
// Use intent classification from skill-router
|
|
381
|
+
// Analyze keywords, scope, and requirements
|
|
382
|
+
// Return structured complexity analysis
|
|
383
|
+
}
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
### 2. Create Execution Plan
|
|
387
|
+
|
|
388
|
+
```typescript
|
|
389
|
+
interface ExecutionPlan {
|
|
390
|
+
phases: Phase[];
|
|
391
|
+
parallel_groups: ParallelGroup[];
|
|
392
|
+
gates: QualityGate[];
|
|
393
|
+
estimated_duration: string;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
interface Phase {
|
|
397
|
+
name: string;
|
|
398
|
+
agents: AgentAssignment[];
|
|
399
|
+
dependencies: string[]; // Phase IDs this depends on
|
|
400
|
+
outputs: string[]; // File paths to create
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
interface ParallelGroup {
|
|
404
|
+
agents: string[];
|
|
405
|
+
can_run_concurrently: boolean;
|
|
406
|
+
sync_point: string; // Where they must sync
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
interface QualityGate {
|
|
410
|
+
phase: string;
|
|
411
|
+
type: 'user_approval' | 'test_pass' | 'security_review' | 'performance_target';
|
|
412
|
+
criteria: string[];
|
|
413
|
+
blocker: boolean; // If true, cannot proceed until gate passes
|
|
414
|
+
}
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
### 3. Execute with Monitoring
|
|
418
|
+
|
|
419
|
+
```typescript
|
|
420
|
+
interface ExecutionState {
|
|
421
|
+
current_phase: number;
|
|
422
|
+
completed_tasks: string[];
|
|
423
|
+
blocked_tasks: string[];
|
|
424
|
+
gates_status: Record<string, 'pending' | 'passed' | 'failed'>;
|
|
425
|
+
agent_outputs: Record<string, any>;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
async function execute(plan: ExecutionPlan): Promise<ExecutionResult> {
|
|
429
|
+
const state: ExecutionState = initializeState();
|
|
430
|
+
|
|
431
|
+
for (const phase of plan.phases) {
|
|
432
|
+
// Check dependencies satisfied
|
|
433
|
+
if (!areDependenciesMet(phase, state)) {
|
|
434
|
+
await waitForDependencies(phase);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// Execute agents (parallel or sequential)
|
|
438
|
+
const results = await executePhase(phase);
|
|
439
|
+
|
|
440
|
+
// Update state
|
|
441
|
+
state.completed_tasks.push(...results.tasks);
|
|
442
|
+
state.agent_outputs[phase.name] = results.outputs;
|
|
443
|
+
|
|
444
|
+
// Check quality gates
|
|
445
|
+
if (phase.gates) {
|
|
446
|
+
const gateResults = await checkGates(phase.gates);
|
|
447
|
+
if (gateResults.failed.length > 0) {
|
|
448
|
+
// Handle gate failures
|
|
449
|
+
await handleGateFailures(gateResults.failed);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
return {
|
|
455
|
+
success: state.blocked_tasks.length === 0,
|
|
456
|
+
outputs: state.agent_outputs,
|
|
457
|
+
summary: generateSummary(state)
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
## Agent Communication Patterns
|
|
463
|
+
|
|
464
|
+
### 1. Sequential Handoff
|
|
465
|
+
|
|
466
|
+
```
|
|
467
|
+
PM Agent → Architect Agent → Tech Lead → Implementation
|
|
468
|
+
(specs) (design) (plan) (code)
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
Each agent receives the previous agent's output and builds upon it.
|
|
472
|
+
|
|
473
|
+
### 2. Parallel Execution with Shared State
|
|
474
|
+
|
|
475
|
+
```
|
|
476
|
+
Backend Agent ─┐
|
|
477
|
+
├─→ Shared Memory (Context) ─→ Integration Phase
|
|
478
|
+
Frontend Agent ─┘
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
Multiple agents work simultaneously, coordinated through shared context.
|
|
482
|
+
|
|
483
|
+
### 3. Feedback Loops
|
|
484
|
+
|
|
485
|
+
```
|
|
486
|
+
Implementation → QA → [FAIL] → Tech Lead (analysis) → Implementation
|
|
487
|
+
↓
|
|
488
|
+
[PASS]
|
|
489
|
+
↓
|
|
490
|
+
DevOps
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
Iterative refinement with quality gates.
|
|
494
|
+
|
|
495
|
+
### 4. Hierarchical Decision-Making
|
|
496
|
+
|
|
497
|
+
```
|
|
498
|
+
Role Orchestrator (strategic decisions)
|
|
499
|
+
↓
|
|
500
|
+
Tech Lead Agent (tactical decisions)
|
|
501
|
+
↓
|
|
502
|
+
Implementation Agents (execution)
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
## Context Management
|
|
506
|
+
|
|
507
|
+
### Shared Context Structure
|
|
508
|
+
|
|
509
|
+
```yaml
|
|
510
|
+
# .specweave/orchestration/context.yaml
|
|
511
|
+
project:
|
|
512
|
+
name: "E-Commerce Platform"
|
|
513
|
+
phase: "implementation"
|
|
514
|
+
current_feature: "003-payment-processing"
|
|
515
|
+
|
|
516
|
+
agents_active:
|
|
517
|
+
- pm-agent: "requirements_complete"
|
|
518
|
+
- architect-agent: "design_approved"
|
|
519
|
+
- backend-agent: "in_progress"
|
|
520
|
+
- frontend-agent: "in_progress"
|
|
521
|
+
- qa-lead-agent: "test_strategy_ready"
|
|
522
|
+
|
|
523
|
+
shared_artifacts:
|
|
524
|
+
specifications: "specifications/modules/payments/"
|
|
525
|
+
architecture: ".specweave/docs/architecture/payment-system.md"
|
|
526
|
+
feature_plan: "features/003-payment-processing/plan.md"
|
|
527
|
+
implementation: "src/payments/"
|
|
528
|
+
|
|
529
|
+
quality_gates:
|
|
530
|
+
- name: "security_review"
|
|
531
|
+
status: "passed"
|
|
532
|
+
approved_by: "security-agent"
|
|
533
|
+
- name: "test_coverage"
|
|
534
|
+
status: "pending"
|
|
535
|
+
target: ">80%"
|
|
536
|
+
current: "67%"
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
### Agent-to-Agent Communication
|
|
540
|
+
|
|
541
|
+
Agents communicate through:
|
|
542
|
+
1. **File outputs**: Each agent creates files in designated locations
|
|
543
|
+
2. **Shared memory**: `.specweave/orchestration/context.yaml`
|
|
544
|
+
3. **Event system**: Agents emit events when tasks complete
|
|
545
|
+
4. **Quality gates**: Explicit approval/rejection points
|
|
546
|
+
|
|
547
|
+
## Decision-Making Framework
|
|
548
|
+
|
|
549
|
+
### When to Use Which Agent
|
|
550
|
+
|
|
551
|
+
```typescript
|
|
552
|
+
const agentSelectionRules = {
|
|
553
|
+
// Product/Business decisions
|
|
554
|
+
'requirements|user-stories|product-strategy': 'pm-agent',
|
|
555
|
+
|
|
556
|
+
// Architecture decisions
|
|
557
|
+
'design|architecture|system-design|tech-stack': 'architect-agent',
|
|
558
|
+
|
|
559
|
+
// Technical guidance
|
|
560
|
+
'code-review|best-practices|technical-debt|refactoring': 'tech-lead-agent',
|
|
561
|
+
|
|
562
|
+
// Security
|
|
563
|
+
'security|authentication|authorization|encryption|compliance': 'security-agent',
|
|
564
|
+
|
|
565
|
+
// Quality assurance
|
|
566
|
+
'testing|qa|test-strategy|test-coverage': 'qa-lead-agent',
|
|
567
|
+
|
|
568
|
+
// Implementation
|
|
569
|
+
'implement-nodejs|api|backend': 'nodejs-backend',
|
|
570
|
+
'implement-python|ml|data': 'python-backend',
|
|
571
|
+
'implement-dotnet|csharp|enterprise': 'dotnet-backend',
|
|
572
|
+
'implement-ui|frontend|react': 'frontend-agent',
|
|
573
|
+
|
|
574
|
+
// Operations
|
|
575
|
+
'deploy|infrastructure|ci-cd|monitoring': 'devops-agent'
|
|
576
|
+
};
|
|
577
|
+
|
|
578
|
+
function selectAgents(task: string): string[] {
|
|
579
|
+
const keywords = extractKeywords(task);
|
|
580
|
+
const matchedAgents = [];
|
|
581
|
+
|
|
582
|
+
for (const [pattern, agent] of Object.entries(agentSelectionRules)) {
|
|
583
|
+
if (keywords.some(kw => pattern.includes(kw))) {
|
|
584
|
+
matchedAgents.push(agent);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
return matchedAgents;
|
|
589
|
+
}
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
## Error Handling & Resilience
|
|
593
|
+
|
|
594
|
+
### Retry Strategy
|
|
595
|
+
|
|
596
|
+
```typescript
|
|
597
|
+
interface RetryConfig {
|
|
598
|
+
max_attempts: number;
|
|
599
|
+
backoff: 'linear' | 'exponential';
|
|
600
|
+
fallback_agent?: string;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
async function executeWithRetry(
|
|
604
|
+
agent: string,
|
|
605
|
+
task: string,
|
|
606
|
+
config: RetryConfig
|
|
607
|
+
): Promise<AgentResult> {
|
|
608
|
+
for (let attempt = 1; attempt <= config.max_attempts; attempt++) {
|
|
609
|
+
try {
|
|
610
|
+
const result = await invokeAgent(agent, task);
|
|
611
|
+
if (result.success) {
|
|
612
|
+
return result;
|
|
613
|
+
}
|
|
614
|
+
} catch (error) {
|
|
615
|
+
if (attempt === config.max_attempts) {
|
|
616
|
+
// Try fallback agent if configured
|
|
617
|
+
if (config.fallback_agent) {
|
|
618
|
+
return await invokeAgent(config.fallback_agent, task);
|
|
619
|
+
}
|
|
620
|
+
throw error;
|
|
621
|
+
}
|
|
622
|
+
await sleep(calculateBackoff(attempt, config.backoff));
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
### Feedback Loops with Auto-Refinement
|
|
629
|
+
|
|
630
|
+
**NEW: Automatic quality improvement through iterative refinement**
|
|
631
|
+
|
|
632
|
+
```typescript
|
|
633
|
+
interface FeedbackLoopConfig {
|
|
634
|
+
enabled: boolean;
|
|
635
|
+
max_retries: 3;
|
|
636
|
+
stop_on_improvement: boolean;
|
|
637
|
+
quality_threshold: number; // 0.0-1.0
|
|
638
|
+
require_user_approval: boolean;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
interface RefinementResult {
|
|
642
|
+
attempt: number;
|
|
643
|
+
output: string;
|
|
644
|
+
score: number;
|
|
645
|
+
issues: Issue[];
|
|
646
|
+
improved: boolean;
|
|
647
|
+
final: boolean;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
async function executeWithFeedback(
|
|
651
|
+
agent: string,
|
|
652
|
+
task: string,
|
|
653
|
+
validator: (output: string) => Promise<ValidationResult>,
|
|
654
|
+
config: FeedbackLoopConfig
|
|
655
|
+
): Promise<RefinementResult> {
|
|
656
|
+
|
|
657
|
+
let bestResult = null;
|
|
658
|
+
let bestScore = 0;
|
|
659
|
+
|
|
660
|
+
for (let attempt = 1; attempt <= config.max_retries; attempt++) {
|
|
661
|
+
// Execute agent
|
|
662
|
+
const output = await invokeAgent(agent, task);
|
|
663
|
+
|
|
664
|
+
// Validate output
|
|
665
|
+
const validation = await validator(output);
|
|
666
|
+
|
|
667
|
+
// Track progress
|
|
668
|
+
console.log(`🔄 Refinement Attempt ${attempt}/${config.max_retries}`);
|
|
669
|
+
console.log(` Score: ${validation.score.toFixed(2)} (Target: ${config.quality_threshold})`);
|
|
670
|
+
|
|
671
|
+
// Check if quality threshold met
|
|
672
|
+
if (validation.score >= config.quality_threshold) {
|
|
673
|
+
console.log(`✅ Quality threshold met (${validation.score.toFixed(2)} >= ${config.quality_threshold})`);
|
|
674
|
+
return {
|
|
675
|
+
attempt,
|
|
676
|
+
output,
|
|
677
|
+
score: validation.score,
|
|
678
|
+
issues: [],
|
|
679
|
+
improved: true,
|
|
680
|
+
final: true
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
// Track best result
|
|
685
|
+
if (validation.score > bestScore) {
|
|
686
|
+
bestScore = validation.score;
|
|
687
|
+
bestResult = { attempt, output, score: validation.score, issues: validation.issues };
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
// Check if should stop (improvement + stop_on_improvement flag)
|
|
691
|
+
if (config.stop_on_improvement && attempt > 1 && validation.score > bestScore) {
|
|
692
|
+
console.log(`⏸️ Stopping early (score improved: ${bestScore.toFixed(2)} → ${validation.score.toFixed(2)})`);
|
|
693
|
+
return {
|
|
694
|
+
...bestResult,
|
|
695
|
+
improved: true,
|
|
696
|
+
final: true
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
// If not last attempt, prepare feedback for next iteration
|
|
701
|
+
if (attempt < config.max_retries) {
|
|
702
|
+
const feedback = generateFeedback(validation.issues);
|
|
703
|
+
|
|
704
|
+
// Update task with feedback
|
|
705
|
+
task = `${task}\n\n**Feedback from previous attempt (${validation.score.toFixed(2)}/1.00):**\n${feedback}`;
|
|
706
|
+
|
|
707
|
+
console.log(` Issues found: ${validation.issues.length}`);
|
|
708
|
+
console.log(` Retrying with feedback...`);
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
// Max retries reached, return best result
|
|
713
|
+
console.log(`⚠️ Max retries reached. Best score: ${bestScore.toFixed(2)}`);
|
|
714
|
+
|
|
715
|
+
return {
|
|
716
|
+
...bestResult,
|
|
717
|
+
improved: bestScore > 0,
|
|
718
|
+
final: true
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
function generateFeedback(issues: Issue[]): string {
|
|
723
|
+
const feedback: string[] = [];
|
|
724
|
+
|
|
725
|
+
for (const issue of issues) {
|
|
726
|
+
feedback.push(`• ${issue.severity.toUpperCase()}: ${issue.description}`);
|
|
727
|
+
if (issue.location) {
|
|
728
|
+
feedback.push(` Location: ${issue.location}`);
|
|
729
|
+
}
|
|
730
|
+
if (issue.suggestion) {
|
|
731
|
+
feedback.push(` Suggestion: ${issue.suggestion}`);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
return feedback.join('\n');
|
|
736
|
+
}
|
|
737
|
+
```
|
|
738
|
+
|
|
739
|
+
### Feedback Loop Workflow
|
|
740
|
+
|
|
741
|
+
```
|
|
742
|
+
Agent generates output
|
|
743
|
+
↓
|
|
744
|
+
Validate output (rule-based + LLM-judge)
|
|
745
|
+
↓
|
|
746
|
+
Score < threshold? ──No──→ ✅ Accept output
|
|
747
|
+
↓ Yes
|
|
748
|
+
Extract issues and suggestions
|
|
749
|
+
↓
|
|
750
|
+
Generate feedback prompt
|
|
751
|
+
↓
|
|
752
|
+
Agent regenerates with feedback ──┐
|
|
753
|
+
↓ │
|
|
754
|
+
Validate again │
|
|
755
|
+
↓ │
|
|
756
|
+
Score improved? ──No──→ Retry ────┘ (max 3x)
|
|
757
|
+
↓ Yes
|
|
758
|
+
✅ Accept improved output
|
|
759
|
+
```
|
|
760
|
+
|
|
761
|
+
### Agent-Specific Feedback Integration
|
|
762
|
+
|
|
763
|
+
**PM Agent (Requirements)**
|
|
764
|
+
```typescript
|
|
765
|
+
const pmValidator = async (spec: string) => {
|
|
766
|
+
// Rule-based checks
|
|
767
|
+
const ruleScore = await runRuleBasedValidation(spec);
|
|
768
|
+
|
|
769
|
+
// Optional: LLM-as-judge quality check
|
|
770
|
+
const qualityScore = await incrementQualityJudge.evaluate(spec);
|
|
771
|
+
|
|
772
|
+
return {
|
|
773
|
+
score: (ruleScore + qualityScore) / 2,
|
|
774
|
+
issues: [...ruleIssues, ...qualityIssues]
|
|
775
|
+
};
|
|
776
|
+
};
|
|
777
|
+
|
|
778
|
+
await executeWithFeedback(
|
|
779
|
+
'pm-agent',
|
|
780
|
+
'Define requirements for authentication',
|
|
781
|
+
pmValidator,
|
|
782
|
+
config
|
|
783
|
+
);
|
|
784
|
+
```
|
|
785
|
+
|
|
786
|
+
**Architect Agent (Design)**
|
|
787
|
+
```typescript
|
|
788
|
+
const architectValidator = async (design: string) => {
|
|
789
|
+
return await incrementQualityJudge.evaluate(design, {
|
|
790
|
+
dimensions: ['feasibility', 'scalability', 'maintainability']
|
|
791
|
+
});
|
|
792
|
+
};
|
|
793
|
+
|
|
794
|
+
await executeWithFeedback(
|
|
795
|
+
'architect-agent',
|
|
796
|
+
'Design authentication system',
|
|
797
|
+
architectValidator,
|
|
798
|
+
config
|
|
799
|
+
);
|
|
800
|
+
```
|
|
801
|
+
|
|
802
|
+
**QA Lead Agent (Test Strategy)**
|
|
803
|
+
```typescript
|
|
804
|
+
const qaValidator = async (testPlan: string) => {
|
|
805
|
+
// Check test coverage
|
|
806
|
+
const coverage = await analyzeTestCoverage(testPlan);
|
|
807
|
+
|
|
808
|
+
// Check testability
|
|
809
|
+
const testability = await incrementQualityJudge.evaluate(testPlan, {
|
|
810
|
+
dimensions: ['testability', 'completeness']
|
|
811
|
+
});
|
|
812
|
+
|
|
813
|
+
return {
|
|
814
|
+
score: coverage >= 0.80 ? testability.score : 0.60,
|
|
815
|
+
issues: testability.issues
|
|
816
|
+
};
|
|
817
|
+
};
|
|
818
|
+
|
|
819
|
+
await executeWithFeedback(
|
|
820
|
+
'qa-lead-agent',
|
|
821
|
+
'Create test strategy',
|
|
822
|
+
qaValidator,
|
|
823
|
+
config
|
|
824
|
+
);
|
|
825
|
+
```
|
|
826
|
+
|
|
827
|
+
### Example: PM Agent with Feedback Loop
|
|
828
|
+
|
|
829
|
+
```markdown
|
|
830
|
+
🔷 SpecWeave Multi-Agent Orchestration Active
|
|
831
|
+
|
|
832
|
+
**Task**: Create authentication feature
|
|
833
|
+
**Agent**: PM Agent (Requirements)
|
|
834
|
+
|
|
835
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
836
|
+
|
|
837
|
+
**Attempt 1/3**: Generating requirements...
|
|
838
|
+
|
|
839
|
+
✅ PM Agent completed
|
|
840
|
+
🔍 Validating output...
|
|
841
|
+
|
|
842
|
+
Validation Results:
|
|
843
|
+
Rule-based: ✅ 47/47 passed
|
|
844
|
+
Quality Score: 0.72/1.00 ⚠️ (Needs improvement)
|
|
845
|
+
|
|
846
|
+
Issues Found:
|
|
847
|
+
• MAJOR: Acceptance criteria not testable
|
|
848
|
+
Location: Section "Success Criteria"
|
|
849
|
+
Suggestion: Use measurable metrics (e.g., "Login completes in <2s")
|
|
850
|
+
|
|
851
|
+
• MINOR: Missing rate limiting specification
|
|
852
|
+
Location: Section "Security"
|
|
853
|
+
Suggestion: Specify brute-force protection (5 attempts, 15min lockout)
|
|
854
|
+
|
|
855
|
+
Score: 0.72 < 0.80 (threshold)
|
|
856
|
+
|
|
857
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
858
|
+
|
|
859
|
+
🔄 **Attempt 2/3**: Refining with feedback...
|
|
860
|
+
|
|
861
|
+
✅ PM Agent completed (with feedback)
|
|
862
|
+
🔍 Validating output...
|
|
863
|
+
|
|
864
|
+
Validation Results:
|
|
865
|
+
Rule-based: ✅ 47/47 passed
|
|
866
|
+
Quality Score: 0.85/1.00 ✓ (Improved!)
|
|
867
|
+
|
|
868
|
+
Issues Found:
|
|
869
|
+
• MINOR: Performance requirements could be more specific
|
|
870
|
+
Location: Section "Non-functional Requirements"
|
|
871
|
+
Suggestion: Add p95/p99 latency targets
|
|
872
|
+
|
|
873
|
+
Score: 0.85 > 0.80 (threshold) ✅
|
|
874
|
+
|
|
875
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
876
|
+
|
|
877
|
+
✅ **Final Result**: Requirements validated (0.85/1.00)
|
|
878
|
+
|
|
879
|
+
Improvements made:
|
|
880
|
+
✓ Acceptance criteria now measurable
|
|
881
|
+
✓ Rate limiting specified (5 attempts, 15min lockout)
|
|
882
|
+
✓ Testable success metrics added
|
|
883
|
+
|
|
884
|
+
Minor issues remaining (can be addressed later):
|
|
885
|
+
• Performance requirements (p95/p99 targets)
|
|
886
|
+
|
|
887
|
+
Proceeding to architecture phase...
|
|
888
|
+
```
|
|
889
|
+
|
|
890
|
+
### Configuration for Feedback Loops
|
|
891
|
+
|
|
892
|
+
```yaml
|
|
893
|
+
# .specweave/config.yaml
|
|
894
|
+
role_orchestrator:
|
|
895
|
+
enabled: true
|
|
896
|
+
|
|
897
|
+
# Feedback loop configuration
|
|
898
|
+
feedback_loops:
|
|
899
|
+
enabled: true # Enable auto-refinement
|
|
900
|
+
max_retries: 3 # Max refinement attempts
|
|
901
|
+
stop_on_improvement: true # Stop if score improves
|
|
902
|
+
require_user_approval: false # Auto-refine without asking
|
|
903
|
+
|
|
904
|
+
# Quality thresholds per agent
|
|
905
|
+
thresholds:
|
|
906
|
+
pm_agent: 0.80 # Requirements quality
|
|
907
|
+
architect_agent: 0.80 # Design quality
|
|
908
|
+
qa_lead_agent: 0.75 # Test coverage + quality
|
|
909
|
+
|
|
910
|
+
# Which agents use feedback loops
|
|
911
|
+
agents:
|
|
912
|
+
- pm_agent
|
|
913
|
+
- architect_agent
|
|
914
|
+
- qa_lead_agent
|
|
915
|
+
# Not applicable for implementation agents
|
|
916
|
+
|
|
917
|
+
# Validation strategy
|
|
918
|
+
validation:
|
|
919
|
+
use_llm_judge: true # Use increment-quality-judge
|
|
920
|
+
combine_with_rules: true # Combine with rule-based checks
|
|
921
|
+
judge_weight: 0.5 # 50% LLM judge, 50% rules
|
|
922
|
+
```
|
|
923
|
+
|
|
924
|
+
### Gate Failure Handling
|
|
925
|
+
|
|
926
|
+
```typescript
|
|
927
|
+
async function handleGateFailure(gate: QualityGate): Promise<void> {
|
|
928
|
+
switch (gate.type) {
|
|
929
|
+
case 'test_pass':
|
|
930
|
+
// Route to QA Lead for analysis
|
|
931
|
+
await invokeAgent('qa-lead-agent', 'Analyze test failures');
|
|
932
|
+
// Then route to appropriate implementation agent
|
|
933
|
+
break;
|
|
934
|
+
|
|
935
|
+
case 'security_review':
|
|
936
|
+
// Route to Security Agent for details
|
|
937
|
+
await invokeAgent('security-agent', 'Detail security issues');
|
|
938
|
+
// Create work items for fixes
|
|
939
|
+
break;
|
|
940
|
+
|
|
941
|
+
case 'performance_target':
|
|
942
|
+
// Route to Tech Lead for optimization strategy
|
|
943
|
+
await invokeAgent('tech-lead-agent', 'Performance optimization plan');
|
|
944
|
+
break;
|
|
945
|
+
|
|
946
|
+
case 'user_approval':
|
|
947
|
+
// Notify user, wait for feedback
|
|
948
|
+
await notifyUser(gate);
|
|
949
|
+
await waitForUserApproval(gate);
|
|
950
|
+
break;
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
```
|
|
954
|
+
|
|
955
|
+
## Monitoring & Observability
|
|
956
|
+
|
|
957
|
+
### Progress Tracking
|
|
958
|
+
|
|
959
|
+
```typescript
|
|
960
|
+
interface OrchestrationMetrics {
|
|
961
|
+
total_phases: number;
|
|
962
|
+
completed_phases: number;
|
|
963
|
+
agents_invoked: Record<string, number>;
|
|
964
|
+
gates_passed: number;
|
|
965
|
+
gates_failed: number;
|
|
966
|
+
execution_time: number;
|
|
967
|
+
estimated_time_remaining: number;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
function trackProgress(state: ExecutionState): OrchestrationMetrics {
|
|
971
|
+
// Calculate metrics
|
|
972
|
+
// Store in .specweave/orchestration/metrics.json
|
|
973
|
+
// Display to user
|
|
974
|
+
}
|
|
975
|
+
```
|
|
976
|
+
|
|
977
|
+
### User Visibility
|
|
978
|
+
|
|
979
|
+
Provide clear progress updates:
|
|
980
|
+
|
|
981
|
+
```markdown
|
|
982
|
+
🔷 SpecWeave Multi-Agent Orchestration Active
|
|
983
|
+
|
|
984
|
+
**Task**: Build E-Commerce Platform
|
|
985
|
+
**Progress**: Phase 3 of 6 (Implementation)
|
|
986
|
+
|
|
987
|
+
✅ Phase 1: Requirements (PM Agent) - Complete
|
|
988
|
+
✅ Phase 2: Architecture (Architect Agent) - Complete
|
|
989
|
+
🔄 Phase 3: Implementation - In Progress
|
|
990
|
+
├─ Backend (nodejs-backend): 65% complete
|
|
991
|
+
└─ Frontend (frontend-agent): 45% complete
|
|
992
|
+
⏳ Phase 4: Testing (QA Lead) - Waiting
|
|
993
|
+
⏳ Phase 5: Security Review - Waiting
|
|
994
|
+
⏳ Phase 6: Deployment - Waiting
|
|
995
|
+
|
|
996
|
+
**Quality Gates**:
|
|
997
|
+
✅ Architecture Review: Passed
|
|
998
|
+
⏳ Test Coverage (Target: >80%): Currently 67%
|
|
999
|
+
⏳ Security Review: Pending
|
|
1000
|
+
|
|
1001
|
+
**Estimated Time Remaining**: 2-3 hours
|
|
1002
|
+
```
|
|
1003
|
+
|
|
1004
|
+
## Integration with Other Skills
|
|
1005
|
+
|
|
1006
|
+
### Skill Invocation
|
|
1007
|
+
|
|
1008
|
+
```typescript
|
|
1009
|
+
// role-orchestrator can invoke any other skill
|
|
1010
|
+
async function invokeSkill(skillName: string, task: string, context: any) {
|
|
1011
|
+
// Load skill context
|
|
1012
|
+
const skillContext = await loadSkillContext(skillName);
|
|
1013
|
+
|
|
1014
|
+
// Merge with orchestration context
|
|
1015
|
+
const mergedContext = {
|
|
1016
|
+
...context,
|
|
1017
|
+
...skillContext,
|
|
1018
|
+
orchestration: {
|
|
1019
|
+
coordinator: 'role-orchestrator',
|
|
1020
|
+
phase: context.current_phase,
|
|
1021
|
+
task_id: generateTaskId()
|
|
1022
|
+
}
|
|
1023
|
+
};
|
|
1024
|
+
|
|
1025
|
+
// Invoke skill
|
|
1026
|
+
const result = await executeSkill(skillName, task, mergedContext);
|
|
1027
|
+
|
|
1028
|
+
// Store result in shared memory
|
|
1029
|
+
await storeResult(skillName, result);
|
|
1030
|
+
|
|
1031
|
+
return result;
|
|
1032
|
+
}
|
|
1033
|
+
```
|
|
1034
|
+
|
|
1035
|
+
### Called By
|
|
1036
|
+
|
|
1037
|
+
- **specweave-detector**: For complex multi-agent requests
|
|
1038
|
+
- **skill-router**: When complexity analysis indicates >3 agents needed
|
|
1039
|
+
|
|
1040
|
+
### Calls
|
|
1041
|
+
|
|
1042
|
+
- All SpecWeave agent skills (pm-agent, architect-agent, etc.)
|
|
1043
|
+
- SpecWeave utility skills (context-loader, docs-updater, etc.)
|
|
1044
|
+
|
|
1045
|
+
## Configuration
|
|
1046
|
+
|
|
1047
|
+
```yaml
|
|
1048
|
+
# .specweave/config.yaml
|
|
1049
|
+
role_orchestrator:
|
|
1050
|
+
enabled: true
|
|
1051
|
+
|
|
1052
|
+
# Orchestration strategy
|
|
1053
|
+
default_pattern: "sequential_with_gates" # or "parallel" or "adaptive"
|
|
1054
|
+
|
|
1055
|
+
# Quality gates
|
|
1056
|
+
require_user_approval:
|
|
1057
|
+
- architecture_decisions
|
|
1058
|
+
- deployment_to_production
|
|
1059
|
+
|
|
1060
|
+
require_automated_approval:
|
|
1061
|
+
- test_coverage: ">80%"
|
|
1062
|
+
- security_scan: "no_critical"
|
|
1063
|
+
|
|
1064
|
+
# Agent preferences
|
|
1065
|
+
preferred_backend: "nodejs-backend" # or python-backend, dotnet-backend
|
|
1066
|
+
preferred_frontend: "frontend-agent"
|
|
1067
|
+
|
|
1068
|
+
# Timeouts
|
|
1069
|
+
phase_timeout_minutes: 30
|
|
1070
|
+
total_timeout_hours: 8
|
|
1071
|
+
|
|
1072
|
+
# Monitoring
|
|
1073
|
+
progress_updates_interval: "5min"
|
|
1074
|
+
store_metrics: true
|
|
1075
|
+
```
|
|
1076
|
+
|
|
1077
|
+
## Testing
|
|
1078
|
+
|
|
1079
|
+
### Test Cases
|
|
1080
|
+
|
|
1081
|
+
**TC-001: Simple Product Development**
|
|
1082
|
+
- Given: User requests "Build a todo app"
|
|
1083
|
+
- When: role-orchestrator analyzes request
|
|
1084
|
+
- Then: Invokes PM → Architect → Backend → Frontend → QA → DevOps
|
|
1085
|
+
- And: All phases complete successfully
|
|
1086
|
+
|
|
1087
|
+
**TC-002: Parallel Execution**
|
|
1088
|
+
- Given: User requests "Implement payment feature"
|
|
1089
|
+
- When: Implementation phase starts
|
|
1090
|
+
- Then: Backend and Frontend agents run in parallel
|
|
1091
|
+
- And: Both complete without conflicts
|
|
1092
|
+
|
|
1093
|
+
**TC-003: Quality Gate Failure**
|
|
1094
|
+
- Given: Test coverage is 65% (target: >80%)
|
|
1095
|
+
- When: QA gate evaluates
|
|
1096
|
+
- Then: Gate fails, blocks deployment
|
|
1097
|
+
- And: Routes to QA Lead for analysis
|
|
1098
|
+
|
|
1099
|
+
**TC-004: Security Gate**
|
|
1100
|
+
- Given: Security review finds critical vulnerability
|
|
1101
|
+
- When: Security gate evaluates
|
|
1102
|
+
- Then: Blocks deployment
|
|
1103
|
+
- And: Creates work items for security fixes
|
|
1104
|
+
|
|
1105
|
+
**TC-005: Brownfield Integration**
|
|
1106
|
+
- Given: Existing codebase needs new feature
|
|
1107
|
+
- When: role-orchestrator receives request
|
|
1108
|
+
- Then: Starts with Tech Lead analysis
|
|
1109
|
+
- And: Creates regression tests before modification
|
|
1110
|
+
|
|
1111
|
+
## Best Practices
|
|
1112
|
+
|
|
1113
|
+
### 1. Clear Phase Boundaries
|
|
1114
|
+
|
|
1115
|
+
Each phase should have:
|
|
1116
|
+
- Clear inputs
|
|
1117
|
+
- Clear outputs
|
|
1118
|
+
- Success criteria
|
|
1119
|
+
- Failure handling
|
|
1120
|
+
|
|
1121
|
+
### 2. Explicit Dependencies
|
|
1122
|
+
|
|
1123
|
+
Always declare:
|
|
1124
|
+
- Which phases depend on which
|
|
1125
|
+
- What artifacts are required
|
|
1126
|
+
- What approvals are needed
|
|
1127
|
+
|
|
1128
|
+
### 3. Quality Gates at Key Points
|
|
1129
|
+
|
|
1130
|
+
Insert gates:
|
|
1131
|
+
- After architecture decisions
|
|
1132
|
+
- Before implementation
|
|
1133
|
+
- After implementation (tests)
|
|
1134
|
+
- Before deployment
|
|
1135
|
+
|
|
1136
|
+
### 4. User Visibility
|
|
1137
|
+
|
|
1138
|
+
Keep users informed:
|
|
1139
|
+
- Show current phase
|
|
1140
|
+
- Display progress percentage
|
|
1141
|
+
- Estimate time remaining
|
|
1142
|
+
- Highlight blockers
|
|
1143
|
+
|
|
1144
|
+
### 5. Graceful Degradation
|
|
1145
|
+
|
|
1146
|
+
If an agent fails:
|
|
1147
|
+
- Retry with backoff
|
|
1148
|
+
- Try fallback agent
|
|
1149
|
+
- If critical, pause and notify user
|
|
1150
|
+
- Don't fail silently
|
|
1151
|
+
|
|
1152
|
+
## Resources
|
|
1153
|
+
|
|
1154
|
+
### Multi-Agent Systems Research
|
|
1155
|
+
- [Microsoft Autogen](https://microsoft.github.io/autogen/) - Multi-agent conversation framework
|
|
1156
|
+
- [LangGraph Multi-Agent](https://blog.langchain.com/langgraph-multi-agent-workflows/) - LangChain's orchestration
|
|
1157
|
+
- [CrewAI](https://www.crewai.io/) - Role-based agent collaboration
|
|
1158
|
+
- [Amazon Bedrock Multi-Agent](https://aws.amazon.com/blogs/machine-learning/design-multi-agent-orchestration-with-reasoning-using-amazon-bedrock-and-open-source-frameworks/) - AWS multi-agent patterns
|
|
1159
|
+
|
|
1160
|
+
### Orchestration Patterns
|
|
1161
|
+
- [Azure AI Agent Patterns](https://learn.microsoft.com/en-us/azure/architecture/ai-ml/guide/ai-agent-design-patterns) - Microsoft's agent design patterns
|
|
1162
|
+
- [Orchestrator-Worker Pattern](https://www.confluent.io/blog/event-driven-multi-agent-systems/) - Event-driven multi-agent systems
|
|
1163
|
+
|
|
1164
|
+
### Quality Gates
|
|
1165
|
+
- [Shift-Left Testing](https://www.atlassian.com/continuous-delivery/software-testing/shift-left-testing) - Early quality gates
|
|
1166
|
+
- [DORA Metrics](https://cloud.google.com/blog/products/devops-sre/using-the-four-keys-to-measure-your-devops-performance) - Deployment quality metrics
|
|
1167
|
+
|
|
1168
|
+
---
|
|
1169
|
+
|
|
1170
|
+
## Summary
|
|
1171
|
+
|
|
1172
|
+
The **role-orchestrator** skill is the **central nervous system** of SpecWeave's multi-agent architecture:
|
|
1173
|
+
|
|
1174
|
+
✅ Coordinates 10+ specialized agents
|
|
1175
|
+
✅ Implements hierarchical orchestrator-worker pattern
|
|
1176
|
+
✅ Supports sequential, parallel, and adaptive workflows
|
|
1177
|
+
✅ Enforces quality gates at critical points
|
|
1178
|
+
✅ Provides real-time progress tracking
|
|
1179
|
+
✅ Handles failures gracefully with retry and fallback
|
|
1180
|
+
✅ Enables complex product development with AI agents
|
|
1181
|
+
|
|
1182
|
+
**User benefit**: Submit complex requests like "Build a SaaS" and watch multiple AI agents collaborate seamlessly to deliver the complete solution, from requirements to deployment.
|
|
1183
|
+
|
|
1184
|
+
This is the **factory of agents** that makes SpecWeave a true AI-powered development framework.
|