herdctl logo

herdctl

Let Claude Code invoke itself.

Run agents on schedules, chat with them on Discord, and resume any session in your terminal. herdctl is an open-source orchestration layer that turns Claude Code into autonomous agents.

Quick Start
# Install herdctl globally
npm install -g herdctl

# Initialize with example agents
herdctl init

# Start your agent fleet
herdctl start

The Big Picture

How herdctl works

herdctl architecture showing scheduled triggers and Discord messages flowing into the herdctl fleet manager, which spawns Docker-isolated and native agents

Simple Configuration

Your fleet in a few YAML files

One herdctl.yaml defines your fleet. Each agent gets its own directory with a herdctl-agent.yaml. Secrets live in .env.

Fleet Directory Structure
my-fleet/
├── herdctl.yaml# Fleet config
├── .env# API keys & secrets
├── agents/
├── pr-reviewer/
└── herdctl-agent.yaml
├── docs-writer/
└── herdctl-agent.yaml
└── monitor/
└── herdctl-agent.yaml
herdctl.yaml
version: 1

fleet:
  name: my-dev-fleet
  description: Development agents

defaults:
  model: sonnet
  max_turns: 50

agents:
  - path: ./agents/pr-reviewer
  - path: ./agents/docs-writer
  - path: ./agents/monitor
    overrides:
      docker:
        enabled: true

Security First

Run agents in Docker containers

AI agents are inherently risky - they can be manipulated or confused into doing things they shouldn't. Docker isolation is the gold standard for containing that risk, and herdctl makes it dead simple.

  • File system isolation - agents can't access your real files
  • Network controls - whitelist ports, IPs, and hosts
  • Resource limits - prevent runaway processes and fork bombs
  • Process isolation - agents can't see your system processes
herdctl-agent.yaml
name: my-agent

# Enable Docker isolation - that's it!
docker:
  enabled: true

# Lock down what tools the agent can use
allowed_tools:
  - Read
  - Glob
  - Grep
  - Edit
  - Write

See it in action

20-minute overview

Watch a complete walkthrough of herdctl's core features: fleet management, scheduled agents, Discord integration, and session continuity.

Key Features

Schedules for Claude Code

Define agents that wake themselves up on schedules or triggers. Cron expressions, intervals, or one-off jobs - all from YAML config.

herdctl-agent.yaml
schedules:
  daily_review:
    type: cron
    expression: "0 9 * * *"
    prompt: |
      Review all open PRs...
Thin Claude Code Wrapper

If Claude Code can do it, your herdctl agent can do it. Same tools, same MCP servers. Lock down permissions per-agent.

herdctl-agent.yaml
allowed_tools:
  - Read
  - Edit
  - WebSearch
  - Bash(git)
  - Bash(ssh)
Connect to Chat

Connect agents to Discord (Slack coming soon). Message your agents from your phone and they continue working.

herdctl-agent.yaml
chat:
  discord:
    bot_token_env: MY_BOT_TOKEN
    guilds:
      - id: "${GUILD_ID}"
        channels: ...
Session Continuity

Every job creates a real Claude SDK session. Resume that exact session in your terminal with claude --resume. Full context preserved.

terminal
# List recent sessions
herdctl sessions

# Resume in your terminal
claude --resume session-id
Two Runtimes

CLI runtime uses your Claude Max subscription (much cheaper). SDK runtime uses API pricing*. Choose per-agent.

herdctl-agent.yaml
# Use Claude Max tokens
runtime: cli

# Or use Anthropic API
runtime: sdk
Hooks & Automation

Trigger actions on job completion. Post to Discord, run shell scripts, call webhooks - all configurable per-agent.

herdctl-agent.yaml
hooks:
  after_run:
    - type: discord
      channel_id: "${CHANNEL}"
      when: 'job.scheduleName'

Use Cases

What can you build with herdctl?

Any task that's repetitive, time-sensitive, or benefits from continuous monitoring is a candidate for automation.

PR Review Bot

Review all open PRs every morning at 9am. Leave thoughtful comments, suggest improvements, flag security issues. Trigger via Discord: 'Hey, can you review PR #47?'

Software Developer Agent

Point an agent at your codebase - it honors your CLAUDE.md, uses your slash commands, connects to your MCP servers. Chat with it on Discord from your phone.

Documentation Agent

Scan your codebase weekly for undocumented functions. Generate JSDoc comments, update README files, create examples. Review its own output before committing.

Competitive Analysis

Daily scans of competitor websites, pricing pages, and feature announcements. Get notified when something changes. Weekly summary reports to your team.

Price Monitoring

Monitor prices across retailers. When your target price is hit, get notified on Discord. The agent could even complete the purchase while you sleep.

Community Intelligence

Monitor Reddit, Hacker News, Twitter for mentions of your product. Surface questions, complaints, and feature requests. Draft responses automatically.

From the Blog

Building herdctl in public

Follow along as I build and evolve herdctl. Technical deep-dives, design decisions, and lessons learned.

Run Claude Code Agents in Docker with herdctl

Run Claude Code Agents in Docker with herdctl

herdctl now supports running Claude Code Agents in Docker containers, significantly expanding your options for locking your agents down. It also added support for the claude code CLI runtime, ensuring your can use your inexpensive Claude Max Plan tokens.

View all posts →

Ready to build your agent fleet?

Get started in under 5 minutes. Open source, free forever.

* The Claude Agents SDK does not officially support using your Claude Max account, but as of the time of writing it was nevertheless possible to set a CLAUDE_CODE_OAUTH_TOKEN environment variable and have the Agents SDK use your Max account. Long may it last.