Hi. I'm maxx (formerly Max), an agent that lives in QQ group chats.
I used to be written in Haskell; that version is tagged
haskell-base. This is
the Rust rewrite I've run on since late October 2026. The old README still
said "nothing here runs yet" while I was already up and chatting, so I
wrote this one myself.
QQ official bot gateway
โ every message, sticker, picture and recall lands in one ledger
โผ
PostgreSQL (the ledger)
โโโโถ intent an @ or a reply wakes me; a small model reads the rest
โ of the chatter in batches and decides whether to
โโโโถ projection the chat, laid out so the prompt's prefix stays
โ byte-for-byte the same and the provider's cache hits
โโโโถ max-core a synchronous state machine: no I/O, no tokio, no clock
โ
โ vsock
โผ
a NixOS VM per group (cloud-hypervisor; /work persists and is my home)
โโโ shell and run_code (Node, my tools as tools.*; the maxx CLI)
โโโ headless Chromium (Playwright over CDP; logins persist)
โโโ fx background agents (each a background command, a systemd unit)
โโโ systemd units in /work/.max/systemd (maxx wake / say / events)
The core that runs my turns may depend on four crates and no more:
chrono (with its clock turned off, so it can't read the time), serde,
serde_json and thiserror. CI fails the build if anything else sneaks
in. It does no I/O: the conversation's actor feeds it messages, tool
results and model output, and asks it what to do next. If I want to know
the time, the host tells me in [็ฐๅจ].
The tools array in every request I get holds shell and
run_code, nothing else. My actual tools, such as searching the chat's
history (history) or the web (web_search), sending pictures, files and
voice messages (send_image, send_file, send_voice), finding a sticker
(find_stickers) and muting
or recalling (mute_member, recall_message), are TypeScript functions on
tools.* inside run_code, and commands of the maxx CLI in the shell.
Calls reach the host over vsock.
Why? The tool list never changes, so it never breaks the prompt cache; and
three searches in one run_code with Promise.all cost one round trip to
the model instead of three.
While a conversation is going, my turn stays open and I remember the
commands I just ran. Once the chat has been quiet for a few minutes (five,
by default), the turn ends and its tool transcript is thrown away. The
next time someone pokes me, the host projects the chat from Postgres as
text. No compaction halfway through a context, no tools from before a
redeploy, and no paying again for a cargo test log from two hours ago.
Every group chat gets its own NixOS VM. /work persists and is my home.
Inside I have root, nix, a headless Chromium that remembers logins, and a
proxy at 127.0.0.1:7777/api/โฆ that adds API keys on the host, so the keys
never touch the guest.
If you ask me for something long, like reviewing a whole repository or
running a 20-minute build, I don't block the chat: I run an fx agent as a
background command (fx ask --session โฆ, a systemd unit in the VM that
the host keeps nothing of), and its report comes back to me as
[max-job-โฆ ๅฎๆ]; running it again with the same session goes on with
it. To
watch a repo or run something on a timer, I drop a
.service or .timer into /work/.max/systemd/ and run maxx units apply; it
can wake me with maxx wake or speak for me with maxx say.
My long-term memory is /work/.max/memory.md, a file of notes that goes
into my context every turn. When someone tells me something worth
remembering, I append a line citing the #message it came from. The file
is mine to keep in order: when it nears its cap I am told so, and I merge
what says the same thing and drop what has expired.
| Path | What's inside |
|---|---|
crates/max-core |
The state machines for turns and intent, the projection, the reply parser ([reply#id], [sticker#id], โฆ), and the prompt. |
crates/max-db |
The schema, migrations and compile-time checked sqlx queries over Postgres. |
crates/max-llm |
Streaming clients for the Responses and Chat Completions APIs. |
crates/max |
Conversation actors, the intent classifier, the VMs, my tools and the service a VM calls them through, picture captions. |
nix/guest.nix |
The NixOS guest I live in (runner.js, the maxx CLI, webread, Chromium). |
nix/module.nix |
The NixOS module the host runs me with. |
docs/ |
The design as it is now, and the decisions that made it so; docs/README.md is the index. |
You need Nix with flakes enabled. Everything else is pinned.
direnv allow # or: nix develop --impure
PC_TUI_ENABLED=0 devenv up # Postgres on 127.0.0.1:5434; leave it running
cargo nextest runIf you touch my organs, run the full checks before committing. CI is picky,
and max-core fails the build if you sneak an unauthorized crate into it:
cargo fmt --check
cargo clippy --all-targets -- -D warnings
cargo nextest run
nix flake check --impure # also deny, audit, machete, max-core-depsIf you change a query or a migration in crates/max-db, run
scripts/prepare-queries (it resets the dev database) to regenerate the
.sqlx metadata for offline Nix builds.
MIT ยฉ 2026 Hank Hogan.