This document establishes the mandatory folder structure documentation pattern that applies to every directory in the Research Project Template. Every directory must follow this pattern to ensure consistent, documentation across the entire codebase.
Every directory must contain exactly two documentation files:
AGENTS.md- technical documentationREADME.md- Quick human reference guide
This pattern is mandatory at all folder levels:
directory/
├── AGENTS.md # REQUIRED: technical documentation for AI agents and developers
├── README.md # REQUIRED: Quick reference with signposting and Mermaid diagrams
├── [optional].md # OPTIONAL: Additional specialized documentation
└── [code files]
Violation of this pattern is considered a documentation standard breach and must be corrected immediately.
- technical documentation for understanding and working with directory contents
- AI agent friendly - structured for automated parsing and comprehension
- Developer reference - details for implementation and maintenance
- Overview (50-100 words) - What this directory does, why it exists, who uses it
- Key Concepts (optional) - Terminology, architecture, important principles
- Directory Structure - File organization and purpose of each file
- Installation/Setup (if applicable) - Prerequisites, installation steps, configuration
- Usage Examples - Common tasks, real-world scenarios, copy-paste ready examples
- Configuration (if applicable) - All options, environment variables, config files
- Testing (for directories with tests) - How to run tests, test structure, writing tests
- API Reference (for modules) - Key classes, functions, import statements, parameters, returns
- Troubleshooting - Common issues, solutions, debug tips
- Best Practices - Do's and don'ts, performance tips, security considerations
- See Also / References - Related documentation, external resources, cross-references
- Minimum: 100 lines for simple directories
- Typical: 200-500 lines for most directories
- Maximum: 600 lines (split into specialized files if exceeded)
- Quick human reference - fast lookup of common tasks and key information
- Signposting - clear navigation to detailed documentation
- Visual elements - Mermaid diagrams for architecture and workflows
- Title - One-line description of directory purpose
- Quick Start - Minimal working example (5-10 lines)
- Key Features - 3-5 bullet points highlighting capabilities
- Installation - Copy-paste ready commands (if applicable)
- Common Commands - 3-5 most frequently used operations
- More Information - Link to AGENTS.md for details
- Typical: 50-150 lines
- Focus: Concise, actionable information
- Diagrams: Include Mermaid diagrams for complex workflows or architectures
| Directory | AGENTS.md | README.md | Purpose |
|---|---|---|---|
infrastructure/ |
✅ module documentation | ✅ Quick reference | Generic build/validation tools |
scripts/ |
✅ Entry point documentation | ✅ Quick reference | Orchestration scripts |
tests/ |
✅ Testing philosophy | ✅ Quick reference | Test suites |
projects/ |
✅ Project structure guide | ✅ Quick reference | Research code |
docs/ |
✅ Documentation organization | ✅ Quick reference | Documentation hub |
.cursorrules/ |
✅ Standards overview | ✅ Quick reference | Development guidelines |
All infrastructure/ subdirectories follow the pattern:
infrastructure/module/
├── __init__.py # Public API exports
├── AGENTS.md # REQUIRED: technical documentation
├── README.md # REQUIRED: Quick reference
├── core.py # Core functionality
├── cli.py # Command-line interface (optional)
├── config.py # Configuration (optional)
├── [other files]
All projects/ subdirectories follow the pattern:
projects/<name>/
├── AGENTS.md # REQUIRED: Directory documentation
├── README.md # REQUIRED: Quick reference
├── [code files]
├── [config files]
All docs/ subdirectories follow the pattern:
docs/section/
├── AGENTS.md # REQUIRED: Section documentation
├── README.md # REQUIRED: Quick reference
├── [topic files]
This standard integrates with:
.cursorrules/documentation_standards.md- Detailed AGENTS.md/README.md writing guidelines.cursorrules/AGENTS.md- System overview and navigation- Root
AGENTS.md- Directory-level documentation section
Documentation quality is verified through:
- Manual review - Pull request reviews check for AGENTS.md/README.md presence
- Automated checks - Pre-commit hooks can validate documentation structure
- Consistency audits - Regular reviews ensure standards compliance
Update documentation when:
- Architecture changes - New directories, file reorganization
- API changes - New functions, parameters, return types
- Feature additions - New capabilities, usage patterns
- Breaking changes - API modifications, migration requirements
- Bug fixes - Important fixes with changed behavior
Additional documentation files should only be added when:
- Content exceeds reasonable length (>600 lines in AGENTS.md)
- Specialized audience needs (e.g., API.md for external users)
- Maintenance benefits (e.g., CHANGELOG.md for versioned modules)
| File | Purpose | When to Use |
|---|---|---|
CHANGELOG.md |
Version history, migration notes | Versioned infrastructure modules |
examples.md |
Extended usage examples | Complex modules with many use cases |
TROUBLESHOOTING.md |
Detailed troubleshooting | Error-prone modules (LLM, rendering) |
API.md |
API reference | Large public-facing modules |
DESIGN.md |
Design decisions, rationale | Complex architectural decisions |
DEPENDENCIES.md |
External dependencies | Modules with complex requirements |
README.md files should include Mermaid diagrams for:
- Architecture diagrams - showing relationships between components
- Workflow diagrams - illustrating processes and data flow
- Decision trees - for complex conditional logic
graph TD
A[Start] --> B{Decision?}
B -->|Yes| C[Action 1]
B -->|No| D[Action 2]
C --> E[End]
D --> E[End]
- Use descriptive node names (no spaces in IDs)
- Include clear labels for decision points
- Use consistent arrow styles
- Keep diagrams focused and readable
infrastructure/llm/
├── __init__.py
├── AGENTS.md # LLM integration documentation
├── README.md # Quick LLM setup and usage
├── core/
│ ├── __init__.py
│ ├── AGENTS.md # Core LLM functionality
│ ├── README.md # Quick core reference
│ └── [python files]
├── templates/
│ ├── AGENTS.md # Template system documentation
│ ├── README.md # Quick template reference
│ └── [python files]
└── [other subdirs]
projects/{name}/src/
├── __init__.py
├── AGENTS.md # research code documentation
├── README.md # Quick research code reference
├── data_processing.py
├── simulation.py
├── visualization.py
└── [other files]
Before committing folder structure changes:
- Every directory has
AGENTS.mdandREADME.md - AGENTS.md follows standard section structure
- README.md includes Mermaid diagrams where appropriate
- Cross-references are accurate and working
- Optional files have clear justification
- Documentation is up-to-date with code changes
- No orphaned documentation files
- documentation_standards.md - Detailed AGENTS.md/README.md writing guidelines
- AGENTS.md - Overview of all development standards
- ../AGENTS.md - Root documentation structure
- docs/ - Main documentation hub
Version: 1.0.0 Last Updated: 2025-01-01 Status: Active standard - mandatory compliance Maintainer: Template Team