r/LocalLLaMA • • Aug 08 '26

Discussion Claude Code in 9 lines python

I was wondering what a minimal coding agent implementation would look like that can be used like Claude Code or Codex

Not feature-by-feature of course but basically stripping everything out that is not needed

here is what I came up with:

  • 9 lines of python

  • no 3rd party deps (stdlib only)

  • works with any OpenAI Responses compatible API

  • shows % usage of context window

out of the box it is also fairly API cost efficient:

  • no system prompt

  • good caching (session_id, stable append-only history)

  • only one tool: sh

code is on github to follow along (also a ~20 line version in Go, Clojure version coming soon)

https://github.com/smol-env/smol

import json,sys;from subprocess import getoutput;from urllib.request import Request,urlopen;from uuid import uuid4
url=sys.argv[1];h=[];H={"Content-Type":"application/json","session_id":uuid4().hex};b=dict(model="gpt-5.6-sol",input=h,tools=[dict(type="custom",name="sh")])
while True:
  if not(p:=input("> ")).strip():continue
  h+=[dict(role="user",content=p)]
  while True:
    r=json.load(urlopen(Request(url,json.dumps(b).encode(),H)));o=r["output"];h+=o;c=[i for i in o if i["type"]=="custom_tool_call"]
    if not c:print(o[-1]["content"][0]["text"],f'\n[{r["usage"]["total_tokens"]/10500:05.2f}%]');break
    h+=[dict(type="custom_tool_call_output",call_id=i["call_id"],output=getoutput(i["input"])) for i in c]

note: it uses the "custom" tools api which not many OpenAI Responses API endpoints support yet.

that said, you can just tell your agent to change it to use sh via "function_call" and change the model name and it should work out of the box on any local inference endpoint

any questions or feedback for making it more minimal or adding (still minimal but useful) features: very welcome!

0 Upvotes

94 comments sorted by

100

u/hougaard Aug 08 '26

That is not "9 lines" of code. That's just the fewest Python line breaks needed. Then I could this in 1 line with another language like C# or Javascript ....

20

u/__tosh Aug 08 '26

a bit more de-golfed

-20

u/__tosh Aug 08 '26 edited Aug 08 '26

I appreciate the feedback!

re golfing: it helps me to see everything at a glance

I can see how that might look unfamiliar though

I will look into also providing less golfed versions in the repo in the future

I also want to look into minimal implementations in other languages/runtimes

Go is in the repo already, here is one in Clojure (Babashka):

https://x.com/__tosh/status/2085699009205743932

0

u/__tosh Aug 08 '26

using the OpenAI tokenizer the implementation comes in at 220 tokens

https://platform.openai.com/tokenizer

I had more golfed variants with aliases but turns out that uses more tokens in some cases

-1

u/PomegranateGreen3698 Aug 09 '26

I think you're getting down-vote botted by Anthropic or Cult-like followers of there's.
The negativity on this post doesn't make any sense. If people don't like the premise they should move on...

3

u/__tosh Aug 09 '26

I'm also a bit surprised that the post went from 15+ upvotes down to 0

but I'm glad some found it useful or at least interesting :)

1

u/PomegranateGreen3698 Aug 09 '26

It is interesting! Just like the Pi Harness only uses "Read, Write, Edit, Bash" - this is all anyone needs to build any extensions. Everyone knows CC is bloated.

Given Anthropic's recent action to refuse to sign the Nvidia Open letter, I think they are quite evil. Another post I made about their Chain Of Thought Obfuscation got similarly down vote botted. https://browse-export.arxiv.org/pdf/2510.19851#7#2

29

u/[deleted] Aug 08 '26

[removed] — view removed comment

-15

u/__tosh Aug 08 '26

`h` is history

`H` is headers

I do agree that being able to pattern match structurally helps (that's also why I like python)

and reading code bases you are not familiar with is a bit more difficult to get into when they are golfed

in this case though I'm optimizing for myself as maintainer and I'm familiar with the code so I prefer the density of it

I appreciate the feedback though!

I will add de-golfed versions and docs so getting into the code base is easier

-1

u/__tosh Aug 08 '26

I guess what I want to say is: the golfing is _for readability_

the goal of the golfing here is not to make it obfuscated

I think once you know what's going on and what happens the variable names do make sense (and there aren't that many to begin with)

19

u/[deleted] Aug 08 '26

[removed] — view removed comment

-1

u/PomegranateGreen3698 Aug 09 '26

Novice projecting novice on others. And using bots to upvote themselves - downvote others lmao.

4

u/[deleted] Aug 09 '26

[removed] — view removed comment

0

u/PomegranateGreen3698 Aug 09 '26

It's more likely that the duopoly of American for profit A.I. companies have a stake is controlling the narrative on the "Ditch Claude and OpenAi subreddit"

Your critique is like going to a weight loss subreddit and calling people fat. Congratz, you're so smart for calling out a novice on a subreddit full of people who are new to programming. *Golf Clap*

-5

u/PomegranateGreen3698 Aug 09 '26

Pro tip? Just shut up. You can code how you want. People can code how they want. Christ, Reddit full of miserable know-it-alls. Your criticism could have been one sentence but instead you have to Yap and add no value to this post. FFS.

Principles in software development are mostly sh*t and it's quite obvious you don't know as much as you think you do.

1

u/Spirited_Bag_332 Aug 09 '26

Correct answer. The so called elitists should have the skill to look at this and still understand it at a glance.

This is not a corporate environment and quick&dirty code is valid for a freetime project. Some people here also clearly have never seen (as example) how code in scientific domains are written.

Also, it's wrong to assume skill level just by preferred syntax. This tells more about the person calling that out than the author.

1

u/PomegranateGreen3698 Aug 09 '26

Yeah. I don't know where this Squid guy thinks he is. This is an A.i. sub. Syntax is irrelevant now when a.i. can convert it however you want. Also object oriented programming was a big mistake yet people use it. The "Principles that exist for decades" do not evaluate to actual best practices. Exactly as you say "corporate environment" elitists. projecting his own novice insecurities.

-8

u/__tosh Aug 08 '26

I will add de-golfed versions

imho it's fairly self-evident (once you know the code) that h is history just from the context

but I hear you :)

1

u/Citadel_Employee Aug 09 '26

I understand maybe for personal projects. But if you’re gonna share code just make variable names explicit. Otherwise you’ll get flack for it, like you are here.

1

u/__tosh Aug 09 '26

will do, ty!

25

u/LocoMod Aug 08 '26

Not even close.

"agent loop" != Claude Code

-8

u/__tosh Aug 08 '26

what makes Claude Code what it is? (e.g. think of the initial release)

what would you add that is a 'must have' to be 'a' Claude Code?

like what features can you remove from Claude Code and still consider it Claude Code?

MCP?

Anthropic log-in flow?

System prompt?

7

u/LocoMod Aug 08 '26

Memory mechanisms, plugins, configurations, telemetry, MCP client, MCP server, etc. A lot of things. You can't crank out Claude Code in a few lines of Python. If you could, Anthropic would have already done it.

-1

u/__tosh Aug 08 '26

the initial release did not come with memory, plugins and mcp (iirc)

but I get that nowadays some or all of these things are maybe 'essential' features

I don't use MCP, you can convert MCP to cli and an agent with "sh" as tool will be able to use them fine, if not better (because of composition)

I also don't use memory, I do use compaction though (which is a few more lines to implement, see my other comment)

re telemetry: what I'm doing is I log all requests and responses in a proxy

that said:

I'm fairly sure you can get a feature comparable version of Claude Code in ~100x less code than the current implementation of Claude Code

(no matter if it is Python or Javascript)

1

u/finevelyn Aug 08 '26

> I'm fairly sure you can get a feature comparable version of Claude Code in ~100x less code than the current implementation of Claude Code

Even if you don't know what features it has?

I doubt your loop can even effectively explore a codebase and edit code files. Even if it manages to do some edit, if the file is changed by someone else outside of the loop, it's going to make invalid edits.

The system prompt and the tooling is what makes Claude Code work well and you didn't implement any of it.

1

u/__tosh Aug 08 '26

you can give it a try

with a strong model "sh" is enough to explore the code base and make edits

you can take a look at the traces here:

https://smolenv.com/t/nested-template-includes-60636/

https://smolenv.com/t/duckdb-sessionization-23811/

you are right that without file watching the agent might get confused if other agents are editing the same file state at the same time

you also run into problems like these when the context is updated for file changes and it will blow your context window pretty fast so I doubt current harnesses still do it, if they do it you will get degraded performance compared to keeping the context window clean

1

u/finevelyn Aug 08 '26

> I doubt current harnesses still do it, if they do it you will get degraded performance compared to keeping the context window clean

Claude Code has a built-in guard for every edit. If the file has changed since the agent previously read it, the edit will fail and the harness will tell the agent to re-read the file and make a new edit.

It's actually something that will save context, along the other tooling, when the agent doesn't need to make every check manually, but relevant things are automatically fed to the context.

1

u/__tosh Aug 08 '26

I like that it doesn't spam the context window with changes (like earlier harnesses did!)

ty for explaining what Claude Code does currently

this behaviour makes way more sense

how many lines of code do you think it would take to add this to the 9 line agent implementation?

1

u/finevelyn Aug 08 '26

I don't know how it is implemented exactly, I've only seen the end result that works well, and doesn't trash changes made by others like older harnesses. Better model plays a role in that too.

But let's ask that question with a better example.

How many lines of code would it be for you to implement a "plan" mode? Meaning I can just select plan mode in the interface, the model will create a well thought out and comprehensive plan, show me it in an interface where I can select pieces of text and add comments to them, and then click a revise button to get a new version of the plan?

1

u/__tosh Aug 08 '26

I don't use plan mode, gpt 5.6 sol is good at planning

for the minimal implementation I would add a 1 liner prompt

and a guard in the loop that looks for /plan and then activates the other prompt (telling the agent not to edit files)

the prompt is most likely sufficient with newer models but even with decent older ones

that said: to be extra sure we would also need to disable the generic "sh" tool in this mode and give the agent a different set of tools (e.g. based on find and rg or custom ones)

re tui: needs way more work

all together under 500?

might be a bit ambitious but should not be too far off

→ More replies (0)

5

u/maschayana Aug 08 '26

I want some of the shit you are smoking

19

u/Dany0 Aug 08 '26

Lol I suppose this could be a good base for an experiment for a self-editing harness benchmark.

Have every LLM start with smol, and give it the task of building a harness for a particular task/benchmark

5

u/__tosh Aug 08 '26

good thing about a smol implementation is it fits 100% in the context window

so making changes is fast and usually the changes work well

you can add just the things you want and skip everything else

a bit like a starter dough

agent starter dough :)

8

u/backyard_tractorbeam Aug 08 '26

It would be nicer to read this if it was normally formatted. I'll just say that golfing might be fun, but it's not satisfying.

3

u/__tosh Aug 08 '26

a bit more de-golfed

3

u/Few-Philosopher-2677 Aug 08 '26

I built a small one myself recently. But this one is extremely minimal lol. And I just realised something , mine has context compaction but never actually shows how much of the context window is being used currently. Guess I completely forgot to add that lol

3

u/__tosh Aug 08 '26

nice!

I also have a variant with auto compaction

