Remote parallel OMP tasks: TypeScript manager, mutable Debian containers, persistent workspaces and JSON CLI
README.md

OMP task manager #

A small remote-first control plane for multiple concurrent OMP sessions, not another coding-agent harness. One mutable, root-capable Debian container per task; one persistent directory per task. Laptop/client lifetime is irrelevant.

What is implemented #

  • Authenticated HTTP API: create/list/inspect/send/respond/abort/teardown
  • Real Docker Engine adapter: on-demand isolated task containers, independent clones and branches, per-task CPU/memory/PID limits, loopback worker ports
  • OMP JSONL RPC bridge from the pinned nano.sharkgirl.pet/omp-tui-rpc flake, model flags supplied by deployment config
  • Persistent repository, OMP home/config/auth, session JSONL, and assistant view
  • Default 90-minute genuinely idle cleanup; a busy or queued task refuses teardown
  • Sending to a sleeping task recreates its machine and resumes its saved session
  • Manager restart adopts labelled containers and saved notification counters
  • Yield-only notifications to nano, including an explicit request for input
  • On-demand assistant text + streaming text + active tool names, not raw tool arguments/results, token-by-token wakeups, or private thinking
  • Optional NixOS service and image builder, plus a mutable Debian Dockerfile with the flake-built OMP runtime closure (no Nix daemon inside tasks)

omp-tasks is a thin authenticated JSON CLI over the same HTTP API, usable from reef without changing nano's harness. TypeScript is strict across source and tests; compiled JS is a build artifact, not the source of truth. Nothing here automatically merges code, accepts the agent's claim of completion, pushes a branch, or deletes workspace data.

NixOS deployment (opt-in) #

Add this standalone repo as a flake input, then import inputs.omp-manager.nixosModules.default on a Docker-capable host. Not enabled on any host by this patch. Example host module:

{ inputs, ... }: {
  imports = [ inputs.omp-manager.nixosModules.default ];
  services.omp-manager = {
    enable = true;
    apiTokenFile = "/run/agenix/omp-manager-api";
    seedDir = "/var/lib/omp-agent-seed";
    # models.yml/config.yml/auth material for OMP, NOT a token in the Nix store
    ompArgs = [ "--provider" "your-provider" "--model" "your-sol-model" ];
    repoRoots = [ "/home/callie/code" ];
    gitName = "Callie Peden";
    gitEmail = "calliepeden@gmail.com";
    notifyUrl = "http://127.0.0.1:4220/agents/nano/events";
    # loopback by default; bind a private reachable interface to let reef call it
    host = "127.0.0.1";
    port = 4230;
  };
}

Use an existing encrypted-secret declaration or create a root-readable token outside the Nix store (openssl rand -hex 32). Rebuild that host normally. The module enables Docker, builds the image before starting the manager, and loads the token via systemd credentials. Existing Podman can coexist, but its dockerCompat alias is disabled so it does not claim Docker's binary/socket. Keep this port on a trusted private interface/firewall, not the public internet. No broad firewall opening is added automatically.

seedDir is mounted read-only, then copied once into each task's persistent home/.omp/agent; later agent/login changes survive teardown. Credential changes to the seed affect new tasks, not existing copies. Do not bake credentials into the image or store paths. Git cloning uses host credentials; task Git pushing needs separately provisioned credentials and is not implicit.

On reef, containers.coral separately bind-mounts homura's /var/lib/omp-manager/workspaces at /mnt/omp-tasks. This reef mount remains root-owned with mode 0700; nano needs sudo to read it. It is not live until its owner activates it. This host-side mount is separate from task workers' own writable workspaces; it does not make those task workspaces read-only.

The omp flake input points to git+https://tangled.org/nano.sharkgirl.pet/omp-tui-rpc?ref=main; flake.lock pins the revision, including its own build dependencies. nix flake update omp updates it deliberately. nix build .#omp builds that same OMP package. The service's ompPackage option can override it; the default task image tag is derived from the prepared image context so a changed OMP doesn't silently keep using an old image. Enabling the service prepares the closure, then Docker builds the Debian image. It does not install the published npm OMP release.

Any Docker host (prepare with Nix, run without Nix) #

cd omp-manager
nix build .#task-image-context --out-link result-task-image
docker build -t omp-task:flake "$(readlink -f result-task-image)"
npm ci && npm run build
node dist/src/main.js /path/to/omp-manager.json

