Local Runtime
Connect a local directory and local coding Harnesses on your machine to a Cohub Space, manage daemon lifecycle, native chat sync, approval modes, and direct local access.
This page explains how to connect a local folder and locally installed coding agents (Harnesses) on your computer or device to a Cohub Space instead of a cloud Sandbox, manage the Runtime lifecycle and native conversation sync, configure approval modes and direct local access, and avoid common setup errors.
Local Runtime vs cloud Sandbox
A Space can have at most one active Local Runtime connection at a time. Collaborators in the Space select a Harness, not a machine.
| Aspect | Local Runtime | Cloud Sandbox |
|---|---|---|
| Workspace files | Your local folder on disk (bridged by sandboxd) |
Persistent cloud /workspace volume |
| Execution user | Your local OS user (non-elevated terminal required on Windows) | Isolated cloud container user |
| Available Harnesses | Built-in cohub Harness plus locally installed Harnesses (pi, codex, claude, workbuddy, cursor, antigravity) |
Built-in cohub Harness |
.cohub/sandbox.json (image, compute spec) |
Ignored | Applied on create/resume/restart |
.cohub/setup.sh startup scripts |
Never runs automatically (including user and Mod scripts) | Runs on each new Sandbox process |
Hibernation (--auto-destroy, --idle-ttl) |
Controlled by your local Runtime process | Managed by cloud Sandbox lifecycle |
Start and bind a directory (cohub runtime up)
Requirements on a computer:
- Node.js 24 or newer and an authenticated CLI session (
cohub auth login). - On Windows: Git for Windows (or
COHUB_BASHpointing tobash.exe) and a non-elevated terminal. Because Space collaborators execute as your OS user, administrator terminals are refused.
Start a Local Runtime from the directory you want to connect (or pass [dir] explicitly):
cohub auth login
cd ./my-project
cohub runtime up
Directory bindings and Space reuse
When --space is omitted, cohub runtime up stores the directory binding in ~/.config/cohub/runtime-spaces.json, scoped by canonical directory path, signed-in account, and API environment:
- First start: prompts to create and name a new local Space, then saves the binding.
- Later starts: defaults to reusing the bound Space.
- Explicit new Space: pass
-n/--new(with optional--name <name>) to request another Space. Note that-nis the boolean shorthand for--new, not--name. - Explicit target Space: pass
-s <space>/--space <space>(ID, owned slug, orusername/slug) or setCOHUB_SPACE_IDto override and update the directory binding. - Subdirectory resolution: other CLI commands run inside a subdirectory resolve the nearest bound ancestor directory (like Git), with a nested binding taking precedence over its parent.
cohub runtime upitself always binds the exact directory it is given.
# Run in the background (detached from the terminal, still supervised)
cohub runtime up -d
# Explicitly create a new Space with a custom name
cohub runtime up -n --name project-next
# Bind this directory to an existing Space with a specific Harness
cohub runtime up --space <space-id> --harness codex
# Non-interactive startup accepting defaults and local execution consent
cohub runtime up -d --yes
Background daemon (-d) and exit codes
Foreground and detached (-d / --detach) runs share the same supervisor, which manages both Harness registration and the sandboxd file bridge. Readiness requires both connections to succeed.
- Exit code
0: the background Runtime reachedreadyand printed its Space link, directory, PID, and log directory. - Exit code
2: the Runtime did not reachreadywithin 30 seconds; the command prints the currentstartingorreconnectingstate while the background supervisor keeps retrying with backoff. - Exit code
1: startup failed (for example invalid flags, missing permissions, or a lease conflict).
Additional startup behavior:
- Zero-downtime background upgrades: a detached Runtime detects a newer CLI install (unless
COHUB_CLI_AUTO_UPDATE=0) or an upgrade request from a newercohub runtime upor the desktop app, waits until it is idle (no active Turn, native run, import, bridge command, unconfirmed result, or on-request screen share), starts the new supervisor, and hands over the same Runtime ID without taking the Space offline. Foreground Runtimes are never replaced automatically. - Screen sharing flags: pass
--display [screen]to share a computer display (macOS, Windows, or Linux X11; prompts unless--yes) or--display xvfb[:WIDTHxHEIGHT]for a headless Linux virtual display. Pass--no-displayto disable screen sharing and skip confirmation. - Bundled
cohubonPATH: the Runtime appends a launcher (~/.cache/cohub/cli/<hash>/cohub) to the end ofPATHso tools can always invokecohub, while anycohubinstalled earlier onPATHkeeps precedence.
Local Harnesses, approval modes, and Fast tier
Harnesses must already be installed and authenticated locally on your machine. Cohub supports the built-in cohub Harness plus six local Harnesses:
--harness value |
Product | Default executable | Read-only enforced | Override flag |
|---|---|---|---|---|
pi |
Pi | pi |
No | --pi <path> |
codex |
Codex | codex |
Yes | --codex <path> |
claude |
Claude Code | claude |
Yes | --claude <path> |
workbuddy |
WorkBuddy | codebuddy |
Yes | --workbuddy <path> |
cursor |
Cursor | cursor-agent |
No | --cursor <path> |
antigravity |
Antigravity | agy |
Yes | --antigravity <path> |
- Auto-discovery (default): omitting
--harnessscansPATH(or any explicit--<harness> <path>overrides) for every installed Harness. Any Harness that fails its startup check is skipped with a warning. If none remain, the Runtime still serves the folder with no local Harnesses declared: Turns execute on the built-incohubHarness while tools reach your folder through the file bridge. - Explicit selection: passing
--harness(repeatable or comma-separated, e.g.--harness pi --harness codex) requires every requested Harness to pass startup checks. A Turn never silently switches Harnesses.
Sending prompts, approval modes, and Fast tier
Run a prompt on a local Harness from the web composer or with cohub prompt:
cohub prompt "Run the test suite and fix failing assertions" --harness codex
cohub prompt "Review auth changes" --harness claude --approval-mode read_only
cohub prompt "Refactor parser" --harness codex --service-tier priority
Approval modes (--approval-mode <inherit|auto|full_access|read_only>): supported in the web composer Harness menu and CLI for Codex (app-server 0.162.1+), Claude Code (versions supporting --permission-prompt-tool stdio), and Antigravity. WorkBuddy does not offer approval modes.
| Mode | Composer label | Codex behavior | Claude Code behavior |
|---|---|---|---|
inherit |
Use local settings | Uses the machine's resolved Codex defaults (profiles and requirements included) | Omits --permission-mode, following local Claude Code settings |
auto |
Auto approval | workspace-write, on-request, escalations reviewed by Codex auto_review |
--permission-mode auto |
full_access |
Full access | danger-full-access, never |
--permission-mode bypassPermissions (refused by Claude Code as root) |
read_only |
Read only | read-only, on-request |
plan mode restricted to Read, Glob, and Grep with no MCP servers |
- When Codex or Claude Code requests permission during a Cohub Turn, the web composer displays an approval card (Allow, Allow for this chat, or Decline). Answering requires
session.prompt.fullaccess. Unanswered cards expire and decline after 30 minutes, and Cohub never auto-grants escalations. - Fast tier (
--service-tier priority): for Codex models whose catalog declares thepriorityservice tier, the composer shows a Fast toggle next to the thinking level. It applies only to that Turn and does not alter later Turns or local terminal defaults.
Harness commands and usage limits
- Commands: type
/in the composer to see the selected Harness's own commands next to Cohub's templates and skills. Claude Code lists its custom commands, skills and the built-ins/usage,/context,/init,/security-reviewand/simplify; other built-ins can still be typed. Pi lists its prompt templates and skills. Cursor lists the command files it loads from.cursor/commandsand.claude/commands. Codex lists its skills, which insert as$name. A command runs as an ordinary Turn: its output is the reply, and later Turns and other Harnesses see it like any other message. A Cohub template or skill with the same name takes precedence. - Refused commands: commands that would change the session behind Cohub, such as Claude Code's
/clear,/compact,/model,/resumeand/rewind, Pi extension commands, and Antigravity's/usageand/model, fail before they start, with a hint to run them in the Harness itself. Use the composer's own controls for new chats and models instead. - Usage limits: the Harness menu shows each subscription window, such as 5 hours or 7 days, with its percentage and reset time. Claude Code and Codex report them while a Turn runs, and Pi does for Claude subscriptions. The last report survives Runtime restarts, and
cohub runtime statusprints it too. Cursor, WorkBuddy and Antigravity report no windows.
Native chat sync and history import
Every local Harness watches its native transcript directory incrementally and syncs terminal conversations into the bound Space without deleting local files. Subagent threads sync as separate agent-created Chats linked to their parent Turn.
Live control depends on the Harness:
- Pi: run
cohub runtime attach(or accept consent onruntime up) to install~/.pi/agent/extensions/cohub.js. With the extension loaded (run/reloadin an existing Pi session), the web app can stream terminal Turns live, stop them, and send messages into the terminal session. Without the extension, Pi syncs read-only. - Codex (0.156+): on consent,
runtime upconnects to Codex's shared app-server (codex app-server daemon start), letting terminalcodexand the web app drive the same live thread. Cohub never stops the shared app-server ondetachordown(stop it manually withcodex app-server daemon stopif desired). On Windows, Codex terminal chats sync read-only because Node cannot connect to Codex's AF_UNIX socket. - Claude Code, WorkBuddy, Cursor, and Antigravity: terminal conversations sync read-only (no live remote stop for terminal-started Turns).
Pause sync or backfill earlier conversations at any time:
# Install the Pi extension for live two-way control
cohub runtime attach --harness pi
# Pause native sync while keeping Space data and local files
cohub runtime detach
cohub runtime detach --harness codex
# Preview and backfill earlier local conversations (newest first)
cohub runtime import --dry-run
cohub runtime import --harness claude --concurrency 4
cohub runtime import [dir] supports --harness <name>, --session <id>, --concurrency <1-8> (default 4), --dry-run, -y / --yes, and --json. Pressing Ctrl-C pauses safely; running the command again resumes from what the server has not yet ingested.
Manage Runtime lifecycle
# Check local supervisor, direct access, server status, archives, displays, and native sync
cohub runtime status
# Stream warning and error diagnostics
cohub runtime logs --level warn -f
# Refresh a running local Harness's model catalog
cohub runtime refresh-models codex
# Stop this local Runtime while keeping the Space, binding, and native files
cohub runtime down
# Check this CLI version, PATH cohub version, and versions served by running Runtimes
cohub version
cohub runtime status: works locally even when the server is unreachable and reportsDirectwhen loopback direct access is active, along with pending/failed local archive counts and native sync status.cohub runtime logs: reads structured diagnostics from~/.local/state/cohub/runtime/<space-id>/diagnostics. Supports-l <count>(default100),--level <debug|info|warn|error>(defaultinfo),-f/--follow, and--json.cohub runtime down: stops the supervisor over authenticated local IPC. If unconfirmed local executions are pending,downrefuses to stop unless you pass-y/--yes(stopping the process does not mark uncertain server-side Turns as finished).cohub runtime refresh-models <harness>: asks the connected Runtime to re-probe models for<harness>(pi,codex,claude,workbuddy,cursor, orantigravity).
Direct local access, Desktop app, and Android
Direct local access (COHUB_NO_DIRECT=1)
On the same machine whose Local Runtime serves a Space, file operations (cohub spaces files) and display operations (cohub spaces displays) talk directly to sandboxd over an ephemeral loopback (127.0.0.1) port authenticated with a per-process token instead of traversing the Cohub API and relay.
- Only the signed-in Space owner uses direct access. Scoped execution tokens (
COHUB_EXECUTION_TOKEN), App sessions, andCOHUB_NO_DIRECT=1always route through the API so server-side scope checks apply. - Process execution and WebRTC viewer sessions always stay on the Cohub pipeline.
- If a connection is refused before reaching
sandboxd, the client falls back to the API; mutations that already reachedsandboxdare never retried.
Desktop app (macOS, Windows, Linux)
The Cohub desktop apps bundle the CLI and connect folders as standard cohub runtime up -d instances sharing the same login session file:
- Folders connected in the desktop app appear in
cohub runtime status,logs, anddownfrom any terminal, and terminal-started Runtimes appear in the desktop app. - Connected folders reconnect automatically when the desktop app restarts unless stopped with
cohub runtime down. Quitting the desktop app leaves running Runtimes alive; signing out stops all of that account's Runtimes while keeping folder bindings for the next sign-in. - While a local Runtime is serving requests or running Harness Turns,
sandboxdinhibits idle system sleep (released five minutes after work finishes; the display may still sleep and closing a laptop lid still sleeps). Toggle this behavior in Settings → General.
Android device Runtime
The Android app serves phone folders using the same Runtime relay and sandboxd file bridge:
- Any readable folder can be bound (excluding Android's private
Android/dataandAndroid/obbdirectories), with all enabled bindings running concurrently under a foreground service. - Each Android binding registers with no local Harnesses (
harnesses: []), so Turns execute on the built-incohubHarness while tools read and edit the phone folder over the file bridge. - Shell commands run as the app using
sh, and the APK places its bundledcohubCLI and arm64 Node onPATH.
Boundaries and common errors
- One Local Runtime per Space: a Space cannot have two active Local Runtimes at once. Stop the existing Runtime with
cohub runtime downbefore binding another directory or machine to the same Space. .cohub/setup.shand.cohub/sandbox.jsondid not run: Local Runtime intentionally never runs.cohub/setup.shand ignores cloud compute spec and image settings. Run local project setup commands yourself.-ncreated a new Space instead of naming it:-nis shorthand for--new. Always use--name <name>to set the Space name.cohub runtime up -dexited with code2: the background supervisor did not reachreadywithin 30 seconds and is still retrying. Inspectcohub runtime statusandcohub runtime logs --level warn.cohub runtime downrefused to stop: unconfirmed local executions are pending. Wait for reconnection and reconciliation, or force-stop the local process withcohub runtime down --yes(uncertain server-side Turns still require explicit confirmation in the web app).- Read-only prompt rejected on
piorcursor:piandcursorcannot enforce read-only execution and reject read-only prompts. Usecohub,codex,claude,workbuddy, orantigravityfor read-only runs. statusorlogsfailed with no target Space:cohub runtime statusandcohub runtime logsrely on the current directory binding or-s <space>and never silently fall back to your Home Space.- Root directory moved or replaced: moving or replacing the bound folder puts file monitoring into a degraded state; restart the Local Runtime on the new path.
- Windows startup refused or Codex sync read-only: run
cohub runtime upfrom a non-elevated terminal with Git for Windows (orCOHUB_BASH). On Windows, terminal Codex chats sync read-only because Node cannot reach Codex's AF_UNIX socket.
Next steps
- Files & Sandbox — workspace file commands, cloud Sandbox specs, images, and
.cohub/setup.sh - Chats — send prompts, steer or cancel active Turns, and switch models
- Spaces — configure Space access, Home Space, and mounted Mods
- CLI — full command reference, authentication, and target-Space resolution