agentic-sdlc 1.0.0 → 1.5.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/.agent/ide-integration/INTEGRATION-SUMMARY.md +309 -0
- package/.agent/ide-integration/KIRO-IDE.md +381 -0
- package/.agent/ide-integration/README.md +256 -209
- package/.agent/knowledge-base/AUTO-LEARNING-GUIDE.md +327 -0
- package/.agent/knowledge-base/HOW-IT-WORKS.md +365 -0
- package/.agent/knowledge-base/INDEX.md +43 -0
- package/.agent/knowledge-base/README.md +47 -7
- package/.agent/knowledge-base/architecture/KB-2026-01-01-003-neo4j-graph-database-skills.md +1146 -0
- package/.agent/knowledge-base/architecture/README.md +98 -0
- package/.agent/knowledge-base/bugs/KB-2026-01-02-yaml-special-character-escaping.md +56 -0
- package/.agent/knowledge-base/bugs/medium/KB-2026-01-01-001-example-auto-learned.md +198 -0
- package/.agent/knowledge-base/features/KB-2026-01-01-001-landing-page-design-trends-2026.md +646 -0
- package/.agent/knowledge-base/features/KB-2026-01-01-004-uiux-design-skills-2026.md +945 -0
- package/.agent/knowledge-base/features/KB-2026-01-01-005-modern-ai-landing-page-ui.md +310 -0
- package/.agent/knowledge-base/features/KB-2026-01-01-006-award-winning-landing-page-patterns.md +324 -0
- package/.agent/knowledge-base/features/KB-2026-01-02-001-cleanup-workflow.md +242 -0
- package/.agent/knowledge-base/features/KB-2026-01-02-002-landing-page-monorepo-architecture.md +148 -0
- package/.agent/knowledge-base/features/KB-2026-01-02-003-premium-glassmorphism-patterns.md +58 -0
- package/.agent/knowledge-base/features/KB-2026-01-04-ai-agent-enforcement.md +46 -0
- package/.agent/knowledge-base/features/README.md +83 -0
- package/.agent/knowledge-base/features/figma-landing-page-workflow.md +311 -0
- package/.agent/knowledge-base/features/figma-mcp-sa-guide.md +673 -0
- package/.agent/knowledge-base/features/figma-mcp-uiux-guide.md +459 -0
- package/.agent/knowledge-base/performance/KB-2026-01-02-lazy-loading-optimization.md +80 -0
- package/.agent/knowledge-base/platform-specific/KB-2026-01-02-windows-console-encoding.md +56 -0
- package/.agent/knowledge-base/role-guides/DEV-KB-Guide.md +527 -0
- package/.agent/knowledge-base/role-guides/DEVOPS-KB-Guide.md +491 -0
- package/.agent/knowledge-base/role-guides/PM-KB-Guide.md +299 -0
- package/.agent/knowledge-base/role-guides/SECA-KB-Guide.md +555 -0
- package/.agent/knowledge-base/role-guides/TESTER-KB-Guide.md +519 -0
- package/.agent/knowledge-base/security/KB-2026-01-02-input-validation-sanitization.md +74 -0
- package/.agent/rules/AUTO-LEARNING.md +418 -0
- package/.agent/rules/ai-enforcement.md +11 -0
- package/.agent/rules/artifacts.md +77 -58
- package/.agent/rules/git-workflow.md +25 -65
- package/.agent/rules/global.md +18 -13
- package/.agent/skills/role-ba.md +76 -0
- package/.agent/skills/role-brain.md +470 -0
- package/.agent/skills/role-dev.md +338 -0
- package/.agent/skills/role-devops.md +122 -0
- package/.agent/skills/role-orchestrator.md +223 -0
- package/.agent/skills/role-pm.md +258 -0
- package/.agent/skills/role-po.md +237 -0
- package/.agent/skills/role-qa.md +81 -0
- package/.agent/skills/role-reporter.md +117 -0
- package/.agent/skills/role-sa.md +277 -0
- package/.agent/skills/role-seca.md +294 -0
- package/.agent/skills/role-stakeholder.md +105 -0
- package/.agent/skills/role-tester.md +294 -0
- package/.agent/skills/role-uiux.md +264 -0
- package/.agent/templates/CHANGELOG-Template.md +83 -0
- package/.agent/templates/Knowledge-Entry-Template.md +3 -0
- package/.agent/workflows/brain.md +84 -53
- package/.agent/workflows/compound.md +51 -0
- package/.agent/workflows/cycle.md +61 -0
- package/.agent/workflows/emergency.md +114 -0
- package/.agent/workflows/explore.md +147 -0
- package/.agent/workflows/housekeeping.md +105 -0
- package/.agent/workflows/metrics.md +179 -0
- package/.agent/workflows/orchestrator.md +68 -0
- package/.agent/workflows/preflight.md +35 -0
- package/.agent/workflows/release.md +153 -0
- package/.agent/workflows/route.md +160 -0
- package/.agent/workflows/sprint.md +125 -0
- package/.agent/workflows/validate.md +146 -0
- package/CHANGELOG.md +349 -6
- package/README.md +171 -86
- package/bin/CROSS-PLATFORM-CLI.md +526 -0
- package/bin/README.md +525 -0
- package/bin/cli.js +65 -90
- package/bin/kb +34 -0
- package/bin/kb.bat +28 -0
- package/bin/kb_cli.py +226 -0
- package/bin/lib/README.md +411 -0
- package/bin/lib/__init__.py +7 -0
- package/bin/lib/__pycache__/kb_add.cpython-313.pyc +0 -0
- package/bin/lib/__pycache__/kb_common.cpython-313.pyc +0 -0
- package/bin/lib/__pycache__/kb_compound.cpython-313.pyc +0 -0
- package/bin/lib/__pycache__/kb_index.cpython-313.pyc +0 -0
- package/bin/lib/__pycache__/kb_list.cpython-313.pyc +0 -0
- package/bin/lib/__pycache__/kb_search.cpython-313.pyc +0 -0
- package/bin/lib/__pycache__/kb_stats.cpython-313.pyc +0 -0
- package/bin/lib/kb_add.py +203 -0
- package/bin/lib/kb_common.py +224 -0
- package/bin/lib/kb_compound.py +250 -0
- package/bin/lib/kb_index.py +193 -0
- package/bin/lib/kb_list.py +144 -0
- package/bin/lib/kb_search.py +121 -0
- package/bin/lib/kb_stats.py +153 -0
- package/docs/AGENT-MANAGEMENT-GUIDE.md +298 -0
- package/docs/ARCHITECTURE-OVERVIEW.md +350 -0
- package/docs/BRAIN-ARCHITECTURE.md +396 -0
- package/docs/COMPOUND-ENGINEERING-SETUP.md +326 -0
- package/docs/KNOWLEDGE-BASE-GUIDE.md +330 -0
- package/docs/KNOWLEDGE-BASE-SIMPLE.md +248 -0
- package/docs/MONOREPO-ARCHITECTURE.md +492 -0
- package/docs/PROJECT-DOCUMENTATION-INDEX.md +540 -0
- package/docs/SDLC-Diagram.md +235 -0
- package/docs/analysis/Workflow-Optimization-Diagram.md +524 -0
- package/docs/analysis/Workflows-Deep-Analysis-2026-01-03.md +604 -0
- package/docs/architecture/{brain.md → BRAIN.md} +1 -1
- package/docs/global/Master-Documentation.md +307 -0
- package/docs/global/reports/Final-Approval-Report.md +257 -0
- package/docs/guides/AUTO-LEARNING-COMPLETE-GUIDE.md +519 -0
- package/docs/guides/AUTO-LEARNING-SYSTEM.md +322 -0
- package/docs/guides/LEARNING-FLOW.md +0 -0
- package/docs/guides/MCP-QUICK-REFERENCE.md +104 -0
- package/docs/guides/MCP-SETUP.md +139 -0
- package/docs/guides/QUICK-START.md +4 -0
- package/docs/guides/ROLE-COMMUNICATION-SYSTEM.md +71 -0
- package/docs/reports/Metrics-Dashboard-2026-01-02.md +66 -0
- package/docs/reports/Metrics-Dashboard-2026-01-04.md +68 -0
- package/docs/reports/UIUX-Design-Skills-Research-Report-2026.md +91 -0
- package/docs/reports/Validation-Report-2026-01-04.md +23 -0
- package/docs/research-reports/research-20260103-101315.json +95 -0
- package/docs/research-reports/research-20260103-101315.md +78 -0
- package/docs/research-reports/research-20260103-183837.json +95 -0
- package/docs/research-reports/research-20260103-183837.md +78 -0
- package/docs/research-reports/research-20260103-190346.json +100 -0
- package/docs/research-reports/research-20260103-190346.md +83 -0
- package/docs/setup/{github-management.md → GITHUB-MANAGEMENT.md} +1 -1
- package/docs/setup/RESEARCH-AGENT-SETUP.md +575 -0
- package/docs/sprints/{sprint-github-issues.md → SPRINT-GITHUB-ISSUES.md} +1 -1
- package/docs/sprints/{sprint-leann-integration.md → SPRINT-LEANN-INTEGRATION.md} +1 -1
- package/docs/sprints/sprint-1/designs/Backend-Design-Spec-Sprint-1-v1.md +1206 -0
- package/docs/sprints/sprint-1/designs/System-Design-Spec-Sprint-1-v1.md +439 -0
- package/docs/sprints/sprint-1/designs/System-Design-Spec-v1.0.md +425 -0
- package/docs/sprints/sprint-1/designs/UIUX-Design-Spec-Sprint-1-v1.md +55 -0
- package/docs/sprints/sprint-1/designs/UIUX-Design-Spec-v1.0.md +644 -0
- package/docs/sprints/sprint-1/logs/DevOps-Plan-and-Log-Sprint-1-v1.md +253 -0
- package/docs/sprints/sprint-1/logs/Development-Log-Phase1.md +433 -0
- package/docs/sprints/sprint-1/logs/Development-Log-Sprint-1-v1.md +181 -0
- package/docs/sprints/sprint-1/logs/Development-Log-Sprint-1.md +548 -0
- package/docs/sprints/sprint-1/logs/Orchestration-Log-Sprint-1.md +46 -0
- package/docs/sprints/sprint-1/logs/Phase1-Summary.md +84 -0
- package/docs/sprints/sprint-1/plans/Product-Backlog-Sprint-1-v1.md +40 -0
- package/docs/sprints/sprint-1/plans/Product-Backlog-v1.0.md +613 -0
- package/docs/sprints/sprint-1/plans/Project-Plan-Sprint-1-v1.0.md +210 -0
- package/docs/sprints/sprint-1/plans/Project-Plan-Sprint-1-v1.md +377 -0
- package/docs/sprints/sprint-1/reports/Design-Verification-Report-v1.0.md +220 -0
- package/docs/sprints/sprint-1/reports/Phase-Report-Sprint-1-v1.md +238 -0
- package/docs/sprints/sprint-1/reports/Security-Review-Report-v1.0.md +285 -0
- package/docs/sprints/sprint-1/reports/Sprint-Report-Sprint-1.md +74 -0
- package/docs/sprints/sprint-1/reports/Test-Report-v1.0.md +346 -0
- package/docs/sprints/sprint-1/reviews/Design-Verification-Report.md +508 -0
- package/docs/sprints/sprint-1/reviews/Security-Review-Report.md +589 -0
- package/docs/sprints/sprint-1/sprint-current/logs/WORKFLOW-CLEANUP-FINAL.md +121 -0
- package/docs/sprints/sprint-1/sprint-current/logs/WORKFLOW-OPTIMIZATION-COMPLETE.md +224 -0
- package/docs/sprints/sprint-1/sprint-current/logs/Workflow-Optimization-Progress.md +310 -0
- package/docs/sprints/sprint-1/sprint-current/logs/Workflow-Optimization-Session-Summary.md +420 -0
- package/docs/sprints/sprint-1/sprint-current/plans/Workflow-Optimization-Implementation-Plan.md +1124 -0
- package/docs/sprints/sprint-2/SPRINT-SUMMARY.md +150 -0
- package/docs/sprints/sprint-2/designs/UIUX-Design-Spec-Sprint-2-v1.md +352 -0
- package/docs/sprints/sprint-2/logs/Development-Log-Sprint-2-v1.md +293 -0
- package/docs/sprints/sprint-2/plans/Product-Backlog-Sprint-2-v1.md +62 -0
- package/docs/sprints/sprint-2/plans/Project-Plan-Sprint-2-v1.md +228 -0
- package/docs/sprints/sprint-2/reports/Phase-Report-Sprint-2-v1.md +303 -0
- package/docs/sprints/sprint-3/designs/UIUX-Design-Spec-Sprint-3-v1.md +160 -0
- package/docs/sprints/sprint-3/logs/Development-Log-Sprint-3-v1.md +249 -0
- package/docs/sprints/sprint-3/logs/Testing-Report-Sprint-3-v1.md +244 -0
- package/docs/sprints/sprint-3/plans/Product-Backlog-Sprint-3-v1.md +95 -0
- package/docs/sprints/sprint-3/reports/Final-Approval-Report-Sprint-3-v1.md +299 -0
- package/docs/sprints/sprint-3/reports/Sprint-Summary-Sprint-3-v1.md +276 -0
- package/docs/sprints/sprint-3/reviews/Design-Verification-Report-Sprint-3-v1.md +122 -0
- package/docs/sprints/sprint-3/reviews/Security-Review-Report-Sprint-3-v1.md +67 -0
- package/docs/sprints/sprint-5/designs/Backend-Design-Spec-Sprint-5-v1.md +1734 -0
- package/docs/sprints/sprint-5/designs/Design-Verification-Report.md +101 -0
- package/docs/sprints/sprint-5/designs/Security-Review-Report.md +84 -0
- package/docs/sprints/sprint-6/.brain-state.json +29 -0
- package/package.json +92 -16
- package/.agent/ide-integration/aider-commands.md +0 -40
- package/.agent/ide-integration/cline-config.json +0 -108
- package/.agent/ide-integration/cursor-rules.md +0 -63
- package/.agent/ide-integration/github-copilot-instructions.md +0 -75
- package/.agent/ide-integration/vscode-commands.json +0 -190
- package/.agent/ide-integration/windsurf-cascade.md +0 -125
- package/.agent/knowledge-base/index.md +0 -202
- package/.agent/legacy/roles/designer.md +0 -311
- package/.agent/legacy/roles/dev.md +0 -177
- package/.agent/legacy/roles/devops.md +0 -146
- package/.agent/legacy/roles/orchestrator.md +0 -339
- package/.agent/legacy/roles/pm.md +0 -120
- package/.agent/legacy/roles/po.md +0 -89
- package/.agent/legacy/roles/qa.md +0 -108
- package/.agent/legacy/roles/reporter.md +0 -70
- package/.agent/legacy/roles/sa.md +0 -118
- package/.agent/legacy/roles/seca.md +0 -112
- package/.agent/legacy/roles/stakeholder.md +0 -111
- package/.agent/legacy/roles/tester.md +0 -129
- package/.agent/rules/global.md.bak +0 -154
- package/.agent/usage.md +0 -653
- package/.agent/workflows/auto.md +0 -35
- package/.agent/workflows/dev.md +0 -30
- package/.agent/workflows/devops.md +0 -28
- package/.agent/workflows/kb-search.md +0 -22
- package/.agent/workflows/pm.md +0 -42
- package/.agent/workflows/po.md +0 -21
- package/.agent/workflows/qa.md +0 -31
- package/.agent/workflows/reporter.md +0 -21
- package/.agent/workflows/sa.md +0 -51
- package/.agent/workflows/seca.md +0 -21
- package/.agent/workflows/stakeholder.md +0 -26
- package/.agent/workflows/tester.md +0 -21
- package/.agent/workflows/uiux.md +0 -38
- package/.cursorrules +0 -49
- package/.env.template +0 -10
- package/.github/ISSUE_TEMPLATE/bug_report.yml +0 -47
- package/.github/ISSUE_TEMPLATE/config.yml +0 -8
- package/.github/ISSUE_TEMPLATE/feature_request.yml +0 -33
- package/.github/ISSUE_TEMPLATE/security_alert.yml +0 -28
- package/.github/ISSUE_TEMPLATE/task_implementation.yml +0 -37
- package/.github/copilot-instructions.md +0 -60
- package/bin/commands/create.js +0 -96
- package/bin/commands/help.js +0 -69
- package/bin/commands/ide.js +0 -116
- package/bin/commands/init-kb.js +0 -74
- package/bin/commands/install.js +0 -68
- package/bin/commands/list.js +0 -35
- package/bin/graph_brain.py +0 -86
- package/bin/sync_github.py +0 -75
- package/bin/utils/args-parser.js +0 -33
- package/bin/utils/colors.js +0 -21
- package/bin/verify_neo4j.py +0 -25
- /package/.agent/rules/{knowledge-base.md → KNOWLEDGE-BASE.md} +0 -0
- /package/docs/architecture/{neo4j-learning-queries.md → NEO4J-LEARNING-QUERIES.md} +0 -0
- /package/docs/reports/{comparison-leann-neo4j.md → COMPARISON-LEANN-NEO4J.md} +0 -0
- /package/docs/sprints/{sprint-neo4j-brain.md → SPRINT-NEO4J-BRAIN.md} +0 -0
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
# BRAIN Architecture - Master Orchestrator
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The **BRAIN** is the root-level master controller that manages all workflow execution with strict adherence to the SDLC diagram. It acts as a state machine that enforces workflow rules, validates transitions, and orchestrates all roles.
|
|
6
|
+
|
|
7
|
+
## Architecture Diagram
|
|
8
|
+
|
|
9
|
+
```mermaid
|
|
10
|
+
graph TB
|
|
11
|
+
User([User]) <--> Brain{{"🧠 BRAIN<br/>Master Orchestrator"}}
|
|
12
|
+
|
|
13
|
+
Brain --> StateMachine["State Machine<br/>12 States + Transitions"]
|
|
14
|
+
Brain --> Validator["Validation Engine<br/>Prerequisites & Artifacts"]
|
|
15
|
+
Brain --> Enforcer["Rule Enforcer<br/>No Skip, No Scope Creep"]
|
|
16
|
+
Brain --> Monitor["Monitor & Metrics<br/>Progress Tracking"]
|
|
17
|
+
|
|
18
|
+
StateMachine --> State1["IDLE"]
|
|
19
|
+
StateMachine --> State2["PLANNING"]
|
|
20
|
+
StateMachine --> State3["PLAN_APPROVAL"]
|
|
21
|
+
StateMachine --> State4["DESIGNING"]
|
|
22
|
+
StateMachine --> State5["DESIGN_REVIEW"]
|
|
23
|
+
StateMachine --> State6["DEVELOPMENT"]
|
|
24
|
+
StateMachine --> State7["TESTING"]
|
|
25
|
+
StateMachine --> State8["BUG_FIXING"]
|
|
26
|
+
StateMachine --> State9["DEPLOYMENT"]
|
|
27
|
+
StateMachine --> State10["REPORTING"]
|
|
28
|
+
StateMachine --> State11["FINAL_REVIEW"]
|
|
29
|
+
StateMachine --> State12["FINAL_APPROVAL"]
|
|
30
|
+
StateMachine --> State13["COMPLETE"]
|
|
31
|
+
|
|
32
|
+
Brain --> RoleOrch["Role Orchestrator"]
|
|
33
|
+
RoleOrch --> PM["@PM"]
|
|
34
|
+
RoleOrch --> SA["@SA"]
|
|
35
|
+
RoleOrch --> UIUX["@UIUX"]
|
|
36
|
+
RoleOrch --> PO["@PO"]
|
|
37
|
+
RoleOrch --> QA["@QA"]
|
|
38
|
+
RoleOrch --> SECA["@SECA"]
|
|
39
|
+
RoleOrch --> DEV["@DEV"]
|
|
40
|
+
RoleOrch --> DEVOPS["@DEVOPS"]
|
|
41
|
+
RoleOrch --> TESTER["@TESTER"]
|
|
42
|
+
RoleOrch --> REPORTER["@REPORTER"]
|
|
43
|
+
RoleOrch --> STAKEHOLDER["@STAKEHOLDER"]
|
|
44
|
+
|
|
45
|
+
Brain --> Storage[("State Storage<br/>.brain-state.json")]
|
|
46
|
+
Brain --> Diagram[("SDLC Diagram<br/>docs/SDLC-Diagram.md")]
|
|
47
|
+
Brain --> KB[("Knowledge Base<br/>.agent/knowledge-base/")]
|
|
48
|
+
|
|
49
|
+
style Brain fill:#ff6b6b,stroke:#c92a2a,stroke-width:4px,color:#fff
|
|
50
|
+
style StateMachine fill:#4ecdc4,stroke:#0a9396,stroke-width:2px,color:#000
|
|
51
|
+
style Validator fill:#ffe66d,stroke:#f4a261,stroke-width:2px,color:#000
|
|
52
|
+
style Enforcer fill:#ff6b6b,stroke:#c92a2a,stroke-width:2px,color:#000
|
|
53
|
+
style Monitor fill:#95e1d3,stroke:#38a3a5,stroke-width:2px,color:#000
|
|
54
|
+
style RoleOrch fill:#a8dadc,stroke:#457b9d,stroke-width:2px,color:#000
|
|
55
|
+
style Storage fill:#e1bee7,stroke:#6a1b9a,stroke-width:2px,color:#000
|
|
56
|
+
style Diagram fill:#b3e5fc,stroke:#01579b,stroke-width:2px,color:#000
|
|
57
|
+
style KB fill:#c5e1a5,stroke:#558b2f,stroke-width:2px,color:#000
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## State Machine Flow
|
|
61
|
+
|
|
62
|
+
```mermaid
|
|
63
|
+
stateDiagram-v2
|
|
64
|
+
[*] --> IDLE
|
|
65
|
+
IDLE --> PLANNING: User provides requirements
|
|
66
|
+
|
|
67
|
+
PLANNING --> PLAN_APPROVAL: PM completes plan
|
|
68
|
+
PLAN_APPROVAL --> DESIGNING: User approves
|
|
69
|
+
PLAN_APPROVAL --> PLANNING: User rejects
|
|
70
|
+
|
|
71
|
+
DESIGNING --> DESIGN_REVIEW: All designs complete
|
|
72
|
+
DESIGN_REVIEW --> DEVELOPMENT: QA+SECA approve
|
|
73
|
+
DESIGN_REVIEW --> DESIGNING: Issues found
|
|
74
|
+
|
|
75
|
+
DEVELOPMENT --> TESTING: Dev+DevOps complete
|
|
76
|
+
TESTING --> BUG_FIXING: Critical/High bugs found
|
|
77
|
+
TESTING --> DEPLOYMENT: No critical bugs
|
|
78
|
+
|
|
79
|
+
BUG_FIXING --> TESTING: Bugs fixed
|
|
80
|
+
|
|
81
|
+
DEPLOYMENT --> REPORTING: Production deployed
|
|
82
|
+
REPORTING --> FINAL_REVIEW: Report complete
|
|
83
|
+
FINAL_REVIEW --> FINAL_APPROVAL: Stakeholder reviews
|
|
84
|
+
|
|
85
|
+
FINAL_APPROVAL --> COMPLETE: User approves
|
|
86
|
+
FINAL_APPROVAL --> PLANNING: User rejects
|
|
87
|
+
|
|
88
|
+
COMPLETE --> [*]
|
|
89
|
+
|
|
90
|
+
note right of PLAN_APPROVAL
|
|
91
|
+
🚪 Approval Gate 1
|
|
92
|
+
User decision required
|
|
93
|
+
end note
|
|
94
|
+
|
|
95
|
+
note right of DESIGN_REVIEW
|
|
96
|
+
Parallel: QA + SECA
|
|
97
|
+
Both must approve
|
|
98
|
+
end note
|
|
99
|
+
|
|
100
|
+
note right of FINAL_APPROVAL
|
|
101
|
+
🚪 Approval Gate 3
|
|
102
|
+
User decision required
|
|
103
|
+
end note
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Component Architecture
|
|
107
|
+
|
|
108
|
+
### 1. State Machine
|
|
109
|
+
**Responsibility:** Manage workflow states and transitions
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
interface StateMachine {
|
|
113
|
+
currentState: WorkflowState;
|
|
114
|
+
previousState: WorkflowState;
|
|
115
|
+
stateHistory: StateTransition[];
|
|
116
|
+
|
|
117
|
+
canTransition(from: State, to: State): boolean;
|
|
118
|
+
transition(to: State): Result;
|
|
119
|
+
rollback(to: State): Result;
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### 2. Validation Engine
|
|
124
|
+
**Responsibility:** Validate prerequisites and artifacts
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
interface ValidationEngine {
|
|
128
|
+
validatePhaseCompletion(state: State): ValidationResult;
|
|
129
|
+
validateArtifacts(state: State): ArtifactCheck[];
|
|
130
|
+
validateRoleCompletion(state: State): RoleStatus[];
|
|
131
|
+
validateApprovalGate(gate: Gate): ApprovalStatus;
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 3. Rule Enforcer
|
|
136
|
+
**Responsibility:** Enforce workflow rules
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
interface RuleEnforcer {
|
|
140
|
+
enforceNoPhaseSkip(transition: Transition): boolean;
|
|
141
|
+
enforceApprovalGate(gate: Gate): boolean;
|
|
142
|
+
enforceScopeControl(feature: Feature): boolean;
|
|
143
|
+
enforceParallelCompletion(roles: Role[]): boolean;
|
|
144
|
+
enforceBugPriority(bugs: Bug[]): boolean;
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### 4. Role Orchestrator
|
|
149
|
+
**Responsibility:** Manage role activation and coordination
|
|
150
|
+
|
|
151
|
+
```typescript
|
|
152
|
+
interface RoleOrchestrator {
|
|
153
|
+
activateRole(role: Role, context: Context): void;
|
|
154
|
+
activateParallel(roles: Role[]): void;
|
|
155
|
+
waitForCompletion(roles: Role[]): Promise<void>;
|
|
156
|
+
notifyNextRole(role: Role, message: string): void;
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### 5. Monitor & Metrics
|
|
161
|
+
**Responsibility:** Track progress and performance
|
|
162
|
+
|
|
163
|
+
```typescript
|
|
164
|
+
interface Monitor {
|
|
165
|
+
trackPhaseTime(state: State): Duration;
|
|
166
|
+
trackApprovalGates(): GateMetrics;
|
|
167
|
+
trackIterations(): IterationCount;
|
|
168
|
+
trackEfficiency(): EfficiencyMetrics;
|
|
169
|
+
generateReport(): MetricsReport;
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### 6. Communication Layer
|
|
174
|
+
**Responsibility:** Persist role-to-role context and "thoughts" via Chat System.
|
|
175
|
+
|
|
176
|
+
```typescript
|
|
177
|
+
interface ChatSystem {
|
|
178
|
+
channel: string; // e.g., "general"
|
|
179
|
+
thread: string; // e.g., "Feature-X"
|
|
180
|
+
|
|
181
|
+
sendMessage(role: Role, content: string): void;
|
|
182
|
+
getHistory(limit: number): Message[];
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Data Flow
|
|
188
|
+
|
|
189
|
+
```mermaid
|
|
190
|
+
sequenceDiagram
|
|
191
|
+
participant User
|
|
192
|
+
participant Brain
|
|
193
|
+
participant StateMachine
|
|
194
|
+
participant Validator
|
|
195
|
+
participant Enforcer
|
|
196
|
+
participant Role
|
|
197
|
+
participant Storage
|
|
198
|
+
|
|
199
|
+
User->>Brain: Provide requirements
|
|
200
|
+
Brain->>StateMachine: Check current state (IDLE)
|
|
201
|
+
StateMachine-->>Brain: State: IDLE
|
|
202
|
+
|
|
203
|
+
Brain->>Enforcer: Can start PLANNING?
|
|
204
|
+
Enforcer-->>Brain: Yes, requirements valid
|
|
205
|
+
|
|
206
|
+
Brain->>StateMachine: Transition to PLANNING
|
|
207
|
+
StateMachine->>Storage: Save state
|
|
208
|
+
|
|
209
|
+
Brain->>Role: Activate @PM
|
|
210
|
+
Role->>Role: Create project plan
|
|
211
|
+
Role-->>Brain: Plan complete
|
|
212
|
+
|
|
213
|
+
Brain->>Validator: Validate plan artifacts
|
|
214
|
+
Validator-->>Brain: Validation passed
|
|
215
|
+
|
|
216
|
+
Brain->>StateMachine: Transition to PLAN_APPROVAL
|
|
217
|
+
StateMachine->>Storage: Save state
|
|
218
|
+
|
|
219
|
+
Brain->>User: Request approval
|
|
220
|
+
User-->>Brain: Approved
|
|
221
|
+
|
|
222
|
+
Brain->>Enforcer: Can proceed to DESIGNING?
|
|
223
|
+
Enforcer-->>Brain: Yes, approval received
|
|
224
|
+
|
|
225
|
+
Brain->>StateMachine: Transition to DESIGNING
|
|
226
|
+
Brain->>Role: Activate @SA + @UIUX + @PO (parallel)
|
|
227
|
+
|
|
228
|
+
Note over Brain,Role: Workflow continues...
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Command Interface
|
|
232
|
+
|
|
233
|
+
### Status Command
|
|
234
|
+
```
|
|
235
|
+
@BRAIN /status
|
|
236
|
+
```
|
|
237
|
+
Shows current state, progress, and next steps.
|
|
238
|
+
|
|
239
|
+
### Validation Command
|
|
240
|
+
```
|
|
241
|
+
@BRAIN /validate
|
|
242
|
+
```
|
|
243
|
+
Validates current phase completion and readiness for transition.
|
|
244
|
+
|
|
245
|
+
### Auto-Execute Command
|
|
246
|
+
```
|
|
247
|
+
@BRAIN /auto-execute
|
|
248
|
+
```
|
|
249
|
+
Runs full workflow with automatic role orchestration.
|
|
250
|
+
|
|
251
|
+
### Force Transition (Emergency)
|
|
252
|
+
```
|
|
253
|
+
@BRAIN /force-transition [REASON]
|
|
254
|
+
```
|
|
255
|
+
Bypasses validation (logged, requires user confirmation).
|
|
256
|
+
|
|
257
|
+
### Rollback Command
|
|
258
|
+
```
|
|
259
|
+
@BRAIN /rollback [STATE]
|
|
260
|
+
```
|
|
261
|
+
Rolls back to previous state (requires user confirmation).
|
|
262
|
+
|
|
263
|
+
## Integration Points
|
|
264
|
+
|
|
265
|
+
### With Existing Roles
|
|
266
|
+
- BRAIN activates roles at appropriate phases
|
|
267
|
+
- Roles report completion to BRAIN
|
|
268
|
+
- BRAIN validates role outputs before transition
|
|
269
|
+
|
|
270
|
+
### With Enhanced Workflows
|
|
271
|
+
- `/cycle` - Managed as mini-workflow within current state
|
|
272
|
+
- `/explore` - Pauses main workflow for investigation
|
|
273
|
+
- `/emergency` - Overrides normal flow with logging
|
|
274
|
+
- `/compound` - Triggered automatically for learnings
|
|
275
|
+
|
|
276
|
+
### With Knowledge Base
|
|
277
|
+
- BRAIN logs all state transitions
|
|
278
|
+
- Documents approval decisions
|
|
279
|
+
- Records validation failures
|
|
280
|
+
- Compounds workflow patterns
|
|
281
|
+
|
|
282
|
+
## Error Handling
|
|
283
|
+
|
|
284
|
+
### Validation Failure
|
|
285
|
+
```
|
|
286
|
+
1. Block transition
|
|
287
|
+
2. Log failure reason
|
|
288
|
+
3. Notify responsible role
|
|
289
|
+
4. Wait for fix
|
|
290
|
+
5. Re-validate
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### Role Failure
|
|
294
|
+
```
|
|
295
|
+
1. Keep current state
|
|
296
|
+
2. Log error details
|
|
297
|
+
3. Notify role with error
|
|
298
|
+
4. Provide recovery guidance
|
|
299
|
+
5. Wait for completion
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### Approval Rejection
|
|
303
|
+
```
|
|
304
|
+
1. Rollback to PLANNING
|
|
305
|
+
2. Create new plan version
|
|
306
|
+
3. Document rejection reason
|
|
307
|
+
4. Notify PM
|
|
308
|
+
5. Restart workflow
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## State Persistence
|
|
312
|
+
|
|
313
|
+
State stored in: `docs/sprints/sprint-N/.brain-state.json`
|
|
314
|
+
|
|
315
|
+
```json
|
|
316
|
+
{
|
|
317
|
+
"sprint": "sprint-1",
|
|
318
|
+
"currentState": "DESIGNING",
|
|
319
|
+
"previousState": "PLAN_APPROVAL",
|
|
320
|
+
"stateHistory": [...],
|
|
321
|
+
"approvalGates": {...},
|
|
322
|
+
"artifacts": {...},
|
|
323
|
+
"roleStatus": {...},
|
|
324
|
+
"metrics": {...}
|
|
325
|
+
}
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
## Benefits
|
|
329
|
+
|
|
330
|
+
1. **Strict Enforcement** - No phase skipping or rule violations
|
|
331
|
+
2. **Complete Traceability** - Full history of all transitions
|
|
332
|
+
3. **Error Recovery** - Safe rollback and retry mechanisms
|
|
333
|
+
4. **Parallel Optimization** - Automatic parallel role execution
|
|
334
|
+
5. **Quality Gates** - Mandatory validation at each phase
|
|
335
|
+
6. **Metrics Tracking** - Complete workflow analytics
|
|
336
|
+
7. **Knowledge Compound** - Automatic learning capture
|
|
337
|
+
|
|
338
|
+
## Usage Example
|
|
339
|
+
|
|
340
|
+
```
|
|
341
|
+
User: @BRAIN - Build a todo app with React
|
|
342
|
+
|
|
343
|
+
🧠 BRAIN Initialized
|
|
344
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
345
|
+
State: IDLE → PLANNING
|
|
346
|
+
Action: Activating @PM
|
|
347
|
+
|
|
348
|
+
@PM - Create project plan for todo app with React
|
|
349
|
+
Expected: Project-Plan-v1.md in docs/sprints/sprint-1/plans/
|
|
350
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
351
|
+
|
|
352
|
+
[PM creates plan]
|
|
353
|
+
|
|
354
|
+
🧠 BRAIN Status Update
|
|
355
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
356
|
+
State: PLANNING → PLAN_APPROVAL
|
|
357
|
+
Validation: ✅ Project-Plan-v1.md exists
|
|
358
|
+
|
|
359
|
+
🚪 Approval Gate 1: Project Plan
|
|
360
|
+
Please review: docs/sprints/sprint-1/plans/Project-Plan-v1.md
|
|
361
|
+
|
|
362
|
+
Approve to proceed to DESIGNING phase.
|
|
363
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
364
|
+
|
|
365
|
+
User: Approved
|
|
366
|
+
|
|
367
|
+
🧠 BRAIN Status Update
|
|
368
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
369
|
+
State: PLAN_APPROVAL → DESIGNING
|
|
370
|
+
Action: Activating parallel roles
|
|
371
|
+
|
|
372
|
+
@SA - Create architecture spec
|
|
373
|
+
@UIUX - Create UI/UX spec
|
|
374
|
+
@PO - Create product backlog
|
|
375
|
+
|
|
376
|
+
Waiting for all roles to complete...
|
|
377
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
378
|
+
|
|
379
|
+
[Workflow continues through all phases...]
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
## Future Enhancements
|
|
383
|
+
|
|
384
|
+
1. **AI-Powered Predictions** - Predict phase durations
|
|
385
|
+
2. **Auto-Recovery** - Automatic error recovery strategies
|
|
386
|
+
3. **Workflow Templates** - Pre-configured workflows for common projects
|
|
387
|
+
4. **Real-time Dashboard** - Visual workflow progress
|
|
388
|
+
5. **Integration APIs** - External tool integration
|
|
389
|
+
6. **Custom Rules** - User-defined validation rules
|
|
390
|
+
|
|
391
|
+
---
|
|
392
|
+
|
|
393
|
+
**Version:** 1.0.0
|
|
394
|
+
**Created:** 2026-01-02
|
|
395
|
+
**Status:** Active
|
|
396
|
+
|