This guide provides standards and best practices for maintaining and contributing to Codomyrmex documentation.
- User-Centric: Documentation is organized by user intent, not code structure
- Show, Don't Tell: Provide working examples rather than abstract descriptions
- Progressive Complexity: Start simple, build to advanced topics
- Maintenance-First: Easy to maintain and keep up-to-date
- Accessible: Clear language, good structure, searchable content
| Type | Location | Purpose | Audience |
|---|---|---|---|
| Project Documentation | docs/ |
Information about Codomyrmex | Users, Contributors |
| Module Documentation | src/codomyrmex/[module]/ |
Module-specific information | Module users |
| Documentation Tools | src/codomyrmex/documentation/ |
Website generation tools | Other projects |
| API References | */API_SPECIFICATION.md |
Technical API details | Developers |
Diagrams use fenced code blocks with the mermaid language tag. Conventions:
- No hard-coded theme styling β Do not use
style β¦ fill:β¦,classDef, or:::classon nodes. Diagrams must render legibly in light and dark themes (see Cursor Mermaid rules). - Subgraphs β Prefer
subgraph graphId [Human-readable label]so the graph id has no spaces and labels with punctuation stay in brackets. - Edges and nodes β Use quoted edge labels when they contain parentheses or slashes. Avoid node ids that are Mermaid reserved words (
end,graph, β¦). - Edges only between real nodes β Do not point an edge at a subgraph name unless your renderer supports it; connect to an explicit node inside the subgraph instead.
- Maintenance scripts (repo root):
uv run python scripts/strip_mermaid_style_lines.pyremoves legacystylelines;uv run python scripts/normalize_mermaid_subgraphs.pyconvertssubgraph "Title"tosubgraph sg_β¦ [Title].
Counts for modules, MCP tools, and tests drift quickly. Do not hand-edit broad statistics across the tree β refresh from one place:
- docs/reference/inventory.md β definitions, dated table, reproduce commands
uv run python scripts/doc_inventory.pyβ print current counts (--pytestincludes collected test total, ~30s)
Hermes-specific examples and agent-doc rules: docs/agents/hermes/AGENTS.md (Diagram conventions).
Paths such as src/codomyrmex/documentation/.docusaurus/ are build output from the site generator, not editorial sources. Do not treat files there (including any AGENTS.md copies) as maintained RASP contracts. Edit hand-written docs under docs/ and per-module files under src/codomyrmex/<module>/ instead.
docs/
βββ README.md # Documentation overview
βββ getting-started/ # User onboarding
β βββ installation.md # Installation guide
β βββ quickstart.md # Quick start guide
β βββ tutorials/ # Step-by-step tutorials
βββ project/ # Project-level documentation
β βββ architecture.md # System architecture
β βββ contributing.md # Contributing guidelines
βββ modules/ # Module system documentation
β βββ overview.md # Module system overview
β βββ relationships.md # Inter-module dependencies
βββ development/ # Developer documentation
β βββ environment-setup.md # Development environment
β βββ documentation.md # This file
βββ reference/ # Reference materials
βββ troubleshooting.md # Troubleshooting guide
βββ cli.md # CLI reference
βββ api.md # API reference index
βββ changelog.md # Version history (redirects to root)
Each module follows this standardized documentation structure:
src/codomyrmex/[module]/
βββ README.md # β
REQUIRED: Module overview
βββ AGENTS.md # β
REQUIRED: Agent configuration
βββ SECURITY.md # β
REQUIRED: Security considerations
βββ API_SPECIFICATION.md # β οΈ Required if referenced in docs/index.md
βββ MCP_TOOL_SPECIFICATION.md # β οΈ Required if referenced in docs/index.md
βββ USAGE_EXAMPLES.md # β οΈ Required if referenced in docs/index.md
βββ CHANGELOG.md # Optional: Module version history
βββ pyproject.toml # Project dependencies
βββ docs/ # Extended documentation
β βββ index.md # β
REQUIRED if docs/ exists
β βββ technical_overview.md # Optional: Architecture details
β βββ tutorials/ # Optional: Module-specific tutorials
β βββ example_tutorial.md # β οΈ Required if referenced in docs/index.md
βββ tests/
βββ README.md # Optional: Testing documentation
All modules MUST have:
- README.md: Module overview, features, quick start, and usage examples
- AGENTS.md: Agent configuration, operating contracts, and navigation links
- SPEC.md: Functional specification and design principles
- PAI.md: Personal AI Infrastructure integration notes
- SECURITY.md: Security considerations and vulnerability reporting process
These files are required if referenced in documentation:
- API_SPECIFICATION.md: Required if
docs/index.mdreferences it - MCP_TOOL_SPECIFICATION.md: Required if
docs/index.mdreferences it - USAGE_EXAMPLES.md: Required if
docs/index.mdreferences it - docs/tutorials/example_tutorial.md: Required if
docs/index.mdreferences it
All internal links must follow these conventions:
- Contributing Guidelines: Always link to
../../docs/project/contributing.md(from module root) or../../../docs/project/contributing.md(fromdocs/directory) - Module Documentation: Use relative paths from current file location
- Cross-Module References: Use paths relative to repository root
Module documentation is automatically validated using:
scripts/documentation/module_docs_auditor.py- Comprehensive audit toolscripts/documentation/validate_module_docs.py- CI/CD validation tool
Run validation before committing:
python3 scripts/documentation/validate_module_docs.pyAfter large doc-tree changes, regenerate the scoped AGENTS.md / README.md presence report:
uv run python scripts/rasp_gap_report.pyOutput: docs/plans/agents-readme-gap-report.md. Inclusion roots and path excludes are defined in scripts/rasp_gap_report.py.
# Document Title
Brief description of what this document covers.
## π― Section with Emoji
Use descriptive emojis to make sections scannable.
### **Bold Subsection Headers**
Use bold for important subsections.
#### Regular Subsection
Use regular headers for detailed breakdowns.
### **Code Examples**
```python
# Always include complete, working examples
from codomyrmex.module import function
result = function("example", param="value")
print(f"Result: {result}")| Column 1 | Column 2 | Column 3 |
|---|---|---|
| Data | Data | Data |
β οΈ Important: Critical information users must know.
π‘ Tip: Helpful suggestions for better experience.
π Note: Additional context or clarification.
### **Link Conventions**
```markdown
# Internal links (relative to current file)
[Architecture Guide](../project/architecture.md)
[Module Template](../../src/codomyrmex/module_template/README.md)
# External links
[GitHub Repository](https://github.com/docxology/codomyrmex)
# Anchor links within document
[See Installation Section](#installation)
- Complete Examples: Always provide full, runnable code
- Real Implementations: No placeholder or pseudo-code
- Error Handling: Show proper error handling patterns
- Context: Provide necessary imports and setup
# β
Good example
from codomyrmex.logging_monitoring import setup_logging, get_logger
from codomyrmex.data_visualization import create_line_plot
import numpy as np
# Initialize logging (required)
setup_logging()
logger = get_logger(__name__)
try:
# Generate sample data
x = np.linspace(0, 10, 100)
y = np.sin(x)
# Create visualization
create_line_plot(
x_data=x,
y_data=y,
title="Sine Wave",
output_path="sine_wave.png"
)
logger.info("Plot created successfully")
except Exception as e:
logger.error(f"Failed to create plot: {e}")
raise
# β Bad example
result = some_function()
print(result)- Accuracy: All code examples work
- Completeness: Covers all necessary information
- Clarity: Clear, concise writing
- Structure: Logical organization and flow
- Links: All internal links work correctly
- Consistency: Follows established patterns
- User-Focused: Addresses user needs and questions
- Examples: Includes practical, working examples
- Maintenance: Easy to keep up-to-date
All module documentation is validated for consistency and completeness:
-
scripts/documentation/module_docs_auditor.py: Comprehensive audit of all modules- Scans for missing required files
- Identifies broken references
- Checks documentation structure
- Generates detailed reports
-
scripts/documentation/validate_module_docs.py: Fast validation for CI/CD- Validates required files exist
- Checks for broken references
- Ensures link consistency
- Returns exit code for automation
# Comprehensive audit (generates detailed report)
python3 scripts/documentation/module_docs_auditor.py
# Quick validation (for CI/CD)
python3 scripts/documentation/validate_module_docs.py
# Fix common issues
python3 scripts/documentation/fix_contributing_refs.py
python3 scripts/documentation/create_example_tutorials.py
python3 scripts/documentation/create_missing_doc_files.pyRegular link checking is essential:
# Manual link checking
find docs/ -name "*.md" -exec grep -l "](.*\.md)" {} \; | while read file; do
echo "Checking links in $file"
grep -o "](.*\.md)" "$file" | sed 's/](\(.*\))/\1/' | while read link; do
if [[ ! -f "$(dirname "$file")/$link" ]] && [[ ! -f "$link" ]]; then
echo "β Broken link: $link in $file"
fi
done
done
# Check external links (requires network)
# Use tools like markdown-link-check or similar- Regular Reviews: Schedule quarterly documentation reviews
- Version Sync: Update documentation with code changes
- Link Maintenance: Check for broken links after file moves
- Example Validation: Test all code examples regularly
- User Feedback: Incorporate user feedback and questions
The documentation system includes automated tools for maintenance:
# Add to .git/hooks/pre-commit
python3 scripts/documentation/validate_module_docs.pySee .github/workflows/documentation-validation.yml for automated validation in CI/CD pipelines.
Run comprehensive audits periodically:
# Full repository audit
python3 scripts/documentation/comprehensive_audit.py
# Module-specific audit
python3 scripts/documentation/module_docs_auditor.py- Identify Gap: Find missing or outdated documentation
- Check Structure: Determine correct location in documentation structure
- Write Content: Follow the writing standards above
- Test Examples: Ensure all code examples work
- Check Links: Verify all links work correctly
- Submit PR: Create pull request with clear description
- Discuss First: Open issue to discuss major structural changes
- Plan Migration: Consider impact on existing links and bookmarks
- Update References: Update all referring documentation
- Provide Redirects: Add redirect notices for moved content
- Announce Changes: Communicate changes to community
# Local documentation development
cd src/codomyrmex/documentation/
npm install
npm run start # Start development server
# Build documentation website
npm run build
# Check for broken links (if using link checker)
npm run check-links- Check for new issues asking documentation questions
- Review and merge documentation pull requests
- Update example code if APIs change
- Run comprehensive link checking
- Review analytics for most-viewed documentation
- Update getting-started guides for new features
- Complete documentation structure review
- User experience testing with new contributors
- Performance review of documentation website
- Cleanup of outdated or redundant content
Track these metrics for documentation health:
- Coverage: Percentage of modules with complete documentation
- Freshness: Age of documentation vs. last code changes
- Usage: Most and least viewed documentation pages
- Issues: Number of documentation-related issues opened
- Contribution: Community contributions to documentation
- Problem: Code examples break with API changes
- Solution: Automated testing of documentation examples
- Prevention: Include documentation in code review process
- Problem: Links break when files are moved or reorganized
- Solution: Regular link checking and relative link preferences
- Prevention: Use consistent link patterns and automation
- Problem: Users can't find information they need
- Solution: User testing and feedback collection
- Prevention: User-centric organization and clear navigation
- Problem: Information exists in multiple places, creating maintenance burden
- Solution: Single source of truth principle
- Prevention: Clear content ownership and regular audits
Good documentation should achieve:
- Discoverability: Users can quickly find what they need
- Usability: Information is clear and actionable
- Completeness: All necessary information is available
- Maintainability: Easy to keep up-to-date
- Community: Encourages contributions and engagement
- Decreased "documentation" issues in GitHub
- Increased successful first-time installations
- More community contributions
- Positive feedback on documentation quality
- Reduced support requests for covered topics
Last Updated: Auto-generated from documentation review
Maintainers: Documentation team and community contributors
Feedback: Open an issue for documentation improvements
- Parent: Project Overview
- Module Index: All Agents
- Documentation: Reference Guides
- Home: Repository Root