A native Swift/SwiftUI menu bar app for capturing text snippets from any application and using a local LLM (Ollama) for context-aware summarization. Organize snippets into multiple contexts, edit them, and generate AI summaries—all running locally on your machine with no cloud dependencies.
- Text Capture: Capture text snippets from any app using global keyboard shortcuts
- Capture Selection (⌥⌘E): Captures selected text without modifying clipboard
- Copy & Capture (⌥⌘T): Copies to clipboard AND adds to context
- Multiple Contexts: Organize snippets into named contexts (e.g., "Feature PR", "Research Notes", "Meeting Notes")
- Context Management:
- Switch between contexts with keyboard shortcut
- Context menu actions: Save to file, Summarize & Copy, Clear snippets
- Menu bar icon shows current context number
- Local AI Integration:
- Uses Ollama for local LLM inference
- Generate structured summaries of captured snippets
- Customizable system prompts
- Configurable response length limits
- Snippet Management:
- Edit snippets inline
- Delete individual snippets
- Clear all snippets from a context
- Auto-delete empty snippets
- Privacy-First: All data stays on your machine, no cloud services
- macOS 13.0+ (Ventura)
- Xcode 14.0+
- Swift 5.9+
- Ollama installed and running locally
-
Install Ollama:
brew install ollama # or download from https://ollama.ai -
Start Ollama service:
ollama serve
-
Download a model (optional, can be done through the app):
ollama pull phi3:mini # or any other model you prefer
-
Clone the repository:
git clone <repository-url> cd cntxtr
-
Open the project in Xcode:
open cntxtr.xcodeproj
-
Build and run:
- Select the
Cntxtrscheme - Press ⌘R to build and run
- Select the
-
On first launch:
- Grant Accessibility permissions when prompted
- Configure keyboard shortcuts
- Download a model through the Preferences panel
- Complete the onboarding flow to:
- Grant Accessibility permissions (required for text capture)
- Configure keyboard shortcuts
- Download your first LLM model
- Select text in any application
- Press ⌥⌘E to capture selected text (doesn't modify clipboard)
- OR press ⌥⌘T to copy to clipboard AND capture
- The snippet is added to your current context with metadata (source app, timestamp)
- Switch Contexts: Press ⌥⌘[ to cycle to the next context
- Create New Context: Click the menu bar icon → "New Context..."
- Context Menu: Right-click any context in the menu for:
- Save to File: Export all snippets to a text file
- Summarize & Copy: Generate AI summary and copy to clipboard
- Clear Snippets: Remove all snippets (with confirmation)
- Open AI Panel: Click menu bar icon → "Open Cntxtr..."
- View Snippets: See all captured snippets for the current context
- Generate Summary: Click "Generate Summary" to create an AI-powered summary
- Edit Snippets: Click any snippet to edit its content
- Delete Snippets: Click the delete button on any snippet
| Shortcut | Action |
|---|---|
⌥⌘E |
Capture selected text (without clipboard) |
⌥⌘T |
Copy & Capture (copies to clipboard AND adds to context) |
⌥⌘[ |
Cycle to next context |
⌥⌘S |
Summarize current context & copy to clipboard |
All shortcuts can be customized in Preferences.
Customize the AI's behavior by setting a custom system prompt in Preferences → AI Settings. The default prompt is optimized for context summarization.
Limit AI response length by setting "Max Response Tokens" in Preferences → AI Settings. Default: 500 tokens.
- Add Models: Enter any Ollama model name in Preferences → Model Settings
- Pull Models: Download new models directly from the app
- Switch Models: Select from downloaded models in the dropdown
Cntxtr requires Accessibility permissions to capture text from other applications. This permission is:
- Requested during onboarding
- Required for the "Capture Selection" shortcut
- Can be granted in System Settings → Privacy & Security → Accessibility
Cntxtr/
├── Cntxtr/ # App target
│ ├── App/
│ │ ├── CntxtrApp.swift
│ │ ├── MenuBarController.swift
│ │ └── WindowManager.swift
│ ├── Assets.xcassets/ # App icon and logo assets
│ ├── UI/
│ │ ├── MenuBarView.swift
│ │ ├── ContextListView.swift
│ │ ├── AIPanelView.swift
│ │ ├── PreferencesView.swift
│ │ ├── OnboardingView.swift
│ │ └── ToastView.swift
│ └── Shortcuts/
│ └── ShortcutManager.swift
├── CntxtrCore/ # Swift Package
│ ├── Models/
│ │ ├── Context.swift
│ │ └── Snippet.swift
│ ├── Persistence/
│ │ ├── PersistenceController.swift
│ │ └── CntxtrModel.xcdatamodeld/
│ ├── Services/
│ │ ├── ContextService.swift
│ │ ├── SnippetService.swift
│ │ ├── ClipboardManager.swift
│ │ └── AccessibilityService.swift
│ └── Llm/
│ ├── OllamaService.swift
│ ├── ModelManager.swift
│ └── PromptTemplates.swift
└── Scripts/
├── build_dmg.sh
└── sign_and_notarize.sh
- SwiftUI + AppKit: Native macOS UI with menu bar integration
- Core Data: Local persistence for contexts and snippets
- Ollama API: HTTP-based integration with local Ollama service
- Accessibility API: Direct text selection capture from any app
- Swift Package Manager: Modular architecture with
CntxtrCorepackage
# Run all tests
xcodebuild test -scheme Cntxtr -destination 'platform=macOS'
# Or use Xcode: ⌘U- Archive the app in Xcode (Product > Archive)
- Export the archive
- Run the signing script:
./Scripts/sign_and_notarize.sh path/to/Cntxtr.app
./Scripts/build_dmg.sh 1.0.0- Ensure Accessibility permissions are granted in System Settings
- Restart the app after granting permissions
- Check that Ollama is running:
ollama list
- Verify Ollama is running:
ollama serve - Check that a model is downloaded:
ollama list - Verify model name in Preferences matches downloaded model
- Check Console.app for error logs
The app appears in the app switcher (⌘⇥) when windows are open. If no windows are open, it runs as a menu bar-only app.
See LICENSE.md for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- Built with SwiftUI
- LLM integration via Ollama
- Keyboard shortcuts via KeyboardShortcuts