Founder Notes What founders use

Arpit Bhayani's post on X, curated on eChai

  • Curated from X →

    Arpit Bhayani on running agents whose only job is cleanup: one for dead code, one for duplicates, one for stale comments, each change small and passing the same tests as any other.

    Arpit Bhayani Arpit Bhayani

    pro tip: run a few agents whose only job is to keep deleting tech debt and doing cleanups.

    Agents write code quickly, which means they also produce clutter quickly. Dead code, near-duplicate helper functions, unused imports, stale feature flags, and comments that no longer match the code pile up much faster. Cleanup is also work that people rarely prioritize (being super generous here).

    A few things make this work (call them cleanup agents) in practice:

    - Keep each cleanup agent narrow. One removes dead code, one merges duplicates, and one updates stale docs and comments. A single "make the codebase better" agent will actually rewrite things it should leave alone ... so, bad idea.

    - Keep the changes small. One focused pull request per cleanup is easy to review and easy to revert.

    - Let the test suite be the judge. A cleanup is only valid if the behavior is unchanged, so every change must pass the same checks as any other change.

    The last point matters most. Agents can get this wrong just like people do, so tests and the review step should be the gate.

    Deleting code is risky, but having your agents call dead code because they think it is still live is riskier.

    Hope this helps.

eChai Partner Brands The partnership →