Skip to content

code_map

code_map renders an ASCII diagram showing how modules and files depend on each other. Use it to visualize the architecture of a project or a specific subdirectory.

code_map()
code_map(path="src/api", depth=2)
ParameterTypeDefaultDescription
pathstringLimit diagram to a specific module or directory
depthnumber2Levels of dependency nesting to show (1–3)
src/
├── api/
│ ├── controllers/ ──→ services/
│ └── middleware/ ──→ services/auth
├── services/
│ ├── AuthService ──→ db/, cache/
│ ├── OrderService ──→ PaymentService, InventoryService
│ └── UserService ──→ db/
└── db/
└── client ──→ (postgres)
  • Understand the layered architecture of an unfamiliar project
  • Identify circular dependencies or unexpected cross-module imports
  • Document the system for a new team member
  • Plan a refactor that needs to respect module boundaries