worktree-recycle
Skill4 starsChanged 48 days agoMITView on GitHub
Fast reset of a primary checkout or linked dev-* workstation onto origin/HEAD: soft preflight, then worktree-task recycle (fetch + dirty check + hard-reset + remote sync). Skips delivery gate and project init by default. Use when the user says 重置开发分支 / 重置工作站 / recycle this worktree / 收尾换下一轮, optionally with a next-task brief.
In this repository11 other files it gives its agents.
- AGENTS.mdAGENTS.md
- frontend-designSkill
- web-design-guidelinesSkill
- adversarial-reviewSkill
- brainstormSkill
- cross-repo-delegateSkill
- habit-weeklySkill
- human-runSkill
- repo-hygieneSkill
- wezdeck-runtime-opsSkill
- yuns-engineerSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 5 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 75
If the user already named the next task, keep it for --task.
- Distinctive: line 76
When the user already said 重置 / recycle: do not re-ask about squash / push / init.
- Very specific: line 80
Prefer -y when the user explicitly asked to reset.
- Distinctive: line 96
After a successful recycle:
- Distinctive: line 115
Don't ask the human to run CLI as the main path
- Distinctive: line 116
Don't re-ask squash / push / manual-reset questions after the user already said 重置开发分支
- Very specific: line 117
Don't use recycle for short-lived task-* / hotfix-* (use reclaim)
- Very specific: line 118
Don't --force away dirty trees without an explicit user override
- Very specific: line 119
Don't treat attention / ledger / delegate shipped as proof of merge
- Very specific: line 120
Don't run sync-runtime or package installs just because recycle finished
- Distinctive: line 121
Don't auto-bootstrap the project inside the skill runner
- Very specific: line 122
Don't delete Claude transcripts.
- Very specific: line 123
Don't maintain a second SKILL.md body outside this directory (link only)
≈ “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 recycle (platform skill — single source)
Who runs: the coding agent, not the human.
Never tell the user to copy-paste worktree-task recycle as the primary path — load this skill and run the co-located runner.
Hard git ops stay in worktree-task recycle (dirty check, optional delivered gate, allowlisted clean, branch align to slug, reset --hard origin/HEAD, sync origin/<branch>).
This skill owns soft preflight and readiness hints. Project bootstrap is not part of recycle — the next task initializes what it needs.
When to load / run
| User intent (examples) | You do |
| 重置开发分支 / 重置工作站 / recycle / 收尾换下一轮 | preflight (optional glance) → recycle -y |
| 重置并开始做 X / recycle with task X | same, pass --task "X" |
| 只要看看能不能重置 | preflight or recycle --dry-run only |
| 主 worktree / primary / master 对齐最新主分支 | same recycle path on the primary checkout |
wezdeck standing close-out: worktree round delivered onto origin/HEAD / 「合入主分支后收尾」 | same recycle path — default, not optional |
Skip / redirect:
- Short-lived
task-*/hotfix-*end-of-life →worktree-task reclaim/Ctrl+k g r(not this skill) - Pure
git resetwithout this skill → do not bypass; still use the runner
wezdeck policy: worktrees = isolation; delivery = direct mainline (no PR).
Invariant: idle dev/* tip must equal origin/HEAD. After landing on mainline (or when mainline moved while the workstation sat idle), immediately recycle — do not leave dev/* behind. See docs/workspaces.md → Maintenance loop.
Resolve TOOL_HOME (first hit wins)
1. $WORKTREE_RECYCLE_HOME
2. directory of this SKILL.md if run.sh is co-located
3. $HOME/.agents/skills/worktree-recycle
4. $WEZDECK_ROOT/skills/worktree-recycle
5. $HOME/github/wezterm-config/skills/worktree-recycleTOOL_HOME=… # dir that contains run.sh
R="$TOOL_HOME/run.sh"Install / refresh discovery (idempotent, from wezdeck):
./scripts/dev/link-platform-skills.shWho runs what
| Layer | Duty |
Skill + run.sh | Soft preflight, orchestrate recycle; init only with --with-init |
worktree-task recycle | Fetch, dirty gate, branch align, hard-reset, remote sync |
| Agent (you) | After git is clean, start the next task; bootstrap the stack only if that task needs it |
| Human | Intent; confirm only when preflight shows real blockers (wrong lifecycle slug, dirty outside allowlist) |
Agent procedure
- Resolve TOOL_HOME; confirm
"$R"is executable. Cwd may be a linkeddev-*worktree or the primary checkout (or pass--cwd). - Preflight (optional glance; recycle also runs it):
Soft signals only."$R" preflight --cwd "$PWD"task-*/hotfix-*are real blockers (use reclaim). Dirty trees need--forceor a clean tree. - If the user already named the next task, keep it for
--task. - When the user already said 重置 / recycle: do not re-ask about squash / push / init. Proceed:
Prefer"$R" recycle --cwd "$PWD" -y [--task "…"] [--fresh-agent] [--dry-run]-ywhen the user explicitly asked to reset. Do not invent a “先 push / 手动 reset / 先 bootstrap” fork. - Do not run init unless the user asked or you pass
--with-init. Leave deps/codegen/services to the follow-up task. - Report briefly: new HEAD, branch (after slug align), remote sync result, next step (including
/clearwhen--fresh-agent).
Preflight covers (skill layer)
| Check | Hard / soft | Notes |
Primary or linked dev-* | hard | task-* / hotfix-* → reclaim |
| Dirty outside recycle allowlist | hard (CLI) | Fix or explicit --force from user |
| Delivery / content-absorbed | off by default | Opt in with --require-delivered |
.delegate/ leftovers | soft | Allowlisted clean on linked trees |
| Next-task text from user | passthrough | Becomes --task / .task-brief.md |
Desired end state
After a successful recycle:
- Local tip ==
origin/HEAD(default branch tip) - Branch name matches the worktree slug mapping (
dev-agent→dev/agent); primary uses the default branch (master/main) origin/<same branch>tip == that same commit (unless--no-sync-remote)- Upstream is
origin/<branch>(linked never tracks the default branch) - Project bootstrap not required by recycle itself
Fast path defaults
| Behavior | Default | Opt-in / opt-out |
| Delivery gate | skip | --require-delivered / WT_RECYCLE_REQUIRE_DELIVERED=1 |
| Branch align to slug | on | --keep-branch-name / WT_RECYCLE_KEEP_BRANCH_NAME=1 |
| Remote sync | on | --no-sync-remote / WT_RECYCLE_SYNC_REMOTE=0 |
| Project init | skip | --with-init or run.sh init |
Don't
- Don't ask the human to run CLI as the main path
- Don't re-ask squash / push / manual-reset questions after the user already said 重置开发分支
- Don't use recycle for short-lived
task-*/hotfix-*(use reclaim) - Don't
--forceaway dirty trees without an explicit user override - Don't treat attention / ledger / delegate
shippedas proof of merge - Don't run
sync-runtimeor package installs just because recycle finished - Don't auto-bootstrap the project inside the skill runner
- Don't delete Claude transcripts; use
--fresh-agent+/clearwhen a blank session is wanted - Don't maintain a second SKILL.md body outside this directory (link only)
Related
- Runner:
run.sh,lib/preflight.sh,lib/init.sh(opt-in) - Hard ops:
scripts/runtime/worktree/worktree-task recycle - Docs:
docs/workspaces.md(Recycle),docs/daily-workflow.md(closing a round) - Link:
scripts/dev/link-platform-skills.sh - Offline:
"$TOOL_HOME/test.sh"
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.

