Skip to content

CTRL-Magic/Ctrl_Magic

Repository files navigation

Ctrl+Magic

Smart clipboard that uses Gemini to extract structured data from what you copy, stores it in Snowflake.

Quick Setup

Need Snowflake account (trial works), Gemini API key, Visual Studio, Python 3.8+.

  1. Create .env in root folder:
SNOWFLAKE_CONNECTION_STRING="scheme=https;account=YOUR_ACCOUNT;user=YOUR_USER;password=YOUR_PASSWORD;role=ACCOUNTADMIN;warehouse=CTRL_MAGIC_WH;db=CTRL_MAGIC_DB;schema=CORE"
GEMINI_API_KEY="YOUR_KEY"
  1. Setup DB:
cd db-setup
pip install snowflake-connector-python python-dotenv
python setup.py
  1. Open CtrlMagicWindowsApp.sln in Visual Studio.
  2. Build the solution.
  3. Run the application.
  4. It will run silently in the system tray.
    • Ctrl+C on text/files: Captures and processes content.
    • Ctrl+M: Intelligent Paste.

App sits in system tray, processes clipboard on Ctrl+C. Smart paste (Ctrl+Shift+V) comming soon.

On startup, the app runs a self-test:

  1. Checks Snowflake connection (TODO).
  2. Sends a "Hello" prompt to Gemini and prints the JSON response to the Debug Console.

🏗️ Architecture

  • Frontend: Windows Forms (hidden), Keyboard Hooks.
  • AI: Gemini 2.0 Flash (via REST API).
  • Backend: Snowflake (Hybrid Tables / Standard Tables).
  • Background Service: Python service on Vultr VM for data cleanup.

🧹 Background Cleanup Service (vultr-background)

A Python service that runs on a Vultr VM to automatically analyze and clean sensitive data from clipboard history using Snowflake Cortex LLM.

Features

  • Privacy Analysis: Uses Snowflake Cortex AI to detect PII, passwords, API keys, financial data.
  • Confidence-Based Decisions: Configurable thresholds for auto-remove, flag for review, or retain.
  • Audit Logging: All cleanup actions logged to CLEANUP_AUDIT_LOG for compliance.
  • Dry-Run Mode: Test analysis without deleting data.

ChromaDB is used by defult, for more advanced use cases A-MEM agentic LLM memory DB used from https://arxiv.org/abs/2502.12110.

Setup

  1. Create a .env file in vultr-background/:

    SNOWFLAKE_ACCOUNT=YOUR_ORG-YOUR_ACCOUNT
    SNOWFLAKE_USER=YOUR_USER
    SNOWFLAKE_PASSWORD=YOUR_PASSWORD
    SNOWFLAKE_WAREHOUSE=CTRL_MAGIC_WH
    SNOWFLAKE_DATABASE=CTRL_MAGIC_DB
    SNOWFLAKE_SCHEMA=CORE
    DRY_RUN=true
  2. Install dependencies:

    cd vultr-background
    pip install -r requirements.txt
  3. Run the schema setup in Snowflake:

    snowsql -f sql/setup_schema.sql

Running

# Run once (for testing)
python main.py --once

# Run as scheduled service (every 6 hours by default)
python main.py

# Check status
python main.py --status

Deployment

  • Docker: docker-compose up -d
  • Systemd: Use systemd/data-cleanup.service for production Linux servers.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •