worktree-space
Skill0 starsChanged 2 months agoMITView on GitHub
Use when running inside Herdr (HERDR_ENV=1) and the user asks to open a worktree in a Herdr space, move this session into a new worktree, start feature work in its own worktree workspace, or says worktree space / herdr worktree / open in herdr. Works in any git repository. Outside Herdr do not use it: use EnterWorktree alone.
In this repository10 other files it gives its agents.
- create-pull-requestSkill
- deep-researchSkill
- herdrSkill
- pr-review-loopSkill
- readme-writerSkill
- remixSkill
- sandi-metz-rulesSkill
- skill-creatorSkill
- tearing-down-a-merged-worktreeSkill
- test-auditSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Create the worktree with the bundled script, then move this session into it with EnterWorktree.
- Very specific: line 37
Call EnterWorktree with the printed path.
- Distinctive: line 39
If the script reported a background setup log, wait for it before any command that needs dependencies or databases:
- Very specific: line 60
After moving from one worktree to another, the previous worktree is no longer writable from this session.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Worktree space
Create the worktree with the bundled script, then move this session into it
with EnterWorktree. The script moves the terminal pane into a grouped
Herdr workspace; EnterWorktree moves the session. Both are needed, and
the script cannot do the second one.
Worktrees go under <repo>/.claude/worktrees/<slug>. That is the one
location EnterWorktree accepts from anywhere, including from a session
already sitting in another worktree, so chained runs are a normal move.
Script: ~/.claude/skills/worktree-space/scripts/worktree-space.sh
(--help is the header comment; read it for flags).
Steps
- Gate:
test "${HERDR_ENV:-}" = 1. If it fails, say so and stop using this skill. Create the worktree withEnterWorktree name=<slug>instead. - Pick the branch name up front (the ticket's canonical branch name if the project uses one; renaming a branch with an open PR closes the PR).
Run:
~/.claude/skills/worktree-space/scripts/worktree-space.sh <branch>It prints the worktree path, the workspace id, and a final
==> Next: EnterWorktree path="..."line. If the repo ships its ownbin/worktree-herdr, the script delegates to it and the project's own worktree skill or AGENTS.md rules take over from here, including any handoff behaviour on chained runs.- Call
EnterWorktreewith the printedpath. Neverclaude --resumein the new workspace: the running session is the one that moved. If the script reported a background setup log, wait for it before any command that needs dependencies or databases:
grep -q 'Done. Worktree ready' <repo>/.claude/worktrees/<slug>-setup.log- First report after the move states: workspace opened, session moved, and whether setup is still running.
Project hooks
bin/worktree-herdrin the repo: the script execs it. Project owns the flow..claude/worktree-setup.shin the repo (executable): run once inside the new worktree in the background with args<slug> <branch>. Its last line on success must beDone. Worktree ready. Use it for bundle/db/deps.
Notes
- Re-runnable: an existing worktree dir is reused and an already-open workspace gets a new tab instead of a second workspace.
- After moving from one worktree to another, the previous worktree is no
longer writable from this session. Re-enter it with
EnterWorktree pathif you need to. - Teardown:
ExitWorktreemoves the session back, not the pane. Move the pane to its home workspace first (herdr pane move <id> --workspace <home>), then exit withaction: "remove". The empty workspace closes when its last pane leaves. Delete the setup log too. - Outside Herdr the script still builds the worktree and prints the
herdr worktree opencommand to run later.
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.

