frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

How to build a coding agent

https://ghuntley.com/agent/
167•ghuntley•5h ago

Comments

ofirpress•4h ago
We (the Princeton SWE-bench team) built an agent in ~100 lines of code that does pretty well on SWE-bench, you might enjoy it too: https://github.com/SWE-agent/mini-swe-agent
ghuntley•4h ago
cheers i'll add it in.
simonw•3h ago
OK that really is pretty simple, thanks for sharing.

The whole thing runs on these prompts: https://github.com/SWE-agent/mini-swe-agent/blob/7e125e5dd49...

  Your task: {{task}}. Please reply
  with a single shell command in
  triple backticks.
  
  To finish, the first line of the
  output of the shell command must be
  'COMPLETE_TASK_AND_SUBMIT_FINAL_OUTPUT'.
nivertech•30m ago

  system_template: str = "You are a helpful assistant that can do anything."
anything? Sounds like an AI Safety issue ;)
faangguyindia•2h ago
when a problem is entirely self contained in a file, it's very easy to edit it with LLM.

that's not the case with a codebase, where things are littered around in tune with specific model of organisation the developer had in mind.

koakuma-chan•2h ago
> in tune with specific model of organisation

You wish

fmbb•1h ago
Lumpers win again!

https://en.wikipedia.org/wiki/Lumpers_and_splitters

meander_water•2h ago
> 1. Analyze the codebase by finding and reading relevant files 2. Create a script to reproduce the issue 3. Edit the source code to resolve the issue 4. Verify your fix works by running your script again 5. Test edge cases to ensure your fix is robust

This prompt snippet from your instance template is quite useful. I use something like this for getting out of debug loops:

> Analyse the codebase and brainstorm a list of potential root causes for the issue, and rank them from most likely to least likely.

Then create scripts or add debug logging to confirm whether your hypothesis is correct. Rule out root causes from most likely to least by executing your scripts and observing the output in order of likelihood.

Teever•1h ago
What sort of results have you had from running it on its own codebase?
BenderV•1h ago
Nice but sad to see lack of tools. Most your code is about the agent framework instead of specific to SWE.

I've built a SWE agent too (for fun), check it out => https://github.com/myriade-ai/autocode

diminish•55m ago
> sad to see lack of tools.

Lack of tools in mini-swe-agent is a feature. You can run it with any LLM no matter how big or small.

faangguyindia•3h ago
Anyone can build a coding agent which works on a) fresh code base b) when you've unlimited token budget

now build it for old codebase, let's see how precisely it edits or removes features without breaking the whole codebase

lets see how many tokens it consumes per bug fix or feature addition.

simonw•3h ago
This comment belongs in a discussion about using LLMs to help write code for large existing systems - it's a bit out of place in a discussion about a tutorial on building coding agents to help people understand how the basic tools-in-a-loop pattern works.
faangguyindia•2h ago
anyone who used those coding agent can already see how it works, you can usually see agent fetching files, running commands, listing files and directories.

i just wrote this comment so people aren't under false belief that it's pretty much all coding agents do, making all this fault tolerant with good ux is lot of work.

pcwelder•3h ago
Agree. To reduce costs:

1. Precompute frequently used knowledge and surface early. For example repository structure, os information, system time.

2. Anticipate next tool calls. If a match is not found while editing, instead of simply failing, return closest matching snippet. If read file tool gets a directory, return directory contents.

3. Parallel tool calls. Claude needs either a batch tool or special scaffolding to promote parallel tool calls. Single tool call per turn is very expensive.

Are there any other such general ideas?

faangguyindia•2h ago
that info can be just included in preffix which is cache by LLM, reducing cost by 70-80% average. System time varies, so it's not good idea to specify it in prompt, better to make a function out of it to avoid cache invalidation.

I am still looking for a good "memory" solution, so far running without it. Haven't looked too deep into it.

Not sure how next tool call be predicted.

I am still using serial tool calls as i do not have any subagents, i just use fast inference models for directly tools calls. It works so fast, i doubt i'll benefit from parallel anything.

