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: end after-change by stopping npm run dev and deleting the worktree

leepokai488450da2b74
diff --git a/.claude/workflows/after-change.js b/.claude/workflows/after-change.js
index e3e7c049..55be4089 100644
--- a/.claude/workflows/after-change.js
+++ b/.claude/workflows/after-change.js
@@ -7,6 +7,7 @@ export const meta = {
{ title: 'Fix', detail: 'confirmed findings, then e2e failures' },
{ title: 'E2E', detail: 'the changed flows on the real apps' },
{ title: 'Cleanup', detail: 'cleanup edits and a read-only refactor review, then the refactors worth doing' },
+ { title: 'Finish', detail: 'stop the worktree\'s npm run dev, sandbox host and Electron' },
],
}
@@ -139,9 +140,16 @@ ${scope}
${JSON.stringify(refactors, null, 2)}`, { label: 'apply-refactors', phase: 'Cleanup', schema: FIXED })
: null
+phase('Finish')
+const stopped = await agent(`Stop every process this worktree started: \`npm run dev\` (apps/desktop tools/dev.mjs), its Vite, its Electron app and its sandbox host. Find them with \`ps\`/\`lsof\` by this worktree's path in their command line or cwd, stop them, then check that none remain. Never stop processes of the main checkout, another worktree, the shared Codync Dev or the production Codync app.
+${scope}
+Return what you stopped, one line each, or that nothing was running.`, { label: 'stop-dev', phase: 'Finish', effort: 'low' })
+
return {
review: { found: found.length, confirmed, refuted, fix: reviewFix },
e2e: { checks: walked?.checks ?? [], fix: e2eFix },
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.',
}
diff --git a/CLAUDE.md b/CLAUDE.md
index 19a7f304..3cc887de 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: [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, stop its `npm run dev` and delete the worktree: [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 1c02e9e1..b47af452 100644
--- a/docs/guides/clean-code.md
+++ b/docs/guides/clean-code.md
@@ -45,6 +45,8 @@ Once a code change works (its tests pass) and before commit, it goes through thr
2. **End-to-end test**: the changed flows on the real apps, minimal or full as CLAUDE.md defines it. A failure is fixed and the flows are walked once more.
3. **Cleanup and refactor**: in parallel, a cleanup agent (Claude Code: `code-simplifier:code-simplifier`) edits directly (dead code, duplication, unclear names, comments that restate the code, unused imports, places an existing helper should be reused), and a read-only refactor reviewer reports responsibility splits, files past ~500 lines, long functions, layer leaks, missed reuse, language best practices (Swift 6, Rust `rust-skills`, strict TypeScript, Compose) and any bug it notices. The refactors worth doing are applied and the affected builds and tests rerun.
-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.
+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.
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.