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,79 @@ echo $VIRTUAL_ENV # Should show project path
9999uv pip install -r requirements-dev.txt
100100```
101101
102+ ### Repomap - Context Window Optimization
103+
104+ ** MANDATORY: Load repomap at session start and use proactively throughout development.**
105+
106+ #### Session Start Protocol
107+
108+ ** ALWAYS load .repomap.txt as the first action** when starting any development session:
109+
110+ ``` bash
111+ # At session start - load existing repomap
112+ cat .repomap.txt
113+ ```
114+
115+ ** Purpose** : Provides token-optimized codebase context for AI-assisted development, reducing context window usage while maintaining code understanding.
116+
117+ ** Note** : The .repomap.txt file is tracked in git and should already exist. Only regenerate it when structural changes occur.
118+
119+ #### Proactive Usage Throughout Development
120+
121+ ** Use repomap context in these scenarios** :
122+
123+ 1 . ** Planning implementations** - Review repomap before designing features
124+ 2 . ** Understanding dependencies** - Check which files/classes exist before creating new ones
125+ 3 . ** Code reviews** - Reference structure when reviewing changes
126+ 4 . ** Refactoring** - Understand impact scope across codebase
127+ 5 . ** Documentation** - Ensure docs reflect actual code structure
128+
129+ #### When to Regenerate
130+
131+ ** Regenerate repomap when** :
132+
133+ - Files are added or removed
134+ - Classes or functions are added/removed
135+ - Major refactoring is completed
136+ - Before creating PRs (ensure map is current)
137+
138+ ``` bash
139+ # Regenerate after changes
140+ python repomap.py . > .repomap.txt
141+ git add .repomap.txt # Include in commits
142+ ```
143+
144+ #### Integration with Development Workflow
145+
146+ ** Include repomap in commit tracking** :
147+
148+ ``` bash
149+ # Pre-commit: Update repomap
150+ python repomap.py . > .repomap.txt
151+ git add .repomap.txt
152+
153+ # Commit message references structure changes
154+ git commit -m " Add UserService class
155+
156+ Updated repomap to reflect new service layer structure"
157+ ```
158+
159+ ** Use in AI prompts** :
160+
161+ - Reference specific files/classes from repomap by name
162+ - Ask questions about structure (e.g., "Where should I add authentication logic?")
163+ - Validate assumptions (e.g., "Does a Config class already exist?")
164+
165+ #### Repomap Best Practices
166+
167+ - ✅ Load at session start (always)
168+ - ✅ Regenerate after structural changes
169+ - ✅ Reference in planning and design discussions
170+ - ✅ Include in commit workflow
171+ - ✅ Use to avoid duplicate implementations
172+ - ❌ Don't rely on stale repomaps
173+ - ❌ Don't skip regeneration before PRs
174+
102175### Code Quality Tools
103176
104177For linting documentation code examples:
@@ -338,6 +411,9 @@ cd reference
338411# Install doc tooling
339412uv pip install -r requirements-dev.txt
340413
414+ # Load repomap (session start)
415+ cat .repomap.txt
416+
341417# Lint documentation
342418markdownlint docs/** /* .md --fix
343419
@@ -351,18 +427,24 @@ markdownlint docs/**/*.md --fix
351427# 1. Create feature branch
352428git checkout -b docs/topic-name
353429
354- # 2. Edit documentation
430+ # 2. Review repomap
431+ cat .repomap.txt
432+
433+ # 3. Edit documentation
355434# ... make changes ...
356435
357- # 3 . Validate
436+ # 4 . Validate
358437markdownlint docs/** /* .md --fix
359438./scripts/validate-mermaid.sh
360439
361- # 4. Commit
362- git add docs/
440+ # 5. Regenerate repomap if structure changed
441+ python repomap.py . > .repomap.txt
442+
443+ # 6. Commit
444+ git add docs/ .repomap.txt
363445git commit -m " Add documentation for X"
364446
365- # 5 . Push and create PR
447+ # 7 . Push and create PR
366448git push -u origin docs/topic-name
367449gh pr create --title " docs: Add X" --body " Documentation for X pattern"
368450```
0 commit comments