CODE-STICK — AI IN YOUR POCKET.
A portable offline AI coding agent that lives on a USB drive. Plug in, get a full terminal coding agent backed by a local LLM — on any machine, in any environment, with nothing left behind when you unplug.
The Problem
Cloud AI coding agents are blocked on airgapped machines — banks, hospitals, defense contractors, classified environments. Installing Ollama and downloading a 5 GB model on every machine you touch isn't practical either, especially on borrowed laptops, school computers, or client sites.
The gap between "I have a laptop" and "I have an AI coding agent" is too wide in restricted environments. code-stick closes it: install once on a USB, carry the agent everywhere.
How It Works
<USB>/ ├── code-stick.json ← manifest (models, versions) ├── start-windows.bat ← double-click launcher (Windows) ├── start-mac.command ← double-click launcher (macOS) ├── start-linux.sh ← launcher (Linux) ├── engine/ │ ├── windows-x64/ ← ollama.exe for Windows │ ├── darwin-arm64/ ← ollama for Apple Silicon │ ├── darwin-x64/ ← ollama for Intel Mac │ ├── linux-x64/ ← ollama for Linux x64 │ └── linux-arm64/ ← ollama for Raspberry Pi / ARM ├── opencode/<target>/ ← opencode binary per platform ├── data/ ← OLLAMA_MODELS (platform-agnostic blobs) └── config/opencode/ ← opencode.json (XDG redirect)
Layer 1: Installer CLI
A TypeScript/Node.js CLI (npx code-stick install) that auto-detects the USB drive, lets you pick a coding model, and downloads pre-built Ollama + opencode binaries for all 5 platforms onto the stick. Host machine needs nothing beyond Node 20 to run the installer.
Layer 2: Cross-Platform Binary Bundles
Binaries are pre-built and bundled per target: Windows x64, macOS Apple Silicon, macOS Intel, Linux x64, Linux ARM64. Platform detection at launcher time ensures the right binary runs without user intervention. Hash verification guards against corrupted downloads.
Layer 3: USB-Local Model Store
Ollama's model blobs are pulled directly into <USB>/data with OLLAMA_MODELS redirected to the stick. Fast-mode stages in host temp then copies to USB for slow sticks. The model never touches the host's permanent storage — auto-cleaned after install.
Layer 4: Zero-Residue Launcher
OS-native launchers (start-windows.bat, start-mac.command, start-linux.sh) spawn Ollama from the USB, redirect opencode's config dir to the stick, and run the agent in the foreground. On exit, only the Ollama PID they spawned is killed — by PID, never by process name. The host is left clean.
Technical Implementation
// Install flow — auto-detect USB, pull model, write launchers
export async function runInstall(opts: InstallOptions) {
const target = opts.target ?? await detectUsb(); // drivelist or manual
preflightMaxPath(target); // Windows 260-char guard
preflightFormat(target); // FAT32 4GB blob guard
const model = opts.model ?? await pickModel(); // interactive picker
const mode = opts.mode ?? await pickMode(target); // Fast vs Direct
await downloadBinaries(target, ALL_PLATFORMS); // Ollama + opencode ×5
await pullModel(target, model, mode); // blobs → USB/data
await writeLaunchers(target, model); // .bat / .command / .sh
await writeManifest(target, { model, version: PKG_VERSION });
}@echo off
:: Launcher — spawns Ollama from USB, runs opencode, kills on exit
set STICK=%~dp0
set OLLAMA_MODELS=%STICK%data
set OLLAMA_HOST=127.0.0.1:11434
set XDG_CONFIG_HOME=%STICK%config
start /B "" "%STICK%engine\windows-x64\ollama.exe" serve
:: Wait for Ollama to be ready, then launch opencode
"%STICK%opencode\windows-x64\opencode.exe"
:: PID-targeted kill — never taskkill /IM ollama.exe
taskkill /PID %OLLAMA_PID% /F >nul 2>&1Engineering Decisions
Fast vs Direct install modesPulling a 5 GB model blob onto a slow USB stick via Ollama takes 40+ minutes. Fast mode stages in host temp (2× model size, auto-cleaned), then copies blobs — typically 5× faster on USB 2.0 sticks.
PID-targeted shutdown, not process nametaskkill /IM ollama.exe would kill any Ollama instance on the machine. The launcher stores its Ollama PID and kills only that process — critical for developers running Ollama for other projects simultaneously.
exFAT + NTFS format enforcementFAT32 has a 4 GB file-size limit. Qwen2.5-Coder 7B blobs exceed this. The installer detects the format upfront and bails with a clear message before wasting any download time.
MAX_PATH preflight on Windowsopencode's node_modules go deep. A USB mounted at a long path overflows Windows' 260-char limit mid-install. The preflight catches this before a single byte is downloaded.
The Use Cases
"Cloud AI is simply not an option in many professional environments. A bank's dev machine is airgapped by policy. A hospital can't let code leave the network. A defense contractor's laptop has no internet. code-stick is for those environments — where you still need a capable AI coding agent but the cloud is off-limits."