$ glue
[ ax-first · remote-first · one static go binary · MIT ]

In your terminal. On AX. On any model.

glue is an open-source coding agent that runs locally in a fast terminal TUI and remotely inside isolated AX gVisor sandboxes. Dispatch uncommitted work in 3 seconds, tap answers from phone lock-screen buttons at 0 CPU, control workspaces from a Zero-Trust Cloudflare Access browser URL, and teleport tested code + context back into your checkout.

erain@dev: ~/src/payments (feat/jitter*)
$ go install github.com/erain/glue/cmd/glue@latest
$ glue                               # interactive local coding TUI
$ glue --remote "Add bounded jitter & race tests" \
    --snapshot --verify "go test -race ./limiter/..."
  [2.8s] started job-7c4e91a0 · gVisor sandbox · safe to close lid
         browser https://glue.acme.dev/#/jobs/job-7c4e91a0

$ glue job teleport latest           # pulls patch + session briefing into TUI
  ✓ applied to feat/jitter · hydrated .glue/sessions/teleport-7c4e91a0.json
ax gvisor sandboxes · cloudflare access webui · ntfy lock-screen push · teleport · gemini · codex · deepseek · openrouter · nvidia
[0x01] // what it is

One harness across local terminals, AX sandboxes, and every model.

Most coding agents lock you to one model vendor and die the moment you close your laptop lid. glue separates where work executes (locally in your checkout or remotely on AX) from which model thinks — running the exact same tool bundle, goal loop, and transcript hardening across Gemini, Codex (your ChatGPT subscription), DeepSeek, OpenRouter, and NVIDIA.

It ships as one static Go binary — no Node, Python, or Docker required on your laptop — and is built directly on the public glue Go agent framework (ADR-0012).

[0x02] // remote dispatch

Fire from a dirty branch in 3 seconds. Zero cluster setup.

glue --remote talks straight to AX over ephemeral PodCertificateRequest mTLS (ADR-0020) using the published ghcr.io/erain/glue-task image (Go, Node.js, Python, C/C++, ripgrep, jq). Run glue job init once to verify connectivity and pair your phone via QR code.

erain@dev: ~/src/yourrepo
$ glue job init                         # doctor checks + QR phone pairing (0600 config.yaml)
$ glue --remote "Add Sub(a, b int) next to Add, with table-driven tests" \
    --snapshot --attempts 2 --verify "go test ./..."
  submitted 2 jobs in 6.0s · group grp-feb93e9dc9ca
$ glue job compare grp-feb93e9dc9ca
  job-f8a57d276fb8  achieved  pass  2 files +38 -0  2m50s  42090 tok
  job-cf7e5e72a8c4  achieved  pass  2 files +28 -0  2m58s  68290 tok
$ glue job pick job-f8a57d276fb8        # opens Draft PR & cleans up sibling attempts

Dirty-tree safe (--snapshot)

Jobs start from your branch. Uncommitted edits? glue refuses to silently drop local WIP — pass --snapshot to package your working tree onto a temporary ref.

Direct ephemeral mTLS, RAM-only secrets

PodCertificateRequest + atenet-router mTLS straight to AX with zero mandatory gateway. API keys and GitHub tokens go to /v1/credentials in memory — 0 bytes on disk.

Parallel attempts & pick

--attempts 3 (and repeated --model) runs sandboxes in parallel; glue job compare lines up diffstats, tokens, and tests so pick keeps the winner.

Issues in, review rounds out

--issue 123 reads the GitHub issue + comments and opens a closing Draft PR. glue job continue --from-pr feeds review threads and failed CI logs back into the sandbox.

Steer mid-flight

glue job say queues guidance before the next model turn; --interrupt cancels the active model stream or shell command and redirects immediately.

Repo-wide .glue/remote.yaml

Check in setup, verify, deliver, egress_hosts, resources, and budgets once so every teammate's glue --remote obeys the repo gate.

[0x03] // anywhere ux

Close the laptop: lock-screen buttons, Zero-Trust browser & teleport.

Add an opt-in, bookmarkable browser workspace to your cluster in one command (ADR-0021) — or run glue job ui --open --tunnel for an instant local magic-link UI with a phone QR code. Idle sandboxes suspend to disk at 0 CPU, and read-only views never wake them.

https://glue.acme.dev/#/jobs/job-7c4e91a0
✓ CF Access: dev@acme.dev (0 idle AX workers)

Interactive Chat → edit_file limiter/retry.go ✓
[ Run Autonomously ] verify: go test -race ./...

ACHIEVED · EXIT 0 · +42 -3
▶ [ Open Draft PR #142 ]
phone lock screen · ntfy · laptop closed
SUSPENDED · 0.00 vCPU · ask_user
At MaxAttempts (5), cap delay or error?

[ Cap delay at 30s ]
[ Return ErrRetryExhausted ] ← HTTP POST

✓ Woke sandbox in 1.4s · token redacted
# one-time cluster browser workspace (Cloudflare Access JWT + Tunnel, 0 AX workers used)
$ glue remote setup --public-url https://glue.acme.dev \
    --cf-team acme.cloudflareaccess.com --cf-aud <aud> --allow-email you@acme.dev \
    --tunnel-token "$CLOUDFLARE_TUNNEL_TOKEN"

# back at your desk: pull git changes + provider-neutral session briefing into local TUI
$ glue job teleport job-7c4e91a0

Zero-CPU suspend + lock-screen buttons

Pair once via glue job init QR. On ask_user or permission prompts, AX suspends the sandbox to disk (0 vCPU) and pushes native HTTP POST buttons to ntfy on your phone.

Cloudflare Access browser workspace

glue remote setup deploys a 1-pod gateway + cloudflared consuming 0 idle AX workers. Verifies Cf-Access-Jwt-Assertion JWTs — zero OAuth app, zero second login.

Explore in chat → Run Autonomously

Start an interactive workspace in #/new (auto-suspending between turns), then escalate the exact same sandbox in 1 click into Planner → Maker → Checker + unified diff + Draft PR.

Teleport code + context home

glue job teleport (or pressing t in /jobs) safely applies the patch onto matching --snapshot branches and hydrates a provider-neutral session briefing in your local TUI.

Verified on every release against a live Kind + gVisor + headless Chrome stack by scripts/demo/aha.sh and scripts/demo/anywhere.sh.

[0x04] // interactive

A TUI that stays out of the way — with remote Mission Control built in.

glue · session 4f2a · gemini-3-flash · ⧗ 2 remote jobs · 1 waiting
▶ edit_file  internal/server/router.go
    - mux.Handle("/healthz", health)
    + mux.Handle("/healthz", logged(health))
    [a]llow once   [s]ession   [t]his file   [n]o

⠸ shell_exec  go test ./internal/server/

  All 14 tests pass. Type /remote to hand off the soak suite,
  or /jobs to inspect & teleport finished AX runs.

› /remote --snapshot Add 16-goroutine race tests across router/

Tool cards with inline permissions

Every side-effecting tool call renders as a card with a spinner — and the [a]llow / [s]ession / [t]his-file / [n]o prompt right inside it. Reads never nag.

/jobs Mission Control & /teleport

Live status bar (⧗ N remote jobs · M waiting) without waking suspended sandboxes. Open /jobs to toggle diffs (d), steer (s/i), open Draft PRs (o), or teleport home (t).

@-file & /-command pickers

Type @ to fuzzy-pick workspace files inline (secrets blocklisted); type / for command autocomplete; Ctrl+Y / /copy copies raw Markdown over SSH via OSC 52.

edit_file diff preview & Markdown

Inspect surgical replacements before approving. Streaming text settles into rendered Markdown with mouse-wheel, PgUp/PgDn, and sticky-bottom scroll.

Session tree (/fork, /clone, /tree)

/fork branches from any message, /clone duplicates, and /tree visualizes the ├─ / └─ lineage to switch branches cleanly.

Token-aware compaction

/compact summarizes older turns into a structured state snapshot with a cumulative read/modified file ledger that survives repeated compactions.

Run bare glue (or glue code --continue) in any checkout to launch the TUI. Designed in ADR-0014 and ADR-0015.

[0x05] // autonomous

The goal loop: plan, make, verify — repeat.

/goal in the TUI, glue goal locally, and glue --remote on AX all share the same autonomous engine: a planner decomposes the objective into a verifiable checklist, a fresh maker session executes each iteration, and an independent read-only checker audits the evidence — the writer never grades its own homework.

# isolated local git worktree goal (your checkout stays untouched on branch goal/<id>)
$ glue goal --coding --yolo --worktree \
    "Make golangci-lint pass on ./... without disabling checks"

# exit code reflects the outcome for CI / cron:
# 0 achieved · 2 blocked · 3 max-iterations · 4 budget · 1 error

$ glue goal --list && glue goal --resume

Goals checkpoint to the session store after every iteration so they survive restarts and AX suspend/resume cycles without re-planning. Designed in ADR-0016.

[0x06] // cli reference

Every command in one static binary.

glue --help
Command What it does
glue / glue code Interactive terminal coding TUI (--continue, --select, --model, --prompt).
glue job init Doctor preflight + one-time QR phone pairing (~/.config/glue/config.yaml, 0600).
glue --remote "<goal>" Dispatch to an AX gVisor sandbox (-i interactive, --snapshot, --verify, --attempts, --issue).
glue remote setup One-time opt-in cluster gateway with Cloudflare Access & Tunnel (0 idle AX workers).
glue job ui [--tunnel] Instant local browser UI with #token magic link (and optional cloudflared phone QR).
glue job attach | list | show Live resumable transcript (Ctrl-C detaches) or cached status without waking suspended tasks.
glue job say | answer Steer a running maker (--interrupt) or unblock a question/permission from any terminal.
glue job diff | pull | pr Inspect unified patch, pull branch/working-tree (--apply), or open an upstream Draft PR.
glue job teleport [<id>] Pull git changes + redacted [user, assistant] handoff briefing directly into local TUI.
glue goal "<goal>" Local autonomous Planner → Maker → Checker loop (--coding, --worktree, --resume).
glue run | models | serve Headless/piped prompts (--mode json), offline model catalog, and local HTTP+SSE daemon.

Full flags, TUI hotkeys, and .glue/remote.yaml schema live in docs/cli.md and docs/jobs.md.

[0x07] // models

Bring a key, a subscription, or neither.

Gemini (primary)

Google's genai SDK with Gemini 3 & 4 thinking levels, thought-signature round-tripping, and streamed reasoning. Coding defaults to gemini-3-flash-preview (low thinking, ~1s/turn).

Codex — your ChatGPT subscription

No per-token bill. Run codex login once; glue reuses ~/.codex/auth.json for personal coding sessions.

DeepSeek

Native DEEPSEEK_API_KEY adapter defaulting to deepseek-flash (off/low/high/max thinking) with streamed reasoning replay across tool calls.

OpenRouter — open-weight models

Kimi K2, Qwen, GLM, Llama and friends by ID — or openrouter/free, which auto-selects a free model for zero-key runs.

NVIDIA build + failover

OpenAI-compatible open-weight endpoints via NVIDIA_API_KEY. glue.WithFailover automatically skips providers without configured keys.

Offline catalog & live picker

glue models lists curated defaults and verified thinking levels without credentials; glue run --select opens an interactive arrow-key picker.

Switch per run with --provider / --model / --thinking, mid-session with /model, or set defaults in ~/.config/glue/config.yaml. And because glue job teleport writes a provider-neutral briefing, a job run on Gemini on AX continues seamlessly on Codex or DeepSeek locally.

[0x08] // reliability

A harness that absorbs model sloppiness.

Most wasted agent turns come from the harness, not the model: a failed edit match, a truncated log missing the error, an orphaned tool call that kills the next request. glue ports the consensus fixes from a source-level analysis of pi, Cline, Codex CLI, and Gemini CLI — tuned for Gemini first and open-weight models second.

Self-repairing edits

Models misquote whitespace, indentation, and smart quotes constantly. edit_file repairs the drift with a deterministic match ladder, reports what it fixed, and echoes the updated lines back.

Logs that keep the part that matters

Long build output keeps the first error and the final status (head + tail), with the complete stream spooled to a named temp file the model can read back.

Transcript repair

Interrupted turns leave dangling tool calls that providers reject with opaque 400s. Every run repairs the history first — cancel, crash, resume, and model switches just work.

Retries + overflow recovery

Rate limits and dropped streams retry with backoff (honoring server hints); a blown context window triggers compact-once-and-retry instead of a dead session.

Loop guardrails

Repeating the same tool call, or burning turn after turn on failing calls, draws a corrective nudge first — and a clean typed stop if the model ignores it.

Stall recovery

Gemini's classic “I will now edit the file.”-then-silence gets a bounded “Please continue.” — the narration becomes the action.

[0x09] // safety

Permission-gated locally, gVisor + Zero-Trust remotely.

Locally, reads and navigation are free while write_file, edit_file, and shell_exec prompt inline with allow-once / allow-session / allow-file grades (--yolo and --worktree cover autonomous branches, and @-mentions blocklist .env and key files).

Remotely, glue --remote isolates every job inside an AX gVisor sandbox with a default-deny TLS egress allowlist. Model and GitHub credentials are pushed in memory via POST /v1/credentials (never stored in Task.spec.env or exposed to agent shell commands), git pushes run through an out-of-band GIT_ASKPASS helper, and ntfy reply tokens are automatically redacted before events hit disk.

[0x0A] // headless

Scriptable from day one.

# one-shot coding fix
$ glue code --prompt "Run the tests and fix the first failure."

# pipe a diff in for review
$ git diff main | glue run --prompt "Review this diff for race conditions."

# stable JSONL event stream for CI & custom tooling
$ glue run --coding --mode json --prompt "..." | jq -r '.type'

The same binary runs a local HTTP+SSE daemon (glue serve --coding / glue connect) that powers glue job ui and custom automation channels.

[0x0B] // built on glue

One project, three faces.

The framework

The composable Go SDK underneath: provider-agnostic loop, typed tools, SQLite FTS5 store, MCP client, compaction, and goal engine. glue-framework-site.vercel.app

glue-review

A zero-cost pre-push branch reviewer (CLI + GitHub Action) that posts one sticky PR comment with a copy-pasteable fix block. glue-review.vercel.app

This coding agent

cmd/glue + webui + gateway in the same repository — daily driver locally and on AX. github.com/erain/glue

[0x0C] // faq

Anticipated questions.

? How is this different from Claude Code, Codex CLI, or Gemini CLI?

Two ways: first, glue is model-agnostic — the same TUI, tools, and Planner → Maker → Checker loop run on Gemini, your ChatGPT subscription, DeepSeek, or open-weight models. Second, remote mode is first-class on AX: uncommitted snapshots, 0-CPU suspend on questions, phone lock-screen buttons, a Zero-Trust Cloudflare Access web workspace, and one-command teleport back into your local TUI.

? How do browser and phone control work when my laptop is closed?

CLI dispatch (glue --remote) needs zero cluster services, and pairing ntfy via glue job init gives you two-way lock-screen HTTP action buttons out of the box. For a permanent browser URL, run glue remote setup once: it deploys a lightweight glue-gateway + cloudflared pod that uses 0 AX worker slots, verifies Cloudflare Access JWTs with no second login screen, serves cached job state while sandboxes sleep, and wakes AX tasks only when you send a message or start a run.

? Why use glue job teleport instead of git pull?

git pull brings files, leaving your local coding agent blind to what was tried, what you answered on your phone, and which checks ran. glue job teleport safely applies the patch onto matching --snapshot branches without clobbering unrelated local WIP and hydrates a redacted [user, assistant] briefing in .glue/sessions so your very next TUI prompt has full context.

? Can I run it for free?

Yes: the Codex provider uses your existing ChatGPT subscription with no per-token API charges, and openrouter/free auto-picks a free open-weight model. For fastest coding turns (~1s median), use gemini-3-flash-preview.

? What do I need to run remote AX jobs?

An AX cluster in your Kubernetes context (for local development on a workstation, scripts/ax-dev/up.sh stands up Kind + Agent Substrate + AX gVisor workers) plus gh auth login and a model API key. Jobs run the published ghcr.io/erain/glue-task image by digest — nothing to build.