
Neuro-Symbolic Context Pruning Middleware for Local SLMs & Coding Agents (85% token reduction, 6.7x
Neuro-Symbolic Context Pruning Middleware for Local SLMs & Coding Agents (85% token reduction, 6.7x faster TTFT on CPU, 0% hallucinations)
·
Neuro-Symbolic Context Pruning Middleware for Local SLMs and Cloud LLMs
English | Español | 📄 Technical Whitepaper (PDF) | 📄 Whitepaper en Español (PDF)
OntoPrune is an ultra-lightweight (<12ms CPU) neuro-symbolic middleware that transforms multi-file source code into minimal typed dependency contracts. By isolating closed-world functional boundaries before attention computation, OntoPrune slashes input tokens by ~60% in modular enterprise architectures, collapses Time-to-First-Token ($TTFT$) latency by 62% on CPU-bound local models (Ollama), guarantees 100% functional test success (Pass@1), and prevents 100% of proprietary code leakage.
Tested across 3 real-world software archetypes in isolated execution sandboxes with live evaluation via pytest:
gemini-3.8-flash via native SSE streaming)qwen2.5-coder:7b running on AMD Ryzen CPU)| Software Archetype | Backend | Treatment | Input Tokens (Median) | Token Reduction | TTFT (Local/Cloud) | Pass@1 (pytest) | Leaked IP (Private Lines) |
|---|---|---|---|---|---|---|---|
| Archetype 1: Isolated Algorithm | gemini | OntoPrune | 818 | -24.3% | 0.1 ms | 100.0% (5/5) | 0 lines |
| Archetype 1: Isolated Algorithm | gemini | Naive Full | 1,081 | Baseline | 0.1 ms | 100.0% (5/5) | 0 lines |
| Archetype 1: Isolated Algorithm | ollama | OntoPrune | 731 | -23.5% | 155 ms | 100.0% (5/5) | 0 lines |
| Archetype 1: Isolated Algorithm | ollama | Naive Full | 956 | Baseline | 12,985 ms | 100.0% (5/5) | 0 lines |
| Archetype 2: Multi-Module Service | gemini | OntoPrune | 931 | -59.7% | 0.1 ms | 100.0% (8/8) | 0 lines (100% shielded) |
| Archetype 2: Multi-Module Service | gemini | Naive Full | 2,313 | Baseline | 0.1 ms | 100.0% (8/8) | 74 private lines exposed |
| Archetype 2: Multi-Module Service | ollama | OntoPrune | 797 | -59.7% | 10,569 ms | 100.0% (8/8) | 0 lines (100% shielded) |
| Archetype 2: Multi-Module Service | ollama | Naive Full | 1,979 | Baseline | 28,032 ms | 100.0% (8/8) | 74 private lines exposed |
| Archetype 3: Clean Architecture | gemini | OntoPrune | 1,147 | -60.1% | 0.1 ms | 100.0% (10/10) | 0 lines (100% shielded) |
| Archetype 3: Clean Architecture | gemini | Naive Full | 2,873 | Baseline | 0.1 ms | 100.0% (10/10) | 91 private lines exposed |
| Archetype 3: Clean Architecture | ollama | OntoPrune | 952 | -60.5% | 13,092 ms | 100.0% (10/10) | 0 lines (100% shielded) |
| Archetype 3: Clean Architecture | ollama | Naive Full | 2,412 | Baseline | 34,376 ms | 100.0% (10/10) | 91 private lines exposed |
Running local code intelligence models (Qwen 2.5 Coder 7B, Llama 3 8B, DeepSeek Coder via Ollama or llama.cpp) on consumer laptops and developer workstations has historically faced an insurmountable barrier. OntoPrune dismantles this barrier through three architectural pillars:
pytest suites.# Standard installation (native Python support):
pip install ontoprune
# With multi-language support (Flutter/Dart, Java, TypeScript via Tree-sitter):
pip install "ontoprune[languages]"
# For development, benchmarks, and tests:
pip install "ontoprune[dev,benchmark,languages]"OntoPrune automatically detects file types and resolves dependencies across project boundaries:
| Language | Extension | AST Engine | Output Format |
|---|---|---|---|
| Python | .py | Native Python ast | def name(args) -> Ret: ... |
| Flutter / Dart | .dart | tree-sitter-dart | abstract class ... { Ret method(); } |
| Java / Spring Boot | .java | tree-sitter-java | public interface ... { Ret method(); } |
| TypeScript / React | .ts, .tsx, .js | tree-sitter-typescript | export interface ... { method(): Ret; } |
OntoPrune runs out of the box as an MCP server (ontoprune-mcp) compatible with Claude Desktop, Cursor, Gemini CLI, or Antigravity IDE:
ontoprune-mcpConfiguration in claude_desktop_config.json:
{
"mcpServers": {
"ontoprune": {
"command": "ontoprune-mcp"
}
}
}Exposed MCP Tools:
prune_context(file_path, target_symbol, format='stubs'): Extracts the minimal dependency contract resolving cross-file imports.verify_response(response_code, contract_or_file): Deterministically validates generated code against authorized contracts.# Prune a target method across multi-file projects:
ontoprune translate src/services/OrderService.java processOrder --format stubs
# Direct streaming pipeline with local Ollama:
ontoprune translate services/order_service.py procesar_orden | ollama run qwen2.5-coder:3b
# Deterministically verify LLM output against contract:
ontoprune check --file generated_solution.py --contract contract.pyimport ontoprune
# 1. Prune a multi-module project to a minimal typed contract
context = ontoprune.translate(
"services/order_service.py",
target="procesar_orden",
fmt="stubs",
multi_module=True,
)
print(context)
# 2. Verify model output against the contract
violations = ontoprune.check(llm_code_response, against=context)
if not violations:
print("Code is 100% compliant and free of hallucinations!")pytest tests/
# 46 passed in 1.40sYou can independently replicate the benchmark evaluation in isolated sandboxes on your machine:
# 1. Quick deterministic validation in sandbox (no API key needed):
ontoprune benchmark --backend mock --analyze
# or via Make:
make benchmark-mock
# 2. Live evaluation against Google Gemini (requires GEMINI_API_KEY):
ontoprune benchmark --backend gemini --analyze
# or via Make:
make benchmark-gemini
# 3. Live local evaluation against Ollama CPU (requires running Ollama):
ontoprune benchmark --backend ollama --analyze
# or via Make:
make benchmark-ollamaVigmar Carlo
Pick your client and paste the snippet. Each one is the same server, written the way that client expects it.
claude mcp add ontoprune -- ontoprune-mcp{
"mcpServers": {
"ontoprune": {
"command": "ontoprune-mcp"
}
}
}code --add-mcp '{"name":"ontoprune","command":"ontoprune-mcp"}'[mcp_servers.ontoprune]
command = "ontoprune-mcp"Runs locally on your device. Your client starts the server itself, so nothing has to be hosted.
Paste this prompt into your agent. It reads this page and does the setup for you.
Read https://aiagentslisting.com/mcp/ontoprune to learn what the "OntoPrune" MCP server does and how to install it. Add it to my coding agent's MCP configuration as documented on that page, then confirm the server connects and list the tools it exposes.Agents can also browse this directory over MCP at https://aiagentslisting.com/api/mcp
pip install ontoprune
pip install "ontoprune[languages]"
pip install "ontoprune[dev,benchmark,languages]"This server runs locally, so we can't read its tool list over the web yet.
We could not run this server: it ships no npx package for our sandbox and no public endpoint. The four checks that need a live server are left out, and the grade tops out at B until one exists.
Maintain this server? Claiming proves you own the listing and earns the last 4 points.
Claim this listingPaste this line near the top of your repository's README. The badge always renders the current score.
[](https://aiagentslisting.com/mcp/ontoprune)Nothing comparable is listed yet.
v0.3.0OntoPrune v0.3.0 — Domain Types Extraction, Class Scoping & Empirical Benchmark SuiteRelease notesConnect to the AI Agents Listing MCP server at https://aiagentslisting.com/api/mcp using the HTTP transport and complete the sign-in when it asks. Then call the submit_review tool for the listing "ontoprune" with a rating from 1 to 5 and a short note on what worked and what did not.No reviews yet
Be the first to share your experience with this tool.
One email a week. New agents, MCP servers and skills, and what is actually getting traction.