ctxgraph 0.5.3__tar.gz → 0.5.4__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.
Files changed (56) hide show
  1. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/PKG-INFO +55 -1
  2. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/README.md +54 -0
  3. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/pyproject.toml +1 -1
  4. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/chat.py +9 -6
  5. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph.egg-info/PKG-INFO +55 -1
  6. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/setup.cfg +0 -0
  7. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/__init__.py +0 -0
  8. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/analyzers/__init__.py +0 -0
  9. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/analyzers/python/__init__.py +0 -0
  10. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/analyzers/python/importer.py +0 -0
  11. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/analyzers/python/semantic.py +0 -0
  12. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/analyzers/python/symbols.py +0 -0
  13. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/capsule/__init__.py +0 -0
  14. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/capsule/renderer.py +0 -0
  15. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/capsule/savings.py +0 -0
  16. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/cli/__init__.py +0 -0
  17. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/cli/main.py +0 -0
  18. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/clients/__init__.py +0 -0
  19. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/clients/models.py +0 -0
  20. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/config/__init__.py +0 -0
  21. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/config/init.py +0 -0
  22. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/config/providers.py +0 -0
  23. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/config/settings.py +0 -0
  24. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/exclude/__init__.py +0 -0
  25. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/exclude/patterns.py +0 -0
  26. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/graph/__init__.py +0 -0
  27. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/graph/builder.py +0 -0
  28. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/graph/models.py +0 -0
  29. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/graph/query.py +0 -0
  30. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/graph/storage.py +0 -0
  31. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/history.py +0 -0
  32. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/mcp/__init__.py +0 -0
  33. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/mcp/server.py +0 -0
  34. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/skills/__init__.py +0 -0
  35. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/skills/field-guide.toml +0 -0
  36. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/skills/project-style.toml +0 -0
  37. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/skills/template.example.toml +0 -0
  38. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/view/__init__.py +0 -0
  39. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/view/visualizer.py +0 -0
  40. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/wrapper/__init__.py +0 -0
  41. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph/wrapper/claude.py +0 -0
  42. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph.egg-info/SOURCES.txt +0 -0
  43. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph.egg-info/dependency_links.txt +0 -0
  44. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph.egg-info/entry_points.txt +0 -0
  45. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph.egg-info/requires.txt +0 -0
  46. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/src/ctxgraph.egg-info/top_level.txt +0 -0
  47. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/tests/test_analyzers.py +0 -0
  48. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/tests/test_benchmark.py +0 -0
  49. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/tests/test_capsule.py +0 -0
  50. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/tests/test_config.py +0 -0
  51. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/tests/test_e2e.py +0 -0
  52. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/tests/test_integration.py +0 -0
  53. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/tests/test_model_mode.py +0 -0
  54. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/tests/test_models.py +0 -0
  55. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/tests/test_query.py +0 -0
  56. {ctxgraph-0.5.3 → ctxgraph-0.5.4}/tests/test_storage.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ctxgraph
3
- Version: 0.5.3
3
+ Version: 0.5.4
4
4
  Summary: 97% cheaper AI coding. ctxgraph builds a knowledge graph of your Python codebase, then generates token-efficient context capsules for any AI tool. Or hook up Ollama/Claude/OpenAI and use it as a code-aware coding assistant — like ChatGPT or Claude Code, but with built-in graph context. Cut token costs by 97%, work offline with just a graph, or connect your favorite LLM.
5
5
  Author: ctxgraph contributors
6
6
  License: MIT
@@ -177,6 +177,60 @@ ctx capsule "user authentication" --savings
177
177
 
178
178
  ---
179
179
 
