wt
Spawn a fresh fir agent in its own tmux session on its own git worktree. Use whenever the user wants the work — or the conversation about the work — to happen over there, not here. If the user points at this skill, or has directly loaded it in the context, that alone is the cue — spawn, don't inline.
- License 许可
- MIT
- 所属仓库
- kfet/fir
- 最近更新
- 2026-11-15
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- wt
- builtin
- true
- override
- true
- description
- Spawn a fresh fir agent in its own tmux session on its own git worktree. Use whenever the user wants the work — or the conversation about the work — to happen over there, not here. If the user points at this skill, or has directly loaded it in the context, that alone is the cue — spawn, don't inline.
02 资源文件 3
- 脚本scripts/gc.sh5.0 KB
- 脚本scripts/reap-idle.sh2.8 KB
- 脚本scripts/spawn.sh3.0 KB
03 SKILL.md 正文
Delegate all to a new agent!
-
Pick a short kebab-case feature name from the task description.
-
Construct the task text. The spawned agent will land in
<cwd>-wt-<feature>on branchwork/<feature>— that is its workspace. It must do all work and commits there.Prepend the task text with an explicit pin, e.g.:
You are in a dedicated git worktree on branch work/<feature>. Do all work and commits in this CWD. Before exploring, run the `recall` skill for this repo (it runs `orient` if no repo map exists yet). <original task here>If the original task names a repo path, clarify that the path identifies the project, not the working directory.
-
Run the spawn script:
bash "$SKILL_DIR/scripts/spawn.sh" <feature-name> "<task text with pin>" -
Sweep up after earlier agents. A wt agent's tmux session closes when the agent exits, but windows can still be left behind: from agents spawned by older versions of this skill, or shells someone opened by hand. Always run the sweep once the spawn succeeded:
bash "$SKILL_DIR/scripts/gc.sh" --reapIt kills only windows with no agent in them. It never kills a live agent, and it never kills your own window.
Lines that start with
REPORTare live agents that look wrong — an agent whose worktree is gone, or one idle for days. You MUST copy everyREPORTline into your answer, word for word. Do not act on them and do not summarise them away. A count of reaped windows is not a substitute: theREPORTlines are the part a human needs. If there are none, say so in one short sentence.Each agent runs in its own detached tmux session (named after the feature, with
./:replaced by_), so killing some other tmux session never takes it down. The script printssession:,window:and anattach:command (tmux switch-client -t …inside tmux,tmux attach -t …outside). It fails if that session already exists. -
Report back what the spawn script returned, then every
REPORTline.
Closing idle sessions: scripts/reap-idle.sh closes every tmux session
whose panes are all idle shells. These are sessions left by agents from
before spawn.sh stopped chaining exec $SHELL, and sessions that
tmux-resurrect restored as empty shells. It covers every session on the
tmux server, not only wt ones, so do not run it as part of a spawn. Run it
when the user asks to clean up idle or restored sessions:
bash "$SKILL_DIR/scripts/reap-idle.sh" # dry run: REAP / KEEP per session
bash "$SKILL_DIR/scripts/reap-idle.sh" --reap # close the REAP sessions
A session is closed only if every pane is dead or is a shell with no child process. It never closes an attached session or the session it runs in. Tell the user which sessions were closed.
Checking in later: the agent's session is named <feature-name>, so talk
to it through fir, not its tmux screen:
fir observe <feature-name> --status # idle | running | error | no-model, last error
fir observe <feature-name> -n 40 # snapshot of what it did; exits
fir send <feature-name> --wait --timeout 5m 'status?' # ask, block for the reply
The same commands work for an agent on another host — run them there
over ssh (rexec). observe_session / send_session only see this machine.
The task description usually follows below, after the skill body:
04 同仓库更多 Skills
wrap-up
Wrap up work on a project branch — review, fix, and simplify in a loop until clean, then ff-merge to main.
tmux-observer
Attach a tmux window to an already-running fir session — observe its transcript and drive its input via tmux send-keys. Use when you need to watch or steer another fir agent.
tmux-driver
Drive interactive CLIs (python, gdb, etc.) via named tmux sessions with multi-window support. Falls back to fir's built-in PTY driver when tmux is unavailable.
telegram-bot-setup
Set up a new Telegram bot channel for a fir project — install the telegram MCP, create a per-project state dir, drop in the bot token, wire .fir/mcp.json with TELEGRAM_STATE_DIR, pair the user, and verify. Use when the user asks to add, configure, or onboard a Telegram bot for a fir worktree/project.
sync
Sync with an upstream source repo — detect changed files, apply equivalent downstream edits, update the baseline, and report any new features or non-trivial changes picked up.
skill-creator
Create, write, add, edit, update, or review a fir skill — author SKILL.md with frontmatter and agent-facing instructions, run the quality checklist, and tell the user to /reload.