Herdr Workflows
Load herdr first. It is the sole source of truth for Herdr commands, command
semantics, topology, identifiers, targeting, agent lifecycle, output reading,
and general safety. Do not restate, override, or infer those rules here. This
companion adds only the local exceptions and transfer ordering below.
Session Routing
- When diagnosing session routing, inspect the inherited
HERDR_SOCKET_PATH.
Do not assume the default socket identifies the current pane's server.
- Do not recover a stopped or unreachable shared session by running
herdr server directly. Use herdr session attach default; its attach path
safely starts the default server when absent.
Worktree Transfer
Treat checkout removal and work transfer as separate operations. Use the
herdr skill and current CLI to determine the available worktree operations;
this workflow only decides when removal is safe.
Establish Both Checkouts
- Identify the linked source workspace, branch, checkout path, and exact Git
state. Identify the repository's primary non-linked checkout as the host;
"host" does not imply that its current branch is named
main.
- Use Herdr and Git's worktree metadata to establish paths and workspace IDs.
Confirm whether the host checkout already has staged, unstaged, or untracked
work.
- Keep the final coordinator outside the linked checkout being removed. If the
current agent runs inside that checkout, use an existing host workspace or
open the host checkout with Herdr, then coordinate from that host workspace.
Do not remove the checkout containing the coordinator's running process.
- Give the host-side coordinator compacted knowledge from the linked-worktree
session: the user's intent, reviewed scope, material decisions, current Git
and preservation state, validation evidence, and any further requested work.
Do not rely on the host coordinator reconstructing that context from files or
terminal output.
Preserve The Reviewed State
- Record the exact reviewed source scope: staged files, unstaged files,
untracked files, base commit, and branch. Verification from an earlier turn
is stale until both checkouts are checked again immediately before removal.
- Make the reviewed content durable outside the linked checkout using the
smallest non-destructive method appropriate to its state:
- If the host already contains the intended files, verify their paths and
content are byte-for-byte identical to the reviewed source.
- If work is committed on the linked branch, verify the commit and branch
are reachable from the host repository.
- If work exists only as an uncommitted linked-checkout diff, reproduce it in
the host checkout or create and verify a complete transfer artefact before
removal. Account separately for staged, unstaged, and untracked content;
an ordinary
git diff does not include untracked files.
- Preserve unrelated host changes. A matching file name is not evidence that
the contents match, and a clean source after a copy is not evidence that the
host copy is complete.
- Stop on conflicts, missing files, differing content, an unexpected base, or
a host branch switch that would overwrite changes. Do not use reset,
checkout restoration, or an implicit stash to make the transfer proceed.
Every source change must have a verified durable counterpart outside the
checkout that will be removed.
Hand Off To The Host
- From the host-side coordinator, recheck both worktrees and confirm the
linked workspace ID to remove. Do not begin removal until deleting the source
checkout cannot destroy the only copy of any intended change.
- Use the
herdr skill's current removal process to remove only that linked
workspace.
- Confirm Herdr and Git no longer list the linked checkout, and confirm the
source branch still exists before proceeding.
- Switch the host checkout to the source branch. Dirty host changes
may follow the switch only when Git accepts it without overwriting content.
If the switch fails, stop and preserve the current host state.
- Reverify the host branch, changed-file set, content, staging state, and any
prior test evidence. Rerun checks when checkout context or generated state
could affect their result.
- If the user requested further work, continue it from the host checkout.
Otherwise, stop and report the completed transfer.
Report the source workspace removed, final host path and branch, preservation
method, final changed-file state, and verification run. Do not report a
transfer complete merely because the linked workspace disappeared.
1---2name: herdr-workflows3description: Apply local safeguards for Herdr session recovery and transferring linked-worktree changes back to a host checkout. Use alongside the herdr skill when diagnosing Herdr socket routing, recovering the default session, or moving, consolidating, or continuing Herdr worktree changes from the main or host checkout. The herdr skill remains authoritative for all Herdr CLI, topology, targeting, lifecycle, and safety behaviour.4license: Apache-2.05---67# Herdr Workflows89Load `herdr` first. It is the sole source of truth for Herdr commands, command10semantics, topology, identifiers, targeting, agent lifecycle, output reading,11and general safety. Do not restate, override, or infer those rules here. This12companion adds only the local exceptions and transfer ordering below.1314## Session Routing1516- When diagnosing session routing, inspect the inherited `HERDR_SOCKET_PATH`.17 Do not assume the default socket identifies the current pane's server.18- Do not recover a stopped or unreachable shared session by running19 `herdr server` directly. Use `herdr session attach default`; its attach path20 safely starts the default server when absent.2122## Worktree Transfer2324Treat checkout removal and work transfer as separate operations. Use the25`herdr` skill and current CLI to determine the available worktree operations;26this workflow only decides when removal is safe.2728### Establish Both Checkouts29301. Identify the linked source workspace, branch, checkout path, and exact Git31 state. Identify the repository's primary non-linked checkout as the host;32 "host" does not imply that its current branch is named `main`.332. Use Herdr and Git's worktree metadata to establish paths and workspace IDs.34 Confirm whether the host checkout already has staged, unstaged, or untracked35 work.363. Keep the final coordinator outside the linked checkout being removed. If the37 current agent runs inside that checkout, use an existing host workspace or38 open the host checkout with Herdr, then coordinate from that host workspace.39 Do not remove the checkout containing the coordinator's running process.404. Give the host-side coordinator compacted knowledge from the linked-worktree41 session: the user's intent, reviewed scope, material decisions, current Git42 and preservation state, validation evidence, and any further requested work.43 Do not rely on the host coordinator reconstructing that context from files or44 terminal output.4546### Preserve The Reviewed State47481. Record the exact reviewed source scope: staged files, unstaged files,49 untracked files, base commit, and branch. Verification from an earlier turn50 is stale until both checkouts are checked again immediately before removal.512. Make the reviewed content durable outside the linked checkout using the52 smallest non-destructive method appropriate to its state:53 - If the host already contains the intended files, verify their paths and54 content are byte-for-byte identical to the reviewed source.55 - If work is committed on the linked branch, verify the commit and branch56 are reachable from the host repository.57 - If work exists only as an uncommitted linked-checkout diff, reproduce it in58 the host checkout or create and verify a complete transfer artefact before59 removal. Account separately for staged, unstaged, and untracked content;60 an ordinary `git diff` does not include untracked files.613. Preserve unrelated host changes. A matching file name is not evidence that62 the contents match, and a clean source after a copy is not evidence that the63 host copy is complete.644. Stop on conflicts, missing files, differing content, an unexpected base, or65 a host branch switch that would overwrite changes. Do not use reset,66 checkout restoration, or an implicit stash to make the transfer proceed.6768Every source change must have a verified durable counterpart outside the69checkout that will be removed.7071### Hand Off To The Host72731. From the host-side coordinator, recheck both worktrees and confirm the74 linked workspace ID to remove. Do not begin removal until deleting the source75 checkout cannot destroy the only copy of any intended change.762. Use the `herdr` skill's current removal process to remove only that linked77 workspace.783. Confirm Herdr and Git no longer list the linked checkout, and confirm the79 source branch still exists before proceeding.804. Switch the host checkout to the source branch. Dirty host changes81 may follow the switch only when Git accepts it without overwriting content.82 If the switch fails, stop and preserve the current host state.835. Reverify the host branch, changed-file set, content, staging state, and any84 prior test evidence. Rerun checks when checkout context or generated state85 could affect their result.866. If the user requested further work, continue it from the host checkout.87 Otherwise, stop and report the completed transfer.8889Report the source workspace removed, final host path and branch, preservation90method, final changed-file state, and verification run. Do not report a91transfer complete merely because the linked workspace disappeared.