ensemble

command module
v0.0.0-...-de45444 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2026 License: MIT Imports: 37 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Ensemble

⚠️ Hobby project — don't take it seriously. Someone having fun building things in their spare time. It is not secure, not complete, and not production-ready. No guarantees, no support, no warranty — don't trust it with anything that matters. Use at your own risk.

Fully decentralized peer-to-peer messaging, file transfer, and apps. No central server. No accounts. Just a keypair.

Discovery and signaling ride Tor, so your IP stays hidden from the network. Once two peers mutually agree to connect, they swap real IPs — encrypted to each other's keys — and switch to a direct QUIC connection for speed. Your IP is only ever revealed to people you explicitly accept. And the daemon doesn't stop at chat: it's a platform that hosts services, each with its own identity and connection policy.

DISCOVER → SIGNAL → GATE → VERIFY → IP SWAP → NAT TRAVERSAL → DIRECT QUIC
   over Tor (anonymous, slow)        only after consent      (direct, fast)

Highlights

  • Private by default — all discovery and signaling traffic routes through Tor hidden services. Real IPs are revealed only to accepted peers.
  • Bitcoin-style post-quantum identity — a Dilithium (ML-DSA-65) keypair anchors your E… address, with a bound Ed25519 key for fast per-message signing and transport. No registration, no server.
  • Direct connections — after mutual consent, peers connect over QUIC / TLS 1.3 with an automatic NAT-traversal cascade (UPnP → hole punch → relay → Tor fallback).
  • A platform, not an app — the daemon hosts named services, each with its own derived identity, default-deny ACL, and message stream. Install, supervise, and distribute them through signed registries.
  • One binary, many faces — daemon, terminal UI, attach mode, CLI diagnostics, an embedded web client, and a native desktop shell, all in one executable.
  • Pluggable signaling — Tor for real deployments, plus same-host loopback and LAN mdns backends for fast dev loops.

A platform, not an app

The daemon is the substrate; services are the inhabitants — each one registers, gets its own E… address derived from the node seed, declares its own connection policy, and gets its own stream. Chat and the web UI are just the two built-in services. The interesting ones are external:

Service What it is Platform primitive it shows off
PUG a .NET matchmaking library — queues, matchers, private lobbies, sessions introductions → direct peer-to-peer QUIC, no grants
Jeff a single-user AI companion (Ollama + pgvector memory) supervised installs, env-overlay secrets, stable identity across upgrades
gomp a decentralized, self-hostable take on a Discord server launched-app lifecycle, host-led rooms, services bringing their own frontend

Write them in Python or .NET against the SDKs; distribute and run them through the registry + supervisor. The whole story is in docs/services.md.

Quick start

# Go-only build (daemon + TUI, no embedded web UI) — needs just Go.
make build-dev

# Run the daemon + interactive terminal UI.
./bin/ensemble

That's enough to kick the tyres. The default tor signaling backend needs a tor binary in $PATH (Fedora: sudo dnf install tor); for a Tor-free local loop, add --signaling=loopback. Full build (with the web UI), cross-compiles, and the dev toolchain are in docs/setup.md.

How it works

1. DISCOVER  — Query the DHT over Tor to find the peer's .onion address
2. SIGNAL    — Dial that .onion, send a connection request (addresses only)
3. GATE      — Responder checks its contacts/ACL; unknown peers prompt the user
4. VERIFY    — 3-step handshake: mutual identity proof via signatures
5. IP SWAP   — Encrypt real IPs to each other's public keys, exchange over Tor
6. NAT       — UPnP (2s) → hole punch (10s) → relay (15s) → Tor fallback
7. CONNECT   — QUIC handshake with Noise authentication
8. DATA      — Chat and file transfer at full speed

The signaling channel is anonymous and slow; the data channel is direct and fast; the handover only happens after consent. The full architecture, layers, and protocol are in docs/architecture.md.

