Back to list
danielkov

granary-orchestrate

by danielkov

A CLI context hub for agentic work

3🍴 0📅 Jan 21, 2026

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:

SituationAction
Project has no tasksUse /granary:plan-work skill to plan first
Project has tasks but they lack detailUse /granary:plan-work skill to refine
Single simple project with clear descriptionImplement directly as one task
Project has tasks with dependenciesHappy 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

  1. Get all unblocked tasksgranary next --all --json
  2. Spawn agents for ALL tasks in parallel → One Task tool call per task, all in the same message
  3. Monitor progress → Check on background agents, wait for completions
  4. 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

  1. Get overviewgranary summary
  2. Find projectgranary projects
  3. Assess readiness → Are tasks planned? If not, use plan-work skill
  4. Start sessiongranary session start
  5. Loop: delegate tasks in parallel → Use granary next --all, spawn agents for ALL unblocked tasks at once
  6. Close sessiongranary 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

50/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon