Skip to content

Peers & Sources: Multi-Machine Federation & Shared Harness State ​

Modern developer setups rarely live on a single machine — you might write code on a laptop, keep heavy GPUs and local models on a workstation, store team skills and memories in S3/R2 or a shared drive, and still have historical chats spread across Claude Code, Codex, or Antigravity.

Kompile connects all of these through two complementary primitives:

TIP

Looking for a step-by-step setup tutorial? Follow Walkthrough: Connecting Two Peers & Sharing Remote Memories, Transcripts, and Tools (CLI & Web) to pair a main workstation and a laptop behind a VPN, pull memories/skills/extensions, and offload writes remotely.

  • Unified Harness Sources (kompile sources, /sources, sources MCP, Web /#/sources) — one registry (~/.kompile/config/sources.json, zero secrets) that lets you search, read, write, pull, push, and install harness components and runtime artifacts across TLS peers, object/blob stores, GitHub Releases, local directories, and external CLIs.
  • Encrypted CLI-to-CLI Peers (kompile peer, peer MCP) — direct pinned-TLS connections (tls://host:port, default :7337) between Kompile machines for zero-copy federated search, scoped state & runtime artifact sync, shared GPU model serving, agent-to-agent messaging, and advisory remote judging — with no SSH or central cloud server required.

Architecture at a glance ​

mermaid
flowchart LR
    AGENT["Kompile CLI / Web Harness /\nMCP Tools (sources, peer,\nmemory, transcript_search)"] --> REG["Unified Source Registry\n(~/.kompile/config/sources.json)"]
    REG -->|"type=peer"| PEER["Pinned-TLS Peer (:7337)\nUDP LAN Discovery (:7338)"]
    REG -->|"type=blob-store"| BLOB["Blob Store\n(S3 / R2 / MinIO / FS / kompile-http)"]
    REG -->|"type=github-releases"| GH["GitHub Releases\n(owner/repo Artifact Catalog)"]
    REG -->|"type=local-dir"| DIR["Local / Mounted Directory\n(NFS, SMB, Shared Folder)"]
    REG -->|"type=external-harness"| EXT["External CLI Stores\n(Claude, Codex, agy, OpenCode, ...)"]

    PEER --> P1["Federated Search & Read\n(Zero File Transfer)"]
    PEER --> P2["State & Runtime Artifact Sync\n(--allow-artifacts)"]
    PEER --> P3["Remote GPU Model Serving\n(--allow-models)"]
    PEER --> P4["Agent Mailbox & Advisory Judge\n(--allow-judge)"]

Part 1: Unified Harness Sources (kompile sources) ​

Every surface shares the exact same grammar and backend: kompile sources in the terminal (alias kompile source; bare command opens an interactive wizard), /sources inside chat, the sources MCP tool, and the /#/sources tab in the Web Harness.

Five supported source backends ​

Typeref=<target>Read / WritePrimary Use
peerPaired peer name (e.g., gpu-box)Read / Write (per listener exposure)Federated search, live paged read, pull/push, and runtime artifact sync with another Kompile host
blob-storeConfigured blob store name (S3/R2/MinIO, mounted filesystem, or kompile-http TLS blob server)Read / WriteTeam-wide memories, skills, roles, archived transcripts (blobs/components/<component>/), and private artifact mirrors
github-releasesowner/repo (or GitHub URL)Read-onlyInstalling local-runtime, backend-libs, packaged .zip extensions, and distributions via ArtifactSourceCatalog
local-dirDirectory path (e.g., /mnt/shared-kompile)Read / WriteShared NAS/NFS folders, team git-synced skill directories, or local air-gapped mirrors
external-harnessAdapter ID (claude-code, codex, agy, opencode, …)Read-onlySearching, reading, and pulling transcripts directly from external coding CLIs

Nine portable component families (HarnessComponent) ​

Sources address nine portable families stored under ~/.kompile/:

memories · transcripts · skills · roles · prompts · provider-skills · agents · config · extensions

IMPORTANT

Hard security boundary: Sources never expose or write credentials (auth.json, credentials.json), machine-bound hardware/GPU configs (nd4j-environment-config.json, subprocess-backend-config.json, gpu-limits.json, hardware-profile.json, local-serving.json), peer identities (peer-identity.json), instance registries, or runtime transcript sidecars (.ledger.jsonl, .state.json, .queue.json, etc.). That keeps sources safe to mix freely across machines and team blob stores.

Everyday sources workflows ​

bash
# Inspect configured sources and auto-discover available peers, blob stores & harnesses
kompile sources
kompile sources discover
kompile sources auto-attach --yes

# Register sources explicitly (lower priority numbers are queried first; default 100)
kompile sources add team-s3 type=blob-store ref=r2-archive components=memories,skills,roles,transcripts priority=50
kompile sources add gpu-box type=peer ref=gpu-box mode=read-write
kompile sources add team-dir type=local-dir ref=/mnt/shared-kompile mode=read-only
kompile sources add upstream type=github-releases ref=GetKompile/kompile

# Verify connectivity and read/write capabilities
kompile sources test

# Federated search & paged read across local + all matching sources
kompile sources search "cuda graph replay" --component memories,transcripts
kompile sources items team-s3 skills
kompile sources read team-s3 memories feedback_rule.md --offset 1 --limit 120

# Write, pull (import into local ~/.kompile), and push (export to a writable source)
kompile sources write team-s3 skills deploy/SKILL.md --file ./SKILL.md --yes
kompile sources pull team-s3 --components memories,skills --yes
kompile sources push team-s3 --components memories,skills --yes

Inside chat and MCP, agents can also query configured sources transparently through existing tools by passing include_sources=true or source="<name>" to memory (recall/search/read/write) and transcript_search (search/fulltext/read).

Distributing runtimes, backend libraries & extensions via Sources ​

Sources double as an artifact distribution catalog (local-runtime, backend-libs, extension, distribution) with automatic SHA-256 verification:

bash
# Browse installable artifacts in a GitHub release, blob store, local dir, or peer
kompile sources catalog upstream --kind all

# Install a runtime companion or extension from any source (dry-run without --yes)
kompile sources install team-s3 local-runtime --backend cuda-12.9 --yes

# Publish a locally built artifact + SHA-256 sidecar to a writable team source
kompile sources publish team-s3 ./dist/my-ext.zip --kind extension --name my-ext --version 1.0.0 --yes

Part 2: Encrypted CLI-to-CLI Peers (kompile peer) ​

kompile peer (and the peer MCP tool) lets two Kompile machines collaborate directly over pinned TLS without running a web server or configuring SSH.

1. Initialize identity, discover on LAN & pair ​

On Machine B (the listener):

bash
# Creates owner-only ~/.kompile/peer/identity/{identity.p12, password, token}
kompile peer init --yes

# Listen on TLS :7337 (also broadcasts non-secret LAN discovery beacons on UDP :7338)
kompile peer listen --bind 0.0.0.0 --port 7337 \
  --only skills,memories,roles \
  --search-only transcripts \
  --allow-artifacts \
  --allow-models \
  --yes

NOTE

Zero cleartext secrets on LAN discovery: PeerDiscovery broadcasts only non-secret metadata (hostname, homeId, SHA-256 fingerprint, TLS port, exposed components) on UDP :7338. Connection tokens are never broadcast in cleartext.

Copy only B's token to an owner-only file (chmod 600) on Machine A over a trusted channel, verify B's printed SHA-256 fingerprint, and pair:

bash
# Optional: discover peers advertising on the local subnet
kompile peer discover

# Pair with pinned TLS certificate fingerprint (verified BEFORE sending the token)
chmod 600 /private/path/b-token
kompile peer add gpu-box \
  --address tls://B_ADDRESS:7337 \
  --fingerprint B_SHA256 \
  --token-file /private/path/b-token \
  --yes

kompile peer status gpu-box

2. Bootstrap a brand-new machine without SSH (serve-install) ​

Need to install Kompile on a second box that doesn't have SSH enabled? Serve the installer and archive directly from an existing machine with Kompile's built-in read-only HTTP server (pure JDK, default port :8765, strict allowlist /install.sh, /dist/<archive>, /dist/<archive>.sha256 — never exposes peer keys or tokens):

bash
kompile peer serve-install --yes

It prints the exact one-line curl -fsSL ... | bash install command plus the follow-up kompile peer add command with your host's SHA-256 fingerprint.

3. Six capabilities once paired ​

A. Federated search & paged read (zero file transfer) ​

Query a peer's memories, transcripts, skills, roles, prompts, agents, config, or judge records server-side without copying files onto your local disk:

bash
kompile peer search "oauth refresh" --only memories,transcripts,skills
kompile peer search gpu-box --query "cuda graph" --only transcripts --no-local
kompile peer read gpu-box --component memories --path gpu_diagnostics.md --offset 1 --limit 120

Agents can also pass include_peers=true or peer="<name>" directly to memory and transcript_search. Listeners can expose families read-only via --search-only <families> without permitting sync writes.

B. Scoped state sync (dry-run by default) ​

Defaults to skills,memories,roles. Opt-in families include prompts, provider-skills, agents, config, extensions, cli-settings, credentials, transcripts, judge-records, plus external Codex/Claude harness-settings and harness-credentials (see Harness Sync):

bash
# Preview changes first (dry-run by default)
kompile peer sync gpu-box --only skills,memories,roles,transcripts

# Apply explicitly (--direction push|pull|both, --conflict abort|local|remote)
kompile peer sync gpu-box --only skills,memories,roles,transcripts --apply --yes

Close active chat/harness writers before applying whole-file snapshots. Deletions require --allow-delete on both caller and listener. Files are bounded to 16 MiB (24 MiB frames).

C. Runtime artifact sync over TLS (--allow-artifacts) ​

Push slim harness binaries/JARs (launcher, cli-harness, chat-harness, harness, local-runtime) over the pinned TLS connection — no SSH needed:

bash
kompile sync gpu-box --artifacts harness --artifacts-only --dry-run
kompile sync gpu-box --artifacts harness --artifacts-only --yes

Streams in 1 MiB SHA-256-verified chunks to allowlisted targets (bin/kompile, lib/kompile-*.jar, .dist-info.json) and automatically purges stale lib/.boot-inf-extracted/ caches on JAR swaps.

D. Share a GPU workstation's local models (--allow-models) ​

Start the listener on your GPU box with --allow-models. PeerModelHandler (model_status, model_list, model_chat) routes authenticated mTLS inference requests from thin laptops to your workstation's running local model server, kompile-model-staging, or an on-demand LocalServingRuntimePool lease — without ever opening an unauthenticated LAN HTTP port.

E. Agent-to-agent messaging ​

When paired in both directions, agents in different machines/projects can coordinate asynchronously through durable project mailboxes:

bash
kompile peer agents gpu-box
kompile peer send gpu-box --target-session REMOTE_SESSION_ID --message "Benchmark finished; ready for review"
kompile peer inbox --project /local/project --session LOCAL_SESSION_ID
kompile peer ack --project /local/project --session LOCAL_SESSION_ID --message-id MESSAGE_ID

Messages are explicitly marked as untrusted peer data (never treated as user instructions or operator approvals) and delivered via cooperative polling.

F. Advisory remote judge calls (--allow-judge) ​

Ask a paired machine's configured judge to evaluate an output (--allow-judge required on the listener, bounded to 45 seconds):

bash
kompile peer judge gpu-box --prompt "Review proposed migration" --output-file result.txt --yes

Verdicts are strictly advisory: they execute no commands, modify no live controls, and import no approvals or overrides.


Managing Peers & Sources in the Web Harness (/#/sources) ​

In both slim kompile-chat-harness and full kompile-chat, the Sources & Peers tab (/#/sources, backed by /api/agents/chat/sources/**) puts the entire surface in the browser:

  • Discover, auto-attach, add, edit, test, and remove sources.
  • Discover LAN peers, initialize peer identity, pair/remove peers, and start/inspect the local peer listener.
  • Browse items and run federated search across all component families (memories, transcripts, skills, roles, prompts, config, extensions).
  • Preview and apply pull/push transfers, push runtime artifacts, and inspect local model status.

Security invariants at a glance ​

  • Pinned TLS before token: Addresses must be tls://host:port (no plaintext, query strings, or paths). The client verifies the pinned SHA-256 certificate fingerprint before sending its bearer token.
  • No ambient delegation: Delegated subagents (task/multi_task/quorum_task) can run read-only sources/peer search, list, catalog, and poll/ack their own inbox — they cannot change peer exposure, mutate profiles, apply unconfirmed syncs, or authorize remote judge calls.
  • Anchored, no-follow I/O: Sensitive operations reject symlinks and path traversal, enforce POSIX 0600/0700 on private identity/token files, and fail closed on unsupported filesystems.
  • No silent background sync: Listeners never initiate reverse connections, traverse NAT, or auto-sync without explicit invocation.

Released under the Apache-2.0 License.