New advertisers: 50% off your first month with code FIRSTMONTHSee slots

Delegation framework that routes Claude Code tasks to external LLMs while keeping strategic control.

version
1.10.3
GitHub stars
350
View on GitHub

What it does

  • Adds delegate-auto and per-provider delegate-<service> targets for Gemini, Qwen, MiniMax, GLM, Muse, Codex, OpenCode, and Glimmer
  • Covers readiness checks through delegate-setup, delegate-doctor, and delegate-install, with each install gated on confirmation
  • Enforces a fallback where unavailable providers return providers_exhausted, so the caller completes the work itself
  • Designed for developers who want cheaper models on bulk analysis while keeping quota tracking and usage logs

Delegate tasks to external LLMs (Gemini, Qwen) with cheapest-capable model selection while retaining strategic oversight

Add marketplace

/plugin marketplace add athola/claude-night-market

Run it inside Claude Code once, then install the plugin below.

Install

/plugin install conjure@claude-night-market

Run it inside Claude Code after adding the marketplace.

Files

Discovered from source

Agent Teams Coordination

Overview

Claude Code Agent Teams enables multiple Claude CLI processes to collaborate on shared work through a filesystem-based coordination protocol. Each teammate runs as an independent claude process in a tmux pane, communicating via JSON files guarded by fcntl locks, with no database, daemon, or network layer.

This skill provides the patterns for orchestrating agent teams effectively.

When To Use

  • Parallel implementation across multiple files or modules
  • Multi-agent code review (one agent reviews, another implements fixes)
  • Large refactoring requiring coordinated changes across subsystems
  • Tasks with natural parallelism that benefit from concurrent agents

When NOT To Use

  • Single-file changes or small tasks (overhead exceeds benefit)
  • Tasks requiring tight sequential reasoning (agents coordinate loosely)
  • When claude CLI is not available or tmux is not installed

Prerequisites

# Verify Claude Code CLI
claude --version

# Verify tmux (required for split-pane mode)
tmux -V

# Enable experimental feature (set by spawner automatically)
export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1

Protocol Architecture

~/.claude/
  teams/<team-name>/
    config.json            # Team metadata + member roster
    inboxes/
      <agent-name>.json    # Per-agent message queue
      .lock                # fcntl exclusive lock
  tasks/<team-name>/
    1.json ... N.json      # Auto-incrementing task files
    .lock                  # fcntl exclusive lock

Design principles:

  • Filesystem is the database: JSON files, atomic writes via tempfile + os.replace
  • fcntl locking: Prevents concurrent read/write corruption on inboxes and tasks
  • Numbered tasks: Auto-incrementing IDs with sequential file naming
  • Loose coupling: Agents poll their own inbox (no push notifications)

Quick Start

1. Create a Team

# Programmatic team setup (via MCP or direct API)
# Team config written to ~/.claude/teams/<team-name>/config.json

The team config contains:

  • name, description, created_at (ms timestamp)
  • lead_agent_id, lead_session_id
  • members[]: array of LeadMember and TeammateMember objects

2. Spawn Teammates

Each teammate is a separate claude CLI process launched with identity flags:

claude --agent-id "backend@my-team" \
       --agent-name "backend" \
       --team-name "my-team" \
       --agent-color "#FF6B6B" \
       --parent-session-id "$SESSION_ID" \
       --agent-type "general-purpose" \
       --model sonnet

See modules/spawning-patterns.md for tmux pane management and color assignment.

3. Create Tasks with Dependencies

{
  "id": "1",
  "subject": "Implement API endpoints",
  "description": "Create REST endpoints for user management",
  "status": "pending",
  "owner": null,
  "blocks": ["3"],
  "blocked_by": [],
  "metadata": {}
}

See modules/task-coordination.md for state machine and dependency management.

4. Coordinate via Messages

{
  "from": "team-lead",
  "text": "API endpoints are ready for integration testing",
  "timestamp": "2026-02-07T22:00:00Z",
  "read": false,
  "summary": "API ready"
}

See modules/messaging-protocol.md for message types and inbox operations.

Coordination Workflow

  1. agent-teams:team-created: Initialize team config and directories
  2. agent-teams:teammates-spawned: Launch agents in tmux panes
  3. agent-teams:tasks-assigned: Create tasks with dependencies, assign owners
  4. agent-teams:coordination-active: Agents claim tasks, exchange messages, mark completion
  5. agent-teams:team-shutdown: Graceful shutdown with approval protocol

Crew Roles

Each team member has a role that determines their capabilities and task compatibility. Five roles are defined: implementer (default), researcher, tester, reviewer, and architect. Roles constrain which risk tiers an agent can handle. See modules/crew-roles.md for the full capability matrix and role-risk compatibility table.

Team Formation

For mission-level team sizing, use the Team Formation rules from references/team-formation.md. This defines:

  • Role definitions: Coordinator (mission lead), Agents (task owners), Reviewer (adversarial challenger)
  • Team sizing rules: Simple (1), Moderate (2-4), Complex (5-7), Critical (5-10)
  • Maximum team size: 10 agents (coordination overhead limit)
  • File ownership rules: Prevent conflicts with clear ownership

See references/team-formation.md for full team sizing guidance and example team formations.

Health Monitoring

Team members can be monitored for health via heartbeat messages and claim expiry. The lead polls team health every 60s with a 2-stage stall detection protocol (health_check probe and 30s wait). Stalled agents have their tasks released and are restarted or replaced following the "replace don't wait" doctrine. See modules/health-monitoring.md for the full protocol and state machine.

Module Reference

  • team-management.md: Team lifecycle, config format, member management
  • messaging-protocol.md: Message types, inbox operations, locking patterns
  • task-coordination.md: Task CRUD, state machine, dependency cycle detection
  • spawning-patterns.md: tmux spawning, CLI flags, pane management
  • crew-roles.md: Role taxonomy, capability matrix, role-risk compatibility
  • health-monitoring.md: Heartbeat protocol, stall detection, automated recovery

Integration with Conjure

Agent Teams extends the conjure delegation model:

Conjure PatternAgent Teams Equivalent
delegation-core:task-assessedagent-teams:team-created
delegation-core:handoff-plannedagent-teams:tasks-assigned
delegation-core:results-integratedagent-teams:team-shutdown
External LLM executionTeammate agent execution

Use Skill(conjure:delegation-core) first to determine if the task benefits from multi-agent coordination vs. single-service delegation.

Delegation is on by default there, so the question a team formation answers is which shape of delegation fits. A teammate holding execution work delegates it the same way a single session would. A teammate holding design work keeps it, under the same Keep Local clauses.

When a teammate's delegation returns a fallback_reason, that teammate does the work itself and reports which providers it tried. It does not message the crew for a reassignment: no other teammate has a provider this one lacks, because the registry is machine-wide.

Worktree Isolation Alternative (Claude Code 2.1.49+)

For parallel agents that modify files, isolation: worktree provides a lightweight alternative to filesystem-based coordination. Each agent runs in its own temporary git worktree, eliminating the need for fcntl locking or inbox-based conflict avoidance on shared files.

  • When to prefer worktrees over agent teams messaging: Agents work on overlapping files but don't need mid-execution communication
  • When to prefer agent teams messaging: Agents need to coordinate discoveries or adjust plans based on each other's progress
  • Combine both: Use agent teams for coordination with isolation: worktree per teammate for filesystem safety

Troubleshooting

Common Issues

tmux not found Install via package manager: brew install tmux / apt install tmux

Stale lock files If an agent crashes mid-operation, lock files may persist. Remove .lock files manually from ~/.claude/teams/<team>/inboxes/ or ~/.claude/tasks/<team>/

Orphaned tasks Tasks claimed by a crashed agent stay in_progress indefinitely. Use modules/health-monitoring.md for heartbeat-based stall detection and automatic task release. The health monitoring protocol detects unresponsive agents within 60s and 30s probe window and releases their tasks for reassignment.

