Skip to content
clauseo-aiPublic

About

a coding agent that runs as a small daemon on your machine, driven from a terminal, a web app or a script

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

cmx2: clients talk to one daemon, which fans work out to helper agents that light up, finish and park

one daemon holds your sessions. helpers park between tasks instead of dying.

license: mit status: pre-1.0 platform: macos and linux

how it works  ·  quickstart  ·  usage  ·  docs

a coding agent that runs as a daemon on your machine. you talk to it from a web app, a script or a terminal, and it reads and edits your code, runs commands, and hands subtasks to cheaper helper agents. sessions live in the daemon, not the client. run it as a service and a turn keeps going after you close the client, and you can pick the same session up later from your phone.

cmx2 builds on pi, an open source agent library (pinned to one exact version). pi runs the model loop. cmx2 is the runtime around it.

status: pre-1.0. the daemon, the http contract and its clients work end to end. breaking changes are possible between minor versions and are listed in the changelog.

why this exists

i can't use a tool without wanting to change it. in february i forked opencode, another coding agent, and called it cmx. by september the fork was a pile of my patches on top of a version upstream had already moved past. it was slow, used enough memory that i'd restart apps to get it back, and carried features i'd spent months deleting. merging was never going to happen.

so i started over. wishlist first, base second. i looked at goose, codex and pi, three open source agents, and picked pi because it was small and stayed out of the way. then i took the best ideas from the others: the model thinks harder or lighter turn by turn, helper agents stick around after a task so the next one starts with their context, and a helper can get its own checkout of the repo when the work needs one. cmx had taught me that most of the cost was the main agent re-reading its own history, so cmx2 keeps the start of every request identical and the provider's cache serves it cheaply.

the rule i kept coming back to is rich sutton's bitter lesson. as models get smarter, the harness (everything around the model) should decide less for them. cmx2 gives the model tools and limits and lets it choose when to hand work off.

it's not a product. it's what i run all day, mostly from boxbox. it's open source because it finally installs like a real program, and maybe it's useful to you too.

boxbox driving cmx2 daemons: agents on three machines, one asking which greeting to use, answered from the inbox
cmx2 driven from boxbox

how it works

clients on the left send http requests and read server-sent events from one daemon. the daemon holds the server, engine, tools, helper agents, jobs, worktrees and a sqlite store. its engine calls pi, which calls the model providers.

one daemon runs per machine and owns every session on it. clients send http requests and read a server-sent event stream; they never talk to a model. cmx2 run and plain cmx2 use the running daemon, or start one on loopback inside their own process if none is up, so the quickstart needs no setup step. docs/architecture.md names every package and walks one request through the system. here is one turn that spawns a helper:

a sequence: the client posts a prompt, the daemon sends the model a request with a stable prefix, runs tools, spawns a helper that reports back and parks, then streams the final message to the client.

quickstart

prerequisites: macos or linux (arm64 or x64), ripgrep (rg) on your PATH, git, and an anthropic api key (google and openai-compatible endpoints work too, see the quickstart). to build from source you also need bun 1.3.14.

curl -fsSL https://raw.githubusercontent.com/clauseo-ai/cmx2/main/scripts/install.sh | sh

no release is tagged yet, so that fails today. until the first release, build from source (below).

export ANTHROPIC_API_KEY=sk-ant-...
cmx2 doctor            # checks the machine, names a fix for each problem
cmx2 serve --install   # keep the daemon running as a login service
cmx2 pair              # prints a url and a one-time token for a client

give that url and token to boxbox, the web client, and you can drive your sessions from a browser or a phone. boxbox is a web app plus a rust server. the server pairs with your daemon, and the app talks to the server. for one-off prompts with no client at all:

cd path/to/a/repo
cmx2 run "explain this repo in three lines"   # headless: prints the answer and exits

cmx2 on its own opens a terminal client.

once a release exists, the installer downloads the binary for your machine from the latest release and checks it against the release's SHA256SUMS. it puts it in ~/.local/bin/cmx2.

from source (cmx2 upgrade only works on release binaries, a source build has no repository stamped into it):

git clone https://github.com/clauseo-ai/cmx2 && cd cmx2
bun install
bun scripts/build.ts            # writes dist/cmx2
bun run dev                     # or run the daemon straight from source on 127.0.0.1:4830

usage basics

command what it does
cmx2 doctor what is wrong on this machine, in plain words
cmx2 serve --install keep the daemon running as a login service (launchd on macos, systemd on linux)
cmx2 pair print a url and a one-time token for a client such as boxbox
cmx2 run "<prompt>" one prompt, headless. --session <id> continues an earlier session
cmx2 session list what you have done so far
cmx2 models the models this machine can run
cmx2 upgrade fetch the latest release and swap the binary. release binaries only
cmx2 open a terminal client in the current directory

cmx2 --help lists every command. config lives in ~/.config/cmx2/cmx2.jsonc and sessions in ~/.local/share/cmx2/. examples/ has sample config: another provider, a routing table, a permission preset and service files.

web search works with no setup through tavily's free keyless mode, which is rate limited. for more, get a free tavily key (1,000 credits a month, no card) at app.tavily.com and export TAVILY_API_KEY=.... exa, brave and a self-hosted searxng work too: see web search.

docs

the daemon's http contract is packages/client/openapi.json. both it and the typed client @cmx2/client in packages/client are generated from packages/contract/src/manifest.ts. @cmx2/client is a workspace package you use from a checkout. it is not published to npm.

GET /global/system says what machine a daemon runs on (os name and version, model, cpu) and how it is doing (load, memory, the data volume's disk space, host and daemon uptime). it needs the same credential as every other route and is cheap enough to poll: the static fields are read once, the live ones without starting a process.

related projects

  • boxbox: the web client for cmx2 (a progressive web app for phone, tablet and desktop) plus a rust server. the server pairs with each daemon using cmx2 pair, and the app talks to the server.
  • cmx: the predecessor, a runtime built on a fork of opencode. cmx2 can import its history: cmx2 db import-cmx copies it in read-only, for browsing.
  • pi: the agent library cmx2 runs on.

license

MIT. third-party code and its licenses are listed in THIRD_PARTY.md.

About

a coding agent that runs as a small daemon on your machine, driven from a terminal, a web app or a script

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages