mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-23 21:59:14 +09:00
- Reorganize v3/ into implementation/ subfolders: - planning/, architecture/, migration/, integration/ - security/, adrs/, research/, swarm-plans/ - Add 15-agent concurrent swarm implementation plans: - SWARM-OVERVIEW.md: Hierarchical mesh topology, 4 phases - AGENT-SPECIFICATIONS.md: 15 agent configs with capabilities - TDD-LONDON-SCHOOL-PLAN.md: Mock-first TDD methodology - BENCHMARK-OPTIMIZATION.md: Performance targets (2.49x-7.47x) - DEPLOYMENT-PLAN.md: Release strategy, CI/CD, rollback - GITHUB-ISSUE-TRACKING.md: Issue workflow with agent replies - Update .claude/settings.json with proper hooks format - Add bash aliases for claude --dangerously-skip-permissions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
556 lines
15 KiB
Markdown
556 lines
15 KiB
Markdown
# Architecture Documentation - GitHub Workflows Optimization
|
||
|
||
**Comprehensive documentation for optimizing claude-code-flow GitHub Actions workflows**
|
||
|
||
---
|
||
|
||
## 📚 Document Index
|
||
|
||
This directory contains the complete architectural strategy for optimizing the GitHub Actions workflows in claude-code-flow. The documentation is organized into three main documents:
|
||
|
||
### 1. **Strategy Document** (Main Reference)
|
||
**File:** `github-workflows-optimization-strategy.md`
|
||
**Purpose:** Comprehensive architectural strategy and recommendations
|
||
**Audience:** Technical leads, architects, product managers
|
||
|
||
**Contains:**
|
||
- Executive summary with current state analysis
|
||
- Detailed optimization strategies for each workflow
|
||
- Architecture Decision Records (ADRs)
|
||
- Success metrics and ROI calculations
|
||
- Risk assessment and rollback plans
|
||
- Technical debt reduction plan
|
||
|
||
**Read this if you want to:**
|
||
- Understand the full scope of optimization
|
||
- Review architectural decisions
|
||
- Evaluate risks and benefits
|
||
- Get approval from stakeholders
|
||
|
||
### 2. **Implementation Guide** (Step-by-Step)
|
||
**File:** `workflow-optimization-implementation-guide.md`
|
||
**Purpose:** Practical implementation steps for developers
|
||
**Audience:** Developers, DevOps engineers
|
||
|
||
**Contains:**
|
||
- Quick start commands for each phase
|
||
- Copy-paste workflow configurations
|
||
- Testing and validation steps
|
||
- Troubleshooting common issues
|
||
- Success checklists
|
||
|
||
**Read this if you want to:**
|
||
- Actually implement the changes
|
||
- Know what commands to run
|
||
- Test workflows locally
|
||
- Debug workflow issues
|
||
|
||
### 3. **Architecture Diagrams** (Visual Reference)
|
||
**File:** `workflow-architecture-diagram.md`
|
||
**Purpose:** Visual representation of current vs. optimized architecture
|
||
**Audience:** All stakeholders
|
||
|
||
**Contains:**
|
||
- Before/after workflow structure diagrams
|
||
- Dependency flow visualizations
|
||
- Timeline comparisons
|
||
- Resource utilization charts
|
||
- Quality gates flow
|
||
|
||
**Read this if you want to:**
|
||
- Quickly understand the changes
|
||
- Present to non-technical stakeholders
|
||
- See visual before/after comparisons
|
||
- Understand workflow relationships
|
||
|
||
---
|
||
|
||
## 🎯 Quick Summary
|
||
|
||
### The Problem
|
||
|
||
**Current State:**
|
||
- ❌ 75% workflow failure rate (3 of 4 workflows failing)
|
||
- ❌ 880 lines of fake integration tests providing zero value
|
||
- ❌ Dangerous automated rollback with force pushes to main
|
||
- ❌ Duplicate workflows (ci.yml + test.yml)
|
||
- ❌ Over-engineered truth scoring (667 lines of redundancy)
|
||
- ⏱️ ~120 minutes of wasted compute time daily
|
||
- 💸 ~$60/month in unnecessary GitHub Actions costs
|
||
|
||
**Impact on Development:**
|
||
- Slow PR feedback (15+ minutes)
|
||
- False confidence from fake tests
|
||
- Confused developers (which workflow matters?)
|
||
- Blocked deployments from flaky tests
|
||
- Risk of accidental force pushes
|
||
|
||
### The Solution
|
||
|
||
**Optimized State:**
|
||
- ✅ >95% workflow success rate
|
||
- ✅ Real integration tests using actual CLI commands
|
||
- ✅ Safe notification-based failure handling
|
||
- ✅ Single consolidated CI pipeline
|
||
- ✅ Simple, maintainable workflow structure
|
||
- ⏱️ ~10 minutes of compute time daily (92% reduction)
|
||
- 💸 ~$20/month in GitHub Actions costs (67% savings)
|
||
|
||
**Developer Experience:**
|
||
- Fast PR feedback (5 minutes)
|
||
- Real test coverage catching real bugs
|
||
- Clear, simple workflow structure
|
||
- Reliable deployments
|
||
- Safe, human-controlled rollbacks
|
||
|
||
### Key Changes
|
||
|
||
| Area | Before | After | Improvement |
|
||
|------|--------|-------|-------------|
|
||
| **CI Duration** | 15 min | 5 min | **67% faster** |
|
||
| **Success Rate** | 25% | 95% | **87% better** |
|
||
| **Lines of Code** | ~2,500 | ~800 | **68% less** |
|
||
| **Active Workflows** | 7 | 4 | **43% fewer** |
|
||
| **Monthly Cost** | $90 | $30 | **$60 saved** |
|
||
| **Real Tests** | 0% | 100% | **Infinite% better** 😊 |
|
||
|
||
---
|
||
|
||
## 🚀 Getting Started
|
||
|
||
### For Decision Makers
|
||
|
||
1. **Read the Executive Summary** in `github-workflows-optimization-strategy.md` (pages 1-2)
|
||
2. **Review the Success Metrics** (page 15)
|
||
3. **Check the Risk Assessment** (page 16)
|
||
4. **Approve Phase 1 implementation**
|
||
|
||
**Time Investment:** 15 minutes
|
||
**Decision Required:** Approve Phase 1 changes
|
||
|
||
### For Implementers
|
||
|
||
1. **Skim the Strategy Document** to understand context
|
||
2. **Follow the Implementation Guide** step-by-step
|
||
3. **Use the Architecture Diagrams** for reference
|
||
4. **Complete Phase 1 checklist** before proceeding
|
||
|
||
**Time Investment:** 2-3 hours for Phase 1
|
||
**Skills Required:** Git, GitHub Actions, bash
|
||
|
||
### For Reviewers
|
||
|
||
1. **Review Architecture Diagrams** for visual overview
|
||
2. **Check ADRs in Strategy Document** for key decisions
|
||
3. **Verify Implementation Guide** matches strategy
|
||
4. **Provide feedback on risks/concerns**
|
||
|
||
**Time Investment:** 30 minutes
|
||
**Feedback Needed:** Concerns, suggestions, approval
|
||
|
||
---
|
||
|
||
## 📋 Implementation Phases
|
||
|
||
### Phase 1: Critical Fixes (Week 1) - **START HERE**
|
||
|
||
**Priority:** URGENT
|
||
**Risk:** LOW
|
||
**Impact:** HIGH
|
||
|
||
**Changes:**
|
||
1. Delete fake integration tests (integration-tests.yml)
|
||
2. Replace with real CLI-based tests
|
||
3. Replace rollback automation with notification
|
||
4. Remove duplicate test.yml
|
||
|
||
**Expected Outcome:**
|
||
- 40-50 minutes saved per CI run
|
||
- Elimination of 3 consistently failing workflows
|
||
- Safer codebase (no more automated force pushes)
|
||
|
||
**Commands:**
|
||
```bash
|
||
# See implementation guide for detailed steps
|
||
cd /workspaces/claude-code-flow
|
||
# Follow Phase 1 section in workflow-optimization-implementation-guide.md
|
||
```
|
||
|
||
### Phase 2: Consolidation (Week 2)
|
||
|
||
**Priority:** HIGH
|
||
**Risk:** MEDIUM
|
||
**Impact:** MEDIUM-HIGH
|
||
|
||
**Changes:**
|
||
1. Consolidate CI pipeline (7 jobs → 3 jobs)
|
||
2. Merge truth scoring into CI
|
||
3. Simplify verification pipeline
|
||
|
||
**Expected Outcome:**
|
||
- 50% faster CI pipeline
|
||
- Single source of truth
|
||
- Reduced complexity
|
||
|
||
### Phase 3: Polish (Week 3)
|
||
|
||
**Priority:** MEDIUM
|
||
**Risk:** LOW
|
||
**Impact:** MEDIUM
|
||
|
||
**Changes:**
|
||
1. Optimize caching strategy
|
||
2. Add retry logic for flaky tests
|
||
3. Update documentation
|
||
|
||
**Expected Outcome:**
|
||
- Professional, maintainable workflow structure
|
||
- 30-40% additional speed improvement
|
||
- Clear team understanding
|
||
|
||
---
|
||
|
||
## 📊 Success Criteria
|
||
|
||
### Phase 1 Success Indicators
|
||
|
||
✅ **Integration tests use real CLI commands**
|
||
- Tests run `./bin/claude-flow` commands
|
||
- Tests use actual npm scripts
|
||
- No `node -e "Math.random()"` fake data
|
||
|
||
✅ **No automated git force pushes**
|
||
- Rollback manager workflow deleted
|
||
- Notification workflow creates issues
|
||
- Human approval required for rollbacks
|
||
|
||
✅ **Single test workflow**
|
||
- test.yml deleted
|
||
- Only ci.yml remains
|
||
- No duplicate test runs
|
||
|
||
✅ **Improved reliability**
|
||
- CI success rate >80%
|
||
- Clear failure messages
|
||
- Fast feedback (<10 minutes)
|
||
|
||
### Final Success Metrics (After Phase 3)
|
||
|
||
| Metric | Target | Measurement |
|
||
|--------|--------|-------------|
|
||
| CI Duration | <5 min | `gh run view --log` |
|
||
| Success Rate | >95% | Last 20 runs all pass |
|
||
| Daily Waste | <10 min | Tracked in metrics |
|
||
| Cost Savings | $60/mo | GitHub Actions billing |
|
||
| Developer Satisfaction | 👍 | Team feedback |
|
||
|
||
---
|
||
|
||
## 🏗️ Architecture Decisions
|
||
|
||
### Critical ADRs
|
||
|
||
**ADR-003: Remove Simulated Integration Tests**
|
||
- **Status:** CRITICAL - Implement Immediately
|
||
- **Rationale:** 880 lines of fake tests provide zero value
|
||
- **Trade-off:** Must write real tests (better outcome)
|
||
|
||
**ADR-005: Disable Automated Rollbacks**
|
||
- **Status:** CRITICAL - Implement Immediately
|
||
- **Rationale:** Automated force pushes are too risky
|
||
- **Trade-off:** Manual intervention required (appropriate)
|
||
|
||
**ADR-009: Remove Duplicate Test Workflow**
|
||
- **Status:** CRITICAL - Implement Immediately
|
||
- **Rationale:** Eliminates confusion and redundancy
|
||
- **Trade-off:** None - pure benefit
|
||
|
||
See `github-workflows-optimization-strategy.md` for all ADRs with full context.
|
||
|
||
---
|
||
|
||
## 🔍 Current Workflow Analysis
|
||
|
||
### Workflows by Status
|
||
|
||
| Workflow | Status | Issue | Priority |
|
||
|----------|--------|-------|----------|
|
||
| ci.yml | ❌ Failing | Over-engineered, 7 jobs | CRITICAL |
|
||
| test.yml | ❌ Duplicate | Redundant with ci.yml | CRITICAL |
|
||
| integration-tests.yml | ❌ Failing | 880 lines of fake tests | CRITICAL |
|
||
| rollback-manager.yml | ❌ Failing | Dangerous automation | CRITICAL |
|
||
| truth-scoring.yml | ⚠️ Slow | 667 lines of duplication | HIGH |
|
||
| verification-pipeline.yml | ⚠️ Complex | Unnecessary matrix | MEDIUM |
|
||
| status-badges.yml | ✅ Working | Well-designed | KEEP |
|
||
|
||
### Failure Analysis
|
||
|
||
**Recent 20 runs:**
|
||
- Status Badges: 100% success (5/5) ✅
|
||
- Rollback Manager: 100% failure (4/4) ❌
|
||
- Integration Tests: 100% failure (4/4) ❌
|
||
- CI/CD Pipeline: 100% failure (5/5) ❌
|
||
|
||
**Root Causes:**
|
||
1. Fake tests can't actually test anything
|
||
2. Over-engineered logic prone to errors
|
||
3. Missing error handling
|
||
4. Unrealistic test scenarios
|
||
|
||
---
|
||
|
||
## 💡 Key Insights
|
||
|
||
### Why Current Workflows Fail
|
||
|
||
**1. False Testing Paradigm**
|
||
- Integration tests generate fake data with `Math.random()`
|
||
- Tests always "pass" regardless of actual functionality
|
||
- Provides false confidence
|
||
- Doesn't catch real bugs
|
||
|
||
**2. Over-Engineering**
|
||
- 7 separate CI jobs when 3 would suffice
|
||
- Complex matrix testing for single-platform Node.js
|
||
- Duplicate workflows (test.yml + ci.yml)
|
||
- Truth scoring duplicates CI checks
|
||
|
||
**3. Dangerous Automation**
|
||
- Automated `git push --force` to main branch
|
||
- No human oversight for critical operations
|
||
- Complex failure detection prone to false positives
|
||
|
||
**4. Resource Waste**
|
||
- npm ci runs 7 times in single workflow
|
||
- Fake integration tests waste 25 minutes
|
||
- Duplicate workflows double execution time
|
||
|
||
### How Optimization Fixes This
|
||
|
||
**1. Real Testing**
|
||
```yaml
|
||
# BEFORE: Fake test
|
||
run: node -e "console.log(Math.random())"
|
||
|
||
# AFTER: Real test
|
||
run: npm run test:integration -- swarm
|
||
```
|
||
|
||
**2. Simplification**
|
||
```yaml
|
||
# BEFORE: 7 jobs, 7× npm ci
|
||
jobs: [security, lint, typecheck, test, docs, build, deploy]
|
||
|
||
# AFTER: 3 jobs, efficient execution
|
||
jobs: [quality-security, test-build, deploy]
|
||
```
|
||
|
||
**3. Safety**
|
||
```yaml
|
||
# BEFORE: Automated force push
|
||
run: git push --force origin main
|
||
|
||
# AFTER: Human notification
|
||
uses: actions/github-script@v7
|
||
# Creates issue for human review
|
||
```
|
||
|
||
**4. Efficiency**
|
||
```yaml
|
||
# BEFORE: Sequential execution, long waits
|
||
needs: [job1, job2, job3, ...]
|
||
|
||
# AFTER: Parallel within jobs
|
||
run: lint & typecheck & audit & wait
|
||
```
|
||
|
||
---
|
||
|
||
## 📖 Related Documentation
|
||
|
||
### Internal Documents
|
||
|
||
- **Strategy:** `github-workflows-optimization-strategy.md`
|
||
- **Implementation:** `workflow-optimization-implementation-guide.md`
|
||
- **Diagrams:** `workflow-architecture-diagram.md`
|
||
- **This Index:** `README.md`
|
||
|
||
### External Resources
|
||
|
||
- [GitHub Actions Documentation](https://docs.github.com/en/actions)
|
||
- [GitHub Actions Best Practices](https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions)
|
||
- [actionlint](https://github.com/rhysd/actionlint) - Workflow linter
|
||
- [act](https://github.com/nektos/act) - Run workflows locally
|
||
|
||
### Future Documentation
|
||
|
||
**To Be Created:**
|
||
- `docs/testing/integration-tests.md` - Real integration test strategy
|
||
- `docs/development/ci-cd-best-practices.md` - CI/CD guidelines
|
||
- `docs/operations/rollback-procedures.md` - Manual rollback guide
|
||
|
||
---
|
||
|
||
## 🤝 Contributing to Workflow Optimization
|
||
|
||
### How to Help
|
||
|
||
**If you're a developer:**
|
||
1. Review the implementation guide
|
||
2. Test workflow changes locally
|
||
3. Provide feedback on usability
|
||
4. Report issues or improvements
|
||
|
||
**If you're a reviewer:**
|
||
1. Verify ADRs align with project goals
|
||
2. Check for security concerns
|
||
3. Validate improvement claims
|
||
4. Approve or request changes
|
||
|
||
**If you're a stakeholder:**
|
||
1. Review success metrics
|
||
2. Evaluate ROI and timeline
|
||
3. Approve phases for implementation
|
||
4. Champion the optimization effort
|
||
|
||
### Feedback Process
|
||
|
||
**Found an issue?**
|
||
```bash
|
||
# Create issue with details
|
||
gh issue create --title "Workflow Optimization: [Issue]" \
|
||
--body "Details about the concern..." \
|
||
--label "workflow-optimization"
|
||
```
|
||
|
||
**Have a suggestion?**
|
||
```bash
|
||
# Add comment to strategy document
|
||
# Or discuss in team chat
|
||
# Or open PR with improvements
|
||
```
|
||
|
||
---
|
||
|
||
## 🎯 Next Steps
|
||
|
||
### For Your Team
|
||
|
||
1. **Schedule Review Meeting** (30 minutes)
|
||
- Present architecture diagrams
|
||
- Review strategy document highlights
|
||
- Discuss concerns and questions
|
||
- Get approval to proceed
|
||
|
||
2. **Assign Implementation Owner**
|
||
- Experienced with GitHub Actions
|
||
- Available for ~3 hours over next week
|
||
- Can make git commits to main branch
|
||
- Will follow implementation guide
|
||
|
||
3. **Set Up Monitoring**
|
||
- Track CI success rate
|
||
- Measure duration improvements
|
||
- Monitor cost reductions
|
||
- Collect developer feedback
|
||
|
||
4. **Begin Phase 1** (Week 1)
|
||
- Follow implementation guide
|
||
- Make changes incrementally
|
||
- Test each change
|
||
- Monitor for issues
|
||
|
||
### Timeline
|
||
|
||
```
|
||
Week 0: Team review and approval
|
||
Week 1: Implement Phase 1 (critical fixes)
|
||
Week 2: Implement Phase 2 (consolidation)
|
||
Week 3: Implement Phase 3 (polish)
|
||
Week 4: Measure results, celebrate success! 🎉
|
||
```
|
||
|
||
---
|
||
|
||
## 📞 Support
|
||
|
||
### Getting Help
|
||
|
||
**Questions about strategy?**
|
||
- Read the full strategy document
|
||
- Check ADRs for decision rationale
|
||
- Review architecture diagrams
|
||
|
||
**Issues during implementation?**
|
||
- Consult troubleshooting section in implementation guide
|
||
- Check workflow logs: `gh run view --log-failed`
|
||
- Test locally with act: `act push -W .github/workflows/ci.yml`
|
||
|
||
**Need approval or decision?**
|
||
- Review risk assessment in strategy document
|
||
- Present architecture diagrams to stakeholders
|
||
- Use success metrics to justify changes
|
||
|
||
---
|
||
|
||
## ✅ Document Checklist
|
||
|
||
Use this checklist to ensure you've reviewed all necessary documentation:
|
||
|
||
### Before Implementation
|
||
- [ ] Read strategy document executive summary
|
||
- [ ] Review architecture diagrams
|
||
- [ ] Understand the problem and solution
|
||
- [ ] Check success criteria
|
||
- [ ] Review ADRs for critical decisions
|
||
- [ ] Get stakeholder approval
|
||
|
||
### During Implementation
|
||
- [ ] Follow implementation guide step-by-step
|
||
- [ ] Test changes locally before pushing
|
||
- [ ] Monitor workflow runs after each change
|
||
- [ ] Document any issues or deviations
|
||
- [ ] Update team on progress
|
||
|
||
### After Implementation
|
||
- [ ] Verify success metrics
|
||
- [ ] Collect team feedback
|
||
- [ ] Update documentation if needed
|
||
- [ ] Share results with stakeholders
|
||
- [ ] Plan for Phase 2 (if Phase 1 successful)
|
||
|
||
---
|
||
|
||
## 🎉 Success Stories (To Be Added)
|
||
|
||
*This section will be updated with actual results after implementation.*
|
||
|
||
**Expected Outcomes:**
|
||
- 67% faster CI pipeline
|
||
- 87% improvement in reliability
|
||
- 68% reduction in complexity
|
||
- $60/month cost savings
|
||
- Much happier development team!
|
||
|
||
---
|
||
|
||
## 📝 Revision History
|
||
|
||
| Version | Date | Author | Changes |
|
||
|---------|------|--------|---------|
|
||
| 1.0 | 2025-11-24 | System Architect | Initial comprehensive documentation |
|
||
|
||
---
|
||
|
||
## 📄 License
|
||
|
||
This documentation is part of the claude-code-flow project and is licensed under the MIT License. See the LICENSE file in the root directory for details.
|
||
|
||
---
|
||
|
||
**End of Index Document**
|
||
|
||
**Start Here:** Read `github-workflows-optimization-strategy.md` for the full strategy.
|
||
**Then:** Follow `workflow-optimization-implementation-guide.md` for implementation.
|
||
**Reference:** Use `workflow-architecture-diagram.md` for visual understanding.
|