Getting Started

CodeTwin is a terminal-first AI coding agent that runs on your machine. This guide covers installation, provider authentication, your first task, and mobile connection.

Installation

Verify Bun (Windows)

Check whether Bun is already installed:

powershell
bun --version

If Bun is not installed, run:

powershell
powershell -c "irm https://bun.sh/install.ps1 | iex"

Windows one-step verify + install:

powershell
if (Get-Command bun -ErrorAction SilentlyContinue) { bun --version } else { powershell -c "irm https://bun.sh/install.ps1 | iex" }

Windows one-liner (PowerShell)

powershell
irm https://code-twin.vercel.app/install.ps1 | iex

Linux/macOS one-liner

bash
curl -fsSL https://code-twin.vercel.app/install.sh | bash

Open a new terminal, then verify:

bash
codetwin --help

If you installed with one-liner, start the TUI from any project folder using:

bash
codetwin

Source install (Windows, Linux, macOS)

bash
git clone https://github.com/Sahnik0/CodeTwin.git
cd CodeTwin

Run the launcher from the repository:

bash
./CLI/codetwin --help

Windows equivalent:

powershell
.\CLI\codetwin.cmd --help

Provider authentication

CodeTwin supports both:

  • limited free usage path (opencode no-cost models), and
  • BYOK (bring your own API key) across providers.

Authenticate a provider and verify saved credentials:

bash
codetwin providers login
codetwin providers list

List available models for a provider:

bash
codetwin models openai

First task

Interactive TUI:

bash
codetwin

One-shot command mode:

bash
codetwin run "refactor auth module to use JWT"

Override autonomy for a single run:

bash
codetwin run "add tests for auth middleware" --dependence-level 3

Mobile connection (CodeTwin USP)

Mobile connection is one of CodeTwin's core differentiators: your laptop runs the agent while your phone can monitor, approve, and steer runs remotely.

If you are only using local CLI/TUI, you can skip this section.

Mobile app download:

  • Google Drive: https://drive.google.com/drive/folders/12f3pnUAb6GOitnHyF_JeRF02tre8YJ8N?usp=sharing
  1. Pair this CLI device with a bridge:
bash
codetwin login https://codetwin-1quv.onrender.com
  1. Copy the 12-character pairing code printed in terminal.
  2. Open the mobile app Pair screen.
  3. Enter the same bridge URL and code.
  4. Start worker:
bash
codetwin worker
  1. Confirm the app shows your CLI device as connected.

QR flow (if available in your app build):

  • Open the mobile app Pair screen and tap Scan QR.
  • Scan the pairing QR shown by your CLI environment.
  • If QR is not available, use the 12-character code method above.

For local source installs, use the repo launcher variants:

  • Windows: .\CLI\codetwin.cmd login ... and .\CLI\codetwin.cmd worker
  • Linux/macOS: ./CLI/codetwin login ... and ./CLI/codetwin worker

For complete details and troubleshooting, see Mobile Connection and Remote Control.

Config locations

CodeTwin reads config from standard project/global locations, including:

  • codetwin.json or codetwin.jsonc
  • .codetwin directory in your repository hierarchy
  • your OS global config directory

Use the same command everywhere; only the launcher path differs by installation method.