# jackin hardline (https://jackin.tailrocks.com/commands/hardline/)



## Synopsis [#synopsis]

```bash
jackin hardline [--inspect | --new [--agent <agent>] | --shell] [--debug] [SELECTOR]
```

Reconnect your terminal to an agent container. Use this when you've closed your terminal but the agent is still running in the background, or when an agent crashed and you want to resume the same session without rebuilding the whole stack.

A `hardline` is the direct line back into an agent session that's already running — the operator's way to step back inside without loading a fresh instance.

When `SELECTOR` is omitted, `jackin hardline` resolves the current saved workspace or ad-hoc directory from the local instance index, prompts for an instance when more than one matches, then prompts for the action: reconnect/recover, start another foreground agent session, inspect, or cancel. If you pass a role selector, `jackin hardline` targets that class's primary container. If you pass an exact instance or container selector and the CLI detects multiple running agent processes in that container, it prompts for the safe action instead of blindly attaching. If you have multiple instances, use the instance ID or full container name to pick a specific one.

## Arguments [#arguments]

| Argument   | Required | Description                                                                                               |
| ---------- | -------- | --------------------------------------------------------------------------------------------------------- |
| `SELECTOR` | No       | Role selector (e.g., `agent-smith`), instance ID, or full container name (e.g., `jk-k7p9m2xq-agentsmith`) |

## Options [#options]

| Option            | Description                                                                                                                                                                                                                                                                                                                |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--inspect`       | Resolve the same target but print the instance manifest, live agent-session inventory, role/DinD Docker state, Docker network state, cert volume name, and mount-state summary without attaching or restarting anything.                                                                                                   |
| `--new`           | Start a fresh agent session as a new tab inside the selected running instance instead of attaching to the existing tab strip. On roles that support multiple agents, omitting `--agent` triggers an interactive prompt so you can choose the runtime; the workspace `default_agent` is used when set and skips the prompt. |
| `--agent <agent>` | Agent runtime for `--new` (`claude`, `codex`, `amp`, `kimi`, or `opencode`). When omitted on a multi-agent role with no `default_agent` set on the workspace, an interactive prompt asks.                                                                                                                                  |
| `--shell`         | Open a one-shot interactive zsh shell in the selected running instance without a named agent session. Mutually exclusive with `--inspect` and `--new`.                                                                                                                                                                     |
| `--debug`         | Print every external command the CLI issues (`docker`, `git`, etc.) and their captured output. Also enabled by `JACKIN_DEBUG=1`.                                                                                                                                                                                           |

## Behavior [#behavior]

`jackin hardline` inspects the target container and chooses one of three paths:

| Container state                        | Action                                                                                                                                                           |
| -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Running                                | Attach to the running in-container multiplexer; the existing focused tab continues. `--new` spawns a fresh agent tab; `--shell` opens an ephemeral zsh session.  |
| Stopped, exit code `0` (clean `/exit`) | Error. The previous session ended normally — use `jackin load` to start a new one.                                                                               |
| Stopped, non-zero exit or OOM-killed   | Error. Use `jackin load` to start a new session or recover saved state.                                                                                          |
| Not found with indexed state           | Rebuild the jackin-managed runtime for that instance when the saved workspace, original ad-hoc directory, or a confirmed moved ad-hoc directory can be resolved. |
| Not found without indexed state        | Error. Nothing to reconnect to — use `jackin load`.                                                                                                              |

`jackin hardline` only works on **running** containers. Any stopped container — whether it exited cleanly or crashed — requires `jackin load` to start a new session. This keeps the rule simple: if you can see the container in `jackin console` as running, use `jackin hardline`; otherwise, use `jackin load`.

If the role container itself was deleted, jackin❯ can rebuild the runtime around local state managed by jackin❯, such as the per-instance agent home and preserved worktrees/clones. Changes written only to the deleted container's writable layer are gone. jackin❯ intentionally does not restore packages installed ad hoc inside the container, global files edited outside mounted paths, DinD images, or other container-layer mutations.

For ad-hoc instances, `jackin hardline <instance-id>` normally expects the original project directory. If that directory moved, run the exact hardline command in an interactive terminal; the CLI lets you mount the current directory, browse for the moved project directory, or enter another path manually at the original in-container workdir before rebuilding the missing runtime.

`--inspect` is read-only. It works from the current workspace or ad-hoc directory, or with an explicit selector/instance ID/container name, and reports local manifest details even when Docker is unavailable. When the role container is running, it also reports live in-container session inventory.

`--new` requires a running indexed instance. It asks the in-container multiplexer to spawn a fresh agent tab in the running container with the same mounts, Docker-in-Docker sidecar, working directory, and in-container state. The tab is independently reconnectable — a second `jackin hardline --new` from the same instance attaches alongside the existing tabs and creates another one. If the selected container is stopped or missing, run plain `jackin hardline` first so the CLI can restart or rebuild it.

When `jackin hardline` resolves an instance from the current directory without an explicit selector or option, the same actions are available through an interactive picker. Candidate labels include the detected live agent-session count when Docker can inspect a running role container. Exact selectors also show the action picker when multiple running agent processes are detected. Non-interactive runs default to reconnect/recover.

## Terminal close vs. exit [#terminal-close-vs-exit]

Closing your terminal tab **does not** shut the container down. The foreground session connects via `docker exec`, so closing the terminal detaches from the in-container multiplexer while the container (and the multiplexer daemon inside it) keeps running. `jackin hardline` reconnects to the running daemon.

To stop one agent, exit it from inside (e.g., `/exit` in Claude Code). That ends the agent's tab cleanly. When the last tab ends, the multiplexer exits and the container shuts down cleanly.

To stop the whole container from inside the multiplexer, use the command palette's **Exit** action and confirm &#x2A;*Exit?**. That terminates every live pane, lets the Capsule daemon exit as PID 1, and returns to the host finalizer so jackin❯ removes the role container, DinD sidecar, certs volume, and network through the standard cleanup path.

## Terminal tab title [#terminal-tab-title]

`jackin hardline` sets the terminal tab title before connecting, matching the behavior of `jackin load`. Once attached, `jackin-capsule` owns the title so Ghostty-style tab and window lists show the active workspace plus the current GitHub context. On a pull request branch it uses the workspace directory name and pull request title, for example `jackin · PR #436 · feat(capsule): show branch and PR context`; on a non-default branch without an open pull request it uses the workspace plus branch name.

