otag

module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2026 License: MIT

README

otag

A command tent for your AI coding agents.

CI Release Go version

What is otag?

otag coordinates AI coding agents (Claude Code, Codex CLI and OpenCode) on your own Mac, across one or more existing projects. A coordinator agent splits the work into tasks; child agents work on them in isolated git worktrees inside a private tmux server; you watch and steer everything from one terminal UI.

  • Tasks and runs. A task is a unit of work with a status machine (draft, ready, running, waiting, review, done, delivered). Every attempt is a run. When a run hits a quota limit or fails to launch, the daemon starts a new run with the profile's fallback; crashed or stalled runs fall back too if you add them to fallback_on.
  • Isolation. One git worktree and branch per task (feature/<task> by default; set branch_prefix), started from the project's base (for example origin/dev, fetched first) or its current HEAD. otag never writes into your project's working tree.
  • Review flow. A finished task can spawn a linked review task, ideally on a different model; the reviewer inspects the reviewed commit in a detached checkout and accepts or rejects. --review <profile|none> overrides the project's reviewer per task.
  • Messaging with proven delivery. Agents and humans exchange questions, replies and commands (otag send, otag ask, otag inbox, otag reply). A child can park itself while waiting for an answer and is resumed when the reply arrives.
  • Guard. Hooks block dangerous actions: git push, git operations on other refs or on the main checkout, writes outside the worktree, and deny-listed files such as .env*. Two levels: light (default) and strict (behind the harness's native sandbox where available). The guard protects against accidents, not against a malicious agent.
  • Quota tracking. Per-account quota windows, cooldowns and profile fallback (otag quota).
  • Delivery. otag never merges. A done task is "ready to deliver"; each project delivers its own way (the coordinator, a delivery agent, or you), then otag task deliver marks it delivered and removes the worktree.
  • Merge/pull request flow. Mechanisms, not a workflow: otag task push pushes a task branch when the project's push setting allows it, the coordinator opens the MR/PR with glab or gh, and otag task reopen sends a done task back to work (review feedback, red CI) on the same branch with the reason.
  • Terminal UI. otag tui is mouse-driven with a live pane preview, a typing mode that forwards keys to the agent, and full-screen attach.

State comes from harness hooks and a SQLite database, not from screen scraping.

Why "otag"?

Otag (Turkish otağ) was the command tent of a Turkic or Ottoman ruler on campaign: the headquarters from which the campaign was coordinated.

Requirements

  • macOS (Apple Silicon or Intel)
  • tmux and git
  • at least one agent CLI: claude, codex or opencode

Install

Homebrew (builds from source; Homebrew fetches Go and tmux for you):

brew install nesiler/tap/otag

Install script (honors OTAG_VERSION and OTAG_INSTALL_DIR):

curl -fsSL https://raw.githubusercontent.com/nesiler/otag/main/install.sh | sh

From source (pure Go, no cgo):

go install github.com/nesiler/otag/cmd/otag@latest

otag --version prints the version (otag version --json too).

Verifying a release

Every release archive comes with a SHA-256 checksum (checksums.txt, checked by the install script), an SBOM, and a signed build provenance attestation that proves it was built from this repository by its release workflow:

gh attestation verify otag_<version>_darwin_arm64.tar.gz --repo nesiler/otag

Quick start

  1. Run otag inside a project. In a git repository you want agents to work on:

    cd ~/dev/myapp
    otag
    

    On first run this starts a short setup wizard (the same as otag init): it finds Claude Code, Codex and OpenCode on your PATH, proposes profiles for them (models, effort, fallbacks), registers the repository as a project, offers to install the background daemon, shows exactly which files it will write, writes them and loads them. Nothing is written until you confirm; Esc cancels. No terminal (CI, a script)? Use otag init --yes. Details: docs/SETUP.md.

  2. Open the TUI and start the coordinator. The wizard ends by offering the TUI; later, plain otag opens it. Select the project and press c to start its coordinator, or from the shell:

    otag coord myapp --attach   # the project's coordinator agent; tell it what to build
    otag tui                    # the full-screen view (also: plain `otag`)
    
  3. More projects: otag project add inside another repository (otag project list, otag project remove). Check the setup: otag doctor; every problem comes with the command that fixes it.

The coordinator creates tasks with otag task add and starts children with otag run start <task>; you can do the same by hand. Useful commands: otag status, otag needs (what waits for you), otag inbox, otag quota, otag stats, otag notify list. otag prime prints orientation (identity, task, allowed commands, unread messages) for the calling agent. Add --json to any command for a versioned machine-readable envelope.

Manual configuration

The wizard writes plain, commented TOML: ~/.config/otag/registry.toml (accounts and profiles) and ~/.config/otag/projects/<name>.toml (one per project). Edit them, then run otag sync. For setups beyond the wizard (several logins of one agent, custom model ids, strict guard, environment for API keys) see the annotated examples/registry.toml and examples/projects/, and docs/SETUP.md.

Concepts

Concept Meaning
Project A registered repo. Its own CLAUDE.md / AGENTS.md rules still apply; otag writes no files into it.
Task A unit of work with a status and dependencies (blocks, parent, review_of, related).
Run One attempt at a task by one profile (harness + account + model + effort). Retry or fallback means a new run.
Coordinator The project's long-lived agent session that plans and creates tasks.
Child An agent run working on one task in its own worktree; finishes with otag done or otag fail.
Review A separate task linked with review_of; recorded with otag review --accept / --reject.
Guard Hook-based blocking of dangerous actions, light or strict.
Delivery Getting a done task's result into the project, done by the project; otag task deliver records it.
Branch A task's branch, <branch_prefix><task> (default feature/), kept for the task's life once created.
Push / reopen otag task push (who may: the project's push setting) and otag task reopen (done back to ready, with a reason): the MR/PR flow primitives.

Documentation

  • Setup: the first-run wizard, otag init, projects, the generated files
  • Design: goals, data model, decisions
  • Daemon: watchdogs, fallback, park and resume, review, delivery, the MR/PR flow
  • Adapters: Claude Code, Codex and OpenCode integration, threat model
  • Messages: messaging and delivery proof
  • Quota: quota collectors and cooldowns
  • TUI: terminal UI design

Status

Early alpha (v0.1), macOS only. Interfaces and the database schema may still change.

Contributing

See CONTRIBUTING.md.

Security

See SECURITY.md.

License

MIT

Directories

Path Synopsis
cmd
otag command
Command otag coordinates AI coding agents across projects and harnesses.
Command otag coordinates AI coding agents across projects and harnesses.
internal
adapter
Package adapter defines the boundary between otag and a harness (Claude Code, Codex, OpenCode, ...).
Package adapter defines the boundary between otag and a harness (Claude Code, Codex, OpenCode, ...).
adapter/builtin
Package builtin lists the adapters compiled into otag.
Package builtin lists the adapters compiled into otag.
adapter/claude
Package claude is the Claude Code adapter.
Package claude is the Claude Code adapter.
adapter/codex
Package codex connects a per-run Codex app-server and remote TUI to otag.
Package codex connects a per-run Codex app-server and remote TUI to otag.
adapter/fake
Package fake is a scripted harness for tests and demos.
Package fake is a scripted harness for tests and demos.
adapter/opencode
Package opencode is the otag adapter for OpenCode v2 (tested with v2.0.20).
Package opencode is the otag adapter for OpenCode v2 (tested with v2.0.20).
apperr
Package apperr defines the stable, machine-readable errors exposed by the CLI.
Package apperr defines the stable, machine-readable errors exposed by the CLI.
cli
Package cli implements the otag command line.
Package cli implements the otag command line.
daemon
Package daemon is otag's background service (`otag daemon`, run by launchd): every tick it runs the quota collectors, reaps runs whose pane died, stops stalled runs, reminds about unanswered questions, starts fallback runs on another profile after a usage limit or a harness that would not launch, and shows new notifications.
Package daemon is otag's background service (`otag daemon`, run by launchd): every tick it runs the quota collectors, reaps runs whose pane died, stops stalled runs, reminds about unanswered questions, starts fallback runs on another profile after a usage limit or a harness that would not launch, and shows new notifications.
db
Package db opens otag's SQLite database and applies embedded migrations.
Package db opens otag's SQLite database and applies embedded migrations.
event
Package event appends rows to the events table.
Package event appends rows to the events table.
guard
Package guard decides whether an agent's write or shell command is allowed: writes must stay inside the workspace and off the project's deny globs, and commands must not push or write outside it.
Package guard decides whether an agent's write or shell command is allowed: writes must stay inside the workspace and off the project's deny globs, and commands must not push or write outside it.
identity
Package identity resolves which project and run a CLI invocation acts for.
Package identity resolves which project and run a CLI invocation acts for.
msg
Package msg is otag's durable message outbox (phase 4, docs/MESSAGES.md): messages, their per-recipient deliveries and the delivery state machine.
Package msg is otag's durable message outbox (phase 4, docs/MESSAGES.md): messages, their per-recipient deliveries and the delivery state machine.
notify
Package notify stores notifications for the human: rows in `notifications`, listed with `otag notify list` and acknowledged with `otag notify ack`.
Package notify stores notifications for the human: rows in `notifications`, listed with `otag notify list` and acknowledged with `otag notify ack`.
paths
Package paths resolves otag's default file locations.
Package paths resolves otag's default file locations.
proc
Package proc identifies local processes by pid plus birth (start) time, so a pid the kernel reused is never taken for the process otag started, and finds their descendants.
Package proc identifies local processes by pid plus birth (start) time, so a pid the kernel reused is never taken for the process otag started, and finds their descendants.
quota
Package quota records how much of each account's provider quota is used.
Package quota records how much of each account's provider quota is used.
registry
Package registry loads the desired-state TOML (accounts, profiles, projects), validates it and syncs it into the database.
Package registry loads the desired-state TOML (accounts, profiles, projects), validates it and syncs it into the database.
run
Package run implements the run lifecycle: start a harness in a tmux window on a workspace, follow it through normalized hook events, and end it with done, fail, stop or a crash.
Package run implements the run lifecycle: start a harness in a tmux window on a workspace, follow it through normalized hook events, and end it with done, fail, stop or a crash.
setup
Package setup is otag's first-run setup: it detects the agent CLIs and tools on the machine, proposes accounts, profiles and a project, renders them as commented TOML and writes the files atomically.
Package setup is otag's first-run setup: it detects the agent CLIs and tools on the machine, proposes accounts, profiles and a project, renders them as commented TOML and writes the files atomically.
task
Package task implements tasks, their status machine and dependencies.
Package task implements tasks, their status machine and dependencies.
tmux
Package tmux drives otag's private tmux server (`tmux -L otag`).
Package tmux drives otag's private tmux server (`tmux -L otag`).
tui
Package tui is `otag tui`: a full-screen view of projects, tasks and runs with a live preview of the selected agent's pane.
Package tui is `otag tui`: a full-screen view of projects, tasks and runs with a live preview of the selected agent's pane.
tui/attach
Package attach plans the TUI's full-screen attach to an agent's window (docs/TUI.md "Full-screen attach"): a nested tmux client of otag's server run with tea.ExecProcess, or, inside the user's own tmux, a full-screen display-popup that runs that client.
Package attach plans the TUI's full-screen attach to an agent's window (docs/TUI.md "Full-screen attach"): a nested tmux client of otag's server run with tea.ExecProcess, or, inside the user's own tmux, a full-screen display-popup that runs that client.
tui/data
Package data reads what the TUI shows: an immutable Snapshot taken in one read transaction, a Watcher that notices commits made by any other connection, and pane liveness.
Package data reads what the TUI shows: an immutable Snapshot taken in one read transaction, a Watcher that notices commits made by any other connection, and pane liveness.
tui/fixture
Package fixture is a hand-built data.Snapshot for the TUI's unit and golden tests: every row kind, at a fixed time.
Package fixture is a hand-built data.Snapshot for the TUI's unit and golden tests: every row kind, at a fixed time.
tui/form
Package form is the TUI's dialog kit: text fields, text areas, selects, checkboxes, pick lists, read-only notes and buttons.
Package form is the TUI's dialog kit: text fields, text areas, selects, checkboxes, pick lists, read-only notes and buttons.
tui/preview
Package preview holds the TUI's view of one agent pane: the last capture, sanitized to text and SGR colours, cropped to the preview's size, with a live (follow) mode and a scroll-locked history mode.
Package preview holds the TUI's view of one agent pane: the last capture, sanitized to text and SGR colours, cropped to the preview's size, with a live (follow) mode and a scroll-locked history mode.
tui/style
Package style holds the TUI's colours, status glyphs and small text helpers.
Package style holds the TUI's colours, status glyphs and small text helpers.
tui/tabs
Package tabs renders the right-hand tabs other than the preview: Needs and Inbox as items with inline actions, and the text of Details and Stats.
Package tabs renders the right-hand tabs other than the preview: Needs and Inbox as items with inline actions, and the text of Details and Stats.
tui/tree
Package tree flattens a data.Snapshot into the rows of the TUI's left pane: projects, their coordinator, the "Ready to deliver" group, tasks by attention, review tasks under the task they review, and runs under their task.
Package tree flattens a data.Snapshot into the rows of the TUI's left pane: projects, their coordinator, the "Ready to deliver" group, tasks by attention, review tasks under the task they review, and runs under their task.
tui/tuitest
Package tuitest builds isolated otag environments for the TUI's tests: a temporary database, config and data dir, a private tmux socket, and the fake harness.
Package tuitest builds isolated otag environments for the TUI's tests: a temporary database, config and data dir, a private tmux socket, and the fake harness.
tui/tuitest/pastecheck command
Command pastecheck is a test stand-in for an agent's input box with paste detection, the way Claude and Codex judge it: in raw mode, an Enter that arrives in the same read as text, or less than a threshold after the last text, is part of a paste and becomes a newline; only an Enter on its own submits.
Command pastecheck is a test stand-in for an agent's input box with paste detection, the way Claude and Codex judge it: in raw mode, an Enter that arrives in the same read as text, or less than a threshold after the last text, is part of a paste and becomes a newline; only an Enter on its own submits.
tui/typing
Package typing is the TUI's typing mode (docs/TUI.md "Typing mode"): key events encoded for `tmux send-keys`, and the sender that delivers them to an agent's pane one tmux command per key, in order, holding Enter back until the agent can no longer take it for part of a paste.
Package typing is the TUI's typing mode (docs/TUI.md "Typing mode"): key events encoded for `tmux send-keys`, and the sender that delivers them to an agent's pane one tmux command per key, in order, holding Enter back until the agent can no longer take it for part of a paste.
tui/wizard
Package wizard is otag's setup wizard (`otag init`, bare `otag` on a fresh machine, and the confirm step of `otag project add`): a short sequence of form pages built with the TUI's dialog kit (internal/tui/form) and theme.
Package wizard is otag's setup wizard (`otag init`, bare `otag` on a fresh machine, and the confirm step of `otag project add`): a short sequence of form pages built with the TUI's dialog kit (internal/tui/form) and theme.
workspace
Package workspace prepares the directory an agent works in: a git worktree on the task's branch (<branch_prefix><task>) outside the repository (mode "worktree"), a detached worktree at the commit a review run inspects, or the project itself ("same").
Package workspace prepares the directory an agent works in: a git worktree on the task's branch (<branch_prefix><task>) outside the repository (mode "worktree"), a detached worktree at the commit a review run inspects, or the project itself ("same").

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL