reducto-graph 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Reducto
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,5 @@
1
+ include README.md
2
+ include LICENSE
3
+ include .env.example
4
+ include docker-compose.yml
5
+ recursive-include reducto *.py py.typed
@@ -0,0 +1,213 @@
1
+ Metadata-Version: 2.4
2
+ Name: reducto_graph
3
+ Version: 0.2.0
4
+ Summary: Universal knowledge graph for LLMs — reduce tokens, not intelligence.
5
+ Author-email: Reducto <sudacadev@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/SudacaDev/reducto
8
+ Project-URL: Documentation, https://github.com/SudacaDev/reducto#readme
9
+ Project-URL: Repository, https://github.com/SudacaDev/reducto
10
+ Project-URL: Bug Tracker, https://github.com/SudacaDev/reducto/issues
11
+ Keywords: llm,knowledge-graph,tokens,mcp,claude,context,codebase,neo4j,ai
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: networkx>=3.0
25
+ Requires-Dist: mcp>=1.0.0
26
+ Requires-Dist: click>=8.1
27
+ Requires-Dist: rich>=13.0
28
+ Provides-Extra: ast
29
+ Requires-Dist: tree-sitter>=0.23; extra == "ast"
30
+ Requires-Dist: tree-sitter-python>=0.23; extra == "ast"
31
+ Requires-Dist: tree-sitter-javascript>=0.23; extra == "ast"
32
+ Requires-Dist: tree-sitter-typescript>=0.23; extra == "ast"
33
+ Provides-Extra: dev
34
+ Requires-Dist: build>=1.0; extra == "dev"
35
+ Requires-Dist: twine>=5.0; extra == "dev"
36
+ Requires-Dist: pytest>=8.0; extra == "dev"
37
+ Requires-Dist: ruff>=0.4; extra == "dev"
38
+ Dynamic: license-file
39
+
40
+ # Reducto
41
+
42
+ > Reduce tokens, not intelligence.
43
+
44
+ Reducto convierte tu codebase en un **knowledge graph local** que cualquier LLM puede consultar sin leer archivos enteros. Menos tokens, mejores respuestas, mismo resultado.
45
+
46
+ ## Qué hace
47
+
48
+ - **Indexa tu proyecto** — parsea `.ts`, `.tsx`, `.js`, `.py` y `.md` extrayendo funciones, clases, imports y calls reales (AST via tree-sitter)
49
+ - **Detecta comunidades** — agrupa automáticamente archivos relacionados usando Louvain clustering
50
+ - **Guarda todo localmente** — en `reducto-out/graph.json`, sin base de datos, sin cuenta, sin internet
51
+ - **Expone el grafo via MCP** — cualquier LLM que soporte MCP (Claude Code, Antigravity, VS Code Copilot, Cursor) lo puede consultar
52
+ - **Cache inteligente (Schrödinger)** — los nodos se resuelven on-demand y se cachean con hash SHA256. Si el archivo cambia, el cache se invalida automáticamente (decoherencia)
53
+ - **Vistas por observador** — pide solo la firma (`signature`), un resumen (`summary`), o el código completo (`full`) — cada vista se cachea independientemente
54
+
55
+ ## Requisitos
56
+
57
+ - **Python 3.10+** (probado hasta 3.13)
58
+ - **uv** (recomendado) o pip
59
+
60
+ ### Opcional (para parsing AST real)
61
+
62
+ ```bash
63
+ pip install tree-sitter tree-sitter-python tree-sitter-javascript tree-sitter-typescript --user
64
+ ```
65
+
66
+ Sin esto, Reducto usa un parser regex que funciona pero es menos preciso. Con tree-sitter se detectan CALLS reales (función→función).
67
+
68
+ ## Instalación
69
+
70
+ ### Opción 1: con pip (la más simple)
71
+
72
+ ```bash
73
+ pip install git+https://github.com/SudacaDev/reducto.git --user
74
+ ```
75
+
76
+ ### Opción 2: con uv (más rápido)
77
+
78
+ ```bash
79
+ uv tool install --from git+https://github.com/SudacaDev/reducto.git reducto
80
+ ```
81
+
82
+ ### Opción 3: clonar y instalar local
83
+
84
+ ```bash
85
+ git clone https://github.com/SudacaDev/reducto.git
86
+ cd reducto
87
+ pip install . --user
88
+ # o con uv:
89
+ uv tool install --from . reducto
90
+ ```
91
+
92
+ ### Opcional: tree-sitter para parsing AST real
93
+
94
+ ```bash
95
+ pip install tree-sitter tree-sitter-python tree-sitter-javascript tree-sitter-typescript --user
96
+ ```
97
+
98
+ Sin esto, Reducto funciona con regex (menos preciso). Con tree-sitter detecta CALLS reales (función→función).
99
+
100
+ ### Verificar
101
+
102
+ ```bash
103
+ reducto --help
104
+ ```
105
+
106
+ ### Actualizar a la última versión
107
+
108
+ ```bash
109
+ pip install git+https://github.com/SudacaDev/reducto.git --user --force-reinstall
110
+ # o con uv:
111
+ uv tool install --from git+https://github.com/SudacaDev/reducto.git reducto --force
112
+ ```
113
+
114
+ ## Primeros pasos
115
+
116
+ ```bash
117
+ # 1. Ir a tu proyecto
118
+ cd mi-proyecto
119
+
120
+ # 2. Indexar el código (primera vez)
121
+ reducto ingest . --clean
122
+
123
+ # 3. Conectar con tu IDE
124
+ reducto install
125
+ # → te pregunta qué IDEs querés configurar
126
+ # → o directo: reducto install --target all
127
+
128
+ # 4. Listo — abrí tu IDE y preguntale algo sobre el proyecto
129
+ ```
130
+
131
+ ## Uso diario
132
+
133
+ ```bash
134
+ # Re-indexar después de cambios (solo procesa archivos modificados)
135
+ reducto ingest .
136
+
137
+ # Buscar en el grafo
138
+ reducto query "auth"
139
+ reducto query "getSession" --resolve
140
+
141
+ # Ver stats de ahorro de tokens
142
+ reducto context
143
+
144
+ # Ver el grafo visualmente
145
+ reducto visualize
146
+ # → abre reducto-out/graph.html en el navegador
147
+
148
+ # Agregar un skill de arquitectura desde GitHub
149
+ reducto skill https://github.com/SudacaDev/react-architecture
150
+ ```
151
+
152
+ ## Comandos
153
+
154
+ | Comando | Qué hace |
155
+ |---|---|
156
+ | `reducto ingest . [--clean]` | Indexa el proyecto (`--clean` = rebuild completo) |
157
+ | `reducto install [--target X]` | Configura tu IDE (claude-code, antigravity, vscode, cursor, all) |
158
+ | `reducto query "término" [--resolve]` | Busca en el grafo (`--resolve` = carga el código fuente) |
159
+ | `reducto context` | Muestra tokens usados y ahorrados |
160
+ | `reducto visualize` | Genera un HTML interactivo del grafo |
161
+ | `reducto skill <url>` | Descarga e indexa un skill desde GitHub |
162
+ | `reducto serve` | Levanta el MCP server (el IDE lo usa automáticamente) |
163
+
164
+ ## IDEs soportados
165
+
166
+ | IDE | Config generada |
167
+ |---|---|
168
+ | Claude Code | `.mcp.json` + `CLAUDE.md` + slash commands |
169
+ | Antigravity (Google) | `AGENTS.md` + `~/.gemini/antigravity/mcp_config.json` |
170
+ | VS Code (Copilot) | `.vscode/mcp.json` |
171
+ | Cursor | `.cursor/mcp.json` + `.cursorrules` |
172
+
173
+ ## Cómo funciona
174
+
175
+ ```
176
+ reducto ingest . ← parsea el código, extrae nodos y edges, detecta comunidades
177
+ todo queda en reducto-out/graph.json
178
+
179
+ Tu IDE pregunta algo → LLM consulta Reducto via MCP (search_context, get_callers, etc.)
180
+ → Reducto busca en el grafo (metadata, ~10 tokens)
181
+ → Si necesita el código: resuelve el nodo (lee solo esas líneas)
182
+ → Lo cachea con hash SHA256 (próxima vez = 0 tokens)
183
+ → Si el archivo cambió: invalida el cache automáticamente
184
+ ```
185
+
186
+ ## Archivos generados
187
+
188
+ ```
189
+ tu-proyecto/
190
+ reducto-out/ ← gitignored
191
+ graph.json ← el grafo completo
192
+ graph.html ← visualización interactiva
193
+ session_stats.json ← stats de tokens
194
+ .mcp.json ← config MCP para Claude Code
195
+ CLAUDE.md ← routing rules para Claude Code
196
+ AGENTS.md ← routing rules para Antigravity
197
+ .reducto/
198
+ skills/ ← skills descargados con `reducto skill`
199
+ ```
200
+
201
+ ## Troubleshooting
202
+
203
+ **"tree-sitter no disponible"** — Reducto funciona sin tree-sitter (usa regex), pero para CALLS reales necesitás instalarlo: `pip install tree-sitter tree-sitter-python tree-sitter-javascript tree-sitter-typescript --user`
204
+
205
+ **"error: Failed to install entrypoint" en Windows** — Cerrá Antigravity/Claude Code (tienen `reducto.exe` bloqueado) y reintentá.
206
+
207
+ **"UnicodeEncodeError" en Windows** — Setear `$env:PYTHONUTF8 = "1"` antes de correr Reducto, o agregarlo permanente: `[System.Environment]::SetEnvironmentVariable("PYTHONUTF8", "1", "User")`
208
+
209
+ **El MCP no conecta en Antigravity** — Verificá que `~/.gemini/antigravity/mcp_config.json` tenga la entrada de reducto. Corré `reducto install --target antigravity` para regenerarlo.
210
+
211
+ ## Licencia
212
+
213
+ MIT
@@ -0,0 +1,174 @@
1
+ # Reducto
2
+
3
+ > Reduce tokens, not intelligence.
4
+
5
+ Reducto convierte tu codebase en un **knowledge graph local** que cualquier LLM puede consultar sin leer archivos enteros. Menos tokens, mejores respuestas, mismo resultado.
6
+
7
+ ## Qué hace
8
+
9
+ - **Indexa tu proyecto** — parsea `.ts`, `.tsx`, `.js`, `.py` y `.md` extrayendo funciones, clases, imports y calls reales (AST via tree-sitter)
10
+ - **Detecta comunidades** — agrupa automáticamente archivos relacionados usando Louvain clustering
11
+ - **Guarda todo localmente** — en `reducto-out/graph.json`, sin base de datos, sin cuenta, sin internet
12
+ - **Expone el grafo via MCP** — cualquier LLM que soporte MCP (Claude Code, Antigravity, VS Code Copilot, Cursor) lo puede consultar
13
+ - **Cache inteligente (Schrödinger)** — los nodos se resuelven on-demand y se cachean con hash SHA256. Si el archivo cambia, el cache se invalida automáticamente (decoherencia)
14
+ - **Vistas por observador** — pide solo la firma (`signature`), un resumen (`summary`), o el código completo (`full`) — cada vista se cachea independientemente
15
+
16
+ ## Requisitos
17
+
18
+ - **Python 3.10+** (probado hasta 3.13)
19
+ - **uv** (recomendado) o pip
20
+
21
+ ### Opcional (para parsing AST real)
22
+
23
+ ```bash
24
+ pip install tree-sitter tree-sitter-python tree-sitter-javascript tree-sitter-typescript --user
25
+ ```
26
+
27
+ Sin esto, Reducto usa un parser regex que funciona pero es menos preciso. Con tree-sitter se detectan CALLS reales (función→función).
28
+
29
+ ## Instalación
30
+
31
+ ### Opción 1: con pip (la más simple)
32
+
33
+ ```bash
34
+ pip install git+https://github.com/SudacaDev/reducto.git --user
35
+ ```
36
+
37
+ ### Opción 2: con uv (más rápido)
38
+
39
+ ```bash
40
+ uv tool install --from git+https://github.com/SudacaDev/reducto.git reducto
41
+ ```
42
+
43
+ ### Opción 3: clonar y instalar local
44
+
45
+ ```bash
46
+ git clone https://github.com/SudacaDev/reducto.git
47
+ cd reducto
48
+ pip install . --user
49
+ # o con uv:
50
+ uv tool install --from . reducto
51
+ ```
52
+
53
+ ### Opcional: tree-sitter para parsing AST real
54
+
55
+ ```bash
56
+ pip install tree-sitter tree-sitter-python tree-sitter-javascript tree-sitter-typescript --user
57
+ ```
58
+
59
+ Sin esto, Reducto funciona con regex (menos preciso). Con tree-sitter detecta CALLS reales (función→función).
60
+
61
+ ### Verificar
62
+
63
+ ```bash
64
+ reducto --help
65
+ ```
66
+
67
+ ### Actualizar a la última versión
68
+
69
+ ```bash
70
+ pip install git+https://github.com/SudacaDev/reducto.git --user --force-reinstall
71
+ # o con uv:
72
+ uv tool install --from git+https://github.com/SudacaDev/reducto.git reducto --force
73
+ ```
74
+
75
+ ## Primeros pasos
76
+
77
+ ```bash
78
+ # 1. Ir a tu proyecto
79
+ cd mi-proyecto
80
+
81
+ # 2. Indexar el código (primera vez)
82
+ reducto ingest . --clean
83
+
84
+ # 3. Conectar con tu IDE
85
+ reducto install
86
+ # → te pregunta qué IDEs querés configurar
87
+ # → o directo: reducto install --target all
88
+
89
+ # 4. Listo — abrí tu IDE y preguntale algo sobre el proyecto
90
+ ```
91
+
92
+ ## Uso diario
93
+
94
+ ```bash
95
+ # Re-indexar después de cambios (solo procesa archivos modificados)
96
+ reducto ingest .
97
+
98
+ # Buscar en el grafo
99
+ reducto query "auth"
100
+ reducto query "getSession" --resolve
101
+
102
+ # Ver stats de ahorro de tokens
103
+ reducto context
104
+
105
+ # Ver el grafo visualmente
106
+ reducto visualize
107
+ # → abre reducto-out/graph.html en el navegador
108
+
109
+ # Agregar un skill de arquitectura desde GitHub
110
+ reducto skill https://github.com/SudacaDev/react-architecture
111
+ ```
112
+
113
+ ## Comandos
114
+
115
+ | Comando | Qué hace |
116
+ |---|---|
117
+ | `reducto ingest . [--clean]` | Indexa el proyecto (`--clean` = rebuild completo) |
118
+ | `reducto install [--target X]` | Configura tu IDE (claude-code, antigravity, vscode, cursor, all) |
119
+ | `reducto query "término" [--resolve]` | Busca en el grafo (`--resolve` = carga el código fuente) |
120
+ | `reducto context` | Muestra tokens usados y ahorrados |
121
+ | `reducto visualize` | Genera un HTML interactivo del grafo |
122
+ | `reducto skill <url>` | Descarga e indexa un skill desde GitHub |
123
+ | `reducto serve` | Levanta el MCP server (el IDE lo usa automáticamente) |
124
+
125
+ ## IDEs soportados
126
+
127
+ | IDE | Config generada |
128
+ |---|---|
129
+ | Claude Code | `.mcp.json` + `CLAUDE.md` + slash commands |
130
+ | Antigravity (Google) | `AGENTS.md` + `~/.gemini/antigravity/mcp_config.json` |
131
+ | VS Code (Copilot) | `.vscode/mcp.json` |
132
+ | Cursor | `.cursor/mcp.json` + `.cursorrules` |
133
+
134
+ ## Cómo funciona
135
+
136
+ ```
137
+ reducto ingest . ← parsea el código, extrae nodos y edges, detecta comunidades
138
+ todo queda en reducto-out/graph.json
139
+
140
+ Tu IDE pregunta algo → LLM consulta Reducto via MCP (search_context, get_callers, etc.)
141
+ → Reducto busca en el grafo (metadata, ~10 tokens)
142
+ → Si necesita el código: resuelve el nodo (lee solo esas líneas)
143
+ → Lo cachea con hash SHA256 (próxima vez = 0 tokens)
144
+ → Si el archivo cambió: invalida el cache automáticamente
145
+ ```
146
+
147
+ ## Archivos generados
148
+
149
+ ```
150
+ tu-proyecto/
151
+ reducto-out/ ← gitignored
152
+ graph.json ← el grafo completo
153
+ graph.html ← visualización interactiva
154
+ session_stats.json ← stats de tokens
155
+ .mcp.json ← config MCP para Claude Code
156
+ CLAUDE.md ← routing rules para Claude Code
157
+ AGENTS.md ← routing rules para Antigravity
158
+ .reducto/
159
+ skills/ ← skills descargados con `reducto skill`
160
+ ```
161
+
162
+ ## Troubleshooting
163
+
164
+ **"tree-sitter no disponible"** — Reducto funciona sin tree-sitter (usa regex), pero para CALLS reales necesitás instalarlo: `pip install tree-sitter tree-sitter-python tree-sitter-javascript tree-sitter-typescript --user`
165
+
166
+ **"error: Failed to install entrypoint" en Windows** — Cerrá Antigravity/Claude Code (tienen `reducto.exe` bloqueado) y reintentá.
167
+
168
+ **"UnicodeEncodeError" en Windows** — Setear `$env:PYTHONUTF8 = "1"` antes de correr Reducto, o agregarlo permanente: `[System.Environment]::SetEnvironmentVariable("PYTHONUTF8", "1", "User")`
169
+
170
+ **El MCP no conecta en Antigravity** — Verificá que `~/.gemini/antigravity/mcp_config.json` tenga la entrada de reducto. Corré `reducto install --target antigravity` para regenerarlo.
171
+
172
+ ## Licencia
173
+
174
+ MIT
@@ -0,0 +1,66 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "reducto_graph"
7
+ version = "0.2.0"
8
+ description = "Universal knowledge graph for LLMs — reduce tokens, not intelligence."
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ requires-python = ">=3.10"
12
+ authors = [
13
+ { name = "Reducto", email = "sudacadev@gmail.com" }
14
+ ]
15
+ keywords = [
16
+ "llm", "knowledge-graph", "tokens", "mcp", "claude",
17
+ "context", "codebase", "neo4j", "ai"
18
+ ]
19
+ classifiers = [
20
+ "Development Status :: 3 - Alpha",
21
+ "Intended Audience :: Developers",
22
+ "License :: OSI Approved :: MIT License",
23
+ "Programming Language :: Python :: 3",
24
+ "Programming Language :: Python :: 3.10",
25
+ "Programming Language :: Python :: 3.11",
26
+ "Programming Language :: Python :: 3.12",
27
+ "Topic :: Software Development :: Libraries :: Python Modules",
28
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
29
+ ]
30
+ dependencies = [
31
+ "networkx>=3.0",
32
+ "mcp>=1.0.0",
33
+ "click>=8.1",
34
+ "rich>=13.0",
35
+ ]
36
+
37
+ [project.urls]
38
+ Homepage = "https://github.com/SudacaDev/reducto"
39
+ Documentation = "https://github.com/SudacaDev/reducto#readme"
40
+ Repository = "https://github.com/SudacaDev/reducto"
41
+ "Bug Tracker" = "https://github.com/SudacaDev/reducto/issues"
42
+
43
+ [project.scripts]
44
+ reducto = "reducto.cli:cli"
45
+
46
+ # Permite `uv tool install reducto` y `pipx install reducto`
47
+ [project.optional-dependencies]
48
+ ast = [
49
+ "tree-sitter>=0.23",
50
+ "tree-sitter-python>=0.23",
51
+ "tree-sitter-javascript>=0.23",
52
+ "tree-sitter-typescript>=0.23",
53
+ ]
54
+ dev = [
55
+ "build>=1.0",
56
+ "twine>=5.0",
57
+ "pytest>=8.0",
58
+ "ruff>=0.4",
59
+ ]
60
+
61
+ [tool.setuptools.packages.find]
62
+ where = ["."]
63
+ include = ["reducto*"]
64
+
65
+ [tool.setuptools.package-data]
66
+ reducto = ["py.typed", "assets/*.js"]
@@ -0,0 +1,6 @@
1
+ """
2
+ Reducto — Universal knowledge graph for LLMs.
3
+ Reduce tokens, not intelligence.
4
+ """
5
+
6
+ __version__ = "0.1.0"