Skip to content
Edit this page View source of this page

TUI

The terminal UI is the default way to use Pegg. Launch it with pegg on a terminal, or explicitly with pegg tui.

Layout

┌──────────────────────────────────────────────────────────┐
│                                                          │
│                    chat transcript                       │
│        (streaming markdown, tool cards, diffs)           │
│                                                          │
├──────────────────────────────────────────────────────────┤
│  attachments                                             │
├──────────────────────────────────────────────────────────┤
│  > input editor                                          │
├──────────────────────────────────────────────────────────┤
│  ● gpt-4o/openai · 12.4K (6%) · $0.0021 · Ctrl+P         │
└──────────────────────────────────────────────────────────┘
  • Chat transcript — user cards, assistant markdown, thinking blocks, tool cards, and subagent cards. With an empty chat, an animated Pegg logo is shown.
  • Attachment bar — appears only when files are attached.
  • Input editor — up to 6 rows tall, with inline chips for skills, mentions, and long pasted text.
  • Status bar — a running indicator (●), the active model as name/provider, reasoning effort when set, the current session mode chip (build/plan/auto), context usage, session cost, and a Ctrl+P hint.
  • Hint line — transient errors and the Press Esc to interrupt hint.

Global keys

Key Action
Ctrl+Q Quit
Ctrl+C Clear the input; on an empty input, press again within 2 seconds to quit
Ctrl+T Cycle to the next theme (saved to config)
Ctrl+P Open Settings
Ctrl+G Start / stop voice input (see Voice input)
Ctrl+Shift+C Copy the selected chat text (or input selection)
Tab Cycle session mode: build → plan → auto (saved to the session)
Esc Interrupt (see below)
Shift+Tab Toggle focus between the input and attachments (when attachments exist)
Mouse wheel Scroll the chat 3 lines
Mouse drag Select chat text (release to keep the selection)
Mouse click Activate the item under the cursor

Interrupting the agent

While a run is active, pressing Esc once shows Press Esc to interrupt. Pressing Esc again within 2 seconds cancels the run and any foreground subagents. Background subagents are not tied to the run context: they keep working, and their task cards stay in the running state until they finish. Pressing it once and waiting lets the run continue.

When the attachment bar has focus, Esc returns focus to the input. While viewing a subagent transcript, Esc goes back to the main chat.

Clearing the input and quitting

Ctrl+C clears the chat input when it has text. When the input is already empty, the first press shows Press Ctrl+C again to quit; a second press within 2 seconds closes the application. Ctrl+Q always quits immediately. The same hint area is used for the Esc stream-interrupt warning.

Input editor

Key Action
Enter Submit
Shift+Enter Insert newline
Left / Right Move the cursor (word-wrap aware)
Up / Down Recall history when the input is empty, otherwise move between lines
Alt+Up / Alt+Down Recall the previous / next message
Ctrl+J Jump to the last line and insert a newline
Home / End Start / end of line
Ctrl+Left / Ctrl+Right Word left / right
Alt+Left / Alt+Right Word left / right
Ctrl+A Select all
Ctrl+E End of line
Ctrl+K / Ctrl+U Delete to end / start
Ctrl+W / Alt+Backspace Delete word
Ctrl+D Delete character forward
Ctrl+Y Paste from the kill ring
Ctrl+Z / Ctrl+Shift+Z Undo / redo (200 steps)
Ctrl+Shift+K Delete line
Ctrl+Shift+Up / Ctrl+Shift+Down Move line up / down
++shift+arrows++ Extend selection

Skills (/name), mentions (@name), and long pasted text are atomic chips: cursor movement and deletion treat each chip as a single unit.

Input history

Sent messages are kept in an in-memory history (the last 200, with consecutive duplicates skipped). Loading a session seeds the history from its stored user messages, so the shortcuts also work after resuming a session. In the input:

  • Up recalls the previous message when the input is empty; Down walks forward again, and Down past the newest entry restores the draft.
  • While browsing history, Up/Down keep walking when the caret stays at the end of the input. Editing or moving the caret ends browsing. Shift+Up/Down continues to extend the selection.
  • Alt+Up/Alt+Down also recall history from a non-empty draft.
  • Recalled messages scroll into view automatically, so multi-line messages stay visible with the cursor at the end.
  • Ctrl+J moves the cursor to the end of the input and starts a new line, useful for appending to a multi-line message.
  • Submitting or clearing the input resets history browsing.

Voice input

Press Ctrl+G or click the [mic Ctrl+G] button on the input border. The first press starts recording; the next press (or the configured maximum duration) stops it and inserts the transcript at the cursor.

  • Streaming models show live partial text above the input as you speak.
  • Final turns are appended to the input as they are recognized.
  • Esc cancels recording or transcription.
  • The spoken language follows the app language; there is no separate STT language setting.
  • A recorder must be available: sox, arecord, or ffmpeg. Override it with stt.record_command in ~/.peggco/pegg.json; use {output} for the file path for non-streaming recording, or omit it to write raw PCM to stdout for streaming.
  • stt.max_duration_secs bounds the recording length and is config-only.

Voice input is available whenever an STT provider and model are selected under Settings → General. There is no separate enable/disable toggle. See Voice input for provider setup.

Skills and mentions

Type / at the start of a word to open the skill picker, or @ to open the mention picker. Both are fuzzy-filtered as you type.

Key Action
Up / Down Move the selection
Enter / Tab Accept the selected item
Esc Dismiss
Space Dismiss and keep typing
  • /skill inserts a skill chip that is expanded to the skill's instructions before the message reaches the model. See Skills.
  • @name inserts a mention chip for an agent, file, folder, or attachment. Mentions are sent to the model as literal @name text for it to interpret. See Adding Context.

Pasting and attachments

There is no system-clipboard integration; pasting uses the terminal's bracketed paste. When you paste:

  • A single line that is an existing file path is attached as a file.
  • A multi-line paste is attached only when every non-empty line is an existing file path; otherwise the text is inserted verbatim.
  • Multi-line text keeps its newlines, blank lines, and tabs exactly as pasted.
  • Text longer than 100 characters is inserted as a collapsible long text chip (the full text, including line breaks, is sent).

Attachments appear in the attachment bar with type icons (image, audio, video, file) and pagination dots. Focus the bar with Shift+Tab, navigate with Left/Right, and remove with Backspace or Del.

Files are copied into the attachment store (os.TempDir()/pegg); the agent is told their paths and reads non-media files (PDF, text, archives, …) from there. Image and audio attachments are rejected if the active model's metadata does not list that input modality.

Chat items

Item Rendering
User message Boxed card, with attachment chips
Assistant message Rendered markdown (headings, lists, quotes, inline styles)
Thinking Collapsible; animated while active, raw reasoning when expanded
Tool call Card with name, enriched target (read:path, bash:cmd, websearch:query, ...), duration, expandable output
Task Boxed card with subagent name, type, prompt, status, live activity, output preview, usage, and a History action
Subagent Card for fork-launched subagents: status, live activity line, output preview, usage, and a History action
Error Bold red ✖ error: ...

While a tool runs, its live activity is shown instead of the target: websearch renders Searching <query> and webfetch renders Fetching <url>.

Selecting and copying text

