← Catalog

@dhruv2mars/pi-queue

Advanced FIFO message queue and steering for pi — queue follow-ups while the agent works

Extension

Install

Install with PiG

pig install npm:@dhruv2mars/pi-queue

Install with Pi

pi install npm:@dhruv2mars/pi-queue
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./src/index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 0.0.6 (README.md). PiG does not review it.

🎯 pi-queue

npm version pi-extension license

Advanced FIFO message queue and steering for pi. Queue up messages while the agent works, then drain them one at a time.


✨ Why pi-queue?

Ever been deep in a coding session with pi and thought of 3 follow-up questions while it's still running? Instead of waiting idle, queue them up. pi-queue intercepts your Enter key while the agent is working and routes messages into a FIFO queue. When pi finishes its current run, the next queued message auto-sends. No context switching. No lost ideas.


🚀 Install

pi install npm:@dhruv2mars/pi-queue

Or from source:

git clone https://github.com/Dhruv2mars/pi-queue.git
pi install ./pi-queue

📖 Table of Contents


🎨 Features

FeatureDescription
🔄 Queue ModeEnter while working → queue message for delivery after full run
⚡ Steer ModeEnter while working → send steering message after current tool batch
📊 Live WidgetSee mode + queue count + queued messages above the editor
🗂️ Queue ManagerInteractive overlay: edit, remove, reorder queued messages
🎹 Smart KeysAlt+Enter flips behavior, Ctrl+Shift+M toggles mode, Ctrl+Shift+Q opens manager
🔄 Auto-DrainQueue drains automatically — one message per agent run
💾 Persistent ModeQueue/steer mode preference survives session restarts

🏁 Quick Start

# 1. Install
pi install npm:@dhruv2mars/pi-queue

# 2. Start pi
pi

# 3. Ask pi to do something
> build a react component

# 4. While pi is working, queue a follow-up
> add tests for it          ← press Enter, message queued!

# 5. Queue another
> make it responsive        ← press Enter, message queued!

# 6. pi finishes → next queued message auto-sends
# 7. That run finishes → next message auto-sends

🎮 Usage

Queue Mode (default)

┌────────────────────────────────────────┐
│ ▶ QUEUE | 2 queued       ^Q manager    │
│────────────────────────────────────────│
│  1. add tests for it                   │
│  2. make it responsive                 │
│  ● working…                            │
├────────────────────────────────────────┤
│ > type here...                    QUEUE│
└────────────────────────────────────────┘
ActionKeyWhenBehavior
SubmitEnteridleNormal prompt submission
QueueEnterworkingAdd to queue → sent after full run
SteerAlt+EnterworkingSent after current tool batch
Toggle modeCtrl+Shift+ManySwitch queue ↔ steer
Open managerCtrl+Shift+QanyEdit / remove / reorder queue
Abort + drainEscapeworkingAbort run, auto-send next queued

Steer Mode

Flip the behavior so Enter steers and Alt+Enter queues:

ActionKeyWhenBehavior
SteerEnterworkingSent after current tool batch
QueueAlt+EnterworkingAdd to queue → sent after full run

Queue Manager

Open with Ctrl+Shift+Q or type /queue:

╭────────────────────────────────────╮
│ Queue Manager                      │
│                                    │
│  ▶ add tests for it                │
│    make it responsive              │
│                                    │
│  ↑↓ navigate  Enter edit  Del ...  │
╰────────────────────────────────────╯
KeyAction
↑ / ↓Navigate items
EnterEdit selected message
Delete / Ctrl+DRemove selected message
Shift+↑ / Shift+↓Reorder selected message
EscapeClose manager

While editing:

  • Type to modify text
  • Enter — Save changes
  • Escape — Cancel edit

Commands

CommandDescription
/queueOpen the queue manager overlay
/queue-modeToggle between queue and steer mode
/queue-clearClear all queued messages

⌨️ Keybindings

ShortcutAction
Enter (working)Queue message (queue mode) or steer (steer mode)
Alt+Enter (working)Steer (queue mode) or queue (steer mode)
Ctrl+Shift+MToggle queue ↔ steer mode
Ctrl+Shift+QOpen queue manager
Escape (working)Abort current run, auto-drain queue

🧠 How It Works

pi-queue replaces the default editor with a custom QueueEditor component that intercepts keypresses while the agent is working.

┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│  You type   │────▶│  QueueEditor│────▶│  FIFO Queue │
│  "add tests"│     │  intercepts │     │  (in-memory)│
└─────────────┘     │  Enter key  │     └─────────────┘
                    └─────────────┘            │
                                               ▼
                    ┌─────────────┐     ┌─────────────┐
                    │  pi agent   │◀────│  Auto-drain │
                    │  finishes   │     │  next msg   │
                    └─────────────┘     └─────────────┘

Auto-drain flow:

  1. Queue messages while pi is working
  2. When pi finishes its current run → first queued message auto-sends via pi.sendUserMessage()
  3. That run finishes → next queued message auto-sends
  4. Repeat until queue is empty

Smart Escape: Press Escape while working to abort the current run. If the queue has items, draining begins immediately.


⚙️ Configuration

No configuration required. Mode preference (queue vs steer) is automatically persisted in the session file and survives restarts.

If you want to reset your mode preference, use /queue-mode or Ctrl+Shift+M.


📝 Changelog

See CHANGELOG.md for version history.


🤝 Contributing

Contributions welcome! See CONTRIBUTING.md.


📄 License

MIT © Dhruv2mars