Message ordering Filesystem timestamp resolution varies (HFS+ = 1s granularity). Use numbered filenames or UUID-sorted names to avoid collision on rapid message bursts.

Model errors on Bedrock/Vertex/Foundry (pre-2.1.39) Teammate agents could use incorrect model identifiers on enterprise providers, causing 400 errors. Upgrade to Claude Code 2.1.39+ for correct model ID qualification across all providers.

Nested session guard (2.1.39+) If claude refuses to launch within an existing session, ensure you're using tmux pane splitting (not subshell invocation). The guard is intentional. See modules/spawning-patterns.md for details.

Exit Criteria

  • Team created with config and directories
  • Teammates spawned and registered in config
  • Tasks created with dependency graph (no cycles)
  • Agents coordinating via inbox messages
  • Graceful shutdown completed

Readme

Conjure

Delegate tasks to external models from Claude Code. Delegate analysis, bulk work, and summarization to Gemini, Qwen, MiniMax, GLM, Meta Muse, Codex, OpenCode, or a Muse Glimmer running locally.

Track quotas, log usage, and suggest delegation for large tasks.

Installation

As a Claude Code plugin

/plugin install athola@claude-night-market
/status

Development setup

uv sync             # install deps
make install-hooks  # pre-commit hooks
make test           # lint + type + security checks

Requirements: Python 3.10+, uv.

Optional Dependencies

PackagePurposeFallback
tiktokenAccurate token estimationHeuristic (~4 chars/token)
leylineQuota trackingStub tracker (disabled)

For accurate token counts, install tiktoken:

pip install tiktoken

Why delegation is on by default

It was opt-in until the provider chain landed, under docs/inclusive-defaults.md TRUE-exception category 3: the external CLIs (gemini, qwen, mmx, muse, codex, opencode, claude, ollama) are separately installed and authenticated, and smart_delegate raised when none of them was. Defaulting on would have failed every task on an unconfigured machine.

The chain removed that failure. An unconfigured machine now costs one availability probe per provider and gets a providers_exhausted result, which the caller reads as "do this work yourself". The reasonable default the category asked for exists, and it is "try, then do it yourself".

Skill(conjure:provider-setup) is how an operator stops paying that cost. It prints which CLIs are installed and authenticated, explains each unhealthy one, installs the missing ones after confirmation, and stores the result at ~/.claude/hooks/delegation/provider-state.json:

python3 scripts/delegation_setup.py --available
python3 scripts/delegation_setup.py --doctor
python3 scripts/delegation_setup.py --install gemini

Two switches decline it, environment over file:

ScopeHow
One runCONJURE_DELEGATION=off
One machine"enabled": false in ~/.claude/hooks/delegation/config.json

A disabled delegator probes and spawns nothing.

Usage

Quick Start

# Check delegation readiness
make delegate-verify

# Select best service for a task
make delegate-auto PROMPT="Summarize src" FILES="src/"

# Monitor limits and usage
make quota-status
make usage-report

Delegation Executor

# List services
uv run python scripts/delegation_executor.py --list-services

# Verify a service
uv run python scripts/delegation_executor.py --verify gemini

# Auto-select a service for the task
uv run python scripts/delegation_executor.py auto "Analyze this code" \
  --files src/

# Force a specific service
uv run python scripts/delegation_executor.py gemini "Summarize" \
  --files docs/*.md --model gemini-3.1-pro-preview

Make Commands

# Development
make format          # ruff format + check --fix
make lint            # ruff check
make typecheck       # mypy + ty
make security-check  # bandit
make test            # lint + type + security bundle
make validate-all    # full validation including hooks
make clean           # remove caches/venv

# Delegation lifecycle
make delegate-status
make delegate-verify
make delegate-usage
make delegate-test
make delegate-gemini PROMPT="Analyze" FILES="src/main.py"
make delegate-qwen   PROMPT="Extract" FILES="src/**/*.py"
make delegate-minimax PROMPT="Summarize" FILES="src/**/*.py"
make delegate-glm     PROMPT="Review this design"
make delegate-muse    PROMPT="Run the tests and summarize failures"
make delegate-codex   PROMPT="Explain this module"
make delegate-opencode PROMPT="Find the bug"
make delegate-glimmer PROMPT="Summarize" FILES="src/"   # local, no quota
make delegate-auto   PROMPT="Best service" FILES="src/"

# Getting set up
make delegate-setup     # which providers are installed and authenticated?
make delegate-doctor    # what is broken, and the command that fixes it
make delegate-install   # install what is missing, one confirmation each

# Quota & usage
make quota-status
make usage-report

Quota & Usage Tools

# Quota tracker (Gemini)
uv run python tools/quota_tracker.py --status
uv run python tools/quota_tracker.py --estimate src/ docs/
uv run python tools/quota_tracker.py --validate-config

# Usage logger (Gemini)
uv run python tools/usage_logger.py --report
uv run python tools/usage_logger.py --validate
uv run python tools/usage_logger.py --status

In Claude Code

Use skills directly in chat:

Skill(conjure:delegation-core)
Skill(conjure:gemini-delegation)
Skill(conjure:qwen-delegation)
Skill(conjure:minimax-delegation)
Skill(conjure:glm-delegation)
Skill(conjure:muse-delegation)
Skill(conjure:codex-delegation)
Skill(conjure:opencode-delegation)

Hooks surface delegation suggestions for large tasks.

Commands

delegate-auto

Select the best external service based on requirements.

delegate-<service>

Force a specific service with optional file globs and model hints. One target per registered provider: gemini, qwen, minimax, glm, muse, codex, opencode, glimmer.

delegate-setup / delegate-doctor / delegate-install

Report which provider CLIs are present and authenticated, name the command that fixes each unhealthy one, and install the missing ones after a confirmation showing the package, publisher, and source URL. Install commands come only from the vetted provenance map, so an unrecorded binary is refused rather than guessed at.

quota-status

Display current Gemini quota usage.

usage-report

Summarize recent requests, token counts, and success rate.

validate-delegation

Check configuration integrity.

Architecture

Conjure is built around a Core Plugin that registers skills, commands, and hooks within Claude Code. Specialized Skills manage execution paths, while a Delegation Executor provides a unified interface for task processing and token estimation. Resource Management is handled by a quota tracker and usage logger that monitor limits and record outcomes, with a Makefile coordinating lifecycle automation and development tasks.

Workflow

Task delegation begins with an Assessment by delegation-core to determine if delegation is appropriate, followed by Selection where delegate-auto identifies the best external service. Execution is then handled by the delegation_executor, with Monitoring provided by quota tracking and logging. Finally, Integration returns the results to the active Claude session.

Configuration & Paths

  • Delegation config: ~/.claude/hooks/delegation/config.json
  • Quota data: ~/.claude/hooks/gemini/usage.json
  • Usage logs: ~/.claude/hooks/gemini/logs/usage.jsonl

Development

uv sync
make lint typecheck security-check
make test

See CHANGELOG.md for release notes and LICENSE (MIT).

Stewardship

Ways to leave this plugin better than you found it:

  • Service selection criteria in delegate-auto are an opportunity to document the decision logic so users understand why one service was chosen over another
  • Quota tracker error messages could guide users toward specific fixes when limits are reached
  • The delegation executor would benefit from a quick troubleshooting section for common API failures
  • Token estimation accuracy (tiktoken vs. heuristic) could include a comparison table showing divergence

See STEWARDSHIP.md for the full stewardship principles guiding this project.

License

MIT

Details

Marketplace
athola/claude-night-market
Source
plugins/conjure
Category
Community
Keywords
llm-delegation, multi-model, gemini, qwen
Listed since
Apr 7, 2026

More from athola/claude-night-market

All 23