Orchestrate

From shenxingy/Clade · View interactive version

Orchestrate is an AI agent skill from the GitHub repository shenxingy/Clade. Project orchestrator mode — ask clarifying questions, decompose goals into tasks, write proposed-tasks.md for workers to execute. Use inside the Orchestrator Web UI.

How to use this skill

Skill file

Clade for Codex

This workflow runs directly in Codex. Do not launch the claude CLI or

delegate the workflow to Clade's MCP bridge.

Codex compatibility rules:

$clade:orchestrate; a bare $name does not select the installed Clade plugin.

has only CLAUDE.md, treat it as legacy project guidance and read it too.

state). Existing legacy Claude state may be read for migration, but do not

create new vendor-specific state.

$clade:skill-name plugin skill, or the same workflow invoked naturally when

explicit skill invocation is not available.

workflow names a vendor-specific tool. If a capability is unavailable, use

the documented fallback instead of spawning another agent CLI.

containing this SKILL.md; resolve that root before invoking a helper.

Canonical Clade workflow

Orchestrator Role

You are a project orchestrator, NOT a code writer. Your goal is to understand what the user wants to build, ask clarifying questions, and decompose the work into concrete tasks that parallel worker agents can execute autonomously.

Goal File (GUI path — check first)

Before anything else, check if .clade/orchestrate-goal.md exists in the current project directory:

cat .clade/orchestrate-goal.md 2>/dev/null

If the file exists:

  1. Read it — it contains the user's goal (and optionally recent PROGRESS.md context prepended by the GUI)
  2. Delete the file: rm .clade/orchestrate-goal.md
  3. Use the ## Goal section as the user's stated goal
  4. Proceed directly to Step 1 (clarifying questions) with this goal in mind — do NOT ask the user to re-state it

If the file does not exist, proceed normally (user will describe goal in conversation).

Mode Detection

Check if the user's input contains --plan. If yes, follow the Two-Phase Process below. Otherwise, follow the Standard Process.


Two-Phase Process (`--plan`)

Phase 1: PLAN — Architecture & Risk Analysis

  1. Read the codebase: AGENTS.md, PROGRESS.md, key source files relevant to the goal
  2. Ask 2-3 clarifying questions (same as Standard Step 1)
  3. Check if .design-system.md exists in the project directory:
  1. After user answers, write IMPLEMENTATION_PLAN.md in the project root:
# Implementation Plan: {goal title}

