Skip to main content

LLMGraph

Gestor de contexto para modelos y agentes IA basado en grafos comprimidos.

Principio del sistema:

Markdown humano editable -> grafo comprimido -> Context Pack minimo, vigente y trazable

LLMGraph no reemplaza la documentacion humana. Compila .md a un indice .llgr.zlib para que los agentes consulten solo el contexto relevante de una tarea, con fuentes y metricas.

Instalación

pip install -e ".[mcp]"

Instalación por editor

VS Code / Cursor / Windsurf

LLMGraph incluye una extension VSIX en extension/ que agrega una pestaña en la Activity Bar del editor. El panel invoca el CLI local y puede asegurar la configuracion MCP del workspace.

cd extension
npm install
npm run validate
npm run package
code --install-extension llmgraph-editor-0.4.0.vsix

Cursor y Windsurf pueden instalar el mismo .vsix desde su interfaz de extensiones o desde un CLI compatible.

Claude Code

El plugin vive en .claude-plugin/plugin.json y registra el MCP llmgraph. Tambien se incluye el skill .claude/skills/llmgraph-context/SKILL.md.

Codex

codex mcp add llmgraph -- llmgraph-mcp

La configuracion equivalente esta en .codex/config.toml.

opencode

Copiar opencode.json al workspace o usarlo desde esta raiz. Declara el MCP local llmgraph.

ChatGPT Desktop

Usar el connector MCP local con comando llmgraph-mcp y working directory del proyecto. ChatGPT web no aplica porque LLMGraph no expone una API HTTP.

Uso rápido

Python

from llmgraph import Graph, encode, decode
from llmgraph.md_parser import parse_file

# Crear grafo
g = Graph()
g.metadata["project"] = "mi-proyecto"
g.add_node("file", name="auth.py", lang="python")
g.add_node("file", name="db.py", lang="python")
g.add_edge(0, 1, "imports")

# Codificar a binario
raw = encode(g)  # → bytes, ~10x más pequeño que .md equivalente

# Decodificar
g2 = decode(raw)

CLI

# Convertir .md a .llgr
llmgraph convert README.md -o project.llgr

# Consultar
llmgraph query project.llgr -t section

# Comparar
llmgraph diff graph1.llgr graph2.llgr

Context Manager

# Crear context/context-policy.toml
llmgraph context init .

# Compilar README.md/docs/operations a context/project.llgr.zlib
llmgraph context build .

# Preparar contexto optimizado para una tarea
llmgraph context prepare . "refactorizar autenticacion" --profile coding --max-tokens 3000

# Buscar dentro del grafo de contexto
llmgraph context search . "middleware de autenticacion"

# Auditar fuentes, nodos grandes y referencias rotas
llmgraph context health .

El Context Pack reporta:

  • tokens fuente vs tokens usados;
  • porcentaje de tokens ahorrados;
  • nodos incluidos;
  • fuentes usadas;
  • porcentaje de trazabilidad;
  • nodos obsoletos excluidos.

Plan de continuación:

MCP Server (para editores agenticos)

# Agregar a opencode.json:
{
  "mcp": {
    "llmgraph": {
      "type": "local",
      "command": ["python", "-m", "llmgraph.mcp_server"],
      "enabled": true
    }
  }
}

Formato binario

Un archivo .llgr contiene:

  • Header (16 bytes): magic "LLGR" + versión + conteos
  • String dictionary: strings deduplicadas (como side channel en MP3)
  • Nodes: tipo + propiedades por nodo
  • Edges: src + tgt + tipo + propiedades por edge
  • Metadata: key-value pairs a nivel de grafo

Compresión vs .md

Formato Tamaño (50 nodos) Ratio
.md 1x (baseline) 1.0x
.llgr ~0.3-0.5x 2-3x
JSON ~2x 0.5x

La compresión mejora con grafos más grandes gracias a la deduplicación de strings.

Licencia

MIT

Metadata

Release files for sp-llmgraph 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sp-llmgraph 0.5.0
File Size Uploaded Provenance
sp_llmgraph-0.5.0.tar.gz 61.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for sp-llmgraph 0.5.0
File Interpreter ABI Platform
sp_llmgraph-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 108.1 kB

Release files / sp_llmgraph-0.5.0.tar.gz

Download URL sp_llmgraph-0.5.0.tar.gz
Size 61.5 kB
Tags Source
SHA-256 checksum
How to use checksums
643b58c82eba96e2a3c040fc3dd0f3eecf3623622647166fd6e6d87f78c77bc1
BLAKE2b-256 checksum
How to use checksums
c77b7fe4fcd8e42568881a184a197e73d6a02ae006c93415ff5c4420691daa6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / sp_llmgraph-0.5.0-py3-none-any.whl

Download URL sp_llmgraph-0.5.0-py3-none-any.whl
Size 46.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a84f81cb8e0a909a6d64c41641fb96e876961c3b184f2dc8ca1168a0d69cc1cf
BLAKE2b-256 checksum
How to use checksums
bceefde04423519c30a9919295d5d9ecb169620bd9a43c7e5c49787e95e819c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Security for sp-llmgraph 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page