pi-copilot-queue
v0.7.4
Published
Pi extension that queues ask_user responses for Copilot-style workflows
Maintainers
Readme
Copilot Queue (Pi Extension)
Queue user feedback ahead of time and let the model consume it via an ask_user tool.
This extension is inspired by TaskSync-style workflows: you preload responses, then configured providers can pull them during long runs.
What it does
- Registers tool:
ask_user - Registers command:
/copilot-queue - Keeps a FIFO queue of responses
- Supports autopilot prompt cycling (1→2→3→1…)
- Activates queue/autopilot only on configured providers (defaults to
github-copilot) - Injects a provider-targeted
ask_userloop policy into the system prompt on each new run - Adds a hidden
ask_userprotocol reminder, and reinforces compatible provider payloads (tool_choice: requiredfor OpenAI-style requests,tool_choice: { type: "any" }for Anthropic-style requests when thinking is not enabled) whenask_useris available - While a configured provider is actively running, normal interactive input is captured into queue by default (instead of triggering a new turn)
- Interactive capture can be toggled with
/copilot-queue capture on|off(onby default) - Tracks session elapsed time,
ask_usercall count, other tool-call count, and direct-reply misses in status line - Emits session hygiene warnings at configurable thresholds (default: 120 minutes, 50
ask_usercalls) - Persists state in session entries
- Shows queue/autopilot/session state in Pi status line when the current provider is configured for Copilot Queue
- Status line output follows the active Pi theme, and can be disabled with
copilotQueue.showStatusLine
When ask_user is called:
- If queue has items → returns next queued response
- Else if autopilot is enabled and has prompts → returns next autopilot prompt (cycling)
- Else in interactive UI for a configured provider → waits for
/copilot-queue add <message>,/copilot-queue done, or/copilot-queue stop(optionally with timeout) - Else → returns fallback response (
continueby default)
When the current model provider is not configured for Copilot Queue, queue/autopilot is bypassed, ask_user uses manual/fallback behavior only, and the extension status line is hidden.
Install
Option 1: Direct with Pi (npm or git)
Install from npm:
pi install npm:pi-copilot-queueInstall from git:
pi install git:github.com/ayagmar/pi-copilot-queuePinned to a specific release tag:
pi install git:github.com/ayagmar/[email protected]Project-local install (writes to .pi/settings.json):
pi install -l git:github.com/ayagmar/pi-copilot-queueInstall from local path:
pi install /absolute/path/to/pi-copilot-queueThen reload in Pi:
/reloadOption 2: With pi-extmgr (/extensions)
Install extmgr once:
pi install npm:pi-extmgrThen in Pi (GitHub source):
/extensions install git:github.com/ayagmar/pi-copilot-queue
/reloadOr install the extension file directly from GitHub (index.ts/entrypoint path):
/extensions install https://github.com/ayagmar/pi-copilot-queue/blob/master/src/index.ts
/reloadYou can also install a local extension file directly:
/extensions install /absolute/path/to/pi-copilot-queue/src/index.ts
/reloadSettings
By default, Copilot Queue is active only for github-copilot.
You can override that in ~/.pi/agent/settings.json:
{
"copilotQueue": {
"providers": ["github-copilot", "openai"],
"showStatusLine": true
}
}Single-provider shorthand also works:
{
"copilotQueue": {
"provider": "github-copilot"
}
}Settings are global and are read from ~/.pi/agent/settings.json.
Defaults:
providers = ["github-copilot"]showStatusLine = true
Use an empty array to disable provider interception entirely:
{
"copilotQueue": {
"providers": []
}
}Hide the extension status line while keeping provider management enabled:
{
"copilotQueue": {
"showStatusLine": false
}
}You can also manage the global settings from inside Pi:
/copilot-queue providers
/copilot-queue providers github-copilot openai
/copilot-queue providers global openai anthropic
/copilot-queue providers off
/copilot-queue providers global off
/copilot-queue settingsproviderswith no arguments shows the current active list.- Passing one or more provider names writes
~/.pi/agent/settings.json. globalis still accepted as an alias.offwrites an empty global provider list.- Tab completion covers the full command surface, including top-level commands, provider routing, session subcommands, timeout presets, and common provider names.
Usage
Queue messages
/copilot-queue add continue with the refactor
/copilot-queue add now add tests for edge cases
/copilot-queue list
/copilot-queue clear
/copilot-queue done
/copilot-queue stopDone / stop waiting
/copilot-queue done
/copilot-queue stopBoth commands request an explicit stop. If ask_user is currently waiting, it is released with stop. Otherwise the next ask_user call will immediately receive stop.
After an explicit stop, managed-provider runs stay in normal direct-reply mode until you queue a new message or enable autopilot. That re-arms the ask_user loop immediately.
Quick settings UI
/copilot-queue settingsThe settings UI lets you adjust all current Copilot Queue settings from one place, including:
- managed providers
- busy input capture
- status line visibility
- empty-queue wait timeout
- fallback response
- warning thresholds
- autopilot on/off
- autopilot prompt add/clear
Interactive capture while busy (configured providers only)
/copilot-queue capture on
/copilot-queue capture offon(default): while a run is active, interactive input is queued forask_user.off: keep normal steering behavior (input is not auto-queued).
Wait timeout (for empty queue in UI mode)
/copilot-queue wait-timeout 0
/copilot-queue wait-timeout 600disables timeout (default): wait indefinitely.>0makes waitingask_userreturn fallback after<seconds>.
Session counters and hygiene warnings
/copilot-queue session status
/copilot-queue session reset
/copilot-queue session threshold 120 50- When enabled, the status line includes elapsed time +
ask_usercall count, and shows missed ask_user runs when they happen. /copilot-queue session statusalso reports completed managed-provider runs, runs that usedask_user, direct replies that skippedask_user, compliance rate, other tool-call count, the last missed direct reply preview, and the non-ask_usertool count from that missed run.- Warnings are advisory only (no forced stop).
- Default thresholds are
120minutes and50ask_usercalls.
Fallback message
/copilot-queue fallback continueAutopilot (cycling prompts)
/copilot-queue autopilot add continue with implementation
/copilot-queue autopilot add now write tests
/copilot-queue autopilot on
/copilot-queue autopilot list
/copilot-queue autopilot off
/copilot-queue autopilot clearRecommended instruction snippet for your model
When provider is managed by Copilot Queue, use the ask_user tool whenever feedback is required. Keep calling ask_user after every completed step instead of ending with a direct reply. Only stop when the user explicitly replies with stop, end, terminate, or quit.Development
pnpm install
pnpm run checkRelease commands:
pnpm run release:patch
pnpm run release:minor
pnpm run release:majorQuick run:
pi -e ./src/index.ts