Twig

Laptop companion

Plug USB (or an emulator with adb reverse). Get power. Phone still home.

Phone always home. Laptop = power outlet.

Run the companion on a laptop (or the same machine as Metro). It lends CPU and real TypeScript script execution to the same agents. It never becomes source of truth.

bun run companion
  • Tool requests and results
  • Scripts under scripts/ the phone refuses to run
  • Optional heavier model / embedding work

What never moves

  • Ownership of the Twig root
  • Durable memory, skills, and transcripts as the canonical copy

If the cable (or reverse tunnel) dies mid-tool, the phone stays consistent. Journals and files live on the device.

Macros vs scripts

ThingPhoneCompanion
Macro (tool chain)YesYes
Script (scripts/*.ts)NoYes

How the cable is simulated

On a physical phone: USB debugging + adb reverse tcp:8787.

In the browser emulator: the same reverse over adb connect host:5555. The companion’s device watcher treats that TCP device like a USB phone.

bun run emu:wait && bun run emu:adb
bun run companion
# In the emulator: Twig → Laptop → enter the six-digit code

Pairing

The TUI shows a six-digit code. The phone proves possession with HMAC; the code never goes on the wire in the clear. After the first success the phone can remember the code in secure storage.