agentleFS
yunsiiyunsii/wezdeck/skills/worktree-recycle/SKILL.md

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.

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
  1. Very specific:

    If the user already named the next task, keep it for --task.

    line 75
  2. Distinctive:

    When the user already said 重置 / recycle: do not re-ask about squash / push / init.

    line 76
  3. Very specific:

    Prefer -y when the user explicitly asked to reset.

    line 80
  4. Distinctive:

    After a successful recycle:

    line 96
  5. Distinctive:

    Don't ask the human to run CLI as the main path

    line 115
  6. Distinctive:

    Don't re-ask squash / push / manual-reset questions after the user already said 重置开发分支

    line 116
  7. Very specific:

    Don't use recycle for short-lived task-* / hotfix-* (use reclaim)

    line 117
  8. Very specific:

    Don't --force away dirty trees without an explicit user override

    line 118
  9. Very specific:

    Don't treat attention / ledger / delegate shipped as proof of merge

    line 119
  10. Very specific:

    Don't run sync-runtime or package installs just because recycle finished

    line 120
  11. Distinctive:

    Don't auto-bootstrap the project inside the skill runner

    line 121
  12. Very specific:

    Don't delete Claude transcripts.

    line 122
  13. Very specific:

    Don't maintain a second SKILL.md body outside this directory (link only)

    line 123

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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 Xsame, 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 reset without 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-recycle
TOOL_HOME=…   # dir that contains run.sh
R="$TOOL_HOME/run.sh"

Install / refresh discovery (idempotent, from wezdeck):

./scripts/dev/link-platform-skills.sh

Who runs what

LayerDuty
Skill + run.shSoft preflight, orchestrate recycle; init only with --with-init
worktree-task recycleFetch, 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
HumanIntent; confirm only when preflight shows real blockers (wrong lifecycle slug, dirty outside allowlist)

Agent procedure

  1. Resolve TOOL_HOME; confirm "$R" is executable. Cwd may be a linked dev-* worktree or the primary checkout (or pass --cwd).
  2. Preflight (optional glance; recycle also runs it):
    "$R" preflight --cwd "$PWD"
    Soft signals only. task-* / hotfix-* are real blockers (use reclaim). Dirty trees need --force or a clean tree.
  3. If the user already named the next task, keep it for --task.
  4. When the user already said 重置 / recycle: do not re-ask about squash / push / init. Proceed:
    "$R" recycle --cwd "$PWD" -y [--task "…"] [--fresh-agent] [--dry-run]
    Prefer -y when the user explicitly asked to reset. Do not invent a “先 push / 手动 reset / 先 bootstrap” fork.
  5. Do not run init unless the user asked or you pass --with-init. Leave deps/codegen/services to the follow-up task.
  6. Report briefly: new HEAD, branch (after slug align), remote sync result, next step (including /clear when --fresh-agent).

Preflight covers (skill layer)

CheckHard / softNotes
Primary or linked dev-*hardtask-* / hotfix-* → reclaim
Dirty outside recycle allowlisthard (CLI)Fix or explicit --force from user
Delivery / content-absorbedoff by defaultOpt in with --require-delivered
.delegate/ leftoverssoftAllowlisted clean on linked trees
Next-task text from userpassthroughBecomes --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

BehaviorDefaultOpt-in / opt-out
Delivery gateskip--require-delivered / WT_RECYCLE_REQUIRE_DELIVERED=1
Branch align to slugon--keep-branch-name / WT_RECYCLE_KEEP_BRANCH_NAME=1
Remote syncon--no-sync-remote / WT_RECYCLE_SYNC_REMOTE=0
Project initskip--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 --force away dirty trees without an explicit user override
  • Don't treat attention / ledger / delegate shipped as proof of merge
  • Don't run sync-runtime or package installs just because recycle finished
  • Don't auto-bootstrap the project inside the skill runner
  • Don't delete Claude transcripts; use --fresh-agent + /clear when 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"

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.