Skip to content

Commands Panel

The workspace right sidebar now includes a Commands tab beside Files and Git. It keeps a per-project list of the commands you submit most often in Claude-style chats, so repeated commands stay one click away.

What it tracks

The panel records submitted commands whose final trimmed line is a single non-empty command. Examples:

  • ls
  • claude
  • rm dd
  • /help
  • /review src-tauri
  • /commit

It records commands from both input paths the app supports:

  • PTY terminals in the workspace, by parsing submitted terminal input without counting every keystroke
  • PromptInput-based non-PTY sessions, by tracking successful send_input submits

Only submitted one-line commands are counted. Clicking a saved command later types it back into the focused terminal but does not press Enter.

History-recalled commands

In a PTY terminal, commands you bring back without typing them character by character - arrow-up history recall, Ctrl+R reverse search, and in-place line edits - are also counted. Those keystrokes only send escape sequences over the input stream; the command text itself never travels there, so for them the panel reads the rendered prompt line from the terminal and strips the shell prompt prefix.

Prompt detection is a heuristic: the prefix is taken up to the first prompt symbol ($, #, %, >, , ) followed by a space. If no such delimiter is found (for example, an unusual custom prompt), the command is not recorded rather than recording a polluted line. Right-side prompts (RPROMPT) may be appended to the captured command, since they share the same rendered line.

Project scope and persistence

Command usage is scoped by project_id, not globally.

  • In the Tauri desktop/mobile app, the data is stored in the app config directory in project-ui-state.json.
  • In browser-shim mode, the same shape is persisted in localStorage["hive:project-command-usage"].

Each project stores:

  • command - the full trimmed slash command string
  • count - how many times it has been submitted
  • pinned - whether it should stay at the top of the list

Panel behavior

The table is sorted by:

  1. pinned commands first
  2. higher usage count first
  3. command text alphabetically

Per command you can:

  • Click the command text to type it into the focused terminal
  • Save to Run - copy the command into the Run panel as a custom runner, so it can be launched as a hidden dev-server session with URL detection. Commands move both ways between the two panels - the Run panel has a matching Save to Cmds button that copies a runner back here as a pinned command.
  • Pin / Unpin it
  • Reset its counter to 0
  • Remove it entirely

Long commands are truncated to one line in the table. The full text is still available:

  • on desktop: hover the command
  • on touch devices: long-press the command

At the project level you can:

  • Clear all commands for the active project

Resetting keeps the command in the list (and preserves its pinned state) until you remove it or clear the project.

Frontend integration

  • Parser/helpers: crates/hive-app/src/lib/commandUsage.ts
  • Pinia store: crates/hive-app/src/stores/commandUsage.ts
  • Sidebar UI: crates/hive-app/src/components/sidebar-right/CommandsPanel.vue
  • Rendered prompt-line reader (for history-recalled commands): crates/hive-app/src/composables/useTerminalManager.ts::readPromptCommandLine, registered per session via commandUsage.ts::registerCommandLineReader
  • Tracking hooks:
    • crates/hive-app/src/stores/sessions.ts::send_input
    • crates/hive-app/src/stores/sessions.ts::send_pty_input

Tauri integration

  • Persistence helpers: crates/hive-app/src-tauri/src/project_data.rs
  • Commands:
    • load_project_command_usage(projectId)
    • save_project_command_usage(projectId, entries)

These commands are local app-state operations only; they do not go through the daemon WebSocket protocol.

Hive - remote AI coding agents over WebSocket.