Live data from Hacker News

How to code Claude Code in 200 lines of code

mihaileric.com

151–160 of 249 posts

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

#151

This misses that agentic LLMs are trained via RL to use specific tools. Adding custom tools is subpar to those the model has been trained with. That's why Claude Code has an advantage, over say, Cursor, by being vertically integrated.

But if one were to write tools that were "abi-compatible" with Claude Code's, could you see similar performance with a custom agent? And if so - is Cursor not doing just that?

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

#152
post #128
post #98

Earlier quoted context omitted.

I'm unsure of its accuracy/provenance/outdatedness, but this purportedly extracted system prompt for Claude Code provides a lot more detail about TODO iteration and how powerful it can be: https://gist.github.com/wong2/e0f34aac66caf890a332f7b6f9e2ba... https://gist.github.com/wong2/e0f34aac66caf890a332f7b6f9e2ba... I find it fascinating that while in theory one could just append these as reasoning tokens to the conte…

aren't the system prompt of Claude public in the doc at https://platform.claude.com/docs/en/release-notes/system-pro... ?

The system prompt of claude code changes constantly. I use this site to see what has changed between versions: https://cchistory.mariozechner.at/

It is a bit weird why anthropic doesn't make that available more openly. Depending on your preferences there is stuff in the default system prompt that you may want to change.

I personally have a list of phrases that I patch out from the system prompt after each update by running sed on cc's main.js

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

#153
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…

Yes this “premature termination”, becomes particularly evident when you switch out Opus/Sonnet with a weaker LLM, and also happens more often in Codex CLI with GPT-5.

Since one of the replies asked for an example: the agent works for a bit and just stops. We’ve all seen cases where the agent simply says “ok, let me read the blah.py to understand the context better”, and just stops. It has essentially forgotten to use a tool for its next edit or read etc.

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

#154

Yea.. our startup greatly overestimated how hard it is to make a good agent loop. Handling exit conditions, command timeouts, context management, UI, etc is surprisingly hard to do seamlessly.

I'm curious which startup, if you wouldn't mind sharing?

For reciprocity, I work at Imbue, and we can also attest to the real work complexities of this domain.

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

#155

This is cool but as someone that's built an enterprise grade agentic loop in-house that's processing a billion plus tokens a month, there are so many little things you have to account for that greatly magnify complexity in real world agentic use cases. For loops are an easy way to get your foot in the door and is indeed at the heart of it all, but there are a multitude of a little things that compound complexity rath…

Please do! This sounds way more interesting than a simple coding loop agent (not to knock the blog)

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

#156
I have mixed feelings about the "Do X in N lines of code" genre. I applaud people taking the time to boil something down to its very essence, and implement just that, but I feel like the tone is always, "and the full thing is lame because it's so big," which seems off to me.

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

#159
post #128

Earlier quoted context omitted.

aren't the system prompt of Claude public in the doc at https://platform.claude.com/docs/en/release-notes/system-pro... ?

The system prompt of claude code changes constantly. I use this site to see what has changed between versions: https://cchistory.mariozechner.at/ It is a bit weird why anthropic doesn't make that available more openly. Depending on your preferences there is stuff in the default system prompt that you may want to change. I personally have a list of phrases that I patch out from the system prompt after each update by r…

What are those phrases? Why do you exclude them?
Post reply on HN