How matthartman/ghost-pepper works
Purpose and runtime
Ghost Pepper is a macOS 14+/Apple Silicon menu-bar application for private, on-device dictation and meeting transcription. It captures microphone/system audio, runs local speech and cleanup models, and stores transcripts, summaries, and knowledge artifacts as local Markdown. Optional integrations can use user-configured cloud credentials.
Primary app entry points are GhostPepper/GhostPepperApp.swift and state composition in GhostPepper/AppState.swift; the Xcode project is GhostPepper.xcodeproj/project.pbxproj.
Application shell, permissions, and interaction
The SwiftUI menu-bar UI coordinates recording, settings, transcripts, model controls, search, and chat. App lifecycle utilities handle relaunch/update behavior. macOS permission boundaries are microphone, Accessibility (global hotkey and synthetic paste), and screen recording for OCR/window capture.
Key paths: GhostPepper/GhostPepperApp.swift, GhostPepper/AppState.swift, GhostPepper/PermissionChecker.swift, GhostPepper/UI/MenuBarView.swift.
Dictation control flow
A global Control-key monitor feeds chord/action handling and creates paste sessions. The recorder captures input audio; after release, the selected transcriber produces text, cleanup normalizes it, and the text paster injects it into the focused external application. Accessibility-based focused-element lookup and optional OCR provide contextual input to cleanup.
Key paths: GhostPepper/Input/HotkeyMonitor.swift, GhostPepper/Input/ChordEngine.swift, GhostPepper/Input/TextPaster.swift, GhostPepper/Audio/AudioRecorder.swift, GhostPepper/Context/FocusedElementLocator.swift.
Local transcription subsystem
RecordingSessionCoordinator owns recording-to-transcription orchestration. SpeechTranscriber selects among WhisperKit, FluidAudio, and MLX Audio implementations; chunked and streaming paths support recorded meetings and low-latency dictation. ModelManager/catalog manage downloadable local speech-model inventory and selection.
Key paths: GhostPepper/Transcription/RecordingSessionCoordinator.swift, GhostPepper/Transcription/SpeechTranscriber.swift, GhostPepper/Transcription/ChunkedTranscriptionPipeline.swift, GhostPepper/Transcription/FluidAudioSpeechSession.swift, GhostPepper/Transcription/NemotronStreamingModel.swift.
Cleanup and contextual correction
The cleanup manager is an abstraction boundary between deterministic correction and local LLM cleanup. It builds prompts from transcription plus OCR context, tracks learned corrections after paste, and invokes LLM.swift-backed local Qwen models. A standalone probe target isolates model validation/CLI execution.
Key paths: GhostPepper/Cleanup/TextCleanupManager.swift, GhostPepper/Cleanup/LocalLLMCleanupBackend.swift, GhostPepper/Cleanup/PostPasteLearningCoordinator.swift, CleanupModelProbe/main.swift.
Meeting capture, archive, and knowledge generation
Meeting detection identifies active calls; dual-stream capture records microphone and system audio. Transcripts, speaker identity resolution, summaries, and meeting Markdown are persisted locally. The Wiki subsystem chunks meeting content and uses structured local LLM output to generate/reconcile entities and cards; indexing builds searchable archive entries.
Key paths: GhostPepper/Meeting/MeetingDetector.swift, GhostPepper/Audio/DualStreamCapture.swift, GhostPepper/Meeting/MeetingMarkdownWriter.swift, GhostPepper/Wiki/GeneratedWikiEngine.swift, GhostPepper/Indexing/IndexBuilder.swift.
Search, QA, and integrations
QA is an agent layer over local meeting/wiki files, with sandboxed file tools and QMD/wiki search. Providers include local LLMs and an optional Anthropic-backed path, with credentials isolated through Keychain. Pepper Chat routes commands to optional Zo and Trello backends; Airtable and Granola importers ingest external meeting data.
Key paths: GhostPepper/QA/MeetingQAAgent.swift, GhostPepper/QA/PathSandbox.swift, GhostPepper/QA/AnthropicProvider.swift, GhostPepper/PepperChat/PepperChatSession.swift, GhostPepper/Meeting/GranolaImporter.swift.
Infrastructure and operational boundaries
Inference is local through WhisperKit, FluidAudio, MLX Audio, and LLM.swift; model artifacts are downloaded once from Hugging Face and cached locally. Sparkle-style update metadata is represented by appcast.xml; usage and debug data remain local. Signing, entitlement, and privacy constraints are central to macOS deployment.
Key paths: GhostPepper/ModelInventory.swift, GhostPepper/UpdaterController.swift, GhostPepper/GhostPepper.entitlements, GhostPepper/UsageStats/UsageStatsStore.swift, PRIVACY_AUDIT.md.
Main entry points: RecordingSessionCoordinator.swift Recording coordinator · SpeechTranscriber.swift Speech transcriber · MeetingMarkdownWriter.swift Meeting Markdown archive · TextCleanupManager.swift Text cleanup
Components 25
macOS Shell
- App composition · Menu-bar lifecycle and shared application state.
GhostPepper/GhostPepperApp.swift - Menu-bar UI
GhostPepper/UI/MenuBarView.swift - Permissions · Controls microphone, Accessibility, and screen-recording access.
GhostPepper/PermissionChecker.swift
Dictation
- Global hotkey
GhostPepper/Input/HotkeyMonitor.swift - Chord actions
GhostPepper/Input/ChordEngine.swift - Microphone recorder
GhostPepper/Audio/AudioRecorder.swift - Focused-app context · Finds focused input; OCR can supplement cleanup context.
GhostPepper/Context/FocusedElementLocator.swift - Text paster · Injects cleaned dictation into the focused external app.
GhostPepper/Input/TextPaster.swift - Text cleanup · Combines deterministic correction, local LLM cleanup, and contextual prompts.
GhostPepper/Cleanup/TextCleanupManager.swift - Post-paste learning
GhostPepper/Cleanup/PostPasteLearningCoordinator.swift
Local Speech
- Recording coordinator · Owns recording-to-transcription lifecycle.
GhostPepper/Transcription/RecordingSessionCoordinator.swift - Speech transcriber · Selects WhisperKit, FluidAudio, or MLX Audio transcription.
GhostPepper/Transcription/SpeechTranscriber.swift - Chunked transcription · Processes recorded meetings in chunks.
GhostPepper/Transcription/ChunkedTranscriptionPipeline.swift - Streaming speech
GhostPepper/Transcription/FluidAudioSpeechSession.swift - Model inventory · Downloads and caches selectable local model artifacts.
GhostPepper/ModelInventory.swift
Meetings & Knowledge
- Meeting detection
GhostPepper/Meeting/MeetingDetector.swift - Dual-stream capture · Captures microphone and system audio.
GhostPepper/Audio/DualStreamCapture.swift - Meeting Markdown archive · Persists transcripts, speaker resolution, and summaries locally.
GhostPepper/Meeting/MeetingMarkdownWriter.swift - Generated wiki · Generates and reconciles entities and cards from meeting content.
GhostPepper/Wiki/GeneratedWikiEngine.swift - Archive index
GhostPepper/Indexing/IndexBuilder.swift
QA & Integrations
- Meeting QA agent · Answers over local meeting and wiki files.
GhostPepper/QA/MeetingQAAgent.swift - Path sandbox
GhostPepper/QA/PathSandbox.swift - Anthropic provider · Uses user-configured credentials isolated through Keychain.
GhostPepper/QA/AnthropicProvider.swift - Pepper Chat · Routes commands to optional Zo and Trello backends.
GhostPepper/PepperChat/PepperChatSession.swift - Granola importer
GhostPepper/Meeting/GranolaImporter.swift
Connections 29
- App composition → Menu-bar UI: renders
- App composition → Permissions: checks
- Menu-bar UI → Recording coordinator: controls
- Menu-bar UI → Pepper Chat: opens
- Permissions → Global hotkey: authorizes
- Permissions → Focused-app context: authorizes
- Global hotkey → Chord actions: feeds
- Chord actions → Recording coordinator: starts/stops
- Recording coordinator → Microphone recorder: records
- Recording coordinator → Speech transcriber: submits audio
- Speech transcriber → Chunked transcription: uses for batch
- Speech transcriber → Streaming speech: uses for live
- Model inventory → Speech transcriber: supplies speech models
- Recording coordinator → Text cleanup: sends transcript
- Focused-app context → Text cleanup: provides context
- Text cleanup → Text paster: returns cleaned text
- Text paster → Post-paste learning: records corrections
- Post-paste learning → Text cleanup: improves corrections
- Meeting detection → Dual-stream capture: triggers
- Dual-stream capture → Recording coordinator: supplies meeting audio
- Chunked transcription → Meeting Markdown archive: produces transcript
- Meeting Markdown archive → Generated wiki: sources content
- Generated wiki → Archive index: indexes artifacts
- Meeting Markdown archive → Archive index: indexes meetings
- Archive index → Meeting QA agent: retrieves local knowledge
- Path sandbox → Meeting QA agent: limits file tools
- Anthropic provider → Meeting QA agent: optional model path
- Granola importer → Meeting Markdown archive: ingests meetings
- Pepper Chat → Meeting QA agent: routes knowledge commands