Generated by: PROP-EXT-OM-03-CODING-STANDARDS
Update Codemaps
Analyze the codebase structure and generate token-lean architecture documentation.
Step 1: Scan Project Structure
- Identify the project type (monorepo, single app, library, microservice)
- Find all source directories (src/, lib/, app/, packages/)
- Map entry points (main.ts, index.ts, app.py, main.go, etc.)
Step 2: Generate Codemaps
Create or update codemaps in docs/CODEMAPS/ (or .reports/codemaps/):
| File |
Contents |
architecture.md |
High-level system diagram, service boundaries, data flow |
backend.md |
API routes, middleware chain, service → repository mapping |
frontend.md |
Page tree, component hierarchy, state management flow |
data.md |
Database tables, relationships, migration history |
dependencies.md |
External services, third-party integrations, shared libraries |
Codemap Format
Each codemap should be token-lean — optimized for AI context consumption:
# Backend Architecture
## Routes
POST /api/users → UserController.create → UserService.create → UserRepo.insert
GET /api/users/:id → UserController.get → UserService.findById → UserRepo.findById
## Key Files
src/services/user.ts (business logic, 120 lines)
src/repos/user.ts (database access, 80 lines)
## Dependencies
- PostgreSQL (primary data store)
- Redis (session cache, rate limiting)
- Stripe (payment processing)
Step 3: Diff Detection
- If previous codemaps exist, calculate the diff percentage
- If changes > 30%, show the diff and request user approval before overwriting
- If changes <= 30%, update in place
Step 4: Add Metadata
Add a freshness header to each codemap:
<!-- Generated: 2026-02-11 | Files scanned: 142 | Token estimate: ~800 -->
Step 5: Save Analysis Report
Write a summary to .reports/codemap-diff.txt:
- Files added/removed/modified since last scan
- New dependencies detected
- Architecture changes (new routes, new services, etc.)
- Staleness warnings for docs not updated in 90+ days
Tips
- Focus on high-level structure, not implementation details
- Prefer file paths and function signatures over full code blocks
- Keep each codemap under 1000 tokens for efficient context loading
- Use ASCII diagrams for data flow instead of verbose descriptions
- Run after major feature additions or refactoring sessions
1---2name: codemap-sync3description: Analyzes codebase structure and generates token-lean architecture documentation in codemap files, with diff detection and metadata tracking.4---56# Generated by: PROP-EXT-OM-03-CODING-STANDARDS7---8# Update Codemaps910Analyze the codebase structure and generate token-lean architecture documentation.1112## Step 1: Scan Project Structure13141. Identify the project type (monorepo, single app, library, microservice)152. Find all source directories (src/, lib/, app/, packages/)163. Map entry points (main.ts, index.ts, app.py, main.go, etc.)1718## Step 2: Generate Codemaps1920Create or update codemaps in `docs/CODEMAPS/` (or `.reports/codemaps/`):2122| File | Contents |23|------|----------|24| `architecture.md` | High-level system diagram, service boundaries, data flow |25| `backend.md` | API routes, middleware chain, service → repository mapping |26| `frontend.md` | Page tree, component hierarchy, state management flow |27| `data.md` | Database tables, relationships, migration history |28| `dependencies.md` | External services, third-party integrations, shared libraries |2930### Codemap Format3132Each codemap should be token-lean — optimized for AI context consumption:3334```markdown35# Backend Architecture3637## Routes38POST /api/users → UserController.create → UserService.create → UserRepo.insert39GET /api/users/:id → UserController.get → UserService.findById → UserRepo.findById4041## Key Files42src/services/user.ts (business logic, 120 lines)43src/repos/user.ts (database access, 80 lines)4445## Dependencies46- PostgreSQL (primary data store)47- Redis (session cache, rate limiting)48- Stripe (payment processing)49```5051## Step 3: Diff Detection52531. If previous codemaps exist, calculate the diff percentage542. If changes > 30%, show the diff and request user approval before overwriting553. If changes <= 30%, update in place5657## Step 4: Add Metadata5859Add a freshness header to each codemap:6061```markdown62<!-- Generated: 2026-02-11 | Files scanned: 142 | Token estimate: ~800 -->63```6465## Step 5: Save Analysis Report6667Write a summary to `.reports/codemap-diff.txt`:68- Files added/removed/modified since last scan69- New dependencies detected70- Architecture changes (new routes, new services, etc.)71- Staleness warnings for docs not updated in 90+ days7273## Tips7475- Focus on **high-level structure**, not implementation details76- Prefer **file paths and function signatures** over full code blocks77- Keep each codemap under **1000 tokens** for efficient context loading78- Use ASCII diagrams for data flow instead of verbose descriptions79- Run after major feature additions or refactoring sessions