The raw checkout is not a complete Docker build context: the Nix output adds nix/store/ and an omp launcher. Prepare it on a matching Linux architecture with Nix, or transfer that whole prepared directory to the Docker host. Its runtime closure lives at the original /nix/store paths inside the image; it needs no Nix daemon, registry or host store mount. Do not copy the executable alone: its interpreter/native libraries also need the closure.

Requires Node 22+, Git, and access to the local Docker socket. The daemon and manager must share the same host filesystem; bind source paths refer to that host. Container/host architecture must match the multiarch base images.

Example config (credentials are separate files):

{
  "dataDir": "/var/lib/omp-manager",
  "socketPath": "/run/docker.sock",
  "tokenFile": "/run/secrets/omp-api",
  "image": "omp-task:flake",
  "host": "127.0.0.1",
  "port": 4230,
  "idleMinutes": 90,
  "seedDir": "/var/lib/omp-agent-seed",
  "ompArgs": ["--provider", "your-provider", "--model", "your-sol-model"],
  "repoRoots": ["/home/callie/code"],
  "notifyUrl": "http://127.0.0.1:4220/agents/nano/events"
}

For a protected notification receiver, notifyToken can be provided in this runtime-only JSON. It is never copied into task containers.

CLI for nano (and humans) #

Build/install with npm ci && npm run build, or nix build for wrapped binaries. nix run . -- --help runs the client. Client config is separate from host config:

{"url":"http://PRIVATE-MANAGER-HOST:4230","tokenFile":"/home/nano/.config/omp-tasks/token"}

Save it as ~/.config/omp-tasks/config.json, and protect token/config files. No token on the command line or in shell history. Every successful command emits JSON; errors are JSON on stderr with a nonzero exit code.

omp-tasks list --json
omp-tasks start --name 'Fix deploy retries' --repo https://example.com/repo.git --goal-file task.txt
omp-tasks inspect TASK_UUID --json
omp-tasks send TASK_UUID --message 'check the failing integration test'
omp-tasks send TASK_UUID --message-file - --mode steer
omp-tasks respond TASK_UUID --request INPUT_REQUEST_ID --confirmed true
omp-tasks abort TASK_UUID
omp-tasks teardown TASK_UUID

start requires a caller-supplied --name, independent of the goal. Names are trimmed and must contain 1–64 Unicode code points, include at least one Unicode letter or number, and contain no Unicode control (Cc) or formatting (Cf) characters or U+2028/U+2029 line separators. Names are persisted in the task registry and returned by list and inspect; the goal remains available as the separate task instruction/detail. Legacy records without a name display as unnamed task <full task id>; the manager never infers a name from a goal. No task-creation tool integration is defined here; the authenticated HTTP API and omp-tasks start are the manager's creation contract.

Overrides: --url, --token-file, --config or OMP_TASKS_URL / OMP_TASKS_TOKEN_FILE. --goal-file - and --message-file - accept stdin. No raw tool output is exposed through the CLI. Teardown frees the machine only.

Terminal task picker and tmux attachment (Go / Bubble Tea) #

nix build .#omp-picker builds bin/omp-picker; nix run .#omp-picker -- --demo opens the sample-data preview. For local development:

cd picker
go test ./...
go build -o omp-picker .
./omp-picker --demo
# Real read-only task list, same client config/env as omp-tasks:
./omp-picker --url http://PRIVATE-MANAGER-HOST:4230 --token-file /path/to/token

The centered picker has running/present task machines on the left (including idle and starting machines) and dead/stopped tasks on the right. It shows the task name, goal, repository, state, and age; filtering searches task names while the selected task retains its goal and other details. The UI layout is frozen at Callie’s approved version; header/explanatory/update copy has been removed. tab / left / right switches columns; up / down selects; / filters; r refreshes; enter wakes the selected container if necessary and attaches to its omp tmux session. q exits without selecting. --select returns selection JSON instead; --demo always uses selection mode and never wakes tasks. Run the picker on the manager host, with access to its Docker socket:

# With the homura Nix module's protected-token wrapper installed:
ssh -t homura 'sudo omp-picker'
# Or directly with explicit manager credentials:
omp-picker --url http://10.233.1.1:4230 --token-file /run/agenix/ompManagerApi

The picker exits alternate-screen mode, POSTs /tasks/ID/attach, then executes docker --host unix:///run/docker.sock exec -it CONTAINER tmux -L omp-task attach-session -t omp. The server wakes/reuses the task machine without replaying the goal. Ctrl-B then D detaches the human terminal; the agent and manager continue. No container SSH daemon, exposed SSH port, second OMP process, or separate jump daemon is needed. Normal host SSH authenticates the user; Docker access remains root-equivalent.

Each production task worker starts normal OMP in tmux with --rpc-socket and controls that same live process over its private Unix socket. The worker HTTP API still exposes bounded assistant activity, not terminal scraping. A task with attached tmux clients refuses teardown, and an attach request reserves a 30-second grace period while the client joins. Keyboard input and manager RPC share the same OMP session. The explicit stdio mode remains for local protocol tests, not the container entrypoint.

--demo makes no API requests (the approved interface has no demo badge). Tokens are read from protected files, never CLI token arguments; HTTP redirects are not followed. The UI stays frozen; this changes Enter's action, not its layout. Existing already-running headless images are not hot-migrated: deploy the new task image and recreate an idle machine before attaching to it.

HTTP API #

All requests require Authorization: Bearer <api-token>. JSON request/response; body size capped at 256 KiB. Stable UUID task IDs, distinct from container IDs.

Method Path Meaning
GET /health Authenticated manager health
GET /tasks Concise cached task list, name, goal/state/latest assistant text
POST /tasks {name, repo, goal} creates a named task and sends its goal
GET /tasks/ID Fresh assistant-only activity, name and goal, session/model/queue/error state
POST /tasks/ID/send {message, mode?}; auto/steer; wakes sleeping task
POST /tasks/ID/respond {id, value? / confirmed? / cancelled?} answers pending UI request
POST /tasks/ID/attach Wake/reuse task machine; return validated tmux attach target, no prompt
POST /tasks/ID/abort Explicitly interrupt; does not delete anything
POST /tasks/ID/teardown Stop/remove an idle machine; workspace remains

The required name is caller-supplied, never derived from goal. It is trimmed and must contain 1–64 Unicode code points after trimming, including at least one Unicode letter or number. Unicode control (Cc) and formatting (Cf) characters and U+2028/U+2029 separators are rejected before trimming. Legacy records without names display as unnamed task <full task id>. No task-creation tool integration is defined here; the authenticated API and omp-tasks start are the manager's creation contract.

repo is an HTTPS or SSH Git URL, or an absolute local path under repoRoots. Local paths are resolved before allowlist checking; file/ext URLs and embedded HTTP credentials are rejected. Each task gets its own full clone and a task/<UUID> branch, never a shared working directory.

A send acknowledgment means accepted, not completed. All task messages use OMP's steering queue. Agent output is available through inspect; no shell-output scraping is required.

Inspect's view.error remains a nullable string: current poll unavailability first, otherwise the current failed/aborted model turn's safe reason. Additive view.pollError reports poll health separately (null when healthy). Poll recovery does not erase a model failure. view.lastError is the most recently observed model or RPC/process failure; successful turns do not erase it. Additive view.modelError / view.lastModelError contain {stopReason: "error" | "aborted", reason, at} for current / most recent model failure independently of polling and RPC failures. No assistant text is invented for a textless failure; partial assistant text remains visible alongside its failure.

A new agent_start or assistant message_start clears the current model failure, as does a settled assistant stop, length, or toolUse. Accepting or queueing a send, local slash commands, agent_end, polling, and scheduling a retry do not clear it. Failed/cancelled retry completion restores a safe reason even if no new assistant message was emitted. Only an actual new attempt clears the old failure; last-model history remains. These fields and lastError are saved atomically in view.json on turn/error events and survive worker restart, teardown/wake, and the manager's cached registry. Interrupted work without an observed model failure remains uncertain; restart is not proof of success.

Error details are bounded to a single 512-character line from an 8 KiB input prefix. URLs, labelled credentials/config, known credential patterns, opaque values and structured payload tails are redacted/omitted. Missing details use Model turn failed (no detail provided) or Model turn aborted (no detail provided). No raw provider payload, thinking, tool arguments/results, usage or model configuration is copied into error state. This is conservative redaction of untrusted prose, not a guarantee against every possible unlabelled secret. isIdle, stable-idle yield counting and teardown guards still describe activity, not success: an idle failed task can be torn down without hiding its failure.

