This document explains the documentation architecture, the purpose of each document type, and guidelines for maintaining clear, focused documentation that serves both human developers and AI agents effectively.
File: AGENTS.md
- Purpose: Central truth source for AI agents working on the project
- Size Limit: Must stay under 40k characters for optimal performance
- Content: Essential instructions, critical rules, architecture references
- What belongs: Agent execution instructions, testing rules, commit standards, known issues
- What doesn't belong: Historical task completions, duplicated content from other docs
Location: docs/ organized in numbered sections
- Purpose: Comprehensive guides for specific features and capabilities
- Organization:
01-getting-started/- Setup, quickstart, project structure02-user-guide/- Application developer docs (Phoenix/Ecto/LiveView)03-compiler-development/- Compiler internals and contributor docs04-api-reference/- API + annotation reference05-architecture/- System design and architectural decisions06-guides/- Task-focused how-to guides07-patterns/- Patterns and best practices08-roadmap/+prds/- Roadmaps and PRDs09-history/- Historical records and learnings10-contributing/- Contribution process and LLM integration docs
Location: docs/05-architecture/
- Purpose: Explain system design, compilation flow, and architectural decisions
- Key Files:
ARCHITECTURE.md- Complete system architectureTESTING.md- Testing philosophy and infrastructureTESTING_ARCHITECTURE_COMPLETE.md- Comprehensive testing details
Location: docs/01-getting-started/, docs/02-user-guide/, and docs/06-guides/
- Purpose: Help users get started and use the project effectively
- Key Files:
GETTING_STARTED.md- First steps with Reflaxe.ElixirEXAMPLES.md- Working example walkthroughsCOOKBOOK.md- Common patterns and recipesQUICKSTART.md- Rapid onboarding guideTUTORIAL_FIRST_PROJECT.md- Step-by-step tutorial
Location: docs/08-roadmap/ and docs/prds/
- Purpose: Strategic vision, requirements analysis, and product roadmap
- Key Files:
PRD_VISION_ALIGNMENT.md- Core vision and architecture requirementsPRD_README.md- Index of PRDs with guidelines
- Content: Executive summaries, requirement specifications, success metrics, implementation roadmaps
- Audience: Project stakeholders, senior developers, strategic planners
Location: docs/04-api-reference/
- Purpose: API references and feature specifications
- Key Files:
ANNOTATIONS.md- Annotation usage and referenceFEATURES.md- Production readiness and capability statusMIX_TASKS.md- Mix task reference documentationEXTERN_CREATION_GUIDE.md- Creating extern definitions
Location: Git history (tags/commits)
- Purpose: Preserve a record of completed tasks and learnings without keeping outdated snapshots in the working tree
- Guidance:
- Prefer
CHANGELOG.mdfor user-facing history - Use
git log/ tags for deep historical context
- Prefer
Location: docs/10-contributing/llm-integration/
- Purpose: Guide AI agents in specific tasks
- Key Files:
LLM_DOCUMENTATION_GUIDE.md- How to write and maintain documentationLLM_WORKFLOW_COMPATIBILITY.md- AI agent workflow patternsLLM_DEBUGGING_STRATEGY.md- Debugging approach for agentsLLM_STACKTRACE_DEBUGGING_COMPLETE.md- Complete debugging methodology
Location: .claude/
- Purpose: Claude-specific configuration and rules
- Content: Project-specific rules and commands for AI agents
- Note: Keep separate from main documentation
Prevent documentation rot and ensure accuracy:
- ALWAYS remove deprecated/outdated documentation - Don't let incorrect info accumulate
- Verify claims against actual code - Check implementation before documenting issues
- Update Known Issues immediately when issues are fixed - remove solved problems
- Delete obsolete sections entirely rather than marking them as outdated
- Test claims in real code - If documenting a limitation, verify it actually exists
- Remove fixed TODOs and resolved items - Keep only current actionable items
- Documentation updates are part of implementation - Update docs when changing code
- Size Check: Run
wc -c AGENTS.mdafter major updates - Target: Keep under 40,000 characters
- Actions when over limit:
- Move historical content to TASK_HISTORY.md
- Remove duplicated content (reference other docs instead)
- Consolidate redundant sections
- Archive completed task descriptions
- Don't duplicate: If content exists in another doc, reference it
- Use links:
See [docs/04-api-reference/FEATURES.md](../04-api-reference/FEATURES.md) - Keep references current: Update links when files move or rename
- Rule: Documentation is part of the implementation
- When changing code: Update relevant documentation immediately
- New features: Create or update feature documentation
- Breaking changes: Update all affected documentation
- Feature docs:
FEATURE_NAME.md(e.g.,SOURCE_MAPPING.md) - Guides:
ACTION_GUIDE.md(e.g.,GETTING_STARTED.md) - LLM docs:
LLM_PURPOSE.md(e.g.,LLM_DOCUMENTATION_GUIDE.md) - Architecture:
COMPONENT.md(e.g.,ARCHITECTURE.md,TESTING.md)
Every major documentation file should include:
- Purpose statement at the top
- Table of contents for files >100 lines
- Clear section headers using markdown hierarchy
- Code examples with syntax highlighting
- Cross-references to related documentation
- Be concise but complete
- Use examples to illustrate concepts
- Include "why" not just "what"
- Test instructions - ensure they work
- Keep current - outdated docs are worse than no docs
// Always provide context
@:liveview("/counter/:id")
class CounterLive {
// Explain what the code does
public function mount(params: Map<String, String>, session: Map<String, String>, socket: Socket): Socket {
// Implementation
}
}- Document which version features were added
- Note breaking changes clearly
- Keep compatibility notes when relevant
Before committing documentation changes:
- Is AGENTS.md still under 40k characters?
- Are all cross-references valid?
- Do code examples compile/work?
- Is the content in the right file?
- Are related docs updated?
- Is the language clear and concise?
- Are there unnecessary duplications?
Documentation in Reflaxe.Elixir is living documentation:
- It evolves with the code
- It's tested and validated
- It serves multiple audiences (users, developers, AI agents)
- It's part of the implementation, not an afterthought
By maintaining this documentation philosophy, we ensure that knowledge is preserved, discoverable, and actionable for all project stakeholders.