TUI Commands
LeanCTL's full-screen terminal UI supports slash commands, keyboard shortcuts, file attachments, and inline shell commands.
Slash Commands
Type / or press Ctrl+P to access commands. Commands are organized by category.
Sessions
| Command | Shortcut | Description |
|---|---|---|
/new | Ctrl+N | Start a new conversation |
/sessions | Ctrl+S | Browse past sessions |
/resume <n> | Resume session by number | |
/delete <n> | Delete a session | |
/export | Ctrl+X X | Export chat as markdown |
Models & Providers
| Command | Shortcut | Description |
|---|---|---|
/model | Ctrl+L | Open model picker |
/model <name> | Switch to a specific model | |
/model <provider>/<model> | Switch provider and model | |
/connect | Setup guide for all providers | |
/connect list | Show configured providers | |
/connect test | Test current connection | |
/connect add <name> --type <type> | Add a new provider | |
/thinking <mode> | Set thinking mode: auto, always, never, manual |
Tools & MCP
| Command | Shortcut | Description |
|---|---|---|
/mcp | Show MCP server status | |
/mcp add <name> <cmd> | Add MCP server | |
/mcp reload | Reconnect all servers | |
/verbose | Ctrl+E | Toggle tool detail output |
Code & Git
| Command | Shortcut | Description |
|---|---|---|
/diff | Ctrl+X D | Git diff of session changes |
/undo | Ctrl+X U | Undo file changes (git restore) |
/redo | Ctrl+X R | Redo undone changes |
Context & Savings
| Command | Shortcut | Description |
|---|---|---|
/context | Show context token usage | |
/compact [focus] | Ctrl+X C | Compress conversation to save tokens |
/cost | Show API cost & token savings | |
/stats | Token savings statistics (today) | |
/wrapped [period] | Savings report (day/week/month) | |
/knowledge [query] | Knowledge base status or search | |
/benchmark [file] | Token compression benchmark | |
/lab [key value] | Tune lean-ctx compression parameters |
Settings
| Command | Description |
|---|---|
/yolo | Toggle auto-approve for all tool executions |
/theme <name> | Switch TUI theme (or open theme picker) |
/init | Create LEANCTL.md project instructions file |
/sidebar | Toggle sidebar visibility |
/verbose | Toggle detailed tool output (alias: /details) |
/lab [key value] | View or tune LeanCTX compression parameters |
/clear | Clear conversation (keep context) |
/exit | Quit LeanCTL |
Custom Commands
Any /command that doesn't match a built-in will look for a markdown file in .leanctl/commands/ or ~/.leanctl/commands/. The file content is sent as a prompt with $ARGUMENTS replaced by the command arguments. See Configuration for details.
Keyboard Shortcuts
General
| Key | Action |
|---|---|
Enter | Send message |
Shift+Enter | New line in input |
Ctrl+C | Quit (with confirmation) |
Ctrl+D | Quit immediately |
Esc | Cancel current action (press twice) |
Tab | Toggle Build/Plan mode |
Navigation
| Key | Action |
|---|---|
Ctrl+N | New session |
Ctrl+S | Browse sessions |
Ctrl+L | Model info / picker |
Ctrl+P | Command palette |
Ctrl+B | Toggle sidebar (files in context) |
Ctrl+T | Expand thinking output |
Ctrl+E | Toggle tool details |
Ctrl+O | Open external editor ($VISUAL or $EDITOR, fallback: vim) |
PageUp / PageDown | Scroll chat |
Text Editing
| Key | Action |
|---|---|
Alt+←/→ | Jump by word |
Ctrl+A | Move to line start |
Ctrl+W | Delete word backwards |
Ctrl+K | Delete to end of line |
Ctrl+U | Delete to start of line |
Quick Actions (Ctrl+X, then key)
| Sequence | Action |
|---|---|
Ctrl+X N | New session |
Ctrl+X L | Session picker |
Ctrl+X Y | Copy last message |
Ctrl+X X | Export chat |
Ctrl+X C | Compact context |
Ctrl+X D | Git diff |
Ctrl+X U | Undo |
Ctrl+X R | Redo |
Ctrl+X S | Toggle mouse scroll |
Ctrl+X Q | Quit |
Inline Features
File attachments with @
Reference files in your prompt to include their content as context:
@src/auth.ts fix the token validation bug
@package.json @tsconfig.json update the build config Multiple @ references can be used in a single prompt.
Shell commands with !
Run a shell command and attach its output to your prompt:
!npm test — fix the failing tests
!git log --oneline -5 — summarize recent changes Model Picker
Press Ctrl+L or type /model to open the interactive model picker. It shows:
- All configured models from your
[[providers]]registry - Local Ollama models (auto-detected)
- Provider type and tier indicators
Type to filter, use arrow keys to navigate, and press Enter to select.
Build & Plan Modes
Toggle between modes with Tab:
- Build mode (default): The AI has access to all 23 tools — read, write, edit, run commands, git, web, etc.
- Plan mode: The AI only has access to read-only tools (no writes, no command execution, no task). It analyzes your request and proposes a plan without making changes.
Permission Dialog
When the AI wants to edit a file or run a command, a permission dialog appears showing:
- The tool name and permission level
- A diff preview for file edits (unified or split view for wide terminals)
- Three options: Allow (a), Always Allow (s), or Deny (d)
"Always Allow" grants permission for that tool for the rest of the session. Use /yolo or leanctl --yolo to skip all dialogs.
Sidebar
Toggle with Ctrl+B or /sidebar. Shows "Files in Context" — all files the AI has read during the session, extracted from read_file tool calls.
Session Picker
Press Ctrl+S or type /sessions to browse past sessions. The picker supports:
- Resume a previous session
- Search sessions by title
- Rename sessions
- Delete sessions
Undo & Redo
LeanCTL uses git stash internally for undo/redo. When you type /undo, it restores files to their state before the AI's last changes. /redo re-applies them. Requires a git repository.
Use /undo msg to remove the last chat message without reverting file changes.
Adding Providers via /connect
The /connect command provides an interactive way to add and manage providers without editing config files:
# Setup guide
/connect
# Add a provider interactively
/connect anthropic
/connect openai
/connect ollama
# Add with full parameters
/connect add myserver --type openai --url https://my-api.com/v1 --key sk-... --model gpt-4.1
# Test connection
/connect test
# List all providers
/connect list
# Remove a provider
/connect remove myserver