| name | update-file-map |
| description | Updates the file map in .agent/file-map.md to reflect current codebase structure. Maps only actual functional code (excluding tests and config) with brief descriptions and exported symbols. Use after implementing features or refactoring code. |
Update File Map
Maintain an accurate, minimal file map documenting the codebase structure.
Purpose
The file map provides agents with a concise guide to existing code. It must be:
- Current: Reflect actual files only, never planned/imagined ones
- Minimal: Keep token count low as it loads on every request
- Functional: Cover only production code, exclude tests and config
- Complete: List every exported symbol per file
Workflow
1. Scan Codebase
- Use Glob and Read tools to discover project code files
- Focus on functional/production code only
- Exclude:
- Test files and test directories
- Configuration files (tsconfig, eslint, package.json, etc.)
- Build artifacts and dependencies
- Documentation and meta files
- Hidden directories and common tooling folders
2. Extract Information
For each file, identify:
- Purpose: One-line description of what it contains
- Exports: Every class, function, constant, type, interface, or component that could be imported/used externally
- Use bullet list format for exports
3. Organize Alphabetically
- Sort all file paths alphabetically
- This allows agents to estimate location when reading partial maps
- Group naturally by directory due to path sorting
4. Write Minimal Entries
Format per file:
- `path/to/file.ext` - [Brief purpose]
- [Export 1]
- [Export 2]
Keep descriptions concise - single phrase, not full sentences.
5. Update .agent/file-map.md
- Replace content under "## Functional Code" heading
- Preserve file header and intro text
- Ensure alphabetical ordering
- Remove entries for deleted files
- Add entries for new files
Key Rules
- Only document files that exist NOW
- Never include planned or future files
- Exclude all test code
- Exclude configuration files
- Keep descriptions minimal (context window cost matters)
- List ALL exports, even if numerous
- Maintain strict alphabetical sorting
- If unsure whether something is exported, include it