зеркало из
https://github.com/docxology/cognitive.git
synced 2025-10-30 20:56:04 +02:00
3.5 KiB
3.5 KiB
Package Documentation Guide
Overview
This guide outlines the documentation standards and organization for the Cognitive Modeling package. It combines Python docstrings, markdown documentation, and Obsidian's knowledge management capabilities.
Documentation Structure
Directory Organization
docs/
├── api/ # API reference documentation
├── concepts/ # Core theoretical concepts
├── examples/ # Usage examples and tutorials
├── guides/ # How-to guides and tutorials
└── tools/ # Tool-specific documentation
Documentation Types
1. API Documentation
- Located in
docs/api/ - Generated from docstrings
- Follows Google docstring format
Example:
def update_beliefs(observation: np.ndarray, prior: np.ndarray) -> np.ndarray:
"""Updates agent beliefs based on new observations.
Args:
observation (np.ndarray): Current observation vector
prior (np.ndarray): Prior belief state
Returns:
np.ndarray: Updated belief state
See Also:
[[belief_update_algorithm]]
[[free_energy_computation]]
"""
pass
2. Concept Documentation
- Located in
docs/concepts/ - Theoretical foundations
- Mathematical formulations
- Links to implementations
Example: concepts/free_energy.md:
# Free Energy Principle
## Mathematical Foundation
...
## Implementation
See [[free_energy_impl]] for code implementation.
3. Example Documentation
- Located in
docs/examples/ - Practical usage examples
- Step-by-step tutorials
- Interactive notebooks
Documentation Standards
Python Docstrings
- Use Google style docstrings
- Include type hints
- Link to relevant documentation
- Provide usage examples
Markdown Files
- Clear headings hierarchy
- Consistent formatting
- Proper linking
- Code examples
YAML Frontmatter
---
title: Package Documentation
category: guide
status: stable
related:
- [[docstring_guide]]
- [[api_reference]]
tags:
- documentation
- standards
---
Integration Patterns
Code-to-Doc Links
# Implementation of algorithm described in [[algorithm_spec]]
class BeliefUpdater:
pass
Doc-to-Code Links
See implementation in `src/models/belief_update.py`:
[[belief_update_impl#update_method]]
Test Documentation
def test_belief_update():
"""Test case described in [[belief_update_tests]]"""
pass
Maintenance
Documentation Updates
- Keep in sync with code
- Update related documents
- Maintain version consistency
- Review broken links
Version Control
- Document version dependencies
- Track breaking changes
- Maintain changelog
- Update migration guides
Tools and Automation
Documentation Generation
- Use sphinx for API docs
- Auto-generate from docstrings
- Maintain cross-references
- Update graphs
Quality Checks
- Link validation
- Style consistency
- Coverage metrics
- Reference integrity
Best Practices
Writing Style
- Clear and concise
- Consistent terminology
- Proper citations
- Progressive disclosure
Organization
- Logical grouping
- Clear navigation
- Proper linking
- Version management
Code Examples
- Runnable snippets
- Clear context
- Error handling
- Best practices