altra's profile picture
altra

context

Public

Give your local model situational awareness: clipboard contents, the active window, running apps, and system info.

229 Downloads

2 stars

README

Context Plugin for LM Studio — Live System Context for Your Local AI

Keywords: lm studio plugin, system context ai, clipboard ai, active window awareness, local context injection, private system monitoring, no cloud, macos ai context

Live system context for LM Studio. Gives the model instant access to your clipboard, active window, running apps, and system info — on demand via tools, or automatically injected into every new chat session.


What It Does

  • Clipboard reading — paste-and-ask without copying text manually
  • Active window — know which app and window you're focused on
  • Running apps — list all visible applications currently open
  • System info — platform, CPU, RAM, hostname, username
  • Auto-injection — clipboard content optionally prepended to every new chat session

Who This Is For

  • Developers who want their AI to see the current code or error message on their clipboard without manual pasting
  • Power users who want context-aware responses based on the app they're currently using
  • Privacy-conscious users who won't send clipboard contents to cloud AI services and need a fully local alternative
  • Anyone using LM Studio as a daily assistant who wants zero-friction paste-and-ask workflows

Installation

cd context-plugin
npm install
npm run build

Load the built plugin folder in LM Studio.


Requirements

  • macOS — clipboard, active window, and running apps require macOS (uses pbpaste and AppleScript)
  • System info works on all platforms

Configuration

FieldDefaultDescription
Inject Clipboard into PromptfalsePrepend clipboard contents to every new chat session
Max Clipboard Characters8000Truncate clipboard at this length to avoid oversized prompts

Tool: context

Single tool with four actions.

clipboard

Get the current clipboard text.

context(action="clipboard")

Returns { chars, content }. Truncated at Max Clipboard Characters if oversized.

active_window

Get the frontmost application and window title.

context(action="active_window")

Returns { active_app, window_title }.

running_apps

List all visible (non-background) running applications.

context(action="running_apps")

Returns { count, apps } — sorted alphabetically.

system

OS and hardware info.

context(action="system")

Returns { platform, os_release, arch, hostname, username, cpu, ram_total_gb, ram_free_gb, ram_used_pct }.


How Clipboard Injection Works

When Inject Clipboard into Prompt is enabled, the first message of every session gets the clipboard prepended:

[Clipboard contents:
<clipboard text here>
]

<your message here>

This enables a fast paste-and-ask workflow: copy something → open LM Studio → ask your question — the model already has the context. Disable if you prefer to ask explicitly via context(action="clipboard").


Example Workflows

Ask about something you just copied:

"Explain this" (with clipboard injection enabled — the copied text is already in context)

Check what's in the clipboard:

"What do I have in my clipboard?" → context(action="clipboard")

Situational awareness:

"What am I working on right now?" → context(action="active_window")

Debug environment:

"What machine am I on?" → context(action="system")

💚 Support Development

This plugin is free and open source. If you find it useful, consider supporting development:

Ko-fi
TierAmountPerks
☕ Coffee$3Name in credits
🍔 Lunch$10+ Priority support
🍕 Pizza$25+ Name in README
🏆 Founding$50+ Lifetime support, consultation

Every coffee helps keep this project alive! ☕