Prerequisites

Before getting started, make sure you have:

  • Java 21 or later installed (java -version).

  • Gradle (or use the repository’s ./gradlew / gradlew.bat).

  • An LLM API Key: OPENAI_API_KEY or ANTHROPIC_API_KEY.

Installation

Linux & macOS

Run the interactive installer:

./install.sh

Windows (PowerShell)

Run the interactive PowerShell installer:

.\install.ps1

The installer will:

  1. Check prerequisites (Java 21+)

  2. Build Book

  3. Install the bk wrapper script (bk on Unix, bk.ps1/bk.bat on Windows)

  4. Create ~/.bk/config with your settings

  5. Guide you through configuration

Configuration

Edit ~/.bk/config:

# Book Configuration File
export OPENAI_BASE_URL="https://api.openai.com/v1"
export OPENAI_API_KEY="your-api-key-here"

Usage

Basic Commands

# Start Book interactively
bk

# Start with a prompt
bk "Help me with this code"

# Headless mode
bk --prompt "What's the weather?"

# Get help
bk --help

System Prompts (File Paths)

Important: --system-prompt and --system-prompt-append expect FILE PATHS, not inline text.

Tilde Expansion: The bk wrapper automatically expands ~ to your home directory for all file paths.

# Replace system prompt with content from a file
bk --system-prompt ~/prompts/coding-assistant.txt

# Append project context from a file
bk --system-prompt-append ./.bk/project-context.md

# Both formats work (with or without =)
bk --system-prompt=~/prompts/expert.md

# Combine with other options
bk --model gpt-4 --system-prompt ./persona.txt "Debug this issue"

Sessions

# Load a session
bk --session my-work

# Continue with a prompt
bk --session abc123 "Continue our discussion"

# Resume the most recent session for this directory
bk --continue

# Resume by ID or name fragment
bk --resume abc123

# List sessions
bk sessions list

# Remove a session by ID prefix
bk sessions rm abc123

# Clear all sessions for this directory
bk sessions clear --force

Models

# Use specific model
bk --model gpt-4
bk --model gpt-3.5-turbo

Project Structure

  • bk - Main wrapper script (handles environment setup)

  • install.sh - Interactive installer

  • ~/.bk/config - Your configuration file

  • ~/.bk/tools/ - Custom KTS extension scripts (global, applies to every session)

  • .bk/tools/ - Project-local KTS extension scripts (per-directory)

Quick project setup โ€” Run /init in the TUI to auto-detect your project language and generate .bk/SYSTEM.md, .bk/tools/, and AGENTS.md with sensible defaults.

Optional: Tool Approval Guard โ€” By default Book executes all tools freely ("yolo mode"). To enable interactive APPROVE / DENY prompts before guarded tools run, install the opt-in tool_approval.bk.kts script:

cp extensions/src/scripts/tool_approval.bk.kts ~/.bk/tools/

See docs/extend/api-approval.md for customisation options. - .bk-config.template - Template for configuration

Common Issues

API Key Not Set

Error: OPENAI_API_KEY is not set

Fix: Edit ~/.bk/config and set your API key

JAR Not Found

Error: JAR file not found

Fix: Run ./gradlew :cli:shadowJar

Command Not Found

command not found: book

Fix: Add install directory to PATH or use ./book from project root

See Also

  • SHELL_SCRIPTS.md - Detailed shell-scripting reference (repository file, not published to the docs site)

  • docs/user/ - Full user guide (getting started, usage, configuration, tools)

  • docs/ARCHITECTURE.html - Architecture overview