TUI plugin for OpenCode that adds a /retitle slash command to regenerate session titles from conversation history.
Ported from the VS Code Copilot Chat fork's /retitle command.
- Samples recent conversation turns (tail-3 + spread sampling)
- Sends sampled messages to the
"title"agent via a helper child session - Polls for the generated title (60 attempts × 500ms)
- Cleans the title (strips think tags, refusal detection, quote removal, max 100 chars)
- Updates the current session title via
session.update
/retitle # retitle from recent messages
/retitle → "deployment pipeline" # with steering hint
/retitle → "--samples 20 --from 50" # sample 20 turns from 50% point
/retitle → "--offset 30 --samples 15 docker setup" # last 30 msgs, 15 samples, hint
| Flag | Default | Range | Description |
|---|---|---|---|
--samples N |
10 | 3–50 | Max user turns to sample |
--from P |
100 | 0–100 | Percentage-based sampling center (100 = end) |
--offset N |
all | ≥1 | Use only last N messages (user + assistant) |
Any remaining text after flags is treated as a steering hint for the title.
Add to your tui.json plugin array:
{
"plugin": [
"file:///path/to/opencode-retitle"
]
}Or install from npm (if published):
{
"plugin": [
"opencode-retitle"
]
}/retitle model resolution order:
- Settings modal Model (saved in
retitle-config.jsonunder the OpenCode config dir) small_modelfromopencode.jsonc(provider/model)- Last session message model
- First available provider model
Open /retitle and use Model: in the settings modal (same pattern as /execsa).
- OpenCode v1.17.7+ (TUI plugin API with
keymap.registerLayer) - A configured
"title"agent (built-in by default) - At least one provider with a model
MIT