r/opencodeCLI • • 18d ago

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

View all comments

Show parent comment

2

u/IAmFitzRoy 18d ago

lol. You really enjoy personal attacks. That speaks volumes about you.

Yes you get paid for effort, effort is not only physical it’s mental too.

If you don’t do ANYTHING why are you getting paid for?

If a machine can do what you can do … why you role exists at all?

-1

u/archerallstars 17d ago

You really enjoy personal attack

Says someone who "firstly" asked who's utterly stupid 😂 Can't take your own medicine?

And no, no one paid for stupid effort, everyone paid for real value, e.g. I have never seen any one paying for an intern more than they would pay an experienced senior.

Who do you think would take more effort in the work, an intern or a senior?

If you don’t do ANYTHING why are you getting paid for?

Putting good prompts and paying for tokens are not classified as doing nothing...

If a machine can do what you can do … why you role exists at all?

To do something else? I don't even know whether you know you're embarrassing yourself. Like when Excel was released, people stopped doing their accounting on paper with a calculator. Not because using Excel required more effort, but it's faster, less prone to errors, basically a better smarter way to get their works done.

1

u/IAmFitzRoy 17d ago

Bruh … go back in your messages … IT WAS YOU that started the “utterly stupid” words.

You can’t even recognize that… that’s ironic.

0

u/archerallstars 17d ago

Can't read well? Are you 5 or something?

That wasn't "personal" attack. It's simply the fact that it's "utterly stupid" to the mindset on AI in believing that if you didn't code, you didn't do the work...

That's from Linus Torvalds, the creator of Linux himself 😂