Skip to content

feat: Replacement Suggestions from dictation corrections#282

Open
martin-forge wants to merge 13 commits intoaltic-dev:mainfrom
martin-forge:codex/auto-learn-dictionary
Open

feat: Replacement Suggestions from dictation corrections#282
martin-forge wants to merge 13 commits intoaltic-dev:mainfrom
martin-forge:codex/auto-learn-dictionary

Conversation

@martin-forge
Copy link
Copy Markdown

@martin-forge martin-forge commented Apr 14, 2026

This implements feature request #272: an Alpha, review-first queue that suggests Instant Replacements from corrections made after dictation.

It deliberately does not silently auto-add anything. FluidVoice proposes replacements, the user reviews them, and approved suggestions become deterministic Instant Replacement entries.

Replacement Suggestions review queue

What changed

  • Adds a Replacement Suggestions review queue to Custom Dictionary.
  • Detects edits made after FluidVoice types dictated text and extracts correction candidates.
  • Supports AX-readable editors and a generic post-dictation event fallback for editors that do not expose readable AX text.
  • Aggregates repeated corrections before showing ordinary suggestions to the user.
  • Allows high-signal technical replacements such as signal flow -> SignalFlow to appear after one correction.
  • Keeps approved suggestions tied to Instant Replacement, not Parakeet-only Custom Words.
  • Shows at most 5 suggestions at once, with a count for any remaining suggestions.
  • Preserves pending suggestions on conflicts instead of silently dropping them.
  • Adds inline Added confirmation before approved rows animate away.
  • Refreshes the suggestion list live while the Custom Dictionary page is open.
  • Preserves the original target app PID when monitoring helper-process AX text elements.
  • Skips Replacement Suggestions AX capture entirely while the opt-in is disabled.
  • Escapes approved replacement text so $ and backslashes are applied literally by Instant Replacement.
  • Preserves technical edge punctuation in learned diff and event-fallback candidates while still stripping sentence punctuation.
  • Waits for Reliable Paste verification before starting AX-based correction monitoring, and primes the event fallback during that wait so AX-blind editors can still capture quick corrections.
  • Starts the Reliable Paste event fallback only after the typing request is accepted, so rejected insertions cannot monitor unrelated edits.

Suggestion thresholds

  • Most suggestions appear after 2 corrections.
  • Technical spellings such as FluidVoice, acronyms, numbers, and punctuation can appear after 1 correction.

The screenshot uses seeded examples so the review queue and overflow count are visible.

Validation

  • swiftlint --strict --config .swiftlint.yml Sources/Fluid/ContentView.swift Sources/Fluid/Services/AutoLearnDictionaryService.swift Sources/Fluid/Services/GlobalHotkeyManager.swift Sources/Fluid/Services/ASRService.swift Sources/Fluid/Services/CorrectionDiffEngine.swift Sources/Fluid/Services/TypingService.swift Sources/Fluid/UI/CustomDictionaryView.swift Tests/FluidDictationIntegrationTests/DictationE2ETests.swift
  • git diff --check
  • xcodebuild test -scheme Fluid -configuration Debug -destination 'platform=macOS' CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY='' -skip-testing:FluidDictationIntegrationTests/DictationE2ETests/testDictationEndToEnd_whisperTiny_transcribesFixture passed 37/37 tests.
  • xcodebuild build -scheme Fluid -configuration Release -destination 'platform=macOS' CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY='' passed.

The skipped test is the existing legacy Whisper tiny E2E fixture. This PR does not change default model download behavior; the feature validation above covers the replacement-suggestion code paths without using that fixture.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4979780c0d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread Sources/Fluid/Persistence/BackupService.swift
Comment thread Sources/Fluid/UI/CustomDictionaryView.swift Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8094b284eb

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread Sources/Fluid/Services/AutoLearnDictionaryService.swift Outdated
Comment thread Sources/Fluid/Services/CorrectionDiffEngine.swift
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e052dcc1ef

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread Sources/Fluid/Services/AutoLearnDictionaryService.swift Outdated
Comment thread Sources/Fluid/Services/CorrectionDiffEngine.swift
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f9d2501188

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread Sources/Fluid/ContentView.swift Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a84344430b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread Sources/Fluid/Services/TypingService.swift Outdated
Comment thread Sources/Fluid/Services/AutoLearnDictionaryService.swift Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f411e1969c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread Sources/Fluid/ContentView.swift Outdated
Comment thread Sources/Fluid/UI/CustomDictionaryView.swift Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f7f7ab438c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread Sources/Fluid/Services/AutoLearnDictionaryService.swift
@martin-forge martin-forge force-pushed the codex/auto-learn-dictionary branch from 58ced2e to b63f934 Compare May 2, 2026 21:22
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b63f9342ae

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/Fluid/Services/AutoLearnDictionaryService.swift
Comment thread Sources/Fluid/Services/AutoLearnDictionaryService.swift Outdated
@martin-forge martin-forge changed the title feat: Auto-learning custom dictionary suggestions (Review Queue) feat: Suggested Replacements from dictation corrections May 2, 2026
@martin-forge
Copy link
Copy Markdown
Author

