Skip to content

UX: Suggested next actions with tab completion #29

@evansenter

Description

@evansenter

Summary

Show suggested next actions in the input field as dim/grey text that can be accepted with Tab, similar to Claude Code's behavior.

Example

After clemini completes a task:

[bash] cargo check, 0.8s
All checks passed.

> run the tests█                    ← cursor here, dim grey suggestion

Pressing Tab accepts the suggestion:

> run the tests

How It Works

  1. After each response, clemini generates 1-3 contextual suggestions
  2. The first suggestion appears as ghost text in the input field
  3. Tab accepts the suggestion, or user can type to override
  4. Cycle through suggestions with Tab (before typing anything)

Suggested Actions by Context

After... Suggestions
cargo check passes "run the tests", "commit changes"
cargo check fails "fix the first error", "show the error details"
Reading a file "edit this file", "search for usages"
Creating a file "run cargo check", "add tests"
Fixing a bug "verify the fix", "commit the fix"
No recent context "show project structure", "what can you help with?"

Implementation Notes

rustyline supports hints via the Hinter trait:

use rustyline::hint::Hinter;

struct SuggestionHinter {
    suggestions: Vec<String>,
}

impl Hinter for SuggestionHinter {
    type Hint = String;
    
    fn hint(&self, line: &str, pos: usize, _ctx: &Context) -> Option<String> {
        if line.is_empty() && !self.suggestions.is_empty() {
            // Return first suggestion as ghost text
            Some(self.suggestions[0].clone())
        } else {
            None
        }
    }
}

The hint appears in a different color (configurable via Highlighter).

Generating Suggestions

Options:

  1. Rule-based: Pattern match on last tool calls and responses
  2. Model-generated: Ask Gemini to suggest next steps (adds latency/cost)
  3. Hybrid: Rule-based with model fallback for complex contexts

Start with rule-based for speed, consider model-generated for the "no recent context" case.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions