shepherd
Skill4 starsChanged 48 days agoMITView on GitHub
Own open PRs to merge-readiness — autonomously. Forge provides a singleton shepherd daemon — start it with `forge shepherd daemon` — that then watches every open PR, converges CI check state into kernel verdicts, re-runs flaky required checks, reaps orphan watchers, and self-retires when no PRs remain; one-shot passes (forge shepherd <pr>) exist for a single bounded check. Use when a PR was just opened or shipped; when a session starts with open PRs (Forge automatically wakes the singleton; the lease makes a duplicate start a safe no-op); when the user asks "why isn't my PR merging", "what's blocking the PR", "is the PR ready", "did a check fail / go red"; when asked to "keep watching / keep an eye on / babysit my PRs"; or to read PR verdicts (forge shepherd <pr> --pull --json, forge shepherd events). NEVER merges and never resolves review threads — fixing review feedback is `review`; opening the PR is `ship`; post-merge health is `verify`; general orientation is `status`.
- Reads credentials
7 other projects use a version of this.
Adopted by
Most recently taken up by
- MCKRUZ/shepherd-sdlctheir own version, first seen Oct 20, 2026
- xiaosys/shepherd-skilltheir own version, first seen Sep 28, 2026
- CodeCaroS/MythOs_Aegistheir own version, first seen Aug 11, 2026
- hisazumi/paper-review-skillstheir own version, first seen Jul 3, 2026
- robinebers/skillstheir own version, first seen Jun 25, 2026
- chrisbanes/skillstheir own version, first seen Jun 18, 2026
Other versions7 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 7
- chrisbanes/skills★ 1.1ksame name
- robinebers/skills★ 48same name
- MCKRUZ/shepherd-sdlc★ 9same name
- genomewalker/chitta★ 4same name
- hisazumi/paper-review-skills★ 4same name
- xiaosys/shepherd-skill★ 1same name
- CodeCaroS/MythOs_Aegis★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository51 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .cursor/rules/permissions-guidance.mdcCursor rule
- claim-safetySkill
- devSkill
- gatesSkill
- hermes-forgeSkill
- issue-basicsSkill
- kernelSkill
- memorySkill
- parallel-deep-researchSkill
- planSkill
- portabilitySkill
- researchSkill
- reviewSkill
- rollbackSkill
- setupSkill
- shepherdSkill
- shipSkill
- smithSkill
- sonarcloud-analysisSkill
- sonarcloudSkill
- statusSkill
- triage-readySkill
- using-forgeSkill
- validateSkill
- verifySkill
- worktreeSkill
- claim-safetySkill
- devSkill
- gatesSkill
- hermes-forgeSkill
- issue-basicsSkill
- kernelSkill
- memorySkill
- parallel-deep-researchSkill
- planSkill
- portabilitySkill
- researchSkill
- reviewSkill
- rollbackSkill
- setupSkill
- shipSkill
- smithSkill
- sonarcloud-analysisSkill
- sonarcloudSkill
- statusSkill
- triage-readySkill
- using-forgeSkill
- validateSkill
- verifySkill
- worktreeSkill
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.
0
Common
Most of the 7 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 95
Never merges: No merge action, no server-side auto-merge latch.
- Distinctive: line 99
HEAD-changed abort: Before any mutating action it re-reads the head SHA and aborts if HEAD moved.
“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Forge owns your open PRs. A singleton daemon converges every open PR toward merge-readiness; you read its verdicts and only step in on escalations. Never merges, never resolves review threads.
Shepherd
shepherd is the PR-ownership utility, not a workflow stage. It has two modes over the single forge shepherd verb:
- Daemon (default ownership):
forge shepherd daemonis a machine-wide singleton for this repo. It heartbeats and converges the whole PR world every ~60s — self-registering hand-opened PRs, restarting killed watchers, reaping verified orphans, converging CI check state into kernel verdicts, retiring merged/closed PRs — then self-retires (releases the lease, kills its children, exits) once no PRs remain open. You do NOT poll by hand; the daemon does. - One-shot convergence:
forge shepherd <pr>runs the local review preflight, reads one PR's current-head state, takes at most one idempotent Tier-A action, persists bounded deltas/receipts, and exits. Use it for a point-in-time question or one bounded convergence attempt on a single PR.
Which mode? (decision rule)
- User asks about one PR, right now ("is #212 ready?", "why is this blocked?") → one-shot (
forge shepherd <pr> --pull). - Anything ongoing — "keep", "until it merges", "watch", "babysit", multiple PRs, or a session that starts with PRs already open → ensure the daemon is running.
Automatic attachment
Forge wakes the singleton after a successful supported session start, every successful push, and every successful non-dry-run ship. Push does not require a locally resolved PR number; the daemon enumerates all open and draft PRs itself. Ordinary commands do not launch it.
The daemon is a repo singleton guarded by an O_EXCL lease, so no liveness
check is needed first. Forge prefers a supplied harness background shell; its
bare-CLI detached fallback launches from the stable common repository root, not
the current disposable worktree. Agents never launch a detached spawn directly.
(A forge prime daemon-liveness line remains the separate W-S5 follow-up.)
Reading verdicts (the common case)
forge shepherd <pr> --pull --json # actionable payload: WHY blocked + exactly what to fix
forge shepherd <pr> --bundle --json # the COMPLETE read-only PR-state bundle
forge shepherd events <pr> --since <seq> # only the new events since sequence <seq>--pull is strictly read-only (dry-run pass: no rerun, no rebase, no merge, no thread resolution). It returns one bounded, actionable-only payload — blockers[], classified requiredChecks, failed-check log failures[] (matrix-deduped), and every unresolved reviewThreads[] — so you get "everything blocking this PR + what to fix" in one call. Passing checks and satisfied policy are omitted.
A plain forge shepherd <pr> also returns a consolidated localPreflight, at
most 128 deltas, receiptIds, and one explicit handoff. The preflight probes
CodeRabbit and runs strict lint, Sonar parity, structural drift, and affected
tests. An unavailable or unauthenticated CodeRabbit CLI is reported as
UNAVAILABLE/INCOMPLETE, never as a fabricated pass; deterministic failures or
actual review findings make the remote decision read-only for that pass. A
checkout that is not the exact PR head is NOT_APPLICABLE, never reviewed as if
it were authoritative.
Verdict vocabulary (collapsed, W-S1)
| Verdict | Meaning |
MERGE_READY | Required checks green, branch up to date — hand off to a human to merge. |
PENDING | A Tier-A action was taken, or checks are still running — await the next tick/pass. |
INCOMPLETE | Exact-head local review or durable convergence evidence is unavailable — fail closed and retry after evidence is restored. |
BLOCKED | Something actionable blocks merge (failing/missing/skipped required check, conflict, behind, unresolved threads, changes requested). Read blockers[]. |
CI_DEAD_HEAD | The head has no required checks running (e.g. an auto-update authored by GITHUB_TOKEN never re-triggered CI). Recovery is an escalation, not an autonomous Tier-A rerun: it needs a maintainer-provided FORGE_PR_TOKEN (contents + pull-requests + checks) to re-author the push so CI re-triggers. |
ESCALATE | A Tier-C condition (conflict, unreadable required set, persistent failure, oscillation, budget exhaustion). Context is posted to the PR. |
HARD_STOP | A permanent auth/scope failure retrying cannot fix — a human must widen token scope. |
Trigger scenario → command
| Situation | Command |
| PR just opened / shipped | automatic singleton wake; read with forge shepherd <pr> --pull |
| Session starts with open PRs | automatic singleton wake |
| "Why isn't my PR merging / what's blocking it" | forge shepherd <pr> --pull |
| "Is the PR ready?" | forge shepherd <pr> --pull (read MERGE_READY) |
| "A check failed / went red" | forge shepherd <pr> --pull --json (read failures[]) |
| "Keep watching / babysit my PRs" | ensure forge shepherd daemon running |
| Read incremental deltas | forge shepherd events <pr> --since <seq> |
Boundaries (kept — true of both modes)
- Never merges. No merge action, no server-side auto-merge latch. Terminates at
MERGE_READYand hands off — a human merges in the GitHub UI. - Never resolves review threads. It refreshes a single sticky status comment; thread resolution is semantic and stays with
review. - Action ladder. Tier-A (autonomous, idempotent): re-run a flaky required check (rerun-budget capped); refresh the single sticky status comment — an upsert, never an append, so the ~60s daemon loop cannot post duplicate comments. Tier-B (opt-in, default OFF):
--auto-rebaserebases onto base and force-pushes with lease — a lease rejection is a hard-stop, never re-armed. Tier-C: everything else escalates (incl.CI_DEAD_HEADrecovery, which needs the maintainerFORGE_PR_TOKEN). - Required-check gate.
MERGE_READYonly when the branch-protection required set is known and all green; if protection is unreadable, it escalates rather than guessing. - HEAD-changed abort. Before any mutating action it re-reads the head SHA and aborts if HEAD moved.
Adjacent skills
- Fixing review feedback (CodeRabbit/Greptile/human comments, resolving threads) →
review. - Opening or pushing the PR →
ship. - Post-merge health (CI green on main, close issues) →
verify. - "Where am I / what's in flight" orientation →
status.
Kill-switches
FORGE_SHEPHERD_DISABLE=1 # env: makes automatic firing inert
forge gate disable rail.auto_shepherd # config gate honored by every automatic seamCI/test (NODE_ENV=test, BUN_ENV=test, CI, GITHUB_ACTIONS, or
GITLAB_CI), dry-run, uninitialized repositories, and disabled paths return
before lease, Kernel-state, or process work. All leave the manual
forge shepherd surface usable; they only stop automatic daemon fire.
State
Public Memory is the durable monitor authority and public Flow reducers restore
its bounded event and watcher-process checkpoints after restart. The per-PR
journal under .forge/pr-monitor/<repo>-<pr>/ remains a compatibility delivery
surface for events --since, not authority. Merged/closed evidence produces one
idempotent terminal MonitorReceipt; conflicting or incomplete replay fails
closed. For 0.1 no receipt grants continuing lease authority: live ownership is
re-probed at consequential boundaries, and canonical LeaseReceipt epoch/scope
plus the same-actor/session ABA fix remain explicitly deferred.
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.

