agentleFS
Hive-AcademyHive-Academy/PtahCode/.claude/skills/orchestration/SKILL.md

orchestration

Skill34 starsChanged 10 days agoMITView on GitHub

Default workflow for any engineering task (feature, bugfix, refactor, docs, research, devops, SaaS init, creative) — phased plan with user checkpoints on subagents or CLI lanes, including X plans, Y implements, Z reviews. Not for multi-vendor second opinions — use tribunal.

47 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use orca-cli, orca-per-workspace-env and 8 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • HK-hubSkill

    orca-cli

    Use the public `orca` CLI to operate Orca-managed worktrees, folder contexts, terminals, repos, automations, artifacts, worktree comments, and the browser embedded inside the Orca app. Use when the user says "$orca-cli", "use orca cli", "Orca worktree", "child worktree", "cardStatus", "spawn codex/claude in a worktree", "read/wait/send Orca terminal", "terminal send", "full handoff", "handover", "give this to another agent", "another worktree", "Orca browser", "orca artifacts", "share HTML/Markdown", "public artifact link", or "control the browser inside Orca". Prefer this over raw `git worktree`, ad hoc PTYs, Playwright, or Computer Use when the task touches Orca-managed state. Use Computer Use for browser windows, webviews, or desktop UI outside Orca's embedded browser.

    Also in 5 projects that use this

  • stablyaiSkill

    orca-per-workspace-env

    Set up, review, debug, or validate an Orca per-workspace environment recipe: the on-demand, disposable runtime (cloud sandbox, VM, SSH host, or local container) Orca creates fresh for each workspace. Use to stand up a new recipe end to end, fix an `environmentRecipes` entry in `orca.yaml`, scaffold provider lifecycle scripts, or resolve an `orca vm recipe doctor` failure. Use `orca-cli` for ordinary worktree and workspace creation with no recipe involved.

    Also in 3 projects that use this

  • HK-hubSkill

    computer-use

    Use Orca's computer-use CLI to inspect and operate local desktop app windows through accessibility trees, screenshots, and safe UI actions. Use for desktop app interaction: list apps/windows, get app state, read visible UI, click controls, type, press keys, scroll, drag, set values, or perform accessibility actions. Also use for browser windows, webviews, Orca app UI, or other desktop UI. Triggers include "computer use", "orca computer", "read Spotify", "read Slack", "control/click/read in a desktop app", and "get app state".

    Also in 6 projects that use this

  • kongyo2Skill

    prompt-engineering

    Comprehensive prompt engineering framework for designing, optimizing, and iterating LLM prompts. This skill should be used when users request prompt creation, optimization, or improvement for any LLM task, or when users need help translating vague requirements into effective prompts through collaborative dialogue and iterative refinement.

    Also in 3 projects that use this

  • AnthropicSkill

    wrap-up

    Close out (or revisit) a Claude Managed Agent build — refresh the overview page, recap every primitive the founder now owns, show the run log and live status, suggest 1–2 tailored next upgrades, and sweep hygiene (sessions archived, key only in .env, no literal dates in deployment kickoffs). Use when the founder says "/wrap-up", "wrap up", "close it out", "where do things stand with my agent", or at the end of a /launch-your-agent build.

    Also in 3 projects that use this

  • GoogleSkill

    codebase-design

    Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.

    Also in 4 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

