Follow-up Suggestions
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
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
bun run db:generate
# Review the generated SQL, then apply it to your database.
bun run db:migrate
See plugin 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
agent/hooks/followup-suggestions.tsregisters the plugin’s native EVE hook.chatjs/plugins/followup-suggestions/followup-hook.tscollects the current exchange and dispatches generation when the turn settles.chatjs/plugins/followup-suggestions/generate-suggestions.tsclaims the completed turn before the paid call, then generates questions using the configured model and core usage accounting.chatjs/plugins/followup-suggestions/followup-queries.tsstores the result inEveFollowupwith 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 for the lifecycle and UI contracts.