›Tuse

Tuse Documentation

Source of truth for Tuse's observable behavior and public contracts. Pages describe how Tuse works today. Planned changes are specified in docs/ first, then implemented.

Getting Started & Interfaces

  • Installation & Updates — Supported platforms, shell installer, building from source, and tuse update.
  • CLI — Executable subcommands, argument parsing, output formats, and exit behavior.
  • Terminal UI (TUI) — Full-screen terminal interface, keybindings, mouse, pickers, panels, links, and steering.
  • Commands — Quick reference for CLI subcommands and TUI slash commands.
  • JSON-RPC Mode (tuse json) — JSON-RPC 2.0 over stdio: handshake, methods, events, and interactive UI requests.

Core Runtime & Providers

  • Sessions & Persistence — SQLite store (~/.tuse/tuse.db), session locks, resume, and TUI/JSON parity.
  • Agent Loop & Tool Lifecycle — Turn execution, streaming, tool calls, cancellation, and recovery.
  • System Prompt — The exact system prompt, the lua tool description and the function reference lines, with the placeholders that drop disabled functions.
  • Prompts, Files & Images — # prompts, @ files/directories, pasted images, and hidden context blocks.
  • Providers & API Client — Provider credentials, four API adapters (openai-chat, openai-responses, anthropic-messages, google-gemini), streaming, reasoning replay, retries, and errors.
  • Providers & Models — Model naming, background discovery, Lua metadata, reasoning effort, and selection scoping.
  • Usage, Cost & Context Compaction — Token accounting, USD cost formulas, display, and 50/25/25 compaction.

Lua Runtime & Extensibility

  • Lua Runtime — Persistent Lua 5.4 VM, coroutine scheduler, module loading, and execution limits.
  • The lua Tool — Single agent tool contract, output handling, diffs, and error behavior.
  • Functions — Built-in host functions (session(), file operations, grep, sh, spawn, UI, llm, reload, docs).
  • Background Tasks — Asynchronous tasks (spawn, task_get, task_stop, task_list), logs, and completion notifications.
  • Hooks — Lifecycle event hooks (start, close, user_message, agent_message, model_change, name_change, lua_start, lua_end).

Configuration & Customization

  • Setup Guide — Step-by-step setup: connecting providers, global and project configs, modular layout, and verifying with /reload and /config.
  • Config — Lua config modules, require resolution, schema keys, strict validation, and /reload.
  • Environment & Config Lookup — Environment variables read by Tuse and config file search order.
  • Theme & UI Settings — The 10-token color theme and settings.ui behavior and layout options.
  • Plugins — Git, local, and bundled (tuse/default) plugins, options, merge rules, and reload sync.
  • Plugin Authoring Guide — Writing, testing, and publishing Tuse plugins.
  • Subscription Proxy (subs) — Optional tuse/default CLIProxyAPI wrapper (/subs), loopback proxy lifecycle, and provider wiring.