Twig

Contributing

How to work on Twig without fighting the monorepo.

Layout

apps/native     Android app (Expo)
apps/cli        Laptop companion (Bun + Ink)
apps/fumadocs   twig.bhalala.org
packages/core   Domain types
packages/memory Filesystem + index + recall
packages/harness Model + tools + dreams
packages/link   USB protocol

memory and harness take injected adapters. Do not import expo-* or node:fs into those packages. Phone bindings live in apps/native/lib/adapters/; laptop bindings in apps/cli/src/adapters/.

Commands

bun install
bun run test
bun run check-types
bun run dev:native
bun run companion
bun run dev:web

Rules of the house

  1. Phone owns state. The laptop never becomes source of truth.
  2. Journals append before files change. Versions keep prior bytes.
  3. Dreams are one model call per unit and must be restart-safe.
  4. Scripts run only on the laptop. Macros run on the phone.
  5. UI copy stays plain. No paths, JSON, or token counts in the default chrome.

Browser emulator

bun run emu:up && bun run emu:wait && bun run emu:adb
bun run emu:open
bun run companion

Linux + KVM for the container. On Apple Silicon, run compose remotely and set TWIG_EMU_HOST. See Browser Android emulator.

License

MIT. See License.