atlasomnia/hermes-custom-pack/coding-worktree-recovery

Claude Code and agent skill by atlasomnia/hermes-custom-pack

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

coding-worktree-recovery — Safely recover and continue interrupted or overlapping coding-agent work in a dirty Git checkout, including concurrent-writer arbitration, macOS cloud-synced/dataless checkout recovery, bounded handoff, and verified closeout.

Install

npx vskill@latest install atlasomnia/hermes-custom-pack/coding-worktree-recovery

SKILL.md

The same SKILL.md was published earlier as atlasomnia/donna-starter/coding-worktree-recovery.

Coding Worktree Recovery

Use this skill when coding-agent work is interrupted, an agent exits without a clean commit, multiple controllers target the same checkout, or the checkout produces inconsistent file/Git behavior.

This skill is about preserving valid work and restoring one trustworthy writer. It does not authorize pushing, merging, publishing, or destructive cleanup.

Core invariants

  1. One checkout, one writer. Read-only reviewers may overlap; write-capable agents may not.
  2. The live filesystem is authoritative. Agent summaries and successful process exits are evidence leads, not proof.
  3. Never clean another writer's work. Do not reset, stash, checkout, delete, or overwrite unexplained changes.
  4. Commits are checkpoints, not completion. Re-run controller gates after the final commit.
  5. Mechanical status and reasoning are separate. A deterministic watchdog may report process/Git state; acceptance still requires a controller review.

Recovery workflow

1. Freeze new writers
  • Do not launch another implementation agent yet.
  • Enumerate all live coding/Hermes processes whose full command references the checkout.
  • Record PID, parent PID, process group, start time, elapsed time, and command.
  • Inspect child processes as well as tool-managed process handles; an interrupted parent can leave an orphan writer.
  • Trace workers back to long-lived TUI/gateway controllers. Killing only a visible hermes ... chat PID is insufficient when its controller can respawn or resume another worker.
  • Match writers by exact command semantics (for example, hermes ... chat plus checkout), not by broad words such as hermes, model names, or the checkout path; broad matching misclassifies tsserver and other read-only services.
  • If a stale TUI or messaging controller repeatedly respawns workers, preserve the user session while stopping its already-spawned worker/monitor process groups. Trace the exact originating conversation before transferring ownership.
  • Do not assume /stop cancels prior task-owned background work. It may correctly report no active task while a previously launched worker survives or its completion notification triggers a successor. When that happens, send an explicit plain-language cancellation instruction into the exact originating conversation, require acknowledgement, and independently verify that no new generation appears. Do not suspend the production messaging gateway for this purpose.
2. Arbitrate ownership
  • Classify every surviving process by its full command and repository scope: write-capable controller/worker, strictly read-only reviewer, repository service, language server, or unrelated campaign. A Hermes process is not automatically a writer.
  • Keep the earliest legitimate writer if it is still making bounded progress.
  • Stop later duplicate writers and their child processes.
  • Do not launch a duplicate review merely because the fresh controller cannot see the old tool-process handle. An interrupted parent can leave a read-only reviewer alive under its OS PID; recover its profile/session result instead.
  • A living read-only reviewer may overlap controller-run deterministic gates only when no writer survives and the reviewer prompt forbids generators, installs, builds, tests, staging, commits, and edits.
  • If a worker has undergone repeated context compaction without a committed RED→GREEN slice, terminate it and preserve the tree for a fresh handoff.
  • After stopping a writer, verify the process and descendants are gone before touching the checkout.
2A. Distinguish process liveness from forward progress

A live PID, recent log timestamp, active research child, or expanding diff proves execution activity—not convergence. When the user asks whether work has stalled, lead with the task gate: state Task N passed or Task N incomplete, then report process liveness separately.

Classify a worker as running but nonconverging when the same acceptance gate remains RED through the initial pass plus one bounded resume while mechanisms and diff size keep changing. At that threshold:

  1. Preserve the exact dirty diff and latest authoritative RED artifact outside the repository.
  2. Stop the obsolete writer generation and any watcher/launcher that can revive it; verify the full process group is gone.
  3. Re-run the smallest focused gate against the preserved tree to establish the replacement worker's true starting failure.
  4. Create a fresh dirty-tree handoff naming the baseline HEAD, complete changed-file allowlist, preserved patch hash, exact remaining blocker, required acceptance artifact, and forbidden operations.
  5. Launch the requested replacement model as a fresh sole writer and verify the live provider/model command plus absence of the retired generation.

