Orchestrator Sequences
Agent Buildingorchestrator-sequencesOrchestrator Sequences is an Agent Skill for agent building published in the closedloop-ai/claude-plugins repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Canonical reusable orchestration procedures for the ClosedLoop planning/implementation orchestrators — PLAN_VALIDATION_SEQUENCE and AWAITING_USER_SEQUENCE. Single source of truth shared by prompts/prompt.md (full loop), prompts/plan-prompt.md (/code:create-plan) and prompts/execute-prompt.md (/code:execute-implementation), which each load standalone and cannot reference one another at runtime. Triggers: - An orchestrator phase needs full plan validation (structural + semantic) — run PLAN_VALIDATION_SEQUENCE. - An orchestrator reaches a hard stop that requires user action before continuing — run AWAITING_USER_SEQUENCE.
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Inspect the Agent Skill at https://github.com/closedloop-ai/claude-plugins/blob/HEAD/plugins/code/skills/orchestrator-sequences/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/orchestrator-sequences, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
Orchestrator Reusable Procedures
These two procedures are referenced by name throughout the orchestrator prompts (prompt.md, plan-prompt.md, execute-prompt.md). They live here as the single source of truth so a change propagates to all three orchestrators at once. Substitute $CLOSEDLOOP_WORKDIR with the literal resolved workdir path in any subagent prompt (never the literal string $CLOSEDLOOP_WORKDIR).
PLAN_VALIDATION_SEQUENCE
Use this sequence whenever a phase needs full plan validation (structural + semantic):
- Activate
code:plan-validateskill (runs Python script against $CLOSEDLOOP_WORKDIR) - If
FORMAT_ISSUES: launch @code:plan-writer to fix format issues, then re-activatecode:plan-validate - If
VALID: launch @code:plan-validator with prompt: "WORKDIR=$CLOSEDLOOP_WORKDIR. SEMANTIC ONLY: Check semantic consistency of $CLOSEDLOOP_WORKDIR/plan.json — verify storage/query alignment and task/architecture decision consistency. Skip structural validation (already passed)." - If semantic check finds issues: launch @code:plan-writer to fix, then re-activate
code:plan-validate
AWAITING_USER_SEQUENCE
Use this sequence at any hard-stop that requires user action before continuing. The caller supplies the per-site phase, reason, file (path or null), and command (the resume command — built from the resolved CLOSEDLOOP_ORIGINAL_ARGS value, never the literal string $ARGUMENTS):
- FIRST — Write state.json with AWAITING_USER status:
echo '{"phase": "<current phase>", "status": "AWAITING_USER", "reason": "<why>", "userAction": {"description": "<what user should do>", "file": "<path or null>", "command": "<resume command>"}, "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"}' > $CLOSEDLOOP_WORKDIR/state.json - Record the native-command terminal iteration once:
bash "$CLAUDE_PLUGIN_ROOT/scripts/record_native_iteration_once.sh" "$CLOSEDLOOP_WORKDIR" 2>/dev/null || true - ONLY AFTER state.json is written — Output your command's completion promise:
<promise>PLAN_COMPLETE</promise>for/code:create-plan,<promise>IMPLEMENTATION_COMPLETE</promise>for/code:execute-implementation, or<promise>COMPLETE</promise>for the full/code:codeloop. Use the single promise token defined by your own prompt. - Tell the user what to do (review file, fix issues, run command)
- HARD STOP — Do not continue even if the user asks