Pushed a small CI follow-up: fixed the SwiftLint failure by removing trailing whitespace and moving the custom dictionary/suggestion types into a separate SettingsStore extension so SettingsStore.swift stays under the file-length limit. No behavior change intended.

@martin-forge
Copy link
Copy Markdown
Author

Pushed a small quality pass on the alpha Suggested Replacements feature: learning is now scoped to the text FluidVoice just inserted, simple title-case fixes can be suggested after repeated corrections, high-signal suggestions are more conservative, and focused tests cover the new behavior.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 420d654d11

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/Fluid/Services/AutoLearnDictionaryService.swift
@martin-forge
Copy link
Copy Markdown
Author

martin-forge commented May 3, 2026

Pushed one final polish commit. The suggestion thresholds are intentionally balanced so high-signal replacements can appear quickly, while ordinary casing fixes still need repeat evidence before they appear. I also clarified the helper naming, documented the inserted-text scoping trade-off, and added coverage for ordinary title-case corrections.

@martin-forge martin-forge force-pushed the codex/auto-learn-dictionary branch from 9271342 to 0c146d6 Compare May 3, 2026 22:40
@martin-forge
Copy link
Copy Markdown
Author

martin-forge commented May 3, 2026

Updated this PR with the latest tested Replacement Suggestions work.

Replacement Suggestions review queue

Latest update includes the Codex/event fallback path for editors without readable AX text, tighter target binding, long-document scoped diffing, conflict-safe approval, the inline Added confirmation, final UI copy/polish using the Replacement Suggestions name, punctuation-edge Instant Replacement matching for approved suggestions such as .net, c++, and node.js, target-PID preservation for helper-process AX text elements, opt-in gating so disabled users do not run Replacement Suggestions AX capture, escaped replacement templates so $ and backslashes apply literally, diff/event-fallback tokenization that preserves technical edge punctuation such as .NET, C++, C#, and 5% while still stripping sentence punctuation, Reliable Paste completion timing that waits for paste verification while priming event fallback during the wait for AX-blind editors, and acceptance gating so rejected typing requests cannot leave fallback monitoring attached to unrelated edits.

Validation on the pushed commit:

  • swiftlint --strict on the touched Swift files passed with 0 violations.
  • git diff --check passed.
  • Selected DictationE2ETests suite passed 37/37 with the legacy Whisper tiny fixture explicitly skipped.
  • Release build passed.

The skipped test is the existing Whisper tiny E2E fixture; this PR does not change default model download behavior.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0c146d6db4

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/Fluid/ContentView.swift Outdated
@martin-forge martin-forge force-pushed the codex/auto-learn-dictionary branch from 0c146d6 to 631d33d Compare May 3, 2026 23:02
@martin-forge martin-forge force-pushed the codex/auto-learn-dictionary branch from 631d33d to 2576c9b Compare May 5, 2026 13:43
Copy link
Copy Markdown
Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2576c9b30f

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/Fluid/Services/CorrectionDiffEngine.swift
@martin-forge
Copy link
Copy Markdown
Author

@codex review

@martin-forge martin-forge changed the title feat: Suggested Replacements from dictation corrections feat: Replacement Suggestions from dictation corrections May 5, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7e901e0fa9

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/Fluid/Services/AutoLearnDictionaryService.swift
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8c72ec03f4

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/Fluid/Services/AutoLearnDictionaryService.swift Outdated
@martin-forge
Copy link
Copy Markdown
Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8505d553bb

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/Fluid/ContentView.swift Outdated
@martin-forge
Copy link
Copy Markdown
Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 44982b8d0e

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/Fluid/Services/AutoLearnDictionaryService.swift
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 26113c85f4

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/Fluid/Services/CorrectionDiffEngine.swift Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d4a7d0094

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/Fluid/Services/AutoLearnDictionaryService.swift
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 96fc725ce9

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/Fluid/Services/TypingService.swift Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8e508d6fa4

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/Fluid/Services/TypingService.swift Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4826ec642c

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/Fluid/ContentView.swift Outdated
@martin-forge
Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@martin-forge
Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

1 participant