ADR-0013: Module-Local Documentation Structure¶
Status¶
Accepted
Date: 2025-11-05
Context¶
The monorepo had inconsistent documentation organization that made it difficult for contributors to find relevant information and didn't align with modern Python monorepo best practices.
Problems with Previous Structure¶
-
Documentation scattered across multiple locations:
-
Client docs at root
docs/(8 guides + 8 ADRs) - MCP docs split between
docs/mcp-server/(5 files) andkatana_mcp_server/(2 files) -
No clear module boundaries
-
ADRs mixed by scope:
-
Root
docs/adr/contained client ADRs (001-008, 011-012), MCP ADR (010), and shared ADR (009) -
Made it unclear which ADRs applied to which package
-
Examples not organized by module:
-
All examples in flat
examples/directory -
No separation between client and MCP examples
-
Difficult to extract packages:
-
Package-specific docs didn't travel with the package
-
Would need extensive refactoring to split packages into separate repos
-
Questions about organization:
-
"Where are the client docs?" → Unclear (some in root docs/, some might be elsewhere)
- "Where are the MCP docs?" → Very unclear (split across 3 locations)
- "Which ADRs apply to the client?" → Required reading all ADRs to determine
Decision¶
We will reorganize documentation into a module-local structure where each package
has its own docs/ subdirectory containing all module-specific documentation, including
ADRs.
New Structure¶
katana-openapi-client/
│
├── katana_public_api_client/ # CLIENT PACKAGE
│ ├── [source code...]
│ └── docs/ # Client-specific docs
│ ├── README.md # Navigation/index
│ ├── guide.md # User guide
│ ├── testing.md # Testing strategy
│ ├── cookbook.md # Usage recipes
│ ├── CHANGELOG.md # Release notes
│ └── adr/ # Client ADRs (001-008, 011-012)
│
├── katana_mcp_server/ # MCP PACKAGE
│ ├── [source code...]
│ └── docs/ # MCP-specific docs
│ ├── README.md # Navigation/index
│ ├── architecture.md # MCP architecture
│ ├── development.md # Development guide
│ ├── deployment.md # Deployment guide
│ ├── docker.md # Docker guide
│ ├── implementation-plan.md # Implementation roadmap
│ ├── stocktrim-migration.md # Migration plan
│ └── adr/ # MCP ADRs (010)
│
├── docs/ # SHARED MONOREPO DOCS
│ ├── index.md # Landing page
│ ├── CONTRIBUTING.md # Shared contribution guide
│ ├── CODE_OF_CONDUCT.md # Code of conduct
│ ├── MONOREPO_SEMANTIC_RELEASE.md # Shared release guide
│ ├── UV_USAGE.md # Shared tooling
│ ├── PYPI_SETUP.md # PyPI publishing
│ ├── RELEASE.md # Release process
│ ├── client/ # Symlink → ../katana_public_api_client/docs
│ ├── mcp-server/ # Symlink → ../katana_mcp_server/docs
│ └── adr/ # Shared/monorepo ADRs (009, 013)
│
└── examples/ # EXAMPLES
├── README.md # Examples index
├── client/ # Client examples
└── mcp-server/ # MCP examples (placeholder)
Implementation¶
- Created
katana_public_api_client/docs/andkatana_mcp_server/docs/directories - Moved client docs and ADRs to client package
- Moved MCP docs and ADRs to MCP package
- Reorganized examples by module
- Created symlinks from
docs/client/anddocs/mcp-server/to module docs - Updated all internal links and references
- Updated
mkdocs.ymlnavigation structure
Consequences¶
Positive Consequences¶
- Clear Module Boundaries: Each package has complete, self-contained documentation
- Improved Discoverability: Easy to find docs - client docs in client package, MCP docs in MCP package
- Better ADR Organization: ADRs organized by scope (client/MCP/shared)
- Package Extractability: Documentation travels with the package - could extract to separate repo without refactoring
- Consistent with Modern Practices: Aligns with Python monorepo best practices
- Better mkdocs Integration: Root
docs/aggregates everything via symlinks - Easier Navigation: Clear navigation structure by module in documentation site
Negative Consequences¶
- More Complex Directory Structure: More directories to navigate (though better organized)
- Symlinks Required: CI/CD must handle symlinks or copy files for documentation builds
- Cross-References: Some documentation cross-references require relative paths
(e.g.,
../../)
Neutral Consequences¶
- Documentation Paths Changed: All documentation paths updated - old bookmarks/links will break
- Git History: File moves preserved in git history but may complicate some git operations
Alternatives Considered¶
Alternative 1: Keep Flat Structure¶
- Description: Keep all docs in root
docs/directory with subdirectories for different topics - Pros: Simpler structure, easier to browse all docs at once
- Cons: Doesn't scale to multiple packages, unclear ownership, difficult to extract packages
- Why rejected: Doesn't support monorepo evolution and package independence
Alternative 2: Duplicate Documentation¶
- Description: Keep docs in both root
docs/and package directories - Pros: Easy to find docs in either location
- Cons: Synchronization nightmare, source-of-truth unclear, duplicated maintenance
- Why rejected: Unsustainable maintenance burden
Alternative 3: Documentation in Separate Repo¶
- Description: Move all documentation to a separate repository
- Pros: Clean separation, focused documentation repo
- Cons: Docs far from code, version synchronization issues, harder to keep docs updated
- Why rejected: Best practice is to keep docs with code
References¶
- Issue: #118 - Documentation reorganization
- Python Packaging Guide - Modern Python packaging practices
- Monorepo Best Practices - Monorepo organization patterns
- ADR-009: Migrate to uv - Related monorepo decision
- ADR-010: Katana MCP Server - MCP server architecture