21 rules. 0 are common, 10 are distinctive, and 11 are very specific to this project.

  • 0

    Common

    Most of the 41 edited versions we read keep these.

  • 10

    Distinctive

    This author's own choices. Worth a look.

  • 11

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Every decision taken at steps 1–2 goes in <taskFolder>/decisions.md with its evidence.

    line 84
  2. Very specific:

    Every Task() prompt carries Task Folder, a Deliverable: absolute path and the instruction to reply WROTE: <path> + a one-line verdict.

    line 130
  3. Very specific:

    Subagent handoffs: when you re-spawn an agent that Ptah stopped, put the pending handoff record path (from the Ptah pointer line or the …

    line 138
  4. Very specific:

    Subagent outcomes: if ptah_outcome_report is listed, call it once after each Agent run with {kind:'deliverables', target, paths, taskKind, …

    line 140
  5. Very specific:

    Review verdicts: if ptah_outcome_report is listed, call it after each review verdict with {kind:'review', target:{runId:<kept reviewed-run …

    line 148
  6. Very specific:

    Never let a spec/design/plan reach implementation without its gate decision: an approving cross-side review in lane-review mode, or the …

    line 155
  7. Distinctive:

    Never let a reviewer approve a proposed removal — removals always go to the user.

    line 157
  8. Very specific:

    Never delete a capability that is not an approved removal in parity-inventory.md or the lane preserve list.

    line 158
  9. Distinctive:

    Never present Gate 1, 1.7 or 2 without the cross-side review.

    line 159
  10. Very specific:

    Never let an agent's claim stand in for the build: run typecheck, tests and lint before reporting done — scoped to the projects changed …

    line 161
  11. Distinctive:

    Never answer a user-reserved question on the user's behalf, and never ask the user a question that evidence or a peer settled — run Gate SR.

    line 163
  12. Very specific:

    Never take an unlogged decision: no row in decisions.md, no decision.

    line 165
  13. Distinctive:

    Never bypass a commit hook without the user's choice (git-standards.md).

    line 166
  14. Distinctive:

    Never commit to or merge into main on your own.

    line 167
  15. Distinctive:

    Every tool call in any agent or lane resends its whole thread, so cost is requests × context.

    line 171
  16. Very specific:

    Keep tool output small: no full logs, no whole-directory listings, no cat of large files.

    line 175
  17. Distinctive:

    No polling loops: act on the completion signal.

    line 176
  18. Very specific:

    Use ptah_ast_analyze / ptah_context_enrich_file before a full Read.

    line 181
  19. Distinctive:

    Risk-based review: No per-batch review: each batch passes its scoped typecheck, lint and tests before commit.

    line 191
  20. Distinctive:

    Final PR review: Before the first push, run one independent code-logic review of the whole task diff at the current HEAD (git diff …

    line 200
  21. Distinctive:

    Short updates: Keep orchestrator messages brief.

    line 210

“Common” is measured: kept by at least 6 in 10 of the 41 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Orchestration

You are the orchestrator. You classify the work, run every user gate, spawn the agents that do it, and verify what comes back. Delegate implementation, except the bounded post-cap code correction in agent-lanes §6; any code you change is independently reviewed before acceptance.

Pre-flight (run first)

  1. Classify the request. When several rows match, the higher row wins.

    KeywordsType
    new SaaS, multi-tenant, scaffold workspaceSAAS_INIT
    CI/CD, pipeline, Docker, Kubernetes, deployDEVOPS
    landing page, marketing, brand, visualCREATIVE
    implement, add, create, buildFEATURE
    fix, bug, error, issueBUGFIX
    refactor, improve, optimizeREFACTORING
    document, readme, guideDOCUMENTATION
    research, investigate, analyzeRESEARCH
  2. Pick depth: Full (unclear scope), Partial (known requirements), Minimal (one developer or reviewer). Two types equally plausible, or none fits → pick the broader flow, log it in decisions.md and announce it; the user can redirect. The host may already have run pre-flight routing. When a Routing: system reminder is present, use its taskType and depth suggestions unless the user says otherwise; do not call stage pre-flight again. Otherwise, if ptah_route_decide is listed, call it once with {stage:'pre-flight', request}. Use non-null taskType.value and depth.value; for null values, use the rules above. An explicit user choice wins. Record the choice and any user override in decisions.md, along with each answer's source, confidence, fallbackCause and modelProposal, plus overallConfidence, reasons and usage. If the tool is not listed, use the rules above.
  3. Announce type, depth and the planned agent sequence. Then proceed.
TypeFlow
FEATUREPM → [research] → [designer → prototype → Gate 1.7] → architect → team-leader → QA
BUGFIX[research] → team-leader → QA
REFACTORINGarchitect → team-leader → QA
DOCUMENTATIONPM → developer → style reviewer
RESEARCHresearcher → [switch to FEATURE]
DEVOPSPM → architect → devops-engineer → QA
SAAS_INITdiscovery → PM → architect → team-leader
CREATIVE[designer → prototype → Gate 1.7] → content writer → frontend developer

Any flow adding or redesigning a UI surface inserts [designer → prototype → cross-side review → Gate 1.7] before the next phase of the flow (architect, team-leader, or content writer). Complete any required inventory first (Task folder below). Any UI change that adds or redesigns no surface requires no prototype and skips the designer and Gate 1.7; its completion requires before/after screenshots (dark + light) of the affected screen instead of a prototype — capture the before screenshots from the base commit (or before the first batch / before the fix lands) with the visual-reviewer.

Task folder

  • /orchestrate TASK_YYYY_NNN[_xxxx] → continuation: detect the phase from the folder contents (task-tracking.md § Continuation).
  • /orchestrate TASK_A TASK_B ... or an explicit fleet request → validate every task ID before spawning, then load fleet.md. One ID keeps ordinary continuation.
  • Anything else → new task: allocate the ID and create task.md first, then context.md (task-tracking.md § New task).
  • parity-inventory.md is REQUIRED when replacing, consolidating, rebuilding or redesigning an existing surface. PM writes it from the OLD code before design starts. In flows without a PM (including BUGFIX and REFACTORING), the orchestrator first invokes software-architect in inventory-only mode to write it before the designer. For flows with a plan, the architect's plan phase runs after any required Gate 1.7 as usual; BUGFIX remains plan-free. Columns: capability, where today (file:line), backing RPC/API, decision (keep/move/remove-proposed), new location, test that proves it. Record user approval for removals.
  • Status changes: Edit exactly the status: line of task.md. Never rewrite the carrier.

Decide first, ask last

Agents decide from what exists; the user gets only the decisions that are theirs. Every open decision runs the decision ladder:

  1. Evidence — the task folder, code and conventions, project docs, ptah_memory_search, ptah_web_search. One defensible answer → decide.
  2. Peer — still open or costly to undo → a cross-side reviewer validates the proposed decision.
  3. User — only a user-reserved decision (scope intent, removals, irreversible or outward actions, security/privacy/licensing, money, breaking public changes, hook bypass) or a split the peer could not settle. One bundled AskUserQuestion call.

Every decision taken at steps 1–2 goes in <taskFolder>/decisions.md with its evidence; gate notices and the completion summary list them so the user can audit and overturn any of them.

Gates (all yours — subagents and lanes cannot reach the user)

GateWhenHow
0.1 CLI lanesStart; search execution preference with ptah_memory_search, then read request, settings and ptah_agent_listNotice, no wait (no-preference default enabled when a capable lane is spawnable)
0 ScopeBefore PM, if the request is ambiguousDecision ladder; ask only for scope intent
1 RequirementsAfter task-description.mdPer approval mode (below)
1.5 TechnicalBefore architect, if several valid approachesDecision ladder; ask only if user-reserved
1.7 DesignAfter design-spec.md and prototype/, before the next phase of the flow (architect, team-leader, or content writer); mandatory whenever a designer ran or any UI surface is added/redesignedPer approval mode (below)
2 ArchitectureAfter implementation-plan.mdPer approval mode (below)
3 QA selectionAfter team-leader completionNotice, agents chosen by rule
SR QuestionsAn agent messaged a question or returned ## Clarifications NeededDecision ladder, answer back via messaging

At Gate 0.1, a current explicit instruction wins. For conflicting or stale memory, use the most recent unambiguous preference; if still unresolved, ask. With no preference and a spawnable capable lane, select enabled; auto stays selectable. If memory is unavailable, record preference unknown and use that no-preference default. If a stored preference wants lanes but none is spawnable, select disabled, tell the user why, and set Approval: user. Record the preference source, mode, approval mode and ptah_agent_list rows in context.md.

Document gates 1, 1.7 and 2 require cross-side review: you invoke an independent reviewer on the other execution side (routing and disclosed fallback per agent-lanes §6), then run the bounded revision protocol in checkpoints.md. The gate shows who wrote it, who reviewed it, the verdict and any open items.

Shipping code receives a separate independent code-logic review on the phase diff. Choose a capable different-family reviewer when available; record the specific reason and weaker-evidence label for any same-family or subagent fallback. Do not apply the document gate approval mode to code.

Approval mode for document Gates 1, 1.7 and 2 (set at Gate 0.1, recorded in context.md; checkpoints.md § Approval mode):

  • lane-review — a spawnable lane exists and lanes are enabled or auto. The cross-side reviewer's APPROVED passes Gates 1, 1.7 and 2: post a short notice and continue without waiting.
  • user — no spawnable lane, lanes disabled, or the user asked to approve gates. Present the gate as a plain message and wait for the user's APPROVED.
  • Escalate to the user in either mode when the reviewer is still at REVISE after the cap, the review was not cross-side, the artifact proposes a removal, or the user asked to see the gate.

Templates, skip conditions and rejection handling: checkpoints.md.

Invoking agents

  • Every Task() prompt carries **Task Folder**, a **Deliverable**: absolute path and the instruction to reply WROTE: <path> + a one-line verdict. Shape and filenames: agent-catalog.md § Invocation.
  • Team-leader is advisory and spawns nothing. Each return ends in a ### Next action: line — do exactly that: team-leader-modes.md.
  • CLI lanes: Gate 0.1 decides whether they are used. Who may spawn them and how phases, batches or whole runs are assigned to lanes: lane-assignment.md. How to run a lane: the agent-lanes skill.
  • Subagent handoffs: when you re-spawn an agent that Ptah stopped, put the pending handoff record path (from the Ptah pointer line or the subagent-handoff-*.md stub) in its prompt.
  • Subagent outcomes: if ptah_outcome_report is listed, call it once after each Agent run with {kind:'deliverables', target, paths, taskKind, taskId, routingSource}. Take target from that run's Agent result: the Ptah ptah-run: runId=... tag gives {runId}; otherwise use the result's agentId as {agentId}. If neither exists, skip the report. Keep the runId with each run, including concurrent and repeated runs, and report background runs when their completion arrives. taskKind is one of plan, implement, review, research, tests, docs; use the Gate 0.1 row's taskKind and source when present. held and queued count as reported; do not repeat the call.
  • Review verdicts: if ptah_outcome_report is listed, call it after each review verdict with {kind:'review', target:{runId:<kept reviewed-run id>}, verdict}. For a lane run without a kept runId, use target:{agentId:<lane agent id>}. Verdict is approved, rejected or revise. Skip either optional tool silently when it is not listed.

Never

  • Never let a spec/design/plan reach implementation without its gate decision: an approving cross-side review in lane-review mode, or the user's APPROVED in user mode or on escalation.
  • Never let a reviewer approve a proposed removal — removals always go to the user.
  • Never delete a capability that is not an approved removal in parity-inventory.md or the lane preserve list.
  • Never present Gate 1, 1.7 or 2 without the cross-side review; a same-side review states its recorded reason (user pin, lanes disabled at Gate 0.1, or opposite side unavailable).
  • Never let an agent's claim stand in for the build: run typecheck, tests and lint before reporting done — scoped to the projects changed with -p, output tailed; never workspace-wide.
  • Never answer a user-reserved question on the user's behalf, and never ask the user a question that evidence or a peer settled — run Gate SR.
  • Never take an unlogged decision: no row in decisions.md, no decision.
  • Never bypass a commit hook without the user's choice (git-standards.md).
  • Never commit to or merge into main on your own.

Token economy

Every tool call in any agent or lane resends its whole thread, so cost is requests × context.

  • Verification is scoped: nx run-many -t <target> -p <changed projects>, output tailed or filtered to the header, failures and summary.
  • Keep tool output small: no full logs, no whole-directory listings, no cat of large files.
  • No polling loops: act on the completion signal. If push is unavailable, re-check at most 5 times per lane, at least 60 s apart, then tell the user the lane is still running or stop it (agent-lanes §4).
  • Lanes are narrow and get their file list up front (agent-lanes §8 batch cap and tool-call ceiling); a lane that explores the workspace is the expensive lane.
  • Use ptah_ast_analyze / ptah_context_enrich_file before a full Read; read whole files only when editing them.

Lean orchestration rules

  1. Fresh team-leader per Mode 2/3 call. Give it only the batch report path, plus the review path when you return with a phase review verdict. Never resume a long-lived team-leader.
  2. Resume only inside the cache window. Resume a developer or reviewer only when its last activity was under 5 minutes ago. Otherwise start a fresh one with the batch section and the report paths.
  3. Risk-based review. No per-batch review: each batch passes its scoped typecheck, lint and tests before commit. One independent code-logic review per phase, on the combined diff, by a capable reviewer from a different family than the implementer when available. Same-family review needs a specific reason and a weaker-evidence label; record the Review family. Batches that change only types, tests, docs or measurement get no review. Add a style review only for new public API.
  4. One fix round. Blocking and Serious are fixed in one round. Moderate is fixed only if it can break a lane config or lose data; otherwise it becomes a named later task. Minor is fixed in the same round when the fix is local (one file, no contract or public API change); otherwise it is recorded. After the round, one short re-review scoped to the fixes.
  5. Final PR review. Before the first push, run one independent code-logic review of the whole task diff at the current HEAD (git diff main...HEAD). The reviewer's family differs from every family that wrote code in that diff; when none is left, a same-family reviewer needs a specific reason and a weaker-evidence label. It covers what phase reviews skip: fix-round commits, batches that change only types, tests or docs, and the callers of each changed export outside the diff, which the reviewer finds with ptah_lsp_references (ptah_get_dependents only widens the candidate files). This review gets its own fix round under the severity rules of rule 4, inside the revise cap of agent-lanes §6, which it does not reset. Re-review the fix commits, then push. Defects still open after that round go to the user before any push. Skip this review only when the run had one phase and no commit followed that phase review.
  6. Short updates. Keep orchestrator messages brief; no status message per notification.

References — load on demand, never all at once

ReferenceLoad when
strategies.mdRunning a strategy's phases
checkpoints.mdPresenting any gate
agent-catalog.mdChoosing or invoking an agent
team-leader-modes.mdInvoking team-leader or acting on its return
task-tracking.mdCreating or continuing a task folder
lane-assignment.mdGate 0.1 enabled lanes, or the user pinned a phase to a lane
fleet.md/orchestrate TASK_A TASK_B ... or an explicit fleet request; validate IDs first
git-standards.mdWriting a commit or handling a hook failure

Requires

  • agent-lanes — lane mechanics, when any CLI lane runs. If it is not installed, tell the user to enable the agent-lanes skill, and run the task with subagents only until they do.

For a high-stakes change whose acceptance bar can be written down in advance, offer the tribunal skill's Crucible move.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.