# AGENTS.md — herdr-peers

Entry point for AI agents working **on** this repository.

## Purpose

A standalone agent skill for [Herdr](https://herdr.dev): any coding agent can ask any other agent, in any pane on any machine, and get the answer back — with an explicit reply grant, a loop guard, depth 1, and a record of every delegation. It builds on Herdr's official skill and never re-teaches its CLI.

## Command / skill

herdr-peers (skill + helper script)

## Layout

| Path | What |
| --- | --- |
| `skills/herdr-peers/` | The installable skill: `SKILL.md`, normative `protocol.md`, `discipline.md`, `launcher.md`, `orchestra.md`, `autopilot.md`, the debate sub-skill `debate.md`, `templates/` (incl. `delegation-record.json` schema and `templates/debate/`) |
| `skills/herdr-peers/scripts/` | The helper: `herdr-peers` (bash entry) + `herdr_peers.py` (python3 stdlib) + `debate.py` (the `debate` verb) + `autopilot.py` (the `autopilot` verb: the pure decision function, the loop and the plan loop) + `brain.py` (the brain's pure parts: pick-v2 checking, cases and closed action lists, answers) + `fleet_ui.py` (`fleet ui`: source, pure model and rendering, curses) + `fleet_report.py` (the machine report behind `plans` and `fleet`: self-contained, no import from the helper, because the plan loop sends this very file to other machines). It lives inside the skill so `npx skills add` installs it. |
| `bin/herdr-peers` | Checkout shim that runs the skill's helper |
| `tests/` | `run.sh` (sandboxed runner), `lib.sh`, `fakes/herdr`, `fakes/ssh`, `fakes/agentkit/ak`, `scopes/`, `fixtures/messages/`, `tools/` |
| `assets/` | README logos (`logo-light.png`, `logo-dark.png`) |
| `docs/` | `TESTING_GUIDE.md`, `SECURITY.md` (threat model) |
| `scripts/` | `check-public-hygiene.sh` (public-hygiene check; allow-list in `.public-hygiene-allow`), `release-assets.sh` (release notes + `SHA256SUMS`) |
| `.github/` | `workflows/ci.yml` (suite on Ubuntu + macOS, `public hygiene` job), `workflows/release.yml` (annotated tag → release), issue/PR templates, `CODEOWNERS`, `dependabot.yml` |
| `.agents/` | Working on this repo: `agents/` (personas), `commands/` (`/dwp-*` delegators), `skills/` (vendored `deepworkplan`, `ai-diff-reviewer` — never hand-edit), `docs/` (catalogs); `.claude` and `.cursor` link here |
| `.review/extension.md` | Severity overrides for the local AI Diff Reviewer |
| `.dwp/config.json` | Tracked DWP addon registry (the rest of `.dwp/` is gitignored) |
| Root | `README.md`, `CHANGELOG.md` (Keep a Changelog), `SECURITY.md` (policy), `CONTRIBUTING.md`, `CODE_OF_CONDUCT.md`, `CREDITS.md`, `LICENSE`; `CLAUDE.md` is a symlink to this file |

The protocol's interface version is `metadata.protocol` in `SKILL.md`; a wire
change bumps it (and the major version, since 1.0.0). Keep `protocol.md`, the
helper constants and `templates/` in step — the `skill` and `templates` test
scopes compare them.

## Quick commands

| Scope | Command |
| --- | --- |
| Full | `bash tests/run.sh` |
| Scoped | `bash tests/run.sh <scope>` |
| Public hygiene | `bash scripts/check-public-hygiene.sh` |
| Release assets (local) | `bash scripts/release-assets.sh vX.Y.Z <outdir>` |
| DWP conformance | `bash .agents/skills/deepworkplan/verify/conformance.sh` |

Agents, commands and skills for working on this repo: [`.agents/docs/skills_agents_catalog.md`](.agents/docs/skills_agents_catalog.md). Local review: the vendored `ai-diff-reviewer` skill with [`.review/extension.md`](.review/extension.md).

The test map lives in [`docs/TESTING_GUIDE.md`](docs/TESTING_GUIDE.md).

## Rules

1. English for code, comments and docs; conventional commits.
2. Runtime code depends on bash and the python3 standard library only.
3. Never print, log or write the value of any `*_API_KEY` / `*_TOKEN` variable; refer to variables by name.
4. Never spell a fetch-piped-to-shell install line in a skill file (marketplace rule E005); never inject a permission-bypass flag by default (E006); pin every cross-repo install to a tag (W012).
5. Developing is not installing: tests run in a sandbox `HOME`; nothing is installed into the real `$HOME` while developing.
6. Pin every external tool by version.
7. This repository is public: never commit personal absolute paths, private
   organization or repository names, internal hostnames, or real credentials.
   Secret-shaped test data says it is fake and is listed in
   `.public-hygiene-allow` with a reason. Never rewrite history; a leaked
   secret is rotated first.
8. Upgrading a vendored skill (`npx --yes skills add <repo>@<tag> --skill <name> --force -y`) can also write copies into `agent/skills/` and symlinks into `skills/`; delete them — `skills/` ships only `herdr-peers` (the `repo` test scope checks it).
9. Changes land through a pull request with green CI; releases come from an
   annotated `vX.Y.Z` tag (`.github/workflows/release.yml`).

## Deep Work Plans

Structured work runs through the installed `deepworkplan` skill (`.agents/skills/deepworkplan/`, pinned in `skills-lock.json`); the `/dwp-*` commands are thin delegators in `.agents/commands/` (`.claude` and `.cursor` are symlinks to `.agents/`). Plans live in the gitignored `.dwp/`; only the addon registry `.dwp/config.json` is tracked (`herdr` enabled — this repository ships it; `ai-diff-reviewer` enabled for the local review).

DWP standard: 8.0.0 (onboarded 2026-10-08; upgraded 2026-10-09, 2026-10-11, 2026-10-12, 2026-10-13 and 2026-11-16; skill 8.0.2, vendored 2026-11-16: tag commit `4d3e2f6`, all 188 files byte-identical to the release `SHA256SUMS`, digest `332e8f9a…`; existing plans keep their recorded generation)