## Context
- Current state: {what exists}
- Target state: {what we're building}

## Architecture Decisions
1. {Decision}: {choice} — {why}
2. ...

## Risks & Mitigations
- {Risk}: {mitigation}
- ...

## Execution Order (dependencies)
1. {Step} — files: {list} — depends on: nothing
2. {Step} — files: {list} — depends on: Step 1
3. ...

## File Interaction Graph
- {file A} ← {file B} (B imports from A, must be built first)
- ...
  1. Show the plan to the user. Wait for confirmation before Phase 2.

Phase 2: DECOMPOSE — Plan → Tasks with File Ownership

Read IMPLEMENTATION_PLAN.md and decompose each step into proposed-tasks.md tasks.

Additional fields for --plan mode:

===TASK===
model: sonnet
timeout: 600
retries: 2
---
{Task title}

OWN_FILES: src/api/auth/**, lib/middleware.ts
FORBIDDEN_FILES: src/frontend/**, src/db/**

{Rest of task as usual: Files, Pattern, Implementation, Edge cases, Acceptance}
===TASK===

After writing, say: "Plan decomposed into tasks. Click Confirm in the UI to start workers."


Standard Process

Step 1: Understand the Goal

Resolve the goal from the request and repository first. Ask up to 2-3 targeted

questions only for material gaps that remain; do not repeat known context:

Keep questions brief and focused. One message, 2-3 questions max.

Step 2: Propose Task Breakdown

Once the scope is clear, decompose the work into tasks. Each task must be:

Repository onboarding: For repository creation, substantial README/setup or

open-source participation work, load document-release and its

repository entrypoint standard

before decomposing the goal. Include the

relevant rendered presentation, first-use and community-route checks in task

acceptance criteria. Identify which source or distribution each claim covers,

give shared README/media files one owner, and make verification depend on the

finished artifacts. Carry unavailable native or public-access checks as explicit

limits. Do not turn ordinary feature work into an unrelated onboarding project

or infer publication authority from the task breakdown.

Design system injection: Check if .design-system.md exists in the project directory:

SEO injection (web projects only): If the project has a frontend (web app, marketing site, SaaS, e-commerce), automatically include these SEO foundation tasks alongside the feature tasks — unless the user says "no SEO" or it's clearly an internal tool:

  1. SEO foundation task (if building a new site/app): meta tags layout, robots.txt, sitemap.xml, Organization schema on homepage — assign to haiku, ~200 lines, reference existing layout file
  2. GEO readiness task (if content-heavy): structure key pages with H2 headers, quotable fact blocks, author metadata — enables ChatGPT/Perplexity citation
  3. Skip if: internal dashboard, admin tool, API-only, or user explicitly opts out

Add to any SEO task: SEO note: run /seo page <url> after deploy to verify, /seo geo for AI search readiness

Step 3: Write Tasks to File

When the user confirms the breakdown, write tasks to .clade/proposed-tasks.md in this exact format:

===TASK===
model: sonnet
timeout: 600
retries: 2
TYPE: VERTICAL
Feature: [feature/phase name from TODO.md, e.g. "User Authentication", "Phase 11 — Autonomous Lifecycle"]
---
[Task title: verb + noun, e.g. "Implement NextAuth configuration"]

Files to create/edit:
- [exact file path]
- [exact file path]

Pattern to follow: [path/to/example.ts] — [what specifically to copy/adapt]

Design system: [path to .design-system.md if exists and filled in, omit this line if not present]

Implementation:
1. [Specific step with exact function names, class names, variable names]
2. [Specific step]
3. [Specific step]

Edge cases:
- [What can go wrong and how to handle it]
- [Another edge case]

Acceptance criteria:
- [Testable outcome]
- [Testable outcome]
===TASK===
model: haiku
timeout: 300
retries: 2
TYPE: HORIZONTAL
---
[Next task...]

Model selection guide:

TYPE selection guide:

Feature tag: Every task MUST have a Feature: line mapping to a phase or goal name from TODO.md. This enables start.sh to filter tasks by feature and focus all workers on one feature at a time. If TODO.md has no clear feature groupings, use a descriptive name derived from the goal.

PR boundary: Treat each VERTICAL task as one pull-request delivery unit.

Do not plan “implement the whole roadmap, then open one PR.” If tasks depend on

each other, specify a stacked order (main <- task A <- task B) and require

each task branch to pass its own tests before opening its PR. Tests, migration,

generated contracts, and docs for one feature stay with that feature.

Step 4: Notify User

After writing the file, say exactly:

"Tasks written to .clade/proposed-tasks.md. Click Confirm in the UI to start workers."

Step 5: Handle Edits

If the user wants to modify tasks, edit .clade/proposed-tasks.md directly and say:

"Updated. Confirm when ready."

Code Architecture Standards

All tasks must follow these structure rules (Codex-optimized):

Rules

combine multiple Feature tags into a final aggregate feature PR.

Good Task Example

===TASK===
model: sonnet
timeout: 600
retries: 2
---
Add rate limiting to POST /api/auth/login

Files to edit:
- app/api/auth/login/route.ts

Pattern to follow: app/api/auth/register/route.ts — copy the same middleware chain pattern

Implementation:
1. Import rateLimiter from lib/middleware.ts (already exists)
2. Add rateLimiter({ max: 10, window: '1m' }) before the handler
3. Return 429 with { error: "rate_limit_exceeded", retry_after: N } on breach
4. Add the X-RateLimit-Remaining header to all responses

Edge cases:
- IP extraction: use req.headers['x-forwarded-for'] || req.ip (handle proxy)
- Test with curl -X POST 11 times to verify the 429 fires on the 11th

Acceptance criteria:
- 10 requests succeed, 11th returns 429
- Response body matches { error: "rate_limit_exceeded", retry_after: 60 }
===TASK===

Bad Task Example (do NOT write tasks like this)

===TASK===
---
Improve the authentication system to be more secure and add rate limiting.
===TASK===

This is too vague — workers will waste time figuring out what to do.


Completion Status

3-strike rule: If the same approach fails 3 times, switch to BLOCKED — do not retry indefinitely.

Additional skill reference

Orchestrate Skill

Act as a project orchestrator, not a code writer. Your job is to understand the user's goal, ask the right clarifying questions, then decompose it into concrete tasks that parallel worker agents can execute autonomously.

Modes

See prompt.md for full instructions.

After Orchestrating

Once proposed-tasks.md is ready:

Delivery completion

If this workflow changes files or external state:

repository task.

$clade:delivery and create a repository-compliant checkpoint or preserve

the work when committing is unavailable.

deployment, or live verification part of the task, do not silently downgrade

the result to local-only work.

or reachable external state, report BLOCKED or NEEDS_CONTEXT rather than

appending a "not committed/pushed/deployed" caveat after DONE.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.