r/opencodeCLI • • Oct 19 '26

I reimplement Opencode v2 and v1 in Rust

I use opencode every day and the thing that kept getting in the way wasn't the client. It was the server. On my laptop it sat at about 2.4 GB RSS next to a 33 GB SQLite file, and searching inside a single session took roughly six seconds.

So I reimplemented the server in Rust. Same HTTP and SSE wire contract, so the real TUI attaches and the real web UI loads against it. No client changes, no patches to their project.

Same box, same fixture data, back to back:

• binary: 61 MB, upstream 185 MB

• idle RSS: ~100 MB, upstream ~2.4 GB

• boot: 0.6 s, upstream 4.7 s

• session list and read p95: 0–2 ms, upstream 8–15 ms

• search inside one session: 0.2 ms, upstream ~6 s

• web UI first load: 1.05 MB of assets, upstream 9.10 MB

Then I ran a read-only load test, no model calls at all, both servers pinned to the same two cores. It held about 6,700 requests/sec against roughly 420 for upstream, with p95 latency an order of magnitude lower, and used about a quarter of the memory. That's a closed-loop test, so treat the throughput as capacity, not as a latency promise for your setup.

What works: TUI attach, the embedded web UI, sessions and messages with cursor paging, streaming, tools, permissions, questions, PTY, shadow-git snapshots, revert, diff, in-session search, MCP, and plugins in both the v1 shape and the newer v2 shape. Auto-compaction and config hot-reload. The v2 API surface is bound and tested against the real 2.0.28 client.

What doesn't: provider OAuth, the hosted share backend, and macOS/Windows: the PTY layer is Linux/glibc only.

"cargo install ocserve" still gives you 0.3.1, because crates.io caps crate size and one crate carries the embedded web UI; the 0.4.0 tarball is on the releases page.

It's not a fork. Separate codebase, MIT, their notice retained. I read their source to port behaviour faithfully and I keep a differential harness that boots both servers and compares the bytes.

If opencode runs fine on your machine, keep using it. It's the reference implementation and it's good. This exists for the machines where the server is the thing falling over.

MIT, source and releases: https://github.com/Reliary/ocserve

51 Upvotes

55 comments sorted by

20

u/ByteNomadOne Oct 20 '26

By saying “I reimplemented” you meant “Opus reimplemented“

6

u/microbass Oct 20 '26

Fair enough. I got my LLM to make an Opencode compatible agent harness.

16

u/RE20ne Oct 20 '26

probably and also who cares? not relevant and not a negative.

-1

u/ByteNomadOne Oct 20 '26

It’s fine that he did use Opus (as it would be impossible to do without), but it feels off to say “I did” while it ran fully automatic.

4

u/Alive_Solution_689 Oct 21 '26

Have you implemented anything serious using Opus "fully automatic" and it worked just like that?

0

u/ByteNomadOne Oct 21 '26

Nope, to be honest I can't afford Opus and stick to cheaper models. I just hear all the time that people one-shot things with Opus 5.5 using that REA project.
I don't have first hand experience how good it actually is.
You're right to question that.

2

u/Alive_Solution_689 Oct 21 '26 • Bravo

Small advice, don't always believe what "people" are saying. 😁

I am developing with Opus 5.5 right now and did so before with many other models. While current Opus is slightly better than earlier versions, there is no huge improvement.

I am always shaking my head in disbelief when people claim apps have been developed by an AI model. They must be able to do miracles.

1

u/ByteNomadOne Oct 21 '26

Thank you very much for this insight.

I'm paying for GLM 5.3 Flash and it mostly gets things right, but it needs some directions to not go off the rails and every 10th time it produces garbabe all the sudden.

2

u/Alive_Solution_689 Oct 24 '26

True, but you get used to it... Z.ai just gave my another 500M tokens for the weekend, GLM-5.3 and GLM-5.3-Flash, more than ever before. So I don't complain too much.

1

u/ByteNomadOne Oct 24 '26

Thanks for the hint. I grabbed that, too.
GLM 5.3 Flash is my favorite model.

I let it commit, but not push. When it’s done I quickly go over what it did, drop the garbage commits and push the rest.

Most of what it does it helpful, so I let it work on my code.

1

u/RE20ne Oct 24 '26

Opus-5-5 was the most radical jump in frontier intelligence and speed/cost/value I have ever seen. that first week was a fever dream.

1

u/Alive_Solution_689 Oct 24 '26

As a daily user I would disagree with the "radical jump". It is good, finally an opus model staying on track with what I want it to do, and with a subscription you get a lot for 20$. But I am still using ~10 other models doing their assigned tasks on a similar level. And Claude Code is definitely not my harness of choice.

4

u/Pedrito_Basket Oct 20 '26

Yeah like an architect saying he makes houses while not touching a brick

-5

u/archerallstars Oct 20 '26

He still did. He put in prompts and paid for the tokens...

0

u/IAmFitzRoy Oct 20 '26 edited Oct 20 '26

He literally paid for tokens so a machine can build it.

He wrote /goal “no mistakes” and went to sleep, he didn’t do it.

0

u/archerallstars Oct 20 '26

Imagine when you work on Excel and your boss doesn't pay you saying you "didn't" do the work, it's Excel, unless you do all the calculation on paper...

People mindset on AI is still utterly stupid even in an AI sub like this one 😂

Maybe, the "utterly stupid" part needs to be echoed to people here from Linus Torvalds himself:

https://thenextweb.com/news/torvalds-ai-assisted-by-tag-utterly-stupid-open-source-summit

2

u/IAmFitzRoy Oct 20 '26 edited Oct 20 '26

Bruh…. If you can’t see the difference between working in Excel … vs. sending a prompt with /goal and go to bed… we are toast.

We have reached AGI if we consider yours. lol.

-1

u/archerallstars Oct 20 '26

It would be "utterly stupid" to evaluate any work on the effort putting into it. I base my evaluation on the quality. If it works great from an AI prompt with /goal set, I called it a smart way to work, so the dev can use their time elsewhere...

2

u/IAmFitzRoy Oct 20 '26

Well it’s utterly stupid to not consider the effort.

Thats how your boss measure your pay.

If your boss suddenly realize he can do your job because… it requires NO effort… what will happen?

He will fire you.

Who is the utterly stupid now?

-1

u/archerallstars Oct 20 '26

You have an "utterly stupid" boss. If you're still working in a job that requires no effort, you're "utterly stupid".

Smart people sell ideas, not effort.

What type of an "utterly stupid" are you?

→ More replies

-3

u/motonarola Oct 20 '26

Relevant, because no value added. OpenCode team could do it themselves if they thought it is needed.

2

u/SebastianSonn Oct 20 '26

When using agent to create software, the ownership is still with the human. And ownersip means both ipr and responsibilities. Even Linus Torvalds agrees on this.

2

u/ColonelKlanka Oct 21 '26

I would suggest it would have been better to participate on the opencode github project and work to pushing a pr to improve existing codebase. All these alternative reimplentations are just going to sit un maintained and will not gain any updates from original opencode.

1

u/microbass Oct 21 '26

I made my own version to solve a problem I was facing. Upstream opencode has many, many open PRs. This version also has a somewhat mechanical diffing mechanism to inherit from opencode, easing the maintenance burden. Plus, it's open source so others can fork or contribute.

1

u/Rustybot Oct 23 '26

Upstream opencode doesn’t accept PRs in practice(almost ever) and they certainly wouldn’t take a full rebuild.

1

u/jrz302 Oct 20 '26

Benchmarks sound great. Would love to get the memory footprint down on my machine. Any plans for Apple silicon support?

3

u/microbass Oct 20 '26

Sure. I'll add it to the CI!

1

u/Rustybot Oct 21 '26

Seconded.

2

u/microbass Oct 21 '26

In progress. I'll need testers as I don't have a Mac, but I used compatible runners for integration testing.

2

u/microbass Oct 21 '26

Apple silicon support is done

1

u/jrz302 Oct 21 '26

That was fast! Will definitely check it out.

1

u/microbass Oct 21 '26

Please do. I'd love some feedback.

1

u/arker0 Oct 20 '26 edited Oct 20 '26

Will it be musl (alpine) compatible?

2

u/microbass Oct 21 '26

Working on it!

1

u/Rustybot Oct 21 '26

How is the plugin compatability?

2

u/microbass Oct 21 '26

It works for my plugins, but I'm working on a pipeline for better confirmed coverage.

1

u/Rustybot Oct 23 '26

I’ll give it a crack with my stack and see how it goes.

2

u/microbass Oct 23 '26

Cool. Be sure to grab the latest version as I've made major plugin compatibility improvements in the last couple of days.

1

u/Sufficient_Wait4290 Oct 21 '26

I would rather build my own. It would be nice to pick open source libs for skills, for git etc and put together for exactly the code agent you need.

-3

u/gandazgul Oct 19 '26

Since you are open to trying new coding agents and open code is not cutting it for you try RunWield :) https://runwield.dev/

4

u/IlBuono47 Oct 20 '26

Jesus, I have harness fatigue

1

u/gandazgul Oct 21 '26

Can you expand on this? Why the fatigue and what could I do to make any transitions easier or helping you try it without having to rebuild your setup which is how I understand this.

2

u/Sufficient_Wait4290 Oct 21 '26

Does it make parallel calls to the llm?

1

u/gandazgul Oct 21 '26

It supports subagents (delegate_agent tool) and background tasks (async tasks with automatic reply to the LLM when done)

Otherwise no, one call at a time. It also supports tool call batching and multi file edits and code search batching as well.

0

u/Leading-Salt-947 Oct 19 '26

I'm. Going to try it out and thank you

-7

u/microbass Oct 19 '26

No, thank you. I'm already building my own bespoke harness on top of the ocserve lessons.

1

u/Infamous_Trade Oct 19 '26

then he won't use your sloppified rust made opencode :)

3

u/microbass Oct 19 '26

I'll have you know it was hewn from free range, organic slop. Only the best.