# Native AI Coding Agent CLIs & Herdr PTYs

> Canban runs native coding agent CLIs inside persistent Herdr PTY terminals (`herdr-core`) rendered with `libghostty-vt`, preserving every tool's native TUI, MCP servers, skills, permissions, and conversation resume.

## Zero-interference native TUI, MCP & skill preservation

Rather than reimplementing provider chat wrappers or injecting fragile `Stop` hooks, Canban launches your chosen CLI inside a `herdr-core` (`hc`) supervised PTY:

- **Native TUIs & Controls**: Interact directly with the agent's own terminal UI via `libghostty-vt` (rendered in native AppKit/CoreText on macOS and GTK4 on Linux, with SGR/pixel mouse reporting, OSC 8 hyperlinks, and 17 dark themes including Monokai).
- **MCPs, Skills & Permissions Intact**: Because the real CLI binary executes in the Card worktree with your home configuration, existing MCP servers, custom skills, sandbox flags, and auth logins work unchanged.
- **Restart-Safe PTYs & Exact Resume**: Closing Canban, restarting `canband`, or live-upgrading the app leaves running `herdr-core` sessions alive. Finished sessions can resume exact provider conversation IDs (`--resume`, `--session`, or `--conversation`) when supported.
- **Global Scheduler Budget**: Automatic workflow steps share a configurable concurrency limit (`scheduler.max_agents`, default `8`), while manual shells and `script` steps run outside the agent budget.

![Canban Card #2 running a native @developer CLI session inside a persistent Herdr PTY terminal alongside card activity, Hold auto-merge, and workflow progress.](https://canban.dev/screenshots/terminals.webp)

*Live @developer Herdr PTY running cargo test inside Card #2's isolated Git worktree (acme-api-f4c9/2), waiting for explicit canban report completion.*

## Managed terminals, presence leases & auto-reclaim

Canban separates automated terminals from your own shells so background PTYs clean up predictably without ever closing a terminal you are actively using:

- **Managed vs. Manual Terminals**: Workflow `AgentRun` sessions, cardless `scheduled:*` runs, `_merge_queue` `@merger` batches, and `configuration:*` sessions are **Managed terminals** with distinct visual badges and hover lifecycle summaries. Manual shells (`+` / `⌘T`) and standalone CLI launches (`Open Agent`) are **Manual terminals** and are **never** auto-reclaimed.
- **In-Memory Presence Leases (`viewer.presence`)**: While your active Canban window displays a managed terminal or its owning Card, `viewer.presence` pauses idle reclamation automatically with zero SQLite churn. Leaving a viewed terminal starts a 30-second post-view grace window for completed runs—or waits for the full `scheduler.idle_minutes` (default `15m`) if Herdr detected an interactive follow-up turn.
- **Calm `Reclaiming soon` Warning & Exact Resume**: Right before idle reclamation fires, tabs and the terminal header display a static `Reclaiming soon` indicator (clickable or focusable to keep alive). Once reclaimed, exact provider conversation history stays saved on the Card for one-click Resume.
- **Two-Level Sidebar Folding**: The **Terminals** sidebar supports collapsing both Project and Worktree groups while keeping `[N]` counts and the highest-priority status mark (`Error` > `Blocked` > `Working` > `Done`) visible.

## Built-in CLI agents & custom profiles

Canban's catalog (`crates/profiles/src/catalog.rs`) ships 24 official interactive CLI presets matching Herdr's terminal detector and resume planner, plus custom profiles in `config/agents.json` and dynamic `herdr:<template>` profiles:

| ID | Agent | Binary | Exact Resume | Model / Effort Args |
| --- | --- | --- | --- | --- |
| `codex` | Codex | `codex` | Yes (`resume`) | `-m`, reasoning effort |
| `claude` | Claude Code | `claude` | Yes (`--resume`) | `--model`, `--effort` |
| `agy` | Antigravity | `agy` | Yes (`--conversation`) | `--model`, `--effort` |
| `gemini` | Gemini CLI | `gemini` | Yes (`--resume`) | `-m` |
| `opencode` | OpenCode | `opencode` | Yes (`--session`) | `-m`, `--variant` |
| `cursor` | Cursor Agent | `cursor-agent` | Yes (`--resume`) | `--model` |
| `pi` | Pi | `pi` | Yes (`--session`) | `--model`, `--thinking` |
| `omp` | Omp | `omp` | Yes (`--resume=`) | `--model` |
| `copilot` | GitHub Copilot | `copilot` | Yes (`--resume=`) | `--model` |
| `droid` | Droid | `droid` | Yes (`--resume`) | `-m` |
| `amp` | Amp | `amp` | Fresh launch | — |
| `kimi` | Kimi | `kimi` | Yes (`--session`) | `--model` |
| `kiro` | Kiro | `kiro-cli` | Fresh launch | `--model` |
| `qwen` | Qwen Code | `qwen` | Yes (`--resume`) | `-m` |
| `devin` | Devin | `devin` | Yes (`--resume`) | — |
| `cline` | Cline | `cline` | Fresh launch | — |
| `grok` | Grok | `grok` | Yes (`--resume`) | `-m` |
| `hermes` | Hermes | `hermes` | Yes (`--resume`) | `-m` |
| `kilo` | Kilo | `kilo` | Yes (`--session`) | `-m` |
| `qodercli` | Qoder | `qodercli` | Yes (`--resume`) | `--model` |
| `letta` | Letta | `letta` | Yes (`--conversation`) | `-m` |
| `mastracode` | Mastra Code | `mastracode` | Yes (`--thread`) | `--model` |
| `maki` | Maki | `maki` | Fresh launch | — |
| `muse` | Muse | `muse` | Fresh launch | — |

### Antigravity (`agy`) dual-role Orchestrator & per-model effort detection

In **Settings → Agents & Identities** and **Project → Agents**, selecting `agy`'s `orchestrator` mode unlocks independent **Planner** and **Worker / Executor** model and reasoning-effort selectors (forwarded cleanly via `--settings`), alongside automatic per-model effort capability detection across Codex, Claude Code, and `agy` so unsupported flags are omitted automatically.

## Interactive takeover with canban card adopt

When you start exploring a `Backlog` Card in an interactive terminal or `@mention` session and decide to move ahead with implementation in that same conversation, the agent does not need to lose its context or spawn a duplicate session:

```sh
"$CANBAN_CLI" card update --file "$CANBAN_RUN_DIR/card.md"
"$CANBAN_CLI" card adopt --stage develop
```

- `card adopt` automatically passes inherited `HC_TERMINAL_ID` and `HC_SESSION` context to `AppServer`.
- `AppServer` verifies the Core, machine, live PTY, Profile, and Card workspace, transitions the Card to `develop` (`reason: "agent_adopted_stage"`) without launching a second Agent, and binds the existing live PTY directly to the `WorkflowRun` step.
- When the agent later runs `canban report --state completed`, the workflow proceeds seamlessly to `Review` and `Queue Merge`.

## Injected canban CLI reference

Canban injects `CANBAN_CLI`, `CANBAN_ENDPOINT`, `CANBAN_HOME`, `CANBAN_CARD`, `CARD_ID`, `CANBAN_PROJECT`, `CANBAN_PROFILE_ID`, and `CANBAN_RUN_DIR` into every launched session:

```sh
# Inspect or update the current Card
"$CANBAN_CLI" card show --fields number,title,body,stage,revision
"$CANBAN_CLI" card update [--title 'Updated title'] --file "$CANBAN_RUN_DIR/card.md"

# Report execution outcome (completed | backlog | blocked | failed | working)
"$CANBAN_CLI" report --state completed --message 'Summary' --file "$CANBAN_RUN_DIR/report.md"

# Reply to a follow-up question without ending the active task
"$CANBAN_CLI" reply --to <QUESTION_ID> --file "$CANBAN_RUN_DIR/reply.md"

# Stage local diff review comments without publishing directly to GitHub
"$CANBAN_CLI" review draft --file "$CANBAN_RUN_DIR/review_draft.json"

# Call any AppServer JSON-RPC method
"$CANBAN_CLI" call card.list '{"project_id":"<PROJECT_ID>","stage":"develop","limit":50}'
```

For the full command matrix, Agent-first `--fields` / `request_key` contract, and `--human` examples, see [Canban CLI, Agent Optimization & --human](/docs/cli/).

## Frequently asked questions

### Does Canban wrap or modify my Claude Code, Codex, Antigravity (agy), or Pi CLI?

No. Canban executes your real CLI binary inside a Herdr Core supervised PTY with libghostty-vt rendering, so native TUIs, MCP servers, skills, auth sessions, and tool permission prompts work identically to your terminal.

### Can I mix different coding agents on the same Kanban board?

Yes. You can assign different profiles per workflow stage or @mention (for example @planner on Claude Code, @developer on Codex, Antigravity agy, or Pi, and @reviewer on Gemini CLI or OpenCode) within the same Project.

### What happens to running agent sessions if I quit Canban.app or upgrade?

Herdr Core keeps every supervised PTY process running independently of the GUI window. Reopening Canban reattaches live terminals immediately, and finished sessions preserve exact provider resume IDs.

### Can I add a custom or internal coding CLI not in the built-in catalog?

Yes. In addition to the 24 built-in presets and dynamic herdr:<template> profiles, you can declare custom CLI commands, arguments, and environment settings in config/agents.json.