180
+ ## Approach Comparison
181
+
182
+ Independent analysis by Claude compared ctxgraph's token efficiency against other common approaches for the same task — answering `"how does InventoryService link to OrderService"` in a real codebase:
183
+
184
+ ![Approach comparison](docs/approach-comparison.png)
185
+
186
+ ### How each approach works step-by-step
187
+
188
+ **ctxgraph (graph-based surgical fetch)**
189
+ ```
190
+ search_graph("InventoryService OrderService") → paths only (~50 tok)
191
+ get_file_dependencies() → dependency map
192
+ read_file × 2 → exact files needed
193
+ Done. 0 irrelevant tokens.
194
+ ```
195
+
196
+ **Claude Code (agentic filesystem access)**
197
+ ```
198
+ Load system prompt (~1,500 tok)
199
+ Glob("**/*service*") → list paths
200
+ Grep("InventoryService") → narrow hits
201
+ Read × 2–3 (target files + maybe models.py)
202
+ Answer. Small extra overhead from explore steps.
203
+ ```
204
+
205
+ **CLAUDE.md approach (static map)**
206
+ ```
207
+ Load full index (~2,800 tok) — paid every session
208
+ Scan index manually, pick files
209
+ Read × 2 (explicit paths)
210
+ Index cost is fixed — paid even for unrelated queries.
211
+ ```
212
+
213
+ **No tooling (full dump)**
214
+ ```
215
+ All 34 files pasted in (~85k tok)
216
+ Context overflow risk above ~200 files
217
+ Early files pushed out, answers degrade
218
+ Not viable at scale.
219
+ ```
220
+
221
+ | Approach | Total Input Tokens | Tool Calls | Session Overhead |
222
+ |---|---|---|---|
223
+ | ctxgraph | **~5,600** | 3 | ~0 |
224
+ | Claude Code | ~8,000 | 4–6 | ~1,500 (system prompt) |
225
+ | CLAUDE.md | ~8,400 | 2 | ~2,800 (static index) |
226
+ | No tooling | ~85,000+ | 0 | — |
227
+
228
+ The key insight: **ctxgraph's graph is pre-built.** `search_graph` returns file paths for ~50 tokens, then you fetch only what you need. Agentic approaches (Claude Code) burn tokens exploring the filesystem dynamically. Static index approaches (CLAUDE.md) burn tokens loading a full index on every session — even for unrelated queries.
229
+
230
+ ---
231
+
232
+
233
+
180
234
  ## Commands
181
235
 
182
236
  ### `ctx init` — Scaffold project
@@ -148,6 +148,60 @@ ctx capsule "user authentication" --savings
148
148
 
149
149
  ---
150
150
 
151
+ ## Approach Comparison
152
+
153
+ Independent analysis by Claude compared ctxgraph's token efficiency against other common approaches for the same task — answering `"how does InventoryService link to OrderService"` in a real codebase:
154
+
155
+ ![Approach comparison](docs/approach-comparison.png)
156
+
157
+ ### How each approach works step-by-step
158
+
159
+ **ctxgraph (graph-based surgical fetch)**
160
+ ```
161
+ search_graph("InventoryService OrderService") → paths only (~50 tok)
162
+ get_file_dependencies() → dependency map
163
+ read_file × 2 → exact files needed
164
+ Done. 0 irrelevant tokens.
165
+ ```
166
+
167
+ **Claude Code (agentic filesystem access)**
168
+ ```
169
+ Load system prompt (~1,500 tok)
170
+ Glob("**/*service*") → list paths
171
+ Grep("InventoryService") → narrow hits
172
+ Read × 2–3 (target files + maybe models.py)
173
+ Answer. Small extra overhead from explore steps.
174
+ ```
175
+
176
+ **CLAUDE.md approach (static map)**
177
+ ```
178
+ Load full index (~2,800 tok) — paid every session
179
+ Scan index manually, pick files
180
+ Read × 2 (explicit paths)
181
+ Index cost is fixed — paid even for unrelated queries.
182
+ ```
183
+
184
+ **No tooling (full dump)**
185
+ ```
186
+ All 34 files pasted in (~85k tok)
187
+ Context overflow risk above ~200 files
188
+ Early files pushed out, answers degrade
189
+ Not viable at scale.
190
+ ```
191
+
192
+ | Approach | Total Input Tokens | Tool Calls | Session Overhead |
193
+ |---|---|---|---|
194
+ | ctxgraph | **~5,600** | 3 | ~0 |
195
+ | Claude Code | ~8,000 | 4–6 | ~1,500 (system prompt) |
196
+ | CLAUDE.md | ~8,400 | 2 | ~2,800 (static index) |
197
+ | No tooling | ~85,000+ | 0 | — |
198
+
199
+ The key insight: **ctxgraph's graph is pre-built.** `search_graph` returns file paths for ~50 tokens, then you fetch only what you need. Agentic approaches (Claude Code) burn tokens exploring the filesystem dynamically. Static index approaches (CLAUDE.md) burn tokens loading a full index on every session — even for unrelated queries.
200
+
201
+ ---
202
+
203
+
204
+
151
205
  ## Commands
152
206
 
153
207
  ### `ctx init` — Scaffold project
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ctxgraph"
7
- version = "0.5.3"
7
+ version = "0.5.4"
8
8
  description = "97% cheaper AI coding. ctxgraph builds a knowledge graph of your Python codebase, then generates token-efficient context capsules for any AI tool. Or hook up Ollama/Claude/OpenAI and use it as a code-aware coding assistant — like ChatGPT or Claude Code, but with built-in graph context. Cut token costs by 97%, work offline with just a graph, or connect your favorite LLM."
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -177,6 +177,8 @@ def interactive_session_picker(repo_path: Path) -> Optional[str]:
177
177
  table.add_column("Last", style="white")
178
178
 
179
179
  def render_table(highlight: int) -> Table:
180
+ from rich.markup import escape
181
+
180
182
  t = Table(title="Chat Sessions (↑/↓ select, Enter confirm, Esc cancel)", show_header=True)
181
183
  t.add_column("#", style="dim", width=3)
182
184
  t.add_column("ID", style="cyan")
@@ -184,13 +186,14 @@ def interactive_session_picker(repo_path: Path) -> Optional[str]:
184
186
  t.add_column("Tokens", style="magenta", justify="right")
185
187
  t.add_column("Last", style="white")
186
188
  for i, s in enumerate(sessions):
187
- style = "reverse" if i == highlight else ""
189
+ row_style = "reverse" if i == highlight else None
188
190
  t.add_row(
189
- f"{i + 1}",
190
- f"[{style}]{s['id']}[/{style}]",
191
- f"[{style}]{s['turns']}[/{style}]",
192
- f"[{style}]{s['tokens']}[/{style}]",
193
- f"[{style}]{s['last_message']}[/{style}]",
191
+ str(i + 1),
192
+ escape(s["id"]),
193
+ str(s["turns"]),
194
+ str(s["tokens"]),
195
+ escape(s["last_message"]),
196
+ style=row_style,
194
197
  )
195
198
  return t
196
199
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ctxgraph
3
- Version: 0.5.3
3
+ Version: 0.5.4
4
4
  Summary: 97% cheaper AI coding. ctxgraph builds a knowledge graph of your Python codebase, then generates token-efficient context capsules for any AI tool. Or hook up Ollama/Claude/OpenAI and use it as a code-aware coding assistant — like ChatGPT or Claude Code, but with built-in graph context. Cut token costs by 97%, work offline with just a graph, or connect your favorite LLM.
5
5
  Author: ctxgraph contributors
6
6
  License: MIT
@@ -177,6 +177,60 @@ ctx capsule "user authentication" --savings
177
177
 
178
178
  ---
179
179
 
180
+ ## Approach Comparison
181
+
182
+ Independent analysis by Claude compared ctxgraph's token efficiency against other common approaches for the same task — answering `"how does InventoryService link to OrderService"` in a real codebase:
183
+
184
+ ![Approach comparison](docs/approach-comparison.png)
185
+
186
+ ### How each approach works step-by-step
187
+
188
+ **ctxgraph (graph-based surgical fetch)**
189
+ ```
190
+ search_graph("InventoryService OrderService") → paths only (~50 tok)
191
+ get_file_dependencies() → dependency map
192
+ read_file × 2 → exact files needed
193
+ Done. 0 irrelevant tokens.
194
+ ```
195
+
196
+ **Claude Code (agentic filesystem access)**
197
+ ```
198
+ Load system prompt (~1,500 tok)
199
+ Glob("**/*service*") → list paths
200
+ Grep("InventoryService") → narrow hits
201
+ Read × 2–3 (target files + maybe models.py)
202
+ Answer. Small extra overhead from explore steps.
203
+ ```
204
+
205
+ **CLAUDE.md approach (static map)**
206
+ ```
207
+ Load full index (~2,800 tok) — paid every session
208
+ Scan index manually, pick files
209
+ Read × 2 (explicit paths)
210
+ Index cost is fixed — paid even for unrelated queries.
211
+ ```
212
+
213
+ **No tooling (full dump)**
214
+ ```
215
+ All 34 files pasted in (~85k tok)
216
+ Context overflow risk above ~200 files
217
+ Early files pushed out, answers degrade
218
+ Not viable at scale.
219
+ ```
220
+
221
+ | Approach | Total Input Tokens | Tool Calls | Session Overhead |
222
+ |---|---|---|---|
223
+ | ctxgraph | **~5,600** | 3 | ~0 |
224
+ | Claude Code | ~8,000 | 4–6 | ~1,500 (system prompt) |
225
+ | CLAUDE.md | ~8,400 | 2 | ~2,800 (static index) |
226
+ | No tooling | ~85,000+ | 0 | — |
227
+
228
+ The key insight: **ctxgraph's graph is pre-built.** `search_graph` returns file paths for ~50 tokens, then you fetch only what you need. Agentic approaches (Claude Code) burn tokens exploring the filesystem dynamically. Static index approaches (CLAUDE.md) burn tokens loading a full index on every session — even for unrelated queries.
229
+
230
+ ---
231
+
232
+
233
+
180
234
  ## Commands
181
235
 
182
236
  ### `ctx init` — Scaffold project
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes