Sessions

Resume, browse, rewind, and fork sessions, run several at a time, and move one to another machine.

hob saves each session in its state folder (~/.local/state/hob/ on Linux and macOS). You can resume a session, rewind it to an earlier prompt, or fork it.

Resume a session

Command What it does
hob -c Resumes the last session in this folder.
hob -r <id> Resumes one session by its id.
hob -c --fork-session Resumes a copy of the last session under a new id.
/resume or Ctrl+P Browses the sessions.
/session-id Shows and copies the id of the current session.

In the session browser, Tab switches between the sessions of this folder, of every worktree of the repository, and of every project. A fork shows under the session that it came from.

To make hob -c and Ctrl+P cover the whole repository, set session_scope:

~/.config/hob/init.lua
hob.setup({
  storage = { session_scope = "repo" },
})

Run several sessions

Sessions run at the same time. In /resume, Ctrl+N starts a new session while the current one keeps working in the background. The browser shows the live state of each session: working, needs input, or idle. When a session in the background finishes or needs input, hob shows a note in the status bar.

Key in the session browser What it does
Ctrl+N Starts a new session.
Ctrl+R Renames the session.
Ctrl+D Deletes the session (press it twice).

/rename renames the current session. /new replaces the current session, which ends its turn and its background tasks.

Rewind

Esc Esc, or /rewind, opens the rewind picker. Pick a prompt to go back to it.

  • When the turns that you drop changed files through hob’s edit tools, hob asks if the files go back too.
  • hob does not track changes that bash made, and leaves a file alone that changed since.
  • After a rewind, the first row of the picker undoes it.
  • Ctrl+F in the picker forks the session at that prompt, instead of a rewind.

hob.setup({ agent = { file_history = false } }) turns the file tracking off. Autoreview needs it on.

Fork

/fork copies the whole session and switches to the copy. Both sessions edit the same folder.

/fork --worktree [name] puts the copy in a new Git worktree next to the checkout, with your uncommitted changes (staged, unstaged, and untracked files, but not ignored ones). hob shows the command that opens the fork in another terminal, cd <path> && hob -r <id>, and copies it to the clipboard.

To make the worktree with your own command, set worktree_command. hob passes the name last, and reads the new path from the output:

~/.config/hob/init.lua
hob.setup({
  ui = { worktree_command = { "git", "wt", "-n" } },
})

Export and import

Command What it does
hob session list Lists the sessions of this folder. -g lists every project, --json prints JSON.
hob session export <id> Writes a session as a JSON transcript to stdout.
hob session import [file] Stores a JSON transcript as a new session in this folder, and prints its id.
hob session delete <id> Deletes a session. -f skips the question.
/export [path] Exports the transcript of the current session, as Markdown (default) or as raw JSON.
/import Imports a raw JSON transcript into a new tab.

To move a session to another machine:

Terminal
hob session export 7f3c2a > session.json
hob session import session.json

Session titles

The bundled autotitle plugin can give each session a short title, and each prompt a key of about five words. It is off until you configure it with /autotitle. /prompts lists the prompts of the session by their keys. See Commands.

Keyboard shortcuts

Go to

On this page

  • jkNext or previous section
  • 12…The section with that number
  • cCopy the install command
  • iDownload
  • dDocs
  • []Previous or next page

Anywhere

  • ?Show or hide this list
  • EscClose, or stop a "g"