import-graph
Skill100 starsChanged 6 months agoMITView on GitHub
Static import analysis that builds dependency graphs, domain clusters, hub files, git churn hotspots, and file priority rankings
1 other project uses a version of this.
Adopted by
Most recently taken up by
- TheophilusChinomona/idevtheir own version, first seen Jun 12, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- TheophilusChinomona/idev★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository27 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- agent-customizationSkill
- architectureSkill
- baseSkill
- claude-runnerSkill
- cli-shellSkill
- codex-supportSkill
- doc-impactSkill
- doc-syncSkill
- import-graphSkill
- repo-scanningSkill
- save-tokensSkill
- skill-generationSkill
- template-librarySkill
- agent-customizationSkill
- baseSkill
- claude-runnerSkill
- cli-shellSkill
- codex-supportSkill
- doc-impactSkill
- doc-syncSkill
- repo-scanningSkill
- save-tokensSkill
- skill-generationSkill
- template-librarySkill
The file
Files
You are working on the import graph system — static analysis that parses JS/TS and Python source files to produce dependency graphs, plus persistence/query layers for runtime use.
Domain purpose
The graph turns raw source into a queryable map of "what depends on what" so other aspens features (doc-init, doc-sync, doc-impact, the graph context hook) can rank files by importance, surface hubs, detect domain clusters, and inject just the relevant neighborhood into prompts. It is the substrate that makes context generation deterministic and code-aware rather than guess-based.
Key Concepts
graph-builder.js — buildRepoGraph(repoPath, languages?) runs a 9-step pipeline:
- Walk source files → 2. Parse imports → 3. Reverse edges → 4. Git churn → 5. Per-file metrics → 6. Priority ranking → 7. Hub detection → 8. Domain clustering → 9. Hotspots
graph-persistence.js — Persistence and query layer:
serializeGraph()converts raw graph to indexed format (O(1) lookups, file→cluster mapping)persistGraphArtifacts(repoPath, rawGraph, options?)writes.claude/graph.json+.claude/code-map.md+.claude/graph-index.json+ auto-gitignores them. Target-aware: ifoptions.target.supportsGraph === false, returns serialized data without writing files.extractSubgraph(graph, filePaths)returns 1-hop neighborhood of mentioned files + relevant hubs/hotspots/clustersformatNavigationContext(subgraph)renders compact markdown (~50 line budget) for prompt injectionextractFileReferences(prompt, graph)tiered extraction: explicit paths → bare filenames → cluster keywordsgenerateCodeMap()/writeCodeMap()standalone overview for graph hook consumption — emits a Domain clusters block (viaformatDomainClusters) and framework entry points only; cross-domain coupling, hotspots, and the totals/date footer are intentionally omitted because they churn on every syncformatDomainClusters(clusters, files)— exported helper that renders the canonical Domain clusters block: clusters are merged by label, single-file clusters dropped, files per cluster capped at 5 and sorted byfanIndesc then path asc for sync stability; no per-cluster(N files)countsgenerateGraphIndex()/saveGraphIndex()tiny inverted index (export names → files, hub basenames, cluster labels)
doc-graph.js — Target-aware: reads .aspens.json config, passes target to persistGraphArtifacts(). Shows different completion message for Codex target (artifacts not written).
Critical Rules
await initbefore anyparseJsImportscall. es-module-lexer requires WASM initialization.- Priority formula is load-bearing:
fanIn * 3.0 + exportCount * 1.5 + (isEntry ? 10.0 : 0) + churn * 2.0 + (1/(depth+1)) * 1.0. Downstream consumers depend on this ranking. - All paths are repo-relative strings, never absolute. Resolution functions convert abs→relative.
- Graph artifacts are gitignored —
ensureGraphGitignore()(internal to persistence) adds.claude/graph.json,.claude/graph-index.json,.claude/code-map.mdto prevent commit loops. - Graph artifacts are Claude-only — when target has
supportsGraph: false,persistGraphArtifactsreturns serialized data for embedding (e.g., condensed code-map in root AGENTS.md) but writes no files. - Errors are swallowed, not thrown in graph-builder — parse failures return empty/null. The graph must always complete.
extractSubgraphlogic is mirrored ingraph-context-prompt.mjs(buildNeighborhood()). Keep both in sync.- doc-sync rebuilds graph on every sync — calls
buildRepoGraph+persistGraphArtifacts(with target) to keep it fresh. - Code-map output is sync-stable — no totals, no dates, no hotspot churn counts, no
+N moresuffixes. Anything that varies between syncs without a real code change must stay out of generated context.
References
- Hook mirror:
src/templates/hooks/graph-context-prompt.mjs
Last Updated: 2026-05-11
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

