---
title: jackin hardline
description: "Reattach to a running agent's session, or restart a crashed one"
---

## 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 jackin 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

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

## 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 named secondary tmux session inside the selected running instance instead of attaching to the primary session. 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 tmux session. Mutually exclusive with `--inspect` and `--new`. |
| `--debug` | Print every external command jackin issues (`docker`, `git`, etc.) and their captured output. Also enabled by `JACKIN_DEBUG=1`. |

## Behavior

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

| Container state | Action |
|---|---|
| Running | Attach to the most recently used tmux session, or create a new `jackin-<agent>-<id>` session when none are running. `--new` creates a new named tmux session inside the container. `--shell` opens an ephemeral zsh session without a tmux 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 jackin-managed local state 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; jackin 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 tmux session inventory from the running container.

`--new` requires a running indexed instance. It starts a named secondary tmux session (`jackin-<agent>-<id>`) inside the running container with the same mounts, Docker-in-Docker sidecar, working directory, and in-container state. The session is independently reconnectable — a second `jackin hardline --new` from the same instance reattaches to any live session or creates a fresh one. If the selected container is stopped or missing, run plain `jackin hardline` first so jackin 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

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

To stop an agent, exit it from inside (e.g., `/exit` in Claude Code). That ends the tmux session cleanly. The container keeps running until the foreground session exits cleanly and jackin's post-session teardown runs.

## Terminal tab title

`jackin hardline` sets the terminal tab title to the role's display name (e.g. `jackin' · The Architect`) before connecting, matching the behavior of `jackin load`. This applies to all three paths: reconnect, `--new`, and `--shell`.

## 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

- 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/).
