Code-Only vs Full Graph
Understanding the two graph modes and when to use each.
📊 Comparison
| Aspect | Code-Only (--code-only) | Full Graph (default) |
|---|
| API Key Required | ❌ No | ✅ Yes |
| Build Time | ~30-60 seconds | ~1-2 minutes |
| Graph Size | Smaller (~3-5 MB) | Larger (~10-50 MB) |
| Languages Indexed | 20+ via tree-sitter | Same + semantic docs |
| File Types | Source code only | Code + markdown + docs + PDFs + images |
| Query Depth | Code structure, calls, imports | + Semantic content, cross-references |
| Cost | Free (local only) | API credits per build |
🔍 What Each Indexes
Code-Only Mode
Indexes:
- ✅ Python, JavaScript, TypeScript, Go, Rust, Java, C++, and 15+ languages
- ✅ Functions, classes, methods, variables
- ✅ Imports, calls, contains relationships
- ✅ File structure and module hierarchy
- ❌ Markdown content (frontmatter only)
- ❌ Documentation prose
- ❌ PDF content
- ❌ Image analysis
Best for:
- Architecture questions about code
- Dependency tracing between code files
- Call chain analysis
- Module boundary identification
- Teams without API keys / budget
Full Graph Mode
1# Requires API key
2export GEMINI_API_KEY="your-key"
3graphify .
Indexes everything in code-only PLUS:
- ✅ Markdown content (headings, prose, code blocks)
- ✅ Documentation files (semantic understanding)
- ✅ YAML/JSON structure and values
- ✅ PDF text extraction (with
pypdf) - ✅ Image analysis (with vision model)
- ✅ Cross-references between docs and code
- ✅ Relref/shortcode resolution
Best for:
- Questions about documentation content
- “What does the X skill do?” queries
- Cross-referencing docs ↔ code
- Content-heavy projects
- Teams with API budget
🎯 When to Use Each
Use Code-Only When
- ✅ No API key / no budget for API calls
- ✅ Primary questions are about code architecture
- ✅ Fast iteration needed (rebuild in 30s)
- ✅ CI/CD integration (no secrets needed)
- ✅ Large codebase, limited API quota
Use Full Graph When
- ✅ Have API key (Gemini free tier: 60 req/min)
- ✅ Need to query documentation content
- ✅ Questions span code + docs
- ✅ Want semantic understanding of markdown
- ✅ Need cross-references (relrefs, shortcodes)
🔄 Switching Between Modes
From Code-Only to Full
1# 1. Set API key
2export GEMINI_API_KEY="your-key"
3
4# 2. Rebuild full graph
5mkdir -p graphify-out && touch graphify-out/.graphify-activity
6graphify update .
From Full to Code-Only
1# Just rebuild with flag
2mkdir -p graphify-out && touch graphify-out/.graphify-activity
3graphify update . --code-only
💰 Cost Considerations
API Costs (approximate)
| Provider | Free Tier | Paid Cost |
|---|
| Google Gemini | 60 req/min, 1M tokens/day free | $0.35/1M input tokens |
| OpenAI | $5 free credit | $2.50/1M input tokens (GPT-4o) |
| Anthropic | None | $3/1M input tokens (Claude 3.5 Sonnet) |
| DeepSeek | Generous free tier | $0.14/1M input tokens |
Graphify Build Cost
- Code-only: $0 (local only)
- Full graph: ~50-200 API calls per build
- Gemini free tier: ~3-10 builds/day free
- OpenAI: ~$0.01-0.05 per build
📈 This Project’s Graph
| Mode | Nodes | Edges | Size | Build Time |
|---|
| Code-only | 4,797 | 6,087 | 3.3 MB | ~45s |
| Full (est.) | ~15,000 | ~25,000 | ~15 MB | ~90s |
🎯 Recommendation
Start with code-only. It answers 80% of architecture questions instantly for free.
Upgrade to full when:
- You ask “what does the X skill do?” and code-only can’t answer
- You need to trace doc → code relationships
- You have API budget and want richer queries
1# Start here (free, fast)
2graphify . --code-only
3
4# Upgrade when needed
5export GEMINI_API_KEY="..."
6graphify update .
Next Steps