righthand•2h ago
Surprise, as rambunctious dev who’s socially hacked their way through promotions, I will just convince our manager we need to rewrite the platform in a new stack or convince them that I need to write a new server to handle the feature. No old tech needed!
NitpickLawyer•2h ago
There's "swe re-bench", a benchmark that tracks model release dates, and you can see how the model did for "real-world" bugs that got submitted on github after the model was released. (obviously works best for open models).

There are a few models that solve 30-50% of (new) tasks pulled from real-wolrd repos. So ... yeah.

cryptoz•2h ago
I really think the current trend of CLI coding agents isn't going to be the future. They're cool but they are _too simple_. Gemini CLI often makes incorrect edits and gets confused, at least on my codebase. Just like ChatGPT would do in a longer chat where the context gets lost: random, unnecessary and often harmful edits are made confidently. Extraneous parts of the codebase are modified when you didn't ask for it. They get stuck in loops for an hour trying to solve a problem, "solving it", and then you have to tell the LLM the problem isn't solved, the error message is the same, etc.

I think the future will be dashboards/HUDs (there was an article on HN about this a bit ago and I agree). You'll get preview windows, dynamic action buttons, a kanban board, status updates, and still the ability to edit code yourself, of course.

The single-file lineup of agentic actions with user input, in a terminal chat UI, just isn't gonna cut it for more complicated problems. You need faster error reporting from multiple sources, you need to be able to correct the LLM and break it out of error loops. You won't want to be at the terminal even though it feels comfortable because it's just the wrong HCI tool for more complicated tasks. Can you tell I really dislike using these overly-simple agents?

You'll get a much better result with a dashboard/HUD. The future of agents is that multiple of them will be working at once on the codebase and they'll be good enough that you'll want more of a status-update-confirm loop than an agentic code editing tool update.

Also required is better code editing. You want to avoid the LLM making changes in your code unrelated to the requested problem. Gemini CLI often does a 'grep' for keywords in your prompt to find the right file, but your prompt was casual and doesn't contain the right keywords so you end up with the agent making changes that aren't intended.

Obviously I am working in this space so that's where my opinions come from. I have a prototype HUD-style webapp builder agent that is online right now if you'd like to check it out:

https://codeplusequalsai.com/

It's not got everything I said above - it's a work-in-progress. Would love any feedback you have on my take on a more complicated, involved, and narrow-focus agentic workflow. It only builds flask webapps right now, strict limits on what it can do (no cron etc yet) but it does have a database you can use in your projects. I put a lot of work into the error flow as well, as that seems like the biggest issue with a lot of agentic code tools.

One last technical note: I blogged about using AST transformations when getting LLMs to modify code. I think that using diffs or rewriting the whole file isn't the right solution either. I think that having the LLM write code that modifies your code and then running that code to affect the modifications is the way forward. We'll see I guess. Blog post: https://codeplusequalsai.com/static/blog/prompting_llms_to_m...

faangguyindia•2h ago
>Gemini CLI often makes incorrect edits and gets confused

Gemini CLI still uses archaic whole file format for edits, it's not a good representative of current state of coding agents.

cryptoz•2h ago
Oh that's wild, I did suspect that but didn't know it outright. Mind-blowing Google would release that kind of thing, I had wondered why it sucked so much haha. Okay so what is a good representation of the current state of coding agents? Which one should I try that does a better job at code modifications?
mrugge•2h ago
claude code (with max subscription), cursor-agent (with usage based pricing)
NitpickLawyer•2h ago
Claude code is the strongest atm, but roocode or cline (vscode extensions) can also work well. Roo with gpt5-mini (so cheap, pretty fast) does diff based edits w/ good coordination over a task, and finishes most tasks that I tried. It even calls them "surgical diffs" :D
lifthrasiir•6m ago
I'm not sure what do you mean by "whole file format", but if it refers to the write_file tool that overwrites the whole file, there is also the replace tool which is apparently inspired by a blog post [1] by Anthropic. It seems that Claude Code also supports the roughly identical tool (inferred from error messages), so editing tools can't be the reason why Claude Code is good.

[1] https://www.anthropic.com/engineering/swe-bench-sonnet

sitkack•1h ago
You are wasting your time and everyone elses with Gemini, it is the worst.
cryptoz•58m ago
Oh I don’t use Gemini! I did try it out and admittedly formed an opinion too narrow on cli agents. But no way do I actually use Gemini.
revskill•2h ago
Where is the program synthesis? My way of thinking is given primitives as tools, i want the model to construct and return the program to execute.

