mech.app

The mech.app newsletter

Agentic AI, minus the noise.

Get practical field notes on AI agents, automation, developer tools and security delivered to your inbox.

No spam. Unsubscribe anytime.

Security

XBin: Self-Hosted Sandboxed Workspaces for Agent-Generated Code

A Harvard-architecture workspace that isolates agent code from state, using namespaces and default-deny grants to contain self-modifying tiles.

Source: xbin.dev
XBin: Self-Hosted Sandboxed Workspaces for Agent-Generated Code

XBin is a self-hosted workspace that treats agent-generated code and runtime state as separate security domains. It borrows the Harvard architecture concept (separate instruction and data memory) and applies it to directories: agents rewrite code in one sandbox, live state answers only to the tile’s own API in another. The result is a deployment shape where self-modifying components cannot accidentally leak secrets or escalate privileges through the code they write.

The project launched on Hacker News with minimal fanfare (2 points, 0 comments) but addresses a real gap: how do you host and manage 100x more code when agents are the primary authors? Traditional container orchestration, WASM runtimes, and serverless functions all assume human-written, relatively static code. XBin assumes the opposite.

Architecture: Tiles, Terminals, and Grants

Every component is a tile, which is just a directory. A tile can contain:

  • An index.html frontend
  • A backend (Go, Node, Python, or none)
  • Its own git repo for versioning
  • An encrypted vault for secrets

Tiles run rootless with user, mount, pid, and network namespaces. Seccomp and landlock further restrict syscalls and filesystem access. By default, a tile cannot reach the network or another tile. You grant access explicitly using bx grant.

Terminals are sandboxed shells attached to a tile, running in the browser. No SSH, no local checkout. You open a terminal, edit code, commit, and the tile updates live. Agents can do the same: point an agent at a tile’s terminal, and it can rewrite the tile’s code from inside the workspace.

Grants are the authorization boundary. A tile declares typed interface slots (“I need an LLM”, “I need MCP servers”) and you wire them together. The grant system is default-deny: nothing moves between tiles unless you approve it.

# scaffold a new tile
$ bx new apps/dashboard --runtime go

# attach a terminal (in the browser)
$ bx term apps/dashboard

# inside the terminal, edit and ship
~/apps/dashboard $ vim backend/main.go
~/apps/dashboard $ git commit -am ship

# grant access to another tile
$ bx grant apps/dashboard res:apps/db reader

Isolation Layers

XBin stacks multiple isolation primitives to contain agent-written code:

LayerMechanismWhat It Stops
User namespaceRootless containersPrivilege escalation via setuid binaries
Mount namespacePrivate filesystem viewReading other tiles’ files
PID namespaceIsolated process treeSignaling or inspecting other tiles
Network namespaceNo network by defaultExfiltrating data or calling external APIs
SeccompSyscall filteringKernel exploits via obscure syscalls
LandlockPath-based access controlWriting outside the tile’s directory
VaultEncrypted secretsHardcoding API keys in agent-generated code

The vault is per-tile. Secrets are encrypted at rest and only decrypted when the tile’s backend requests them via the XBin API. If an agent rewrites a tile’s code to log all environment variables, it still cannot see secrets from other tiles.

Self-Modifying Code Flow

The typical flow for an agent modifying a tile:

  1. Agent connects to the tile’s terminal (browser-based shell).
  2. Agent reads current code, proposes changes.
  3. Agent writes new code, commits to the tile’s git repo.
  4. XBin detects the commit, rebuilds the tile if needed.
  5. Tile restarts with new code, but state remains in the separate state sandbox.

Because code and state are separated, a buggy agent rewrite cannot corrupt the tile’s database or leak its secrets. The worst case is a broken tile that fails to start. You roll back the git commit and restart.

Deployment Shape

XBin runs as a single unprivileged daemon on a Linux box (or macOS via Lima VM). No SaaS, no telemetry, no external accounts. Tiles are stored as directories on disk, backed by git. The daemon manages namespaces, grants, and the internal HTTP router.

Tiles are internal by default. They serve users inside the workspace. To expose a tile to the internet, you run bx expose, which puts it behind your TLS termination. Most tiles never need this. A dashboard for your home lab stays internal. An API you want to share gets exposed.

The install script is a single curl command:

$ curl -fsSL https://xbin.dev/install.sh | sh

It prints the plan and asks before changing anything. The entire system is MIT/Apache-2.0 licensed.

Observability and Failure Modes

XBin does not include built-in observability beyond basic logging. You instrument tiles the same way you would any other service: structured logs, metrics endpoints, distributed tracing if you need it. Because each tile is a git repo, you have a full audit trail of code changes. You can see exactly what an agent wrote and when.

Failure modes:

  • Agent writes broken code: Tile fails to start. Roll back the git commit.
  • Agent requests excessive grants: You see the grant request in the UI and deny it.
  • Agent tries to exfiltrate data: Network namespace blocks it unless you granted network access.
  • Agent fills disk with logs: Standard disk quotas apply. XBin does not enforce per-tile quotas yet.
  • Agent rewrites the XBin daemon itself: Not possible. The daemon runs outside the workspace and tiles cannot write to its directory.

The biggest operational risk is grant sprawl. If you approve every grant request without reviewing, you lose the isolation benefit. The UI shows pending grants, but there is no policy engine to enforce “no tile should talk to more than three other tiles” or similar rules.

Comparison to Other Deployment Models

ModelCode MutabilityState IsolationNetwork DefaultAgent-Friendly
Kubernetes podsImmutable imageShared volumesOpenNo
AWS LambdaImmutable zipEphemeralOpenNo
WASM runtimeImmutable moduleCapability-basedDenyPartial
Docker ComposeMutable via volumesShared networkOpenNo
XBin tilesMutable via gitSeparate sandboxDenyYes

Kubernetes and Lambda assume you build an image or zip file and deploy it. Agents cannot rewrite the code at runtime. WASM runtimes are closer (capability-based security, deny-by-default network), but they are not designed for self-modifying code and LLM tooling is still catching up. XBin optimizes for the case where the agent is the primary author and code changes frequently.

When to Use XBin

Good fit:

  • You run coding agents (Claude Code, Cursor, Copilot Workspace) and want to deploy their output without manual review.
  • You manage a home lab or internal tooling and want isolation without Kubernetes complexity.
  • You need to version-control agent-generated code and roll back bad changes quickly.
  • You want default-deny networking and filesystem access for untrusted code.

Poor fit:

  • You need multi-tenancy with strict resource quotas (XBin does not enforce CPU/memory limits per tile yet).
  • You want a managed service (XBin is self-hosted only).
  • You need Windows support (Linux and macOS only).
  • You have a large team and need RBAC beyond “you control the box, you control the grants.”

Technical Verdict

XBin is a deployment primitive for agent-authored code. It solves the problem of “how do I run 100x more code when I did not write it and cannot audit every line” by isolating tiles with namespaces and enforcing default-deny grants. The Harvard-architecture split between code and state is clever: agents can rewrite code without touching secrets or live data.

The project is early. There is no policy engine for grants, no resource quotas, no multi-user RBAC. But the core isolation model is sound. If you are running coding agents and need a way to deploy their output safely on your own hardware, XBin is worth testing. If you need enterprise features or managed hosting, wait for the ecosystem to mature.

The fact that it launched with 2 points and 0 comments on HN suggests the market is still figuring out what agent deployment infrastructure should look like. XBin is a concrete answer to that question.

Tags

agentic-ai orchestration infrastructure

Primary Source

xbin.dev