ctxgraph 0.2.4__tar.gz → 0.3.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.
- {ctxgraph-0.2.4/src/ctxgraph.egg-info → ctxgraph-0.3.0}/PKG-INFO +82 -11
- ctxgraph-0.2.4/PKG-INFO → ctxgraph-0.3.0/README.md +610 -568
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/pyproject.toml +1 -1
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph/capsule/renderer.py +9 -1
- ctxgraph-0.3.0/src/ctxgraph/capsule/savings.py +85 -0
- ctxgraph-0.3.0/src/ctxgraph/cli/main.py +537 -0
- ctxgraph-0.3.0/src/ctxgraph/config/init.py +26 -0
- ctxgraph-0.3.0/src/ctxgraph/history.py +69 -0
- ctxgraph-0.3.0/src/ctxgraph/skills/__init__.py +38 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph/view/visualizer.py +10 -2
- ctxgraph-0.2.4/README.md → ctxgraph-0.3.0/src/ctxgraph.egg-info/PKG-INFO +639 -539
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph.egg-info/SOURCES.txt +5 -0
- ctxgraph-0.3.0/tests/test_e2e.py +219 -0
- ctxgraph-0.2.4/src/ctxgraph/cli/main.py +0 -262
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/setup.cfg +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph/__init__.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph/analyzers/__init__.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph/analyzers/python/__init__.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph/analyzers/python/importer.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph/analyzers/python/semantic.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph/analyzers/python/symbols.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph/capsule/__init__.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph/cli/__init__.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph/clients/__init__.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph/clients/models.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph/config/__init__.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph/config/providers.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph/config/settings.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph/exclude/__init__.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph/exclude/patterns.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph/graph/__init__.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph/graph/builder.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph/graph/models.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph/graph/query.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph/graph/storage.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph/mcp/__init__.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph/mcp/server.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph/view/__init__.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph/wrapper/__init__.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph/wrapper/claude.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph.egg-info/dependency_links.txt +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph.egg-info/entry_points.txt +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph.egg-info/requires.txt +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/src/ctxgraph.egg-info/top_level.txt +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/tests/test_analyzers.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/tests/test_benchmark.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/tests/test_capsule.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/tests/test_config.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/tests/test_integration.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/tests/test_model_mode.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/tests/test_models.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/tests/test_query.py +0 -0
- {ctxgraph-0.2.4 → ctxgraph-0.3.0}/tests/test_storage.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ctxgraph
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: AI context engine for Python — cuts LLM tokens 97% via code knowledge graphs. Build, query, and generate compact context capsules for Claude, OpenAI, Ollama.
|
|
5
5
|
Author: ctxgraph contributors
|
|
6
6
|
License: MIT
|
|
@@ -86,10 +86,10 @@ Repository (.py files)
|
|
|
86
86
|
### Architecture
|
|
87
87
|
|
|
88
88
|
```
|
|
89
|
-
┌─────────┐ ┌──────────────┐ ┌──────────────┐
|
|
90
|
-
│ CLI │───▶│ Analyzers │───▶│ SQLite DB │
|
|
91
|
-
│ typer │ │ AST-based │ │ .ctxgraph/ │
|
|
92
|
-
└────┬────┘ └──────────────┘ └──────┬───────┘
|
|
89
|
+
┌─────────┐ ┌──────────────┐ ┌──────────────┐ ┌─────────────┐
|
|
90
|
+
│ CLI │───▶│ Analyzers │───▶│ SQLite DB │───▶│ Skills/Hist │
|
|
91
|
+
│ typer │ │ AST-based │ │ .ctxgraph/ │ │ .ctxgraph/ │
|
|
92
|
+
└────┬────┘ └──────────────┘ └──────┬───────┘ └─────────────┘
|
|
93
93
|
│ │
|
|
94
94
|
├── ctx build ──────────────────────▶│ Graph build
|
|
95
95
|
│ │
|
|
@@ -97,9 +97,17 @@ Repository (.py files)
|
|
|
97
97
|
│ │
|
|
98
98
|
├── ctx query ◀─────────────────────│ Keyword search
|
|
99
99
|
│ │
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
├── ctx ask ◀──────────────────────│ LLM query + savings
|
|
101
|
+
│ │
|
|
102
|
+
├── ctx view ◀──────────────────────│ D3.js viz
|
|
103
|
+
│ │
|
|
104
|
+
├── ctx serve ◀─────────────────────│ MCP server
|
|
105
|
+
│ │
|
|
106
|
+
├── ctx init ───────────────────────│ Scaffold project
|
|
107
|
+
│ │
|
|
108
|
+
├── ctx history ◀───────────────────│ Query log
|
|
109
|
+
│ │
|
|
110
|
+
└── ctx skill ◀─────────────────────│ Skill management
|
|
103
111
|
│ │
|
|
104
112
|
└── ccg wrapper ───▶ Claude Code ───┘ AI tool
|
|
105
113
|
```
|
|
@@ -159,10 +167,36 @@ JSON: 426 tokens DSL: 143 tokens
|
|
|
159
167
|
|
|
160
168
|
**+16.7pp average coverage improvement** — better answers, concrete file names, real code structure.
|
|
161
169
|
|
|
170
|
+
### Token Savings Display
|
|
171
|
+
|
|
172
|
+
Use `--savings` to see how many tokens each capsule saves:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
ctx capsule "user authentication" --savings
|
|
176
|
+
# ┌──────────────────────────┬──────────────┐
|
|
177
|
+
# │ Metric │ Value │
|
|
178
|
+
# ├──────────────────────────┼──────────────┤
|
|
179
|
+
# │ Raw Project .py Files │ 10,587 tokens│
|
|
180
|
+
# │ Capsule DSL │ 132 tokens │
|
|
181
|
+
# │ JSON Equivalent │ 490 tokens │
|
|
182
|
+
# │ Savings vs Raw │ 98.8% │
|
|
183
|
+
# │ DSL vs JSON │ 73.1% │
|
|
184
|
+
# └──────────────────────────┴──────────────┘
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
`ctx ask` shows this automatically on every query.
|
|
188
|
+
|
|
162
189
|
---
|
|
163
190
|
|
|
164
191
|
## Commands
|
|
165
192
|
|
|
193
|
+
### `ctx init` — Scaffold project
|
|
194
|
+
```bash
|
|
195
|
+
ctx init
|
|
196
|
+
# Creates: .ctxgraph/config.toml, .ctxgraph/skills/, .ctxgraph/history.jsonl
|
|
197
|
+
```
|
|
198
|
+
Sets up a fresh `.ctxgraph/` directory with default config and built-in skills. Idempotent — safe to run on existing projects.
|
|
199
|
+
|
|
166
200
|
### `ctx build` — Build knowledge graph
|
|
167
201
|
```bash
|
|
168
202
|
ctx build # Current directory
|
|
@@ -170,12 +204,24 @@ ctx build /path/to/project # Specific repo
|
|
|
170
204
|
ctx build --exclude "vendor/*" # Custom exclude patterns
|
|
171
205
|
```
|
|
172
206
|
|
|
207
|
+
### `ctx ask <query>` — Ask questions via LLM
|
|
208
|
+
```bash
|
|
209
|
+
ctx ask "how does JWT auth work" # Uses configured provider
|
|
210
|
+
ctx ask "fix login bug" --provider claude --model claude-sonnet-4-20250514
|
|
211
|
+
ctx ask "refactor payment flow" --skill project-style # Activate a skill
|
|
212
|
+
ctx ask "find auth code" --graph # Show graph search results
|
|
213
|
+
ctx ask "deep dive" --mode deep # Deep graph context
|
|
214
|
+
```
|
|
215
|
+
Shows token savings automatically. Requires a running Ollama instance (or other configured provider).
|
|
216
|
+
|
|
173
217
|
### `ctx capsule <query>` — Generate context
|
|
174
218
|
```bash
|
|
175
219
|
ctx capsule "fix JWT token validation" # Balanced (default: 20 nodes, depth 2)
|
|
176
220
|
ctx capsule "fix JWT token validation" --mode fast # Fast (10 nodes, depth 1)
|
|
177
221
|
ctx capsule "fix JWT token validation" --mode deep # Deep (40 nodes, depth 3)
|
|
178
222
|
ctx capsule --overview # Project architecture overview
|
|
223
|
+
ctx capsule "fix auth" --savings # Show token savings table
|
|
224
|
+
ctx capsule "fix auth" --skill project-style # Prepends skill context
|
|
179
225
|
```
|
|
180
226
|
|
|
181
227
|
| Mode | Max Nodes | BFS Depth | When to Use |
|
|
@@ -217,6 +263,22 @@ Claude Desktop config:
|
|
|
217
263
|
```
|
|
218
264
|
Tools: `search_graph`, `get_context_capsule`, `get_file_dependencies`, `get_project_overview`.
|
|
219
265
|
|
|
266
|
+
### `ctx history` — Query history
|
|
267
|
+
```bash
|
|
268
|
+
ctx history # Last 10 queries
|
|
269
|
+
ctx history -n 20 # Last 20
|
|
270
|
+
ctx history --filter "auth" # Filter by keyword
|
|
271
|
+
ctx history --stats # Aggregate statistics
|
|
272
|
+
```
|
|
273
|
+
History stored in JSONL format at `.ctxgraph/history.jsonl`. Auto-prunes to 1000 entries.
|
|
274
|
+
|
|
275
|
+
### `ctx skill` — Manage skills
|
|
276
|
+
```bash
|
|
277
|
+
ctx skill list # Show all available skills
|
|
278
|
+
ctx skill show project-style # Display skill contents
|
|
279
|
+
```
|
|
280
|
+
Skills are TOML files in `.ctxgraph/skills/`. Activate with `ctx ask --skill <name>` or `ctx capsule --skill <name>`.
|
|
281
|
+
|
|
220
282
|
### `ctx info` — Graph statistics
|
|
221
283
|
```bash
|
|
222
284
|
ctx info
|
|
@@ -531,25 +593,34 @@ python benchmarks/run_ollama_comparison.py # Requires local Ollama
|
|
|
531
593
|
### Project Structure
|
|
532
594
|
```
|
|
533
595
|
src/ctxgraph/
|
|
534
|
-
├── cli/main.py — Typer CLI (
|
|
596
|
+
├── cli/main.py — Typer CLI (9 commands)
|
|
535
597
|
├── graph/
|
|
536
598
|
│ ├── models.py — Node, Edge, Graph dataclasses
|
|
537
599
|
│ ├── storage.py — SQLite persistence
|
|
538
600
|
│ ├── builder.py — Graph build orchestrator
|
|
539
601
|
│ └── query.py — Tokenizer + BFS + relevance scoring
|
|
540
|
-
├── capsule/
|
|
602
|
+
├── capsule/
|
|
603
|
+
│ ├── renderer.py — DSL context generation
|
|
604
|
+
│ └── savings.py — Token savings computation
|
|
541
605
|
├── analyzers/python/
|
|
542
606
|
│ ├── importer.py — AST import extraction
|
|
543
607
|
│ ├── symbols.py — AST class/function/method analysis
|
|
544
608
|
│ └── semantic.py — Docstring summarization
|
|
545
609
|
├── config/
|
|
610
|
+
│ ├── __init__.py
|
|
611
|
+
│ ├── init.py — Project scaffold (.ctxgraph dir)
|
|
546
612
|
│ ├── settings.py — TOML/JSON/env config loading
|
|
547
613
|
│ └── providers.py — Ollama, Claude, OpenAI clients
|
|
548
614
|
├── clients/models.py — Mode enum (fast/balanced/deep)
|
|
549
615
|
├── exclude/patterns.py — Exclusion pattern matching
|
|
550
616
|
├── view/visualizer.py — D3.js HTML graph generator
|
|
551
617
|
├── wrapper/claude.py — ccg Claude wrapper
|
|
552
|
-
|
|
618
|
+
├── mcp/server.py — MCP protocol server
|
|
619
|
+
├── skills/
|
|
620
|
+
│ ├── __init__.py — Skill discovery + loading
|
|
621
|
+
│ ├── project-style.toml — Default skill: project conventions
|
|
622
|
+
│ └── field-guide.toml — Default skill: field guide
|
|
623
|
+
└── history.py — JSONL history append/query/stats
|
|
553
624
|
```
|
|
554
625
|
|
|
555
626
|
---
|