Explore — Internal Codebase Exploration
Overview
READ-ONLY exploration at three depths. Never modifies code.
Depths
| Depth | Time | What It Does |
|---|---|---|
| Quick | ~1 min | File tree + code structure overview |
| Deep | ~5 min | Comprehensive analysis + pattern documentation |
| Architecture | ~3 min | Layer detection + call graph + dependency mapping |
Quick Exploration
Fast orientation. Use when you need to know what's where.
- •File structure —
Globfor project layout - •Code structure —
Grepfor key patterns (main, init, handlers, routes) - •Focused search — if looking for something specific,
Grepfor keywords
Deep Exploration
Thorough understanding. Use before major work or in unfamiliar code.
- •Map structure — file tree, key modules, entry points
- •Read key files — main entry, config, core types/interfaces
- •Trace patterns — how data flows, how errors are handled, how tests are organized
- •Document findings — write to
docs/or summarize for the user
Architecture Exploration
System boundaries and dependencies. Use before refactoring or design work.
- •
Identify layers:
- •Entry — handlers, CLI commands, main
- •Middle — services, business logic
- •Leaf — utilities, helpers, data access
- •
Map call graph — what calls what across files
- •
Detect issues:
- •Circular dependencies
- •Overly coupled modules
- •Missing abstractions
- •
Output structure:
yaml
layers: entry: [cmd/main.go, internal/api/router.go] middle: [internal/service/, internal/domain/] leaf: [internal/util/, pkg/] call_graph: hot_paths: [request → validate → authorize → execute] circular_deps: []
Choosing Depth
| Situation | Depth |
|---|---|
| "Where is X?" | Quick |
| "How does X work?" | Deep |
| "How is the system organized?" | Architecture |
| Starting new feature | Deep (focused on relevant area) |
| Preparing for refactor | Architecture |
Key Principles
- •READ-ONLY — never modify code during exploration
- •Use primitives — Grep, Glob, Read are your tools
- •Token-efficient — don't read entire files; scan structure first, then targeted reads
- •Output to shared locations —
docs/for documentation, inline for quick answers