---
slug: "pi-next-cue"
source_type: "readme"
source_url: "https://cdn.jsdelivr.net/gh/ouzhenkun/pi-next-cue@main/README.md"
repo: "https://github.com/ouzhenkun/pi-next-cue"
source_file: "README.md"
branch: "main"
---
# pi-next-cue

**Predicts your next prompt after each agent turn — Tab to fill, Enter to send.**

[![npm version](https://img.shields.io/npm/v/pi-next-cue?style=for-the-badge)](https://www.npmjs.com/package/pi-next-cue)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge)](https://opensource.org/licenses/MIT)

## Why

After the agent finishes, you usually know what to type next. Pi-next-cue predicts it and shows a hint above your editor — saving keystrokes and keeping you in flow.

## Install

```bash
pi install npm:pi-next-cue
```

Requires Pi v0.37.0+.

## How It Works

The hint widget shows **one** of two states, depending on context:

**Predicted prompt** (after agent responds):
```
→ run the tests
```

**Your last message** (for reference):
```
↩ fix the login redirect bug
```

- **→** Next prompt you're likely to send — generated by a lightweight LLM after each agent turn
- **↩** The last message you sent — so you never lose context of what you asked

When the editor is empty:
- **Tab** fills the hint into the editor for editing
- **Enter** sends the hint directly

When you start typing, the hint stays visible but won't interfere — Tab and Enter only trigger when the editor is empty.

## Features

- **Adaptive tone** — matches your language and communication style from recent messages
- **Correction learning** — remembers when you ignore suggestions, avoids repeating rejected directions
- **Tool-aware** — considers whether the last tool succeeded or failed when predicting
- **Lightweight** — single LLM call with minimal context, no background indexing

## Configuration

Pi-next-cue uses your session's current model by default. To use a specific fast/cheap model or customize keybindings, create `~/.pi/agent/pi-next-cue.json`:

```json
{
  "provider": "deepseek",
  "model": "deepseek-v4-flash",
  "keys": {
    "fill": "tab",
    "send": "enter"
  }
}
```

All fields are optional. Defaults: `tab` to fill, `enter` to send. Key names follow Pi's [keybinding format](https://pi.dev/docs/latest/keybindings).

## Events

Other extensions can control hint visibility:

```typescript
// Hide the hint (e.g. when showing a dialog)
pi.events.emit("pi-next-cue:pause");

// Restore the hint
pi.events.emit("pi-next-cue:resume");
```

## License

MIT
