# Using bone ## Screen Out of the box the screen is the runtime's standard UI (`runtime/lua/bone/ui/`). It can be changed or replaced in Lua (see [lua.md](lua.md)). ```text › your message ← the session reasoning (dim) $ cargo test ← a tool call; output collapses to a few rows ╰ test result: ok The answer, rendered as Markdown. ── ⠙ working 12s ctrl+c to cancel ── ← divider (a plain line when idle) › Message bone… ← prompt (grows with its text) session title 1.2k in · 40 out │ ~/project ← statusline ``` By default, stretches of tool calls collapse to a summary (for example, "Read 3 files, ran 2 shell commands"); edits and failures stay visible. Press `ctrl+t` for rows or full detail. Individual calls show `◌` while running, `✕` on failure, nothing when done. Shell rows show `$ command`, a non-zero `exit N`, and an output preview. Edits show a short `-`/`+` diff; reads and writes are one line. There are no editing modes: normally you type into the prompt; focused popups, panels and terminals receive their own keys. Type `/` for commands; a list of matches appears as you type. ## Keys These come from `runtime/tui/defaults.lua`; change them in `~/.bone/tui.lua`. | Key | Does | |---|---| | `enter` | send (or run a `/command`). While a turn runs, the message is queued: by default it joins that turn at its next step; with `bone.o.queue_mode = "next"` in `tui.lua` or `gui.lua` it waits for a turn of its own. Queued messages show at the end of the chat | | `up` on an empty prompt | edit the last queued message: `enter` saves it in place, `esc` leaves it as it was | | `alt+enter`, `shift+enter`, `ctrl+j` | new line | | `ctrl+c` | cancel the running turn; else clear the prompt; else press twice to quit | | `ctrl+o` | pick a session to open | | `f1` | open the searchable help popup: Commands, Keys and Docs | | `down` / `ctrl+b` | the tray below the prompt: queued messages, sub-agents and shell jobs. `down` on an empty prompt moves into it (the Queue page first when anything is queued; `up` from its top row leaves), `tab` switches pages, `enter` opens one (a sub-agent's session in the chat, a shell job as a terminal in the tray), `c` cancels, `esc` goes back; a click does the same. On the Queue page `enter` edits a message, `s` switches it between steer and next (when no turn runs: sends it now), `shift+up`/`shift+down` move it, `d` drops it and `r` resumes a paused queue. `ctrl+b` folds the tray to one line. In a sub-agent's session, `‹ main` in the tray or `esc` on an empty prompt goes back | | `ctrl+r` | show / hide the model reasoning (live in the chat and in the transcript) | | `alt+m` | switch the session to its provider's next model (the list `/model` keeps) | | `ctrl+t` | how much of each tool call to show: a summary line per stretch of calls ("Read 3 files, ran 2 shell commands"; edits and failures in full) → a row per call → everything in full → back. It stays until you press it again | | `ctrl+n` | new session | | `ctrl+]` / `ctrl+5` | **term plugin:** open or focus a terminal panel (Unix); in the terminal, return to the prompt | | `shift+pageup` / `shift+pagedown` in a terminal | scroll terminal history | | `F6` / `shift+F6` | move the keys to the next / previous area: the prompt, then each panel (the sidebar, files …). Works from inside any panel except a terminal, which keeps every key (`ctrl+]` leaves it). The panel with the keys has its bar lit in the accent colour, and the prompt's `›` dims | | `ctrl+p` | move focus to the next panel (from the prompt) | | `up` / `down` | move between prompt lines; past the edges, earlier messages. With `/` suggestions showing, move through them | | `tab` | complete the selected `/` command | | `esc` | hide suggestions, or clear a message | | `pageup` / `pagedown`, `shift+up` / `shift+down`, mouse wheel | scroll the session | | `ctrl+home` / `ctrl+end` | top / bottom (bottom keeps following new output) | | mouse drag | highlight text; releasing copies it to the clipboard (through tmux when inside it, else OSC 52, plus `wl-copy`/`xclip` locally). In the chat, the copy is the text alone: no gutters, quote and code bars or indents, bullets as `- `, and lines the screen wrapped joined again. `bone.o.mouse = false` in `tui.lua` hands the mouse back to the terminal | | `ctrl+left` / `ctrl+right`, `alt+left` / `alt+right` | move by word | | `ctrl+a` / `ctrl+e`, `home` / `end` | start / end of line | | `ctrl+w`, `alt+backspace` | delete the word before the cursor | | `ctrl+u` / `ctrl+k` | delete to the start / end of the line | | `ctrl+v` / `super+v` / `alt+v` | read the local clipboard: attach a screenshot, or paste text; `super+v` is Command+V on macOS when the terminal forwards it; use `alt+v` on Windows, where the terminal keeps `ctrl+v` for itself | | terminal paste | goes into the prompt as text | Pastes longer than 500 characters appear as `[Pasted text #N +M chars]` while you compose; the full text is sent when you submit. Backspace immediately after the placeholder removes the whole pasted block. **Panels.** Plugins can dock panels beside, above or below the session (`bone.ui.panel`). Click one (or use the key its plugin gives) to give it the keyboard: the arrows, `pageup`/`pagedown`, `home`/`end` and the wheel scroll it, `tab`/`shift+tab` move to the next/previous panel and back to the prompt (unless the panel uses `tab` itself), `F6`/`shift+F6` do so from any panel, `esc` returns to the prompt. The focused panel's bar beside the chat is drawn in the accent colour (`WinSeparatorFocus`). The wheel over a panel always scrolls that panel. **Approval popup.** By default tool calls run without asking. Custom hooks can pause with `bone.ask`; a TUI handler displays the question and replies with `ask/respond` (see [lua.md](lua.md#asking-the-user)). **Conversations sidebar** (`ctrl+o`, `/sessions`): a docked left column has **Chats** and **Processes** tabs. Chats groups top-level conversations into **Pinned**, **Active** (finished within the last hour, or waiting for your answer), **Running** and **Archived**, newest activity first within each section. A finished chat is archived on its own once it has been idle for `bone.ui.sessions_archive_after` seconds (3600 by default; set it in `tui.lua` or `gui.lua`), and comes back when it runs again. Running chats show animated spinners. `ctrl+t` pins or unpins the selected chat; pinned chats stay at the top and are never archived. `/archive` archives the current conversation and starts a new one; it does not delete the session. Pins and archives are shared with the desktop sidebar on the same machine. It shows titles, last-activity times, total input + output tokens, and user-turn counts. Type to filter by title or directory, `up`/`down` to select, and `enter` or a mouse click to open. First open selects the current chat. Switching leaves the sidebar open and returns keyboard focus to the prompt; background turns keep running. `ctrl+o` focuses it again, or closes it when already focused; `esc` returns to the prompt without closing it. Page keys and `home`/`end` navigate longer lists; the mouse wheel scrolls. Drag the blank column at its right edge to change its width, which is kept for next time (set `bone.ui.sessions_width` in `tui.lua` for the default; the chat always keeps 20 columns). Running status updates live, including turns already active when connecting to the core; usage totals refresh when turns finish. `tab` switches to the **Processes** page, remembering selection and scroll on each tab: every chat's background shells and running sub-agents, grouped by chat, whichever chat is on screen. `enter` opens the chat a shell belongs to, or the sub-agent's own chat, and `x` stops the selected one. The tray below the prompt only shows the on-screen chat's shells and sub-agents. ## Images Copy a screenshot to your system clipboard, focus the prompt and press `ctrl+v`. Bone reads the image in the background and shows its name and dimensions below the composer. Add a question or press `enter` to send the image alone. `/paste` does the same read when the terminal intercepts your paste shortcut; on macOS, forwarded Command+V also works. Ordinary clipboard text still pastes as text. `/attach PATH` adds an image file (paths may contain spaces or be quoted). `/detach 2` removes the second image; `/detach all` clears the attachment list. `esc` or `ctrl+c` clears the whole draft. Each open session keeps its draft, including images; queue editing and prompt history keep images too. Enter waits until pending image reads finish, so a screenshot cannot accidentally miss its message. Native clipboard access runs on the TUI's machine, including when connected to a separate core. Linux reads the clipboard with `wl-paste` (Wayland, from the wl-clipboard package) or `xclip` (X11), the same programs copying uses; `/health` says when one is missing. A terminal's usual paste shortcut may be handled by the terminal before Bone sees it; use `/paste` or configure the terminal to forward `ctrl+v`. In SSH or a desktop-free environment, use `/attach` on a local file. Native Windows builds use the Windows clipboard; a Linux build in WSL uses its Linux desktop clipboard. PNG, JPEG and WebP inputs become lossless PNG attachments. Limits: 8 images per message, 20 MiB per input and resulting PNG, 40 megapixels per image, and 40 MiB of image data per message. Select a model that accepts images and enable vision in its server configuration (for example, TabbyAPI can load a vision-capable model with its vision component disabled); `supports_images = false` in a provider entry rejects attachments before submission and preserves the draft. Leave it unset for the endpoint to decide, or set it to `true` for a vision provider. Saved sessions and forks refer to durable files under `/attachments/.png`; pixels are sent to the model only when needed. Attachment files are retained, including uploads from drafts you discard; automatic garbage collection is not implemented. Back up the attachments directory together with sessions when moving your history. The model can also use `read_file` to view PNG, JPEG and WebP files on the core machine. Images are recognized by their contents and returned as pixels with the same limits and storage as attachments. Line ranges apply only to text files. Invalid images or a model with `supports_images = false` produce a tool error, allowing the model to continue. ## Commands | Command | Does | |---|---| | `/help`, `/?` | searchable help popup with Commands, Keys and Docs tabs (also `f1`) | | `/help {topic}` | the matching section of these docs in a scrollable window (`/help hooks`, `/help windows`, `/help lua` for a whole file) | | `/md [relative path]` | **md plugin:** browse the working directory's Markdown files in a large popup, or open a listed document directly | | `/health`, `/checkhealth` | check the setup: provider address and key, sessions folder, terminal, mouse, clipboard route, Lua errors, plus plugins' own checks | | `/setup` | add a model provider: kind, URL, model and key (kept in `~/.bone/secrets.json`), and catalog plugins; opens by itself on a first run with no provider | | `/catalog` | browse the plugin catalog: install, update and remove packages (each file checked against the catalog's hashes) | | `/config`, `/settings` | the settings page: TUI options, which provider and model to use, plugins on and off, and plugins' own settings; everything is saved in `~/.bone/settings.json` | | `/paste` | paste a screenshot or text from the local clipboard | | `/attach PATH` | attach a PNG, JPEG or WebP file | | `/detach [N|all]` | remove an attachment (default: the last one) | | `/model [name]` | alone, a picker of every provider's models (type a name that is not there to add it); with a name, switch the on-screen session to that model of its provider and add it to the provider's list (`providers..models`); `/model rm NAME` takes one off | | `/provider` | open the Providers page in `/config` | | `/tui`, `/tui use NAME`, `/tui create NAME [bare]`, `/tui delete NAME` | choose the built-in standard or bare library (read-only) or one of yours; create one that starts from standard (or bare) and holds only your changes, or move an inactive one aside | | `/new`, `/clear` | start a new session | | `/archive` | move this conversation to History and start a new session | | `/term [command]`, `/terminal [command]`, `/term close` | **term plugin:** open a terminal panel on the TUI's machine (Unix), or close it and stop its program | | `/sessions`, `/resume` | pick a session to open | | `/where` | show the current session's title and directory | | `/cd [dir]` | move this session to another directory: `/cd ~/projects/x`, `/cd ..` (relative to where it is now), `/cd -` for the one it was in before, or alone to pick one used before or browse to another. The conversation stays; its tools run in the new directory from the next turn on, the model is told where the change was, and new sessions start there too. Not while a turn runs. Before a session has started, `/cd` only names where it starts. In the desktop app the folder in the header is a button for the same picker | | `/rename {title}` | give this session a title | | `/compact`, `/compact clear` | summarize this session for the model (`compact.keep` controls how many recent turns stay word for word; default 0); the chat and the session file keep everything, and one line notes the tokens saved. Each model call also gets a short handoff of that cut, rebuilt from the transcript and not stored, so a later compaction cannot paraphrase it away. `clear` sends the whole history again. Bone also compacts by itself when the model says the context is too long, or before a call over `compact.limit` (`/config` → General → Compaction), unless the session's selected provider overrides it with `compact_limit` (`/config` → Providers → `e` → Compaction limit): unset inherits the global limit, positive overrides it, and `0` disables proactive compaction without changing overflow retry. The summary provider does not determine this limit; empty input resets the saved override | | `/queue`, `/queue clear`, `/queue resume` | list the queued messages, empty the queue, let a paused queue go on (after a cancel, restart or failed queued-turn start) | | `/quit`, `/exit`, `/q` | quit | | `/plugins` | open the plugin settings; `/plugins list` lists plugins (TUI and core halves); `/plugins load name`, `/plugins unload name`, `/plugins reload name` act on both halves (picking up edits to their files); `/plugins reload` reloads the core's whole Lua configuration (`core.lua` and core plugins) | `/rename`, `/compact` and `/plugins` are Lua commands from `runtime/lua/bone/commands.lua`: change or remove them like any other (`bone.cmd.del("rename")`). Conversation branching is available through the optional fork plugin in the catalog (install it from `/catalog`): `/fork` opens a user-message tree popup, `/fork N` branches before user message N and restores it as an editable draft, and `/fork copy` copies an idle session. The original stays unchanged. **Queue cancellation.** Cancelling a turn normally pauses older queued messages. Sending a new message resumes them; if the cancelled turn is still winding down, the new message goes ahead of the older queue and runs next. Queue save failures are reported without rejecting accepted messages, so those messages can still run but may be lost on restart. Enter on a partial name runs the highlighted suggestion (`/ses` + enter opens the picker). A message that really starts with `/` can be sent as `//like this`; paths such as `/etc/hosts …` are sent as messages anyway. Commands from Lua or plugins show up in the suggestions too. **Help popup.** Type to filter the current tab; `tab` / `shift+tab` or `left` / `right` switch between Commands, Keys and Docs. Search matches command aliases and descriptions too, and includes commands registered by plugins. Use `up` / `down`, the wheel, `pageup` / `pagedown` or `home` / `end` to navigate; `ctrl+u` clears the search. `enter` on a command puts it in the prompt ready to edit and submit; on a shortcut or doc topic, it opens the guide in a scrollable window. Close the guide with `esc` to return to the same search. `esc` closes help and returns to your draft. The Keys tab describes the default mappings; your `tui.lua` can override them. Described user and plugin mappings appear too. Docs includes usage, Lua, protocol, architecture and the customization guides (`/help customizing` or `/help customizing/customizing-tui`). Loaded plugins' READMEs are also available. ## Terminal panels and chat windows Install the optional **term** plugin from `/catalog` for terminal panels. `/term` opens your shell in a bottom panel; `/term cargo test` runs a command instead. Focused terminals send keys and pasted text to the program, except `ctrl+]` / `ctrl+5`, which return focus to the prompt; `shift+pageup` / `shift+pagedown` scroll history. From the prompt, `ctrl+]` focuses the last terminal or opens one. Closing the panel stops its program; an interactive shell's exit closes it, while a command's output remains until closed. These terminals use local TUI jobs and currently require Unix; they are separate from core-side background shell jobs shown in the tray. Lua layouts can show several chats at once, each with its own prompt, statusline, draft and scroll position. Chat numbers start at 0 and exist even before a new chat has a session ID. See `/help chat windows` for the layout API, or `/help customizing/customizing-tui` for editable libraries and UI configuration. ## Markdown popup Install the optional **md** plugin from `/catalog` for the Markdown browser. `/md` recursively lists `.md` files (case-insensitive) in the current session's working directory, including hidden files but excluding `.git` internals and symlinks. On a new chat it uses Bone's launch directory. The popup leaves your draft and chat untouched; files are read locally, not sent to the model. `/md docs/usage.md` selects that relative path after discovery. Type in the file pane to filter relative paths (all search words must match); `backspace` edits and `ctrl+u` clears the filter. `up` / `down`, the wheel, page keys and `home` / `end` select files and preview them. `enter` focuses the reader; `tab` / `shift+tab` switch panes. In the reader those navigation keys scroll, and `space` pages down. `ctrl+r` rescans and reloads the selected file; `esc` closes. Reading positions are remembered while the popup stays open. Narrow terminals show only the active pane. The preview uses Bone's themed Markdown renderer for headings, emphasis, links, lists, quotes, code blocks and wrapping tables. Links are displayed, not executed. Discovery and reads run as background jobs using `find` and `head` from your PATH; no new Rust APIs or model calls are involved. UTF-8 filenames are supported, including spaces and newlines. Scans stop after 30 seconds or 20,000 files and report incomplete results; each read has a 10-second timeout and a 1 MiB limit. Unreadable, empty and oversized documents have explicit messages. This is a browser for trusted local projects, not a filesystem sandbox against concurrent symlink replacement. Implementation: `require("md_browser").open(path)` in the catalog's `plugins/md/lua/md_browser.lua`. Run its regression tests from the catalog checkout: `luajit tests/md_test.lua`. ## Options | Option | Default | | |---|---|---| | `show_reasoning` | off | show model reasoning (`ctrl+r`) | | `tool_detail` | summary | tool calls: `summary`, `rows` or `full` (`ctrl+t`) | | `tool_preview_lines` | 4 | rows of tool output under each call | | `diff_preview_lines` | 8 | rows of diff under each edit | | `prompt_max_height` | 10 | prompt height limit | Options are set in `~/.bone/tui.lua` (`bone.o.tool_detail = "rows"`). What you choose with `ctrl+t` and `ctrl+r` is remembered in `~/.bone/settings.json`, which bone writes for you; `tui.lua` still wins when it sets the same option. The same file remembers the default provider and provider settings (`"provider"`, `"providers": { "": { "model": … } }`): `/config` edits these over what `core.lua` gives them and adds new providers. Sessions persist their own provider/model selection; selecting a provider or explicitly setting the selected provider's model in the TUI updates the on-screen session too, without moving other sessions. Resetting a model field changes the default, not an existing session's saved selection. ## Command line ```text bone [-r [ID]] [--connect [PATH]] TUI (on the shared core, or the server you name) bone --gui [--connect [PATH]] the desktop app, on the same core bone --headless [--listen [PATH]] core only, on stdio or a local socket/named pipe bone --init starter ~/.bone/core.lua and tui.lua ``` Without `--connect`, the TUI and the GUI share one core on the default socket: the first launch starts it as a process of its own (`bone --headless --listen --exit-idle`), later launches attach, and the core exits when its last client disconnects — whichever order the UIs close in, nothing is left running. `bone --gui` while the desktop app is already running opens the window in that process instead of starting a second one. Configuration lives in `~/.bone/` (or `$BONE_CONFIG_DIR`); sessions are saved in `~/.bone/sessions/`. `BONE_BASE_URL`, `BONE_MODEL`, `BONE_API_KEY`, `BONE_REASONING_EFFORT`, `BONE_SYSTEM_PROMPT`, and `BONE_DATA_DIR` override `core.lua` for one run. `BONE_DEBUG_HTTP=` saves every model request and raw response there (API keys excluded), which is the thing to attach when a provider misbehaves. **Updates.** When bone starts it checks, in the background, for a newer bone and for updated catalog plugins. Installed from npm, it asks to update (bone first, then plugins) and then to restart; on Windows, quit and run `bone update`. Built from a git checkout, it says how many commits it is behind `origin/main` (update with `git pull && scripts/install.sh`). A plugin that needs a newer bone is not offered, or installed by `/catalog`, until bone is updated. "Skip this version" stops asking about that update; `update.check = false` in settings turns the check off. On Windows, `--listen` and `--connect` use `\\.\pipe\bone3-` by default (or the named-pipe path you provide). Only the current user can connect. Shell commands run in `cmd.exe`, and background jobs use ConPTY. ## Desktop shortcut `bone desktop` adds the desktop app to your system: a Start menu and desktop shortcut on Windows, `~/Applications/Bone.app` on macOS (Spotlight, Launchpad, the Dock) and an app menu entry on Linux. The shortcut opens the desktop app from this install, starting in your home folder. `bone update` updates the shortcut's app too. Run `bone desktop` again after changing `PATH` or your Node version, and `bone desktop --remove` to take the shortcut away. ## Building from source You need Rust 1.88+ and a C toolchain (LuaJIT is built from source and compiled into the binary). ```sh scripts/install.sh # builds release, installs ~/.local/bin/bone3 scripts/install.sh --name bone # install as `bone` instead ``` Or `cargo build --release` and run `target/release/bone`. The desktop app is built in by default; add `--no-default-features` for a TUI-only binary. **Windows.** Build with `cargo build --release` in a Rust/C toolchain terminal and run `target/release/bone.exe`. Shell tools use `cmd.exe`; live shell jobs use ConPTY (Windows 10 version 1809 or newer). The default config directory is `%USERPROFILE%\.bone`. **Android/Termux.** Use Clang with its compiler runtime installed. The build finds and links Clang's builtins archive for LuaJIT's instruction-cache flush on its own; no extra `RUSTFLAGS` are needed. For cross builds, set the Android C compiler through `CC_` (for example `CC_aarch64_linux_android`) and the Rust linker as usual. Select Android API 23 or newer for the shell tool's `openpty` support.