Terminal & CLI

Watch the agent run commands in a branded VS Code terminal, hand terminal output to the chat, and run the full LocalPilot agent from any shell with the `localpilot` CLI.

Ask AI about this page

The agent in your terminal

When the agent runs a command (run_command), it executes in a visible, branded LocalPilot Agent terminal through VS Code’s shell integration. You watch the command run live — with the shell’s own prompt, colours and exit-code markers — while the agent receives the captured output and exit code.

The LocalPilot Agent terminal running npm test twice — failing before the fix, passing after — while the chat shows the captured exit codes and “1 file changed”

Setting Default Purpose
localpilot.terminal.runInIntegratedTerminal true Run agent commands in the visible LocalPilot Agent terminal
localpilot.terminal.reveal true Show the terminal panel (without stealing focus) when a command runs

Terminal output as context

LocalPilot records the commands you run in any VS Code terminal (via shell integration), so the last command and its output are one click away:

The localpilot CLI

localpilot is the complete LocalPilot agent for the shell — the same agent loop, tools, skills, memory, MCP servers and change tracking as the extension, running under Node against your local model servers. Nothing is sent anywhere else.

The localpilot CLI running inside the branded LocalPilot terminal: it edits math.js, runs npm test, prints a summary and lists the changed file

Getting it

Usage

localpilot "fix the failing tests in src/api"     # one task in agent mode, then exit
localpilot                                        # interactive session (REPL)
localpilot --ask "how does the retry logic work?"
localpilot --plan "migrate the auth module to JWT"
localpilot -f src/db.ts "add connection pooling"   # attach files (path#L10-L20 for a range)
localpilot --yes "update all deps and run tests"   # auto-approve commands/edits (CI, scripts)
localpilot -p "summarise this repo" > NOTES.md     # print only the final answer
git diff | localpilot --ask "review this diff"     # piped stdin becomes the prompt
localpilot -m ollama/qwen3:8b "…"                   # pick a model for this run
localpilot models                                 # models from every reachable server
localpilot doctor                                 # servers, settings, skills, MCP, ripgrep
localpilot --ide "…"  ·  --settings  ·  --setup   # hand off to VS Code

In a session: /mode agent|ask|plan, /model <name>, /models, /changes, /undo, /keep, /file <path>, /clear, /doctor, /exit. Ctrl+C stops the current run; press it again to quit.

Approvals

Every command, file edit, delete and network call goes through the same approval policies as the extension (localpilot.approvals.*). When a policy says ask, the CLI shows the command or diff and prompts [y]es · [n]o · [a]lways this session. --yes approves everything; without a TTY (CI) anything that needs approval is denied unless --yes is given.

Edits are tracked per run: a one-shot run prints the changed files at the end; in a session /undo reverts them and /keep accepts.

Settings

The CLI reads, in order: VS Code’s user settings.json, the workspace’s .vscode/settings.json, ~/.localpilot/config.json, then flags. So a model server configured in LocalPilot Settings is already known to the CLI. Changes made from the CLI (/model) are saved to ~/.localpilot/config.json, never to VS Code’s settings. Logs go to ~/.localpilot/cli.log.

~/.localpilot/config.json uses the same keys without the localpilot. prefix:

{
  "providers": [{ "id": "ollama", "type": "ollama", "baseUrl": "http://localhost:11434" }],
  "defaultModel": "ollama/qwen2.5-coder:7b",
  "approvals": { "terminal": "ask", "write": "always" }
}

The CLI’s --ide, --settings and --setup flags use LocalPilot’s URI handler, which you can call from anything: vscode://localpilot.localpilot-agent/run?mode=agent&prompt=…, /new, /settings?section=providers, /setup, /terminal?run=localpilot%20--help.