mattriley.tools
Back to tool index

Homebrew Tool

panda

Modular Rust coding harness with a native macOS sandbox

Version: 0.1.26
Binaries: 1
Platforms: 1
License: Undeclared

Install

brew install matt-riley/tools/panda

README

Panda

Panda is a Rust coding harness with a macOS terminal host. It streams model replies, runs workspace tools under Seatbelt, and saves conversations locally. The core and coding crates can also run inside another host. The initial plan describes the boundaries and release checks.

The resume picker searches the current workspace by session ID, title, or transcript. Ctrl-R renames the selected session, Ctrl-D opens a deletion confirmation, Ctrl-S cycles newest/activity/name ordering, Ctrl-N filters to named sessions, and Ctrl-P shows the workspace path. Switch away from the active session before deleting it.

In the session tree, Tab cycles default, no-tools, user-only, labeled-only and all entries. Ctrl-L jumps to labeled entries. Tool calls, results, reasoning and internal events are available for inspection. Prompts, completed answers, branch summaries and imported metadata/checkpoints support navigation.

Offline session transfer on Linux

Install the CLI from this checkout with cargo install --locked --path crates/cli. From the destination workspace, run panda --import-session session.jsonl. Use the returned session ID with panda --export-session ID exported.jsonl. Both commands accept --session-dir DIR for a separate private session store. Interactive coding sessions currently require the macOS host.

Run on macOS

Install the Intel or Apple Silicon release with brew install matt-riley/tools/panda. Check the installed version with panda --version.

From this checkout, install the terminal binary with a Rust toolchain that supports edition 2024 and standard-library file locks.

cargo install --locked --path crates/cli
cd /path/to/repository
panda

For DeepSeek or OpenRouter, set DEEPSEEK_API_KEY or OPENROUTER_API_KEY in the launching shell. Panda defaults to DeepSeek. Select a provider and model with :model openrouter openai/gpt-4.1-mini. To retain a configured key for future sessions, use :login deepseek or :login openrouter.

Panda supports native Anthropic Messages, OpenAI Responses and Gemini alongside Codex subscriptions. Use a virtual model to route individual requests to the configured physical providers. Provider and routing guide

Register OpenAI-compatible endpoints in $PANDA_HOME/models.json (the default state directory is ~/.panda). Each model sets its context window, output ceiling and accepted inputs. Prices are US dollars per million tokens. Omitting a price leaves the corresponding cost unknown. For example:

{
  "providers": {
    "local": {
      "baseUrl": "http://127.0.0.1:8080/v1",
      "models": [{
        "id": "vision",
        "name": "Local Vision",
        "input": ["text", "image"],
        "contextWindow": 32768,
        "maxTokens": 4096,
        "cost": {"input": 1, "output": 3, "cacheRead": 0.1, "cacheWrite": 1.2}
      }]
    }
  }
}

Set apiKey to an uppercase environment variable name for authenticated endpoints. Run panda --list-models to inspect the catalogue. Use panda --models 'local/*,other/fast:high' or :scope PATTERNS to limit the model picker and cycling. Press Ctrl-P or enter :cycle prev to cycle. Check :auth for credential status. :logout PROVIDER removes the saved key and disables that provider until its next login.

Panda resumes each branch with its own provider, model and thinking level. Pi JSONL exports retain the model that answered each turn, including one-shot overrides. :usage lists requests, retries and summaries with their reported or catalogue-derived costs. It reports unpriced requests separately.

Set "request": {"maxRetries": 2, "timeoutMs": 60000} in Panda's settings.json to limit retries and each provider attempt. The project settings file can replace the request policy. Defaults are three retries and no Panda deadline. Use :settings reload to apply edits. In models.json, a Responses endpoint accepts "transport": "sse" (default), "websocket", or "auto". Auto falls back to SSE if the upgrade is unsupported, before sending a generation request.

Use :warm to submit the current prompt prefix once. The command leaves the transcript alone, ignores any returned tool calls, and records the provider's usage under warm. Cache admission depends on the provider. In the loopback pricing fixture a warm request cost $0.000300 for 100 input and 10 output tokens. Panda only warms on request.

For ChatGPT Codex, enter :login, choose OpenAI Codex, then choose Open browser or Use device code. After signing in, enter :model to search the models from configured providers. Type to filter, move with ↑ or ↓, press Enter to select, or Esc to cancel. GPT selections use your Codex subscription. Use :login openai to start Codex sign-in directly. The Rust binary handles authorization, token refresh, streaming and tool calls. Panda reads existing subscription credentials from the same private SQLite database.

Use a session

Run panda --scrollback to keep prompts and streamed replies in your terminal’s scrollback. Add --continue to reopen the latest session. Kitty and iTerm2 can also display PNG attachments and tool results inline. Terminal preferences

Run panda "Review this change" in an interactive terminal to send the first prompt immediately and keep the session open for follow-ups. Use panda --print "Review this change" for a single answer. A positional prompt also runs once when a stream is redirected or when you supply a print/JSON-only option such as --no-session.

The interactive prompt starts in Vim Insert mode. Press Esc for Normal mode, use motions such as w, b, 0 and $, and edit with cw, dw or u. Press i to insert again. Enter sends the prompt. Alt-Enter inserts a newline in terminals that report the shortcut. Multiline paste stays in the editor until you submit it.

The full-screen UI renders Markdown as replies stream, including headings, lists, emphasis, inline code and fenced code. Panda uses the same styles and wrapping to render saved Markdown when you reopen a session. Page Up and Page Down scroll the transcript while you edit. Successful file edits show a coloured, numbered before-and-after excerpt with context. The prompt sits between two rules, with the workspace and Git branch, session mode, latest reported input/output token counts, and selected model below it. The lower-left footer shows the Vim mode. Press Esc, type a command such as :q, and press Enter. In either the idle or steering prompt, typing :mo shows :model and :models above the command line. Tab completes the first match and cycles forward, Shift-Tab cycles backward, and Enter runs the displayed command. Esc cancels the command and restores the draft. Existing slash commands still work. The steering prompt shares the idle editor’s Vim motions, operators, and undo history. Set NO_COLOR=1 for monochrome. Use :tools for full tool results.

  • :plan enables directory listing, file discovery by glob, paginated literal and regex search, file reads, skill lookup and conversational clarification. Type :code to enable edits, writes and shell commands.
  • :resume opens a searchable picker for this workspace. Type part of a name, prompt, or reply to see matching sessions and a conversation preview. Use ↑/↓ to preview another result, Enter to resume, or Esc to return. In piped input, bare :resume lists sessions. :resume ID reopens one and displays its transcript and mode. Ctrl-C interrupts an active turn. :quit closes Panda.
  • After an interrupted turn, inspect the workspace and use :ack to close outstanding calls with an unknown outcome. Panda never reruns the old call during resume.
  • Panda loads $PANDA_HOME/AGENTS.md and instructions from the Git root down to the launch directory. Its instructions tool reads the applicable nested files for a workspace path. Panda discovers Markdown skills in workspace and user skill directories. Set PANDA_SKILL_ROOTS to add colon-separated directories.
  • Workspace tools inherit a private scratch home, restricted filesystem access, and a network-denying macOS profile. System commands and Xcode build tools are available. Set PANDA_TOOLCHAIN_DIRS to colon-separated, trusted toolchain installations to grant read access and add their bin directories to the tool PATH.
  • PANDA_HOME defaults to ~/.panda. This private directory holds the SQLite session database, model selection, and any stored credentials. Install Panda outside repositories you let it edit.

Prompt, tools and sessions

Edit results retain the numbered text diff. JSON events and saved sessions also expose firstChangedLine (one-based, null for a no-op) and an ordered patch of replacement strings and half-open UTF-8 byte ranges in the original file.

In plan and code mode, read accepts UTF-8 text files and images. PNG, JPEG, GIF and WebP images can be up to 8 MiB each. Panda recognizes images by their contents and sends the original bytes to the model. Use offset and limit for text line ranges. In Codemode, tools.read({path: "diagram.png"}) returns an image block with type, mimeType, base64 data and a short note. Call image(block) between text(...) calls to select and position the image. Explicit images are saved under .panda/ and their paths appear in the result. Scripts that omit image() retain automatic read attachments. The encoded image budget is 12 MiB per script.

In code mode, shell accepts an optional whole-number timeout from 1 to 600 seconds and defaults to 120 seconds. A timeout or cancellation stops the shell and its process group. A descendant that has left the group can continue running under the same sandbox permissions and can still change workspace files while you review the diff. When combined stdout and stderr exceed 64 KiB, the result includes the exit status, the last 64 KiB and the workspace-relative path to a full log under .panda/. The log stays in the workspace after Panda exits. Use read or Codemode’s tools.read with offset and limit to inspect earlier lines.

In code mode, edit accepts a single {"path":"src/app.rs","old":"before","new":"after"} replacement or a batch such as {"path":"src/app.rs","edits":[{"old":"fn check()","new":"fn verify()"},{"old":" check();","new":" verify();"}]}. Each target must occur exactly once in the original file. Edits may be listed in any order. A valid batch writes the file once and returns one numbered diff. A missing, ambiguous, or overlapping target rejects the entire batch.

To do this In Panda
Attach a workspace file Type @src/main.rs, or @"path with spaces". Press Tab in Insert mode for completions. For large files, ask Panda to read a range of lines.
Send an image Attach a PNG, JPEG, GIF or WebP by path, or use Ctrl-V in Insert mode or :paste for a macOS clipboard image. :detach clears the pending clipboard image. Select a model that accepts images.
Edit a longer prompt Press Ctrl-G in Insert mode. Panda opens the draft in $VISUAL, $EDITOR or vi. Save and close the editor to return.
Recover from a temporary provider failure By default Panda retries a transient failure up to three times before streaming begins. The countdown appears above the prompt. Ctrl-C cancels it. Completed tools are never replayed by the retry.
Redirect an active turn Type a correction and press Enter. Panda delivers it after the current batch of tools finishes. Alt-Enter queues a follow-up after the answer. Alt-Up brings queued text back into the draft.
Copy a reply Use :copy or Ctrl-X in Insert or Normal mode to copy the last completed reply on the active branch as original Markdown. During a turn the command runs when Panda returns to the prompt.
Inspect output Shell output appears as it arrives. During a turn the activity timer sits above the steering prompt. Ctrl-O at the prompt expands tool results, :tool ID toggles one and Ctrl-T shows or hides reasoning supplied by the model.
Run a shell command yourself In code mode, !git status adds the command and result to the conversation. !!git status displays it locally. Both use the workspace sandbox.
Explore another approach Open :tree, type to filter, and select an earlier prompt to edit it in Insert mode. Submit it to start a sibling branch in the same session. To try a revised prompt in a separate session, highlight the prompt and press Ctrl-F. The child opens with the earlier history and the selected prompt ready to edit. Press Enter to send it. In the tree, Shift-L edits the highlighted entry’s label. Submit an empty label to clear it, or press Ctrl-C to cancel. Ctrl-L toggles the labeled-only view and works alongside the text filter. Labels survive Pi JSONL export and import. Enter switches immediately. Press s on a selected entry to summarize the branch you are leaving and carry its findings into the destination. Press Shift-S to guide that summary, then Enter to submit or Esc to return to the same selection. Use / to filter the tree, then ↑/↓ to select or Ctrl-S to summarize the match. Ctrl-C cancels generation. Select a completed answer to continue from it. Esc closes the picker. Both paths survive quitting and resuming. Navigation changes conversation history only. Workspace files keep their current contents. :fork 2 alternative starts a session at the second completed answer. :clone NAME copies the current conversation.
Return to a session :resume ID or :resume NAME opens a session in the current workspace. panda --continue opens the most recently modified session for that workspace. Creating or saving a session makes it current. Browsing and exporting preserve that order.
Manage context :context shows projected bytes, estimated input tokens and the input budget. Before each model request, including after a tool batch, Panda uses the latest reported token usage plus an estimate for new messages. It reserves a quarter of the context window for the reply, capped at 16,384 tokens. An unknown window defaults to 65,536 tokens. :context BYTES sets an additional byte threshold. :compact [instructions] summarizes earlier conversation for the model while preserving the transcript on disk. Use it alone for the default summary or give it a focus, for example :compact Keep the rollout decision and open questions.
Choose a model :models openrouter deepseek filters the provider catalogue. Use :model NUMBER to select a result. Use :effort to choose a reasoning level, or enter it directly with :effort high. :thinking is an alias. Codex choices come from the selected model’s catalogue entry.
Use a Markdown skill Search with :skills QUERY and invoke one with :skill:NAME task. Panda shows the selected path.

Panda first tries a verified extractive handoff for manual, automatic and overflow checkpoints. It uses the optional TYPESAFE_API_KEY for Jev judgments and masks credentials before sending any text. Without a key, or if judging fails, times out or rejects the handoff, a manual or hard checkpoint uses the current chat provider’s summarizer. Panda can defer compaction at the soft threshold until the next clean boundary. Both strategies preserve the branch and save a private recovery transcript only when a new checkpoint commits.

  • :compact [guidance] adopts a checkpoint. :compact preview [guidance] displays the candidate and leaves session history and recovery storage untouched. Esc cancels a preview in the terminal.
  • :compact info and :context report usage, effective thresholds, prompt section estimates and the visible tool declarations. Looking at context makes no judge requests.
  • view_context() returns the same diagnostics. self_compact({note?}) schedules a checkpoint at the next safe boundary. Panda records the note as model-authored data. Both tools follow the selected tool policy, including --tools and --no-tools.
  • Set compaction.softAt, hardAt, cacheAt (percentages) and cacheForMinutes in user or project settings. Their defaults are 50, 70, 70 and 30. The hard threshold is capped at 90% of an effective window of at most 300,000 tokens. A cache duration of zero disables the warm-cache hold. Override one invocation with --compact-soft-at, --compact-at, --compact-cache-at or --compact-cache-for.

The paired synthetic fixtures measure instruction retention, factual accuracy, recoverable pointers, size and request costs. Compaction comparison

To keep recent exchanges verbatim during manual and automatic compaction, set an estimated token budget in $PANDA_HOME/settings.json and restart Panda. This example keeps up to 20,000 estimated tokens.

{"compaction": {"keepRecentTokens": 20000, "modelOverrides": {"deepseek/deepseek-chat": {"keepRecentTokens": 8000}}}}

The active provider/model override takes precedence over the global setting, including an explicit zero. An invocation-level --keep-recent-tokens overrides both.

The verified planner uses a 20,000-token retention target by default and keeps the latest exchange intact, including tool calls and results. It advances older history in groups of up to 400 visible segments. A zero target keeps only the latest whole exchange. Provider fallback preserves the existing retention behavior. A bare manual request can cover all eligible history, and automatic requests use the model-based budget.

Compaction keeps a sorted list of files read and files modified alongside the summary. A successful edit or write moves a path into the modified list. Successful reads, edits and writes inside Codemode count even if the script later throws. The lists survive reopening and Pi JSONL export and import.

If a provider stops for length before using its output allowance, Panda saves the partial reply in the transcript and retries once. It can compact older exchanges before retrying. The retry carries the current prompt and completed tool results forward. Tool calls from a truncated reply never run. If the provider used its full allowance or the token count or limit is unknown, the turn ends with a length error. A follow-up uses the completed conversation.

Panda sends an explicit output limit for supported DeepSeek models and for OpenRouter models with an output limit in the cached catalogue. Refresh the OpenRouter catalogue with :models openrouter. For a Codex subscription, Panda uses the limit and usage returned with an incomplete response.

Codemode

Panda enables Codemode by default in interactive, print, JSON and RPC sessions. In code mode, scripts can create files with tools.write({path, text}) and update them with tools.edit({path, old, new}). Plan mode exposes read-only helpers. For example, ask “Rank the five files with the most TODO lines.” The script can count matches across all search pages and return only the ranking. Use --no-codemode to disable JavaScript composition. Existing invocations with --codemode still work.

For print and JSON runs, --codemode-only makes codemode the sole tool the provider can call. Scripts use the helpers permitted by the session mode and tool selection. Use panda --print --codemode-only --tools read "Read version.txt" to allow just one nested helper, or panda --mode json --codemode-only --tools codemode,read,search "Rank TODOs by file" to allow two. Listing codemode is optional with this flag. An explicit --no-tools still disables all tools.

ALL_TOOLS lists the current script’s callable helpers as {name, description} entries. searchTools("find matching lines", {limit: 1}) ranks those entries by relevance. The default limit is eight. Pass a returned name to describeTool(name) for its description and typed signature, or to tools[name](args) to call it. Discovery runs synchronously inside the worker and uses no nested calls. With --tools codemode,read, the catalog contains only read, and describeTool("search") returns undefined.

Use --defer-tools NAME[,NAME...] to expose tools after the model calls tool_search with a matching query. Discovery follows the saved branch. --hide-tools removes names from direct calls, search results and Codemode. Both flags respect the current mode and selected tools. Within Codemode, describeNamespace("workspace") lists allowed workspace helpers. Inline helper descriptions use a 12,000-byte budget.

Concurrent reads run in groups of up to four. Mutations wait for earlier calls and complete before later calls begin. Results retain the provider’s order. --steering-mode one and --follow-up-mode one deliver one queued message at each eligible boundary in terminal and RPC sessions. Both default to all.

Use await Promise.allSettled([asyncTools.read({path:"a"}), asyncTools.read({path:"b"})]) to read concurrently and receive each outcome. A first-line // @options: {"async":true} gives the same Promise interface to tools. Up to four workers share slots across sessions for the current user, and each worker admits four nested reads at once. Waiting for a slot ends after three seconds or the script deadline, whichever comes first. An unresolved promise without pending work fails immediately. Cancelling a script stops active reads, and exiting discards unstarted reads.

Each invocation starts a fresh QuickJS worker under macOS Seatbelt. Read helpers are available in both modes. For example, tools.repo_map({glob: "**/*.rs"}) lists Rust files and tools.search({query: "^pub fn ", regex: true, glob: "src/**/*.rs"}) finds matching lines under src/. Search defaults to case-sensitive literal text. For example, tools.search({query: "todo", ignoreCase: true, context: 2}) finds mixed-case TODOs and returns up to two lines on each side. ignoreCase also works with regular expressions. Globs match workspace-relative paths: * stays within one path component and **/ matches zero or more directories.

tools.ls() lists the workspace root. Pass {path: "src"} to list the immediate entries in a directory. Each item contains its name and type (file, directory, symlink, or other). Listings include dotfiles and ignored names, report symlinks without following them, and return up to 50 entries in lexical order. Pass next_offset back as offset with the same path for the next page. An empty directory returns an empty page. A missing path produces an error.

Use tools.list_models({}) to inspect locally configured and cached models. Pass {model: "provider/model"} to check one model. The host reports credential availability and inference capabilities. Enable classification or image generation on a model in the personal models.json by adding "inference": ["classify"] or "inference": ["generate_image"]. These helpers use OpenAI-compatible structured Chat Completions and base64 PNG image generation respectively. For image classification also declare "input": ["text", "image"].

This code-mode script classifies the image it generates and displays it once.

// @options: {"timeout_ms":120000}
const labels = ["diagram", "photograph"];
const drawing = tools.generate_image({model: "studio/art", prompt: "Draw a circuit diagram"});
text(tools.classify({model: "studio/vision", labels, image: drawing}));
image(drawing);

For JSON classification, pass input in place of image. The host resolves credentials and records each request under classify or generate_image in :usage. The default script deadline is 10 seconds. Scripts with an enabled inference helper can request up to 180 seconds.

Use tools.shell_result({id}) to inspect a completed shell call on the active branch. The result includes output, exitCode, cancelled, truncated, and, when recorded, elapsedMs and fullOutputPath. For a truncated result, pass the log path to tools.read({path, offset, limit}) to retrieve specific lines. Older sessions can lack structured results.

Use the optional workspace-relative path on search and repo_map to select one directory or file. Returned paths and glob patterns are relative to the workspace root. Search and map honor workspace and nested .gitignore rules before returning up to 50 matching items per page. A later ! rule can re-include a file if its parent directories are visible. Pass next_offset back as offset with the same arguments until it is null. Search items contain path, one-based line, and text. A positive context adds before and after arrays of text in file order, clipped at file boundaries. Each line is limited to 500 characters. Only matching lines count toward the offset. A context-heavy page can end early to fit the 1 MiB tool-result limit. Map items are paths. Use text(value) to select the text included in the saved tool result and the next model request. Nested calls appear live in the terminal and as nested_call events in JSON and RPC.

Scripts run as async function bodies. For example, return tools.read({path: "version.txt"}) reads the file once and returns its text. A returned value is awaited and appended after earlier text() calls using the same serialization, preview, and total byte limit. A bare return or return undefined adds no output. Call exit() to finish the script immediately with the output and stored values accumulated so far. An uncaught error or rejected return rolls back pending store() writes. File writes and edits take effect when their helper succeeds. A batch containing either runs in submission order.

Use console.log("searched", offset) to record which pages a script visited. log, info, warn, error, and debug join their arguments with spaces. Their lines appear in call order in a single <console_output> block after the text and return value. On a throw, the diagnostic follows the block. The block and its delimiters count toward the same preview and output limits as other text.

Use store("rank", {cursor: page.next_offset, counts}) to checkpoint a paginated search and load("rank") to resume it in a later script. Values follow the active session branch through reopening, compaction, and Pi JSONL export/import. A load returns a fresh JSON copy, or undefined for a missing key. Pass undefined to delete a key. Writes take effect together when the script succeeds. One value can contain 262,144 UTF-16 code units of JSON, and the combined keys and values can contain 1,048,576.

Set a smaller preview or deadline on the first line of a script, for example // @options: {"max_output_tokens": 256, "timeout_ms": 2000}. The preview accepts 1–4,096 tokens at four UTF-8 bytes each. For very small budgets the truncation notice and log path can exceed the requested size. The deadline includes time spent in nested calls. A timeout discards pending store writes.

By default Codemode returns up to 16 KiB inline. For longer text, the preview includes the beginning, the end, and a workspace-relative path to the complete UTF-8 log under .panda/. Use read or tools.read({path, offset, limit}) to recover omitted lines, including after reopening a session. If a script throws, its tool error includes any text emitted before the failure, followed by the diagnostic. The same preview and full log apply, and pending store() writes are discarded. Emitting more than 1 MiB of text across a script fails the call and discards its pending store() writes. Newlines inserted between outputs count toward the limit.

A script has a 64 MiB JavaScript heap, up to 64 tool calls and 12 MiB of base64-encoded image URLs. Ctrl-C cancels the worker and its active host calls.

Scripting

panda --print "Where are sessions stored?"
panda --mode json "Read Cargo.toml and identify the workspace members"
git diff | panda --print --provider deepseek --model deepseek-flash --thinking high --no-session "Review this change"
panda --continue --mode rpc

Print mode writes the final answer. JSON mode emits one object per line, ending with a done object containing the answer and session ID. Both accept a prompt from standard input. If you also supply a prompt argument, Panda prepends the piped text verbatim, separates it from the prompt with a blank line, and resolves attachments from the argument.

See workspace trust, Markdown packages and MCP for installation, activation and server configuration.

The terminal and workspace guide covers cross-workspace sessions, private checkpoint recovery, themes and picker shortcuts.

To follow up on a specific conversation, pass its numeric session_id from the JSON done object to either output mode, for example panda --print --session 42 "Explain the first finding". The ID must identify an existing session in the current workspace. A JSON follow-up returns the same ID. The --session flag conflicts with --continue and --no-session.

Import a Pi v3 JSONL file in the workspace where you want to continue it. Import prints a new Panda session ID. For example, if it prints {"session_id":42}, run:

panda --import-session review.jsonl
panda --print --session 42 "Continue the review"
panda --export-session 42 continued.jsonl
panda --export-session 42 review.html
pi --session continued.jsonl

Open the standalone HTML file offline in a browser to see the active branch. Use the branch selector to review a sibling, including its tool output and compaction checkpoints. Export requires a new destination file and preserves the order used by --continue.

Import and export also accept a trailing --session-dir DIR. Export includes all branches. Pi opens the selected branch, including its compaction checkpoint. Imported entries retain their IDs, parent links and extension payloads. The exported header points to the importing workspace. Panda uses its own configured model and tools when continuing. For Panda-authored entries that lack original timestamps or model metadata, the export uses the time of first export and identifies the model as unknown.

Use --session-dir DIR to choose where a print or JSON run creates and looks up sessions, for example panda --print --session-dir ../review-sessions --continue "Summarize the review". The SQLite database and session locks live in that directory. Both --session ID and --continue look there for conversations in the current workspace. Choose a private directory outside the workspace and configured toolchains. Panda creates it if needed. Credentials, model settings, and user instructions still come from PANDA_HOME, which is also the default session store. With --no-session, Panda skips the session directory entirely.

For print and JSON runs, put options before the prompt. Use --model MODEL for an exact model ID on the configured provider, or add --provider PROVIDER to select a different provider. --thinking LEVEL accepts the same levels as :thinking, including default. These choices apply to this invocation. Add --no-session to keep the conversation in memory. In this mode the JSON session ID is null, and --continue is incompatible.

Select tools for a print or JSON run with --tools read,search,repo_map,ls. The list takes exact tool names and replaces the default selection. Use --tools codemode,read to enable Codemode with only tools.read() available inside scripts. Use --no-tools for a prompt-only run, such as git diff HEAD | panda --print --no-tools "Review this diff". An explicit selection takes precedence over --codemode. The session’s plan or code mode still controls which selected tools can run.

Use --system-prompt TEXT|PATH to replace Panda’s built-in base prompt for a print or JSON run. Workspace instructions and guidance for enabled tools still follow the base. Each --append-system-prompt TEXT|PATH adds a final instruction in command-line order. Both flags accept literal text or the contents of an existing UTF-8 file. Relative paths resolve from the current directory.

git diff HEAD | panda --print --no-tools --system-prompt "You are a code reviewer." --append-system-prompt ./review-rubric.md --append-system-prompt "List findings by severity." "Review this diff."

RPC accepts one JSON object per input line and echoes its id on replies and turn events.

{"id":1,"type":"prompt","text":"Read Cargo.toml and describe the workspace"}

During an RPC turn, send steer or follow_up with a text field, or send cancel. The terminal reply for that turn includes any undelivered input. Once the turn ends, send session to inspect the saved transcript, or ack after inspecting an interrupted tool call.

Select the Pi JSONL adapter with panda --mode rpc --rpc-version pi-v1. Send a request such as {"id":"run-1","type":"prompt","message":"Describe this workspace"}. Its correlated response carries the prompt disposition. Read the event stream until agent_settled to observe completion. While the run is active, clients can query state, steer, queue a follow-up or abort. Clear the queue before aborting to discard pending text.

Pi clients can inspect messages, tree entries and the active leaf, select models and thinking levels, change queue delivery, switch or fork sessions, execute cancellable shell commands, compact or retry. Pass the sessionFile value from get_state to switch_session to reopen a Panda session. The SQLite host also accepts Pi JSONL files for import. Extension UI requests and responses depend on a future Panda extension UI contract.

Embedded Rust hosts use panda_core::sdk::SessionSdk with panda_memory::MemoryStore or panda_local::store::Disk. Supply your provider, toolset, cancellation handle and queue to prompt and retry. Reuse the queue between turns to preserve its delivery policy. The SDK integration test exercises both stores through the same sequence. Rust host example

Pi behavior and Rust test mapping

Test and fuzz

cargo test --locked --workspace
cargo test --locked -p panda-cli --test isolation -- --ignored
cargo clippy --locked --workspace --all-targets -- -D warnings
cargo run --locked -p panda-memory

The isolation tests require native macOS with permission to launch Seatbelt. The HTTP error and cancellation fixture uses loopback. The in-memory binary exercises the same turn loop independently of SQLite, the sandbox, providers and terminal.

The Markdown tests compare streamed prefixes with one-shot rendering across randomized Unicode, terminal widths and chunk boundaries. A SQLite round-trip test compares the live and resumed terminal frames.

The regular Cargo suite uses proptest to generate Unicode arguments and arbitrary chunk boundaries. It also tests each chunk width for a fixed fragmented tool call. The coverage-guided target compares whole and chunked decoding on mutated bytes, starting with valid text and tool-call streams.

rustup toolchain install nightly --profile minimal
cargo install cargo-fuzz --locked
cargo +nightly fuzz run provider_stream -- -max_total_time=60
cargo +nightly fuzz run subscription_stream -- -max_total_time=60

Local verification on 18 November 2026

DeepSeek, OpenRouter and ChatGPT Codex each completed a live tool round trip. Codex also completed a fresh browser login and returned the verified contents of a random test file.

Using DeepSeek, Panda inspected a failing regression in its own subscription transcript conversion, proposed a plan, edited the implementation and passed both Node tests in its sandbox. A new Panda process reopened the session. The fixture needed access to an installed language toolchain, made available through PANDA_TOOLCHAIN_DIRS.

Releasing

Conventional commits on main feed Release Please. Merge its release PR to publish the version in version.txt. The shipped binary and the Cargo workspace packages are versioned separately. The release workflow checks out the tag, packages the Intel and Apple Silicon binaries, uploads SHA-256 checksums, then dispatches the tap publisher at that tag. The publisher uses the tap App's APP_ID variable and PRIVATE_KEY Actions secret. To retry tap publication, dispatch the Homebrew workflow at the published tag.

Settings and Markdown resources

Use :settings to inspect the effective compaction retention and skill index with their sources. :settings reload rereads them for the open session. Defaults are overridden by $PANDA_HOME/settings.json, then .panda/settings.json at the Git root (or launch directory outside Git). --keep-recent-tokens N overrides compaction.keepRecentTokens for one invocation. Set "skillIndex": true to include available skill descriptions in the provider prompt.

At each directory from the Git root to the launch directory, Panda selects the first available instruction file in this order: AGENTS.override.md, AGENTS.md, AGENTS.MD, CLAUDE.md, CLAUDE.MD. The same order applies to user instructions in $PANDA_HOME and scoped instruction reads. Put a base or appended system prompt in $PANDA_HOME/SYSTEM.md or APPEND_SYSTEM.md. For one invocation, --trust-project lets the corresponding files under the project's .pi/ override those user files. Explicit base replacement wins, and CLI appends follow the selected append file.

Markdown prompt files in $PANDA_HOME/prompts/ become commands such as /review "API compatibility". With --trust-project, Panda also discovers .pi/prompts/ at the project root. User templates win name collisions and built-in terminal commands keep their names. Use :prompts to list templates. As in Pi, templates support positional arguments, all arguments, defaults and slices.

Panda discovers ancestor .agents/skills and .pi/skills directories up to the Git root. The workspace sandbox protects these skill directories from writes at every depth. The nearest definition wins duplicate names, followed by user and additional skill roots. :skills reports invalid frontmatter and lists both paths for name collisions. A skill declaring disable-model-invocation: true can still be invoked with :skill:NAME; model search, loading and the startup index omit it.

Offline diagnostics

Use :diagnostics to save a private JSON file under Panda’s state directory. It records the build, platform, session ID, revision, mode, message count and checkpoint status. :bug-report also includes fields you can fill in locally with reproduction steps and expected and observed behavior. :changelog displays the latest bundled release, and :changelog 0.1.20 selects a release offline.

These commands don’t share transcripts externally. To share one, export the session with --export-session ID FILE, inspect the file and choose its recipient.