
granary-orchestrate
by danielkov
A CLI context hub for agentic work
SKILL.md
name: granary-orchestrate description: Orchestrate sub-agents and coordinate multi-agent workflows with granary. Use when delegating tasks, spawning workers, or managing parallel execution.
Orchestrating Implementation with Granary
This skill is for implementation-time orchestration. Your job is to coordinate sub-agents to implement planned work. You do NOT plan or design—you delegate and track.
Primary Use-Case
You are prompted to implement a project. Follow these steps:
Step 1: Get Granary Overview
granary summary
This shows all projects, their status, and task counts. Understand what exists before proceeding.
Step 2: Find Your Target Project
If given a project name, find it:
granary projects
granary project <project-id>
Finding Projects and Tasks
Search for projects and tasks by title:
granary search "query" # Find matching projects and tasks
granary search "api" --json # Get results as JSON
This is useful when you know part of the project or task name but not the exact ID.
Step 3: Assess Project Readiness
Examine the project structure:
granary project <project-id> tasks
Decision tree:
| Situation | Action |
|---|---|
| Project has no tasks | Use /granary:plan-work skill to plan first |
| Project has tasks but they lack detail | Use /granary:plan-work skill to refine |
| Single simple project with clear description | Implement directly as one task |
| Project has tasks with dependencies | Happy path - proceed to Step 4 |
Step 4: Start Orchestration Session
granary session start "implementing-<project-name>" --mode execute
granary session add <project-id>
Step 5: The Orchestration Loop
Your sole focus: hand off tasks to sub-agents. You do NOT implement tasks yourself.
Key principle: Maximize parallelism. Always look for opportunities to run multiple tasks concurrently. Tasks without dependencies on each other can and should run in parallel.
Check for All Unblocked Tasks
# Get ALL actionable tasks (not just one)
granary next --all --json
This returns all tasks that are ready to execute (dependencies satisfied, not blocked). Spawn agents for ALL of them in parallel.
If no tasks are returned, either all tasks are complete or remaining tasks are blocked.
Spawning Agents in Parallel
When multiple tasks are unblocked, spawn them all at once using parallel Task tool calls:
# If granary next --all returns task-1, task-2, task-3:
Use Task tool (call all three in a SINGLE message):
1. prompt: "Execute granary task task-1. Use /granary:execute-task skill."
subagent_type: "general-purpose"
run_in_background: true
2. prompt: "Execute granary task task-2. Use /granary:execute-task skill."
subagent_type: "general-purpose"
run_in_background: true
3. prompt: "Execute granary task task-3. Use /granary:execute-task skill."
subagent_type: "general-purpose"
run_in_background: true
Important: Use run_in_background: true for parallel execution. This allows multiple agents to work simultaneously.
The Loop
- Get all unblocked tasks →
granary next --all --json - Spawn agents for ALL tasks in parallel → One Task tool call per task, all in the same message
- Monitor progress → Check on background agents, wait for completions
- Repeat → When agents complete, new tasks may become unblocked
Single Task Fallback
If only one task is available or tasks must be sequential:
granary next --json
Then spawn a single agent and wait for completion before checking for the next task.
What Sub-Agents Do
Each sub-agent is responsible for:
- Building context (
granary handoff --tasks <id>) - Starting the task (
granary task <id> start) - Doing the actual implementation
- Marking the task done (
granary task <id> done) or blocked
Note: You do NOT need to run granary handoff yourself. Sub-agents handle their own context building. Your job is to identify unblocked tasks and spawn agents.
Step 6: Handle Completion
When all tasks are done:
granary session close --summary "Completed implementation of <project-name>"
Handling Edge Cases
Sub-Agent Gets Blocked
If a sub-agent cannot complete:
# Sub-agent should have blocked the task:
granary task <task-id> block --reason "..."
# You see it when checking next task
granary next --json # Will skip blocked tasks
Conflict Prevention
Sub-agents should claim tasks with leases:
granary task <task-id> claim --owner "Worker-1" --lease 30
# Exit code 4 = conflict (task claimed by another)
Checkpointing
Before risky operations:
granary checkpoint create "before-major-change"
# If things go wrong
granary checkpoint restore before-major-change
Summary
- Get overview →
granary summary - Find project →
granary projects - Assess readiness → Are tasks planned? If not, use plan-work skill
- Start session →
granary session start - Loop: delegate tasks in parallel → Use
granary next --all, spawn agents for ALL unblocked tasks at once - Close session →
granary session close
Your job is coordination, not implementation. Maximize throughput by running independent tasks in parallel. Sub-agents use granary handoff to build their own context and do the actual work—you just identify what's ready and spawn agents.
Score
Total Score
Based on repository quality metrics
SKILL.mdファイルが含まれている
ライセンスが設定されている
100文字以上の説明がある
GitHub Stars 100以上
3ヶ月以内に更新がある
10回以上フォークされている
オープンIssueが50未満
プログラミング言語が設定されている
1つ以上のタグが設定されている
Reviews
Reviews coming soon