ORCHESTRATION SPEC
Orchestration specification for meta-commands - defines execution modes, command references, and skill invocations
---
description: Orchestration specification for meta-commands - defines execution modes, command references, and skill invocations
---
# Meta-Command Orchestration Specification
This document defines the Domain-Specific Language (DSL) for orchestrating meta-commands.
Meta-commands are prompts that call other prompts, enabling sophisticated workflows.
**Categorical Foundation**: This DSL implements category theory constructs:
- **Functor F**: Task → Prompt (structure-preserving transformation)
- **Monad M**: Iterative refinement with quality tracking
- **Comonad W**: Context extraction from execution history
- **Natural Transformation α**: Strategy switching (F ⇒ G)
- **[0,1]-Enriched**: Quality degradation tracking
---
## Command Hierarchy
┌─────────────────────────────────────────────────────────────────┐ │ META-COMMAND LAYER │ │ /meta-build /meta-fix /meta-review /meta-test /meta-* │ │ │ │ These commands ORCHESTRATE other commands using this DSL │ ├─────────────────────────────────────────────────────────────────┤ │ ROUTING LAYER │ │ /route /chain /build-prompt /template │ │ │ │ These commands COMPOSE and SELECT other commands dynamically │ ├─────────────────────────────────────────────────────────────────┤ │ CATEGORICAL LAYER (F, M, W, α) │ │ /meta (Functor) /rmp (Monad) /context (Comonad) │ │ /transform (Natural Transformation) │ │ │ │ Core categorical operations: routing, refinement, context, │ │ strategy switching │ ├─────────────────────────────────────────────────────────────────┤ │ OBJECT COMMAND LAYER │ │ /debug /review /compose /select-prompt /list-prompts │ │ │ │ These commands DO THE WORK on specific tasks │ ├─────────────────────────────────────────────────────────────────┤ │ SKILL LAYER │ │ ⚡ categorical-property-testing │ │ ⚡ categorical-structure-builder │ │ ⚡ recursive-meta-prompting │ │ │ │ Skills provide SPECIALIZED KNOWLEDGE when needed │ └─────────────────────────────────────────────────────────────────┘
---
## Meta-Command Registry
| Command | Purpose | Orchestration Pattern |
|---------|---------|----------------------|
| `/meta-build` | Full feature construction | Sequential stages with parallel design |
| `/meta-fix` | Bug resolution workflow | Debug → Analyze → Fix → Verify |
| `/meta-review` | Multi-dimensional review | Parallel specialized reviewers |
| `/meta-test` | Comprehensive testing | Parallel generation, sequential execution |
| `/meta-refactor` | Safe refactoring | Incremental with verification |
| `/meta-deploy` | Deployment workflow | Staged with rollback support |
---
## Execution Modes
Commands can specify WHEN and HOW to execute referenced commands/skills:
### Timing Modes
@run:now Execute immediately, block until complete @run:background Start execution, continue without waiting @run:after:/cmd Execute after /cmd completes @run:before:/cmd Execute before /cmd starts @run:with:/cmd Execute together with /cmd (co-routine)
### Parallelism Modes
@parallel[/cmd1, /cmd2, /cmd3] Execute all in parallel, wait for all @sequential[/cmd1, /cmd2, /cmd3] Execute in order, each waits for previous @race[/cmd1, /cmd2] Execute in parallel, use first to complete @pipeline[/cmd1 | /cmd2 | /cmd3] Chain outputs: cmd1.out → cmd2.in → cmd3.in
### Conditional Modes
@if:condition:/cmd Execute /cmd only if condition true @unless:condition:/cmd Execute /cmd only if condition false @retry:3:/cmd Retry /cmd up to 3 times on failure @timeout:30s:/cmd Fail if /cmd takes longer than 30s @fallback:/cmd1:/cmd2 Try /cmd1, if fails use /cmd2
### Loop Modes
@loop:until:quality>=8:/cmd Repeat /cmd until quality threshold @loop:times:3:/cmd Repeat /cmd exactly 3 times @loop:while:errors>0:/cmd Repeat while condition holds @loop:for-each:items:/cmd Iterate over collection
---
## Categorical Operators
The DSL implements four categorical operators with verified laws:
### Sequence (→) - Kleisli Composition
A → B → C
**Semantics**: Sequential execution. Output of A becomes input of B.
**Category**: Morphism composition in Kleisli category
**Quality**: `quality(A → B) = min(quality(A), quality(B))`
### Parallel (||) - Tensor Product
A || B || C
**Semantics**: Execute all simultaneously, aggregate results.
**Category**: Monoidal tensor product ⊗
**Quality**: `quality(A || B) = mean(quality(A), quality(B))`
### Tensor (⊗) - Resource Combination
A ⊗ B
**Semantics**: Combine resources/skills with quality degradation.
**Category**: [0,1]-enriched tensor product
**Quality**: `quality(A ⊗ B) ≤ min(quality(A), quality(B))`
### Kleisli (>=>) - Monadic Composition
A >=> B >=> C
**Semantics**: Composition with iterative refinement.
**Category**: Kleisli arrow composition
**Quality**: Improves monotonically with iterations
---
## Comonad Operations (W)
The `/context` command implements Comonad W for context extraction:
### Extract (ε) - Focus on Current
/context @mode:extract @focus:recent "task"
**Semantics**: Extract focused context fr
Maintain ORCHESTRATION SPEC?
Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.
[ORCHESTRATION SPEC on getagentictools](https://getagentictools.com/loops/manutej-meta-command-orchestration-specification?ref=badge)