Usage
Interactive TUI usage: multi-line input, slash commands, hotkeys, headless progress. For the internal rendering architecture (renderer, FileCompleter traversal, charWrap arithmetic), see TUI Internals (Phase 3).
Multi-line Input
You can type freely in the prompt. Press Enter to submit your message.
Pasting multi-line text: When you paste text that contains newlines, Book detects the paste burst (Enter arriving within 20 ms of the last character) and inserts a literal newline into the buffer instead of submitting. The full pasted block is submitted when you press Enter deliberately at the end.
Commands inside TUI (Slash Commands)
-
/model: Opens an interactive selector to change the active model. Falls back to a built-in model list if the API is unreachable. -
/effort [level]: Sets reasoning effort level for the active session (session-scoped). Invoking bare opens an interactive modal effort selection screen. -
/effort-default <level>: Sets reasoning effort level and saves it as the global default in configuration (book.json). -
/resume: Open the full-screen session picker to resume a previous session and restore its full message history (see Session Picker below). -
/tree: Open an interactive branch-point selector β pick any past message to truncate history back to that point and continue from there (see Tree β In-Place Branching below). -
/fork: Fork the current session into a new session file from a selected point. -
/compact: Compact current in-memory conversation history (runs non-blocking in the background; TUI stays responsive). -
/skills: Show loaded skills. -
/clearor/new: Resets the current session history and agent state. -
/init: Run the project initialisation wizard β auto-detects project language and creates.bk/SYSTEM.md,.bk/tools/, andAGENTS.mdwith language-specific templates. -
/quitor/exit: Closes Book. -
/help: Displays available commands and keyboard shortcuts.
Slash command completion: Type / followed by a partial command name and press Tab to complete it. Up to 5 matching commands are shown with their descriptions. Press Escape to dismiss the completion list without clearing the input buffer.
File Attachment Completion
Type @ or # anywhere in the prompt to trigger keyboard-driven file-path completion. The overlap with slash commands is intentional β both share the same completion overlay.
compare @src/F β type @ then a partial path
βββββββββββββββββββββββββββ
β src/Foo.kt π file β
β src/Foo2.kt π file β
βββββββββββββββββββββββββββ
How it works:
-
After typing
@or#, a file completion overlay appears showing up to 8 matching entries from the current working directory. -
Navigate with
β/β(arrow keys). -
Press
TaborEnterto apply the selected entry:-
Directory β the token updates to
@dir/and the overlay refreshes showing that directory’s children. You can keep drilling down. -
File β the token is replaced with
relative/path(backtick-wrapped), signalling to the agent that this is a file reference. The overlay closes.
-
-
Press
Escapeto dismiss the overlay without modifying the buffer. -
Type a space after the trigger to close the token without selecting β the overlay disappears and you can continue typing normally.
Filtering & exclusions:
-
Results are filtered by the text typed after
@or#(prefix match, case-sensitive). -
Sub-directory navigation:
@src/lists the contents ofsrc/;@src/mfilters to entries starting withminsidesrc/. -
Dotfiles (names starting with
.) are always excluded. -
Entries matching your project’s
.gitignoreare excluded (supports,*,/-anchored literals, anddir/directory-only patterns). -
Directories appear before files; both groups are sorted alphabetically.
-
Results are capped at 8 entries.
Tree β In-Place Branching
/tree opens a full-screen interactive message selector over the current session’s history. Unlike /fork (which spawns a new session file), /tree branches in place:
-
A scrollable list of every message in the current conversation is displayed with its index and a text preview.
-
Navigate with
β/βand pressEnterto select the message you want to branch from. -
On selection:
-
The in-memory conversation is truncated to the messages up to and including the selected point.
-
sessionManager.branch(entryId)is called to rewrite the on-disk JSONL so the branch is persisted immediately β you can resume from the same point in a future session.
-
-
You are returned to the chat prompt; subsequent messages continue from the branch point.
-
Press
Escapeto cancel without making any changes.
| Key | Action |
|---|---|
|
Move selection up / down |
|
Branch from selected message |
|
Cancel and return to chat |
/treevs/fork: Use/treewhen you want to keep working in the same session with a revised history. Use/forkwhen you want to preserve the original session unchanged and explore an alternative in a new file.
Session Picker
/resume opens a full-screen interactive session picker and restores the full message history of the selected session into the active agent context. All TUI timers and status indicators are reset so there is no carry-over from the previous session.
Resume Session ββββββββββββββββββββββββββββββββββββββββββββββββββββ Type to filter β’ β/β move β’ Enter select β’ Esc cancel > my-feature-work Refactor the auth module 2m ago 14m fix-login-bug Debug the JWT validation 1h ago 8m api-redesign Design the REST API layoβ¦ 3d ago 22m ββββββββββββββββββββββββββββββββββββββββββββββββββββ 2/3 sessions
| Interaction | Behaviour |
|---|---|
Type characters |
Filters sessions by name, first message, or ID prefix (case-insensitive) |
|
Remove last character from filter |
|
Move selection up/down |
|
Load selected session and return to chat |
|
Cancel and return to chat |
Columns shown per row: session name (or truncated ID), first message preview, relative age (now, Xm ago, Xh ago, Xd ago, Xw ago), message count.
Full context restore: On
Enter, the complete message history is loaded from disk and placed intolastState. Agent-phase, timers, and the UI notice board are all reset to their initial values β identical to starting a fresh session, but with the resumed history pre-loaded.
Sessions are automatically named after their first user/assistant exchange. The auto-generated name appears in the picker and in the window title.
Hotkeys
| Key | Action |
|---|---|
|
Submit message (or insert newline if pasting); applies selected completion when overlay is open |
|
Complete a partial slash command or file path (see File Attachment Completion) |
|
Dismiss completions overlay; or clear input buffer if no completions active |
|
Cancel current agent run; or exit Book if idle |
|
Exit Book (only when input buffer is empty) |
|
Clear and redraw the screen |
|
Toggle extended thinking / reasoning visibility |
|
Cycle reasoning effort levels (displays toast if unsupported) |
|
Open |
|
Navigate completion overlay (when open); or scroll conversation viewport up / down by 1 line |
|
Scroll conversation viewport up / down by 10 lines |
|
Navigate input history β previous entry |
|
Navigate input history β next entry |
Input history is persisted to ~/.bk/history.txt across sessions. Navigate it with Alt+Up / Alt+Down without affecting the conversation scroll position.
Status Row
While the agent is running, a status row appears below the conversation:
-
Thinking phase: a spinner and a rotating phrase (changes every 3 seconds β "thinking", "reticulating splines", "herding semicolons", etc.) plus elapsed time
(Xs)or(Xm Ys). -
Tool execution phase: spinner, the tool name(s) being executed with the most relevant argument extracted β e.g.
bash(ls -la),read_file(src/Main.kt)β plus elapsed time. -
Done: a "Done in Xs" row stays visible for 5 seconds after the agent finishes, then disappears.
Headless Mode Progress (stderr spinner)
When Book runs with -p and stderr is a TTY, a lightweight progress indicator appears on stderr:
β Έ read_file(src/auth/LoginService.kt)...
The spinner updates the current tool name live and clears itself when the run completes. No output is written to stderr when stderr is piped.
Tool Approval (opt-in)
If the tool_approval.bk.kts script is installed (see Opt-in Tool Approval), the TUI will pause before executing guarded tools (bash, write_file, etc.) and display an approval prompt. While the prompt is shown, the key handler is intercepted:
| Key | Decision |
|---|---|
|
Approve this call once |
|
Always approve this tool for the rest of the session |
|
Deny this call |
|
Deny this call |
All other keys are ignored until a decision is made. The approval prompt also shows a diff overlay for file-modifying tools.
CLI Arguments & Options
Positional Argument: prompt
An optional initial prompt to start the session. If provided, Book will process this immediately upon startup.
Options:
-
-m, --model <id>: Specifies the model ID to use (e.g.,gpt-4o,claude-3-5-sonnet-20240620). -
--effort <level>: Reasoning effort level (off,minimal,low,medium,high,xhigh,max), defaulting tohigh. Persists as global default unless--no-save-effortis passed. -
--no-save-effort: Suppresses global default persistence when--effortis passed. -
-s, --session <id|path>: Loads a previous session. You can provide a full path to a.jsonlsession file or a session ID found in your sessions directory. -
-c, --continue: Resume the most recent session for the current directory. -
-r, --resume <id|name>: Resume a session by ID or name fragment.
Subcommands
ls [path]
Lists files in the specified path (defaults to current directory). This uses Book’s internal ListFilesUseCase.
./gradlew :cli:run --args="ls /home/user/project"
sessions list [--all]
Lists recent sessions (current directory by default, or all directories with --all).
sessions rm <id>
Deletes a specific session by ID (prefix match supported).
sessions clear [--force]
Deletes all sessions and their corresponding log files for the current directory (asks for confirmation unless --force).