5.2 KiB
Documentation Standard (MANDATORY)
This guide defines REQUIRED documentation behavior for all Mosaic projects. If code, API contracts, auth, or infrastructure changes, documentation updates are REQUIRED before completion.
Hard Rules
- Documentation is a delivery gate. Missing required documentation is a BLOCKER.
docs/PRD.mdordocs/PRD.jsonis REQUIRED as the project requirements source before coding begins.- API documentation is OpenAPI-first.
docs/API/OPENAPI.yaml(or.json) is the canonical API contract. - Public and private/internal endpoints MUST be documented.
- API input and output schemas MUST be documented.
- API authentication and permissions MUST be documented per endpoint.
- A current site map MUST exist at
docs/SITEMAP.md. - Documentation updates MUST be committed in the same logical change set as the code/API change.
- Generated publishing output (Docusaurus/VitePress/MkDocs artifacts) is not canonical unless the project explicitly declares it canonical.
docs/root MUST stay clean. Reports and working artifacts MUST be stored in dedicated subdirectories, not dumped atdocs/root.
Required Documentation Structure
docs/
PRD.md (or PRD.json)
TASKS.md (active orchestrator tracking, when orchestrator is used)
SITEMAP.md
USER-GUIDE/
ADMIN-GUIDE/
DEVELOPER-GUIDE/
API/
OPENAPI.yaml
ENDPOINTS.md
scratchpads/
reports/
tasks/
releases/
templates/ (optional)
Minimum requirements:
docs/PRD.mdordocs/PRD.json: authoritative requirements source for implementation and testing.docs/USER-GUIDE/: End-user workflows, feature behavior, common troubleshooting.docs/ADMIN-GUIDE/: Configuration, deployment, operations, incident/recovery procedures.docs/DEVELOPER-GUIDE/: Architecture, local setup, contribution/testing workflow, design constraints.docs/API/OPENAPI.yaml: API SSOT for all HTTP endpoints.docs/API/ENDPOINTS.md: Human-readable index for API endpoints, permissions, and change notes.docs/SITEMAP.md: Navigation index for all user/admin/developer/API documentation pages.docs/reports/: Review outputs, QA automation reports, deferrals, and audit artifacts.docs/tasks/: Archived task snapshots and orchestrator learnings.docs/releases/: Release notes and release-specific documentation.docs/scratchpads/: Active task-level working notes.
Root Hygiene Rule (MANDATORY)
Allowed root documentation files are intentionally limited:
docs/PRD.mdordocs/PRD.jsondocs/TASKS.md(active milestone only, when task orchestration is in use)docs/SITEMAP.mddocs/README.md(optional index)
All other docs MUST be placed in scoped folders (docs/reports/, docs/tasks/, docs/releases/, docs/scratchpads/, docs/API/, guide books).
Artifact Placement Rules
| Artifact Type | REQUIRED Location |
|---|---|
| Code review reports, QA reports, audits | docs/reports/<category>/ |
| Deferred error lists / unresolved findings | docs/reports/deferred/ |
| Archived milestone task snapshots | docs/tasks/ |
| Orchestrator learnings JSON | docs/tasks/orchestrator-learnings.json |
| Release notes | docs/releases/ |
| Active scratchpads | docs/scratchpads/ |
API Documentation Contract (OpenAPI-First)
For every API endpoint, documentation MUST include:
- visibility:
publicorprivate/internal - method and path
- endpoint purpose
- request/input schema
- response/output schema(s)
- auth method and required permission/role/scope
- error status codes and behavior
If OpenAPI cannot fully express an internal constraint, document it in docs/API/ENDPOINTS.md.
Book/Chapter/Page Structure
Use this structure for every guide:
- Book: one root guide folder (
USER-GUIDE,ADMIN-GUIDE,DEVELOPER-GUIDE) - Chapter: one subdirectory per topic area
- Page: one focused markdown file per concern
Required index files:
docs/USER-GUIDE/README.mddocs/ADMIN-GUIDE/README.mddocs/DEVELOPER-GUIDE/README.md
Each index file MUST link to all chapters and pages in that book.
Situational Documentation Matrix
| Change Surface | REQUIRED Documentation Updates |
|---|---|
| New feature or behavior change | User guide + developer guide + sitemap |
| API endpoint added/changed/removed | OpenAPI + API endpoint index + sitemap |
| Auth/RBAC/permission change | API auth/permission docs + admin guide + developer guide |
| Database schema/migration change | Developer guide + admin operational notes if runbook impact |
| CI/CD or deployment change | Admin guide + developer guide |
| Incident, recovery, or security control change | Admin guide runbook + security notes + sitemap |
Publishing Target Rule (MANDATORY)
If the user does not specify documentation publishing target, the agent MUST ask:
- Publish in-app (embedded docs)
- Publish on external docs platform (for example: Docusaurus, VitePress, MkDocs)
Default behavior before publishing decision:
- Keep canonical docs in-repo under
docs/. - Do not assume external publishing platform.
Completion Gate
You MUST NOT declare completion until all required documentation updates are done.
Use ~/.config/mosaic/templates/docs/DOCUMENTATION-CHECKLIST.md as the final gate.