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.
How to code Claude Code in 200 lines of code
171–180 of 249 posts
Re: How to code Claude Code in 200 lines of code
#172Something I would add is planning. A big "aha" for effective use of these tools is realizing they run on dynamic TODO lists. Ex: Plan mode is basically bootstrapping how that TODO list gets seeded and how todos ground themselves when they get reached, and user interactions are how you realign the todo lists. The todolist is subtle but was a big shift in coding tools, and many seem to be surprised when we discuss it -…
What you need to do is to match the distribution of how the models were RL-ed. So you are right to say that "do X in 200 lines" is a very small part of the job to be done.
Re: How to code Claude Code in 200 lines of code
#173Imagine a SDK that's dedicated to customizing tools like claude code/cursor cli to produce a class of software like b2b enterprise saas. Within the bounds of the domain(s) modeled these vertical systems would ultimately even crush the capabilities of thin low level wrappers we have today.
Re: How to code Claude Code in 200 lines of code
#174Yea.. 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.
Do you mean they underestimated how hard it is?
Re: How to code Claude Code in 200 lines of code
#175Re: How to code Claude Code in 200 lines of code
#176"What We Built vs. Production Tools This is about 200 lines. Production tools like Claude Code add:
Better error handling and fallback behaviors Streaming responses for better UX Smarter context management (summarizing long files, etc.) More tools (run commands, search codebase, etc.) Approval workflows for destructive operations
But the core loop? It’s exactly what we built here. The LLM decides what to do, your code executes it, results flow back. That’s the whole architecture."
But where's the actual test cases of the performance of his little bit of code vs. Claude Code? Is the core of Claude Code really just what he wrote (he boldly asserts 'exactly what we built here')? Where's the empirical proof?
Re: How to code Claude Code in 200 lines of code
#177How many Claudes could Claude Code code if Claude Code could code Claude?
Re: How to code Claude Code in 200 lines of code
#178To be clear I'm not implying any of that is useful but if you do want to go down that path then why not actually do it?
Re: How to code Claude Code in 200 lines of code
#179> This is the key insight: we’re just telling the LLM “here are your tools, here’s the format to call them.” The LLM figures out when and how to use them. This really blew my mind back then in the ancient times of 2024-ish. I remember the idea of agents just reached me and I started reading various "here I built an agent that does this" articles, and I was really frustrated at not understanding how the hell LLM "know…
Re: How to code Claude Code in 200 lines of code
#180Here's the bigger question. Why would you? Claude code feels like the first commodity agent. In theory its simple but in practice you'll have to maintain a ton of random crap you get no value in maintaining. My guess is eventually all "agents" will be wipped out by claude code or something equivalent. Maybe not the companies will die but that all those startups will just be hooking up a generic agent wrapper and let…