Code Graph Reference
All graph commands and options. Read more
You’re working in a codebase you didn’t write. Maybe you just joined the team, or you’re fixing a bug in a service you’ve never touched. You need to understand how things connect before you start changing them.
Unfault’s code graph helps with this.
Before changing a file, see what else depends on it:
unfault graph impact src/api/auth.pyOutput:
Impact analysis for src/api/auth.py:
Direct dependents (3): → api/routes/users.py (imports validate_token) → api/routes/admin.py (imports validate_token, get_permissions) → tests/test_auth.py (imports validate_token)
Transitive impact (7 files total)This tells you the blast radius. If you change validate_token, those three files are directly affected. Seven files total might see different behavior.
For more precision, check a specific function:
unfault graph function-impact src/api/auth.py:validate_tokenThis shows only what depends on that function, not everything in the file.
When you’re new to a codebase, start with the most connected files:
unfault graph criticalOutput:
Most critical files (by dependents):
1. src/core/models.py (47 dependents) 2. src/utils/helpers.py (31 dependents) 3. src/api/auth.py (23 dependents) 4. src/db/connection.py (19 dependents) 5. src/config/settings.py (18 dependents)These are the files where changes have the most impact. They’re also often the best starting point for understanding how the system fits together.
To see what external libraries or internal modules a file uses:
unfault graph deps src/api/client.pyOutput:
Dependencies for src/api/client.py:
External: · requests · tenacity · structlog
Internal: · src/config/settings.py · src/utils/retry.pyThis tells you what you need to understand to work on this file.
To see everywhere a library is used:
unfault graph library requestsOutput:
Files using 'requests':
· src/api/client.py:12 · src/integrations/billing.py:8 · src/integrations/notifications.py:15 · scripts/health_check.py:3Useful when you’re updating a dependency or changing how it’s used across the codebase.
For higher-level understanding, ask questions in natural language:
unfault ask "How do we handle authentication?"unfault ask "What's the pattern for database transactions?"unfault ask "Where do HTTP timeouts get configured?"This searches past reviews and code patterns to surface relevant context.
A practical workflow for changing unfamiliar code:
Check impact first
unfault graph impact path/to/file.pyUnderstand what the file depends on
unfault graph deps path/to/file.pyAsk about existing patterns
unfault ask "How is error handling done in this part of the codebase?"Make your changes
Review before committing
unfault review --uncommittedIf you’re using an AI assistant to modify unfamiliar code, add to your AGENTS.md:
Before modifying code in unfamiliar areas:
1. Run: unfault graph impact <file>2. If impact is large (>10 files), mention this before proceeding3. Run: unfault ask "How does [this area] work?"4. After changes, run: unfault review --uncommittedThis gives the agent context it wouldn’t otherwise have.