11# Ambient Code Reference Repository - Agent Configuration
22
3- ** Version** : 2.1 .0
4- ** Last Updated** : 2026-01-04
3+ ** Version** : 2.2 .0
4+ ** Last Updated** : 2026-01-15
55** Purpose** : Documentation-only reference for AI-assisted development patterns
66
77---
@@ -99,6 +99,81 @@ echo $VIRTUAL_ENV # Should show project path
9999uv pip install -r requirements-dev.txt
100100```
101101
102+ ### Repomap - Context Window Optimization
103+
104+ ** MANDATORY: Generate repomap at session start and use proactively throughout development.**
105+
106+ #### Session Start Protocol
107+
108+ ** ALWAYS run repomap as the first action** when starting any development session:
109+
110+ ``` bash
111+ # At session start (after activating venv)
112+ source .venv/bin/activate
113+ python repomap.py . > .repomap.txt
114+
115+ # Review the structure
116+ cat .repomap.txt
117+ ```
118+
119+ ** Purpose** : Provides token-optimized codebase context for AI-assisted development, reducing context window usage while maintaining code understanding.
120+
121+ #### Proactive Usage Throughout Development
122+
123+ ** Use repomap context in these scenarios** :
124+
125+ 1 . ** Planning implementations** - Review repomap before designing features
126+ 2 . ** Understanding dependencies** - Check which files/classes exist before creating new ones
127+ 3 . ** Code reviews** - Reference structure when reviewing changes
128+ 4 . ** Refactoring** - Understand impact scope across codebase
129+ 5 . ** Documentation** - Ensure docs reflect actual code structure
130+
131+ #### When to Regenerate
132+
133+ ** Regenerate repomap when** :
134+
135+ - Files are added or removed
136+ - Classes or functions are added/removed
137+ - Major refactoring is completed
138+ - Before creating PRs (ensure map is current)
139+
140+ ``` bash
141+ # Regenerate after changes
142+ python repomap.py . > .repomap.txt
143+ git add .repomap.txt # Include in commits
144+ ```
145+
146+ #### Integration with Development Workflow
147+
148+ ** Include repomap in commit tracking** :
149+
150+ ``` bash
151+ # Pre-commit: Update repomap
152+ python repomap.py . > .repomap.txt
153+ git add .repomap.txt
154+
155+ # Commit message references structure changes
156+ git commit -m " Add UserService class
157+
158+ Updated repomap to reflect new service layer structure"
159+ ```
160+
161+ ** Use in AI prompts** :
162+
163+ - Reference specific files/classes from repomap by name
164+ - Ask questions about structure (e.g., "Where should I add authentication logic?")
165+ - Validate assumptions (e.g., "Does a Config class already exist?")
166+
167+ #### Repomap Best Practices
168+
169+ - ✅ Generate at session start (always)
170+ - ✅ Regenerate after structural changes
171+ - ✅ Reference in planning and design discussions
172+ - ✅ Include in commit workflow
173+ - ✅ Use to avoid duplicate implementations
174+ - ❌ Don't rely on stale repomaps
175+ - ❌ Don't skip regeneration before PRs
176+
102177### Code Quality Tools
103178
104179For linting documentation code examples:
@@ -338,6 +413,9 @@ cd reference
338413# Install doc tooling
339414uv pip install -r requirements-dev.txt
340415
416+ # Generate repomap (session start)
417+ python repomap.py . > .repomap.txt
418+
341419# Lint documentation
342420markdownlint docs/** /* .md --fix
343421
@@ -351,18 +429,24 @@ markdownlint docs/**/*.md --fix
351429# 1. Create feature branch
352430git checkout -b docs/topic-name
353431
354- # 2. Edit documentation
432+ # 2. Generate/review repomap
433+ python repomap.py . > .repomap.txt
434+
435+ # 3. Edit documentation
355436# ... make changes ...
356437
357- # 3 . Validate
438+ # 4 . Validate
358439markdownlint docs/** /* .md --fix
359440./scripts/validate-mermaid.sh
360441
361- # 4. Commit
362- git add docs/
442+ # 5. Regenerate repomap if structure changed
443+ python repomap.py . > .repomap.txt
444+
445+ # 6. Commit
446+ git add docs/ .repomap.txt
363447git commit -m " Add documentation for X"
364448
365- # 5 . Push and create PR
449+ # 7 . Push and create PR
366450git push -u origin docs/topic-name
367451gh pr create --title " docs: Add X" --body " Documentation for X pattern"
368452```
0 commit comments