Repository navigation
Description
Lane: babysit (cycle 33/34, amendment-round 16).
Triggering example: worker-1033, babysitting melodic-software/claude-code-plugins#1033, reproduced this twice in its own worktree: editing SKILL.md and separately writing a brand-new throwaway ztest.md both returned a successful tool result, but the file was then gone from disk afterward (git shows the tracked file deleted; the new file never persisted). The worker did not modify guardrails and treated the deletion as systemic to markdown Write/Edit in that environment, likely triggered by the markdown-format plugin's PostToolUse hook (markdownlint-cli2 --fix "$FILE") rather than content-specific.
Observed: a markdown Write/Edit reports success, then the target file is deleted from disk.
Expected: the hook lints/auto-fixes in place (or fails loudly / no-ops) — it must never delete the file it was invoked on.
Category: bug (destructive — data loss on any markdown edit in the affected environment; also an operational blocker, since a worker fixing a markdown finding gets a false "success" and may believe it landed a fix that was actually silently lost).
Related pattern, not a duplicate: #1057 logged the same symptom class (a formatter's PostToolUse hook deleting the file it was invoked on, there bash-format's shfmt -w) on a different plugin. Worth checking whether both trace to a shared helper/pattern across the formatter-hook family, but filing separately since the two are different plugins/hooks with independent fixes.
Not a self-observation paper-cut: clears the DEFER-FORBIDDEN / destructive-finding bar (rule 3b class 1), filed standalone per the intake throttle's carve-out.
Recommended immediate mitigation for other workers: verify file survival (git status / re-read) after any markdown Write/Edit, before trusting the write and before committing.
Non-reproduction note from this orchestrator's own session: writing this very issue body as a markdown file in the main session's own working directory did NOT delete the file — markdown-format ran, reported lint findings, and the file survived normally. This suggests the deletion may be specific to worker-1033's particular worktree/environment (e.g. a detached-HEAD or symlinked worktree path, or a stale hook version cached there) rather than universal to every markdown-format invocation on this machine. Worth checking worktree-specific factors during triage rather than assuming a blanket repro.
Activity
kyle-sexton commentedon Jul 22, 2026
Confirmed and broadened by a second, independent worker (worker-1054, same cycle) — this is NOT markdown-specific. Its report:
Orchestrator's own audit (this session, not yet fully independently reproduced): spot-checked this cycle's actually-pushed commits for silent corruption. Three commits that touched
.md/.shfiles via Write/Edit and were then committed+pushed this session (claude-code-plugins@d82de0ba,standards@c05179ec) show cleanmodifieddiffs with real additions/deletions, notremoved/deleted-file entries — so at least these did NOT silently ship a deletion. The two reproductions above (worker-1033, worker-1054) both happened in worktrees that never reached a git-commit step (worker-1054 explicitly left its worktree dirty/unpushed), so the current evidence is: the bug is real and reproducible, but nothing has been confirmed to have silently corrupted an already-merged PR yet. Worth a broader retroactive audit before ruling that out entirely.Operational recommendation from worker-1054 (relayed, not yet acted on by the operator): halt file-mutating fixes fleet-wide until the offending hook is identified/patched, and audit recently-"fixed" PRs for missing/corrupted commits.
kyle-sexton commentedon Jul 22, 2026
This was generated by AI during triage.
TL;DR
The
markdown-formathook is exonerated — by code and by empirical repro in exactly the detached-HEAD linked-worktree context the reporter suspected.markdownlint-cli2 --fixrewrites in place; the hook has nounlink/rm/mv/temp-swap on any path. Every worktree-specific difference degrades to a harmless no-op or skip, never a delete.The reporter's own clue is the key: the hook fires on every
.mdWrite/Edit in both the main session and the worker worktree, and in the main session it ran and the file survived. If the hook were the deleter, main would have reproduced too. It didn't — so the worktree-specific variable is not the hook; it is what else was running in that worktree: the PR-babysit loop. That loop contains a documented destructive working-tree op that explains both symptoms and the non-repro. Root cause is a strong, specific hypothesis but unconfirmed for worker-1033's exact run (loss-time state can't be reconstructed post-hoc) → needs-human.Host:
melo-lap-001, Git-Bash MINGW64,markdownlint-cli2 v0.18.1(markdownlint v0.38.0),typos-cli 1.44.0.Verified against #1057
markdown-formatsources the samehook-utils.shSSOT family (lib/hook-utils.sh, synced toplugins/*/hooks/hook-utils.sh) that bug(bash-format): shfmt -w deletes .sh files instead of formatting on Windows worktree #1057 examined forbash-format.shfmt -w. The accused command iscd "$REPO_ROOT" && markdownlint-cli2 --fix "$FILE"(markdown-format.sh:268). Likeshfmt -w,markdownlint-cli2 --fixmutates the file in place — it never unlinks. bug(bash-format): shfmt -w deletes .sh files instead of formatting on Windows worktree #1057 disproved "shfmt -wdeletes the file"; the identical read holds here for "markdownlint-cli2 --fixdeletes the file.".mdwrite, three hooks fire (markdown-format+ the extension-unscopedeol-normalizerandtypos-format) — the same trio-minus-bash-formatfamily bug(bash-format): shfmt -w deletes .sh files instead of formatting on Windows worktree #1057 cleared end-to-end.Empirical repro (throwaway git repo + linked worktree, scratch only)
markdownlint-cli2 --fixon a real.md, direct (the accused command): file PRESENT, 45→41 bytes, rewritten in place. Not deleted.markdown-format.shhook,.mdinside a genuine detached-HEAD linked worktree (git-dir≠git-common-dirconfirmed), real CC-shaped payload,CLAUDE_PROJECT_DIRset to the worktree: hookrc=0,SKILL.mdPRESENT, 14→12 bytes (fixed in place:#Bad→# Bad, trailing spaces stripped). Not deleted.The detached-HEAD / linked-worktree context — the reporter's leading suspect — did not change the outcome.
The actual worktree-specific deleter
babysit-prs/reference/loop.md:405-407, §5.1.6 "PR done — transition to next":This runs only inside a babysit worktree on the PR-transition path — never in the main session. It maps to both symptoms precisely:
ztest.md"never persisted" =git clean -fdremoving untracked files.SKILL.md"shows deleted" =git reset --hard HEADreverting/removing an uncommitted working-tree change (a new-but-uncommitted file is removed; an edit to a tracked file is reverted).Sequence that fits the report: the worker's Edit/Write did land on disk (tool returned success — correctly), then the loop's own §5.1.6 housekeeping wiped the uncommitted change while transitioning PRs, and the loss got misattributed to the
markdown-formathook because it correlated in time with the markdown edit.Corroborating evidence:
feat/976-find-handoff-skill(PR feat(session-flow): add find-handoff skill to recover a lost handoff (#976) #1033) shows only normal commits/merges — consistent with this mechanism:git cleanleaves no ref trace, andgit reset --hard HEADdoes not move HEAD, so neither leaves a discriminating reflog entry.guardrails/block-dangerous-git.shblocks both halves of the §5.1.6 combo —git reset --hard("discards uncommitted work with no recovery path") andgit clean -f("permanently deletes untracked files"). Both fired against my throwaway repo during this investigation. The repo already classifies these as the destructive operations.Conclusion
markdown-formatcannot delete the file (code + repro).git reset --hard HEAD+git clean -fdcleanup — but not confirmed for worker-1033's specific run. I cannot reconstruct loss-time state, and the ops that fit leave no reflog trace by design.Recommendation
Route needs-human. Named open question, answerable only from worker-1033's transcript:
If confirmed, the fix belongs in
babysit-prs§5.1.6, notmarkdown-format: the cleanup must not silently destroy uncommitted changes it cannot distinguish from "failed-fix cruft" (e.g. commit/stash intended edits before the destructive reset+clean, or narrowgit cleanscope), and workers should treat post-Editgit statusverification as mandatory in the babysit loop (the reporter's suggested mitigation is correct). Do not patchmarkdown-format— a guard there addresses nothing.kyle-sexton commentedon Aug 13, 2026
Frontier disposition (drain session)
Ruling: Promote to agent-ready.
Small scoped bug with a bounded blast radius and enough specification for autonomous pickup. Removed
needs-human, addedagent-ready.Re-open trigger: If implementation reveals an unresolved design fork or security policy decision.
kyle-sexton commentedon Aug 13, 2026
Frontier disposition (drain session)
Ruling: Close as not planned for this drain wave.
Issue remains historically valuable but is either advisory, blocked on a larger carrier, or superseded by later conventions. Re-open with a concrete acceptance brief if a consumer needs the work this session.
Title: bug(markdown-format): PostToolUse hook deletes .md files after a successful Write/Edit (worktree-specific?)