Skip to content

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:

  1. Discovering project context through memory files
  2. Analyzing requirements with discovered knowledge
  3. Adapting plans to your specific patterns
  4. Updating distributed memory with insights
  5. 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 upload

Watch the Discovery Process

The prompt will:

  1. Read Memory Files - CLAUDE.md and .orchestre/CLAUDE.md
  2. Discover Your Stack - Understand what you're building with
  3. Find Patterns - Learn from existing code
  4. Call Analysis Tool - Use Gemini for deep analysis
  5. 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 Docs

Observe the Context-Aware Analysis

For complex features, the prompt:

  1. Discovers Current Architecture - Reads all CLAUDE.md files
  2. Researches Technical Fit - How to add this to YOUR stack
  3. Identifies Integration Points - Where this fits in your app
  4. Adapts to Your Patterns - Uses your coding style
  5. 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 receipts

The 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 participants

The prompt will check your current mobile support and adapt.

3. Business Context Matters

/orchestrate Add search optimized for product names and descriptions

The 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 approach

Experiment 3: Memory-Driven Iteration

Watch how memory improves each iteration:

# First prompt
/orchestrate Build a task management system

This creates initial plans and updates memory.

# Memory now knows your task system design
/orchestrate Add recurring tasks to our task system

The prompt reads the previous plan and builds on it!

# Each iteration is smarter
/orchestrate Tasks need file attachments

Notice how it:

  • Knows your task schema
  • Follows your validation patterns
  • Reuses your API style
  • Maintains consistency

The Memory Advantage

Each orchestration:

  1. Reads previous decisions from .orchestre/plans/
  2. Builds on existing knowledge
  3. Updates memory with new insights
  4. 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 consistency

Memory-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 improvements

The 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 approach

The prompt discovers your privacy stance from memory and adapts!

3. Research with Memory

/orchestrate Research the best caching strategy for our API

This 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 API

Uses your existing endpoints to plan the migration!

Common Orchestration Scenarios

Feature Addition

bash
/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

bash
/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

bash
/orchestrate "Improve application security for enterprise customers"

The plan includes:

  • Security audit
  • Vulnerability fixes
  • Compliance features
  • Access controls
  • Audit logging

Technical Debt

bash
/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 blog

Watch 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 preferences

This updates CLAUDE.md with the notification design.

3. Context-Aware Progress

/status

Shows how notifications integrate with your existing features.

4. Intelligent Implementation

/execute-task Add email notifications using our patterns

The prompt:

  • Reads the notification model from memory
  • Follows your established patterns
  • Maintains consistency automatically

5. Memory-Enhanced Review

/review

Reviews with full context of your decisions and patterns.

6. Learn and Iterate

/learn Implemented notifications with email support

Updates 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 authentication

2. Ignoring Memory

# Memory exists to help you!
# Check what Orchestre knows:
/status

# Use that knowledge:
/orchestrate Extend our auth system with social login

3. Skipping Context

Starting fresh in a new terminal? Let prompts rediscover:

/status  # See current state
/discover-context  # Deep analysis of your project

4. Not Capturing Insights

After implementing features:

/learn  # Capture what worked
/document-feature  # Create detailed docs

Troubleshooting

Prompts Not Finding Context?

  • Ensure you have CLAUDE.md files
  • Run /discover-context to analyze project
  • Use /status to 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:

  1. No Installation - Prompts available immediately via MCP
  2. Discovery First - Prompts explore and understand
  3. Memory Integration - CLAUDE.md files create persistence
  4. Adaptive Intelligence - Each use improves understanding
  5. 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-context on 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!

Built with ❤️ for the AI Coding community, by Praney Behl