Live data from Hacker News

How to code Claude Code in 200 lines of code

mihaileric.com

51–60 of 249 posts

Re: How to code Claude Code in 200 lines of code

#51

It's a great point and everyone should know it: the core of a coding agent is really simple, it's a loop with tool calling. Having said that, I think if you're going to write an article like this and call it "The Emperor Has No Clothes: How to Code Claude Code in 200 Lines of Code", you should at least include a reference to Thorsten Ball's excellent article from wayyy back in April 2025 entitled "How to Build an Age…

The most imp part is editing code, to do that reliably Claude models are trained on their own str replace tool schema I think. Models find it hard to modify existing code, they also can't just rewrite whole files bcz that's expensive and doesn't scale.

Re: How to code Claude Code in 200 lines of code

#52

Earlier quoted context omitted.

That comment has tons of AI tells, not simply a few punctuation.

No, it doesn't. The "I'm an expert at AI detection" crowd likes to cite things like "It's not X, it's Y" and other expression patterns without stopping to think that perhaps LLMs regurgitate those patterns because they are frequently used in written speech. I assign a <5% probability that GP comment was AI written. It's easy to tell, because AI writing has no soul.

The message is 100% AI written. And if you click on their username and check their comment history you'll see that ALL their comments are "identical". Just do it, you'll see it by the 5th message. No one talks like that. No one talks like that on every message.

Re: How to code Claude Code in 200 lines of code

#53

Earlier quoted context omitted.

Unclear why you think this is ChatGPT, doesn't read like it at all to me. Many people - myself included - use punctuation to emphasize and clarify.

That comment has tons of AI tells, not simply a few punctuation.

I think at this point it's not easy to accurately detect whether or not something is AI written. A real person can definitely write like this. In fact, that's probably where the LLMs got their writing style from.

Re: How to code Claude Code in 200 lines of code

#54
What's interesting to me about the question of whether you could realistically compete with Claude Code (not Claude, but the CLI agent) is that the questions boil down to things any proficient developer could do. No matter how much I'd want to try, I have no hope of building a competitive frontier model --- "frontier model" is a distinctively apt term. But there's no such thing as a "frontier agent", and the Charmbracelet people have as much of a shot at building something truly exception as Anthropic does.

Re: How to code Claude Code in 200 lines of code

#55

This article was more true than not a year ago but now the harnesses are so far past the simple agent loop that I'd argue that this is not even close to an accurate mental model of what claude code is doing.

Less true than you think. A lot of the progress in the last year has been tightening agentic prompts/tools and getting out of the way so the model can flex. Subagents/MCP/Skills are all pretty mid, and while there has been some context pruning optimization to avoid carrying tool output along forever, that's mainly a benefit to long running agents and for short tasks you won't notice.

Re: How to code Claude Code in 200 lines of code

#56

Earlier quoted context omitted.

[flagged]

Unclear why you think this is ChatGPT, doesn't read like it at all to me. Many people - myself included - use punctuation to emphasize and clarify.

The tells are in the cadence. And the not x but y. And the last line that basically says nothing, while using big words. It's like "In conclusion", but worded differently. Enough tells for me to click on their history. They have the exact same cadence on every comment. It's a bit more sophisticated than "chatgpt write a reply", but it's still 100% aigen. Check it out, you'll see it after a few messages in their history.

Re: How to code Claude Code in 200 lines of code

#57
post #19

There's a bit more to it! For example, the agent in the post will demonstrate 'early stopping' where it finishes before the task is really done. You'd think you can solve this with reasoning models, but it doesn't actually work on SOTA models. To fix 'early stopping' you need extra features in the agent harness. Claude Code does this with TODOs that are injected back into every prompt to remind the LLM what tasks rem…

why would it early stop? examples?

Re: How to code Claude Code in 200 lines of code

#59
post #51

It's a great point and everyone should know it: the core of a coding agent is really simple, it's a loop with tool calling. Having said that, I think if you're going to write an article like this and call it "The Emperor Has No Clothes: How to Code Claude Code in 200 Lines of Code", you should at least include a reference to Thorsten Ball's excellent article from wayyy back in April 2025 entitled "How to Build an Age…

The most imp part is editing code, to do that reliably Claude models are trained on their own str replace tool schema I think. Models find it hard to modify existing code, they also can't just rewrite whole files bcz that's expensive and doesn't scale.

Yeah, there is definitely some RLVR training going on for the Claude LLMs to get them good at some of the specific tool calls used in Claude Code, I expect. Having said that, the string replacement tool schema for file edits is not very complicated at all (you can see it in the tool call schema Claude Code sends to the LLM), so you could easily use that in your own 200-300 line agent if you wanted to make sure you're playing to the LLM's strengths.

Re: How to code Claude Code in 200 lines of code

#60
post #47

Earlier quoted context omitted.

You’re not wrong but I still think that the harness matters a lot when trying to accurately describe Claude Code. Here’s a reframing: If you asked people “what would you rather work with, today’s Claude Code harness with sonnet 3.7, or the 200 line agentic loop in the article with Opus 4.5, which would you choose?” I suspect many people would choose 3.7 with the harness. Moreover, that is true, then I’d say the artic…

I don't think so, model improvements far outweigh any harness or tooling. Look at https://github.com/SWE-agent/mini-swe-agent for proof

Yes but people aren’t choosing CC because they are necessarily performance maximalists. They choose it because it has features that make it behave much more nicely as a pair programming assistant than mini-swe-agent.

There’s a reason Cursor poached Boris Cherney and Cat Wu and Anthropic hired them back!

Post reply on HN