Let's build claude code from scratch!
Posted by RoyalMaterial9614@reddit | LocalLLaMA | View on Reddit | 86 comments
So, I made this video about how to create claude code from scratch.
Here's the video: https://youtu.be/8pDfgBEy8bg
and Github: https://github.com/CohleM/nanoclaude
Feedback is extremely appreciated.
Skylleur@reddit
For legal reasons you should forcefem Claude
overand@reddit
Maybe NanoDual - since that's cLAUDe backwards? If this tool is at all good, you're going to need to change the name.
Ok_Chipmunk_9167@reddit
Claudo with a mustache. The Italian/Spanish cousin
South_Hat6094@reddit
the opencode suggestion is solid but honestly building it yourself teaches you way more about tool calling and context management than any existing framework will
codehamr@reddit
Nice work, the from scratch angle is the right way to actually understand what these tools do. Been working on something similar for a while now and the thing that keeps surprising me is how far you can push local models if you treat the context window with some discipline. Most of the gap to frontier is wasted tokens, not model strength.
snoopbirb@reddit
I think I'm adding harness fatigue to my LLM fatigue
How many versions of a LLM looper with tool calling we need?
(That's I genuine question, btw, they all feel the same for me)
True_Requirement_891@reddit
tbh different harnesses wildly affect the model perf, you should try em. I was using the glm-5.1 in opencode and it couldn't fix a stupid bug I was having, then I tried CC with glm-5.1 and it failed as well and then oh-my-pi which is actually a more batteries included variant of pi just did it...
Weird_Search_4723@reddit
All the best!
chucrutcito@reddit
AI the best
ANTIVNTIANTI@reddit
lololololol fucking heroic
natermer@reddit
Careful with the naming. "claude" is trademark and they will aggressively defend it.
A similar issue happened with OpenClaw. It was originally "Clawdbot" as a spoof on the Claude name. But the name and mascot they used was deemed "too close" for Anthropic Lawyers. So they had to change their name to "Moltbot", which is kinda not ideal. The third name stuck.
I am personally fine with what ever name you want to use. Just something to keep in mind.
Sofakingwetoddead@reddit
Call it Nano Claudia, and flip the trademark script into a gender debate.
Truth-Does-Not-Exist@reddit
Does this mean I have to rename my magmun opus software I've been working on called "claude chode"
openSourcerer9000@reddit
I had to rename my own son to "Molt" after a cease and desist letter from those guys
cleversmoke@reddit
Me too, my dog and vet were confused when I started calling my dog Molt.
arthurtully@reddit
You guys didnt hear? Its Jean-Molt Van Damme now
IrisColt@reddit
Time to rewatch I, Moltius.
RoyalMaterial9614@reddit (OP)
Thanks, i didn't think through, i just wanted it for educational purpose.
SaltySolicitorAu@reddit
I wouldn't worry too much about the trademark unless you try to commercialise it. Everyone in this comment thread is jumping at hypothetical shadows.
Good job, keep on keeping on.
homarp@reddit
call it François instead (or pick any famous Claude from here: https://www.famousbirthdays.com/names/claude.html )
PatBQc@reddit
Bonne idée ! Comme d'habitude 🎵
SE_to_NW@reddit
that is not a valid or reasonable excuse.
JaceBearelen@reddit
Fair use is a thing and OP is almost certainly in the clear as long as this doesn’t take off and become a popular alternative to Claude code.
Risc12@reddit
While fair use is a thing, it needs to go to court for that.
If Claude asks Github to remove the repo they’ll probably just do that. No legal basis necessary. Same with YouTube etc
JaceBearelen@reddit
If it gets popular enough that Anthropic is aware of it then yeah they’re gonna have it removed. Not really a big deal if this was just an educational exercise for OP.
Risc12@reddit
Nobody at Anthropic is searching, this will be a semi-automated process.
This is no ill intent on their part btw, it’s part of trademark law. You need to enforce your trademark or you’ll lose it.
SE_to_NW@reddit
Can you or the OP count on that? Better not bet on it.
Lilrex2015@reddit
not fair use. This is just a copyright infringement.
PANIC_EXCEPTION@reddit
Wouldn't it be trademark infringement instead?
Lilrex2015@reddit
yes, thank you. I knew copyright wasnt the right word but couldnt remember trademark.
iongion@reddit
Yeah, but all this LLM stealing copyrighted books is fair use, sure!
Lilrex2015@reddit
true
SomeIngenuity1957@reddit
Sorry maybe a stupid question but is the point of this that it can run entirely offline?
Asking because I think that would be awesome if there isn't already something like this. I want to use AI tools but not be tied to the cloud companies that control them if I can just invest in a good enough computer and do it all locally
RoyalMaterial9614@reddit (OP)
No, it runs online, needs api key for cloud provider.
SomeIngenuity1957@reddit
So then what do you do if the cloud providers all shut down or start charging ridiculous fees for tokens?
Genuinely curious, I feel like there's a problem we can solve there by giving the power directly to the people
RoyalMaterial9614@reddit (OP)
Maybe dont overthink it? Just use chinese models
falconandeagle@reddit
You do realize this is the localllama subreddit?
overand@reddit
I think you maybe don't realize what r/LocalLLaMA is?
SomeIngenuity1957@reddit
Okay follow up: say the internet connection in your area was shut down because fascist government did fascist shit and now everyone is shocked pikachu face 😟
Now what do you do? Sorry for overthinking. Again I'm genuinely trying to find a solution. I think we (as a society) need to sever our connection between AI and the cloud providers monopolizing it. Make it a boring tool again. It doesn't need to cure cancer. But if it can help the humans by speeding up research then maybe that can be a good middle ground
swanny101@reddit
Run a local llm such as qwen 3.6 and point it to your local endpoint.
SomeIngenuity1957@reddit
And your tool here can do that? Because that would be awesome and I think you should lead with that!
swanny101@reddit
Not my tool. Search up llama.cpp, hit hugging face download the gguf, set it all up, point nano Claude, Claude code, aider, etc at your local endpoint and have fun. You’ll need a decent video card to run ( or Mac Studio + whatever tools it uses ) but yes you can run this kind of stuff locally. I’m not really sure why the OP mentioned cloud providers as this is the LocalLLaMa group AKA people who run models Locally through llama.cpp…
fireheadca@reddit
The requirements file needs cleaning.
RoyalMaterial9614@reddit (OP)
Thanks, I just updated the file.
Imn1che@reddit
But… why?
Busy_Promise1863@reddit
for... practice?
KeikakuAccelerator@reddit
What about pi? I think it's already quite elegant
RoyalMaterial9614@reddit (OP)
pi ?
ChukMeoff@reddit
Maybe do some market research
KeikakuAccelerator@reddit
https://github.com/earendil-works/pi
Check this one. Very token efficient
nantachapon@reddit
What makes it token efficient? Would the frontier harnesses ever integrate token efficiency?
o0genesis0o@reddit
There is very little built-in bloat. And the agent knows how to extend itself, so you can just ask it to build whatever extension or workflow you want.
ea_man@reddit
Well the prompt isn't 12k for starter, it's petite.
KeikakuAccelerator@reddit
No idea what exactly is the magic, just empirical evidence.
apeapebanana@reddit
uh oh haha!! see you in one week, you'll love it!
Legal-Pop-1330@reddit
Us too: https://github.com/rekursiv-ai/sagent
kristianvastveit@reddit
Try opencode, many has already done this
eightshone@reddit
I think building a coding agent is a great exercise for people who wanna create agents. I think it shouldn’t someone’s first agent because it can get very complicated quickly tho
Gipetto@reddit
100% projects like this help raise someone's experience and skills. However we don't need a fragmented landscape. I wholly support contributing to opencode to add features or fix things I don't like. There's no way I'm using someone's small personal project for a system that has read access to a filesystem. I'll trust the larger projects to an extent, but a random person's personal project? Nah, not really. No offense to them, I just need stability, not something that I'm troubleshooting while trying to work.
wren6991@reddit
I feel the opposite. OpenCode is a sprawling project with an awful security posture, existing in a state of perpetually broken churn. It's hard to meaningfully "contribute" to something with 1500 open PRs, so realistically it's just going to stay broken. I would trust a small community project much more easily than OpenCode.
social_tech_10@reddit
For someone using opencode who would like to move on to something better, what would you suggest? I'd like to stick with an open-source tool, if possible.
o0genesis0o@reddit
I can recommend Pi (the harness used by openclaw)
I started with Qwen Code (Gemini CLI fork) and was pretty okay with it. But it does not feel as "open" as OpenCode, so I tested OpenCode. Maybe I started to use that at a bad version, but it spikes my CPU like crazy every time there is an inference run. I like my laptop battery to last long on the go, so no. Ended up using Claude Code with Minimax and GLM backend.
Tested Pi recently and I was blown away by how light and customizable it is. Small system prompt, all the features that I need, and a clever extension system that the agent can use to extend itself. I got Pi to build a set of extensions to customise its behaviour and tooling the way I want it.
I also write my own agent harness to power my own app and non coding tasks. However, for now, I use Pi and extensions that I built for coding.
wren6991@reddit
Honestly I don't have any good recommendations. I haven't found anything I'd be happy to use. Sandboxing of the type I'd want already exists in Rust libraries like birdcage (GPL3) or ai-sandbox (MIT). If you're already happy with taking something barebones like Pi and extending it, then it's not that crazy to just build an agent yourself and re-use existing components for the hard parts like sandboxing.
bigh-aus@reddit
good luck - making your own flavor of stuff is fun.
Strongly suggest writing the cli in a compiled language - you'll get much better performance, plus making end users manage python environment sucks..
Dontdoitagain69@reddit
I don't know why, is it me or I automatically bypass terminal screen apps and bash based setups. I've been with terminals for a long time and I prefer a nice UI. One click setups. Don't have to read setup docs.Just waste of time
tecplush@reddit
Another Open Code.
Ok. Cool.
PoopSick25@reddit
But why? There are many superior harness' already. Pi or hermes as those two are my pwrsonally bias favourite.
raidio-me@reddit
haha I'm on the same trip, mine is paired with an agent harness but it's been very fun to see how it improves local models coding abilities
shanehiltonward@reddit
Windows only...
LegacyRemaster@reddit
Amazing
RoyalMaterial9614@reddit (OP)
Thankyou so much
5anez@reddit
lately i've built an agent that can let llm use ur computer and do for u those long tasks that dont have apis or a way for automating it etc and do relly on ui, should i put it open source and let others help me take it to the absolute limit?
_thr0wkawaii14159265@reddit
Nobody will help u with it lmao. Clearly you're new to oss. Nobody cares if u make it public, there's 100 slop clones of the exact same thing released every week.
5anez@reddit
Lol actually i have 0 upvotes on this sub reddit, thats why i tried to just say anything to get some upvotes and maybe look new to this so later i can post in here. anyways maybe u will see me later posting about cuda c++ or triton wich is way more advanced but for now i am the dumb dude that just gathers upvotes cuz others think he needs the help xd
Uncle___Marty@reddit
Your project HATES windows lol (but to be fair, it aint alone). Having to make so many changes to test this but it sounds interesting and I've been making an effort to test out different harnesses recently. I suspect "Nanokalawd" or "NanoKlord" might be a better choice of name or something though....
RoyalMaterial9614@reddit (OP)
Thanks mate!
Organic_Scarcity_495@reddit
the nanoclaude repo is solid for understanding the loop. one thing that's missing from most of these "build your own agent" tutorials is the tool contract layer — how the agent knows what tools are available, what params they take, and what the return format looks like. the prompt engineering for tool selection is as important as the loop itself. if you cover that in a follow-up video it'd be a huge value add
Logical-Skill4567@reddit
Utile! Lo guarderò grazie!
AleksHop@reddit
lol, usual comment: license
Necessary-Meeting-28@reddit
Sounds interesting for educational purposes, I will definitely check that out!
Organic_Scarcity_495@reddit
building from scratch is the best way to actually understand what's going on under the hood. most people use these tools for months without knowing how the tool loop works
RoyalMaterial9614@reddit (OP)
exactly! this is why i made this video.
BidWestern1056@reddit
or you can do something different like npcsh
https://github.com/npc-worldwide/npcsh
Budget-Toe-5743@reddit
Aren't there other posibly better models?
Why get into copyright problems?
RoyalMaterial9614@reddit (OP)
It's just for educational purpose? so maybe it's okay? i didn't think that hard for the name
Budget-Toe-5743@reddit
ahhh, then it's fine. I'm all in for fun! just don't get into trouble!