Clients:  TUI (in-process)  |  TUI (attach)  |  Web SPA  |  SDKs (Python / .NET)
------------------------------------------------------------------------------
gRPC API  (api/proto/ensemble.proto)  — the same surface for every client
------------------------------------------------------------------------------
Node (Daemon Core)  — orchestrates all subsystems
------------------------------------------------------------------------------
Service Registry  |  App Layer (chat, files, contacts)  |  Transport (QUIC)
Signaling (Tor hidden services)  |  Discovery (Kademlia DHT over Tor + mDNS)

Documentation

Doc What's in it
docs/setup.md Prerequisites, builds, cross-compile/ARM, dev toolchain
docs/running.md Every way to run it: TUI, headless, attach, signaling backends, web UI, Pi, metrics
docs/commands.md Full CLI reference — every subcommand, flag, env var, and TUI keybinding
docs/architecture.md How it's built: layers, subsystems, identity, protocol, project structure
docs/security.md The trust model: identity, the handshake, service ACLs, install gating
docs/services.md The service platform + the PUG / Jeff / gomp showcase
docs/creating-a-service.md Build, package, publish, and run your own service
docs/adr/ Architecture Decision Records — why things are the way they are
ui/README.md The embedded Solid.js web client
clients/python · clients/dotnet The service SDKs

Tech stack

  • Go — single binary, cross-platform.
  • libp2p — QUIC, yamux, TLS 1.3, Noise, AutoNAT, DCUtR.
  • Tor — via bine; embedded in-process through go-libtor (cgo) on linux/amd64, external tor binary everywhere else.
  • Dilithium + Ed25519 + Base58Check — post-quantum Bitcoin-style identity.
  • Protobuf + gRPC — API and wire protocol (server, both SDKs, browser via gRPC-Web).
  • Bubble Tea — terminal UI. Gio — native desktop shell.
  • Solid.js + Vite — web client, embedded via go:embed.

License

MIT — see LICENSE.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
api
pb
cmd
ensemble-registry command
ensemble-registry is the registry service binary (ADR-0009 §7): install it onto a node (it is itself an ensemble service package — the distribution system distributes its own distributor) or run it directly against a daemon socket for the dev loop.
ensemble-registry is the registry service binary (ADR-0009 §7): install it onto a node (it is itself an ensemble service package — the distribution system distributes its own distributor) or run it directly against a daemon socket for the dev loop.
internal
api
api/grpcweb
Package grpcweb wraps an existing *grpc.Server so it also speaks the gRPC-Web protocol over plain HTTP.
Package grpcweb wraps an existing *grpc.Server so it also speaks the gRPC-Web protocol over plain HTTP.
apps
Package apps implements daemon-managed installed services (ADR-0009): the on-disk install layout, the package manifest (ensemble-service.yaml), the install record (install.yaml), and the Supervisor that spawns and watches installed services as plain child processes.
Package apps implements daemon-managed installed services (ADR-0009): the on-disk install layout, the package manifest (ensemble-service.yaml), the install record (install.yaml), and the Supervisor that spawns and watches installed services as plain child processes.
cache
Package cache provides a thread-safe, bounded, string-keyed TTL cache — the PeerState design language (ticket def0ab76) extracted for reuse: a TTL refreshed on every Get keeps actively-used entries warm, and a size cap evicts the least-recently-seen entries first, so only entries abandoned by churned-through identities are reaped.
Package cache provides a thread-safe, bounded, string-keyed TTL cache — the PeerState design language (ticket def0ab76) extracted for reuse: a TTL refreshed on every Get keeps actively-used entries warm, and a size cap evicts the least-recently-seen entries first, so only entries abandoned by churned-through identities are reaped.
discovery
Package discovery wires the LAN (mDNS) and global (DHT) peer-discovery backends behind a unified Manager.
Package discovery wires the LAN (mDNS) and global (DHT) peer-discovery backends behind a unified Manager.
metrics
Package metrics is the node's observability model and collector: a thread-safe pull Registry that subsystems register descriptors with and record samples into via cheap Counter/Gauge/Histogram handles, read by the gRPC/Prometheus surfaces through Snapshot() (the GetDebugInfo / NetDiagnostics pull-aggregator shape — subsystems own their counters, the registry reads; never inverted into push-from-every-caller).
Package metrics is the node's observability model and collector: a thread-safe pull Registry that subsystems register descriptors with and record samples into via cheap Counter/Gauge/Histogram handles, read by the gRPC/Prometheus surfaces through Snapshot() (the GetDebugInfo / NetDiagnostics pull-aggregator shape — subsystems own their counters, the registry reads; never inverted into push-from-every-caller).
metrics/promexp
Package promexp adapts an internal/metrics Registry to Prometheus's text-exposition format — the "if you want real Grafana, you can" escape hatch.
Package promexp adapts an internal/metrics Registry to Prometheus's text-exposition format — the "if you want real Grafana, you can" escape hatch.
registry
Package registry implements ADR-0009 §7: service distribution through registries that are themselves ensemble services, trusted by nothing but their E-address.
Package registry implements ADR-0009 §7: service distribution through registries that are themselves ensemble services, trusted by nothing but their E-address.
registry/host
Package host is the registry service runtime (ADR-0009 §7): a daemon child (or dev-run process) that registers over RegisterService, serves the signed index through the registry command protocol, and accepts publisher-gated releases.
Package host is the registry service runtime (ADR-0009 §7): a daemon child (or dev-run process) that registers over RegisterService, serves the signed index through the registry command protocol, and accepts publisher-gated releases.
rpc
Package rpc implements the libp2p stream path for service-platform envelopes: SERVICE_RPC bytes for SERVICE_TRANSPORT_RPC services (T1) and SERVICE_INTRODUCTION peer-introduction control messages (T2).
Package rpc implements the libp2p stream path for service-platform envelopes: SERVICE_RPC bytes for SERVICE_TRANSPORT_RPC services (T1) and SERVICE_INTRODUCTION peer-introduction control messages (T2).
services
Package services owns the runtime registry of services hosted by the daemon.
Package services owns the runtime registry of services hosted by the daemon.
signaling/loopback
Package loopback provides a same-host signaling.Backend backed by Unix domain sockets under a well-known rendezvous directory.
Package loopback provides a same-host signaling.Backend backed by Unix domain sockets under a well-known rendezvous directory.
signaling/mdns
Package mdns provides a LAN-only signaling.Backend backed by mDNS / DNS-SD advertisements.
Package mdns provides a LAN-only signaling.Backend backed by mDNS / DNS-SD advertisements.
signaling/tor
Package tor provides the Tor-based signaling.Backend implementation.
Package tor provides the Tor-based signaling.Backend implementation.
tor
ui
ui-service
Package uiservice provides the built-in "ui" HTTP service that the daemon publishes alongside the chat-shaped "node" service.
Package uiservice provides the built-in "ui" HTTP service that the daemon publishes alongside the chat-shaped "node" service.
uilog
Package uilog plumbs the stdlib log package into both a file and a TUI subscriber so TUI sessions don't have log lines smeared across the altscreen buffer.
Package uilog plumbs the stdlib log package into both a file and a TUI subscriber so TUI sessions don't have log lines smeared across the altscreen buffer.
e2e command
Package main is a runnable end-to-end test that spins up two local ensemble daemons in separate temp data dirs, has them discover each other over their own Tor onion services, and verifies a chat message flows from one to the other.
Package main is a runnable end-to-end test that spins up two local ensemble daemons in separate temp data dirs, has them discover each other over their own Tor onion services, and verifies a chat message flows from one to the other.
tools
recover-onion command
recover-onion derives the .onion address(es) of a node from its persisted master identity bundle alone — the verification arm of the seed-only recovery contract introduced by ticket 9ef9dd21.
recover-onion derives the .onion address(es) of a node from its persisted master identity bundle alone — the verification arm of the seed-only recovery contract introduced by ticket 9ef9dd21.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL