Files
scientific-agent-skills/skills/pi-agent/references/pi-interview.md
T
Timothy Kassis ef1b2d8026 Update pi-agent skill to latest Pi docs
Refresh every reference against https://pi.dev/docs/latest and the four
ecosystem package pages, cross-checked with the published npm READMEs.

New reference pages (docs added them; the site nav does not surface them):
- environment-variables.md: PI_* process config, the PI_CODING_AGENT child
  marker, and the session variables injected into the bash tool. The old
  env-var list lived in usage.md, which no longer has that section.
- llama-cpp.md: llama.cpp router setup, /login llama.cpp, /llama.

Notable upstream drift now reflected:
- SDK: ModelRuntime.create() replaces AuthStorage + ModelRegistry;
  createAgentSessionServices/FromServices runtime factory; resolveCliModel
  and resolveModelScopeWithDiagnostics.
- Providers: full 30+ API-key table with env vars and auth.json keys;
  xAI/OpenRouter/Radius subscription logins; provider-scoped env blocks in
  credentials; models-store.json; Bedrock proxy variables.
- New thinking level "max" across settings, CLI, RPC, thinkingLevelMap, and
  the themes' thinkingMax token.
- New commands: /trust, /import, /llama; pi update --all/--models/--self;
  pi config; .pi/SYSTEM.md and APPEND_SYSTEM.md; trust.json.
- RPC: get_entries (with since cursor), get_tree,
  get_available_thinking_levels, agent_settled, bash_execution_update,
  summarization_retry_*, and the extension UI sub-protocol.
- Extensions: expanded from a summary to the real API surface, including
  session-replacement semantics and footguns, withFileMutationQueue,
  terminate, prepareArguments, and dynamic tool loading.
- Session format: retainedTail checkpoints and buildContextEntries().
- Packages: pi-web-access gained source_check and nine search providers and
  dropped code_search, which the old reference still documented;
  pi-mcp-adapter gained six config locations, lazy-keep-alive, the output
  guard, and MCP_STATUS_EVENT; pi-subagents gained the watchdog, profiles,
  modelScope, per-agent memory, the fleet inspector, and RPC v1.

Also fixes escape sequences that had been corrupted in earlier versions:
the Git Bash path in windows.md, the shellCommandPrefix JSON in
shell-aliases.md, and the CSI-u sequences in tmux.md and terminal-setup.md.

Bumps metadata.version to 1.2.
2026-07-26 15:50:24 -07:00

5.8 KiB
Raw Blame History

pi-interview Package

Source: https://pi.dev/packages/pi-interview

Interactive interview forms: the agent collects structured user responses through a form with single/multi-select, text input, image upload, and info panels, plus rich media (code, diffs, Markdown, images, Chart.js charts, Mermaid diagrams, tables, HTML).

pi install npm:pi-interview
pi install npm:glimpseui   # optional: native macOS window; browser fallback otherwise

Requires Pi v0.82.1 or later. Restart Pi after installing.

Invocation

await interview({
  questions: '/path/to/questions.json',
  timeout: 600,    // optional, seconds (default 600)
  verbose: false   // optional, debug logging
});

Lifecycle: the tool starts a local server and opens a Glimpse window (macOS) or browser tab → the user answers at their own pace with auto-save and timeout reset on any activity → the session ends by Submit (⌘+Enter), timeout (warning overlay with an option to stay), or Escape twice → the window closes and the agent receives responses, or null if cancelled.

With multiple concurrent interviews, only the first auto-opens; the rest are queued and surfaced as URLs in tool output, plus a top-right toast with a dropdown to open queued sessions. Submitting the active interview redirects the window to the next queued one. A status bar shows project path, git branch, and session ID.

Question Schema

{
  "title": "Project Setup",
  "description": "Review my suggestions and adjust as needed.",
  "questions": [
    { "id": "context", "type": "info", "question": "Architecture context",
      "context": "This project needs SSR and edge deployment support." },
    { "id": "framework", "type": "single", "question": "Which framework?",
      "options": ["React", "Vue", "Svelte"],
      "recommended": "React", "conviction": "strong", "weight": "critical" },
    { "id": "features", "type": "multi", "question": "Which features?",
      "options": ["Auth", "Database", "API"], "recommended": ["Auth", "Database"] },
    { "id": "notes", "type": "text", "question": "Additional requirements?" },
    { "id": "mockup", "type": "image", "question": "Upload a design mockup" }
  ]
}

Question types: single (radio), multi (checkbox), text, image (upload), info (non-interactive panel).

Field Purpose
id, type, question Identifier, type, question text
options Choices for single/multi; strings or { label, content? } objects
recommended Pre-selected option(s) with a "Recommended" badge
conviction "strong" or "slight" (slight opts out of pre-selection); requires recommended
weight "critical" (prominent card) or "minor" (compact card)
context Help text below the question
content Code/diff/Markdown block: { source, lang, file, lines, highlights, showSource }; lang: "diff" renders a diff, lang: "md"/"markdown" previews Markdown
media Object or array of image, table, chart, mermaid, html; each supports position ("above"/"below"/"side") and caption; tables take { headers, rows, highlights }

Single/multi questions also support an "Other" custom-text option, per-question image attachments (button or drag & drop), "✦ Generate more" and "↻ Review options" LLM actions, an "Ask about an option" inline assistant panel with prompt chips and provider/model overrides, and an optional per-option clarification field.

Response Format

interface Response {
  id: string;
  value: string | string[];
  attachments?: string[];  // image paths attached to non-image questions
}

Settings

~/.pi/agent/settings.json:

{
  "interview": {
    "timeout": 600,
    "port": 19847,
    "snapshotDir": "~/.pi/interview-snapshots/",
    "autoSaveOnSubmit": true,
    "generateModel": "anthropic/claude-haiku-4-5",
    "glimpseFloating": false,
    "theme": {
      "mode": "auto",
      "name": "default",
      "lightPath": "/path/to/light.css",
      "darkPath": "/path/to/dark.css",
      "toggleHotkey": "mod+shift+l"
    }
  }
}

Timeout precedence: function parameter > settings > default 600s. A fixed port keeps the URL stable across sessions. generateModel drives the generate/review option actions, defaulting to the agent's current model then a cheap available model; if an explicitly configured model fails and the session uses a different one, it retries once with the session model. glimpseFloating keeps the native macOS window above others (browser fallback unaffected).

Themes: built-ins are default (monospace) and tufte (serif); modes are dark (default), light, and auto (follows the OS, user override persists in localStorage). Custom themes are CSS files overriding variables such as --bg-body, --bg-card, --bg-elevated, --bg-selected, --fg, --fg-muted, --accent, --border, --success, --warning, --error, --focus-ring.

Keyboard

↑/↓ navigate options, ⌘+←/⌘+→ navigate questions (Ctrl off macOS), Tab cycles, Enter/Space selects, ⌘+V pastes into the focused input, ⌘+Enter submits, Esc shows the exit overlay (twice to quit), ⌘+Shift+L toggles the theme when enabled.

Recovery and Snapshots

Abandoned or timed-out interviews save their questions to ~/.pi/interview-recovery/{date}_{time}_{project}_{branch}_{sessionId}.json, auto-deleted after 7 days. Snapshots (manual Save button, or automatic on submit with autoSaveOnSubmit) land in ~/.pi/interview-snapshots/{title}-{project}-{branch}-{timestamp}[-submitted]/ as index.html plus an images/ subfolder. Resume either by passing the recovery JSON or the snapshot index.html path as questions — the form reopens with answers pre-populated.

Limits

Max 12 images per submission, 5 MB per image, 4096×4096 pixels, types PNG/JPG/GIF/WebP.