ai-context-workbench
README.md
<p align="center">
<img src="docs/cover-contextforge.jpg" alt="ContextForge — Local-First AI Context Workbench for Claude, ChatGPT, Gemini, Cursor, Ollama, and MCP" width="100%" />
</p>
<h1 align="center">ContextForge (AI Context Workbench)</h1>
<p align="center">
<strong>Prepare better context for every AI — 100% locally.</strong><br />
Turn messy PDFs, Office files, emails, spreadsheets, websites, YouTube transcripts, and public GitHub repositories into clean, citation-backed, secret-scrubbed <strong>Context Packs</strong> for Claude 5.5, ChatGPT (GPT-6.2), Gemini 4, Cursor, and Ollama.
</p>
<p align="center">
<a href="https://waterdolphinkiller.github.io/ai-context-workbench/"><strong>Live Interactive Demo & 10 Free Local Tools</strong></a> ·
<a href="https://github.com/waterdolphinkiller/ai-context-workbench/releases"><strong>Download macOS / Windows App</strong></a> ·
<a href="docs/context-pack-spec.md"><strong>Context Pack Spec</strong></a> ·
<a href="docs/mcp-guide.md"><strong>MCP Guide</strong></a> ·
<a href="llms.txt"><strong>llms.txt</strong></a>
</p>
<p align="center">
<img src="https://img.shields.io/badge/version-3.7.0-0b5d47?style=flat-square" alt="Version 3.7.0" />
<img src="https://img.shields.io/badge/license-Apache--2.0-141518?style=flat-square" alt="Apache-2.0 License" />
<img src="https://img.shields.io/badge/privacy-100%25%20Local--First-0b5d47?style=flat-square" alt="100% Local-First" />
<img src="https://img.shields.io/badge/tests-59%2F59%20Passing-0b5d47?style=flat-square" alt="59/59 Tests Passing" />
<img src="https://img.shields.io/badge/MCP-9%20Read--Only%20Tools-9a7b4f?style=flat-square" alt="9-Tool MCP Server" />
</p>
---
## See ContextForge in 16 Seconds
<p align="center">
<img src="docs/demo-contextforge.gif" alt="ContextForge v3.7.0 16-second product walkthrough: local multi-format ingestion, automatic API key and US SSN scrubbing, $49 vs $59 conflict detection, AST code compression, and 1-click export / MCP" width="840" />
</p>
<p align="center">
<strong>HD Video Walkthrough (1280×720 · 30fps · with ambient audio):</strong><br />
<a href="docs/contextforge-v3.7.0-showcase.mp4">▶ Download / Play <code>docs/contextforge-v3.7.0-showcase.mp4</code> (1.75 MB)</a>
</p>
> **Tip for GitHub Web Viewing:** GitHub renders the animated GIF above automatically on every device. To embed an inline clickable MP4 player directly in the GitHub UI, drag and drop `docs/contextforge-v3.7.0-showcase.mp4` into the GitHub README editor once — GitHub will automatically generate an inline `<video>` CDN URL.
---
## Why We Built ContextForge: The Tuesday Afternoon Problem
Picture a normal Tuesday afternoon for an analyst, founder, attorney, or software engineer in the US:
You have a **50-page locked SEC 10-K or M&A diligence PDF**, a **live pricing page** that quietly changed from **$49/mo to $59/mo**, three client **`.eml` email threads**, a **100,000-row CSV ledger**, and a **GitHub repository** you need to review before a 4:00 PM meeting.
If you drag those raw files straight into a cloud chat window, four predictable things go wrong:
1. **Repeated page headers, footers, and boilerplate bury the actual tables**, wasting thousands of tokens and degrading retrieval accuracy.
2. **Contradictory figures silently blend together** — the model cites last February's `$49/mo` PDF price instead of November's `$59/mo` live page without telling you they conflict.
3. **Accidental credential or PII leaks** — a forgotten OpenAI/AWS API key, database password URI, `.env` secret, or **US Social Security Number (`XXX-XX-XXXX`)** gets uploaded into a third-party chat log.
4. **Zero portability** — if you want to switch from Claude to ChatGPT, Gemini, Cursor, or air-gapped local Ollama, you have to re-upload and re-clean every file from scratch.
**ContextForge owns that exact upstream step.** It is the missing **AI Context Preparation Studio** that runs 100% locally on your own machine: ingesting 20+ formats, auditing extraction quality across 10 concrete checks, scrubbing secrets automatically, flagging cross-document conflicts, compressing codebases with AST Skeletons, and delivering clean, verifiable **Context Packs** to any AI you choose.
---
## How ContextForge Compares
| Workflow Need | Direct Chat Upload | Ad-Hoc Python / Bash Scripts | **ContextForge Studio (v3.7.0)** |
| :--- | :--- | :--- | :--- |
| **Privacy & US PII Scrubbing** | Uploads raw files to third-party cloud | Manual regex maintenance | **100% local + auto-scrubs API keys, JWTs, DB URIs & US SSNs** |
| **Cross-Document Conflicts** | Silently blends outdated & new numbers | Not detected | **Flags numeric & pricing contradictions with source dates** |
| **Verifiable Citations** | Locked inside one vendor chat thread | Lost when files are concatenated | **100% page, slide, sheet row, timestamp & code-line provenance** |
| **Original PDF Verification** | No side-by-side extraction audit | Text dump only | **Built-in Evidence Split View with inline original PDF viewer** |
| **Codebase Token Compression** | Truncates or blows context limits | Blind character slicing | **Python/TS AST Code Skeleton (-55% to -75% tokens) + Full Pack kept** |
| **Multi-AI Portability** | Single vendor lock-in | Static `.txt` file | **1-Click Markdown/XML Copy · Portable `.zip` · 9-Tool MCP · CLI** |
---
## Measured Local Performance (Zero Cloud Dependencies)
Every number below is measured locally on standard CPU hardware using our automated benchmark and chaos test suites — no synthetic estimates:
| Workload | Measured Performance | Key Guarantee |
| :--- | :--- | :--- |
| **50-page encrypted PDF** (auto-unlock + 100/100 header/footer strip + 5/5 tables) | **53.4 ms** | `0.0%` garbled text · `100%` page provenance |
| **100,000-row GB18030 semicolon CSV** (streaming ingestion) | **36.7 ms** | `O(1)` RAM streaming (`500k` rows in `189.4 ms`) |
| **2,000-block mixed deduplication** (8-Band × 2-Hash MinHash-LSH) | **178.1 ms** | **99.0% near-duplicate recall · 0% false positives** |
| **Incremental SQLite WAL + FTS5 search & append** | **1.54 ms** search / **0.63 ms** append | Thread-safe `RLock` + `busy_timeout=5000` + atomic snapshots |
| **15-thread concurrent chaos stress test** | **0 failures** | **9.1 MB** peak Python memory |
| **17 corrupted / malformed binary & archive formats** | **0 crashes** | Graceful error reporting + ZIP traversal block |
| **Unrequested cloud file uploads** | **0 Bytes** | Strictly local-first by architecture |
---
## Core Capabilities
- **Universal 20+ Format Local Ingest (~95% Real-World Coverage)**: Drag and drop anywhere on the workspace or press `⌘V / Ctrl+V` to ingest `PDF`, `DOCX`, `XLSX`, `PPTX`, `CSV/TSV`, `JSON/JSONL`, `XML/YAML`, `EML/MBOX` email archives, `EPUB`, `RTF`, batch `ZIP` (with path-traversal protection), Markdown, HTML, VTT/SRT YouTube transcripts, same-domain websites, and public **GitHub repository URLs** (respecting `.gitignore`).
- **Red-Team Local Secret & US PII Redaction**: Automatically scrubs OpenAI, Anthropic, GitHub PAT, AWS, Google, Stripe, and Slack keys, JWTs, Postgres/MySQL/MongoDB/Redis connection strings with passwords, `.env` secret assignments, RSA/OpenSSH private keys, and **US Social Security Numbers (`XXX-XX-XXXX`)** before clipboard copy or export — paired with SSRF guards blocking `localhost`, RFC1918, and obfuscated IPs.
- **10-Point Extraction Quality Scorecard & Evidence Split View**: Inspect extraction health immediately and click any citation to verify it side-by-side against the **original uploaded PDF page**.
- **Cross-Document Conflict Guard & MinHash-LSH Deduplication**: Surfaces numeric and pricing contradictions (e.g., `$49/mo` vs `$59/mo`) with timestamps for human triage instead of letting the LLM hallucinate a compromise, while stripping repeated headers, footers, and near-duplicate boilerplate.
- **AST Code Skeleton & 2026 Frontier Token Budgets**: Shrink Python and TypeScript repositories by **55–75%** while keeping typed signatures and docstrings — always preserving the unmodified **Full Source Pack**. Calibrated for **Claude Sonnet 5.5 (1M)**, **GPT-6.2 Astra / Sol (1M)**, **Gemini 4 Neon (1M)**, **Ollama (8K / 32K)**, and custom budgets.
- **Visual Pipeline DAG, Folder Watcher & 9-Tool Read-Only MCP Server**: Drag to reorder custom processing stages, watch local folders with `contextforge watch` for live SQLite FTS5 sync, or connect **Cursor** and **Claude Code** directly over read-only MCP.
- **10 Standalone Free Local Tools**: Includes dedicated single-purpose utilities for `/pdf-to-markdown`, `/pdf-to-text`, `/url-to-markdown`, `/website-to-markdown`, `/youtube-transcript-generator`, `/llm-token-counter`, `/json-formatter`, `/text-chunker`, `/docx-to-markdown`, and `/markdown-to-pdf`.
---
## Quick Start (Pick Your Workflow)
### Option 1: Zero-Terminal Desktop App (macOS & Windows)
Download the double-click `ContextForge-macOS.dmg` or `ContextForge-Windows.exe` from [GitHub Releases](https://github.com/waterdolphinkiller/ai-context-workbench/releases). Double-clicking starts the local engine in the background and opens the studio in your browser automatically. See [`docs/desktop-install.md`](docs/desktop-install.md).
### Option 2: Run Locally with Python (30 Seconds)
```bash
git clone https://github.com/waterdolphinkiller/ai-context-workbench.git
cd ai-context-workbench
pip install -e .
# Launch the local studio (Web UI + FastAPI REST API on http://127.0.0.1:8787)
contextforge serve
```
### Option 3: CLI Automation & Live Folder Watcher
```bash
# Create a project calibrated for Claude Sonnet 5.5 (1M)
contextforge init "Q4 Diligence Pack" --profile claude-sonnet-5.5
# Ingest local files, a GitHub repo, or watch a folder for live updates
contextforge add <project_id> ./Annual_Report_2026.pdf
contextforge watch <project_id> ./research-folder
# Check token budget against GPT-6.2 Astra / Sol (1M) & export portable .zip Context Pack
contextforge budget <project_id> --profile gpt-6.2
contextforge export <project_id> --format zip --variant optimized --redact
```
### Option 4: Connect Cursor or Claude Code via 9-Tool Read-Only MCP
Add ContextForge to your MCP client configuration (see [`docs/mcp-guide.md`](docs/mcp-guide.md)):
```json
{
"mcpServers": {
"contextforge": {
"command": "contextforge",
"args": ["mcp", "--db", "/path/to/workbench.db"]
}
}
}
```
### Option 5: Docker
```bash
docker compose up --build
# Studio available at http://localhost:8787
```
---
## Frequently Asked Questions (FAQ)
<details open>
<summary><strong>1. Do my files leave my computer or get sent to OpenAI, Anthropic, or Google?</strong></summary>
<p>Never by default. ContextForge is local-first by architecture: document parsing, MinHash-LSH deduplication, conflict detection, API key / US SSN redaction, and SQLite FTS5 indexing run strictly on your own machine. Outbound network requests only happen if you explicitly ask ContextForge to fetch a public URL, website, YouTube transcript, or GitHub repository.</p>
</details>
<details>
<summary><strong>2. What sensitive secrets and PII does ContextForge scrub automatically?</strong></summary>
<p>Before copying to clipboard or exporting a Context Pack, ContextForge automatically redacts OpenAI, Anthropic, GitHub PAT, AWS, Google, Stripe, and Slack API keys, JWTs, Postgres/MySQL/MongoDB/Redis connection strings with passwords, <code>.env</code> secret assignments, RSA/OpenSSH private keys, and US Social Security Numbers (<code>XXX-XX-XXXX</code>).</p>
</details>
<details>
<summary><strong>3. Can non-technical users run ContextForge without Python or a terminal?</strong></summary>
<p>Yes. Download the native double-click <code>ContextForge-macOS.dmg</code> or <code>ContextForge-Windows.exe</code> from GitHub Releases, or try the interactive Browser Demo and all 10 standalone local tools directly on the web with zero installation.</p>
</details>
<details>
<summary><strong>4. How does ContextForge work with Claude 5.5, ChatGPT (GPT-6.2), Gemini 4, Cursor, and Ollama?</strong></summary>
<p>ContextForge is AI-agnostic. Prepare your sources once, then copy citation-backed Markdown or Claude XML in 1 click, export a portable <code>.zip</code> Context Pack, use calibrated token budgets for Claude Sonnet 5.5 (1M), GPT-6.2 Astra/Sol (1M), Gemini 4 Neon (1M), or Ollama 8K/32K, or serve live context to Cursor and Claude Code via the 9-tool read-only MCP server.</p>
</details>
<details>
<summary><strong>5. How does GitHub repository packing and AST Code Skeleton mode work?</strong></summary>
<p>Paste any public <code>https://github.com/owner/repo</code> URL (or press <code>⌘V</code> anywhere). ContextForge respects <code>.gitignore</code>, skips binary blobs, preserves exact file/line provenance, and offers an AST Code Skeleton compression stage that keeps typed function/class signatures and docstrings while reducing codebase tokens by 55–75%.</p>
</details>
<details>
<summary><strong>6. What happens if I drop corrupted PDFs, messy GBK CSVs, or malicious ZIP archives?</strong></summary>
<p>ContextForge is battle-tested against 17 malformed formats with 0 crashes. Empty-password PDFs unlock automatically, GBK/GB18030 semicolon CSVs stream in <code>O(1)</code> RAM without mojibake, truncated PDFs record a clean error status without crashing the workspace, and ZIP archives containing path-traversal entries (<code>../</code>) are blocked with an explicit skipped-file manifest.</p>
</details>
---
## AI-Crawler & Documentation Index (GEO Ready)
ContextForge publishes structured machine-readable documentation for both human engineers and AI search/coding agents:
- **[`llms.txt`](llms.txt)** — Concise AI-crawler index of capabilities, CLI commands, MCP tools, and routes.
- **[`llms-full.txt`](llms-full.txt)** — Complete architecture, benchmark, security, and API reference for LLM ingestion.
- **[`docs/context-pack-spec.md`](docs/context-pack-spec.md)** — Portable Context Pack `.zip` schema specification.
- **[`docs/mcp-guide.md`](docs/mcp-guide.md)** — Setup guide for Cursor, Claude Code, and custom MCP clients.
- **[`docs/desktop-install.md`](docs/desktop-install.md)** — Native macOS `.dmg` and Windows `.exe` launcher guide.
---
## Architecture & Development
```bash
# Run the full 59-test automated suite (parsers, dedup, conflicts, red-team security, 15-thread concurrency, MCP, SEO/GEO)
PYTHONPATH=. python3 -m unittest discover -s tests -v
```
Licensed under the **[Apache-2.0 License](LICENSE)**. Contributions, parser plugins, and exporter extensions are welcome.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues