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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sp_llmgraph-0.5.0.tar.gz (61.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sp_llmgraph-0.5.0-py3-none-any.whl (46.6 kB view details)

Uploaded Python 3

File details

Details for the file sp_llmgraph-0.5.0.tar.gz.

File metadata

  • Download URL: sp_llmgraph-0.5.0.tar.gz
  • Upload date:
  • Size: 61.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for sp_llmgraph-0.5.0.tar.gz
Algorithm Hash digest
SHA256 643b58c82eba96e2a3c040fc3dd0f3eecf3623622647166fd6e6d87f78c77bc1
MD5 6e75fcb8795eaa491ac504e3fa457a56
BLAKE2b-256 c77b7fe4fcd8e42568881a184a197e73d6a02ae006c93415ff5c4420691daa6d

See more details on using hashes here.

File details

Details for the file sp_llmgraph-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: sp_llmgraph-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 46.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for sp_llmgraph-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a84f81cb8e0a909a6d64c41641fb96e876961c3b184f2dc8ca1168a0d69cc1cf
MD5 73e140cdd91412ce1db057f2db170a7d
BLAKE2b-256 bceefde04423519c30a9919295d5d9ecb169620bd9a43c7e5c49787e95e819c0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page