9 comments

  • minimaxir3 minutes ago
    One trick I&#x27;ve found that works well is to tell it to refactor, e.g for Python:<p><pre><code> Refactor the Python code to make it more Pythonic, e.g. fewer classes&#x2F;singletons, especially if it will provide a speedup. The Python code **MUST** follow code organization standards expected of popular open-source Python packages code without causing any benchmark performance regressions. </code></pre> A variant I&#x27;ve used for Rust code:<p><pre><code> The Rust codebase in `&#x2F;src` has become bloated with several files &gt;1k LoC. Refactor the Rust codebase to fit code organization standards expected of popular open-source Rust code without causing any benchmark performance regressions. </code></pre> Those types of prompts appear to a) reorganize the code logically and b) do seem to get better performance from the agents because the files now provide hints to where relevant code resides. For bloated 5k LoC files, the agent has to Read several chunks to find relevant code which is inefficient.<p>In terms of benchmark performance it generally <i>improves</i> after the refactor which I suspect is coincidental but I&#x27;m not complaining.
  • i_have_an_idea1 hour ago
    In my experience, the delta in agent performance is substantial if the codebase is littered with dead code, redundant code, unreachable fallbacks, leaking abstractions and half-baked design patterns vs if the code is well-organized, with clear data flow, with good encapsulation and clean architecture. Like, I&#x27;ve seen all the frontier models have to do several rounds of code review &#x2F; QA and fix when the code is bad vs just getting it right at the 1st&#x2F;2nd attempt.
    • yoyohello1319 minutes ago
      I’ve been working with these things for quite some time now and every time I simply “treat it like I would a human” it seems to perform better. I can’t imagine agents wouldn’t perform better in a clean codebase than a giant mess of one. Just like it performs better when it has well formed specs and access to documentation.
    • hannofcart29 minutes ago
      Some of the issues mentioned above like dead code removal, code duplication, unreachable code are already solved using deterministic linters for quite a while now for most language ecosystems.<p>You can get the LLM to run a script which checks for all of these and also enforce them by running the same script as a pre-commit hook. Setting this up religiously in every code base I work on has been what&#x27;s given me the most mileage with agentic coding.<p>I wrote down a more detailed post of the various linters I use here:<p><a href="https:&#x2F;&#x2F;www.balajeerc.info&#x2F;Use-Deterministic-Guardrails-for-your-LLM-Agents&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.balajeerc.info&#x2F;Use-Deterministic-Guardrails-for-...</a>
    • BobbyTables238 minutes ago
      Feel the same way myself when working in messy codebases… At some point, the horrible patterns start to rub off…
    • ramraj0758 minutes ago
      I was reading your comment, agreeing with it but still feeling why this is a bad comment. It just occurred to me that an anecdotal statement like this is the antithesis of scientific discourse. We have a paper here, trying to answer a question, and anecdotal testimonials can only harm the discussion by biasing readers without adding anything of value to let anyone objectively conclude anything on the problem.<p>The most useful discussion would be if we all read the paper and critique its methodology or results.
    • dnautics51 minutes ago
      i mean this is <i>feeling</i> too but im too paranoid and frequently do refactoring and code organization passes and never don&#x27;t do it, so i cant say i know for sure there is a delta.<p>though people who complain that llms aren&#x27;t that great strike me as the type to have messy code bases
  • Gigachad1 hour ago
    I can&#x27;t imagine how it wouldn&#x27;t. None of them can fit a real codebase in context and have to browse the code the same way a person would. Doing searches and reading files. If the files are in the places they would be expected to be and things are called what the model or a person would first guess to search then it gets found in the first attempt rather than requiring a deep search and multiple attempts.
  • ngsevers1 hour ago
    Even if agents can learn to navigate all the stubs and WET crap they leave behind do we really want a code base that no human can follow what&#x27;s actually going on?
    • softwaredoug1 hour ago
      Even if the agent does everything, English is an imprecise description of what the code does.<p>So I personally at a minimum will want to talk “in code” about what code does.
      • ngsevers40 minutes ago
        Sure, but that only happens with a clean, concise, human readable codebase. If agents start working directly in binary, it&#x27;d be a lot harder to interact and understand what&#x27;s going on and where the points of failure are..
  • wgd1 hour ago
    &quot;agent pipelines that [...] clean a messy [repository]&quot;<p>This feels like a terrible approach, sufficient to condemn the entire study.<p>Apparently half of the &quot;minimal pairs&quot; in this work were constructed in this way. I simply am not going to trust any conclusion that requires assuming these AI &quot;cleaned&quot; repos are in any way representative of actually-good codebases.
    • ramraj0758 minutes ago
      Would you trust clean repos that are messed up by AI?
      • smallerize24 minutes ago
        No, because the outputs will still be &quot;in distribution&quot; so to speak.
  • jaxn34 minutes ago
    agents are pretty good at cleaning up a codebase, finding dead code, fixing bad abstractions, etc. You just have to spend some focusing the agents on that goal.
  • rgoulter54 minutes ago
    Another consideration: written by hand, the trade-off of development velocity vs well organised code means that it can be worth taking some tech debt now in order to deliver some value now. (Especially when prototyping etc.).<p>With coding agents, agents can produce code quicker. The same trade-off still applies.. but, the time it takes an LLM coding agent to write well organised code is still going to be quicker than the time it takes me to write scrappy code.
    • softwaredoug52 minutes ago
      Yes this is one reason IMO I think of AI code as instant legacy code.<p>You take on a lot of tech debt. Then you need to do the same work you would do with any legacy app: finding where the brittle points are, what needs better testing, which leads to breaking apart the big ball of mud into cleaner components.
  • ahonn3 minutes ago
    [flagged]
  • jakubmazanec2 hours ago
    &quot;Across 660 trials with Claude Code, code cleanliness does not change the agent&#x27;s pass rate. However, it substantially alters the agent&#x27;s operational footprint: agents working on cleaner code use 7 to 8% fewer tokens and reduce file revisitations by 34%. Our findings suggest that traditional maintainability principles remain highly relevant in the era of AI-driven development [...]&quot;