Use graph
opensip graph builds a static call graph and runs graph rules over it. Use it when the question is about reachability, dead code, duplicated bodies, cycles, blast radius, or surprising coupling.
1. Confirm graph sees the right files
Start with discovery only:
opensip graph --list-files
This is cheap: it asks the language adapter what it would analyze and exits before building a catalog.
For machine-readable output:
opensip graph --list-files --json
If the list is empty, check language markers and scope. You can force an adapter:
opensip graph --language typescript --list-files
opensip graph --language python --list-files
2. Run graph
opensip graph
For agent edit loops, analyze change blast radius without a full rule run:
opensip graph impact --changed --json --top 20
opensip graph --recipe agent-risk --json --filter high-impact
See Use OpenSIP with AI agents.
The default output is compact. Use verbose mode when you want details in the terminal:
opensip graph --verbose
The run creates a session and writes report data to the project runtime store. Open the report with:
opensip report
3. Scope the run
For a subtree:
opensip graph packages/api
For multiple subtrees:
opensip graph packages/api packages/web
For workspace fan-out:
opensip graph --workspace
opensip graph --workspace --concurrency 4
Use --workspace for large monorepos when each workspace unit can be analyzed independently. It runs memory-isolated child processes and aggregates the result into one session.
4. Inspect the catalog
After a graph run, look up function occurrences by name:
opensip graph lookup saveBaseline
opensip graph lookup saveBaseline --json
Emit an editor-friendly symbol index:
opensip graph index --out symbolindex.json
opensip graph index --build --out symbolindex.json
Both commands read the persisted catalog by default. Use --build on graph index
to refresh the catalog first, or run opensip graph before querying.
5. Gate on new graph findings
Save the current graph findings as the baseline:
opensip graph --gate-save
Then fail only when a future run introduces new findings:
opensip graph --gate-compare
For GitHub Code Scanning or any SARIF consumer:
opensip graph --gate-compare --sarif graph.sarif
6. Use recipes when you need a subset
List graph recipes:
opensip graph recipes
Run one:
opensip graph --recipe <name>
No --recipe means the default graph rule set.
What to remember
graph --list-filesanswers "what will graph analyze?" without building.graph --workspaceis the large-monorepo path.graph --gate-saveandgraph --gate-compareuse the same baseline model asfit.graphdoes not have an--openflag; runopensip reportafter the graph run to open the HTML report.
Where to go next
| You want to ... | Go to |
|---|---|
| Understand the pipeline | Stages and catalog |
| Understand rules and baselines | Rules and gating |
| Add a graph language adapter | Adding a language |
| Look up every graph flag | CLI commands |