Graphify knowledge graphs for AI-assisted development¶
ConnectSoft uses Graphify (PyPI package graphifyy) to turn repository source — code, project files, and selected docs — into a persistent, queryable knowledge graph that AI coding assistants (Cursor, Claude Code, Codex, and others) can traverse instead of re-reading raw files on every question.
The first pilot repository is ConnectSoft.Extensions. The same pattern applies to other ConnectSoft.* libraries and service templates.
Why Graphify in ConnectSoft?
Large ConnectSoft workspaces span dozens of NuGet libraries and templates. Asking an assistant to "understand the repo" by grepping and opening files is slow, expensive, and does not scale. Graphify builds a structural map once, stores it under graphify-out/, and answers focused questions with graphify query, graphify path, and graphify explain — typically far fewer tokens than naive file reads.
What Graphify produces¶
After a successful build, each repo contains:
| Output | Purpose | Commit to git? |
|---|---|---|
graphify-out/graph.json |
Queryable graph (nodes, edges, communities) | Yes — team shares one map |
graphify-out/GRAPH_REPORT.md |
God nodes, communities, suggested questions | Yes |
graphify-out/graph.html |
Interactive browser visualization | Yes (optional --no-viz to skip) |
graphify-out/manifest.json |
Local mtime metadata | No — machine-specific |
graphify-out/cost.json |
Local cost tracking | No |
graphify-out/cache/ |
Incremental AST / semantic cache | No (optional to commit for speed) |
Architecture in ConnectSoft¶
flowchart LR
subgraph repo [Repository e.g. ConnectSoft.Extensions]
CS[C# / csproj / sln]
MD[README and docs]
GI[.graphifyignore]
end
subgraph graphify [Graphify CLI graphifyy]
AST[Tree-sitter AST extract]
SEM[Optional semantic LLM extract]
BUILD[NetworkX graph + Leiden clusters]
end
subgraph out [graphify-out]
JSON[graph.json]
RPT[GRAPH_REPORT.md]
HTML[graph.html]
end
subgraph assistants [AI assistants]
CUR[Cursor rule + skill]
Q[graphify query / path / explain]
end
CS --> AST
MD --> SEM
GI --> AST
AST --> BUILD
SEM --> BUILD
BUILD --> JSON
BUILD --> RPT
BUILD --> HTML
JSON --> Q
CUR --> Q
Two extraction modes¶
| Mode | Command | API key | When to use |
|---|---|---|---|
| AST / code-only | python -m graphify update . |
Not required | Day-to-day C# changes, .csproj, solution layout, README sections parsed structurally |
| Full semantic | python -m graphify extract . --backend <name> |
Required (or local Ollama) | Rich doc semantics, images, papers, cross-file inferred relationships |
PowerShell: graphify . is not the same as graphify update .
On the CLI, python -m graphify . is treated as graphify extract . and requires --backend (or a configured API key environment variable). For ConnectSoft library repos without a semantic backend, use python -m graphify update . for builds and refreshes.
Pilot: ConnectSoft.Extensions¶
Repository: ConnectSoft.Extensions
ConnectSoft.Extensions is a foundational Layer-1 NuGet library (extension methods, domain exception base types, shared utilities). It is a good pilot because the codebase is small but representative: solution layout, multi-target net8.0 / net9.0 / net10.0, unit tests, and README-driven install docs.
Example graph facts (AST-only build):
DomainModelException→ inheritsException(extracted fromDomainModelException.cs)- Solution folders link
ConnectSoft.Extensions.csprojandConnectSoft.Extensions.UnitTests.csproj DomainModelExceptionUnitTestsappears as a high-degree test hub
Query from the repo root:
python -m graphify explain "DomainModelException"
python -m graphify query "DomainModelException and unit tests"
Open graphify-out/graph.html in a browser to explore communities visually.
Prerequisites¶
| Requirement | Notes |
|---|---|
| Python 3.10+ | python --version |
graphifyy on PATH |
pip install graphifyy or uv tool install graphifyy |
| Git working tree | Graph reports record commit SHA for freshness checks |
Official package name is graphifyy (double y). The CLI command remains graphify.
Per-repository setup (ConnectSoft standard)¶
Run once from the repository root (not the monorepo workspace root unless that repo is the root).
1. Install Graphify and project-scoped Cursor integration¶
pip install graphifyy
cd D:\Git\ConnectSoft\ConnectSoft.Extensions # example path
python -m graphify install --project
python -m graphify cursor install --project
This writes (commit these):
| Path | Role |
|---|---|
.cursor/rules/graphify.mdc |
Always-on Cursor rule: query graph before grepping |
.cursor/skills/graphify/SKILL.md |
/graphify skill for rebuild workflows |
.claude/skills/graphify/SKILL.md |
Same skill for Claude Code (Windows install) |
CLAUDE.md |
Query-first guidance for Claude Code |
2. Configure .gitignore¶
Append Graphify team defaults (keep graph.json, GRAPH_REPORT.md, graph.html tracked):
### Graphify (https://graphify.net/) ###
graphify-out/manifest.json
graphify-out/cost.json
graphify-out/cache/
3. Configure .graphifyignore¶
Exclude build artifacts and Graphify meta-files so the graph reflects product source, not integration scaffolding:
graphify-out/
.cursor/skills/graphify/
.claude/skills/graphify/
CLAUDE.md
.claude/
**/bin/
**/obj/
.vs/
TestResults/
**/packages/
Adjust per repo (for example add node_modules/ for front-end templates).
4. Build the initial graph (no API key)¶
Verify:
5. Optional: semantic enrichment¶
When you need deeper doc/image semantics:
# Local Ollama (requires running Ollama + pip install openai)
python -m graphify extract . --backend ollama
# Cloud backends (set env var first)
$env:OPENAI_API_KEY = "..."
python -m graphify extract . --backend openai
Supported backends include gemini, claude, openai, deepseek, kimi, ollama, and bedrock.
6. Optional: auto-rebuild on commit¶
Hooks rebuild code AST after commits and register a merge driver for graph.json when multiple branches update the graph.
Daily workflow in Cursor¶
- Pull latest
graphify-out/from git (shared team map). - Ask architecture questions — the
.cursor/rules/graphify.mdcrule steers the agent tographify querywhengraphify-out/graph.jsonexists. - After editing
.csfiles, run:
- Commit updated
graphify-out/graph.json,GRAPH_REPORT.md, and optionallygraph.htmlwith your code change (or in a follow-up commit).
Prefer query over full report
Use graphify query "...", graphify path "A" "B", or graphify explain "Symbol" for focused context. Read GRAPH_REPORT.md only for broad architecture review.
Team git workflow¶
- One developer runs
graphify update .(or fullextract) and commitsgraphify-out/(except ignored cache/manifest/cost). - Everyone else pulls — assistants read the graph immediately.
- On stale graphs, compare
GRAPH_REPORT.mdcommit SHA withgit rev-parse HEAD. - Re-run
graphify update .after code merges.
Rollout to other ConnectSoft repositories¶
Recommended order:
ConnectSoft.Extensions.*libraries (same layout as the pilot).- Service templates (
ConnectSoft.MicroserviceTemplate,ConnectSoft.BaseTemplate, etc.) — extend.graphifyignorefor templatebin//obj/and generatedbase-template/noise as needed. - Documentation repos — Graphify complements Documentation as Code; semantic
extractadds value for long-form Markdown corpora.
For each repo, repeat: install --project, cursor install --project, .gitignore, .graphifyignore, initial update ., commit integration files + graphify-out/.
Security and privacy¶
- Code AST extraction runs locally via Tree-sitter — no network call.
- Semantic extraction sends document descriptions to the configured backend, not raw secret files. Do not index
.env, keys, orsecrets/— add them to.graphifyignore. - Graphify validates URLs and output paths; prefer official
graphifyyon PyPI only.
Troubleshooting¶
| Symptom | Fix |
|---|---|
error: no LLM API key found when running graphify . |
Use graphify update . for code-only, or pass --backend ollama / set an API key for extract |
God nodes are /graphify skill text |
Add .cursor/skills/graphify/ and .claude/skills/graphify/ to .graphifyignore, delete graphify-out/, rebuild with update . |
| Graph seems stale | Run graphify update .; check commit line in GRAPH_REPORT.md |
graphify: command not found |
Use python -m graphify or install via uv tool install graphifyy |
See also¶
- ConnectSoft.Extensions package catalog — NuGet inventory including
ConnectSoft.Extensions - ConnectSoft.Extensions.Testing — shared test utilities in the same ecosystem
- Knowledge Management — documentation and diagram practices
- Documentation as Code — MkDocs and repo handbooks
- Graphify project site — upstream docs, security notes, and command reference