v1.1.1 Released · Aggregated Vault bundles, disk headroom & shallow guards, fbk doctor playbook →
fireworks-branch-killer brand mark
getfbk.dev · Zero-Deps Python 3.9+ Engine & Multi-Agent Skill

Stop letting AI agents turn your disk into a worktree graveyard.

Deterministic Git worktree & branch hygiene across Claude Code, Codex, Antigravity (AGY), Amp, DeepSeek Harness, Amy, T3 Code, and Orca—with a self-evolving fbk doctor, zero-write Squash/Rebase detection, and a hardened Recovery Vault.

npx -y [email protected] add yizhiyanhua-ai/fireworks-branch-killer/skills/fireworks-branch-killer --agent codex claude-code -g -y --copy
0 DepsPython 3.9+ stdlib
4 TiersFail-Closed safety
7+ HarnessesHooks & auto-discovery
33 / 33Isolated sandbox tests
v1.1.0 Flagship

Meet fbk doctor: a self-evolving space playbook that learns your machine.

Every checkup and cleanup writes back into a personal <state_dir>/playbook.md—never dirtying your repository—so recommendations sharpen as your stack and habits evolve.

01 · HARDLINK AWARE

Samples st_nlink > 1 vs. true hogs

Distinguishes pnpm hardlinked node_modules (reminding you to run pnpm store prune) from exclusive physical disk eaters like Rust target/ and Next.js .next/cache.

02 · AUTO-CLEAR WINS

Fixed issues promote to Resolved Wins

Fix a flagged .gitignore trailing slash (node_modules/) and re-run doctor: the warning automatically promotes into Resolved Wins in your playbook.

03 · ACTION FEEDBACK

Real cleanup telemetry feeds back

Every slim, clean, or close --apply feeds actual reclaimed GBs and recurring hotspot repositories back into your profile.

04 · --learn & --no-evolve

Capture team gotchas anytime

Run fbk doctor --learn "..." --stack js-ts or tell your agent to remember a rule. Need a strict zero-write probe? Pass --no-evolve.

Zero Learning Curve

Ask in plain English/Chinese or invoke the deterministic CLI.

Inside Claude Code, Codex, AGY, or Amp, natural-language phrases route straight to scripts/fbk.py instead of ad-hoc rm -rf guesses.

Natural Language vs CLI command reference
Goal Ask Your Agent Naturally Deterministic CLI
Evolving workspace checkup “Run fbk doctor and check my space-saving tips” fbk doctor --root .
Open living local playbook “Show my evolving fbk space-saving playbook” fbk doctor --show-playbook
Record a new gotcha “Save a lesson in fbk: prune pnpm store after cleanups” fbk doctor --root . --learn "Run pnpm store prune" --stack js-ts
Keep branches, slim caches “Slim node_modules, .next/cache, and target in idle worktrees” fbk slim --root . --apply
Close merged PR worktree “PR squash-merged—close this worktree and branch with fbk” fbk close --worktree ./wt-feat --apply
Tier-0 cleanup & rollback “Preview Tier-0 cleanup” / “Restore last vaulted branch” fbk clean --root . --tier 0 --apply · fbk restore <id> --apply
Root-Cause Prevention

9 AI coding stack patterns built into fbk doctor.

Stop duplicating GBs across parallel worktrees from day one—plus critical traps surfaced automatically during diagnosis.

Full-stack AI coding space-saving matrix
Stack / Layer Root-Cause Mechanism Critical Gotcha & fbk Synergy
Claude Code worktree.symlinkDirectories Never end .gitignore rules with / (node_modules/ fails on symlinks—write node_modules). fbk slim uses follow_symlinks=False safely.
JS / TS (pnpm & bun) virtualStoreType: global · bun CoW Standard pnpm hardlinks node_modules to a global store; deleting one worktree frees little until pnpm store prune runs. Real exclusive hogs: target/ & .next/cache.
Browser E2E / QA PLAYWRIGHT_BROWSERS_PATH · PUPPETEER_CACHE_DIR Externalizes 400 MB–1.2 GB browser binaries; set trace and video to retain-on-failure to avoid huge test recordings.
Python & AI / ML uv + UV_LINK_MODE=clone · HF_HOME Keep UV_CACHE_DIR on the same APFS volume for zero-copy venvs and store model weights outside worktrees (saves 10–60 GB).
Rust (Tauri / Wasm) RUSTC_WRAPPER=sccache · CARGO_TARGET_DIR Eliminates 5–20 GB per-worktree target/ bloat; use sccache + fbk slim for parallel lock-free builds.
Go / Mobile / Docker / Git GOMODCACHE · GRADLE_USER_HOME · cp -cR Use git worktree over full clones, tear down test DBs via docker compose down -v, and run git maintenance start.
Zero-Guesswork Architecture

4-Tier Fail-Closed protection & hardened Recovery Vault.

Read-only probes always pass --no-optional-locks, virtual squash probes touch zero loose repo objects, and every non-ancestor delete snapshots a verifiable .bundle first.

TIER 0 · SAFE AUTO