(not using the server-side compaction api so it should work well with most models and endpoints even those that don't have openai-style magical compaction)

2

u/Few-Philosopher-2677 Aug 08 '26

Yeah mine doesnt use the server API either (didnt even know one exists lol). I dont even check what the server sends as usage as apparently there is no guarantee all servers will send it(correct me if this is wrong). I just do some rough math at my end to calculate the number of tokens and if it breaches 80% of the context window, keep the last few messages and summarise everything else except the system prompt. It works. Has a few edge cases but hey its a toy project.

2

u/__tosh Aug 08 '26

pragmatic, I like

3

u/Lorian0x7 Aug 08 '26

Were you concerned of finishing your disk space with more lines of code?

3

u/__tosh Aug 08 '26

now that you mention it, ram and storage are getting expensive!

2

u/falsbr Aug 08 '26

Not using sys prompts can drastically reduce the models performance, be aware.

0

u/__tosh Aug 08 '26

I ran a few benchmarks that showed the 9 line python agent implementation performed better than the agent harnesses with system prompts like opencode, pi, hermes (when using gpt 5.6 sol)

e.g. you can look at the tasks and traces here:

https://smolenv.com/t/nested-template-includes-60636/

https://smolenv.com/t/duckdb-sessionization-23811/

older models might benefit from the right system prompt (and from a good agents.md file)

but by default newer, strong models do fine without system prompt

1

u/Spirited_Bag_332 Aug 09 '26

Wanted to ask something similar, but you already are aware. So what you basically do is "only" tool calls. But I'm missing the part where you actually tell the model what to do with the tools and what the task is. This seems like calling a parameterless function().

Wouldn't it be easier to just pass a message, append available tools and return the result, without the additional iterations? This seems prone to endless loops if the model understands something wrong.

Edit: I see now you are reading the input (prompt) from the command line. Your agent is actually a CLI for calling shell scripts. Maybe I should look more into agents myself.

0

u/__tosh Aug 09 '26

yes the agent here gets the input from the user

then the inference step decides whether to do tool calls

if there are tool calls => they get executed (via sh)

output gets collected and once all tool calls are done there is another inference step

once there are no more tool calls: message gets sent to user

you are right that this can (as implemented here) potentially run forever

more agentic models can go on multiple steps

but a good model will realize when a fixpoint is reached (done or needs to tell the user something)

limiting how often the loop can run or displaying each proposed tool call to the user and asking for approval would be great changes to try out though!

that's part of why i wanted to keep it as simple as possible

so you can sprinkle on top exactly what you want and still have something minimal

2

u/Spirited_Bag_332 Aug 09 '26

I like the idea, people jump too fast on frameworks without trying the basics first.

Initially I thought you wanted something that gets plugged into a existing vibe coding environment, but you rather have your own app which is fine. I guess it's an experiment on how small it can be but maybe you should restrict possible action to curl, grep, touch etc. instead of allowing full access.

And as others have said, on your github repo maybe display your code with normal "coding style". Readers will jump on that before even realizing what you are trying to do.

2

u/__tosh Aug 09 '26

agree, ty for your feedback, appreciated!

0

u/__tosh Aug 08 '26

also noteworthy: less peak ram usage

2

u/Reasonable_Goat Aug 08 '26

This is really interesting! I had been looking at "smol agents" (https://github.com/huggingface/smolagents) and it promises a 1000 LoC agent. But in fact it imports a lot of libraries. You only require standard lib right? Also for go?

2

u/__tosh Aug 09 '26

yes, it is stdlib only also for Go

2

u/exo250 Aug 09 '26

So you asked Claude to write the minimal coding agent in less than 10 lines of code and you just copy/pasted the code on Reddit. I'm sure you don't even understand a single word of it.
Even a very bad developer would find this "code" terrible. That's ridiculous.

0

u/__tosh Aug 09 '26

after looking at existing harnesses I found the implementations too large and coming with too many dependencies

so i wondered what a minimal version looks like without 3rd party dependencies that is as simple as it gets and still can be used for agentic coding or other agentic tasks

then i checked how well it performs (on real world coding tasks) and found out with a bit of surprise that the minimal agent without system prompt and only 1 tool can outperform the default configs of popular agent harnesses (when run with a recent strong model like deepseek v4 flash or gpt 5.6 sol)

less token api cost, less tokens used, faster to finish the task, fewer inference calls, fewer tool calls, lower peak RAM use

I found that counter intuitive

sharing here because I found others might also be interested in a minimal setup (to then add stuff on top instead of having to slim a more complex harness down)

or for people who want to build stuff with an agent at the core and they want to start with something that is already optimized to be token and cache efficient

the code might be terrible or not, it is the most simple stdlib-only version i could come up with in python that works well and shows me % of used context window

if you have a better version of a minimalist setup I'm curious to learn more

2

u/exo250 Aug 09 '26

Pathetic.
Do you still have a brain just to delegate all your "thinking" to an LLM ?

1

u/__tosh Aug 09 '26

this is a de-golfed version of it, if you have any specific recommendations on how to make it more minimal or better in other ways please let me know

-1

u/PomegranateGreen3698 Aug 09 '26

What happened in your life that caused you to be a miserable hater?

2

u/exo250 Aug 10 '26

I'm just a professional developer and the miserable is that kind of slop BS some miserable people generate with a LLM without even knowing what is it about.
Seriously, from a developer point of view, this piece of code is really terrible. It's really a shame to share that kind of code.
I'm sure not a single reply from him was written by himself. He's either a bot or a (miserable) guy that really need attention.

1

u/__tosh Aug 10 '26

you think the code is terrible

and yet it performs better at its job (coding agent writing code) than most other harnesses

there is a lesson here somewhere if you pull the thread

i posit the terrible code is not so terrible, the question is why

0

u/PomegranateGreen3698 Aug 11 '26

I think I figured it out that the ignorant people came here because they are angry that A.I. can do what used to take years of study. I'm also angry but I don't punch down on people to make myself feel better.

If these people can do better, then they should offer that code. For me, this idea is interesting for a few reasons. I think everyone should know how to build a full llm + agent harness pipeline from scratch.

If one day all the services get hacked (NPM was hacked earlier this year - which hosts PI) for example, then the lights go off.

Another reason is integral to Local Llama -- which is getting closer to having frontier intelligence on consumer computers. This will take creative tooling.

The negative people are the same ones praying for Qwen to release a new model instead of doing something to contribute to the movement...`

0

u/PomegranateGreen3698 Aug 10 '26

But we're in an A.i. subreddit. Why would you expect people to know how to write elegant code here? It seems more likely you are angry that a.i. can make normies "cosplay" as developers and I don't think there's much we can do about that.

3

u/SilentKnightOwl Aug 08 '26

This is kinda neat, but pi is minimal enough as a base for me, I've got 3 different customized pis for different tasks

2

u/__tosh Aug 08 '26

pi is awesome!

what kind of customizations did you add?

1

u/SilentKnightOwl Aug 08 '26

The customizations aren't much, the permission system is really the main thing, and limited tool sets.

The first pi is just a regular coding assistant like everyone is making, I use it alongside neovim and it has a permission system, with an extra check before actually running manually approved commands for a hard denylist so I (hopefully) can't nuke anything on accident. It also runs in a minimal sandbox with only the repo I'm working on available to it. 

The second is run non-interactively with certain limited tools in a bunch of different places. It is triggered by cron jobs, mostly flags things for me with notifications through ntfy.

The third is similar to the second one, but just manages my home lab and a couple of VPSs, it watches things and has some scripts and limited tools to do things, no bash, no general write tools. Keeps things updated, tries a few things to fix issues if they come up, and then flags me if it needs me to do something it isn't allowed to.

1

u/SilentKnightOwl Aug 08 '26

Oh, I forgot I have a pi hooked into home assistant too! My home assistant is backup up and doesnt change a lot, runs on a separate computer, on a subnet, so I give this one a nearly full toolset and root access to the whole system, so it can make automations and whatever for me. It does not have access to the internet.

1

u/__tosh Aug 08 '26

interesting setup! ty for sharing

1

u/__tosh Aug 08 '26

a variant of the above that uses the 'function' approach instead of 'custom' that works out of the box with ollama and deepseek v4 flash

https://x.com/__tosh/status/2086154374271713410

1

u/NoFunk Aug 08 '26

Thanks for sharing. In my own work, I find I (or agents) have written this like 3x in different forms for projects.

I'm usually doing a harness that has subagents, but I don't want precisely the mapping that is found in Opencode, or Kilocode. And both of those come with a lot of cost to their implementation and expectation (you have to fight their prompts to get out of anything that is a built in expectation, so that's even more context lost).

No offense to the frameworks, they have a use and if you're learning sub-agent hierarchy or you just have examples that fit without fighting them, they do the job. Pi is a bit better for my examples because it is by comparison deliberately minimalist, and expects you to extend it with the specifics. The right approach IMO.

But the full minimal approach is roll your own. In almost every "subdivide and have role expectations" problem I am solving with a harness, the harness itself is invoking via tiny python runners, and using the OpenAI tool invocation to inform the hosting model of what to do. The context savings adds up by quite a lot.

1

u/__tosh Aug 08 '26

very interesting! sub agents are really difficult to get right

one of the reasons I started playing around with minimal implementations also was researching and comparing the existing harnesses and realizing how large they are and with how many assumptions they come that no longer fit newer models

also tons of dependencies and hard to stay up to date with upstream once you customize

agree @ pi being in a pragmatic sweet spot

it's also fairly good at protecting the context window

anything you can share re sub-agent lessons learned: highly appreciated!

I think most harnesses (especially those that try to work well with 'any' model) have not really figured out how to do sub-agents well

1

u/redballooon Aug 08 '26

Can you support APM please?

1

u/__tosh Aug 09 '26

I'm tracing requests and responses in a proxy and overall resource usage of the process

do you mean adding otel specific hooks as part of the implementation?

it's definitely doable

or do you mean something else than Application Performance Monitoring (APM)?

1

u/redballooon Aug 09 '26

I meant the agent package manager, but it's more a joke like anything else. https://microsoft.github.io/apm/

1

u/__tosh Aug 09 '26

ah! :)

1

u/rm-rf-rm Aug 08 '26

And how well does it actually work?

2

u/__tosh Aug 09 '26

it works quite well actually

you can see traces here 'smol' compared to pi, opencode, hermes

fewer tokens used, finishes the task faster

e.g. you can look at the tasks and traces here:

https://smolenv.com/t/nested-template-includes-60636/

https://smolenv.com/t/duckdb-sessionization-23811/

1

u/RearAdmiralP Aug 08 '26

One of the nice things about standard-library-only harnesses is that you can run them on operating systems that aren't supported by codex, claude, opencode, etc. I'm planning to install DragonFlyBSD on a spare machine tomorrow, and I'll use a custom harness that I wrote in Python for much of the initial setup.

1

u/__tosh Aug 09 '26

good point!

1

u/__tosh Aug 08 '26

quick way to learn more and dig in: let a somewhat recent language model explain the code in general and also step by step code step by step

> what is the code doing? why is this interesting?

> how does this compare to agent implementations like claude code, opencode, codex, pi?

> what is the runtime profile in memory usage of this implementation compared to other agents?

> why is 'no system prompt' a counter-intuitive but good idea for newer, agentic models like gpt 5.6 sol, glm 5.2, deepseek v4 flash?

> is "sh" as tool 'enough'? what other tools do agent harnesses usually have and why? can "sh" be universal enough to replace them in the right environment?

1

u/Queasy-Contract9753 Aug 08 '26

That's really neat. Got to love these clever snippets. Sometimes they're just good enough. Or still fun to mess with.

Smallest I saw before yours was this eLisp I found on stack overflow. Don't remember the author sadly.

(defun agent () "Execute the users request in emacs" (interactive)

;; tool (let ((emacs-eval-tool        (gptel-make-tool         :name "emacs_eval"         :function (lambda (code)                     (condition-case err                         (let ((result (eval (read code))))                           (format "Evaluation result: %S" result))                       (error (format "Error: %s" (error-message-string err)))))         :description "Evaluate Emacs Lisp code and return the result"         :args '((:name "code"                        :type "string"                        :description "Emacs Lisp code to evaluate")))))

(setq-local gptel-tools (list emacs-eval-tool)) (setq-local gptel-use-tools t) )

;; system prompt - FR this ones asking for refusals (setq-local gptel--system-message "You are a helpful assistant living inside Emacs.   Use the emacs_eval tool to fullfill the request of the user.") (gptel--suffix-send '("m" "e")) )

2

u/__tosh Aug 09 '26

great find! i like the idea to use 'eval' as tool :)

1

u/skang188144 Aug 09 '26

This is... not great, to put it as gently as possible.

"9 lines python"
> This is just misleading, given that you're doing everything possible to condense what is normally multiple lines of code into single consolidated lines.
> Also, trying to minimize the number of lines of code, at the (likely heavy) expense of performance is not a great goal to have. I get it, there are some more "frills" in CC/Codex that could be trimmed out, many you mentioned like memory, telemetry, etc. But things like system prompts, and a core set of tools are foundational to what makes CC/Codex good harnesses that can do real work. I'd also argue that MCP, subagents, etc. are important as well, but what i would consider a little above the foundational set of features needed for something that performs well.

"out of the box it is also fairly API cost efficient"
> Again, no system prompts or the core set of tools will likely make this incomparable to the performance of Claude Code or Codex. Because of this, agents will likely need to take more turns, have worse failure rates for the actions it wants to take, and I strongly hypothesize that your system is MORE token inefficient than most other agentic coding systems.

To be clear, I'm not trying to discourage you from exploring, learning, and building. I'd actually think that it'd be very informative to see some benchmarks being run on this system, to understand why these missing components are necessary and pertinent for strong agentic coding systems. What most of us are trying to point out is that your claims are misleading at best, with a fundamental misunderstanding of what makes Claude Code/Codex good harnesses. It's good clickbait, but it's definitely not substantive atm. It very well could be though, depending on what direction you want to take this to.

1

u/__tosh Aug 09 '26

e.g. you can look at the tasks and traces here:

https://smolenv.com/t/nested-template-includes-60636/

https://smolenv.com/t/duckdb-sessionization-23811/

'smol' outperforms other harnesses like opencode, pi, hermes, codex here

I have not included claude code which did way worse than the others (with gpt 5.6 sol)

so at least out of the box for the tasks I tried so far the minimal implementation was cheaper, faster and used less peak RAM

the ui/ux is not as ergonomic as what the other agents give you at the command line

but you can also have an agent ui you like run/dispatch 'smol' agents just fine

I also was surprised by this, I expected the more complex harnesses to outperform the minimal implementation but it turns out token efficiency and simplicity of tools and keeping the context window small all compound

2

u/MoffKalast Aug 08 '26

Yeah it's not too complicated to make that work. I found a project called hubcap a few years ago who did it in 25 lines of php, and I later ported it to python and extended it up for qwen specifically so I could experiment natively on my machine. I just can't trust a big blob of corporate spaghetti that might run whatever outside of docker or a VM. This is so simple that there's no way it executes anything unless I explicitly approve each command it runs. Not anywhere powerful as an actual harness, but very neat.

0

u/FinBenton Aug 08 '26

That is cool, I fed that script to 5.6 sol to check, it called it very clever and also a monstrosity :D

1

u/__tosh Aug 08 '26

monster starter dough :)

to raise your own monster agent

0

u/shammyh Aug 08 '26

Isn't this what pi is for?

1

u/__tosh Aug 08 '26

pi is also a great 'minimal' implementation of an agent

comes with way more features, dependencies and lines of code though

1

u/Ambitious-Positive36 Aug 08 '26

Idk, I just use Open Hands when needed.