herdctl
CLAUDE.md38 starsChanged 8 months agoMITView on GitHub
This file provides guidance for Claude Code when working in this repository. Follow Semver. Breaking changes require a major version bump. herdctl is a TypeScript-based system for managing fleets of autonomous Claude Code agents. It provides: - @herdctl/core - Core library for programmatic fleet management - herdctl - CLI for command-line fleet operations - @herdctl/web - Web dashboard (Vite + React + Tailwind) - @herdctl/discord - Discord connector - @herdctl/slack - Slack connector - @herdctl/chat - Shared chat infrastructure Before…
- Installs packages
In this repository2 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/CLAUDE.mdCLAUDE.md
The file
We split this CLAUDE.md into the rules it gives an agent
11 rules. About 0 are common, 4 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 7
Follow Semver. Breaking changes require a major version bump.
- Very specific: line 21
Library-First Design: All business logic lives in @herdctl/core
- Distinctive: line 53
Use strict TypeScript with explicit types
- Very specific: line 54
Prefer interface over type for object shapes
- Distinctive: line 55
Use Zod for runtime validation schemas
- Distinctive: line 60
Use Vitest for unit tests
- Very specific: line 66
Use createLogger(prefix) from packages/core/src/utils/logger.ts (exported from @herdctl/core)
- Very specific: line 74
Use typed error classes extending FleetManagerError
- Very specific: line 99
Keep documentation in docs/.
- Very specific: line 100
Update relevant docs in docs/src/content/docs/
- Very specific: line 101
Run pnpm build in docs/ to verify
≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance for Claude Code when working in this repository.
LIVE PROJECT - Follow Semver
Follow Semver. Breaking changes require a major version bump.
Project Overview
herdctl is a TypeScript-based system for managing fleets of autonomous Claude Code agents. It provides:
@herdctl/core- Core library for programmatic fleet managementherdctl- CLI for command-line fleet operations@herdctl/web- Web dashboard (Vite + React + Tailwind)@herdctl/discord- Discord connector@herdctl/slack- Slack connector@herdctl/chat- Shared chat infrastructure
Architecture Principles
- Library-First Design: All business logic lives in
@herdctl/core - Thin Clients: CLI, Web, and API are thin wrappers around FleetManager
- Single Process Model: Fleet runs in one process, agents are child processes
Repository Structure
herdctl/
├── packages/
│ ├── core/ # @herdctl/core - FleetManager, config, scheduler, state
│ ├── cli/ # herdctl CLI - thin wrapper on FleetManager
│ ├── web/ # @herdctl/web - Vite+React dashboard (see web/DESIGN_SYSTEM.md)
│ ├── chat/ # @herdctl/chat - Shared chat infrastructure
│ ├── discord/ # @herdctl/discord - Discord bot
│ └── slack/ # @herdctl/slack - Slack bot
├── docs/ # Documentation site (Astro/Starlight) → herdctl.dev
└── examples/ # Example configurationsDevelopment Commands
pnpm install # Install dependencies
pnpm build # Build all packages
pnpm test # Run all tests
pnpm typecheck # TypeScript type checking
pnpm dev # Development mode (watch)Code Conventions
TypeScript
- Use strict TypeScript with explicit types
- Prefer
interfaceovertypefor object shapes - Use Zod for runtime validation schemas
- Export types from package entry points
Testing
- Tests live in
__tests__/directories adjacent to source - Use Vitest for unit tests
- Coverage thresholds vary per package — see each package's
vitest.config.ts - Mock external dependencies (SDK, file system, GitHub API)
Logging
- NEVER use raw
console.log/warn/error/debugfor runtime logging - Use
createLogger(prefix)frompackages/core/src/utils/logger.ts(exported from@herdctl/core) - Logger respects
HERDCTL_LOG_LEVELenv var (debug/info/warn/error, default:info) - Each method accepts an optional
dataparameter:logger.info("message", { key: "value" }) - In external packages (discord, slack), import via
import { createLogger } from "@herdctl/core" - In core, use relative imports:
import { createLogger } from "../utils/logger.js" - Choose appropriate log levels:
debugfor internal details,infofor significant events,warnfor recoverable issues,errorfor failures
Error Handling
- Use typed error classes extending
FleetManagerError - Provide type guards for error discrimination
- Include actionable error messages
Key Files to Know
| File | Purpose |
docs/src/content/docs/architecture/ | Architecture documentation |
packages/core/src/fleet-manager/ | FleetManager orchestration layer |
packages/core/src/config/ | Configuration parsing and validation |
packages/core/src/scheduler/ | Job scheduling |
packages/core/src/state/ | State persistence (.herdctl/) |
packages/core/src/utils/logger.ts | Centralized logger (createLogger) |
packages/web/DESIGN_SYSTEM.md | Web UI visual design system (colors, typography, components) |
Quality Gates
Before merging:
pnpm typecheckpassespnpm testpasses with coverage thresholdspnpm buildsucceeds
Documentation
Keep documentation in docs/. It deploys to herdctl.dev automatically. When adding features:
- Update relevant docs in
docs/src/content/docs/ - Run
pnpm buildin docs/ to verify - Docs deploy automatically on merge to main
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