Click and drag over any chat text to select it; release to keep the selection. Press Ctrl+Shift+C to copy the selection to the system clipboard (via the terminal's OSC 52 support). Card borders and padding are stripped from the copied text. If the input editor has a selection, Ctrl+Shift+C copies that instead.

User message menu

Click a user message (without dragging) to open a small menu. Move the mouse over an option (or use the arrow keys) to highlight it.

Option Action
Copy text Copy the message text to the clipboard
Revert message Delete this message and every message after it, and put the message back into the input
Fork message Create a new session containing the messages before this one, switch to it, and put the message back into the input

A forked session is titled <original title> - fork. Revert keeps the same session; a snapshot of the removed messages is saved so it can be undone. Attachments on the message are restored into the attachment bar along with the text.

Specialized tool cards

  • BASH — command header, live stdout/stderr while the command runs, syntax-highlighted output (30 lines collapsed), exit code footer.
  • DIFF — unified diff for edit calls with added/removed highlighting and a +N -M summary.
  • WRITE — syntax-highlighted file content for write calls.
  • TODO — parsed todo list in submission order, with status icons, descriptions, dependencies, and an N / M completed footer.
  • ASK — question/answer pairs collected from the user.
  • FILES — one box per file delivered by sendfile, with name, size and path. Click a box to open the file with the OS default handler; Enter on the item copies the absolute paths.
  • TASK — one card per task call: subagent name, type, prompt, a background badge, live activity while running, a response preview with expand, and a usage footer. Click History while it runs to open the subagent transcript; the transcript keeps updating after the main agent finishes. Task cards for background subagents stay running after the main agent stops and close with the subagent's result. That response is written back to the task tool message, so restored sessions show it too. When a background subagent finishes, the orchestrator continues automatically — no new message is needed — and the continuation streams into the same chat.

Fenced code in assistant messages is syntax-highlighted for Go, TypeScript, JavaScript, Python, Rust, Bash, C/C++, Ruby, PHP, Swift, Kotlin, Scala, Elixir, Haskell, CSS, HTML, JSON, YAML, Markdown, SQL, R, Lua, and Dart.

Tool card keys

Key Action
Enter / Space Expand or collapse the selected item
] / [ Next / previous item
Up / Down Scroll one line
++pgup++ / ++pgdn++ Scroll one page
Home / End Jump to top / bottom
Shift+Left / Shift+Right Scroll a wide markdown table horizontally (when the prompt is empty)

When a table is wider than the viewport it is kept unwrapped, and a hint at the bottom of the chat shows that more columns exist. With the prompt empty, Shift+Left/Shift+Right reveal the hidden columns and snap between table columns; typing in the prompt keeps those keys for text selection. With the pointer over a table row, the mouse wheel scrolls the table left/right first; once it reaches an edge, scrolling continues vertically. The horizontal wheel works the same way, and the ←/→ markers in the hint are clickable.

Subagents

task calls appear as TASK cards in the main transcript. While the subagent is running, select the card and press Enter, or click History, to open its live transcript. Press Esc or click the back header to return. Fork-launched subagents (which have no task call) still use the standalone subagent card. See Subagents.

Settings

Open with Ctrl+P. The overlay has nine tabs; switch with Left/Right when the tab bar is focused. Press Down to enter the tab content, Up to return to the tab bar.

The whole settings overlay is mouse-driven: click a tab to switch to it, click a row to select and activate it, hover to highlight the row under the pointer, use the wheel to scroll lists or adjust numeric rows, and click outside the dialog to close it. Sub-menus (lists and text fields) respond to clicks too — click an item to choose it, click the field to place the cursor, or click outside to go back.

Tab Contents
General Provider (add or reconfigure), Model (searchable list), STT provider, STT model, Theme, Language, Reasoning effort
Session Load/New/Delete session, Change title, Compaction settings
MCP Connected MCP servers (stdio, SSE, Streamable HTTP) and their tools
Skills Loaded skills with descriptions
Rules Global and project rule files
Plugins Installed plugins with enable/disable toggle
Permissions Preset selector and per-tool permission modes
Memory Memory system: observer model, relevance gating, context budget (see below)
System App name, version, OS, architecture, and manual update check
  • Provider — configure an existing provider again or add a new one by pasting an API key into a masked field. Logging in to Pegg Forever also registers the STT provider and, after the login, shows the recommended defaults for you to apply or skip.
  • Model — type to filter; the active model is marked with ●. When the smart router is enabled, a Smart Router entry appears at the top of the list: it auto-selects the best model for each task and agent at run time.
  • STT provider — choose an STT provider. If it has no saved key, a masked API-key prompt appears; if it is already configured, choose Use existing or Configure again. Keys are stored per provider under stt.providers.
  • STT model — lists models from every configured STT provider. Streaming-capable models show a muted stream label on the right; choosing one makes Pegg use streaming automatically. Selecting a model enables voice input.
  • Reasoning — available only for models that advertise reasoning options.
  • Language — switch between English and Turkish. The choice is saved as the shared language value and also applies to Pegg Desktop; see Localization.
  • Session → Load — sessions from the current directory, newest first. Loading restores the last 50 messages; scrolling to the top loads older messages in batches of 50.
  • Session → Delete — asks for confirmation before permanently removing the session.
  • Session → Change title — edit the generated session title.
  • Session → Compaction — configure context compaction (see below).

Compaction settings

Below the session management rows, the Session tab includes compaction configuration. Navigate to a row with Up/Down. Toggle switches (Enabled and the strategy checkboxes) with Enter or Left/Right; adjust numeric values with Left/Right:

Setting Values Description
Enabled on / off Master toggle for compaction (Enter or arrows)
[x] tool-clearing checkbox Truncate oversized tool outputs (multiple strategies can be active)
[x] sliding-window checkbox Drop older messages past the threshold
[ ] summarization checkbox Summarize history with a dedicated LLM call
Threshold 10%–100% (step 5) Context usage % that triggers compaction
Max messages 5–200 (step 5) Messages kept in sliding-window mode
Max tool output 500–20000 chars (step 500) Truncation limit for tool output

Strategies are independent checkboxes: any combination is allowed, including none (compaction then does nothing until a strategy is re-enabled).

Changes save immediately to ~/.peggco/pegg.json.

Compaction persistence

Compaction does not destroy your history. When the context is compacted, the compacted messages are saved to a new session linked to the current one, forming a chain. The original session keeps every message it had; the newest session in the chain holds the compacted view plus everything said afterwards.

  • Loading a session always opens the newest session in its chain — you see the latest compacted conversation first.
  • Scrolling to the top of the transcript loads the earlier (pre-compaction) conversation, marked with an ─ context compacted ─ divider, and keeps walking back through the chain as you continue scrolling.
  • Resuming a session re-applies compaction to the loaded history (sliding-window and tool-clearing), so resumed conversations stay within the context budget.
  • While chatting, a compacted run shows a ↻ Context compacted (...) item in the transcript.

Permissions tab

The Permissions tab has its own internal navigation. When focused on the tab bar, Left/Right switches tabs. Press Down to enter the presets, Down again to reach the Judge model row, Down again for the Threshold row, and Down a fourth time to reach the tool list. In the tool list, Left/Right cycles the permission mode for the selected tool. Up from presets returns to the tab bar.

Press Enter on the Judge model row to pick which model judges tool calls. The picker lists decision models first (JEV via OpenRouter, marked with the provider and a decision suffix), then every available LLM model across your configured providers. Selecting one writes judge_provider / judge_model to ~/.peggco/pegg.json; choosing a decision model also enables the decision judge by default. See Permissions.

The Threshold row adjusts the decision judge's minimum yes-probability (judge_threshold): Left/Right step it by 0.05, clamped between 0.05 and 1.0, and the value is saved immediately. The row is disabled (and labeled decision only) when the judge provider is not decision-capable.

Memory tab

The Memory tab configures the markdown-based memory system. Press Down to enter the rows, Up/Down to navigate, and Enter or Left/Right to toggle switches and adjust values:

Row Description
Enabled Master switch for memory capture and panel injection (on/off)
Observer Provider/model for memory LLM calls, or default (agent model). Enter opens a searchable picker with decision providers and LLM models
Relevance gating Cycle auto → decision → llm → score → off with Left/Right
Relevance threshold 0.05–1.0, stepped by 0.05. Only active for decision gating (labeled decision only otherwise)
Context budget 500–100000 chars, stepped by 500
Max results 1–10
Consolidate Run the librarian after each run (on/off)
Entries / Last entry Read-only stats from the memory index
Clear memory Deletes all memory files for this project (with confirmation)

All changes save immediately to ~/.peggco/pegg.json and apply live.

System tab

The System tab displays application information (name, version, OS, architecture) and a Check for updates button. Navigate to the button with Down and press Enter to check for a newer version. Status messages appear below the button: "Checking...", "Already up to date", or an error. If an update is available, the update modal opens automatically.

Themes

Pegg ships 26 themes: dark (default), light, dracula, catppuccin-mocha, catppuccin-latte, catppuccin-frappe, catppuccin-macchiato, tokyonight-storm, tokyonight-night, tokyonight-day, gruvbox-dark, gruvbox-light, nord, onedark, solarized-dark, solarized-light, rosepine, rosepine-moon, rosepine-dawn, monokai, monokai-night, monokai-spectrum, kanagawa, kanagawa-dragon, everforest-dark, and everforest-light.

Press Ctrl+T to cycle themes alphabetically, or pick one in Settings → General → Theme. The choice is saved to the theme key in ~/.peggco/pegg.json.

Notifications

  • Update modal — shown at startup when a newer release exists, with Update / Later buttons (Left/Right to choose, Enter to confirm, Esc to skip).
  • Errors — appended to the transcript or shown on the hint line.
  • Transient messages — retry progress (Request failed ... retrying in Xs) and the Esc interrupt hint appear above the status bar.
  • Desktop notifications — permission prompts, agent completions, and agent errors raise an OS notification while the window is in the background. See Notifications.

Session behavior

Each submitted message resumes the active session; if none is active, one is created automatically and titled by a background model call. Switching sessions while a run is active leaves that run going in the background; switching back reattaches to its live stream. See Sessions.

Limitations

  • No system clipboard copy/paste — use the terminal's own selection.
  • No session fork or revert from the UI (available programmatically via the SDK).
  • No command palette; Settings (Ctrl+P) and the inline / and @ pickers cover the same ground.