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.
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 <--> MLSecurity 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 initwrites~/.kompile/peer/identity/{identity.p12, password, token}with strict POSIX0700/0600permissions, 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-deleteon both listener and caller. - Hard secret boundary on unified sources:
kompile sources//#/sourcesnever 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-256fingerprint, TLS port, exposed families) — never connection tokens in cleartext. Across a VPN or shared network, prefer explicit manual pairing (--fingerprint+ out-of-bandchmod 600token 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-onlysources/peersearch, 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):
# 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 \
--yesTIP
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:
# 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-boxStep 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
- On
main-box, launchkompile chat --weband open/#/sources→Peers & Storestab. - Under Local TLS Peer Listener:
- Choose Bind address:
0.0.0.0 (LAN / remote peers)(behind your VPN/private firewall) or127.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, andextensions. - 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.
- Choose Bind address:
- Click Start Peer Listener. Confirm the green Listening badge (
bind:7337 · PID ...). - 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
- On
laptop, launchkompile chat --weband open/#/sources→Peers & Storestab. - 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 600token file copied frommain-box
- Peer Name:
- On a trusted private LAN with broadcast enabled: find
main-boxin the discovered peers list and click Connect (or enter Peer Name +tls://...to pull from a broadcasting LAN peer).
- Recommended over VPN (explicit pinned pairing): under Connect / Pair TLS Peer, fill in:
- Check
Also attach as unified harness sourcesomain-boxis immediately registered for remote memories, transcripts, skills, and tools. - 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):bashkompile 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→Sourcestab): if you checked Also attach as unified harness source during pairing,main-boxis 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(For two-way snapshot synchronization with explicit conflict policy, you can also use
# 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 --yeskompile peer sync main-box --only memories,skills,roles,transcripts --direction pulland add--apply --yesonce active chat writers are closed.) - Web (
/#/sources):- Open
Browse & Pull/Push, pick sourcemain-boxand component (memories,transcripts,skills,roles,prompts,extensions), and click Preview Pull → Apply Pull (or Push Local<component>to send local additions back tomain-box, or Pull to Local on a single file). - Or click Pull directly on
main-box's card in theSourcestab.
- Open
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 (
/sourcesorkompile 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 querymain-boxdirectly using:memorywithinclude_peers=trueorpeer="main-box"transcript_searchwithinclude_peers=trueorpeer="main-box"sources(action="search",action="items",action="read")
- Web (
/#/sources→Federated Searchtab): run one search acrosslocal+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):- On
main-box's card, look underDefault write target (saves local disk). - Click
+ transcriptsand/or+ memories— the chips toggle to✓ transcripts/✓ memoriesand awrites: transcripts, memoriesbadge appears on the card. - Whenever you need offline chat without reaching
main-box, click Reset to local.
- On
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-artifactsonmain-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 onmain-boxto Preview Pull / Pull from Peer (or open Runtimes & Extensions on the source card inSources).
- CLI:
- Remote GPU models (
--allow-modelsonmain-box):- CLI:
kompile chat --provider kompile-peer - Web: inspect available models under
/#/sources→Local & Peer Models→Peer-Hosted Models, then pick providerkompile-peerin+ New chatto run chats onmain-box's GPU with zero local GPU onlaptop.
- CLI:
- Cross-machine agent coordination (same project on both boxes):bash(Peer messages are explicitly tagged as untrusted peer data — never treated as user approvals.)
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>
Troubleshooting Checklist
| Symptom | Cause & Fix |
|---|---|
Connection refused / timeout on :7337 | Verify 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 error | Re-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_for | Reset 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 badge | Both instances are reading the same ~/.kompile folder directly; remove the self-peer entry. |
Conflict during kompile peer sync --apply | Close active chat writers on the target component first, or pass --conflict local / --conflict remote explicitly after inspecting the dry-run diff. |
Related Documentation
- Peers & Sources Architecture — Full architecture, all five source backends (
peer,blob-store,github-releases,local-dir,external-harness), and security invariants. - CLI Peer Sync Reference — Exhaustive flag reference for
kompile peerandkompile sync. - Starting an Agent & Remote Sign-In Walkthroughs — Step-by-step CLI and Web walkthroughs for starting agents and signing in remotely.
- Persistent Memory — How local and peer memories are indexed and recalled into
<memory_context>. - Local Models &
local-runtime— Hosting local GPU models onmain-boxforkompile-peer.