Skip to content

Walkthrough: Connecting Two Peers & Sharing Remote Memories, Transcripts, and Tools (CLI & Web) ​

A common Kompile setup pairs two machines working on the same project:

  • main-box — your primary workstation or server with plenty of disk space, RAM, and optional GPUs, holding your full archive of memories, transcripts, skills, roles, local models, and extensions.
  • laptop — a lighter laptop or secondary box where you also work on the same repository and want to search, pull, share, or offload memories, transcripts, skills, roles, prompts, extensions, and local models over encrypted TLS — without SSH tunnels or a central cloud server.

This walkthrough covers pairing both peers on the CLI and in the Web Harness (/#/sources), followed by setting up remote memories, transcripts, tools/extensions, and write offloading.

mermaid
flowchart LR
    subgraph MainBox["main-box (More Disk / RAM / GPU)"]
        ML["Peer Listener\ntls://VPN_IP:7337"]
        MS["~/.kompile/\nmemories • transcripts • skills\nroles • extensions • local models"]
        ML --> MS
    end

    subgraph VPN["Private VPN / Secure Network (WireGuard / Tailscale / Private LAN)"]
        TLS["Pinned-TLS + 0600 Bearer Token\n(Certificate SHA-256 verified BEFORE token)"]
    end

    subgraph Laptop["laptop (Same Project, Lighter Disk)"]
        LP["Kompile CLI / Web Harness\nkompile sources • /#/sources"]
        LC["Pull / Search / Read / Offload\n(default_write_for + kompile-peer)"]
        LP --> LC
    end

    LC <--> TLS
    TLS <--> ML

Security Model & Network Prerequisites (Read First) ​

WARNING

Always run Kompile peer federation behind a secure private network or VPN (such as WireGuard, Tailscale, ZeroTier, a corporate VPN, or a trusted private LAN — or bind to 127.0.0.1 and forward over SSH). Never expose TCP :7337 or UDP :7338 directly to the public internet.

Kompile layers defense-in-depth inside the peer protocol itself, but network isolation is still your outer perimeter:

  • Pinned TLS verified before credentials: peer addresses must use tls://host:port (no plaintext HTTP, query strings, or paths). The client verifies the listener's pinned 64-character SHA-256 certificate fingerprint before sending its bearer token.
  • Owner-only identity & token files: kompile peer init writes ~/.kompile/peer/identity/{identity.p12, password, token} with strict POSIX 0700/0600 permissions, rejecting symlinks and path traversal.
  • Explicit least-privilege exposure: the listener explicitly chooses which component families to serve (--only, --search-only) and which optional capabilities to enable (--allow-artifacts, --allow-models, --allow-judge, --allow-delete). Deletions require --allow-delete on both listener and caller.
  • Hard secret boundary on unified sources: kompile sources / /#/sources never exposes credentials (auth.json, credentials.json), machine-bound GPU/ND4J configs (nd4j-environment-config.json, gpu-limits.json, local-serving.json), peer private keys, or live transcript sidecars (.ledger.jsonl, .state.json, .queue.json).
  • LAN discovery (UDP :7338) safety: LAN beacons advertise only non-secret metadata (hostname, homeId, SHA-256 fingerprint, TLS port, exposed families) — never connection tokens in cleartext. Across a VPN or shared network, prefer explicit manual pairing (--fingerprint + out-of-band chmod 600 token file) and disable LAN broadcast if you do not need subnet discovery.
  • No silent background sync & no ambient subagent mutation: listeners never open reverse connections or sync behind your back. Delegated subagents (task/multi_task/quorum_task) can only run read-only sources/peer search, list, read, and inbox polling — they cannot alter peer exposure, mutate profiles, or run unconfirmed syncs.

Part 1: Connecting Two Peers on the CLI ​

Step 1 — Initialize identity & start the listener on main-box ​

Run this on main-box (replace <MAIN_BOX_VPN_IP> with your VPN interface IP, or use 0.0.0.0 if firewalled to your VPN/private subnet, or 127.0.0.1 for an SSH tunnel):

bash
# 1. Create owner-only TLS identity + bearer token and print SHA-256 fingerprint
kompile peer init --yes

# 2. Start the pinned-TLS listener exposing portable harness components
kompile peer listen --bind <MAIN_BOX_VPN_IP> --port 7337 \
  --only memories,transcripts,skills,roles,prompts,agents,config,extensions \
  --allow-artifacts \
  --allow-models \
  --yes

TIP

Want laptop to search and read main-box's transcripts without allowing remote writes to transcripts? Keep memories,skills,roles,prompts,agents,config,extensions in --only and pass --search-only transcripts.

Note the printed SHA-256 fingerprint (<MAIN_BOX_SHA256>) and locate main-box's token at ~/.kompile/peer/identity/token.

Step 2 — Transfer the token securely & pair on laptop ​

Copy only main-box's bearer token to laptop over a trusted channel (for example, scp over your VPN/SSH) into a 0600 file, then pair with the pinned fingerprint:

bash
# On laptop: initialize laptop's own peer identity
kompile peer init --yes

# Copy only main-box's token into an owner-only file
mkdir -p ~/.kompile/peer && chmod 700 ~/.kompile/peer
scp user@<MAIN_BOX_VPN_IP>:~/.kompile/peer/identity/token ~/.kompile/peer/main-box.token
chmod 600 ~/.kompile/peer/main-box.token

# Pair using pinned TLS fingerprint (verified BEFORE the token is sent)
kompile peer add main-box \
  --address tls://<MAIN_BOX_VPN_IP>:7337 \
  --fingerprint <MAIN_BOX_SHA256> \
  --token-file ~/.kompile/peer/main-box.token \
  --yes

# Verify connectivity and exposed capabilities
kompile peer status main-box

Step 3 — Optional: Pair in reverse for two-way agent messaging ​

One-way pairing (laptop → main-box) is enough for laptop to search, pull, push, offload writes, and use main-box's GPU models. If you also want main-box to push to laptop or exchange agent mailbox messages bidirectionally, repeat Steps 1–2 with the roles reversed.


Part 2: Connecting Two Peers in the Web Harness (/#/sources) ​

Step 1 — Start the TLS listener on main-box ​

  1. On main-box, launch kompile chat --web and open /#/sources → Peers & Stores tab.
  2. Under Local TLS Peer Listener:
    • Choose Bind address: 0.0.0.0 (LAN / remote peers) (behind your VPN/private firewall) or 127.0.0.1 (local / tunnel only) if using SSH port forwarding.
    • Confirm TLS Port (7337).
    • Under Expose families, check memories, transcripts, skills, roles, prompts, agents, config, and extensions.
    • Enable the capabilities you want:
      • Allow remote search/read (recommended)
      • Allow runtime artifact sync (optional — syncs Kompile binaries/plugins/local-runtime)
      • Expose local models for peer chat (optional — shares main-box's GPU models)
      • Broadcast on LAN & allow auto-discovery (only on a trusted private LAN; leave off across routed VPNs)
      • Leave Allow sync deletes unchecked unless you explicitly need remote delete propagation.
  3. Click Start Peer Listener. Confirm the green Listening badge (bind:7337 · PID ...).
  4. Click Copy next to the displayed fingerprint (or click Copy on the Pair from another box command).

Step 2 — Connect to main-box from laptop ​

  1. On laptop, launch kompile chat --web and open /#/sources → Peers & Stores tab.
  2. Pair using either option:
    • Recommended over VPN (explicit pinned pairing): under Connect / Pair TLS Peer, fill in:
      • Peer Name: main-box
      • TLS Address: tls://<MAIN_BOX_VPN_IP>:7337
      • SHA-256 Fingerprint: paste main-box's 64-char hex fingerprint
      • Local Token File Path: path to the chmod 600 token file copied from main-box
    • On a trusted private LAN with broadcast enabled: find main-box in the discovered peers list and click Connect (or enter Peer Name + tls://... to pull from a broadcasting LAN peer).
  3. Check Also attach as unified harness source so main-box is immediately registered for remote memories, transcripts, skills, and tools.
  4. Click Connect Peer, then click Check Status to confirm the green reachable badge.

NOTE

Never pair two web/chat processes that share the same ~/.kompile home directory — Kompile detects same-home duplicates (invalid · same Kompile home) because they already share local disk directly.


Part 3: Extension — Setting Up Remote Memories, Transcripts, Skills & Tools ​

Once main-box and laptop are paired, attach main-box as a Unified Harness Source so both you and your agents can pull, search, read, and offload components seamlessly while working on the same project.

1. Attach main-box as a Unified Source ​

  • CLI (or inside chat with /sources):
    bash
    kompile sources add main-box type=peer ref=main-box mode=read-write \
      components=memories,transcripts,skills,roles,prompts,agents,config,extensions \
      priority=50
    
    # Or auto-attach all paired peers (preview first, then --yes):
    kompile sources auto-attach --yes
    
    # Verify readability and writability
    kompile sources test main-box
  • Web (/#/sources → Sources tab): if you checked Also attach as unified harness source during pairing, main-box is already listed under Configured Sources; otherwise click Auto-attach under Discovered Unattached Backends (or fill out Add Source) and click Test to verify the green healthy badge.

2. Pull Memories, Skills, Roles, Prompts & Extensions to laptop ​

When you sit down on laptop to work on the same project as main-box, pull the latest curated memories, skills, roles, prompts, and extensions (dry-run is the default — always preview first):

  • CLI:
    bash
    # Preview what would be pulled (dry-run)
    kompile sources pull main-box --components memories,skills,roles,prompts,extensions
    
    # Apply the pull
    kompile sources pull main-box --components memories,skills,roles,prompts,extensions --yes
    
    # Push new skills or memories you created on laptop back to main-box
    kompile sources push main-box --components memories,skills --yes
    (For two-way snapshot synchronization with explicit conflict policy, you can also use kompile peer sync main-box --only memories,skills,roles,transcripts --direction pull and add --apply --yes once active chat writers are closed.)
  • Web (/#/sources):
    • Open Browse & Pull/Push, pick source main-box and component (memories, transcripts, skills, roles, prompts, extensions), and click Preview Pull → Apply Pull (or Push Local <component> to send local additions back to main-box, or Pull to Local on a single file).
    • Or click Pull directly on main-box's card in the Sources tab.

3. Zero-Copy Federated Search & Read (Keep Heavy Archives on main-box) ​

You do not have to copy gigabytes of historical transcripts or every memory file onto laptop:

  • CLI / In-chat (/sources or kompile peer):
    bash
    # Search memories, transcripts, and skills directly on main-box (server-side)
    kompile sources search "oauth refresh" --component memories,transcripts,skills --source main-box --no-local
    
    # List and page specific files on demand
    kompile sources items main-box memories
    kompile sources read main-box memories gpu_diagnostics.md --offset 1 --limit 120
  • Automatic Agent Tool Access: inside chat on laptop, agents can query main-box directly using:
    • memory with include_peers=true or peer="main-box"
    • transcript_search with include_peers=true or peer="main-box"
    • sources (action="search", action="items", action="read")
  • Web (/#/sources → Federated Search tab): run one search across local + main-box, inspect matching snippets inline, and click Pull only on the specific memory or transcript you want locally.

4. Offload New Writes to main-box to Save Local Disk (default_write_for) ​

By default, every component writes to local disk. When laptop has limited disk space and main-box is your big storage host over your VPN, you can route default writes for transcripts, memories, or other writable components straight to main-box (transcripts upload automatically on session close and prune locally):

  • CLI:
    bash
    # Offload default transcript and memory writes to main-box
    kompile sources config main-box default_write_for=transcripts,memories
    
    # Inspect active write targets
    kompile sources list
    
    # Reset back to local disk whenever you need offline chat (e.g. traveling with a local model)
    kompile sources config main-box default_write_for=none
  • Web (/#/sources → Sources → Configured Sources):
    1. On main-box's card, look under Default write target (saves local disk).
    2. Click + transcripts and/or + memories — the chips toggle to ✓ transcripts / ✓ memories and a writes: transcripts, memories badge appears on the card.
    3. Whenever you need offline chat without reaching main-box, click Reset to local.

5. Share Tools, Extensions, Runtime Binaries & Remote GPU Models ​

Beyond memories and transcripts, the same pinned-TLS peer shares your tooling and compute:

  • Extensions & runtime binaries (--allow-artifacts on main-box):
    • CLI:
      bash
      # Browse installable extensions, local-runtime, and backend libs on main-box
      kompile sources catalog main-box --kind all
      kompile sources install main-box <artifactId> --yes
      
      # Or push/sync the slim Kompile harness directly over TLS
      kompile sync main-box --artifacts harness --artifacts-only --dry-run
      kompile sync main-box --artifacts harness --artifacts-only --yes
    • Web: in Peers & Stores, click Backends & Plugins on main-box to Preview Pull / Pull from Peer (or open Runtimes & Extensions on the source card in Sources).
  • Remote GPU models (--allow-models on main-box):
    • CLI: kompile chat --provider kompile-peer
    • Web: inspect available models under /#/sources → Local & Peer Models → Peer-Hosted Models, then pick provider kompile-peer in + New chat to run chats on main-box's GPU with zero local GPU on laptop.
  • Cross-machine agent coordination (same project on both boxes):
    bash
    kompile peer agents main-box
    kompile peer send main-box --target-session <REMOTE_SESSION_ID> --message "Pulled latest memories; running tests on laptop"
    kompile peer inbox --project /path/to/repo --session <LOCAL_SESSION_ID>
    (Peer messages are explicitly tagged as untrusted peer data — never treated as user approvals.)

Troubleshooting Checklist ​

SymptomCause & Fix
Connection refused / timeout on :7337Verify main-box's listener is running (Listening in /#/sources or kompile peer listen) and your VPN firewall allows TCP 7337 between laptop and main-box.
Fingerprint mismatch errorRe-check main-box's 64-char SHA-256 fingerprint — never bypass a mismatch without confirming main-box's identity was regenerated.
Offline chat fails after setting default_write_forReset writes back to local disk with kompile sources config main-box default_write_for=none or click Reset to local in /#/sources.
invalid · same Kompile home badgeBoth instances are reading the same ~/.kompile folder directly; remove the self-peer entry.
Conflict during kompile peer sync --applyClose active chat writers on the target component first, or pass --conflict local / --conflict remote explicitly after inspecting the dry-run diff.

Released under the Apache-2.0 License.