Of course following nix philosophy is another way.

normie3000•2h ago
Why are any of the tools beyond the bash tool required?

Surely listing files, searching a repo, editing a file can all be achieved with bash?

Or is this what's demonstrated by https://news.ycombinator.com/item?id=45001234?

zarzavat•1h ago
Separate tools is simpler than having everything go through bash.

If everything goes through bash then you need some way to separate always safe commands that don't need approval (such as listing files), from all other potentially unsafe commands that require user approval.

If you have listing files as a separate tool then you can also enforce that the agent doesn't list any files outside of the project directory.

BenderV•1h ago
Why do humans need a IDE when we could do anything in a shell? Interface give you the informations you need at a given moment and the actions you can take.
faangguyindia•55m ago
>Why are any of the tools beyond the bash tool required?

My best guess is they started out with a limited subset of tools and realised they can just give it bash later.

the_mitsuhiko•44m ago
Technically speaking, you can get away with just a Bash tool, and I had some success with this. It's actually quite interesting to take away tools from agents and see how creative they are with the use.

One of the reasons why you get better performance if you give them the other tools is that there has been some reinforcement learning on Sonne with all these tools. The model is aware of how these tools work, it is more token-efficient and it is generally much more successful at performing those actions. The Bash tool, for instance, at times gets confused by bashisms, not escaping arguments correctly, not handling whitespace correctly etc.

dotancohen•2m ago

  > The Bash tool, for instance, at times gets confused by bashisms, not escaping arguments correctly, not handling whitespace correctly etc.
This was the only informative sentence in the reply. Can you please go on in this manner - it was an important question.
kissgyorgy•24m ago
This is explained in 3.2 How to design good tools?

    This saves the LLM from having to do multiple low level clicking and typing and keeps it on track. Help the poor model out, will ya!?
Western0•1h ago
Instead of writing about how to build an agent, show us one project that this agent has built.
prodimmune•1h ago
For me, the post is missing an explanation of the reason why I would want to build my own coding agent instead of just using one of the publicly available ones.
dotancohen•1m ago
You wouldn't.

This project and this post are for the curious and for the learners.

johannesboyne•57m ago
A very similar "how to guide" can be found here https://ampcode.com/how-to-build-an-agent written by Thorsten Ball. In general Amp is quite interesting - obviously no hidden gem anymore ;-) but great to see more tooling around agentic coding being published. Also, because similar agentic-approaches will be part of (certain/many?) software suits in the future.
campbellbell•36m ago
Makes sense, the author says he also works at Amp
manojlds•3m ago
Ghuntley also works at Amp
hobofan•22m ago
I hate to do meta-commentary (the content is a decent beginner level introduction to the topic!), but this is some of the worst AI-slop-infused presentation I've seen with a blog post in a while.

Why the unnecessary generated AI pictures in between?

Why put everything that could have been a bullet point into it's own individual picture (even if it's not AI generated)? It's very visually distracting, breaks the flow of reading, and it's less accessible as all the picture lack alt-text.

---

I see that it's based on a conference talk, so it's possibly just 1:1 the slides. If that's the case please put it up in it's native conference format, rather than this.

bambax•20m ago
Agreed. It's unreadable.
gregrata•17m ago
Wow. Yeah. That's unreadable - my frustration and annoyance levels got high fast, had to close the page before I went for the power button on my machine :)
Tewboo•17m ago
Building a coding agent involves defining clear goals, leveraging AI, and iterating based on feedback. Start with a simple task and scale up.

How to build a coding agent

https://ghuntley.com/agent/
168•ghuntley•5h ago•44 comments

Seed: Interactive software environment based on Common Lisp

https://github.com/phantomics/seed
14•todsacerdoti•1h ago•0 comments

Turning Claude Code into My Best Design Partner

https://betweentheprompts.com/design-partner/
7•scastiel•22m ago•0 comments

Equal Earth – Political Wall Map (2018)

https://equal-earth.com/index.html
22•bjelkeman-again•2h ago•14 comments

Wildthing – A model trained on role-reversed ChatGPT conversations

https://youaretheassistantnow.com/
31•iamwil•2h ago•11 comments

Buy a Faster CPU

https://blog.howardjohn.info/posts/buy-a-cpu/
20•ingve•2h ago•12 comments

Setting serial baud rate on ESP-IDF does nothing

https://atomic14.substack.com/p/this-number-does-nothing
11•iamflimflam1•16h ago•10 comments

Rolling the dice with CSS random()

https://webkit.org/blog/17285/rolling-the-dice-with-css-random/
84•zdw•2d ago•5 comments

ThinkMesh: A Python lib for parallel thinking in LLMs

https://github.com/martianlantern/ThinkMesh
16•martianlantern•4h ago•1 comments

Line scan camera image processing for train photography

https://daniel.lawrence.lu/blog/y2025m09d21/
299•dllu•16h ago•56 comments

Marshal madness: A brief history of Ruby deserialization exploits

https://blog.trailofbits.com/2025/08/20/marshal-madness-a-brief-history-of-ruby-deserialization-e...
12•pentestercrab•3d ago•0 comments

Evaluating LLMs for my personal use case

https://darkcoding.net/software/personal-ai-evals-aug-2025/
54•goranmoomin•7h ago•12 comments

The cost of interrupted work (2023)

https://blog.oberien.de/2023/11/05/23-minutes-15-seconds.html
171•_vaporwave_•10h ago•105 comments

Physics of badminton's new killer spin serve

https://arstechnica.com/science/2025/08/physics-of-badmintons-new-killer-spin-serve/
76•amichail•3d ago•9 comments

Show HN: Port Kill – A lightweight macOS status bar development port monitor

https://github.com/kagehq/port-kill
55•lexokoh•5h ago•22 comments

How can AI ID a cat?

https://www.quantamagazine.org/how-can-ai-id-a-cat-an-illustrated-guide-20250430/
137•sonabinu•3d ago•38 comments

What if every city had a London Overground?

https://www.dwell.com/article/what-if-every-city-had-a-london-overground-ac7a7ff9
26•edward•2d ago•30 comments

What makes Claude Code so damn good

https://minusx.ai/blog/decoding-claude-code/
303•samuelstros•13h ago•219 comments

Agentic Browser Security: Indirect Prompt Injection in Perplexity Comet

https://brave.com/blog/comet-prompt-injection/
26•drak0n1c•5h ago•11 comments

Programming People (2016)

https://leftoversalad.com/c/015_programmingpeople/
31•saulpw•5h ago•2 comments

Static sites with Python, uv, Caddy, and Docker

https://nkantar.com/blog/2025/08/static-python-uv-caddy-docker/
123•indigodaddy•1d ago•75 comments

A 2k-year-old sun hat worn by a Roman soldier in Egypt

https://www.smithsonianmag.com/smart-news/a-2000-year-old-sun-hat-worn-by-a-roman-soldier-in-egyp...
118•sensiquest•12h ago•27 comments

RFC 9839 and Bad Unicode

https://www.tbray.org/ongoing/When/202x/2025/08/14/RFC9839
245•Bogdanp•19h ago•119 comments

Motion (YC W20) Is Hiring Principal Software Engineers

https://jobs.ashbyhq.com/motion/7355e80d-dab2-4ba1-89cc-a0197e08a83c?utm_source=hn
1•ethanyu94•11h ago

Texas Instruments’ new plants where Apple will make iPhone chips

https://www.cnbc.com/2025/08/22/apple-will-make-chips-at-texas-instruments-60-billion-us-project....
137•giuliomagnifico•1d ago•126 comments

Acronis True Image costs performance when not used

https://randomascii.wordpress.com/2025/05/26/acronis-true-image-costs-performance-when-not-used/
113•juanviera23•3d ago•25 comments

My original Palm IIIx

https://www.goto10retro.com/p/taking-a-look-at-my-old-palm-iiix
36•rbanffy•3d ago•20 comments

Why was Apache Kafka created?

https://bigdata.2minutestreaming.com/p/why-was-apache-kafka-created
122•enether•1d ago•109 comments

Debdelta

https://debdelta.debian.net/
32•Bogdanp•9h ago•5 comments

Insights from research with probiotic E. coli (2016)

https://pmc.ncbi.nlm.nih.gov/articles/PMC5063008/
6•luu•2d ago•0 comments