Skip to content

Ponytail minimization pass: dead code, formatter locale fixes, redundant-work cuts - #1701

Merged
r3dbars merged 3 commits into
mainfrom
claude/ponytail-code-optimization-198164
Aug 24, 2026
Merged

Ponytail minimization pass: dead code, formatter locale fixes, redundant-work cuts#1701
r3dbars merged 3 commits into
mainfrom
claude/ponytail-code-optimization-198164

Conversation

@r3dbars

@r3dbars r3dbars commented Aug 24, 2026

Copy link
Copy Markdown
Owner

Why

Repo-wide minimalism pass (the ponytail decision ladder: delete > reuse > stdlib > native > shrink) targeting performance and reliability. Every finding was adversarially verified against the repo's landmines (source-text-pinned tests, CoreAudio real-time rules, failed-audio retention, privacy sanitizers) before being applied; refuted findings were dropped.

Product Impact

  • Affects: dictation / meetings / agent artifacts
  • Lane: dictation reliability / meeting reliability
  • Why this matters: removes ~1,430 net lines of dead and duplicated code, fixes two real formatter-locale correctness bugs on non-Gregorian system calendars (transcript frontmatter feeds audio-retention decisions; stats-DB date range queries), and cuts measurable redundant work (repeated file reads/parses, per-row SQL prepares, per-call regex/formatter allocation, per-render filesystem stats).

What changed

  • Deleted the legacy SystemAudioCapture CoreAudio process-tap path (791 lines, zero production callers — SCKAudioCapture is the only backend) plus its orphaned CoreAudioUtils helpers; docs updated
  • Locale-pinned frontmatter/stats dates: transcript date:/time: and six stats-DB sites now write via the POSIX-pinned DateFormattingHelper, matching their POSIX-pinned readers
  • Meeting audio-retention maintenance parses each transcript's frontmatter once per pass instead of 2–3×
  • FailedTranscription: audio/error fields are var, collapsing five 10-field copy-with-mutation sites that could silently drop a future field; same with(...) shape for RecordingHealthInfo
  • Observability: one shared crash-safe log-prepare sequence for EventReporter + ReliabilityPacketRecorder, one shared duration_bucket helper; the pinned source-text test now guards the shared helper
  • ContextCaptureEngine: the mirrored _sharedSessionController global became an explicit isHotkeyRoutingActive flag — same late-CGEventTap-event protection, no triple manual sync
  • Dead code: old "Call Recording" saver + formatMarkdown, SpeakerProfileMerger name-merge API + variants table (MCP keeps its standalone mirror), unused wrappers in TranscriptionTaskManager / RetroactiveSpeakerUpdater (moved to a test helper) / ParakeetEngine / ParakeetModelLifecycle / WhisperEngine, and an NSLock.withLock shadow of Foundation's own
  • Hot loops: regex/DateFormatter hoists (DictationTranscriptStore, RecentCaptureScanners, CaptureMarkdownParser, HomeView), single-evaluation Speakers settings render, lazy Agent-page disclosure content
  • Tools: CLI reads each meeting file once (was 3×); MCP receipts tools stop double-hydrating titles (2× disk reads), dictation reads read once, SQLite indexer prepares INSERTs once per transaction; QA dedups process termination, report writing, and the isolated-launch env block

How I checked it

  • scripts/dev/agent-preflight.sh
  • Selected checks from .agents/test-matrix.yml for the files changed
  • bash build.sh --no-open (launch-to-interactive 906ms / 3000ms budget)
  • bash run-tests.sh (12,203 passed)
  • Performance budget passed (bash build.sh --no-open runs the bundle gate)
  • bash run-integration-smoke.sh if I touched Sources/Meeting/ or Sources/TranscriptedCore/
  • swift test if I touched Package.swift, Sources/TranscriptedCore/, or the public core seam (1,036 passed, 13 hardware-skips)
  • Manual check: bash run-e2e-smoke.sh + all four tool package suites (CaptureKit 53, CLI 78, MCP 192, QA 65) + scripts/dev/check-build-source-lists.py

Risk Review

  • Privacy / local-first behavior reviewed (sanitizers/allowlists untouched; shared log-prepare keeps restrict-before-open, pinned test updated to guard it)
  • Storage path or migration impact reviewed (no path or schema changes; MCP index schema untouched)
  • Public-facing copy stays concrete and matches current product scope (no copy changes)
  • Release/update impact reviewed (no release-path or version changes)
  • Agent PRs link the issue/workpad and stay draft until human review (landing directly per owner request in-session)
  • UI changes include sanitized .agent-review/visuals/ evidence (UI changes are behavior-preserving refactors: identical view output)
  • No private transcripts, audio, tokens, personal paths, or customer data are included

Notes

Deliberately skipped (verified-risky or refuted): caching a meeting title column in the MCP index (real perf win, needs a schema migration — good follow-up), two large ParakeetEngine extractions (the claimed-identical paths differ by an asrManager guard), CameraActivityMonitor/MicActivityMonitor scheduler unification (documented intentional parallelism), TranscriptedStoragePaths caching (freshness checks are load-bearing), and CaptureLibrarySize/ModelCacheInventory unification (symlink semantics differ).

Environment note: this machine needed Xcode's Metal Toolchain component (xcodebuild -downloadComponent MetalToolchain, 687.9 MB) for build-deps.sh to compile the MLX shaders — installed during verification. Also, build-deps.sh/build.sh failures are easy to mask by piping through tail (staleness message prints even on the success path of a later run); worth a follow-up to make the stale-deps case louder.

Agent handoff

COORD_DONE: GREEN | (this PR) | ponytail minimization across Sources+Tools, −1,430 net lines, 2 locale-correctness fixes | none | none | build-deps, build, run-tests (12,203), integration smoke, swift test (1,036), e2e smoke, 4 tool package suites, source-list check | merge

🤖 Generated with Claude Code

Redbars and others added 3 commits August 24, 2026 14:13
…gs, cut redundant work

Repo-wide minimalism audit (ponytail decision ladder) applied for performance
and reliability, adversarially verified finding-by-finding before landing:

- Delete the dead legacy SystemAudioCapture CoreAudio process-tap path
  (791 lines; SCKAudioCapture is the only production backend) plus its
  orphaned CoreAudioUtils helpers
- Pin transcript date:/time: frontmatter and stats-DB date strings to the
  POSIX-pinned DateFormattingHelper so writes match their POSIX-pinned
  readers on non-Gregorian system calendars (frontmatter dates feed
  audio-retention decisions)
- Stop parsing each meeting transcript's frontmatter 2-3x per audio
  retention maintenance pass
- Make FailedTranscription audio/error fields var so the five
  copy-with-mutation sites can't silently drop a future field; same
  with(...) pattern for RecordingHealthInfo
- Share the crash-safe JSONL log prepare sequence (EventReporter +
  ReliabilityPacketRecorder) and the duration_bucket helper so Sentry and
  reliability packets can't drift; repoint the pinned source-text test
- Replace ContextCaptureEngine's mirrored _sharedSessionController global
  with an explicit hotkey-routing flag (keeps the late-CGEventTap-event
  guard the global was silently providing)
- Delete dead surface: old Call Recording saver + formatMarkdown,
  SpeakerProfileMerger name-merge API + name-variants table (MCP keeps its
  standalone mirror), unused wrappers in TranscriptionTaskManager,
  RetroactiveSpeakerUpdater (moved to a test helper), ParakeetEngine,
  ParakeetModelLifecycle, WhisperEngine, and an NSLock.withLock shadow of
  Foundation's own
- Hoist per-call regex compilation and DateFormatter allocation out of
  per-line scan loops (DictationTranscriptStore, RecentCaptureScanners,
  CaptureMarkdownParser, HomeView); stop SpeakerPeopleSettingsSection
  re-running its O(n) grouping several times per render; make the Agent
  page's collapsed disclosure stop stat()ing the filesystem every render
- Tools: CLI reads each meeting file once instead of three times and drops
  a write-only batch results array; MCP receipts tools stop hydrating
  titles twice (2x disk reads), dictation reads read the day file once,
  the SQLite indexer prepares INSERTs once per transaction, and the
  filename-title fallback is shared; QA dedups process termination, report
  writing, and the isolated-launch env block, and drops dead params

66 files changed, ~1,430 net lines removed. Verified: build-deps --force,
build.sh --no-open, run-tests.sh (12,203), run-integration-smoke.sh,
swift test (1,036), run-e2e-smoke.sh, and all four tool package suites.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The repo-hygiene CI step diffed the nickname table between TranscriptedCore
and the MCP server's standalone mirror. The Core copy was deleted in the
previous commit (its only consumer, the name-merge API, was dead code), so
there is nothing left to drift: remove the parity script, its workflow step,
and its README entry, and reword the MCP table's header as the sole copy.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…optimization-198164

# Conflicts:
#	Sources/TranscriptedCore/Audio/Audio.swift
#	Sources/TranscriptedCore/Audio/AudioDeviceRecovery.swift
#	Sources/TranscriptedCore/Audio/AudioFileManager.swift
#	Sources/TranscriptedCore/Audio/SystemAudioCaptureEngine.swift
#	Sources/TranscriptedCore/CLAUDE.md
#	Tools/TranscriptedCLI/Sources/TranscriptedCLI/ContextStore.swift
@r3dbars
r3dbars merged commit 1f7b318 into main Aug 24, 2026
7 checks passed
@r3dbars
r3dbars deleted the claude/ponytail-code-optimization-198164 branch August 24, 2026 19:51
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