arcbox / common
AGENTS.md4.3k starsChanged 4 months agoApache-2.0View on GitHub
Scope: the pure, transport-agnostic crates under common/. Routing lives in common/arcbox-route/AGENTS.md (authoritative — do not restate it here); splicetcp internals live in common/splicetcp/README.md. The crates below the net cluster — arcbox-asset, arcbox-constants, arcbox-error, arcbox-logging — also live in common/ but are not net crates; the one hard rule below does not bind them. See "arcbox-asset & distribution". - No VM / VirtIO / device / hypervisor dependency in any common/ net crate (arcbox-packet, arcbox-datapath, arcbox-conntrack, arcbox-dns, arcbox-fakeip, arcbox-proxy, splicetcp, arcbox-xnu-net).…
Trending
Quiet since September.thin dataabout the whole repository
Who's talking about arcboxlabs/arcbox
- A Hacker News story“ArcBox: From-Scratch Container Runtime for macOS in Rust (Docker, K8s, MicroVMs)”Hacker News · Jul 20, 2026 · 3 points
- @github-trending-rs.bsky.social“🚀 Skyrocketing! 🚀 (200+ new stars) 📦 arcboxlabs / arcbox ⭐ 3,352 (+360) 🗒 Rust Run AI agents on real …”Bluesky · Sep 6, 2026
- @githubprojects.bsky.social“arcboxlabs/arcbox Agents need powerful system access. Giving them your actual machine is the uncomfortable …”Bluesky · Sep 6, 2026
- @github-trending-rs.bsky.social“🎉 Celebrating! 🎉 (500+ new stars) 📦 arcboxlabs / arcbox ⭐ 2,448 (+506) 🗒 Rust Run AI agents on real and …”Bluesky · Sep 2, 2026
- 1Password/for-open-source“Application for ArcBox”GitHub · Apr 18, 2026
The biggest 5 of 6 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 6
Talked about on Bluesky, GitHub and Hacker News (6 times).
On Bluesky · 3
- Sep 6, 2026🚀 Skyrocketing! 🚀 (200+ new stars) 📦 arcboxlabs / arcbox ⭐ 3,352 (+360) 🗒 Rust Run AI agents on real and isolated machines — own… — @github-trending-rs.bsky.social0 likes and reposts · 1 reply
- Sep 6, 2026arcboxlabs/arcbox Agents need powerful system access. Giving them your actual machine is the uncomfortable part. ArcBox gives agents… — @githubprojects.bsky.social0 likes and reposts · 1 reply
- Sep 2, 2026🎉 Celebrating! 🎉 (500+ new stars) 📦 arcboxlabs / arcbox ⭐ 2,448 (+506) 🗒 Rust Run AI agents on real and isolated machines — own kernel,… — @github-trending-rs.bsky.social0 likes and reposts · 1 reply
On GitHub · 2
- Apr 18, 2026Application for ArcBox — 1Password/for-open-source0 reactions · 2 comments
- Mar 23, 2026feat: remove daemon plist log paths (companion to arcbox#99) — arcboxlabs/arcbox-desktop0 reactions
On Hacker News · 1
- Jul 20, 2026ArcBox: From-Scratch Container Runtime for macOS in Rust (Docker, K8s, MicroVMs)3 points
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository10 other files it gives its agents.
- AGENTS.mdAGENTS.md
- app/AGENTS.mdAGENTS.md
- computer/AGENTS.mdAGENTS.md
- engine/AGENTS.mdAGENTS.md
- guest/AGENTS.mdAGENTS.md
- rpc/AGENTS.mdAGENTS.md
- runtime/AGENTS.mdAGENTS.md
- virt/AGENTS.mdAGENTS.md
- xtask/AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
The file
We split this AGENTS.md into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 43
Run cargo test -p arcbox-asset --features download, or the regressions above are silently skipped.
- Distinctive: line 52
Do not treat sidecar validation as tamper detection.
- Distinctive: line 124
Only the first question is parsed (QDCOUNT ≥ 1).
- Very specific: line 126
Keep it std-only (std::net).
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
common/ — Shared Crates Agent Guidance
Scope: the pure, transport-agnostic crates under common/. Routing lives in
common/arcbox-route/AGENTS.md (authoritative — do not restate it here);
splicetcp internals live in common/splicetcp/README.md.
The crates below the net cluster — arcbox-asset, arcbox-constants,
arcbox-error, arcbox-logging — also live in common/ but are not net
crates; the one hard rule below does not bind them. See "arcbox-asset &
distribution".
The one hard rule
- No VM / VirtIO / device / hypervisor dependency in any
common/net crate (arcbox-packet,arcbox-datapath,arcbox-conntrack,arcbox-dns,arcbox-fakeip,arcbox-proxy,splicetcp,arcbox-xnu-net). WHY: two independent consumers depend on that purity — the VM datapath (virt/arcbox-net,virt/arcbox-net-virtio) and the host-only proxy harness (virt/arcbox-net/examples/tun_proxy.rs, docs/experiments/2026-06-17-surge-tun-proxy.md). Every change must serve both; adding a VM type here silently breaks the host harness. Most net-cratelib.rsheaders restate this (arcbox-xnu-net's does not) — keep them true. The dependency half is checked mechanically bycargo xtask check-layersin CI (linux-enginejob), for everycommon/crate, net or not: no direct edge intovirt/,engine/,computer/,app/orguest/.
arcbox-asset & distribution — invariants (net-purity rule does not apply)
- Per-call unique temp name is load-bearing.
download_and_verify/download_raw(arcbox-asset/src/download.rs) stream to a private{name}.{pid}.{seq}.tmpsibling (unique_temp_path), hash the stream incrementally, thenrenameatomically. There is no cross-process lock, and several callers install into the same~/.arcbox/runtime/binconcurrently. Reverting to a fixeddest.tmplets two writers truncate and interleave one file that each writer's own stream hash still verifies — a corrupt binary then gets renamed into place as "verified". Uniqueness makes each writer's temp private, so concurrent installs degrade to last-writer-wins with a genuinely verified file. The temp is removed on every error path — don't "simplify" that away, unique names otherwise accumulate. Regressions:concurrent_downloads_of_same_dest_yield_verified_file,checksum_mismatch_removes_temp_file. - The download module is feature-gated; plain
cargo test -p arcbox-assetruns ZERO of those tests.downloadis not indefault(Cargo.toml). Runcargo test -p arcbox-asset --features download, or the regressions above are silently skipped. - tgz tools trust a sidecar, not the binary (ABX-413, open — tgz install
integrity gap). For
ArtifactFormat::Tgztools (docker,docker-compose) theassets.locksha pins the archive, sois_cachedandvalidate_all(app/arcbox-docker-tools/src/manager.rs) read a{name}.sha256sidecar and never re-hash the extracted binary — swap the installed binary while leaving the sidecar intact andvalidate_allpasses.ArtifactFormat::Binarytools (buildx, …) ARE re-hashed against the file. Do not treat sidecar validation as tamper detection.- Wrong/corrupt docker binary that still passes
validate_all→shasum -a 256 ~/.arcbox/runtime/bin/dockerandcat ~/.arcbox/runtime/bin/docker.sha256→ the sidecar (archive sha) matched while the binary did not; delete the sidecar to force a reinstall.
- Wrong/corrupt docker binary that still passes
arcbox-bootis an EXTERNAL registry crate — do not patch it from this repo. Pinned asarcbox-boot = "0.5.1"in the workspaceCargo.toml; it is not a path member. It still carries the fixed-temp-name bug and trusts the manifest bytes it parses (ABX-417, open — boot-manifest trust gap). The fix must land upstream and then be version-bumped here; a local edit has nowhere to go. (Thearcbox-bootbinary undervirt/arcbox-hypervisor/src/bin/is an unrelated target that shares the name.)arcbox-constants/src/wire.rsis the single source of truth forAGENT_PROTOCOL_VERSION/MIN_AGENT_PROTOCOL_VERSIONand theMessageTyperegistry. Evolution rules (when to bump, how to add a message type, the roundtrip-test requirement) live inrpc/AGENTS.md— follow it, don't restate.
arcbox-datapath — memory-safety landmines
LockFreeRingis SPSC only;MpmcRingis the multi-producer/consumer variant (Vyukov bounded queue,T: Copy). WHY it matters: wiring a second producer/consumer ontoLockFreeRingis silent UB, not a slowdown — no compile error (unsafe Send/Syncis bounded only onT: Send, which the u32 indices used here satisfy).PacketPoolusesMpmcRingdeliberately for ABA safety (src/pool.rs).PacketRefauto-frees on drop. To hand a buffer to a ring by index, callinto_index()(suppresses the free viaManuallyDrop); passing.index()without consuming the ref double-frees.pool.get_mut(idx)while anyPacketReffor that index is live is caller-guaranteed instant UB — none of this is compiler-checked.pool.free()spin-retries because the MPMC ring can transiently report full; do not "fix" that into a bail.LockFreeRing/MpmcRingcapacities round up to the next power of two (next_power_of_two).PacketPool::newdoes not — it keeps the caller's raw capacity (.max(1)); only its internal free-index ring rounds up.
arcbox-conntrack — NAT engine cross-site invariants
- Reverse-NAT key lockstep (extension checklist). The reverse key
(dst_ip, external_ip, dst_port, nat_port, protocol)is hand-built at THREE sites — two insrc/conntrack.rs(get_or_createinsert,removedelete) and one insrc/translate.rs(translate_inboundbuilds the lookup key;lookup_reverseonly doesself.reverse.get, it builds no key). Change the tuple shape in one place and outbound still works while return traffic is silentlyNatResult::Dropped— a one-way-connectivity bug that is hard to localize. Change all three together. - Hardcoded framing assumptions in
translate(): L2 Ethernet at offset 0, EtherType at[12..14], IPv4 (0x0800) only, TCP(6)/UDP(17) only — everything else isPassThrough/Dropped. UDP checksum0means "no checksum" and is deliberately skipped. NatEngine::newdefaults the internal subnet to192.168.64.0/24. Callers on a different subnet MUST callset_internal_networkor NAT silently no-ops.PortAllocator::allocateis a barefetch_addmod range — it does not check conntrack for a live collision. Flag this before trusting it at high connection counts.- Incremental RFC 1624 checksum updates live in
arcbox-packet::checksum; the SIMD variants must equal the scalar path (test_checksum_simdasserts it).
Guest-facing parsers (VM path)
translate()(arcbox-conntrack) andDnsQuery::parse(arcbox-dns) consume arbitrary guest bytes on the VM datapath. The virt/AGENTS.md "Guest-controlled input" rule applies here: every guest-programmed value is arbitrary bits, all arithmetic on it must be checked, bounds verified before any slice. Any new field access needs the same length/overflow guards; tests must cover truncated and oversized inputs (including near-u64::MAX).
arcbox-dns — hand-rolled byte layout
- Response builders write flag bytes at
[2]/[3]and counts at[6..12]literally.build_nxdomain/SERVFAIL/NODATA MUST zero ANCOUNT/NSCOUNT/ARCOUNT, or EDNS(0) queries (ARCOUNT=1 in the request) get malformed responses. - Only the first question is parsed (QDCOUNT ≥ 1); trailing OPT/EDNS ignored.
- This crate compiles for the guest musl target (
aarch64-unknown-linux-musl). Keep it std-only (std::net); do not pull in host-only deps.
arcbox-xnu-net — macOS batch DGRAM kernel landmines
It carries both halves of the datapath's guest socketpair I/O (ABX-313):
GuestTx::flush (virt/arcbox-net/src/darwin/datapath_loop/guest_tx.rs)
sends, FdFrameSource::drain (common/splicetcp/src/frame_source.rs)
receives. A semantics change here lands on both directions at once.
msghdr_xmust be fully zeroed before everyrecvmsg_x— older XNU kernels validate all fields, not just the ones we set (src/ffi.rs,src/batch.rsre-zeros per call).recvmsg_x/sendmsg_xare private-but- stable XNU symbols fromlibsystem_kernel.dylib.MAX_BATCH = 256matches the defaultkern.ipc.maxrecvmsgx/maxsendmsgx. These sysctls are tunable down andcnt > maxreturns EINVAL (a hard failure, not a short batch), so the crate reads both once per process and clamps every call itself (BatchDgram::{send,recv}_capacity). Callers no longer clamp — but a caller that pre-sizes buffers offMAX_BATCHwill over-allocate on such a host.- An oversized datagram is truncated silently on recv. XNU leaves
msg_flagszeroed instead of raisingMSG_TRUNC(measured macOS 26.4;oversized_datagram_is_truncated_without_a_flagpins it) and the discarded tail is not left queued. Slots are sized before the syscall and cannot grow, so every buffer must be at least the largest datagram the peer can send — this is whyMAX_FRAME_SIZEstays 65535 inframe_source.rs. - A send that overruns the peer is a partial send, not an error.
sendmsg_xreturns the accepted count and carries no errno once it accepted anything, so the caller must requeuebufs[n..]and learn why it blocked from a follow-up call.GuestTx::flushdepends on this: it needsEAGAINvsENOBUFSfor its blocked-state machine, so it hands the first refusal to a singlewrite(2). Regression:partial_send_reports_accepted_count. - The fd must be
O_NONBLOCK;recv_batchreturnsWouldBlockwhen idle and readiness reactors rely on that to clear readiness. A blocking fd wedges the reactor. A reactor must also drain toWouldBlockrather than stop at the first short batch — it clears readiness afterwards, so a datagram that arrived mid-drain would wait for an unrelated wakeup.
arcbox-fakeip / arcbox-proxy — proxy awareness
proxy_detectusesscutil/ifconfigprobes that are cfg-gated to macOS; off macOSdetect()silently falls back to env vars only.198.18.0.0/15(198.18.x / 198.19.x) is the Surge/Clash Fake-IP convention, not an ArcBox choice (is_fake_ip).- The
dns_logmodule is the seam that lets splicetcp recover the original hostname from a Fake-IP so TCP egress can tunnel by name (CONNECT / SOCKS5). Break it and by-name tunnelling regresses. Proxy internals →common/splicetcp/README.md.
Debugging
- Return traffic dropped, outbound fine → check the three reverse-key sites
are identical:
rg -n "ConnTrackKey::new" common/arcbox-conntrack/src. Most likely a desynced reverse key or a missingset_internal_network. - NAT no-ops entirely / packets
PassThrough→ verify EtherType is IPv4 and proto is TCP/UDP, and that the guest IP is inside the configured internal subnet (default192.168.64.0/24). - Batch recv fails with EINVAL on some hosts → check
sysctl kern.ipc.maxrecvmsgx kern.ipc.maxsendmsgx; a lowered cap below the per-callcntis EINVAL.BatchDgramclamps to these itself, so an EINVAL here means the clamp was bypassed (a hand-rolledrecvmsg_xcall). Confirm the fd isO_NONBLOCK. - Guest-bound frames stop flowing while
guest-tx delivery countersshowsqueue_lenstuck non-zero → the datapath queues onsendand only writes onflush, so a missingGuestTx::flushin a new event-loop path strands everything it queued.rg -n "guest_tx.flush" virt/arcbox-net/src/darwin— the tail flush must also precede thehas_backlogfast-path gate, or the gate reads "produced this iteration" as backpressure and starves the poll. tx_frames / tx_syscallssits at ~1 in the same log line → batching is not engaging: either every flush sees a single queued frame (an event-loop path flushing too eagerly) orsendmsg_xis failing and every frame falls through to the single-write classifier.- Malformed DNS response for a client → diff the flag/count bytes in the builder; confirm ANCOUNT/NSCOUNT/ARCOUNT are zeroed on the negative paths.
- Sporadic memory corruption near the datapath → look for a second
writer/reader on a
LockFreeRing, or aget_mut/PacketRefalias, or a buffer index handed to a ring withoutinto_index().
Validation ladder (cheapest first)
cargo test -p <crate>— per-crate unit tests (every module has them).- Host-only end-to-end: the
tun_proxyharness (Gate C, docs/experiments/2026-06-17-surge-tun-proxy.md) exercises classifier + TcpBridge + proxy without booting a VM. - VM datapath: run through
virt/arcbox-net/virt/arcbox-net-virtio. - Full-path throughput / regressions: iperf3 reproducer and measured caps in docs/benchmarks/network.md.
Because these crates are pure and have a host-only harness, a NAT/classifier/ proxy change is validatable on the host — far cheaper than the HV e2e ladder in virt/AGENTS.md.
Pointers (do not duplicate)
- Routing:
common/arcbox-route/AGENTS.md(authoritative). - splicetcp architecture:
common/splicetcp/README.md. - Perf numbers & throughput-collapse analysis: docs/benchmarks/network.md.
- Host tunnel proof: docs/experiments/2026-06-17-surge-tun-proxy.md.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

