UNPKG

arela

Version:

AI-powered CTO with multi-agent orchestration, code summarization, visual testing (web + mobile) for blazing fast development.

400 lines (292 loc) 9.83 kB
# Windsurf Workflow Integration - Complete **Date:** 2025-11-14 **Status:** ✅ COMPLETE ## What We Built Integrated Windsurf's workflow system into Arela to provide structured, repeatable processes for common development tasks. ## Key Achievement Created our **first workflow**: `/research-driven-decision` - A systematic approach to making evidence-based technical decisions. ## Files Created ### 1. Workflow Definition **Location:** `.windsurf/workflows/research-driven-decision.md` **Purpose:** Guides Cascade through the research-driven decision making process **How to use:** ``` /research-driven-decision ``` **Features:** - Identifies when research is needed - Generates structured research prompts - Guides user through ChatGPT + Gemini research - Reviews findings together - Implements with documented rationale - Creates memory of decision ### 2. Documentation **Location:** `docs/workflows.md` **Contents:** - What are workflows - How to use them - How to create new ones - Best practices - Integration with Arela rules - Future workflow ideas ### 3. Template Integration **Location:** `src/persona/templates/workflows/research-driven-decision.md` **Purpose:** Automatically copied to new projects during `arela init` ### 4. Code Updates **Location:** `src/persona/loader.ts` **Changes:** - Creates `.windsurf/workflows/` directory during init - Copies workflow templates to new projects - Ensures workflows are available immediately ## How It Works ### Workflow Discovery Windsurf automatically discovers workflows from: - `.windsurf/workflows/` in current workspace - `.windsurf/workflows/` in sub-directories - `.windsurf/workflows/` in parent directories (up to git root) ### Workflow Invocation In Cascade, simply type: ``` /research-driven-decision ``` Cascade will guide you through the workflow steps. ### Workflow Structure ```markdown # Workflow Title **Description:** Brief description ## When to Trigger [Conditions for using this workflow] ## Workflow Steps ### 1. Step Name [Instructions] ## Benefits [Why this workflow is valuable] ## Example [Real-world example] ``` ## Research-Driven Decision Workflow ### When to Use **Trigger research when:** - Current implementation seems suboptimal - Choosing between multiple algorithms/approaches - Encountering known limitations - Considering major architectural changes - Evaluating new technologies **Don't trigger for:** - Simple bug fixes - Obvious implementation errors - Standard patterns with clear best practices - Minor refactoring ### The Process 1. **Identify Decision Point** - What's the problem? - Why is current approach suboptimal? - What alternatives exist? 2. **Generate Research Prompt** ```markdown # Research Request: [Topic] ## Context [Problem description] ## Our Specific Use Case [Requirements, constraints, scale] ## Research Questions 1. [Primary question] 2. [Comparisons needed] 3. [Edge cases] ## What We Need - Validation/disproval - Benchmarks - Implementation guidance ## Success Criteria [What makes a solution "good"] ``` 3. **User Runs Research** - Paste prompt into ChatGPT + Gemini - Save results to `RESEARCH/` folder - Share findings with Cascade 4. **Review Together** - Discuss trade-offs - Make informed decision - Document rationale 5. **Implement** - Execute based on research - Reference research in code - Create ADR if major decision 6. **Document** - Create memory - Update relevant docs ### Real-World Success: CASCADE-003 **Problem:** Louvain algorithm returning 13 singletons instead of 5 slices **Research Prompt:** ```markdown # Deep Research Request: Optimal Community Detection for Codebase Vertical Slice Detection ## Context Louvain clustering fails on small, dense codebase graphs (10-50 nodes) ## Our Use Case - Small graphs (10-50 files) - Dense subgraphs (feature directories) - Directed edges (imports) - Expected output: 4-6 feature slices ## Research Questions 1. Is Infomap optimal for this use case? 2. How does it compare to Leiden? 3. How to handle edge cases? 4. What are the hyperparameters? ## What We Need - Academic evidence for/against Infomap - Comparative benchmarks - Practical implementation guidance ``` **Result:** - Comprehensive research from Gemini + ChatGPT - Switched from Louvain to Infomap - Successful implementation in ~1 hour - Now detects 6 slices correctly! **Without research:** Would have wasted time trying to fix Louvain's ΔQ calculation **With research:** Immediately pivoted to better algorithm ## Benefits**Evidence-based decisions** - Not guessing or using outdated knowledge ✅ **Parallel research** - ChatGPT + Gemini provide multiple perspectives ✅ **Documented rationale** - Research files serve as ADRs ✅ **Continuous learning** - Build knowledge base over time ✅ **Reduced risk** - Avoid costly wrong decisions ## Integration with Arela ### Complements Rules System - **Rules** provide persistent context at the prompt level - **Workflows** provide structured sequences at the trajectory level Together they enable: - Consistent decision-making processes - Repeatable quality gates - Knowledge sharing across team - Continuous improvement ### Aligns with Arela Principles - **Two-Way Door Decisions** - Research helps identify Type 1 vs Type 2 - **Technical Debt Management** - Prevents inadvertent reckless debt - **ADR Discipline** - Research becomes the ADR foundation - **Pragmatic Visionary** - Build for users, validate with research ## Future Workflows Planned workflows for Arela: ### `/contract-validation` Automate OpenAPI contract validation with Dredd ### `/slice-extraction` Guide through vertical slice extraction process ### `/architecture-review` Run comprehensive architecture quality checks ### `/deployment-checklist` Ensure all pre-deployment steps are complete ### `/security-scan` Trigger security vulnerability scans ### `/test-generation` Generate Testcontainers-based integration tests ## Usage Examples ### In New Projects ```bash # Initialize Arela arela init # Workflows automatically created in .windsurf/workflows/ # Ready to use immediately! # In Cascade: /research-driven-decision ``` ### In Existing Projects Workflows already exist in `.windsurf/workflows/` and are ready to use. ### Creating Custom Workflows 1. **Via Cascade UI:** - Click Customizations icon - Navigate to Workflows panel - Click + Workflow button 2. **Via Cascade Command:** ``` Create a workflow for [task description] ``` 3. **Manually:** - Create `.windsurf/workflows/my-workflow.md` - Follow workflow structure template - Use immediately with `/my-workflow` ## Best Practices ### Do's ✅ Use workflows for repetitive processes ✅ Keep steps clear and actionable ✅ Include examples and context ✅ Document when to use vs when not to use ✅ Reference related Arela rules ### Don'ts ❌ Don't create workflows for one-off tasks ❌ Don't make steps too vague ❌ Don't skip the "when to trigger" section ❌ Don't exceed 12,000 character limit ## Technical Implementation ### Directory Structure ``` .windsurf/ ├── rules/ # Arela rules (persistent context) │ ├── arela-cto.md │ ├── 010-pragmatic-visionary.md │ └── ... └── workflows/ # Arela workflows (structured processes) └── research-driven-decision.md ``` ### Init Process When running `arela init`: 1. Creates `.windsurf/rules/` directory 2. Creates `.windsurf/workflows/` directory 3. Copies persona and rules based on preset 4. Copies all workflow templates 5. Creates `.arela/tickets/` structure ### Build Process ```bash npm run build # Compiles TypeScript # Copies templates (including workflows) to dist/ ``` ## Memory Integration Updated memory: **Research-Driven Decision Making Protocol** **Location:** Windsurf Memories **Tags:** workflow, research, decision_making, best_practices, arela_process **Contents:** - When to trigger research - Research prompt template - Workflow steps - Example success (CASCADE-003) - Benefits and integration ## Documentation - ✅ Workflow definition: `.windsurf/workflows/research-driven-decision.md` - ✅ User documentation: `docs/workflows.md` - ✅ Integration summary: `WORKFLOW_INTEGRATION.md` (this file) - ✅ Memory updated with workflow reference - ✅ Code updated to support workflows ## Testing ✅ Build passes ✅ Workflow file created ✅ Template copied ✅ Init process updated ✅ Documentation complete ## Next Steps ### Immediate - Test workflow in real scenario - Get user feedback - Refine based on usage ### Future - Create additional workflows (contract-validation, slice-extraction, etc.) - Build workflow library - Share workflows across team - Integrate with CI/CD ## Resources - [Windsurf Workflows Documentation](https://docs.windsurf.com/windsurf/cascade/workflows) - [Arela Workflows Documentation](docs/workflows.md) - [Research-Driven Decision Workflow](.windsurf/workflows/research-driven-decision.md) - [Arela Rules Documentation](README.md#rules) ## Summary **What we achieved:** - ✅ Integrated Windsurf workflow system into Arela - ✅ Created first workflow: Research-Driven Decision Making - ✅ Updated init process to include workflows - ✅ Documented everything comprehensively - ✅ Tested and validated **Impact:** - Systematic approach to technical decisions - Evidence-based recommendations - Repeatable quality processes - Knowledge sharing across projects - Reduced risk of wrong decisions **This is the foundation for a library of Arela workflows that will guide teams through complex development processes!** 🎯