AI Documentation
The One Code's Understand module uses Claude Sonnet to read your clients' code repositories and generate comprehensive, human-readable documentation. This page explains what gets generated, how the pipeline works, how versioning works, and how to share docs with clients and auditors.
What Gets Generated
The One Code generates eight distinct document types per repository:
| Doc Type | What It Covers |
|---|---|
| Architecture | High-level system design, component breakdown, technology choices, data flow between services |
| API | Endpoints, request/response formats, authentication, error codes, usage examples |
| Database | Schema overview, table/collection structure, relationships, indexing strategy, data lifecycle |
| Deployment | Infrastructure setup, environment variables, CI/CD pipeline, deployment steps, rollback procedure |
| Onboarding | Developer quickstart, local setup instructions, key concepts, first contribution guide |
| Data Flow | How data moves through the system, external integrations, event handling, async processing |
| Security | Auth mechanisms, secret management, input validation, known security considerations |
| Handoff | Comprehensive transfer document combining all the above, plus critical files, known issues, and suggested first tasks |
Every document is written in Markdown and includes:
- Context-aware content based on actual files in the repository
- Tech stack and framework callouts specific to what was found in the code
- Version tracking — each regeneration increments the version number
How the AI Pipeline Works
When you trigger documentation generation:
- File tree fetch — The One Code fetches the complete file tree from GitHub using the installation token
- File selection — For each document type, a set of relevant file paths is selected (e.g., for an API doc, it reads route files, controller files, and OpenAPI specs; for a database doc, it reads migration files and schema definitions)
- File content fetch — The selected files are fetched from GitHub
- Context assembly — The application profile (tech stack, frameworks, languages, health scores) is combined with the file tree and file contents into a prompt context
- AI generation — Claude Sonnet generates the document via the shared AI Gateway
- Versioning — If a document of this type already exists for the repo, its version is incremented and the previous content is preserved in the prompt for consistency
- Storage — The generated Markdown is stored in Cosmos DB and associated with the repo
The pipeline generates all requested document types sequentially to manage AI API throughput. For a full set of seven document types, the complete pipeline typically finishes in 3–7 minutes.
Triggering Documentation Generation
From the repository detail page:
- Navigate to Portfolio and click on a repository
- Click Generate Documentation
- Optionally select specific document types (or leave all selected for a complete set)
- Click Generate
The page shows a progress indicator. Each document type completes independently — you'll see them appear as they finish.
From the Docs page:
- Navigate to Documentation from the left sidebar
- Click Generate for Repository
- Select the repository
- Select document types
- Click Generate
Viewing Documentation
The Documentation page lists all generated documents across all repositories. You can filter by:
- Repository
- Document type
Click on any document to read the full Markdown-rendered content. Documents include the generation timestamp, version number, and which AI model generated it.
Refreshing a Document
Documentation gets stale as code evolves. You can refresh any individual document on demand:
- Open the document
- Click Refresh (or the regenerate icon)
- The One Code re-fetches the file tree and relevant files from GitHub and generates a new version
The version number increments. The previous content is used as context for the new generation, which helps maintain consistency in tone and structure across versions.
Background refresh is also available: go to Documentation and click Refresh All for a repository. This regenerates all documents for that repo.
Exporting Documents
Export any document as a Markdown file:
- Open the document
- Click Export
- Select Markdown format
- The file downloads as
{doc-type}-{repo-id}.md
Sharing Documents with Clients
You can share any document as a public link without requiring the recipient to have a One Stack account. This is useful for:
- Sharing architecture docs with client technical stakeholders
- Providing onboarding documentation to new developers at a client
- Giving auditors read-only access to compliance-adjacent documentation
To create a share link:
- Open the document
- Click Share
- Set the expiration period (default: 7 days)
- Click Create Link
- Copy the URL and share it
The recipient can view the document at app.theonecode.app/shared/docs/{token} — no login required. When the expiration date passes, the link stops working and returns an expiry notice.
Handoff Packages
A Handoff Package is a special documentation bundle designed for knowledge transfer — when an MSP is onboarding a new developer to a client project, when a client is taking work in-house, or when handing off a project between technicians.
A handoff package contains:
- All seven standard documentation types (architecture, API, database, deployment, onboarding, data flow, security)
- A dedicated Handoff document — a narrative transfer summary
- Critical Files — an AI-identified list of the most important files in the repo with explanations of why they matter
- Known Issues — issues the AI detected during analysis that the recipient should be aware of
- Suggested First Tasks — recommended starting points for someone new to the codebase
To generate a handoff package:
- Navigate to Documentation → Handoff
- Click Generate Handoff Package
- Select the repository
- Optionally provide the recipient's name and any context (e.g., "incoming developer, no prior experience with this stack")
- Click Generate
The handoff package takes longer to generate than individual docs because it runs all document types plus the handoff analysis. Expect 5–10 minutes for a typical repository.
Once generated, the package shows all documents in a single view and includes the critical files and suggested task lists. You can export individual docs or share the package via link.
Documentation Versioning
Every time a document is generated or refreshed, its version number increments. Version 1 is the initial generation. The API returns the latest version — older versions are not retained in storage (only the latest version of each document type per repo is kept).
When refreshing, the previous content is passed as context to the AI, which helps maintain consistent terminology and structure across versions.
Tips for Better Results
Ensure the application profile is populated first. The AI documentation pipeline uses the application profile (tech stack, frameworks, detected app type) as context. If a profile hasn't been generated yet, the output will be less precise. Run Analyze Portfolio before generating docs.
Include relevant files. The AI reads a curated selection of files for each document type. For the best API documentation, ensure your route and controller files are present and not minified. For database docs, having migration files or ORM model files produces more accurate results than relying solely on the file tree.
Use the context field for handoff packages. Describing the recipient's background and the reason for the handoff helps the AI calibrate the language and depth of the handoff document.
Refresh after major changes. After significant refactors, dependency updates, or infrastructure changes, trigger a document refresh to keep docs in sync with the current codebase.