ctxgraph 0.4.0__tar.gz → 0.5.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.4.0 → ctxgraph-0.5.0}/PKG-INFO +22 -7
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/README.md +20 -5
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/pyproject.toml +2 -2
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/config/settings.py +23 -6
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/mcp/server.py +8 -1
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph.egg-info/PKG-INFO +22 -7
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/setup.cfg +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/__init__.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/analyzers/__init__.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/analyzers/python/__init__.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/analyzers/python/importer.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/analyzers/python/semantic.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/analyzers/python/symbols.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/capsule/__init__.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/capsule/renderer.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/capsule/savings.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/chat.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/cli/__init__.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/cli/main.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/clients/__init__.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/clients/models.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/config/__init__.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/config/init.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/config/providers.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/exclude/__init__.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/exclude/patterns.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/graph/__init__.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/graph/builder.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/graph/models.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/graph/query.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/graph/storage.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/history.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/mcp/__init__.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/skills/__init__.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/skills/field-guide.toml +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/skills/project-style.toml +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/skills/template.example.toml +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/view/__init__.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/view/visualizer.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/wrapper/__init__.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph/wrapper/claude.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph.egg-info/SOURCES.txt +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph.egg-info/dependency_links.txt +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph.egg-info/entry_points.txt +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph.egg-info/requires.txt +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/src/ctxgraph.egg-info/top_level.txt +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/tests/test_analyzers.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/tests/test_benchmark.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/tests/test_capsule.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/tests/test_config.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/tests/test_e2e.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/tests/test_integration.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/tests/test_model_mode.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/tests/test_models.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/tests/test_query.py +0 -0
- {ctxgraph-0.4.0 → ctxgraph-0.5.0}/tests/test_storage.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ctxgraph
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: 97% cheaper AI coding.
|
|
3
|
+
Version: 0.5.0
|
|
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
|
|
7
7
|
Keywords: code-graph,knowledge-graph,claude,code-analysis,ai-context,token-savings,ollama,openai,ctx,capsule
|
|
@@ -29,15 +29,25 @@ Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
|
29
29
|
|
|
30
30
|
# ctxgraph — AI Context Engine for Python
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
## What is ctxgraph?
|
|
33
|
+
|
|
34
|
+
ctxgraph is a **knowledge graph engine** that makes AI coding assistants **97% cheaper** and **smarter**.
|
|
35
|
+
|
|
36
|
+
It analyzes your Python codebase using AST-based static analysis, builds a searchable dependency graph, and delivers *only the code that matters* to your AI — not every line in your project.
|
|
37
|
+
|
|
38
|
+
### Two ways to use it:
|
|
39
|
+
|
|
40
|
+
**🔧 As a token-saving context engine** — Output compact DSL capsules for any AI tool (Claude, ChatGPT, Cursor, etc.). Cut context costs from dollars to fractions of a cent.
|
|
41
|
+
|
|
42
|
+
**🤖 As a full AI coding assistant** — Hook up Ollama (free, local), Claude, or OpenAI, and ask questions, refactor code, debug issues, or explore architecture through `ctx ask` or `ctx chat` — just like ChatGPT or Claude Code, but with built-in codebase awareness.
|
|
33
43
|
|
|
34
44
|
```bash
|
|
35
45
|
pip install ctxgraph
|
|
36
46
|
|
|
37
47
|
ctx init # Scaffold .ctxgraph with config + default skills
|
|
38
48
|
ctx build # Build knowledge graph (AST analysis → SQLite)
|
|
39
|
-
ctx ask "how does JWT auth work" # Ask questions with automatic token savings
|
|
40
|
-
ctx capsule "fix JWT expiry" # 92-99% fewer tokens vs raw code
|
|
49
|
+
ctx ask "how does JWT auth work" # Ask questions with automatic token savings (needs LLM)
|
|
50
|
+
ctx capsule "fix JWT expiry" # 92-99% fewer tokens vs raw code (no LLM needed)
|
|
41
51
|
ctx chat "refactor this module" # Multi-turn conversation with persistent sessions
|
|
42
52
|
ctx history --stats # Track total tokens saved across all queries
|
|
43
53
|
ccg "fix the login redirect bug" # Launch Claude with context pre-loaded
|
|
@@ -57,11 +67,14 @@ ctx init # Creates .ctxgraph/config.toml + default ski
|
|
|
57
67
|
# 2. Build the knowledge graph
|
|
58
68
|
ctx build # AST analysis → SQLite graph
|
|
59
69
|
|
|
60
|
-
#
|
|
70
|
+
# 3a. Ask questions (requires Ollama or other LLM provider — free with Ollama)
|
|
61
71
|
ctx ask "how does authentication work"
|
|
62
72
|
|
|
63
|
-
#
|
|
73
|
+
# 3b. Or just generate a capsule for your AI tool (no LLM needed)
|
|
64
74
|
ctx capsule "fix login rate limiter" --savings
|
|
75
|
+
|
|
76
|
+
# 4. Explore interactively
|
|
77
|
+
ctx chat # Multi-turn REPL with persistent sessions
|
|
65
78
|
```
|
|
66
79
|
|
|
67
80
|
---
|
|
@@ -70,6 +83,8 @@ ctx capsule "fix login rate limiter" --savings
|
|
|
70
83
|
|
|
71
84
|
Sending entire files to an AI is wasteful. ctxgraph analyzes your code with AST-based static analysis, stores the result in a queryable SQLite graph, and retrieves *only the relevant nodes* — compressed into a token-efficient DSL format.
|
|
72
85
|
|
|
86
|
+
**No LLM? No problem.** ctxgraph's core features (graph building, capsule generation, search, visualization) work entirely offline. You only need an LLM provider when you want to ask questions via `ctx ask` or chat via `ctx chat`.
|
|
87
|
+
|
|
73
88
|
| Without ctxgraph | With ctxgraph | Savings |
|
|
74
89
|
|:---|---:|:---:|
|
|
75
90
|
| All files dumped to context | Targeted capsule (10-40 nodes) | **97% fewer tokens** |
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
# ctxgraph — AI Context Engine for Python
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## What is ctxgraph?
|
|
4
|
+
|
|
5
|
+
ctxgraph is a **knowledge graph engine** that makes AI coding assistants **97% cheaper** and **smarter**.
|
|
6
|
+
|
|
7
|
+
It analyzes your Python codebase using AST-based static analysis, builds a searchable dependency graph, and delivers *only the code that matters* to your AI — not every line in your project.
|
|
8
|
+
|
|
9
|
+
### Two ways to use it:
|
|
10
|
+
|
|
11
|
+
**🔧 As a token-saving context engine** — Output compact DSL capsules for any AI tool (Claude, ChatGPT, Cursor, etc.). Cut context costs from dollars to fractions of a cent.
|
|
12
|
+
|
|
13
|
+
**🤖 As a full AI coding assistant** — Hook up Ollama (free, local), Claude, or OpenAI, and ask questions, refactor code, debug issues, or explore architecture through `ctx ask` or `ctx chat` — just like ChatGPT or Claude Code, but with built-in codebase awareness.
|
|
4
14
|
|
|
5
15
|
```bash
|
|
6
16
|
pip install ctxgraph
|
|
7
17
|
|
|
8
18
|
ctx init # Scaffold .ctxgraph with config + default skills
|
|
9
19
|
ctx build # Build knowledge graph (AST analysis → SQLite)
|
|
10
|
-
ctx ask "how does JWT auth work" # Ask questions with automatic token savings
|
|
11
|
-
ctx capsule "fix JWT expiry" # 92-99% fewer tokens vs raw code
|
|
20
|
+
ctx ask "how does JWT auth work" # Ask questions with automatic token savings (needs LLM)
|
|
21
|
+
ctx capsule "fix JWT expiry" # 92-99% fewer tokens vs raw code (no LLM needed)
|
|
12
22
|
ctx chat "refactor this module" # Multi-turn conversation with persistent sessions
|
|
13
23
|
ctx history --stats # Track total tokens saved across all queries
|
|
14
24
|
ccg "fix the login redirect bug" # Launch Claude with context pre-loaded
|
|
@@ -28,11 +38,14 @@ ctx init # Creates .ctxgraph/config.toml + default ski
|
|
|
28
38
|
# 2. Build the knowledge graph
|
|
29
39
|
ctx build # AST analysis → SQLite graph
|
|
30
40
|
|
|
31
|
-
#
|
|
41
|
+
# 3a. Ask questions (requires Ollama or other LLM provider — free with Ollama)
|
|
32
42
|
ctx ask "how does authentication work"
|
|
33
43
|
|
|
34
|
-
#
|
|
44
|
+
# 3b. Or just generate a capsule for your AI tool (no LLM needed)
|
|
35
45
|
ctx capsule "fix login rate limiter" --savings
|
|
46
|
+
|
|
47
|
+
# 4. Explore interactively
|
|
48
|
+
ctx chat # Multi-turn REPL with persistent sessions
|
|
36
49
|
```
|
|
37
50
|
|
|
38
51
|
---
|
|
@@ -41,6 +54,8 @@ ctx capsule "fix login rate limiter" --savings
|
|
|
41
54
|
|
|
42
55
|
Sending entire files to an AI is wasteful. ctxgraph analyzes your code with AST-based static analysis, stores the result in a queryable SQLite graph, and retrieves *only the relevant nodes* — compressed into a token-efficient DSL format.
|
|
43
56
|
|
|
57
|
+
**No LLM? No problem.** ctxgraph's core features (graph building, capsule generation, search, visualization) work entirely offline. You only need an LLM provider when you want to ask questions via `ctx ask` or chat via `ctx chat`.
|
|
58
|
+
|
|
44
59
|
| Without ctxgraph | With ctxgraph | Savings |
|
|
45
60
|
|:---|---:|:---:|
|
|
46
61
|
| All files dumped to context | Targeted capsule (10-40 nodes) | **97% fewer tokens** |
|
|
@@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "ctxgraph"
|
|
7
|
-
version = "0.
|
|
8
|
-
description = "97% cheaper AI coding.
|
|
7
|
+
version = "0.5.0"
|
|
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"}
|
|
11
11
|
requires-python = ">=3.10"
|
|
@@ -151,11 +151,11 @@ class Settings:
|
|
|
151
151
|
|
|
152
152
|
@property
|
|
153
153
|
def temperature(self) -> float:
|
|
154
|
-
return self._data["ai"].get("temperature", 0.1)
|
|
154
|
+
return float(self._data["ai"].get("temperature", 0.1))
|
|
155
155
|
|
|
156
156
|
@property
|
|
157
157
|
def max_tokens(self) -> int:
|
|
158
|
-
return self._data["ai"].get("max_tokens", 4096)
|
|
158
|
+
return int(self._data["ai"].get("max_tokens", 4096))
|
|
159
159
|
|
|
160
160
|
@property
|
|
161
161
|
def exclude_patterns(self) -> list[str]:
|
|
@@ -167,11 +167,11 @@ class Settings:
|
|
|
167
167
|
|
|
168
168
|
@property
|
|
169
169
|
def max_nodes(self) -> int:
|
|
170
|
-
return self._data["context"].get("max_nodes", 20)
|
|
170
|
+
return int(self._data["context"].get("max_nodes", 20))
|
|
171
171
|
|
|
172
172
|
@property
|
|
173
173
|
def max_depth(self) -> int:
|
|
174
|
-
return self._data["context"].get("max_depth", 2)
|
|
174
|
+
return int(self._data["context"].get("max_depth", 2))
|
|
175
175
|
|
|
176
176
|
@property
|
|
177
177
|
def azure_deployment(self) -> str:
|
|
@@ -184,7 +184,7 @@ class Settings:
|
|
|
184
184
|
|
|
185
185
|
@property
|
|
186
186
|
def chat_max_session_tokens(self) -> int:
|
|
187
|
-
return self._data["chat"].get("max_session_tokens", 200000)
|
|
187
|
+
return int(self._data["chat"].get("max_session_tokens", 200000))
|
|
188
188
|
|
|
189
189
|
def get_provider_config(self) -> dict:
|
|
190
190
|
return PROVIDER_CONFIGS.get(self.provider, PROVIDER_CONFIGS["custom"])
|
|
@@ -218,11 +218,28 @@ class Settings:
|
|
|
218
218
|
key, _, value = line.partition("=")
|
|
219
219
|
key = key.strip()
|
|
220
220
|
value = value.strip()
|
|
221
|
-
|
|
221
|
+
|
|
222
|
+
if (value.startswith('"') and value.endswith('"')) or \
|
|
223
|
+
(value.startswith("'") and value.endswith("'")):
|
|
224
|
+
value = value[1:-1]
|
|
225
|
+
else:
|
|
226
|
+
value = Settings._parse_toml_value(value)
|
|
227
|
+
|
|
222
228
|
current_section[key] = value
|
|
223
229
|
|
|
224
230
|
return result
|
|
225
231
|
|
|
232
|
+
@staticmethod
|
|
233
|
+
def _parse_toml_value(value: str):
|
|
234
|
+
if value.lower() in ("true", "false"):
|
|
235
|
+
return value.lower() == "true"
|
|
236
|
+
try:
|
|
237
|
+
if "." in value:
|
|
238
|
+
return float(value)
|
|
239
|
+
return int(value)
|
|
240
|
+
except ValueError:
|
|
241
|
+
return value
|
|
242
|
+
|
|
226
243
|
@staticmethod
|
|
227
244
|
def _deep_merge(base: dict, override: dict):
|
|
228
245
|
for key, value in override.items():
|
|
@@ -44,11 +44,18 @@ from ctxgraph.graph.builder import get_storage
|
|
|
44
44
|
from ctxgraph.graph.query import search_relevant_nodes
|
|
45
45
|
|
|
46
46
|
|
|
47
|
+
def _find_repo_root(start: Path) -> Path:
|
|
48
|
+
for parent in [start] + list(start.parents):
|
|
49
|
+
if (parent / ".ctxgraph").is_dir():
|
|
50
|
+
return parent
|
|
51
|
+
return start
|
|
52
|
+
|
|
53
|
+
|
|
47
54
|
def create_server(repo_path: Optional[str] = None) -> Optional[Any]:
|
|
48
55
|
if not HAS_MCP:
|
|
49
56
|
return None
|
|
50
57
|
|
|
51
|
-
path = Path(repo_path).resolve() if repo_path else Path.cwd()
|
|
58
|
+
path = Path(repo_path).resolve() if repo_path else _find_repo_root(Path.cwd())
|
|
52
59
|
storage = get_storage(path)
|
|
53
60
|
|
|
54
61
|
server = Server("ctxgraph")
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ctxgraph
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: 97% cheaper AI coding.
|
|
3
|
+
Version: 0.5.0
|
|
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
|
|
7
7
|
Keywords: code-graph,knowledge-graph,claude,code-analysis,ai-context,token-savings,ollama,openai,ctx,capsule
|
|
@@ -29,15 +29,25 @@ Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
|
29
29
|
|
|
30
30
|
# ctxgraph — AI Context Engine for Python
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
## What is ctxgraph?
|
|
33
|
+
|
|
34
|
+
ctxgraph is a **knowledge graph engine** that makes AI coding assistants **97% cheaper** and **smarter**.
|
|
35
|
+
|
|
36
|
+
It analyzes your Python codebase using AST-based static analysis, builds a searchable dependency graph, and delivers *only the code that matters* to your AI — not every line in your project.
|
|
37
|
+
|
|
38
|
+
### Two ways to use it:
|
|
39
|
+
|
|
40
|
+
**🔧 As a token-saving context engine** — Output compact DSL capsules for any AI tool (Claude, ChatGPT, Cursor, etc.). Cut context costs from dollars to fractions of a cent.
|
|
41
|
+
|
|
42
|
+
**🤖 As a full AI coding assistant** — Hook up Ollama (free, local), Claude, or OpenAI, and ask questions, refactor code, debug issues, or explore architecture through `ctx ask` or `ctx chat` — just like ChatGPT or Claude Code, but with built-in codebase awareness.
|
|
33
43
|
|
|
34
44
|
```bash
|
|
35
45
|
pip install ctxgraph
|
|
36
46
|
|
|
37
47
|
ctx init # Scaffold .ctxgraph with config + default skills
|
|
38
48
|
ctx build # Build knowledge graph (AST analysis → SQLite)
|
|
39
|
-
ctx ask "how does JWT auth work" # Ask questions with automatic token savings
|
|
40
|
-
ctx capsule "fix JWT expiry" # 92-99% fewer tokens vs raw code
|
|
49
|
+
ctx ask "how does JWT auth work" # Ask questions with automatic token savings (needs LLM)
|
|
50
|
+
ctx capsule "fix JWT expiry" # 92-99% fewer tokens vs raw code (no LLM needed)
|
|
41
51
|
ctx chat "refactor this module" # Multi-turn conversation with persistent sessions
|
|
42
52
|
ctx history --stats # Track total tokens saved across all queries
|
|
43
53
|
ccg "fix the login redirect bug" # Launch Claude with context pre-loaded
|
|
@@ -57,11 +67,14 @@ ctx init # Creates .ctxgraph/config.toml + default ski
|
|
|
57
67
|
# 2. Build the knowledge graph
|
|
58
68
|
ctx build # AST analysis → SQLite graph
|
|
59
69
|
|
|
60
|
-
#
|
|
70
|
+
# 3a. Ask questions (requires Ollama or other LLM provider — free with Ollama)
|
|
61
71
|
ctx ask "how does authentication work"
|
|
62
72
|
|
|
63
|
-
#
|
|
73
|
+
# 3b. Or just generate a capsule for your AI tool (no LLM needed)
|
|
64
74
|
ctx capsule "fix login rate limiter" --savings
|
|
75
|
+
|
|
76
|
+
# 4. Explore interactively
|
|
77
|
+
ctx chat # Multi-turn REPL with persistent sessions
|
|
65
78
|
```
|
|
66
79
|
|
|
67
80
|
---
|
|
@@ -70,6 +83,8 @@ ctx capsule "fix login rate limiter" --savings
|
|
|
70
83
|
|
|
71
84
|
Sending entire files to an AI is wasteful. ctxgraph analyzes your code with AST-based static analysis, stores the result in a queryable SQLite graph, and retrieves *only the relevant nodes* — compressed into a token-efficient DSL format.
|
|
72
85
|
|
|
86
|
+
**No LLM? No problem.** ctxgraph's core features (graph building, capsule generation, search, visualization) work entirely offline. You only need an LLM provider when you want to ask questions via `ctx ask` or chat via `ctx chat`.
|
|
87
|
+
|
|
73
88
|
| Without ctxgraph | With ctxgraph | Savings |
|
|
74
89
|
|:---|---:|:---:|
|
|
75
90
|
| All files dumped to context | Targeted capsule (10-40 nodes) | **97% fewer tokens** |
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|