Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

chore: delete the after-change worktree only after the merge into dev is pushed

leepokai119e6984e194
diff --git a/.claude/workflows/after-change.js b/.claude/workflows/after-change.js
index 55be4089..fcad4471 100644
--- a/.claude/workflows/after-change.js
+++ b/.claude/workflows/after-change.js
@@ -151,5 +151,5 @@ return {
cleanup,
refactor: { suggested: refactors, applied },
stopped,
- next: 'Unless an e2e check failed or a skipped fix matters: commit in this worktree, rebase on origin/dev, fast-forward dev, push origin dev, pull dev in the main checkout. Then leave the worktree and, from the main checkout, delete it: `git worktree remove --force <worktree>`, `git branch -D <branch>`, then `npm run dev -- --prune` in apps/desktop. Check that no `npm run dev` from it is still running.',
+ next: 'Unless an e2e check failed or a skipped fix matters: commit in this worktree, rebase on origin/dev, fast-forward dev, push origin dev, pull dev in the main checkout. Only once that merge is pushed (never before, and not at all if the merge or push fails), leave the worktree and, from the main checkout, delete it: `git worktree remove --force <worktree>`, `git branch -D <branch>`, then `npm run dev -- --prune` in apps/desktop. Check that no `npm run dev` from it is still running.',
}
diff --git a/CLAUDE.md b/CLAUDE.md
index 3cc887de..394fb911 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -17,7 +17,7 @@ Bot-based remote for coding agents: persistent named bots on your computer, mess
## Clean code
- Keep code modular and clean on every change: reuse before writing, one responsibility per file/type, no new code appended to files past ~500 lines (split first), views/components hold no I/O or logic, short single-purpose functions, enums over flags, no dead code, no swallowed errors. Full rules: [docs/guides/clean-code.md](docs/guides/clean-code.md).
-- After every code change (tests green, before commit): review → fix → end-to-end test → cleanup and refactor, by running the `after-change` workflow from the change's worktree; then merge, stop its `npm run dev` and delete the worktree: [after every change](docs/guides/clean-code.md#after-every-change-review-e2e-cleanup).
+- After every code change (tests green, before commit): review → fix → end-to-end test → cleanup and refactor, by running the `after-change` workflow from the change's worktree; then merge into `dev`, and only after the merge is pushed delete the worktree (its `npm run dev` stopped): [after every change](docs/guides/clean-code.md#after-every-change-review-e2e-cleanup).
## Architecture
diff --git a/docs/guides/clean-code.md b/docs/guides/clean-code.md
index b47af452..6865d33b 100644
--- a/docs/guides/clean-code.md
+++ b/docs/guides/clean-code.md
@@ -47,6 +47,6 @@ Once a code change works (its tests pass) and before commit, it goes through thr
In Claude Code, the `after-change` workflow (`.claude/workflows/after-change.js`) runs all three: start it from the change's worktree with `{"change": "<what changed and which flows to walk>", "e2e": "minimal"}` (`"full"` for platform code, packaging or the desktop main process; `"base"` if the change isn't against `origin/dev`). It returns the confirmed and refuted findings, the e2e checks, what the cleanup changed and each refactor applied or skipped, and ends by stopping the worktree's `npm run dev` (its Electron app and sandbox host).
-Once it's green, the change is committed, merged into `dev` and pushed, and the worktree is deleted right away: leave it, then from the main checkout `git worktree remove --force <path>`, `git branch -D <branch>` and `npm run dev -- --prune` in `apps/desktop` (deletes its sandbox). Nothing started from the worktree keeps running.
+Once it's green, the change is committed, merged into `dev` and pushed. Only after that merge is pushed is the worktree deleted (a failed merge or push keeps it): leave it, then from the main checkout `git worktree remove --force <path>`, `git branch -D <branch>` and `npm run dev -- --prune` in `apps/desktop` (deletes its sandbox). Nothing started from the worktree keeps running.
Agents touch only the change's own hunks, never another agent's uncommitted work. Keep refactors in `refactor` commits apart from the behavior change. The final report lists the review findings (fixed, or refuted and why), each e2e check that ran or couldn't and why, what the cleanup changed, and each refactor applied or skipped with one line why. Docs- or config-only changes skip this; a tool without subagents does the stages itself.