Files
tty7/docs/agents/sessions.mdx
T
l0ng-ai 6fcf659e04 feat(search): tabbed Search Everywhere with a Sessions tab to resume agent sessions (#969)
* feat(search): replace the command palette with tabbed Search Everywhere

The palette was one flat list that every new kind of row had to be squeezed
into: tabs and SSH hosts rode along as "Switch to Tab: …" and "SSH: …"
commands, and the only way to narrow to one kind was a magic seed word.

Search Everywhere splits it into sources behind one trait — All, Actions,
Terminals, Hosts — each with its own empty-query layout and ranking. The All
tab shows each source's top rows, ordered by best match, with a row that
opens the full tab. Tab / Shift-Tab walk the tabs and keep the query.

- Terminals lists every open tab of every workspace (reusing the switcher's
  tab rows) and jumps to it wherever it lives, plus the shells and agents.
- Hosts replaces the separate "Add Connection" input: a typed address or
  full `ssh …` line offers to connect.
- Fixes Return doing nothing after a search that found nothing, or when the
  search opens pre-filtered: gpui-component re-picks the row from a stale
  frame; the delegate now re-arms the first row.
- Fixes `ssh -p 2222 me@box` being offered as a quick-connect address with
  user `ssh -p 2222 me`.

The keymap action stays `TogglePalette` so custom bindings keep working.

* feat(search): a Sessions tab to resume past agent sessions

Search Everywhere gains a Sessions tab listing the Claude Code and Codex
sessions on this computer, read from ~/.claude/projects and
~/.codex/sessions ($CODEX_HOME). Sessions that ran in the focused tab's
directory lead; the All tab offers the last three of them before anything
is typed. Return opens a new tab in the session's directory and runs the
agent's resume command with its configured launch flags.

- Only each transcript's head and tail are read, off the window thread,
  and cached by path, size and mtime: ~170ms cold for 50 sessions,
  under 1ms warm. The search opens on the cached list and fills in.
- Titles: /rename name, then the agent's own title (ai-title, Codex's
  session_index.jsonl), then the first thing typed, skipping harness
  injections. Codex rollouts it ran for itself (subagent/internal) and
  sessions never asked anything are left out.
- A session whose directory is gone is refused with a notice rather than
  resumed where the agent cannot find it.
2026-09-27 09:38:31 +08:00

63 lines
2.2 KiB
Plaintext

---
title: "Agent sessions"
description: "Resuming a conversation after a reboot, forking a live one, and getting at the session id."
---
Coding agents keep their own conversation history, addressed by a session id.
Because tty7's hooks learn that id, it can do three things with it.
## Resume after a restart
When the server goes away — a reboot, a crash, a deliberate restart — the shells
go with it. Panes that were running an agent relaunch the conversation on
restore instead of coming back to a bare prompt:
```bash
claude --dangerously-skip-permissions --resume 8f3c…
```
The original launch flags are replayed, so the pane comes back the way you
started it, not the way the defaults would.
Supported for every recognised agent except Aider. Turn it off with
`restore_agent_sessions: false`.
<Note>
Resume needs the agent's hooks installed, since the session id comes from
them. [Installing hooks →](/agents/status)
</Note>
## Fork a live session
Forking branches a running conversation into a second, independent one. The
original keeps going untouched; both continue separately from the same history.
Right-click a **pane** to fork into a split — the menu offers a placement —
or right-click the **tab or sidebar row** to open the fork in a new tab.
| Agent | What tty7 runs |
|---|---|
| Claude Code | `claude --resume <id> --fork-session` |
| Codex | `codex fork <id>` |
| TraeCode | `traecli fork <id>` |
| Grok | `grok --resume <id> --fork-session` |
| OpenCode | `opencode --session <id> --fork` |
| Oh My Pi | `omp --fork <id>` |
| Prime Agent | `prime-agent --fork <id>` |
It is the agent's own fork command, run in a new pane — nothing is copied by
tty7 itself.
<Warning>
A fork duplicates the whole transcript in the agent's session store, so
forking repeatedly costs real disk. A pane on a
[remote machine](/remote/workspaces) cannot fork, because the command would
run against the local agent.
</Warning>
## Copy the session id
**Copy Session ID** — in the tab's right-click menu, beside *Copy Working
Directory*, and in Search Everywhere — puts the agent's native id on the
clipboard. Paste it into `codex resume`, a bug report, or another tool.