Do not answer “not stalled” merely because the process is alive. For the full evidence matrix and status wording, use `shared-worktree-agent-orchestration/.

3. Inventory the checkout

Capture:

  • absolute root, branch, HEAD, remotes, local Git identity;
  • git status --short --branch;
  • changed and untracked paths;
  • diff statistics and git diff --check;
  • active build/test processes;
  • any unexpected duplicate files.

Do not assume a prior clean preflight is still current.

Unclear dirty checkout: isolate instead of commandeering

If the canonical checkout is dirty with unrelated work and no current writer can be positively identified, do not write into it merely because the requested files are currently clean. Preserve the dirty tree and create a fresh worktree from the verified HEAD under a unique path, recording the base SHA and branch. Verify the new worktree is clean before launching one writer. Finish and validate the bounded change there; leave integration/cherry-pick/merge to an explicit later gate. This prevents an interrupted or dormant controller from losing ownership of unrelated WIP.

Restored checkout relocation

When a session is redirected from an old checkout to a restored repository root, recover the intended project/remote, branch, and full HEAD from the originating session or durable handoff before selecting anything. Require an exact match and independently verify complete state plus writer ownership. If no destination checkout matches—or the expected commit is absent from all destination object databases—select none and fail closed rather than continuing at the old path or choosing a similar sibling. Read-only relocation scanners whose command text mentions the path are not writers without corroborating write semantics. Follow for the full enumeration, manifest/object check, ownership classification, and reporting contract.

If the missing checkout was clean and a verified private bare remote contains the exact branch ref and commit, reconstruct a standalone destination through a unique same-volume partial clone using --no-hardlinks --single-branch --branch; verify exact HEAD/branch, complete clean status, git fsck, internal Git common-dir, absent object alternates, and no writer before atomically renaming it to the final path. Re-read the retired checkout afterward to prove it stayed unchanged. Repository-local ignored plans may be absent from the clone, so rebuild remaining work from external evidence/session history and recheck historical blockers live. Follow for this clean-checkout path.

If no complete archive exists but a verified private bare remote contains the exact committed baseline and durable session evidence contains the complete dirty overlay, use the recovery procedure. Reconstruct only from exact patches/file bodies, require recorded hashes where available, preserve staged/unstaged/untracked classification, and fail closed on any mismatch rather than consulting a prohibited checkout.

3A. Integrate an accepted change into a dirty live service checkout

When an accepted commit must land in a running gateway/service without disturbing unrelated dirty work, use a bounded semantic integration transaction:

  1. Before editing, record HEAD/branch, full porcelain inventory, affected-path hashes, service PID/command, supervisor label, and writer evidence. Archive every affected live path under a timestamped report directory and write a SHA-256 manifest for both archive and live copies.
  2. Derive the accepted delta from parent → child; do not treat the accepted child file as a replacement template. Three-way merge each affected path against the live file, parent, and accepted child. If live code diverged, preserve live-only behavior and transplant only the accepted behavior. Record conflict resolutions and any compatibility seam explicitly.
  3. Verify scope after every edit: compare unrelated porcelain entries to the preflight inventory, run git diff --check on tracked files, scan untracked files for trailing whitespace, compile the changed modules, and run focused tests for source, API, and finalization boundaries. Save raw test logs and counts.
  4. Immediately before restart, repeat the writer and inventory checks. A clean test result does not authorize restart if another write-capable process can still mutate the checkout.
  5. Restart through an external supervisor boundary. A command launched from inside the supervised gateway can be terminated by the gateway itself; use the project’s external gateway-restart command or a separate shell/controller. Verify the new PID, supervisor state, two health checks, and startup-log scan.
  6. Produce a verifiable report containing commit IDs, scoped paths, backup hashes, merge disposition, exact commands/results, restart evidence, health responses, and any blocker. Never claim restart completion from an issued command alone.
4. Diagnose storage integrity

On macOS, check for cloud/File Provider placeholders when reads fail, dependencies repeatedly corrupt, or Git reports Resource deadlock avoided:

bash
stat -f '%N | %z bytes | flags=%Sf' <paths>

If source, Git metadata, or dependency executables are compressed,dataless, stop using that checkout as a writer surface. Follow macOS cloud-synced checkout recovery.

5. Preserve and transfer work
Selecting a restored checkout after repository relocation

When an existing session is redirected from an old checkout to a restored repository root, select the replacement only if the candidate worktree itself matches the recorded project lineage, branch, and exact HEAD. A shared object database containing the expected commit, or a sibling worktree listing the expected branch at the old path, is not a match.

After a scheduled chat reset, recover the predecessor by the same messaging thread/topic before using broad keyword search; otherwise a different project that merely mentioned the archive root can be mistaken for the active repository. Extract the expected project + branch + full HEAD and last complete status from that predecessor. If the user then asks for the remaining plan or phases, reconcile the authoritative plan against that same-thread verified boundary and report only the unfinished execution order plus closure gates.

Inspect restoration manifests when available, then verify the candidate's Git root, branch, HEAD, complete staged/unstaged/untracked/stash/lock state, worktree registration, and live writer/open-file ownership. If only a sibling feature worktree was restored while the canonical branch remains elsewhere, report no checkout selected and stop rather than switching branches, creating a detached substitute, or commandeering the sibling.

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
59
Repository forks
6
7-day trend score
20

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/atlasomnia/hermes-custom-pack/coding-worktree-recovery/badge)](https://verified-skill.com/skills/atlasomnia/hermes-custom-pack/coding-worktree-recovery)

Something wrong with this skill or its page? Tell us.