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: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:Branch Strategy
The PR workflow creates KB branches that match the PR branch name:
When the changeset is merged in Moxn, the documentation lands on
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: