Skip to content

On-demand OpenCode rewrite: shortcut to rewrite the last dictation or the selected text #62

Description

@qretsar

The problem

When a capture starts accidentally, or when I lose the flow of thought mid-dictation, the transcript of a longer capture becomes incoherent. Today the only options are re-dictating or keeping the garbled text. Mode post-processing already routes dictation through OpenCode, but it only applies to fresh captures while the automatic toggle is on.

Proposal

Two shortcuts built on the existing OpenCode rewrite pipeline:

  1. Rewrite the last completed dictation (default Option-Shift-O): re-runs the last transcript through the matching mode's configured model and pastes the cleaned-up result at the cursor. Always generates on demand, even when automatic mode processing is off.
  2. Rewrite the selected text (default Option-Shift-R): captures the current selection (Accessibility, same as Voice Action) and does the same, pasting over the selection.

Both fail safely: no OpenCode, no selection, or a generation failure pastes nothing (error tone only). Neither ever updates the last dictation, so Option-Shift-V keeps returning the original.

Why it fits

  • Reuses Profiles::rewrite_cancellable-style generation, the existing processor queue (bounded, ordered, cancellable), the standard paste path, and the Settings shortcut-capture UI. No new generation mechanism.
  • Matches the documented OpenCode contract (discovery, configured model, deadline).

I have a working implementation with tests and hardware verification ready to submit as a PR if this is wanted. Happy to adjust the design (shortcut defaults, mode/model selection, history handling) to whatever fits the project's direction.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions