A hook-based framework for Claude Code that enforces task delegation to specialized agents, enabling structured workflows and expert-level task handling through intelligent orchestration. See the delegation system in action:
> /plugin marketplace add barkain/claude-code-workflow-orchestration
Repo: barkain/claude-code-workflow-orchestration
What's inside
A hook-based framework for Claude Code that enforces task delegation to specialized agents, enabling structured workflows and expert-level task handling through intelligent orchestration.
See the delegation system in action:
⚡ Soft Enforcement & Lean Startup — Replaces hard-blocking enforcement with adaptive per-turn nudges (silent → hint → warning → strong reminder). SessionStart injection trimmed ~6.6K tokens: stub orchestrator (~1.1KB) injected on startup, full orchestrator loaded only on first delegation. Output style loaded natively from plugin.json (no injection). Net result: lean sessions with automatic escalation when delegation is needed.
🤝 Agent Teams Integration — Native dual-mode execution: workflows automatically select between isolated subagents and collaborative Agent Teams (via TeamCreate + Agent(team_name=...) + SendMessage) based on tool availability. Teammates communicate in real-time, share task lists, and self-coordinate. Enable with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1.
This system uses Claude Code's hook mechanism to create a delegation-enforced workflow architecture that routes tasks to specialized agents for expert-level execution.
/workflow-orchestrator:delegate. Subagents immune. Nudge counter resets each turn and zeros when delegation runs.TeamCreate + Agent(team_name=...) + SendMessage for peer-to-peer collaboration, shared task lists, and coordinated multi-agent workflowsThe system uses a two-stage execution pipeline:
Stage 0: Planning & Analysis (native plan mode)
Stage 1: Execution
DONE|{path}. Context-efficient, optimal for most workflows.TeamCreate + Agent(team_name=...). Teammates share context, communicate via SendMessage, and self-coordinate through shared task lists. Requires CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1.Execution Mode Selection: If TeamCreate is in available tools → execution_mode: "team". Otherwise → "subagent". Tool availability is the only signal (set CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 to enable). For subagent mode, plan mode further selects sequential (context preservation, dependencies) or parallel (time savings, independence) based on phase dependency analysis.
curl -LsSf https://astral.sh/uv/install.sh | sh
curl -fsSL https://bun.com/install | bash
# macOS
brew install jq
# Linux
sudo apt install jq
Python 3.12+ is required. All hooks use cross-platform Python scripts.
Python: https://www.python.org/downloads/
python --versionpowershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
powershell -c "irm bun.sh/install.ps1 | iex"
# Using Chocolatey
choco install jq
# Or download from https://jqlang.github.io/jq/download/
Note: The hook system uses Python scripts for cross-platform compatibility. Ensure python is available in your PATH.
This project provides a comprehensive delegation system for Claude Code with multi-agent orchestration. Choose your preferred installation method:
The easiest way to install is via Claude Code's plugin system:
# Add the marketplace
claude plugin marketplace add barkain/claude-code-workflow-orchestration
# Install the plugin
claude plugin install workflow-orchestrator@barkain-plugins # user-level
# or
claude plugin install workflow-orchestrator@barkain-plugins --scope project # project-level
Benefits:
Optional Settings:
/workflow-orchestrator:add-statusline after installation to enable workflow status displaytechnical-adaptive output style optimized for workflow orchestration. To select it, configure outputStyle in your Claude Code settings (project or user level)Note: Changing the output style requires restarting your Claude Code session for the change to take effect.
For development or custom configurations:
# Clone the repository
git clone https://github.com/barkain/claude-code-workflow-orchestration.git
For project-isolated configurations or version-controlled delegation setups:
cd path/to/project
path/to/repo/install.sh # follow the installation instructions
Windows users: The install.sh script requires bash (Git Bash or WSL). For Windows, we recommend using the Plugin Installation method above, which works natively on all platforms.
Once installed, the delegation hook is automatically active. Simply use Claude Code normally (Opus 4.5 is preferred):
# Multi-step workflow - enable orchestration for context passing
claude
and then prompt claude with:
> create a simple calculator app with basic math operations.
add a nice UI and use NextJS/Tailwind to build this out.
the backend should be implemented in python as a modern uv project.
add verification steps after each phase.
What happens:
The main agent enters native plan mode (EnterPlanMode) to decompose the request, assign specialized agents via keyword matching, schedule waves, and select an execution mode. Mode selection is one rule: if TeamCreate is available (CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1), it picks team mode; otherwise parallel subagents.

After ExitPlanMode approval, a dependency graph is rendered showing the parallel waves and the agents assigned to each phase:

In team mode, the lead calls TeamCreate once and then spawns each phase as a persistent teammate via Agent(team_name=...). Teammates run concurrently in the swarm session and self-coordinate via SendMessage. Open the swarm view with tmux -L claude-swarm-<id> a to watch them work in real time:

As each wave completes, downstream phases unblock automatically. A final integration/verification phase confirms end-to-end correctness, then the team shuts down cleanly:

The delegation system uses adaptive nudges instead of hard blocks:
# 1st direct tool call (imperative STOP)
Read test.py
# stderr: "STOP. This tool call bypasses delegation. Abandon this step and run: /workflow-orchestrator:delegate <your task>"
# 2nd direct tool call (imperative STOP, 2nd-call phrasing)
Read other.py
# stderr: "STOP. 2nd direct tool call this turn. The main agent does not execute work tools. Run: /workflow-orchestrator:delegate <your task>"
# 3rd direct tool call (strong reminder — explains what's being lost)
Edit file.py
# stderr: "STOP. 3 direct tool calls bypassing delegation. You are losing planning, parallelization, and context isolation. Abandon the current plan and run: /workflow-orchestrator:delegate <your task>"
# 4th+ direct tool calls keep the same strong reminder with the updated count
Bash command.sh
# stderr: "STOP. 4 direct tool calls bypassing delegation. ..."
# Delegation resets the counter (state clean)
/workflow-orchestrator:delegate "Create feature"
# Counter zeros. Next turn starts fresh.
Counter resets each user turn and zeros when /workflow-orchestrator:delegate runs. Subagents are immune. Use /workflow-orchestrator:bypass for emergency access without restarting.
The system supports several environment variables for configuration and debugging:
Tasks API Configuration:
CLAUDE_CODE_ENABLE_TASKS=true # Enable Tasks API (default: true)
CLAUDE_CODE_TASK_LIST_ID=list_id # Share task list across sessions
CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1 # Disable async background tasks
Agent Teams (Experimental):
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 # Enable Agent Teams dual-mode execution
Token Efficiency:
CLAUDE_TOKEN_EFFICIENCY=1 # Enable token-efficient CLI output (default: 1)
Debug & Control:
DEBUG_DELEGATION_HOOK=1 # Enable hook debug logging
DELEGATION_HOOK_DISABLE=1 # Emergency bypass (disable enforcement)
CLAUDE_MAX_CONCURRENT=8 # Max parallel agents per batch (default 8)
CHECK_RUFF=0 # Skip Ruff validation in PostToolUse
CHECK_PYRIGHT=0 # Skip Pyright validation in PostToolUse
CLAUDE_SKIP_PYTHON_VALIDATION=1 # Skip all Python validation
FAQ
workflow-orchestrator is a Claude Code plugin with hand-picked skills for development work, indexed on Flowy. Install it with the command on its page. Its skills do not fire on their own yet. Request auto-invocation to have Flowy route them as you prompt. Free and open source.
Is this plugin yours?
Claim it with GitHubSubmit a pluginPromote it