frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Tell HN: Claude 4.7 is ignoring stop hooks

24•LatencyKills•1h ago•4 comments

Ask HN: Scaling a targeted web crawler beyond 500M pages/day

11•honungsburk•10h ago•1 comments

Ask HN: How are you using AI code assistants on large messy legacy code bases?

3•thinkingtoilet•7h ago•11 comments

Ask HN: How do solo devs protect their work in the age of vibe coding?

16•langs•20h ago•13 comments

Tell HN: Codex macOS app switches to Fast speed after update without asking

4•mfi•14h ago•0 comments

Ask HN: Chrome, Brave, Firefox or Something Else?

7•wasimsk•12h ago•15 comments

GPT-5.5 – No ARC-AGI-3 scores

10•AG25•1d ago•3 comments

Ask HN: Why are companies so distrustful of remote employees?

10•lyfeninja•20h ago•16 comments

Tell HN: YouTube RSS feeds no longer work

32•019•1d ago•13 comments

Ask HN: How to solve the cold start problem for a two-sided marketplace?

148•alegd•4d ago•164 comments

Is possible a language easy as py, fast as C, more secure than Rust?

5•jerryzhang66•18h ago•7 comments

Hey, it's Earth Day today

20•burnt-resistor•2d ago•13 comments

Can non-developer build commercial products with AI

4•rkorlimarla•1d ago•8 comments

Ask HN: Dear astronomers, what are the most interesting things in space lately?

14•simonebrunozzi•23h ago•5 comments

Ask HN: Am I getting old, or is working with AI juniors becoming a nightmare?

33•MichaelRazum•11h ago•45 comments

Anthropic bans orgs without warning

36•alpinisme•3d ago•18 comments

Ask HN: How are you handling data retention across your stack?

4•preston-kwei•2d ago•3 comments

Ask HN: Would you take a job programming VMS?

11•smackeyacky•1d ago•19 comments

Ask HN: How many tabs do you have open in the browser(s) and why?

4•juujian•21h ago•11 comments

Need advice: Back end engineer → infrastructure: how do you make the transition?

7•gokuljs•2d ago•6 comments

Tell HN: My open-source project hit 5k registered users

19•darkhorse13•3d ago•12 comments

Ask HN: What skills are future proof in an AI driven job market?

35•sunny678•3d ago•76 comments

Opus 4.7 vs. 4.6 after 3 days of real coding side by side from my actual session

15•agentseal•5d ago•6 comments

Ask HN: Are cloud coding agents useful in real workflows yet?

5•Rperry2174•2d ago•3 comments

My file access workaround for cron in Tahoe

5•noduerme•3d ago•2 comments

OpenClaw stats don't add up

11•iliaov•2d ago•6 comments

You've reached the end!

Open in hackernews

Ask HN: How are you using AI code assistants on large messy legacy code bases?

3•thinkingtoilet•7h ago
My company is starting to explore AI coding. I am a dev with 20+ years of experience and I am tasked with trying to help see how we can use this tool to help our company. I have only used Claude so my experience is limited to that.

As you might guess, I find AI to be extremely good at some things and actively terrible at others. A lot of the things I read and demos I watch all have to do with reasonable code bases. Our code base is not reasonable. It's over 20 years old, coded by a multitude of different developers with different coding styles, design patterns, etc... What you would expect from a small company that has been slowly growing for decades. I also work in the medical field so slow evolving old code bases are the norm.

One of the reasons the AI fails constantly is that it has no context of the entire code base. It simply can't keep that context in scope for every session. So it actively adds bloat to the system unless it's guided by a skilled developer who already knows the system. I am using memories where I can but it has to regularly read huge chunks of code and that uses a lot of tokens. I regularly hit my limit on a Pro account.

What are your experiences with this? Any tips or tricks to improve output and cost? Any help is most appreciated. Thanks!

Comments

mc7alazoun•7h ago
I've been in a similar position; where I was tasked to refactor a messy LARGE codebase that was created by a bunch of different previous team members. Here's what I would recommend: - If your codebase contains sensitive or IP related code make sure to remove that before interacting with your AI assistant of choice - Upload the repo/codebase to Claude Code (or codex or whatever you prefer); and ask it to analyse it: the good, the bad and the ugly - Based on the analysis ask the AI assistant to create an .md file with all recommendations/optimisations required to improve code (make sure to have all relevant tests included in the refactoring loop) - Note the before outcomes/outputs; do the refactoring using Claude Code again or whatever tool you prefer; then check after outcomes/outputs to make sure nothing did break

Usually it's an iterative process; if done correctly you could end up with a much better codebase. Good luck!

thinkingtoilet•6h ago
Do you recall how much it cost to review your code base? I worry it's going to be hundreds of dollars just for it to review the thousands of files, let alone organize it all and create suggestions.
mc7alazoun•6h ago
Not thousands of files in my cases .. The Claude 5x Max plan was enough! I'd suggest splitting your code review into reasonable sized chunks .. don't try to do it all at once.
rocketpastsix•6h ago
Start small with it. Pick a contained area and have Claude run through it with you. Have it ask you questions and collab with it. Then have it save any output to a document that can be referenced later.
Someone1234•6h ago
Part of why you're hitting your limit is that Claude's Pro subscription is completely unusable with the current usage limits. I legitimately mean it when I say, you should cancel.

But to the actual question: A lot of people's gut instinct on how to solve this doesn't work. They start going down the road of "well, if I teach the AI about my legacy codebase, it will be smarter, and therefore more efficient." But all you wind up doing is consuming all of your available context, with irrelevancies, and your agent gets dumber and costs more.

What you actually need to do is tackle it the same way a human would: Break it down into smaller problems, where the agent is able to keep the "entire problem" within context at once. Meaning 256K or less (file lengths + prompt + outputs). Then of course use a scratchpad file that holds notes, file references, constraints, and line numbers. That's your compaction protection. Restart the chat with the same scratchpad when you move between minor areas.

Context is your primary-limited resource. Fill it only with what should absolutely need to be there, and nothing else at all.

thinkingtoilet•5h ago
Are you managing your scrathpad file or letting the AI do it? Or both?
Someone1234•5h ago
I have the agent automatically manage its own scratchpad file. But it is meant to be fully disposable; it isn't committed, and is destroyed if you shift areas.
sdevonoes•6h ago
Just go the old way. You will save a lot of time, and gain a lot of knowledge.

In my company we have tried using claude for exactly the same task you have. The results were bad. We discovered a few interesting things, but most of the stuff was wrong: we had to dif through the code base the old way to confidently accept/reject what Claude was telling us. So we could have save a lot of time and money simply by doing it ourselves. As an upside we also learned about the codebase so now people rely on us for that (that feels good too)

4l3x4f1sh3r•6h ago
Preparation: Let it explore small parts of the code and ask it to write .md documentation. It will pick it up and read it later. Create an AGENTS.md file and put in your coding principles. Let it always update its documentation. Do that until the whole repo is in good shape.

Then for execution: Use plan mode. Let it always write a plan first, check it, correct it and only then allow it to implement it.

Try to break big tasks down in small substeps. As small as possible. Let it implement changes iteratively. Let it do a lot of local git commits. Both Codex and Claude Code use this as documentation as well.

Basically, treat it like a junior developer working under you.

Make sure appropriate tests are written for every code change.

thinkingtoilet•5h ago
I'm using memories for things like coding style and preferences. Is using AGENTS any better?
sds357•5h ago
I just came across this yesterday, https://github.com/safishamsi/graphify It's supposed to help the agent find the structure and relations in a code base.