Merged & clean

Ancestor, cherry-pick, or virtual squash-merged branches past the 24h grace period with zero active lsof processes.

TIER 1 · CACHE SLIM

Trim caches, keep code

Removes idle node_modules, .next, target, dist, .venv across 3 nested levels after verifying zero git ls-files.

TIER 2 · REVIEW + VAULT

Dirty or unmerged

Requires --allow-review / --allow-dirty and writes a .bundle + diff + untracked .tar.gz to Recovery Vault first.

TIER 3 · FAIL-CLOSED

Never auto-touched

Primary repos, protected branches, active lsof cwd, index.lock, .fbk-keep, .delivery, or 24h grace period.

Why AI coding workspaces explode and how fbk solves it
From AI worktree sprawl & squash ghosts to deterministic closure
4-Tier Fail-Closed safety model and zero-write probing
Zero-write 3-step merge waterfall & Recovery Vault safety chain
Comparison between fbk, raw Git CLI, and ad-hoc agent shell cleanup
Capability fbk (v1.1.1) Raw Git CLI Ad-Hoc Agent rm -rf
Squash & Rebase merge detection Zero-write 3-step waterfall (ancestor + git cherry + isolated virtual squash) git branch --merged misses squash & rebase Unreliable LLM guesses
Live agent & WIP safety Fail-closed lsof cwd check, 24h grace, .fbk-keep, .delivery Manual inspection per worktree Can wipe active worktrees
Reversible Recovery Vault 1 aggregated .bundle/repo + 5 GiB disk guard + shallow protection None (manual reflog expiry) Permanent data loss
Cache slim & pnpm hardlinks fbk doctor samples st_nlink > 1 + 3-level safe cache slim None May follow symlinks or delete tracked dist/
7+ Coding Harnesses

One skill package. Universal lifecycle prevention.

SessionStart warns gently when stale worktrees accumulate; PreToolUse intercepts /tmp git remote add bloat and worktree quota sprawl before it starts.

Multi-harness continuous lifecycle integration
Supported AI coding harnesses and hook integration
Harness Skill Discovery Hooks & Guard Auto-Detected Worktrees
Claude Code .claude/skills/ .claude/settings.json .claude/worktrees/*, claude-*
Codex .agents/skills/ ~/.codex/hooks.json + AGENTS.md .codex/worktrees/*, codex*
Antigravity (AGY) .agents/skills/ .agents/hooks.json agy-*, ge\d+-*, .gemini
Sourcegraph Amp .agents/skills/ · ~/.config/agents/skills/ AGENTS.md Shared .agents/skills/ standard
DeepSeek / Amy / T3 / Orca .agents/skills/ hook_adapter.py + ORCA_* wt-ds*, .amy/*, .t3/*, .orca/*
FAQ

Frequently asked questions

Does fbk clean untracked node_modules and build caches if I keep the branch?
Yes. Run fbk slim --root . --apply (or ask your agent to slim idle caches). It recursively scans 3 levels for monorepos, checks lsof for active processes and git ls-files to protect tracked files, skips symlinks (follow_symlinks=False), and trims node_modules, .next, target, dist, and .venv without deleting your code or branch.
Why does deleting a pnpm worktree sometimes reclaim little disk space?
Standard pnpm hardlinks files in node_modules to a global store. Unlinking one worktree does not reclaim physical blocks while the store holds references. fbk doctor samples st_nlink > 1 to detect this and reminds you to pair cleanups with pnpm store prune (or enable virtualStoreType: global), while targeting exclusive physical hogs like target/ and .next/cache.
Does fbk doctor modify my Git repository or commit anything?
No. Your personal evolving playbook.md and evolution-profile.json live inside <state_dir> (~/.cache/fireworks-branch-killer or --state-dir), never inside your repo. Pass --no-evolve for zero state writes.
Can it safely detect GitHub Squash Merges and Rebase merges?
Yes. Unlike plain git branch --merged, fbk runs a zero-write 3-step waterfall: ancestor check → git cherry → virtual squash merge inside an isolated temporary GIT_OBJECT_DIRECTORY, writing zero loose objects into your real repo.
What happens if I regret deleting an unmerged branch?
Every non-ancestor deletion, detached unmerged HEAD, or dirty worktree snapshots a verifiable .bundle (plus git diff and untracked .tar.gz) into Recovery Vault before removal. Run fbk restore --list and fbk restore <receipt_id> --apply to recover cleanly.
Why does the skill work with Claude Code, Codex, and Amp without separate versions?
All three follow the open SKILL.md standard under .agents/skills/ (with .claude/skills/ symlinked or copied). Installing once via npx skills gives every compatible agent identical deterministic safety guardrails.
How does fbk avoid filling the disk when archiving hundreds of unmerged branches?
Since v1.1.1, fbk batches all unmerged branches and detached HEADs per repository into a single multi-ref .bundle via git bundle create --stdin, verifies every ref with git bundle verify, enforces a fail-closed 5 GiB preflight disk headroom check (--min-free-gb), and blocks unsafe shallow-clone bundling.