Tutorial 4: Prompt-Based Orchestration
Orchestration is the heart of Orchestre - it's where prompts discover your project context, analyze requirements, and create intelligent, adaptive plans. In this tutorial, you'll master the prompt-based orchestration workflow.
Learning Objectives
By the end of this tutorial, you'll:
- ✅ Master prompt-based orchestration
- ✅ Understand context discovery process
- ✅ See how prompts adapt to your project
- ✅ Work with the distributed memory system
- ✅ Create truly contextual development workflows
Prerequisites
- Completed previous beginner tutorials
- A project with CLAUDE.md files
- 60 minutes of time
What is Prompt-Based Orchestration?
Orchestration in v5 means:
- Discovering project context through memory files
- Analyzing requirements with discovered knowledge
- Adapting plans to your specific patterns
- Updating distributed memory with insights
- Learning from each interaction
The Discovery-First Workflow
Experiment 1: Simple Orchestration
Start with a clear requirement:
/orchestrate Add user profiles to the application with avatar uploadWatch the Discovery Process
The prompt will:
- Read Memory Files - CLAUDE.md and .orchestre/CLAUDE.md
- Discover Your Stack - Understand what you're building with
- Find Patterns - Learn from existing code
- Call Analysis Tool - Use Gemini for deep analysis
- Generate Contextual Plan - Adapted to YOUR project
Example Discovery Flow:
🔍 Discovering project context...
📖 Reading CLAUDE.md files...
🏗️ Found: Cloudflare Hono API with D1 database
🎨 Detected patterns: RESTful endpoints, Zod validation
🧠 Analyzing requirements with AI...
🎯 Orchestration Plan: User Profiles with Avatars
## Discovered Context
- Project Type: Blog API (from your CLAUDE.md)
- Database: Cloudflare D1 (from template)
- Validation: Zod schemas (from your patterns)
- Storage: Cloudflare R2 (recommended for avatars)
## Adaptive Implementation Plan
### Phase 1: Extend Data Model
/execute-task Extend user model with profile fields matching article schema patterns
### Phase 2: Storage Setup
/execute-task Configure R2 bucket for avatars using Cloudflare patterns
### Phase 3: API Endpoints (following your RESTful style)
/execute-task Create profile endpoints matching article CRUD patterns
### Phase 4: Validation (using your Zod approach)
/execute-task Add profile validation schemas consistent with existing validators
📝 Memory will be updated in .orchestre/plans/Experiment 2: Complex Orchestration
Try a more complex requirement:
/orchestrate Build a real-time collaborative document editor like Google DocsObserve the Context-Aware Analysis
For complex features, the prompt:
- Discovers Current Architecture - Reads all CLAUDE.md files
- Researches Technical Fit - How to add this to YOUR stack
- Identifies Integration Points - Where this fits in your app
- Adapts to Your Patterns - Uses your coding style
- Updates Knowledge Base - Saves research to memory
The Adaptive Plan:
🔍 Analyzing your project for real-time capabilities...
📚 Found: Cloudflare Durable Objects support in template
🔌 Discovered: Existing WebSocket patterns
💡 Researching: Operational transformation algorithms
## Contextual Architecture (for YOUR project)
Given your Cloudflare Hono setup:
- Use Durable Objects for document state
- Leverage Workers WebSockets
- Store documents in D1 (matching your pattern)
- Use R2 for document snapshots
## Phased Implementation (respecting your patterns)
Phase 1: Document Model (like your articles)
/execute-task Create document schema following article patterns
Phase 2: Durable Object Setup
/execute-task Implement collaborative document Durable Object
Phase 3: WebSocket Handler (using Hono patterns)
/execute-task Add WebSocket routes matching your API style
📁 Saving architecture decisions to .orchestre/knowledge/Writing Effective Orchestration Prompts
1. Let Discovery Guide You
# Good - lets prompt discover context
/orchestrate Add messaging to the application
# Even better - provides goal
/orchestrate Add real-time messaging between users with read receiptsThe prompt will discover if you have users, auth, and WebSocket support!
2. Constraints Help Focus
/orchestrate Add video calling that works on mobile with max 4 participantsThe prompt will check your current mobile support and adapt.
3. Business Context Matters
/orchestrate Add search optimized for product names and descriptionsThe prompt discovers your data model and creates appropriate search.
4. Trust the Discovery
# Don't over-specify
/orchestrate Add authentication
# The prompt will:
# - Check if you have auth already
# - Discover your user model
# - Find your session patterns
# - Suggest the right approachExperiment 3: Memory-Driven Iteration
Watch how memory improves each iteration:
# First prompt
/orchestrate Build a task management systemThis creates initial plans and updates memory.
# Memory now knows your task system design
/orchestrate Add recurring tasks to our task systemThe prompt reads the previous plan and builds on it!
# Each iteration is smarter
/orchestrate Tasks need file attachmentsNotice how it:
- Knows your task schema
- Follows your validation patterns
- Reuses your API style
- Maintains consistency
The Memory Advantage
Each orchestration:
- Reads previous decisions from .orchestre/plans/
- Builds on existing knowledge
- Updates memory with new insights
- Improves future suggestions
Executing Orchestration Plans
Context-Aware Execution
Each execution prompt discovers and adapts:
# 1. Execute with discovery
/execute-task Create the task data model
# The prompt will:
# - Read existing models
# - Match your schema patterns
# - Use your naming conventions
# - Update CLAUDE.md# 2. Check progress with context
/status
# Shows:
# - What was implemented
# - How it fits your architecture
# - What memory was updated
# - Suggested next steps# 3. Continue building
/execute-task Add task API endpoints
# Automatically:
# - Follows your RESTful patterns
# - Uses your validation approach
# - Maintains consistencyMemory-Enhanced Workflow
The execution flow with memory:
/orchestrate → Creates plan → Saves to .orchestre/plans/
↓
/execute-task → Reads plan → Implements → Updates CLAUDE.md
↓
/status → Reads all memory → Shows contextual progress
↓
/review → Analyzes with context → Updates .orchestre/reviews/Advanced Orchestration Patterns
1. Let the Prompt Explore
/orchestrate Analyze the codebase and suggest impactful improvementsThe prompt will:
- Read all CLAUDE.md files
- Analyze code patterns
- Check .orchestre/reviews/ for past issues
- Suggest improvements based on YOUR project
2. Context-Aware Constraints
/orchestrate Add analytics that respects our privacy-first approachThe prompt discovers your privacy stance from memory and adapts!
3. Research with Memory
/orchestrate Research the best caching strategy for our APIThis prompt:
- Discovers your API patterns
- Researches options
- Saves findings to .orchestre/knowledge/
- Suggests contextual implementation
4. Memory-Guided Migration
/orchestrate Plan migration to GraphQL based on our current APIUses your existing endpoints to plan the migration!
Common Orchestration Scenarios
Feature Addition
/orchestrate "Add social features: comments, likes, and sharing"The plan will consider:
- Data relationships
- Real-time updates
- Notification system
- Privacy controls
- Performance impact
Performance Optimization
/orchestrate "The app is slow, create a plan to improve performance"Orchestration will:
- Identify bottlenecks
- Suggest optimizations
- Prioritize impact
- Plan implementation
- Include monitoring
Security Enhancement
/orchestrate "Improve application security for enterprise customers"The plan includes:
- Security audit
- Vulnerability fixes
- Compliance features
- Access controls
- Audit logging
Technical Debt
/orchestrate "We have too much technical debt, help prioritize what to fix"Practice Exercise: Memory-Driven Development
Let's build a notification system and watch memory in action:
1. Initial Discovery and Planning
/orchestrate Build a notification system for our blogWatch as it:
- Discovers your user model
- Finds your API patterns
- Plans notifications that fit YOUR app
2. Memory Builds Understanding
/execute-task Create notification model and preferencesThis updates CLAUDE.md with the notification design.
3. Context-Aware Progress
/statusShows how notifications integrate with your existing features.
4. Intelligent Implementation
/execute-task Add email notifications using our patternsThe prompt:
- Reads the notification model from memory
- Follows your established patterns
- Maintains consistency automatically
5. Memory-Enhanced Review
/reviewReviews with full context of your decisions and patterns.
6. Learn and Iterate
/learn Implemented notifications with email supportUpdates memory for future features!
Orchestration Best Practices
1. Trust Discovery
Let prompts explore your project - they'll find patterns you might miss.
2. Use Memory as Your Ally
The more you use Orchestre, the smarter it gets about YOUR project.
3. Iterate Naturally
Each prompt builds on previous knowledge - embrace the flow.
4. Context Over Configuration
Don't over-specify - let discovery guide implementation.
5. Review with Purpose
Reviews aren't just quality checks - they update memory for better future work.
Common Pitfalls
1. Fighting Discovery
# Don't over-specify
/orchestrate Add user auth with JWT tokens stored in cookies using bcrypt
# Let it discover and suggest
/orchestrate Add user authentication2. Ignoring Memory
# Memory exists to help you!
# Check what Orchestre knows:
/status
# Use that knowledge:
/orchestrate Extend our auth system with social login3. Skipping Context
Starting fresh in a new terminal? Let prompts rediscover:
/status # See current state
/discover-context # Deep analysis of your project4. Not Capturing Insights
After implementing features:
/learn # Capture what worked
/document-feature # Create detailed docsTroubleshooting
Prompts Not Finding Context?
- Ensure you have CLAUDE.md files
- Run
/discover-contextto analyze project - Use
/statusto see what's known
Plans Too Generic?
- Let the prompt discover more
- Memory builds over time
- Each use improves context
Lost After Break?
/status- Quick memory refresh/interpret-state- Deep understanding- Continue where you left off!
What You've Learned
✅ Prompts discover context through memory files ✅ Each interaction builds on previous knowledge
✅ Discovery creates better plans than prescription ✅ Memory makes AI assistance truly contextual ✅ Orchestre gets smarter about YOUR project over time
The Prompt-Based Paradigm
You've experienced how Orchestre v5 works:
- No Installation - Prompts available immediately via MCP
- Discovery First - Prompts explore and understand
- Memory Integration - CLAUDE.md files create persistence
- Adaptive Intelligence - Each use improves understanding
- Natural Workflow - Just type and let it discover
Next Steps
Congratulations! You've mastered prompt-based orchestration. You understand:
- How prompts discover and adapt
- The power of distributed memory
- Context-aware development
- True AI collaboration
Ready for more? Continue to Intermediate: Building a SaaS →
Practice suggestions:
- Use
/discover-contexton an existing project - Watch how memory improves suggestions over time
- Try the discovery-first approach on complex features
- Document patterns with
/document-feature
Remember: In v5, prompts think WITH you, not just FOR you!
