Skip to content

prtk1910/CoreContext

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CoreContext app icon

CoreContext

Turn your current macOS screen, clipboard, and active app into an editable AI prompt.

CoreContext is a privacy-first, transient macOS 15+ utility. Invoke it from a keyboard shortcut, review the live context, choose an intent and AI model, and generate a Markdown prompt ready to paste into another assistant. CoreContext stays open after copying so you can copy another representation or continue editing, and keeps no prompt or screenshot history after it closes.

Screenshots

Review live context

CoreContext capture and provider screen

Choose which sources to include, optionally extract screenshot text with model-based OCR, select a provider and model, and review the exact screenshot before sending it.

Edit and copy the result

CoreContext generated prompt editor

Edit the generated Markdown, then copy the prompt, screenshot, or both.

Features

  • Live display preview that refreshes every second and captures once more when Generate Prompt is pressed.
  • Display-under-pointer capture or a fixed display with automatic fallback when that display is unavailable.
  • Independent toggles for screenshot, clipboard text, and source application name.
  • Ask, Explain, Fix, Summarize, and Rewrite intents.
  • Live model discovery and selection for Google, OpenAI, and OpenRouter.
  • One separately stored API key per provider, kept in macOS Keychain behind masked fields.
  • Optional model-based OCR that inserts extracted screenshot text directly into the generated Markdown.
  • Editable Markdown output with explicit Copy Prompt, Copy Screenshot, and Copy Both actions.
  • No background daemon, automatic paste, history, analytics, or cloud backend.

Privacy model

CoreContext is designed to make every transfer visible and deliberate:

  • API keys are stored only in macOS Keychain and are never loaded back into visible fields.
  • Screenshots, clipboard text, OCR output, and generated prompts remain in memory and are not written to disk or logged.
  • The App source includes only the name of the application active when CoreContext opened, such as Safari or Xcode. It does not include files, app binaries, window metadata, or additional app contents.
  • CoreContext excludes its own window from screen capture.
  • API screenshots are resized to a maximum 2560-pixel long edge. The original remains in memory for clipboard output.
  • OpenAI requests set store: false.
  • OpenRouter defaults to openrouter/free. Selecting another model is explicit and may incur that model's published charges; CoreContext never changes models or performs an automatic paid fallback.

Requirements

  • macOS 15 or newer.
  • Xcode or a matching Apple Command Line Tools installation.
  • A Google, OpenAI, or OpenRouter API key for the provider you want to use.
  • Screen Recording permission for CoreContext.

Install

git clone https://github.com/prtk1910/CoreContext.git
cd CoreContext
swift test
scripts/install.sh

The installer places the app at ~/Applications/CoreContext.app and links the command to ~/.local/bin/corecontext. Add ~/.local/bin to PATH if your shell does not already include it.

First-time setup

  1. Launch CoreContext:

    corecontext capture
  2. Enable CoreContext in System Settings → Privacy & Security → Screen & System Audio Recording when prompted. Relaunch after changing the permission.

  3. Enter a key for Google, OpenAI, and/or OpenRouter in its masked row and press Save. A green check confirms that provider has a Keychain item.

  4. Select the provider. CoreContext loads the models available to that key into the Model dropdown. Use the refresh button if provider access changes.

  5. Optionally create the keyboard shortcut described below.

Usage

  1. Invoke corecontext capture or the ⌘⇧C Shortcut.
  2. Confirm the live screenshot and select the sources to include:
    • Screenshot sends the image to the generation request.
    • Clipboard includes text captured when CoreContext opened.
    • App includes only the originating application name.
    • OCR sends the screenshot to the selected model in one additional request, uses the extracted text as context, and inserts the real text into the generated prompt without a paste placeholder.
  3. Choose an intent, display preference, provider, and model.
  4. Press Generate Prompt. CoreContext freezes a final fresh screenshot so the generated context and clipboard image match.
  5. Edit the Markdown if needed.
  6. Choose Copy Prompt, Copy Screenshot, or Copy Both. CoreContext stays open until you press Cancel or close the window.

Clipboard behavior

Copy Both writes the prompt and screenshot as separate macOS pasteboard items. The receiving application decides which item types and how many items it accepts; some apps paste only the text or only the image. Use the explicit Prompt or Screenshot action when the destination does not support both items.

Model compatibility

Provider model lists can include specialized or text-only models. Screenshot generation and OCR require a model that accepts image input and produces text. If a selected model does not support the request, CoreContext shows the provider error without switching models automatically.

Add the ⌘⇧C Shortcut

  1. Open the macOS Shortcuts app and create a shortcut named CoreContext Capture.

  2. Add Run Shell Script with:

    "$HOME/.local/bin/corecontext" capture
  3. Open the shortcut details, add a keyboard shortcut, and press ⌘⇧C.

  4. If it conflicts with another command, change that shortcut in System Settings → Keyboard → Keyboard Shortcuts or choose a different combination.

Commands

corecontext capture  # open a fresh capture window
corecontext doctor   # check OS, installation, and setup guidance

Development

CoreContext is a dependency-free Swift Package using SwiftUI, AppKit, ScreenCaptureKit, and Security.framework.

swift build
swift test
scripts/build-app.sh   # assemble and ad-hoc sign build/CoreContext.app
scripts/install.sh     # build and install into ~/Applications

The generated app icon is reproducible:

swift scripts/generate-icon.swift "$PWD"

The package separates reusable capture/provider code in CoreContextKit, the SwiftUI app executable, and the corecontext launcher CLI. The internal CLI artifact is named corecontext-cli to avoid a case-insensitive filesystem collision with the CoreContext app executable.

Error handling

The UI reports missing or rejected keys, rate limits, unavailable models, timeouts, malformed responses, cancellation, Screen Recording denial, and model-list failures. Failed live screenshot refreshes preserve the latest valid frame.

Current scope

CoreContext is a local MVP. It does not include an App Store release, notarization, menu-bar daemon, browser extension, assistant launcher, automatic paste, prompt history, chat interface, or paid-model fallback.

License

CoreContext is licensed under the GNU General Public License v3.0.

About

Ctrl C++

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors