The Orchestration Engine: The Complete Process
The Core Philosophy (The "Why")
The engine's purpose is to solve the "Don't Repeat Yourself" (DRY) problem for prompt engineering and act as a force multiplier. It systematizes successful ad-hoc experiments into a reliable, generative process. You are moving from being a "prompt user" to a "framework architect." The engine codifies your expertise in how to collaborate with an LLM, making that expertise repeatable and scalable.
The Architecture (The "What")
The system consists of four main parts:
- The Engine (
orchestrator.py): An interactive Python script that acts as the "wizard" or "factory foreman." It guides you through the configuration process. - The Engine Configuration (
goal_map.json): An external JSON file that acts as the engine's "brain." It maps the primary goals to the recommended persona, protocol, and constraint components, making the engine's logic easily configurable without changing the source code. - The Component Library (The "Parts Bin"): A collection of text snippets that represent codified patterns.
personas/: Contains snippets for different roles (e.g.,empathetic_guide.txt,meticulous_auditor.txt).protocols/: Contains snippets defining different interaction models (e.g.,code_review_pass.txt,turn_by_turn_dialogue.txt).constraints/: Contains snippets for different rule sets (e.g.,preserve_functional_attributes.txt,no_html_restructure.txt).
- The Collaboration Environment (The "Output"): The final, generated
00_PERSONA.mdand01_PROMPT_TEMPLATE.mdfiles, perfectly tailored to the specific task at hand.
The Workflow (The "How")
This is the step-by-step process of using the engine. It is designed as a simple, linear Command-Line Interface (CLI) for an expert user.
Step 1: Invocation
You start a new project by running the engine from your terminal.
$ python orchestrator.py
Step 2: The Interactive Wizard
The engine begins a dialogue to understand the nature of the task.
Wizard: Welcome to the LLM Orchestration Engine. Let's configure a new collaboration.
Wizard: Enter a name for this project (e.g., "API_Refactor_Tool"):
You: Django_Model_Auditor
Wizard: What is the PRIMARY GOAL of this task? Choose the workflow that best fits.
--- Technical & Execution ---
[1] TEACH_OR_EXPLAIN (Purpose: To teach a concept or document something.)
[2] DIAGNOSE_ROOT_CAUSE (Purpose: To find the underlying cause of a problem.)
[3] REVIEW_AGAINST_STANDARDS (Purpose: To evaluate a piece of work against a set of rules.)
[4] SCAFFOLD_FROM_SCRATCH (Purpose: To create a new entity based on a template or structure.)
[5] OPTIMIZE_OR_REFINE (Purpose: To improve an existing piece of work for clarity or efficiency.)
[6] ADD_OR_INTEGRATE (Purpose: To add a new component to an existing system.)
[7] CONVERT_OR_MIGRATE (Purpose: To change a piece of work from one format to another.)
--- Strategic & Developmental ---
[8] DECONSTRUCT_AN_IDEA (Purpose: Explore a new concept to test its viability and principles.)
[9] PLAN_PROFESSIONAL_GROWTH (Purpose: Set long-term career goals or refine your professional brand.)
[10] BUILD_A_MENTAL_MODEL (Purpose: Develop a deep, lasting understanding of a complex topic.)
[11] REFINE_A_PRESENTATION (Purpose: Improve the clarity and impact of a key message.)
You: 3
Step 3: Component Resolution & Just-in-Time Generation
This is the core of the engine's logic.
- Read Configuration: The engine reads
goal_map.jsonto find the recommended components for the selected 'REVIEW_AGAINST_STANDARDS' goal (e.g.,meticulous_auditor.txt,code_review_pass.txt). - Check for Components: For each recommended component, the engine checks if the file exists in the
components/library. - Just-in-Time Generation (if needed):
- If a recommended component (e.g.,
meticulous_auditor.txt) is missing, the engine triggers a "self-healing" JIT workflow. - It informs you: "INFO: The required component
meticulous_auditor.txtwas not found. We will now generate it." - It then prompts you for a one-line description of the needed snippet.
- Finally, it calls the LLM API to generate the component and saves it to the library under its correct, original name (
meticulous_auditor.txt). The system heals its own Parts Bin, requiring no changes to thegoal_map.json.
- If a recommended component (e.g.,
- Degraded Mode (API Failure): If the LLM API call fails (e.g., no API key, network error), the engine will not crash. It will inform you of the failure, log a TODO, and insert a placeholder in the final
.mdfile, allowing you to complete the process manually. The workflow is never fully blocked.
Step 4: Framework Assembly & Generation
Once all components are present (either pre-existing or just-in-time generated), the engine assembles the final files.
Wizard: Please provide a title for the Persona (e.g., "The Code Guardian"):
You: The Django Standards Advocate
Wizard: Based on the goal 'REVIEW_AGAINST_STANDARDS', I will use the "Meticulous Auditor" persona.
Wizard: Generating framework files in directory: ./output/Django_Model_Auditor/
- SUCCESS: Created 00_PERSONA.md
- SUCCESS: Created 01_PROMPT_TEMPLATE.md
Wizard: Configuration complete.
Step 5: The Collaboration
You now begin your work by providing the generated 00_PERSONA.md to the LLM, followed by the 01_PROMPT_TEMPLATE.md (filled with the code to be audited), kicking off a highly structured and predictable collaboration. You can then begin the manual fine-tuning process to elevate the framework to Gold Standard quality.
The Power of this Approach
- It's a Force Multiplier: It aims to reduce the setup time for a new, high-quality collaboration from hours to minutes.
- It Prevents "Re-inventing the Wheel": It ensures that hard-won lessons are codified into components and reused.
- It Scales Your Expertise: The engine's logic is easily configurable via the
goal_map.jsonfile, allowing the system to evolve without changing its code. - It's Resilient: By gracefully handling failures and operating in a "degraded mode," the engine ensures it is always a useful tool.