# @eko24ive/pi-ask `@eko24ive/pi-ask` is an ask tool that cares about your answers. It lets an agent pause, ask structured questions in a terminal UI, and continue with normalized answers instead of guessing. https://github.com/user-attachments/assets/a8503ca9-afcb-4c31-9edc-353b985a0209 ## Install ```bash pi install npm:@eko24ive/pi-ask ``` You can also install from git: ```bash pi install git:github.com/eko24ive/pi-ask ``` Or try it without installing (load once for the current run): ```bash pi -e npm:@eko24ive/pi-ask ``` ## Features Once installed, this package gives the agent a native way to ask for clarification instead of guessing. - 🧭 Familiar ask-style interface: tabbed questions, single/multi select, and preview mode - ✍️ Inline free-form `Type your own` answers - πŸ“Ž Native pi-style `@` file references inside answer and note editors - πŸ“ Question-level and option-level notes - πŸ‘€ Review tab with `Submit`, `Elaborate`, and `Cancel` - πŸ’¬ Elaboration flow to capture note-based clarification before final submission - ⌨️ Fast keyboard-first interaction with customizable ask keymaps (also mobile-friendly in remote sessions) - βš™οΈ Ask settings with persisted behaviour and keymap customization via config - πŸ—£οΈ You can talk to your agent to configure pi-ask; it will read the bundled configuration guide and tailor the config for you ## Feature walkthrough ### Multi-question flow (tabs) Move across several related questions in one ask flow. ![Multi-question ask_user flow with tab navigation](docs/media/feature-multi-question-tabs.png) ### Single-select question Pick one option when answers are mutually exclusive. ![Single-select question with one selected option](docs/media/feature-single-select.png) ### Multi-select question Choose multiple options when several answers apply. ![Multi-select question with multiple selected options](docs/media/feature-multi-select.png) ### Preview mode Use a dedicated preview pane when options need richer detail. ![Preview question showing a dedicated preview pane](docs/media/feature-preview-pane.png) ### Custom answer (`Type your own`) Capture free-form input inline without leaving the flow. ![Inline custom answer input for Type your own option](docs/media/feature-custom-answer-input.png) ### Native `@` file references Use pi-style `@` file path autocomplete inside free-form answers and note editors. ![Native pi-style @ file references inside the ask flow](docs/media/feature-at-file-mentions.png) ### Option notes Attach clarification notes to a specific option (`n`). ![Option note editor with note text for selected option](docs/media/feature-option-note.png) ### Question notes Add notes at question level for broader context (`Shift+N`). ![Question-level note editor with saved note](docs/media/feature-question-note.png) ### Review tab β€” Submit Review all answers before returning them to the agent. ![Review tab with Submit action highlighted](docs/media/feature-review-submit.png) ### Review tab β€” Elaborate Ask the agent to elaborate on notes before finalizing choices. ![Review tab with Elaborate action and expanded note preview](docs/media/feature-review-elaborate.png) ## Default key bindings Open the ask settings modal with `?` during the ask flow, or with the `/ask-settings` command from pi. Customizable via config: | Action | Default key | |---|---| | Cancel flow or close/save editor draft | `Esc` | | Dismiss entire ask flow immediately | `Ctrl+C` | | Toggle selected option | `Space` | | Confirm / continue / save / submit | `Enter` | | Edit selected option note | `n` | | Edit question note | `Shift+N` | Fixed bindings: | Key | Context | Effect | |-----------------------------|-----------------------------------------|---------------------------------------------| | `?` | Ask flow / empty editor | Open ask settings modal | | `Tab` `Shift+Tab` | Main flow | Switch tabs | | `←` `β†’` | Main flow | Switch tabs | | `↑` `↓` | Main flow | Move cursor | | `1..9` | Options list | Select or toggle matching option | | `1` `2` `3` | Review tab | Trigger `Submit` / `Elaborate` / `Cancel` | | `↑` `↓` | Review tab | Change highlighted review action | | `↑` `↓` | Empty editor | Move options without closing editor | | `Tab` `Shift+Tab` / `←` `β†’` | Empty editor | Switch tabs without closing editor | | Arrow keys / `Tab` | Non-empty editor | Stay in editor for cursor movement | Config file: `~/.pi/.../extensions/eko24ive-pi-ask.json` You can edit this file yourself, ask pi to edit it for you, or use the read-only `Keymaps` tab to find the exact path and active bindings. ```json { "schemaVersion": 1, "behaviour": { "autoSubmitWhenAnsweredWithoutNotes": false }, "keymaps": { "cancel": "esc", "dismiss": "ctrl+c", "toggle": "space", "confirm": "enter", "optionNote": "n", "questionNote": "shift+n" } } ``` Accepted notation follows pi-tui key ids. Common aliases are normalized, for example `escape` β†’ `esc`, `return` β†’ `enter`, `control+c` β†’ `ctrl+c`, and `Shift+N` β†’ `shift+n`. ## Use After installation, the extension registers the `ask_user` tool and `/ask-settings` command. Agents can auto-discover and call `ask_user` when they need clarification instead of guessing. In interactive sessions, it opens a terminal UI flow for structured answers, supports native pi-style `@` file references while typing answers or notes, and returns normalized answers back to the agent. The ask settings modal is available both from `?` in the ask flow and from the `/ask-settings` command, with `Keymaps` and `Behaviour` tabs. `Keymaps` is read-only and shows the active resolved bindings plus the config file path. Behaviour settings are saved explicitly with `Ctrl+S`. You can also talk to pi to configure this extension. When asked to customize pi-ask settings or keymaps, the agent is instructed to read the bundled `docs/configuration.md` guide first and then edit the config file accordingly. This package also bundles the `ask-user` skill profile from `skills/ask-user/SKILL.md`. It reinforces when to use the tool, is enabled by default when installed, and can be disabled via `pi config`. The skill was inspired by https://github.com/edlsh/pi-ask-user. You can still add your own agent instruction if you want to further reinforce usage. For exact input/output and UX guarantees, see [`docs/contract.md`](docs/contract.md). ## Local development ### Run locally in pi ```bash pi -e ./src/index.ts ``` ### Run in isolated test mode (extension + bundled skill only) ```bash pnpm dev pnpm dev ../test ``` `pnpm dev [path]` runs pi with `--no-extensions --no-skills --no-prompt-templates --no-themes --no-context-files`, loads this repo’s extension and `skills/ask-user`, and starts pi from `[path]` by changing directories before launch (defaults to `.`). ### Install dependencies ```bash pnpm install ``` ### Install git hooks (contributors) `lefthook` is not installed automatically. If you want the local commit hooks used by this repo, run: ```bash pnpm exec lefthook install ``` ### Development commands ```bash pnpm format pnpm lint pnpm check pnpm typecheck pnpm test ``` ### Commit workflow This repo uses `lefthook`, Commitizen, conventional commitlint, and semantic-release. If you want local hooks, install them once after `pnpm install`: ```bash pnpm exec lefthook install ``` Recommended flow: ```bash pnpm commit ``` ## Project layout - `src/` β€” TypeScript extension implementation - `tests/` β€” behavior-focused tests - `docs/` β€” small docs set for contract and architecture - `docs/media/` β€” repository-only README media assets ## Documentation Docs stay intentionally small: - `docs/README.md` β€” index - `docs/contract.md` β€” external behavior - `docs/architecture.md` β€” module boundaries and invariants