[FEATURE] Let mods add entries to the prompt autocomplete list
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
A mod (plugin of function hooks) can watch the prompt box through prompt.edit, but it can't offer completions the way slash commands and skills do. The composer's autocomplete list is closed to mods, and the keys that drive it never reach a mod either: in a live session Tab, Shift+Tab and the arrow keys did not fire prompt.edit at all. They aren't edits, so that matches the docs, but it leaves a mod no way to build keyboard completion.
I built a mod that adds a prompt mode: a draft starting with % names an action (% fork [prompt] resumes the session with --fork-session in a new terminal tab). To list and complete the actions I had to:
- draw the matching actions myself in the
AbovePromptband, - complete on a second
%(% f%becomes% fork), because Tab is taken by the composer and Shift+Space arrives as a plain space in my terminal (WSL2, inside a terminal multiplexer).
It works, but it's a workaround that looks and behaves unlike every other completion in Claude Code.
Proposed Solution
Let a mod contribute entries to the composer's autocomplete list, the one used for / commands, skills and @ files. For example, a hook (say prompt.complete) that receives the draft and caret and returns entries { label, description, replace: { start, end, text } }, or a $.prompt.completions.register({ trigger: '%', ... }).
Claude Code keeps owning the list, Tab to accept, the arrow keys and Escape, so mod completions look and behave exactly like the built-in ones.
Alternative Solutions
- Raise
prompt.edit(or a separate key event) for Tab and the arrow keys when the composer has nothing to do with them, e.g. no autocomplete list is open. A mod could then complete on its own, though it would still draw its own list. - Let a band
Button'sactionclaim a plain key (it accepts only chords and modified keys today). - What I do now: a printable trigger character plus a list drawn in the band.
Priority
Low - Nice to have
Feature Category
Interactive mode (TUI)
Use Case Example
- I type
%in the prompt. - The autocomplete list opens with the mod's actions (
fork Fork this session into a new tab, ...), narrowed as I type% fo. - Tab fills in
% fork, I type the fork's first prompt, and Enter runs it. The mod'sprompt.submithook handles it, and the text never reaches the model.
The same mechanism would serve any mod that takes structured input from the prompt: ticket keys, environment names, its own sub-commands.
Additional Context
- Claude Code 2.1.288, terminal surface, Linux (WSL2).
- Related, but a separate request: built-in modes such as
!restyle the prompt box (border colour, prompt glyph). A mod can only colour the draft text (PromptDecoration) and add a footer label (SessionModerender site), so a mod-defined mode can't announce itself the same way.