OntoPrune claims large local-coding gains from code-contract context pruning; results remain unverified
state: seedheat: lowuncertainty: mediumrelevance: lowcontext-pruning local-inference agent-harnesses inference-economicsvigmarcarlo
What is this?
OntoPrune is a maintainer-described, MIT-licensed tool that parses source code into an RDF/SPARQL representation and produces compact contract stubs for coding models. It is offered as a Python library, CLI and MCP server, with a checker for generated code. Its Reddit post and GitHub README report a benchmark on one 300+ line sample, using Qwen 2.5 Coder 3B on a 12-core CPU: 2,390 input tokens fell to 406, TTFT from 22.4 to 3.3 seconds, and one invalid API call in the full-context run versus none with pruning. These are maintainer-reported results, not independent validation; the evidence does not establish general accuracy, performance across projects or models, or adoption.
Why it matters
OntoPrune is a potentially useful, open-source approach to reducing code context for local coding models: it extracts typed interface stubs instead of sending a whole file. The maintainer reports substantial token and latency savings, but those results come from one self-benchmark on one sample and model, with no independent replication shown. It is worth watching as an experiment in lightweight context preparation, not yet treating as a proven performance layer or choosing it on the strength of the headline numbers.
Current assessment
OntoPrune’s maintainer describes an MIT-licensed Python tool that parses code into an RDF/SPARQL graph, extracts dependencies for a target function, renders contract stubs, and checks generated code against them; it also offers a CLI and MCP server. The Reddit post and GitHub README report a test on a 300+ line sample using Qwen 2.5 Coder 3B on a 12-core CPU: input fell from 2,390 to 406 tokens, TTFT from 22.4 to 3.3 seconds, and the full-context output had one invalid API call versus none with pruning. The README repeats the maintainer’s figures, so these are not independent corroboration. A claimed cloud-model token reduction is also reported, but no comparable performance or quality evaluation is supplied. Evidence does not establish generalization across repositories, languages, models, or tasks; nor does it show adoption. The key follow-up is reproducible testing on varied codebases and models, measuring output correctness as well as latency and token savings.
Measured heat
now 0 pts/hpeak 0 pts/hcomments 0/hpeers p10momentum: steady3 platformsage 1251h
points/hour across evidence · reading as of 2026-11-27 02:23:58.509736+11:00 · deterministic, not a model opinion
How the heat travelled
Evidence (3) — ⭐ canonical anchor
| source | object | author | score | comments |
| 🟠 reddit | [Project] OntoPrune: 6.7x faster TTFT on local CPU with Ollama by neuro-symbolic context pruning (83-86% token savings + 0% hallucinations) LocalLLaMA | vigmarcarlo | 0 | 5 |
| 🟧 hn | OntoPrune – Pruning 85% LLM context tokens and 6.7x TTFT on CPURetrieved article excerptOpen article · Retrieved 2026-10-05T12:24:49.807649+00:00 # OntoPrune
*Neuro-Symbolic Context Pruning Middleware for Local SLMs*
OntoPrune es un middleware traductor ligero que transforma código fuente en contratos de contexto mínimos utilizando representación ontológica (RDF/SPARQL), reduciendo drásticamente los tokens de entrada y la latencia TTFT (Time to First Token) para modelos de lenguaje pequeños (SLMs) y evitando alucinaciones de API.
---
## Resultados Empíricos (Benchmark en CPU)
Evaluación real con streaming sobre [sample\_service.py](https://github.com/vigmarcarlo/OntoPrune/blob/main/fixtures/sample_service.py) (300+ LOC) en CPU local (12 cores):
| Métrica | Naive (Archivo Completo) | OntoPrune (`stubs`) | Ganancia Real |
| --- | --- | --- | --- |
| **Sobrecarga CPU** | 0.02 ms | **9.9 ms** | $\le 10\text{ ms}$ (Meta: $\le 15\text{ ms}$) |
| **Tokens Entrada** | 2,390 tokens | **406 tokens** | **-83.0%** ($\approx 6\text{x}$ menos) |
| **TTFT (`qwen2.5-coder:3b`)** | 22.4 s | **3.3 s** | **6.7x más rápido** (ahorra 19.1 s) |
| **Tiempo Total (3B)** | 59.9 s | **16.5 s** | **-72.5%** ($3.6\text{x}$ más rápido) |
| **Alucinaciones API** | 1 método inválido | **0 métodos inválidos** | **100% Precisión Contractual** |
---
## Instalación
```
pip install -e .
# Con dependencias para benchmarking:
pip install -e ".[dev,benchmark]"
```
---
## Modos de Uso
### 1. Como Servidor MCP (Model Context Protocol)
OntoPrune incluye un servidor MCP nativo (`ontoprune-mcp`) para integrarse con Cursor, Claude Desktop, Gemini CLI o cualquier agente:
```
# Ejecutar servidor MCP en transporte stdio:
ontoprune-mcp
```
**Configuración en `claude_desktop_config.json` o similar:**
```
{
"mcpServers": {
"ontoprune": {
"command": "ontoprune-mcp"
}
}
}
```
**Herramientas MCP expuestas:**
- `prune_context(file_path, target_symbol, format='stubs', include_body=False, project_root=None)`: Extrae el contrato podado mínimo (< 400 tokens) resolviendo dependencias entre múltiples archivos del proyecto.
- `verify_response(response_code, contract_or_file, target_symbol)`: Detecta alucinaciones en código generado comparando contra el contrato o archivo.
---
### 2. Como Librería Python
```
import ontoprune
# 1. Traducir un archivo a contexto compacto podado (formato stubs)
# Resuelve automáticamente imports relativos y absolutos entre módulos del proyecto
context = ontoprune.translate(
"services/order_service.py",
target="procesar_orden",
fmt="stubs",
multi_module=True,
)
print(context)
# 2. Verificar respuestas del modelo frente al contrato
violations = ontoprune.check(llm_code_response, against=context)
if not violations:
print("Código 100% válido")
```
---
### 3. Desde la Línea de Comandos (CLI & Pipes)
```
# Traducir función en proyectos multi-módulo:
ontoprune translate services/order_service.py procesar_orden --format stubs
# Pipeline directo con Ollama en proyectos modulares:
ontoprune translate services/order_service.py procesar_orden | ollama run qwen2.5-coder:3b
```
---
### 4. Ejecución del Benchmark Empírico
```
# Correr benchmark comparativo (Naive vs OntoPrune con ablación de formatos):
python -m ontoprune.benchmark --file fixtures/sample_service.py --func procesar_orden --backend ollama --model qwen2.5-coder:3b --compare-formats
```
---
## Modelos de Monetización y Aplicación Comercial
OntoPrune resuelve dos problemas críticos de costo y confiabilidad en ingeniería de IA:
### 1. Token Cost Optimization Gateway (B2B SaaS / Middleware de Ahorro)
- **Problema:** Equipos que operan agentes de código autónomos (Devin, Cursor, Copilot Workspace) gastan miles de dólares mensuales en tokens de entrada donde más del 80% es código irrelevante.
- **Solución:** OntoPrune como proxy o sidecar que poda el contexto antes de enviarlo a APIs comerciales (Gemini, Claude, OpenAI), reduciendo la factura de tokens en un **85%**.
- **Monetización:** Cobro basado en porcentaje de ahorro (*gain-share*: ej. 10% del ahorro mensual generado).
### 2. Local-First Developer Tooling (Edición Profesional / Equipos)
- **Problema:** Desarrolladores y empresas que requieren privacidad estricta ejecutan SLMs en laptops o servidores locales (Ollama/vLLM), sufriendo latencias inaceptables en CPU.
- **Solución:** OntoPrune reduce el TTFT de 22s a 3.3s (6.7x más rápido).
- **Monetización:** Versión open-source para desarrolladores individuales + licencia empresarial para equipos (soporte multi-repositorio, telemetría y reglas de cumplimiento de arquitectura).
### 3. Agent Compliance & CI/CD Security Gate
- **Problema:** Los agentes de código alucinan APIs y rompen contratos de software en producción.
- **Solución:** `ontoprune check` como paso automatizado en GitHub Actions / GitLab CI que bloquea pull requests con llamadas no autorizadas al grafo del sistema.
- **Monetización:** Modelo SaaS de auditoría y seguridad para código generado por agentes. | vigmarcarlo | 1 | 0 |
| 🟧 echo.github ⭐ | Repo README: 'Neuro-Symbolic Context Pruning Middleware for Local SLMs' translating source into RDF/SPARQL contract stubs; self-benchmark on | vigmarcarlo | — | — |
Interpretation history
2026-10-24T21:28:12Z
audience grounding: low — OntoPrune is a potentially useful, open-source approach to reducing code context for local coding models: it extracts typed interface stubs instead of sending a whole file. The maintainer reports substantial token and latency savings, but those results come from one self-benchmark on one sample and model, with no independent replication shown. It is worth watching as an experiment in lightweight context preparation, not yet treating as a proven performance layer or choosing it on the strength of the headline numbers.
Decision trace
- 11-02 23:28review_dormant28 days without material information; scheduled checks stopped
- 10-31 18:25drop_targetsquiet through full ladder or over cap 8
- 10-25 08:28groundOntoPrune is a potentially useful, open-source approach to reducing code context for local coding models: it extracts typed interface stubs instead of sending a whole file. The maintainer reports subs
- 10-08 13:40review_screenjev screen: no material development (noul=0.08)
- 10-05 23:35groundScott's canon already holds this position: dev:concept.deterministic-code-skeleton and dev:concept.adaptive-source-context-compilation are his own versions of compiling source into compact struct
- 10-05 23:26createTwo same-author announcement posts are one episode around a released MIT artifact with concrete falsifiable performance claims — a usable first-party event even though the numbers are self-benchmarked