agentleFS
edspenceredspencer/herdctl/CLAUDE.md

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

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
  1. Distinctive:

    Follow Semver. Breaking changes require a major version bump.

    line 7
  2. Very specific:

    Library-First Design: All business logic lives in @herdctl/core

    line 21
  3. Distinctive:

    Use strict TypeScript with explicit types

    line 53
  4. Very specific:

    Prefer interface over type for object shapes

    line 54
  5. Distinctive:

    Use Zod for runtime validation schemas

    line 55
  6. Distinctive:

    Use Vitest for unit tests

    line 60
  7. Very specific:

    Use createLogger(prefix) from packages/core/src/utils/logger.ts (exported from @herdctl/core)

    line 66
  8. Very specific:

    Use typed error classes extending FleetManagerError

    line 74
  9. Very specific:

    Keep documentation in docs/.

    line 99
  10. Very specific:

    Update relevant docs in docs/src/content/docs/

    line 100
  11. Very specific:

    Run pnpm build in docs/ to verify

    line 101

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

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 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

Architecture Principles

  1. Library-First Design: All business logic lives in @herdctl/core
  2. Thin Clients: CLI, Web, and API are thin wrappers around FleetManager
  3. 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 configurations

Development 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 interface over type for 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/debug for runtime logging
  • Use createLogger(prefix) from packages/core/src/utils/logger.ts (exported from @herdctl/core)
  • Logger respects HERDCTL_LOG_LEVEL env var (debug/info/warn/error, default: info)
  • Each method accepts an optional data parameter: 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: debug for internal details, info for significant events, warn for recoverable issues, error for failures

Error Handling

  • Use typed error classes extending FleetManagerError
  • Provide type guards for error discrimination
  • Include actionable error messages

Key Files to Know

FilePurpose
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.tsCentralized logger (createLogger)
packages/web/DESIGN_SYSTEM.mdWeb UI visual design system (colors, typography, components)

Quality Gates

Before merging:

  • pnpm typecheck passes
  • pnpm test passes with coverage thresholds
  • pnpm build succeeds

Documentation

Keep documentation in docs/. It deploys to herdctl.dev automatically. When adding features:

  1. Update relevant docs in docs/src/content/docs/
  2. Run pnpm build in docs/ to verify
  3. Docs deploy automatically on merge to main

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.