The Perspt Book 0.6.7
On this page

Basic Usage

Choose full-screen chat, plain terminal chat, or a coding task. Chat modes support conversation; agent mode edits a candidate copy and runs project checks.

Launching the TUI

# Auto-detect provider from env keys
perspt

# Explicit model (provider comes from config or env detection)
perspt chat --model claude-fable

# Use a specific config file
perspt --config ./config.toml chat --model gpt-5.5

The TUI provides:

  • Markdown rendering (code blocks, headers, lists, bold, italic)
  • Premium ASCII table rendering with multi-line cell wrapping
  • Inline LaTeX math transpilation to styled Unicode equations (bold and cyan)
  • Real-time response streaming
  • Scroll navigation
  • Status bar (provider, model, streaming indicator, and reasoning toggles)

Keyboard Shortcuts

Key Action
Enter Send message
Ctrl+J Insert newline in input
Page Up / Down Scroll chat history by 10 lines
Shift+Up / Down Scroll chat history by 1 line
Ctrl+Up / Down Scroll chat history by 1 line
Home / End Go to start / end of input line
Ctrl+C / Ctrl+Q Quit
Ctrl+R Toggle inner reasoning process display
Ctrl+A / Ctrl+E Go to start / end of input line
Ctrl+B / Ctrl+F Move cursor left / right
Ctrl+D / Ctrl+H Delete / Backspace character
Ctrl+K / Ctrl+U Kill to end / start of line
Ctrl+W Delete word before cursor

Slash Commands (Directives)

Both CLI and TUI modes support slash commands typed directly in the input box:

Command Description
/exit or /quit Exit the application session
/clear Reset the active conversation history
/model <name> Switch the active LLM model on the fly
/save <path> (TUI only) Export full conversation history to a markdown file
/mcp (TUI only) Show MCP configuration state, discovery failures, policy rejections, and admitted operation names without contacting the model
/mcp accept [JSON], decline, or cancel (TUI only) Answer a pending MCP elicitation request
/help Print the menu of available slash commands

The chat TUI can use latest MCP tools, resources, prompts, completions, sampling, elicitation, subscriptions, and tasks from any [[external_tools]] server entry in config.toml with modes = ["chat"] or modes = ["agent", "chat"] is considered for read-only admission. Every allowed remote tool also needs an exact local policy table. Tool activity is shown as a concise transient status only while a call is active. MCP protocol events, arguments, results, discovery notices, and subscription traces do not become conversation or reasoning content. The selected model chooses an admitted tool automatically when needed; /mcp is the explicit diagnostic surface. Tool results are labeled as untrusted content before returning to the model. Ctrl+R continues to control genuine model reasoning, including tool-aware turns. Unicode and multiline terminal clipboard paste is inserted at the input cursor. See Model Context Protocol (MCP) for configuration and the security boundary.

Simple CLI Mode

For line-oriented chat with optional session logging:

perspt simple-chat
perspt simple-chat --model gpt-4o-mini
perspt simple-chat --log-file session.txt

Type your message, press Enter. Responses stream to stdout. Type exit or press Ctrl+D to quit.

Piped input is line-oriented. Each non-empty line becomes a separate message. The command takes no positional prompt, and stdout includes a banner, input echoes, and session messages as well as responses. It does not combine a multiline file into a single prompt or provide a response-only output mode.

Autonomous Agent Mode

For complex software engineering and coding jobs that require self-stabilizing, multi-file edits:

perspt agent "Implement a parsing logic for custom CSV formats in src/csv.rs"

The default run uses one work node. The agent edits a candidate copy, measures project checks, and requests promotion approval for a deliverable result. See Agent Mode for review, verification policies, and optional parallel dispatch.

Provider Auto-Detection

Perspt checks environment variables in this priority order:

Env Variable Provider Default Model
VERTEX_PROJECT_ID Vertex AI vertex::gemini-2.5-flash
GEMINI_API_KEY Gemini gemini-3.1-flash-lite-preview
OPENAI_API_KEY OpenAI gpt-4o-mini
ANTHROPIC_API_KEY Anthropic claude-3-5-sonnet-20241022
GROQ_API_KEY Groq llama-3.1-8b-instant
COHERE_API_KEY Cohere command-r-plus
XAI_API_KEY xAI grok-beta
DEEPSEEK_API_KEY DeepSeek deepseek-chat
(none) Ollama (local) llama3.2

See Providers for full provider details.