Language models are probabilistic samplers; modifying your codebase or managing confidential client knowledge requires a deterministic transaction manager.
I build sovereign, local-first agent infrastructure so AI coding agents can plan, navigate, and verify multi-step tasks without mutating your physical disk until verified. State lives in PostgreSQL, models remain completely swappable, and operations enforce strict transactional invariants.
Standardized across Antigravity, Claude Code, Cursor, and Windsurf:
| Tier | Subsystem | Authoritative Responsibility | Key Capabilities |
|---|---|---|---|
| Tier 1 | krusch-context-mcp |
Working Memory & Invariants | 5-verb sovereign memory engine (retrieve, remember, revise, nudge, health). Eliminates agent amnesia with ACID decision logs, lineage tracking, and pre-commit invariant gates. |
| Tier 2 | krusch-git |
AST Code Graph & Exploration | Full Git DAG in PostgreSQL, AST symbol extraction, caller-callee call graphs via recursive relational CTEs, 40-char SHA pinning, and exponential temporal recency decay. |
| Tier 3 | krusch (Harness) |
Staged Execution & Verification | PostgreSQL state machine, invariant gate before mutation, virtual unified diff staging, and two-phase commit (2PC) disk application. Zero uninspected disk writes. |
| Bridge | @krusch/polygres-connector |
Zero-Friction Cloud Substrate | Cloud connector marrying KruschContext with pgGraph and Wondersearch with 40-char SHA pinning, cross-substrate joins, and strict ABA Model Rule 1.6 air-gap protection. |
🛡️ krusch-companion · Sovereign Personal AI & Daily Companion
A 100% private, local-first alternative to cloud-tethered personal assistants (like OpenAI Dot or xAI Grok Companion). Triages raw voice thought streams into actionable 5-tier priority boards and maintains persistent working memory on local SQLite.
- Zero Cloud Egress: 100% local SQLite WAL storage; zero prompt training or data harvesting.
- Microsecond Routing: Employs
krusch-cascade-router(<15µs CPU L0 fast-path) and local Ollama edge models for $0.00 daily interaction costs. - Zero Data Retention Cloud Mode: Optional OpenRouter integration injecting
provider: { data_collection: "deny" }for zero-GPU setups while keeping memory local. - Installable PWA: React 19 + Vite luxury dark glassmorphism dashboard with ambient focus timer and daily coaching reflections.
🧠 krusch-context-mcp · Persistent Working Memory & Invariant Steering
A lightweight, 5-tool Model Context Protocol server giving AI coding agents (Claude Code, Cursor, Windsurf, Antigravity) persistent memory and rule enforcement across sessions.
- 5 Core Verbs:
retrieve,remember,revise,nudge,healthconstrained to<350prompt tokens. - Temporal Fact Superseding: Invalidation engine with lineage links that retires obsolete rules and prevents contradictory prompt context.
- Pre-Commit Invariant Gate: Audits code diffs against project rules before disk mutation to prevent silent regressions.
- SQLite-First: Zero-Docker setup built on
node:sqlitewith optional PostgreSQL dual-engine sync.
⚡ krusch-cascade-router · Sub-15µs CPU Routing
Dual-stage microsecond cascade router designed for CPU-only execution. Evaluates semantic difficulty, token length, query structure, and sensitivity to route requests across free, cheap, and frontier models.
- Latency: Sub-15µs L1 heuristic gating; sub-8ms L2 dense vector centroid scoring.
- Speculative Hedging: Automatically dispatches hedge requests when fast models return ambiguous outputs.
- Cost Reduction: Slashes aggregate inference spend by 7–9% while beating baseline Sonnet 3.5 quality scores.
Cloud connector bridging local sovereign agent memory and codebase graphs with Polygres Cloud and Wondersearch.
- Cross-Substrate Marriage:
getSymbolContext()resolves AST definitions, recursive caller CTEs, and active steering invariants in a single database round-trip. - Refactor Safety Gate: Automatically flags
requiresCallerAudit = truewhenever a symbol with inbound callers is modified or renamed. - Air-Gap Boundary: Enforces fail-closed isolation for privileged litigation matters and confidential commercial contracts.
⚖️ krusch-law
100% air-gapped sovereign legal intelligence platform.
- Zero Hallucination Grounding: Enforces a 0.00% False Support Rate across statutory tenant protection codes and appellate cases.
- Statutory Precedence DAG: Traverses jurisdictional overrides and local ordinances with strict citation spine coordinates.
- Air-Gap Compliance: Runs strictly on local PostgreSQL 16 with realpath denial blocking cloud egress under ABA Model Rule 1.6.
Universal high-throughput document extraction and dual-provider RAG substrate.
- Deterministic TOC Parser: Extracts hierarchical document outlines in
<5ms. - 4-Stage Retrieval Ablation: Vector-only, FTS-only, hybrid, and RRF + local cross-encoder reranking.
Languages : TypeScript (ESM) · Python 3.12 · Rust · SQL · C/C++
Databases : PostgreSQL 16 · pgvector · SQLite (WAL) · DuckDB
Agent Protocol : Model Context Protocol (MCP) · JSON-RPC · SSE Streams
Code Analysis : Tree-Sitter AST · Relational Call Graphs (Recursive CTEs)
Infrastructure : Local Homelab Fleet · Linux (Ubuntu/Pop!_OS) · Docker
- PostgreSQL-First Proxy: Operational data, AST symbols, and agent episodic memories persist in relational PostgreSQL with strict relational foreign keys and indexes.
- Fail-Closed Air-Gaps: Cloud egress is opt-in (
ALLOW_CLOUD=1). Private files, counterparty terms, and litigation matters remain strictly on-premises. - Deterministic Over Probabilistic: Prompt chains are constrained by state machines, invariant verification gates, and atomic rollback journals.
- 📑 Zero-Friction Agent Substrates: Powering KruschContext & KruschGit with Swappable Local & Polygres Drives — How AI coding agents eliminate amnesia with ACID decision logs and navigate code with relational AST graphs.
- ⚡ RouterArena Candidate Evaluation: Sub-15µs Cascade Routing on Pure CPU — Benchmarking speculative hedging and dual-stage routing.


