---
title: Follow-up Suggestions
description: Suggest related questions after an assistant answer
---

Use Follow-up Suggestions to generate three to five related questions after your completed answers. When you select a suggestion, you send it through the existing chat or comparison flow.

## Installation

### Add the plugin

```bash
bunx chat-js@alpha add followup-suggestions
```

When you install the plugin, the CLI registers the native EVE hook, server router, suggestions UI, and session cleanup callback.

### Migrate the database

```bash
bun run db:generate
# Review the generated SQL, then apply it to your database.
bun run db:migrate
```

See [plugin migrations](./using-plugins#database-migrations).

### Enable generation

Set `ai.tools.followupSuggestions.enabled` to `true` in `chat.config.ts`. Installation makes the implementation available. The option controls generation and display.

## Usage

You see suggestions below the last editable assistant message after generation finishes. They use your configured model provider and incur an auxiliary model call. Generation failures leave the completed answer usable.

Guest and background sessions do not generate suggestions. A new, failed, or cancelled turn does not reuse an earlier turn's suggestions. Suggested text becomes a user message only when selected.

## Options

Configure these fields under `ai.tools.followupSuggestions` in `chat.config.ts`:

| Option | Default | Purpose |
| --- | --- | --- |
| `enabled` | `false` | Enable generation and display |
| `default` | The configured fast model role | Choose the model for suggestion generation |

Choose a model available through your gateway. The plugin uses core model resolution and usage accounting.

## Schema

You store results in the plugin-owned `EveFollowup` table. Each result retains its native session, turn, and completion-event identity. Branches within the same owned logical chat can read inherited results by exact completion event.

A durable claim is written before the model call. Replayed callbacks and interrupted claims do not regenerate paid output. Deleting a native session removes its records transactionally, and late generation cannot recreate a deleted claim.

## Customize generation

1. `agent/hooks/followup-suggestions.ts` registers the plugin's native EVE hook.
2. `chatjs/plugins/followup-suggestions/followup-hook.ts` collects the current exchange and dispatches generation when the turn settles.
3. `chatjs/plugins/followup-suggestions/generate-suggestions.ts` claims the completed turn before the paid call, then generates questions using the configured model and core usage accounting.
4. `chatjs/plugins/followup-suggestions/followup-queries.ts` stores the result in `EveFollowup` with its session, turn, and completion-event identity.

Edit the generation prompt to change the style of questions. Keep the durable claim before the paid call, preserve completion identity, and retain model usage accounting. The output schema in `suggestion-output.ts` accepts three to five nonempty suggestions of at most 80 characters each.

## Customize display

`chatjs/plugins/followup-suggestions/use-followups.ts` matches the completed answer and reads stored results with bounded polling. Suggestions are persisted separately from the native transcript and are displayed after generation finishes.

Edit `followup-suggestions-view.tsx` to change their presentation. The plugin's `Suggestions` contribution passes selected text to core's existing send/compare flow. Generated questions become conversation input only when selected.

The `Suggestions` placement receives the native session ID, conversation ID, native events, last-message identity, disabled state, and selection callback.

## Preserve cleanup

The plugin's `chat.ts` removes results for deleted native sessions inside the existing deletion transaction. Keep this callback when changing storage so deleting one branch preserves surviving results and late generation cannot recreate a deleted claim.

See the [Plugin API](../reference/plugin-api) for the lifecycle and UI contracts.
