Specter Scan
Build or rebuild the knowledge graph for the current codebase.
When to Use
- First time using Specter on a project
- After major refactoring or adding many files
- When specter tools return stale or missing data
- Before asking the specter agent questions about the codebase
How to Run
Execute the specter scan command:
npx specter-mcp scan
Or with options:
# Skip git history analysis (faster)
npx specter-mcp scan --no-git
# Force rescan even if graph exists
npx specter-mcp scan --force
# Scan a specific directory
npx specter-mcp scan --dir ./packages/core
What It Does
- Parses all TypeScript/JavaScript files using AST analysis
- Extracts functions, classes, interfaces, types, and exports
- Maps import relationships between files
- Calculates cyclomatic complexity for each function
- Analyzes git history for modification patterns (unless --no-git)
- Saves the knowledge graph to
.specter/graph.json
Output
After scanning, you'll see:
- File count and total lines
- Symbol count (functions, classes, etc.)
- Relationship count (imports)
- Complexity metrics
- Language breakdown
The .specter/ directory will contain:
graph.json— The full knowledge graphmetadata.json— Quick-access scan statistics
Performance
- ~1000 files per minute on typical hardware
- Git history adds ~30% scan time
- Use
--no-gitfor faster iteration during development
Notes
- Only TypeScript and JavaScript files are analyzed
node_modules,dist, andbuilddirectories are excluded- Test files (
*.test.ts,*.spec.ts) are excluded - The
.specter/directory is automatically added to.gitignore
Converted and distributed by TomeVault — claim your Tome and manage your conversions.