The PR workflow runs as a GitHub Action on your repository. When a pull request is opened, updated, or reopened, the action gathers the diff, fetches your integration config from Moxn, and spawns Claude Code to create or update documentation in your Knowledge Base. All processing happens on your GitHub Actions runner — your code never leaves GitHub’s infrastructure.Documentation Index
Fetch the complete documentation index at: https://moxn.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- A GitHub repository
- A Moxn API key with read/write access
- An Anthropic API key for Claude
- An integration configured in Moxn for your repository
Setup
1. Configure the Integration
In the Moxn web app, go to Settings > Integrations > GitHub and create an integration:- Repository: Your repo (e.g.,
your-org/your-repo) - Trigger mode: Choose when docs should be generated (see Trigger Modes)
- Target database: Which KB database to add new docs to
- Prompt template: Customize or use the auto-generated default
2. Add the Workflow File
Copy this workflow to.github/workflows/moxn-docs.yml in your repository:
.github/workflows/moxn-docs.yml
3. Add Repository Secrets
In your GitHub repository settings, go to Settings > Secrets and variables > Actions and add:| Secret | Value |
|---|---|
MOXN_API_KEY | Your Moxn API key |
ANTHROPIC_API_KEY | Your Anthropic API key |
The workflow has read-only repository permissions. It never pushes commits, modifies files, or writes to your repo. All documentation changes happen in Moxn’s Knowledge Base via the API.
How It Works
- A PR event triggers the GitHub Action
- The action gathers the PR diff and metadata (title, body, labels, changed files)
context docs-syncfetches your integration config and prompt template from Moxn- Claude Code is spawned with the diff and your prompt template as instructions
- Claude searches for existing docs, decides what to document, and creates or updates KB documents on a branch matching the PR branch name
- A changeset is created grouping all document changes for review
Trigger Modes
Control when docs are generated based on properties of the PR:| Mode | Behavior | Example |
|---|---|---|
always | Runs on every PR | Good for small repos or docs-heavy teams |
path_match | Only when changed files match patterns | src/api/**, lib/auth/* |
label | Only when the PR has specific labels | docs, documentation |
keyword | Only when the PR title or body contains a keyword | [docs], needs-docs |
Branch Strategy
The PR workflow creates KB branches that match the PR branch name:| Git branch | KB branch | Changeset target |
|---|---|---|
feature/auth | feature/auth | main |
fix/rate-limit | fix/rate-limit | main |
main in your KB — mirroring the PR merge in Git.
Reviewing Changes
After the action runs, you’ll find a new changeset in your KB:- Go to Knowledge Base > Changesets in the Moxn web app
- Find the changeset titled “Docs: MR #{number}”
- Click into it to see which documents were created or updated
- Click Doc to view the content on the feature branch
- When satisfied, click Merge All to land the docs on main
CLI Reference
Thedocs-sync command is typically called by the GitHub Action, but you can run it manually for testing:
| Flag | Required | Description |
|---|---|---|
--pr-number | Yes | PR number |
--repo | Yes | Repository full name (org/repo) |
--diff-file | Yes | Path to the diff file |
--pr-metadata-file | Yes | Path to PR metadata JSON |
--pr-url | Yes | URL to the PR |
--head-sha | No | Head commit SHA |
--max-turns | No | Max Claude Code turns (default: 50) |
--model | No | Claude model (e.g., sonnet, opus) |
--dry-run | No | Show prompts without running Claude |