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.

docs: run cleanup and refactor review agents after every code change

leepokaibac4ee0378ef
diff --git a/AGENTS.md b/AGENTS.md
index 01e991ff..c20f7898 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -58,6 +58,7 @@ Name Swift files after their main `UpperCamelCase` type; use `snake_case.rs` and
## 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 e2e and commit), run a cleanup agent and a read-only refactor review agent in parallel on the diff, apply what's worth it, and rerun the tests: [after every change](docs/guides/clean-code.md#after-every-change-cleanup-and-refactor-review).
## Cross-platform UI changes
diff --git a/CLAUDE.md b/CLAUDE.md
index 4f8e443d..3816a4c1 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -17,6 +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 e2e and commit), run a cleanup agent and a read-only refactor review agent in parallel on the diff, apply what's worth it, and rerun the tests: [after every change](docs/guides/clean-code.md#after-every-change-cleanup-and-refactor-review).
## Architecture
diff --git a/docs/guides/clean-code.md b/docs/guides/clean-code.md
index 3e461f3a..076ed40c 100644
--- a/docs/guides/clean-code.md
+++ b/docs/guides/clean-code.md
@@ -36,3 +36,12 @@ Rules every change follows, in every part of the repository (host, iOS, desktop,
- Leave the code you touch a bit cleaner than you found it, but keep cleanups inside your change's area and in separate `refactor` commits from behavior changes.
- Prefer deleting and simplifying over adding. The smallest diff that fixes the problem in the right place wins.
- Every changed piece of logic gets a test that would fail without the change; test behavior, not private details.
+
+## After every change: cleanup and refactor review
+
+Once a code change works (its tests pass) and before e2e and commit, launch two subagents in parallel on the change's diff:
+
+- **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.
+- **Refactor review agent** (Claude Code: `general-purpose`, read-only) reports and does not edit: 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.
+
+Give each agent the exact files and hunks of the change and point it at this guide and CLAUDE.md; agents touch only those hunks, never another agent's uncommitted work. Apply the refactors worth doing, keep them in `refactor` commits apart from the behavior change, and rerun the affected builds/tests before e2e. The final report lists what the cleanup changed and each refactor suggestion applied or skipped, with one line why for each skip. Docs- or config-only changes skip this; a tool without subagents does both passes itself.