Skip to content

Learn corrections made right before pressing Enter - #22

Merged
chiranjeebhub merged 1 commit into
mainfrom
claude/project-thread-3i8pdq
Nov 13, 2026
Merged

chiranjeebhub merged 1 commit into
mainfrom
claude/project-thread-3i8pdq

Conversation

@chiranjeebhub

Copy link
Copy Markdown
Owner

Requested by Chiranjeeb · project thread

Problem

"Learn from my corrections" never fired in the usual flow: hold Fn, dictate, fix a word, press Enter. Hushtype only re-read the field 8, 28 and 73 s after pasting. By then a chat app had sent the message and cleared the box, so the fix was never seen.

Change

  • The field is read every second while Hushtype watches (90 s). A poll only counts once the field has held still, so a half-typed fix isn't learned.
  • New ReturnKeyTap reads the field at the moment Return goes down, before the app sends. It is an active CGEventTap on its own thread, and it's only on while a watch runs.
  • CorrectionLearner.analyze also reports whether the dictation is still in the field. Once it's gone (sent, cleared or rewritten), Hushtype learns from the last settled read and stops. It also learns when the next dictation starts or when the 90 s run out.
  • Range reads are clamped to the field length, because reads past the end failed in TextEdit, Notes and Chrome.
  • New learning log category. Learned words are logged as private.

Testing (on the Mac)

  • swift build passes. swift test ran 42 tests with 0 failures, including 3 new CorrectionLearner tests.
  • I ran a Developer ID build with a synthetic Fn press and say for the speech:
    • TextEdit: I fixed "Chiranjeev" and pressed Return 0.25 s later. The log shows Read 1 fix(es) (Return, counted: true), then Learned.
    • Chrome page whose Enter sends and clears the box: I fixed a word and pressed Enter 0.2 s later. The log shows the Return read, then Dictation no longer in the field (poll), then Learned, about 0.7 s after Enter.

Known limit

Only one-word-for-one-word swaps are learned. If the recogniser splits a word in two (for example "Cuban eats" → "Kubernetes"), the fix isn't learned yet.


Generated by Claude Code

Chat apps send and clear the message on Enter, so the 8 s re-read after a
paste found an empty box and never saw the fix. Hushtype now reads the
field every second and the instant Return goes down (an active key tap on
its own thread, only on while watching), keeps the latest settled read,
and learns from it once the text is gone, the next dictation starts, or
90 s pass. Adds a "learning" log category so this can be checked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H6HfUTGgwuMj97TiJ3gZVb
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-13T11:26:41.965403Z
We couldn’t complete this review. Comment @codex review to try again.
5e973dd PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@chiranjeebhub
chiranjeebhub merged commit 697fdb2 into main Nov 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants