Feature: Cross-repo worktree isolation hook and dev agent profile update #205
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ldraney/claude-custom#205
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type
Feature
Lineage
Child of
forgejo_admin/pal-e-platform#188(Cross-repo worktree isolation for parallel agents)Repo
forgejo_admin/claude-customUser Story
As a platform operator spawning parallel Dev agents
I want a PreToolUse hook that warns when agents attempt unsafe cross-repo checkouts, plus updated dev agent instructions
So that parallel agents working on repos other than the spawning repo get isolated working directories and cannot clobber each other
Context
On 2026-03-26, three parallel Dev agents were spawned to work on
westside-playground. All three rancd ~/westside-playground && git checkout ...against the same shared checkout, clobbering each other's branches and working tree state. Work was lost.The root cause: the
worktree-workflowSOP andagent-spawn-conventionsonly cover isolation for the spawning repo. When agents work on a different repo, there is no isolation mechanism. This child ticket implements the enforcement side: a PreToolUse hook to detect the unsafe pattern, dev agent profile updates with cross-repo isolation instructions, and/tmp/clone cleanup.File Targets
Files to create or modify in
claude-custom:hooks/cross-repo-isolation.sh— PreToolUse hook that:cd ~/other-repo && git checkouton a shared checkoutgit clone ~/repo /tmp/{repo}-{branch}agents/dev.md— add cross-repo isolation instructions:/tmp/{repo}-{branch}cd ~/shared-checkout && git checkouton a non-spawning repo/tmp/clones when donecleanup-worktrees.sh(or equivalent) — add/tmp/clone cleanup logic for cross-repo clonesAcceptance Criteria
hooks/cross-repo-isolation.shexists and detects the unsafecd ~/repo && git checkoutpattern on shared checkouts/tmp/{repo}-{branch}clone as the safe alternativeisolation: worktree)agents/dev.mdincludes cross-repo isolation instructions/tmp/clone cleanup mechanism exists (incleanup-worktrees.shor equivalent)/tmp/{repo}-{branch}Test Expectations
bash hooks/cross-repo-isolation.shwith mock inputs simulatingcd ~/westside-playground && git checkout feature-branch— hook fires warning/tmp/directoriesagents/dev.mdcontains cross-repo isolation sectionConstraints
claude-custom/hooks//tmp/clone pattern aligns with the existingCLAUDE.mdWorktree Isolation section inpal-e-platformclaude-custom#184covers adjacent worktree gaps (freshness, cleanup) but NOT the cross-repo isolation hook — no overlapChecklist
hooks/cross-repo-isolation.shcreated and testedagents/dev.mdupdated with cross-repo isolation instructions/tmp/clone cleanup added to cleanup scriptsettings.json(or equivalent hook config)claude-custom#184scopeRelated
forgejo_admin/pal-e-platform#188worktree-workflowandagent-spawn-conventions— tracked as Dottie task on parent issueclaude-custom#184— adjacent worktree gaps (freshness, cleanup), no overlapworktree-workflow(pal-e-docs SOP) — the existing isolation SOPagent-spawn-conventions(pal-e-docs convention) — pre-spawn checklist