Persistence and lifetime #

/var/lib/omp-manager/
  registry/<UUID>.json       # host-only metadata, token, last yielded counter
  workspaces/<UUID>/
    repo/                   # independent clone + task branch + all edits
    home/.omp/agent/         # task-local config/auth and persistent user state
    sessions/               # original OMP sessions, including full tool history
    view.json               # bounded assistant-only view; no tool results

Raw OMP sessions remain on disk for correct agent resumption, but are not the nano activity feed. The worker view retains the latest 100 assistant text messages (12k characters each), current text, and tool names. Summaries are not invented by a second model.

No model/turn/tool events wake nano. The manager polls the worker privately and posts only a new yield, after 1.5 seconds stable idle with no agent/tool, compaction/retry, queued instruction, or active OMP subagent. Pending input also counts as a yield and can be answered through respond. Notification counters survive restart; failed deliveries retry. This is at-least-once delivery if the receiver accepts a POST but its response is lost: the event includes task/yield numbers for deduplication. Yield wake content includes only the task name (or stable unnamed-task ID fallback), task ID, yield number, and an inspect instruction. Goals and private prompt content are never copied into notifications.

The 90-minute idle timer starts from actual idle/activity, not the task's age or lack of Discord messages. Inspect does not reset it. Teardown uses an atomic worker busy check before EOF/session flush, then Docker stop/remove. There is no workspace deletion route. Explicit abort is required before tearing down an active task. A yielded agent may still need review or steering; yield is not proof the task is done.

Container-local apt installs disappear when the machine is replaced. Files in /data, including task home/config/session, persist; promote common packages into the Dockerfile. Host/worker crashes do not automatically replay an uncertain instruction or rerun the old goal. Inspect the resumed session and steer; an interrupted pending turn is surfaced as an error/yield rather than silently claimed complete. Persistent detached services are not a supported way to keep a task machine alive; managed OMP tools/subagents determine busy state.

The manager's Docker access is root-equivalent. It is a trusted operator API, not a multi-tenant sandbox. Workers are root inside ordinary, non-privileged containers, have no Docker socket, and see only their own workspace and optional read-only seed. Don't run arbitrary hostile workloads with sensitive credentials.

Verification #

npm run check
npm test
# Real RPC with the same pinned flake package; local fake model, no billing:
nix build .#omp --out-link result-omp
OMP_BIN="$PWD/result-omp/bin/omp" node dist/test/real-rpc.js
# Live TUI in tmux + actual PTY/keyboard attachment, same mock provider:
OMP_TUI=1 OMP_BIN="$PWD/result-omp/bin/omp" node dist/test/real-rpc.js
# Both modes also exercise real pinned no-text error, partial/error, abort,
# authenticated inspect, restart persistence and recovery against localhost.
# On a Docker-capable host:
nix build .#task-image-context --out-link result-task-image
docker build -t omp-task:flake "$(readlink -f result-task-image)"
sudo env DOCKER_SOCKET=/run/docker.sock OMP_IMAGE=omp-task:flake node dist/test/container-smoke.js

Verified on reef: twelve automated manager tests, including three parallel HTTP tasks, restart/steer/idle teardown/resume, authenticated routes, filtered output, yield-only wakeups and busy guards. The same tests passed inside a Nix build; Nix evaluation checked Docker/Podman coexistence and runtime credential wiring. The real OMP test used a local mock OpenAI-compatible model, verified actual assistant output + a single yield + resumption of the same persisted session. The live-TUI variant additionally attaches an actual PTY tmux client, submits keyboard input while RPC controls the same OMP, checks busy teardown refusal, detaches, and verifies session resumption. No provider billing is involved.

Not yet verified: full OCI image build and actual task-container execution. Reef's outer nspawn cgroup restrictions reject Docker's nested device-BPF query (bpf_prog_query(BPF_CGROUP_DEVICE): operation not permitted). The Docker daemon and image pulls work, but the first build RUN is blocked. This is a host capability limitation, not a passing container test. Run dist/test/container-smoke.js on the intended host before relying on it. It uses a temporary local fake-provider sidecar (no billing), starts three real OMP task containers, checks yield-only wakeups, tears down idle machines, and verifies file/session resumption. It cleans up only its own temporary resources.