## Attached multiplexer shortcuts [#attached-multiplexer-shortcuts]

Inside an attached `jackin-capsule` session, the command palette includes **Clear pane**. With prefix mode enabled (`JACKIN_PREFIX=C-b`), press `Ctrl+B` then `Ctrl+L` to run the same command. Plain `Ctrl+L` still goes directly to the shell or agent.

Clear pane drops scrollback saved by jackin❯ for the focused pane and sends the standard form-feed key (`Ctrl+L`) to the pane so shells and TUIs redraw themselves. It does not use a terminal reset sequence, so bracketed paste, mouse mode, alternate screen state, and other pane modes stay intact.

## Selecting and copying text [#selecting-and-copying-text]

In a pane whose program is not using the mouse itself (a shell prompt, an idle agent, post-exit output), drag with the left button to select text; releasing copies the selection to your clipboard and shows a **copied** toast. Double-click a word to select and copy it in one gesture — URLs, quoted paths with spaces such as `"/my docs/file one.txt"` (quotes stay out of the copy), plain paths such as `~/Projects/jackin-project/…/pr-555/jackin`, and tokens such as `gpt-5.5`, `/model`, or `00:25` select whole, while surrounding punctuation like the braces in `{feature}` stays out of the copy. Double-clicking whitespace or a blank line selects nothing. Either way the highlight stays on screen after the copy; the next click or keystroke clears it.

The palette's close action is context-aware. On a one-pane tab it appears as **Close tab** and opens the confirmation directly. On a split tab it appears as **Close**, then asks whether to close the focused pane or the whole tab; **Close pane** is highlighted first.

The multiplexer always reserves the bottom row for session context. The right side shows the short jackin instance ID, such as `spamcw91` from `jk-spamcw91-jackin-thearchitect`, and it is available on the first rendered frame. The left side is reserved for branch or pull request context only: on a branch with an open GitHub pull request, it shows the PR number and title. While `gh` is still resolving the branch's pull request, it says `Resolving PR · <branch>` so the pending lookup is visible. On a non-`main` / non-`master` branch without an open PR, the same line shows the branch name instead. On `main`, `master`, or a directory without a recognizable branch, the left side stays empty and only the instance ID remains visible. Hovering either clickable side changes the pointer and slightly lifts the color, matching the top tab strip. Capsule watches the container-side Git metadata for `HEAD` changes so branch switches can invalidate stale PR context immediately, and keeps a once-per-second poll as a fallback for missed filesystem events and `HEAD` movement that does not rewrite `HEAD`. GitHub PR and CI metadata stays cached for the current branch plus `HEAD` and refreshes on a conservative cadence so `gh` is not polled aggressively.

Click the instance ID on the right side of that bar to open **Container info**. The modal shows the full container name, role, active pane's agent, and current workdir. The bottom footer hints that `Enter` copies the full container name, the Container ID value is emphasized as the copy target, and clicking that value performs the same copy action.

Click the PR or branch text on the left side of the bar to open **GitHub context**. The modal schedules a fresh background `gh` lookup for the current branch and `HEAD`, bypassing any recent "no PR" cache so a just-created pull request can appear without waiting for the background cadence. It shows the branch, GitHub pull request URL, pull request title, and best-effort CI status from `gh pr checks` when a pull request exists. The empty left side on the default branch is not a GitHub-context target. The bottom footer keeps `Enter` as the copy action for the GitHub URL and adds explicit host-open actions for the PR and CI/checks target. Clicking the GitHub URL row copies it; clicking the `Open PR` or `Open CI` rows requests a host browser open when host attach is enabled.

## Examples [#examples]

```bash
# Reconnect to agent-smith
jackin hardline agent-smith

# Reconnect from the current workspace or ad-hoc directory
jackin hardline

# Inspect the detected instance without attaching
jackin hardline --inspect

# Inspect a specific instance ID
jackin hardline --inspect k7p9m2xq

# Start another agent process in the detected running instance
jackin hardline --new

# Start a Codex process in a specific running instance
jackin hardline --new --agent codex k7p9m2xq

# Open a one-shot zsh shell in the detected running instance
jackin hardline --shell

# Open a shell in a specific running instance
jackin hardline --shell k7p9m2xq

# Reconnect to a specific container by name
jackin hardline jk-k7p9m2xq-agentsmith

# Reconnect to a namespaced agent
jackin hardline chainargos/backend-engineer
```

## When to use [#when-to-use]

* You closed your terminal window but the agent container is still running.
* An agent crashed (non-zero exit, OOM) and you want to resume in the same container with the same DinD sidecar.
* You want to check on an agent that's been running autonomously.
* You want another foreground agent process inside an already-running instance.
* You accidentally disconnected from a session.

For workflows that intentionally run multiple runtimes together in one instance, see [Parallel Agents](/guides/parallel-agents/).
