Getting Started
This guide covers installing Book, first run, and configuration. For the full TUI walkthrough, see Usage. For all environment variables, see Configuration.
Prerequisites
Before installing Book, ensure your environment meets the following requirements:
-
Java Development Kit (JDK) 21 or later (e.g., Eclipse Temurin OpenJDK). Verify with
java -version. -
Gradle (or use the included
./gradlew/gradlew.batwrapper). -
LLM API Key: Either
OPENAI_API_KEYorANTHROPIC_API_KEY(with optionalOPENAI_BASE_URLfor custom gateways or local endpoints like Ollama).
Installation
Linux & macOS
Run the interactive Bash installer script:
./install.sh
This builds Book using Gradle, installs the bk wrapper script to ~/.local/bin (or your chosen path), and creates your configuration at ~/.bk/config.
Windows (PowerShell)
Run the interactive PowerShell installer script:
.\install.ps1
This builds Book using Gradle, installs the bk.ps1 and bk.bat wrappers, and creates your configuration at ~/.bk/config.
Manual Build & Run
If you prefer building manually without the installer scripts:
Linux / macOS
./gradlew clean :jvm:cli:shadowJar
java -jar "$(ls -t jvm/cli/build/libs/cli-*.jar | grep -vE 'javadoc|sources' | head -1)"
Windows (PowerShell / CMD)
.\gradlew.bat clean :jvm:cli:shadowJar
java -jar (Get-ChildItem jvm\cli\build\libs\cli-*.jar | Where-Object Name -NotMatch 'javadoc|sources' | Select-Object -First 1).FullName
First Run
Book operates in two primary modes depending on how it is invoked.
Interactive Mode (TUI)
When launched without a subcommand, Book enters an interactive Terminal User Interface (TUI). This allows for a continuous, conversational session with the agent.
If you provide a prompt as an argument, Book starts the TUI and processes that prompt immediately.
# Example: Starts TUI and asks "What is Book?"
java -jar "$(ls -t jvm/cli/build/libs/cli-*.jar | grep -vE 'javadoc|sources' | head -1)" "What is Book?"
Headless Mode (Non-Interactive)
There are two ways to run Book headlessly:
-
Subcommands: Commands like
lsrun their task and exit immediately.
`bash java -jar "$(ls -t jvm/cli/build/libs/cli-*.jar | grep -vE 'javadoc|sources' | head -1)" ls /tmp `
-
Headless Prompt: Use the
-por--promptoption to run a single AI prompt and get the output without entering the TUI.
`bash java -jar "$(ls -t jvm/cli/build/libs/cli-.jar | grep -vE 'javadoc|sources' | head -1)" -p "List the contents of my home directory using the ls tool." ` While running, a spinner with the current tool name is printed to *stderr (visible when stderr is a TTY; suppressed when piped). The final answer is printed to stdout.
> Session persistence: Headless runs create and persist a full session JSONL file to
> ~/.bk/agent/sessions/, exactly like interactive sessions. This means headless runs are
> resumable with -c or -r <id>, appear in `/resume’s session picker, and can be
> replayed in the Session Playback Server section of the Extension Overview.
API Keys
Book integrates with various LLM providers through environment variables.
| Variable | Description | Default |
|---|---|---|
|
Your OpenAI API key. Required for GPT models. |
None |
|
Base URL for the OpenAI API. Useful for local models (e.g., Ollama, vLLM) or gateways. |
|
|
Your Anthropic API key. Required for Claude models. |
None |
Example Setup (Linux/macOS)
export OPENAI_API_KEY="your-key-here"
export OPENAI_BASE_URL="https://api.openai.com/v1" # Optional
For runtime tuning variables (BOOK_MAX_TURNS, BOOK_HIDE_TOOL_RESULTS, etc.), see Configuration.
Next Steps
-
Usage โ TUI, slash commands, hotkeys
-
Configuration โ env vars, tuning, session cost
-
System Prompts โ customize the agent’s behaviour
-
Built-in Tools โ the six core tools
-
Integrations โ use Book inside Xcode via ACP