Skip to content

Yoons-AI-LAB/NeuralClip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NeuralClip

Cognitive Memory Engine — Context Engineering Beyond Token Limits

NeuralClip Banner

NeuralClip is an intelligent clipboard daemon that turns your everyday copy-paste into a semantic memory pipeline.
It enables small language models (0.5B–3B) to overcome their context window limits by acting as an external working memory gateway.


🧠 The Problem

Every AI model — from GPT-4 to a local 1.5B — suffers from the same fundamental flaw:
limited context windows. When conversations grow long, models lose track, compress poorly, or hallucinate.

Meanwhile, your clipboard — the most-used data channel in computing — remains a dumb byte buffer that:

  • Strips all meaning the moment you copy
  • Cannot remember what you copied 5 minutes ago
  • Is vulnerable to injection attacks

💡 The Solution

NeuralClip transforms your clipboard into a cognitive memory layer:

Feature Description
Sentinel Model 🦅 Ultra-light LLM (0.5B) runs 24/7, tagging every clip with intent, type, and threat level in <0.3s
Semantic Lifecycle Clips auto-expire: 1hr (OTP), 24hr (code), ∞ (architecture docs) — AI decides
Immune Layer 🛡️ Real-time defense against clipboard hijacking, crypto address swaps, and injection attacks
Duplicate Detection 🔗 SHA-256 dedup prevents memory pollution
Core Collaboration 🦛 When a large model needs context, Sentinel serves curated pointers — not raw dumps

🏗️ Architecture

   User: Ctrl+C
       │
       ▼
 ┌─────────────┐     ┌──────────────┐     ┌─────────────────┐
 │  OS Hook    │ ──▶ │ Immune Layer │ ──▶ │ Sentinel (0.5B) │
 │  (Win32)    │     │  (Security)  │     │  Intent Tagger  │
 └─────────────┘     └──────────────┘     └────────┬────────┘
                                                   │
                                    ┌──────────────▼──────────────┐
                                    │     Lifecycle Manager       │
                                    │  ┌───────┬────────┬──────┐  │
                                    │  │Tier 1 │ Tier 2 │Tier 3│  │
                                    │  │ 1 hr  │ 24 hr  │  ∞   │  │
                                    │  │ (OTP) │ (Code) │(Arch)│  │
                                    │  └───────┴────────┴──────┘  │
                                    │         SQLite DB           │
                                    └─────────────────────────────┘
                                                   │
                                          ┌────────▼────────┐
                                          │  Core Model(8B) │
                                          │  On-demand only  │
                                          └─────────────────┘

🌱 Self-Evolving Local SLM (자율 진화 로컬 모델)

NeuralClip is intrinsically designed to create an automated Reinforcement Learning (RL) Pipeline right on your machine using an ultra-lightweight local LLM (e.g., Qwen2.5 0.5B or Llama-3.2 1B). Instead of relying on static cloud models, it learns your exact clipboard habits:

  1. Phase 1: Instinct Data Collection By default, the regex-based Instinct Mode continuously labels your clipboard behavior, generating raw SFT (Supervised Fine-Tuning) data silently saved to data/sft_pairs/.
  2. Phase 2: Distillation & SFT When enough pairs are collected, the local 0.5B model is fine-tuned (e.g., via Unsloth) to perfectly replicate your personal clipboard categorization logic.
  3. Phase 3: GRPO (Generative Reward Policy Optimization) If the Sentinel makes a misclassification, any user correction acts as a Reward +1 / -1 signal. NeuralClip queues these lessons and performs background GRPO training.
  4. Phase 4: Hot-Swap Deployment The continuously optimizing model is hot-swapped into the running Daemon. Your Sentinel gets smarter, faster, and more personalized over time, entirely offline.

🚀 Quick Start

# 1. Clone
git clone https://github.com/YourOrg/NeuralClip.git
cd NeuralClip

# 2. Setup
python -m venv .venv
.venv\Scripts\activate       # Windows
pip install -r requirements.txt

# 3. Launch (works IMMEDIATELY — no AI setup needed!)
python src/main.py

That's it. NeuralClip runs in Instinct mode out of the box (zero cost, zero setup). When you're ready, connect any AI provider by editing config.json:

⚙️ Configuration (Provider-Agnostic)

Edit config.json in the project root. Just change one line to switch backends:

{
  "sentinel_provider": "ollama",
  "sentinel_model": "qwen2.5:0.5b"
}

Supported Providers

Provider sentinel_provider Setup Cost
Instinct "instinct" None needed Free (regex only)
Ollama "ollama" ollama pull qwen2.5:0.5b Free (local)
OpenAI "openai" Add API key to config Pay-per-use
Anthropic "anthropic" Add API key to config Pay-per-use
OpenRouter "openrouter" Add API key to config Pay-per-use
Custom "custom" Set your own base_url Varies

Example: Using OpenAI

{
  "sentinel_provider": "openai",
  "sentinel_model": "gpt-4o-mini",
  "providers": {
    "openai": {
      "api_key": "sk-your-key-here"
    }
  }
}

📁 Project Structure

NeuralClip/
├── src/
│   ├── main.py                 # Daemon orchestrator
│   ├── interceptor/
│   │   └── hook_win.py         # Windows clipboard hook (native)
│   └── engine/
│       ├── config.py           # Provider-agnostic configuration
│       ├── llm_bridge.py       # Universal Sentinel engine
│       ├── lifecycle_manager.py# Memory tier + PinClaw handoff
│       └── immune.py           # Security gate
├── data/
│   ├── neural_clip.db          # Runtime memory database
│   ├── handoff/                # PinClaw Handoff JSON output
│   └── sft_pairs/              # Auto-collected training data
├── docs/
│   ├── PINCLAW_SYMBIOSIS.md    # PinClaw integration spec
│   └── SENTINEL_TRAINING_SPEC.md # 0.5B distillation roadmap
├── config.json                 # User configuration (1 line to switch AI)
├── requirements.txt            # Minimal deps (pywin32, requests)
└── README.md

🤝 Dual-Model & Symbiosis Philosophy

NeuralClip implements the Sentinel-Core Symbiosis pattern alongside PinClaw Integration:

  • Sentinel (악어새 / Oxpecker): A tiny distilled model (0.5B, see Training Spec) that runs offline 24/7. It curates, tags, and filters.
  • PinClaw Vault (악어입 / Crocodile Mouth): Via JSON Handoff, Sentinel dumps high-value clips directly into PinClaw's auto-research growth loop (see PinClaw Symbiosis).
  • Core (하마 / Hippo): The large model (8B+) sleeps until deep reasoning is needed, operating purely on curated semantic pointers.

This means a 3B local model can effectively maintain infinite context through NeuralClip's external memory.

📄 License

Apache License 2.0 — See LICENSE for details.


Built by Antigravity Hub
Context Engineering Beyond Token Limits

About

No description, website, or topics provided.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages