Skill Tracer
Skills › Scientific Agent Skills › pi-agent › pi-interview.md

pi-interview.md

127 lines · skills/pi-agent/references/pi-interview.md at 5f2bc03

Open on GitHub
1# pi-interview Package
2
3Source: https://pi.dev/packages/pi-interview
4
5Reviewed against Pi 0.99.2 and the package versions listed in `../SKILL.md` on 2026-09-30.
6
7Interactive 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).
8
9```bash
10pi install npm:pi-interview
11pi install npm:glimpseui # optional: native macOS window; browser fallback otherwise
12```
14Requires Pi v0.82.1 or later. Restart Pi after installing.

pi-interview Package

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

Reviewed against Pi 0.99.2 and the package versions listed in ../SKILL.md on 2026-09-30.

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.

Raw lines 1 to 15
16## Invocation
18```javascript
19await interview({
20 questions: '/path/to/questions.json',
21 timeout: 600, // optional, seconds (default 600)
22 verbose: false // optional, debug logging
23});
24```
26Lifecycle: the tool starts a local server and opens a Glimpse window (macOS), an Orca tab, or a 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.
28Remote and Moshi sessions: when the session looks remote (ssh/mosh env, or an active remote login on the host), the tool skips or supplements the local window and prints the form URL with access hints — a Moshi tip when the moshi-hook gateway is running (tap the preview button in the terminal title bar and pick the interview server), and an exact `ssh -L` command for plain SSH (mosh cannot forward ports). The server binds low ports (8377+, scanning forward on collision) and answers tokenless loopback opens with a landing page that hops to the form, so Moshi's browser preview reaches it in one tap. Requests with a non-loopback `Host` header are rejected.
30With 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.

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), an Orca tab, or a 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.

Remote and Moshi sessions: when the session looks remote (ssh/mosh env, or an active remote login on the host), the tool skips or supplements the local window and prints the form URL with access hints — a Moshi tip when the moshi-hook gateway is running (tap the preview button in the terminal title bar and pick the interview server), and an exact ssh -L command for plain SSH (mosh cannot forward ports). The server binds low ports (8377+, scanning forward on collision) and answers tokenless loopback opens with a landing page that hops to the form, so Moshi's browser preview reaches it in one tap. Requests with a non-loopback Host header are rejected.

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.

Raw lines 16 to 31
32## Question Schema
34```json
36 "title": "Project Setup",
37 "description": "Review my suggestions and adjust as needed.",
38 "questions": [
39 { "id": "context", "type": "info", "question": "Architecture context",
40 "context": "This project needs SSR and edge deployment support." },
41 { "id": "framework", "type": "single", "question": "Which framework?",
42 "options": ["React", "Vue", "Svelte"],
43 "recommended": "React", "conviction": "strong", "weight": "critical" },
44 { "id": "features", "type": "multi", "question": "Which features?",
45 "options": ["Auth", "Database", "API"], "recommended": ["Auth", "Database"] },
46 { "id": "notes", "type": "text", "question": "Additional requirements?" },
47 { "id": "mockup", "type": "image", "question": "Upload a design mockup" }
48 ]
50```
52Question types: `single` (radio), `multi` (checkbox), `text`, `image` (upload), `info` (non-interactive panel).
54| Field | Purpose |
55|---|---|
56| `id`, `type`, `question` | Identifier, type, question text |
57| `options` | Choices for single/multi; strings or `{ label, content?, recommended?, conviction? }` objects |
58| `recommended` | Pre-selected option(s) with a "Recommended" badge |
59| `conviction` | `"strong"` or `"slight"` (slight opts out of pre-selection); requires `recommended` |
60| `weight` | `"critical"` (prominent card) or `"minor"` (compact card) |
61| `context` | Help text below the question |
62| `content` | Code/diff/Markdown block: `{ source, lang, file, lines, highlights, showSource }`; `lang: "diff"` renders a diff, `lang: "md"`/`"markdown"` previews Markdown |
63| `media` | Object or array of `image`, `table`, `chart`, `mermaid`, `html`; each supports `position` (`"above"`/`"below"`/`"side"`) and `caption`; tables take `{ headers, rows, highlights }` |
65Single/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.
67Question IDs must be unique. `conviction` requires a recommendation. Use either question-level recommendations or option-level flags, never both; a single-select recommendation names exactly one option. Markdown `content` rejects `lines`/`highlights`, and `showSource` is Markdown-only. The shipped question example was executed against 0.13.0 `validateQuestions`. GUI launch, remote browser routing, and paid option generation were not exercised.

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).

FieldPurpose
id, type, questionIdentifier, type, question text
optionsChoices for single/multi; strings or { label, content?, recommended?, conviction? } objects
recommendedPre-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)
contextHelp text below the question
contentCode/diff/Markdown block: { source, lang, file, lines, highlights, showSource }; lang: "diff" renders a diff, lang: "md"/"markdown" previews Markdown
mediaObject 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.

Question IDs must be unique. conviction requires a recommendation. Use either question-level recommendations or option-level flags, never both; a single-select recommendation names exactly one option. Markdown content rejects lines/highlights, and showSource is Markdown-only. The shipped question example was executed against 0.13.0 validateQuestions. GUI launch, remote browser routing, and paid option generation were not exercised.

Raw lines 32 to 68
69## Response Format
71```typescript
72interface Response {
73 id: string;
74 value: string | string[];
75 attachments?: string[]; // image paths attached to non-image questions
77```

Response Format

interface Response {
  id: string;
  value: string | string[];
  attachments?: string[];  // image paths attached to non-image questions
}
Raw lines 69 to 78
79## Settings
81`~/.pi/agent/settings.json`:
83```json
85 "interview": {
86 "timeout": 600,
87 "port": 19847,
88 "snapshotDir": "~/.pi/interview-snapshots/",
89 "autoSaveOnSubmit": true,
90 "generateModel": "anthropic/claude-haiku-4-5",
91 "launcher": "browser",
92 "browser": "Firefox",
93 "glimpseFloating": false,
94 "theme": {
95 "mode": "auto",
96 "name": "default",
97 "lightPath": "/path/to/light.css",
98 "darkPath": "/path/to/dark.css",
99 "toggleHotkey": "mod+shift+l"
100 }
101 }
103```
105Timeout 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).
107`launcher` chooses where the form opens; omit it for the default (Glimpse on a local macOS session with `glimpseui` installed, otherwise a browser tab):
109- `"glimpse"` — native macOS Glimpse window; requires a local macOS session with `glimpseui`, and reports why the window could not open instead of falling back to a browser.
110- `"browser"` — browser tab even when Glimpse is installed.
111- `"orca"` — a browser tab in the current [Orca](https://github.com/stablyai/orca)-managed worktree, or Orca's focused worktree when the cwd is outside one; the tab is focused when that worktree is visible, otherwise staged in its tab bar. Needs `orca` on `PATH`.
113`browser` names the application used for browser tabs (`"Firefox"`, `"Brave Browser"`, …). It applies to `launcher: "browser"` and to an omitted `launcher` when Glimpse is unavailable; it has no effect under `"glimpse"` or `"orca"`.
115Themes: 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`.

Settings

~/.pi/agent/settings.json:

{
  "interview": {
    "timeout": 600,
    "port": 19847,
    "snapshotDir": "~/.pi/interview-snapshots/",
    "autoSaveOnSubmit": true,
    "generateModel": "anthropic/claude-haiku-4-5",
    "launcher": "browser",
    "browser": "Firefox",
    "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).

launcher chooses where the form opens; omit it for the default (Glimpse on a local macOS session with glimpseui installed, otherwise a browser tab):

  • "glimpse" — native macOS Glimpse window; requires a local macOS session with glimpseui, and reports why the window could not open instead of falling back to a browser.
  • "browser" — browser tab even when Glimpse is installed.
  • "orca" — a browser tab in the current Orca-managed worktree, or Orca's focused worktree when the cwd is outside one; the tab is focused when that worktree is visible, otherwise staged in its tab bar. Needs orca on PATH.

browser names the application used for browser tabs ("Firefox", "Brave Browser", …). It applies to launcher: "browser" and to an omitted launcher when Glimpse is unavailable; it has no effect under "glimpse" or "orca".

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.

Raw lines 79 to 116
117## Keyboard
119`↑`/`↓` 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.

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.

Raw lines 117 to 120
121## Recovery and Snapshots
123Abandoned 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.

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.

Raw lines 121 to 124
125## Limits
127Max 12 images per submission, 5 MB per image, 4096×4096 pixels, types PNG/JPG/GIF/WebP.

Limits

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

Raw lines 125 to 127