Skip to content

feat(pipeline): S4-T7 per-app tone profiles for LLM cleanup#39

Open
rdemeritt wants to merge 7 commits into
mainfrom
feat/s4-tone-profiles
Open

feat(pipeline): S4-T7 per-app tone profiles for LLM cleanup#39
rdemeritt wants to merge 7 commits into
mainfrom
feat/s4-tone-profiles

Conversation

@rdemeritt
Copy link
Copy Markdown
Member

Summary

  • Adds ToneProfile enum (casual/formal/code/raw) with systemPromptSuffix per variant
  • AppToneProfileStore (@Observable, @MainActor) persists bundle ID → profile mappings in UserDefaults; CRUD + sorted listing
  • TranscriptionPipeline.setToneProfileStore(_:) setter; .raw bypasses LLM entirely, other profiles inject suffix via ToneProfileCleanupWrapper
  • CleanupProfile.customSystemPrompt / effectiveSystemPrompt — LlamaCpp and Ollama providers updated to use it; no LLMProvider protocol change needed
  • ToneProfilesSettingsView — "Tone" tab in Settings with live app hint, add/delete UI, prompt-suffix preview
  • AppToneProfileStore.shared injected into AppDelegate and pipeline at launch

Test plan

  • swift build — zero errors (confirmed)
  • swift test — 16 new tests pass; 4 pre-existing failures in ModelDownloadManagerTests and VoiceCommandProcessorTests are unrelated to this PR
  • Manual: Open Settings → Tone; add com.apple.Terminal → Raw; transcribe into Terminal; confirm LLM step skipped in logs
  • Manual: Add com.microsoft.Word → Formal; transcribe; confirm "formal" suffix in LLM prompt (enable debug logging)
  • Manual: Add a bundle ID via hint tap; verify frontmost app bundle ID pre-fills the field
  • Manual: Delete a mapping; verify .casual fallback restored immediately in the UI
  • Persistence: quit and relaunch; verify mappings survive

rdemeritt added 7 commits May 17, 2026 12:35
Adds ToneProfile enum (casual/formal/code/raw) with per-app persistence
via AppToneProfileStore (UserDefaults-backed, @observable, @mainactor).

Wires into TranscriptionPipeline: .raw bypasses the LLM entirely;
other profiles append their systemPromptSuffix via ToneProfileCleanupWrapper.
CleanupProfile gains customSystemPrompt so both LlamaCpp and Ollama providers
consume it via effectiveSystemPrompt without API changes.

Settings tab "Tone" added to SettingsView. Store injected into AppDelegate
and pipeline at launch. 16 new tests cover CRUD, sorting, persistence, and
Codable round-trip.
- cyclomatic_complexity: extract applySilenceTrim and applyFillerScrubber
  helpers from stopAndTranscribe, reducing complexity from 12 to 10
- line_length: split SnippetExpander logger.info call into local bindings
- file_length: add swiftlint:disable file_length to SettingsView.swift
- implicitly_unwrapped_optional/force_unwrapping: replace IUO setUp with
  setUpWithError throws + XCTUnwrap in ToneProfileStoreTests
Zero violations under swiftlint lint --strict across 105 files. Fixes
cover cyclomatic_complexity, identifier_name, opening_brace, trailing_comma,
sorted_imports, force_unwrapping, implicitly_unwrapped_optional, for_where,
large_tuple, line_length, superfluous_disable_command, static_over_final_class,
file_length, function_body_length, type_body_length, nesting, colon, and
redundant_discardable_let across 17 source and test files. Logic unchanged.
build-and-test (debug + tests) completes before the 10-min runner job
token window. The release build was starting ~3 min after expiry and
getting cancelled. Moving it to its own job gives it a fresh token.
…ndow

Job token window is 10 min. Debug build with --jobs 4 was taking 12-13 min.
Removing the CPU throttle allows the build to complete before token expiry.
The original --jobs 4 was a CPU-starvation guard that is no longer needed.
swift build --build-tests compiles all test targets. Without --skip-build,
swift test rebuilds them again (~11 min), exceeding the token window.
With --skip-build the test step runs in seconds.
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