AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Import Graph

skill-aspenkit-aspens-import-graph · by aspenkit

Static import analysis that builds dependency graphs, domain clusters, hub files, git churn hotspots, and file priority rankings

No reviews yet
0 installs
41 views
0.0% view→install

Install

$ agentstack add skill-aspenkit-aspens-import-graph

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-aspenkit-aspens-import-graph)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
4mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Import Graph? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

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.jsbuildRepoGraph(repoPath, languages?) runs a 9-step pipeline:

  1. 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: if options.target.supportsGraph === false, returns serialized data without writing files.
  • extractSubgraph(graph, filePaths) returns 1-hop neighborhood of mentioned files + relevant hubs/hotspots/clusters
  • formatNavigationContext(subgraph) renders compact markdown (~50 line budget) for prompt injection
  • extractFileReferences(prompt, graph) tiered extraction: explicit paths → bare filenames → cluster keywords
  • generateCodeMap() / writeCodeMap() standalone overview for graph hook consumption — emits a Domain clusters block (via formatDomainClusters) and framework entry points only; cross-domain coupling, hotspots, and the totals/date footer are intentionally omitted because they churn on every sync
  • formatDomainClusters(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 by fanIn desc then path asc for sync stability; no per-cluster (N files) counts
  • generateGraphIndex() / 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 init before any parseJsImports call. 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 gitignoredensureGraphGitignore() (internal to persistence) adds .claude/graph.json, .claude/graph-index.json, .claude/code-map.md to prevent commit loops.
  • Graph artifacts are Claude-only — when target has supportsGraph: false, persistGraphArtifacts returns 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.
  • extractSubgraph logic is mirrored in graph-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 more suffixes. 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

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.