Generate technical documentation with AI
A lot of repositories never grow a real explanation of how they work. The README covers how to start the app, the architecture lives in someone's head, and the person who built the tricky part has moved on. New teammates stall on the same question coding agents do: where do I start?
Manage and surface technical documentation can put markdown next to a service in Port, but only when that markdown already exists. This guide covers the gap. From a repository in Port, a Claude managed agent reads the code and writes a wiki: an overview, the architecture, the modules, and the APIs. You review it in a pull request, the same way you review any other change. After you merge it, the pages show up in Port's catalog, and they stay current as the code moves.
Common use cases
- Give a repository its first real docs when the code is the only source of truth.
- Keep the wiki honest by refreshing the pages a merge actually affected, instead of rewriting the whole thing.
- Keep a person in the loop so documentation lands through review, not a silent commit to the default branch.
How it works
Someone opens a repository in Port and runs Generate wiki (managed agent). Port starts a Claude managed agent session with that repository mounted. Claude reads the code, writes the wiki under docs/wiki/, leaves the application alone, and opens a pull request for a person to merge. The workflow records a wiki run with the session link, the token count, and the cost. After the merge, those pages become tech docs, and the TechDocs plugin on the wiki dashboard shows them.
About once an hour, a scheduled workflow starts one session for the repositories you enrolled. Claude refreshes the pages a merge actually affected and opens a smaller pull request. A marker in the wiki records the commit the pages describe and moves only when you merge, so closing a pull request means the next pass picks up the same changes again.
Prerequisites
This guide assumes the following:
- You have a Port account and have completed the onboarding process.
- Port's GitHub Ocean integration is installed and ingesting repositories into the
githubRepositoryblueprint. - The Claude managed agents integration is installed. Actions processing is on for a Hosted by Port install. A self-hosted install has to turn it on. See Claude managed agents.
- You have an Anthropic API key with access to managed agents.
- You can create fine-grained GitHub personal access tokens.
The GitHub Actions tab uses a backend repository and a Port API client ID and secret. See find your Port credentials.
Set up the data model
Port needs two places to put the wiki. techDoc is each page, linked to the repository it describes. wikiRun is a short log of each generation: which repository, how it finished, and where to look next. The dashboard later uses that log. Both tabs write to these blueprints.
- New blueprint
- Existing blueprint
Create the techDoc blueprint
techDoc relates each page to the repository that contains it. The TechDocs plugin uses that relation to scope the page list.
-
Go to the Data model page in Port.
-
Click + Blueprint.
-
Click the
{...}Edit JSON button. -
Copy and paste the following JSON configuration:
Tech Doc blueprint (click to expand)
{"identifier": "techDoc","title": "Tech Doc","icon": "Book","schema": {"properties": {"content": {"title": "Content","type": "string","format": "markdown","description": "The raw markdown content of the document"},"filePath": {"title": "File Path","type": "string","description": "Path to the file within the repository"},"folderPath": {"title": "Folder Path","type": "string","description": "Parent folder path (e.g. docs/wiki)"},"url": {"title": "URL","type": "string","format": "url","description": "Direct link to the file in the repository"},"lastUpdated": {"title": "Last Updated","type": "string","format": "date-time"},"archived": {"type": "boolean","title": "Archived","default": false}},"required": ["content"]},"mirrorProperties": {},"calculationProperties": {},"aggregationProperties": {},"relations": {"repository": {"title": "Repository","target": "githubRepository","required": true,"many": false}}} -
Click Create to save the blueprint.
Add a repository relation
If you already created techDoc from Manage and surface technical documentation, keep that blueprint. Add a relation to githubRepository so wiki pages can attach to the repository that holds docs/wiki/.
-
Go to the Data model page and open Tech Doc.
-
Click the
{...}Edit JSON button. -
Add this relation. If a
servicerelation is required, set"required": falseon it. This mapping setsrepositoryand does not setservice."repository": {"title": "Repository","target": "githubRepository","required": false,"many": false} -
Click Save.
Create the wikiRun blueprint
Each run writes one wikiRun entity. The managed agent path fills the session link, token counts, and cost. The GitHub Actions path fills the pull request and the workflow run.
-
Go to the Data model page.
-
Click + Blueprint.
-
Click the
{...}Edit JSON button. -
Copy and paste the following JSON configuration:
Wiki Run blueprint (click to expand)
{"identifier": "wikiRun","title": "Wiki Run","icon": "Book","schema": {"properties": {"mode": {"title": "Mode","type": "string","enum": ["full", "update"]},"status": {"title": "Status","type": "string","enum": ["completed", "pr_opened", "no_changes", "rejected", "failed"],"enumColors": {"completed": "green","pr_opened": "green","no_changes": "blue","rejected": "red","failed": "red"}},"pullRequestUrl": {"title": "Pull request","type": "string","format": "url"},"commitRange": {"title": "Commit range","type": "string"},"runUrl": {"title": "Run","type": "string","format": "url"},"sessionUrl": {"title": "Claude session","type": "string","format": "url"},"inputTokens": {"title": "Input tokens","type": "number"},"outputTokens": {"title": "Output tokens","type": "number"},"totalCost": {"title": "Total cost (USD)","type": "number"}},"required": ["mode", "status"]},"mirrorProperties": {},"calculationProperties": {},"aggregationProperties": {},"relations": {"repository": {"title": "Repository","target": "githubRepository","required": true,"many": false}}} -
Click Create to save the blueprint.
completed means the Claude session finished. It does not confirm that a pull request opened. Find that pull request in the repository, using the docs: title prefix.
Generate the wiki
The Claude managed agents tab is the setup to follow. A Port workflow starts the session, the session opens the pull request, and a schedule refreshes the repositories you enroll. Use the GitHub Actions path when you want that same wiki to run from a backend repository.
- Claude managed agents
- GitHub Actions
The blueprints above are shared by both paths. This path creates the Claude agent, the workflow that triggers the agent, and the hourly refresh.
The Claude managed agents integration is in beta, so its API and behavior can change. The GitHub Actions tab runs this same wiki from a backend repository.
Set up the managed agent
Claude writes the wiki inside a managed agent session. The session clones the repository, writes docs/wiki/, and opens the pull request. Port records the run from the session result.
Create the GitHub tokens
We use two fine-grained personal access tokens, and they live in two different places. The integration token clones and pushes. The vault token is what GitHub MCP uses to open pull requests.
Create both under GitHub > Settings > Developer settings > Fine-grained personal access tokens. Limit each token to the repositories you want documented.
| Token | Used for | Repository access | Permissions |
|---|---|---|---|
| Integration token | Cloning and pushing | The repositories you enroll | Contents: Read and write. Metadata: Read-only. |
| Vault token | Opening pull requests | The repositories you enroll | Pull requests: Read and write. Metadata: Read-only. |
The account that owns each token needs write access to every repository you enroll. A token cannot do more than its owner can.
Set up the Claude integration
- Install the Claude managed agents integration, if it is not installed yet.
- Set its GitHub authorization token to the integration token from the table above.
- Copy the installation ID from the integration's Manage panel. The workflows below ask for it.
Upload the deepwiki skill
The deepwiki skill is what powers the wiki. Claude loads it as a skill, reads the repository, and follows its steps to write the pages.
We keep the skill on one reviewed commit, 887304e68ff3711a964bcb4b3f33e47ad53c4405 (version 1.0.4), so generation stays on a version you have already looked at. Upload that commit's wiki folder to the Skills API, using your Anthropic API key.
Clone the reviewed commit into /tmp, then confirm the wiki folder is present:
SHA=887304e68ff3711a964bcb4b3f33e47ad53c4405
rm -rf /tmp/deepwiki-skill
git clone -q https://github.com/natsu1211/deepwiki-skill.git /tmp/deepwiki-skill
git -C /tmp/deepwiki-skill checkout -q "$SHA"
cd /tmp/deepwiki-skill/.apm/skills
find wiki -type f | sort
- Claude console
- Terminal
Upload from the Claude console
-
Switch to the workspace that the integration's API key belongs to.
-
Upload the
wikifolder from/tmp/deepwiki-skill/.apm/skills/.SKILL.mdhas to sit directly insidewiki/. -
Name the skill
deepwiki-skillplus the first 7 characters of the commit, and copy its ID. The ID starts withskill_.
Upload from the terminal
This upload uses curl and jq.
-
Set your API key without saving it to your shell history:
read -rs ANTHROPIC_API_KEY && export ANTHROPIC_API_KEY -
From
/tmp/deepwiki-skill/.apm/skills, upload the folder. Each file keeps its path underwiki/:ARGS=()while IFS= read -r f; doARGS+=(-F "files[]=@${f};filename=${f}")done < <(find wiki -type f | sort)curl -sS https://api.anthropic.com/v1/skills \-H "x-api-key: $ANTHROPIC_API_KEY" \-H "anthropic-version: 2023-06-01" \-H "anthropic-beta: skills-2025-10-02" \-F "display_title=deepwiki-skill ${SHA:0:7}" \"${ARGS[@]}" | tee /tmp/skill-create.json | jq .SKILL_ID=$(jq -r .id /tmp/skill-create.json)echo "$SKILL_ID"Keep the value that starts with
skill_. The beta header is the one in Anthropic's skills API at the time of writing. If the request is rejected, check that page for the current header.
When a newer commit is stable, or you have reviewed it and you are happy with it, upload that commit and update the skill ID on the agent.
Create the environment
- In the Claude console, under Managed agents, open Environments.
- Click + Create environment.
- Under Hosting, leave Cloud selected. This choice cannot be changed after you create the environment.
- In Name, enter
wiki-environment. - In Description, enter
Runs the wiki agent. Needs package installs and network access to github.com, pypi.org, and registry.npmjs.org. - Open Networking and select Limited.
- Check Allow package managers and Allow MCP servers.
- In Allowed hosts, enter one host per line:
github.com,pypi.org, andregistry.npmjs.org. - Click Create environment.

Resync the Claude managed agents integration. The environment then shows up in Port as a claude_environment entity, which Generate wiki (managed agent) asks you to pick. Allow package managers is what lets the session install @mermaid-js/mermaid-cli and the skill's Python packages. The agent instructions tell it to do that before it checks diagrams.
Create the vault
The vault holds the token that opens pull requests.
- Claude console
- Terminal
- In the Claude console, under Managed agents, click Credential vaults.
- Click Create vault, enter
GitHub PR token, and click Continue. - Enter
GitHub PATas the credential name. - Under Type, choose Bearer token.
- Under MCP server, search for GitHub MCP and select it.
- Enter the vault token from the table above, and click Add credential.

Paste this in your terminal to create the vault and add the GitHub credential:
curl -s https://api.anthropic.com/v1/vaults \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "anthropic-beta: managed-agents-2026-04-01" \
-H "Content-Type: application/json" \
-d '{"display_name": "GitHub PR token"}' | jq -r .id
curl -s https://api.anthropic.com/v1/vaults/<VAULT_ID>/credentials \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "anthropic-beta: managed-agents-2026-04-01" \
-H "Content-Type: application/json" \
-d '{
"display_name": "GitHub PAT",
"auth": {
"type": "static_bearer",
"mcp_server_url": "https://api.githubcopilot.com/mcp/",
"token": "<VAULT_TOKEN>"
}
}'
Replace <VAULT_ID> with the first command's output, and <VAULT_TOKEN> with the vault token from the table above.
After the next resync, the vault shows up in Port as a claude_vault entity.
Set up wiki resources in Port
These workflows live in Port. One creates the agent. The other is the button people click to start a wiki.
Create the wiki agent
The agent holds the skill, the tools it can use, and its standing instructions.
- Go to the workflows page.
- Click + Workflow.
- For Name, enter
Create wiki agent, then click Confirm. - Click the
{...}button and paste the JSON below. - Replace
<YOUR_CLAUDE_INTEGRATION_INSTALLATION_ID>.
Create wiki agent workflow (click to expand)
{
"identifier": "create_wiki_agent",
"title": "Create wiki agent",
"icon": "Claude",
"description": "One-time setup. Creates the Claude agent that writes docs/wiki/ and opens pull requests.",
"allowAnyoneToViewRuns": true,
"nodes": [
{
"identifier": "trigger",
"title": "Create wiki agent",
"config": {
"type": "SELF_SERVE_TRIGGER",
"userInputs": {
"properties": {
"name": {
"title": "Agent name",
"type": "string",
"default": "Wiki generator"
},
"model": {
"title": "Model",
"type": "string",
"enum": ["claude-sonnet-5-5", "claude-haiku-5-5"],
"default": "claude-sonnet-5-5"
},
"skillId": {
"title": "Skill ID",
"description": "The skill_ ID returned when the deepwiki skill was uploaded.",
"type": "string"
},
"systemPrompt": {
"title": "System prompt",
"description": "Paste the agent instructions from this guide.",
"type": "string",
"format": "multi-line"
}
},
"required": ["name", "model", "skillId", "systemPrompt"],
"order": ["name", "model", "skillId", "systemPrompt"]
},
"actionCardButtonText": "Create",
"executeActionButtonText": "Create",
"published": true,
"permissions": { "roles": ["Admin"] }
}
},
{
"identifier": "create_agent",
"title": "Create wiki agent",
"config": {
"type": "INTEGRATION_ACTION",
"installationId": "<YOUR_CLAUDE_INTEGRATION_INSTALLATION_ID>",
"integrationProvider": "claude-managed-agents",
"integrationInvocationType": "create_agent",
"integrationActionExecutionProperties": {
"name": "{{ .outputs.trigger.name }}",
"model": "{{ .outputs.trigger.model }}",
"systemPrompt": "{{ .outputs.trigger.systemPrompt }}",
"enablePortMcp": false,
"config": {
"description": "Writes docs/wiki/ for one repository and opens a pull request for review.",
"mcp_servers": "{{ [{\"type\": \"url\", \"name\": \"github\", \"url\": \"https://api.githubcopilot.com/mcp/\"}] }}",
"tools": "{{ [{\"type\": \"agent_toolset_20260401\"}, {\"type\": \"mcp_toolset\", \"mcp_server_name\": \"github\", \"default_config\": {\"enabled\": false}, \"configs\": [{\"name\": \"create_pull_request\", \"enabled\": true, \"permission_policy\": {\"type\": \"always_allow\"} }, {\"name\": \"list_pull_requests\", \"enabled\": true, \"permission_policy\": {\"type\": \"always_allow\"} }]} ] }}",
"skills": "{{ [{\"type\": \"custom\", \"skill_id\": .outputs.trigger.skillId}] }}"
}
},
"onFailure": "terminate"
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "create_agent"
}
]
}
- Click Apply changes.
Run Create wiki agent. Enter the agent name, the model, and the skill ID from the upload. Paste the instructions below into System prompt.Agent instructions (click to expand)
Create the generate wiki workflow
This is the button people click. It asks which repository to document, which mode to run, and which agent, environment, and vault to use. It then starts a session and records the run. They can also run it as a day-2 action on the repository, which selects that repository for them.
- Go to the workflows page.
- Click + Workflow.
- For Name, enter
Generate wiki (managed agent), then click Confirm. - Click the
{...}button and paste the JSON below. - Replace
<YOUR_CLAUDE_INTEGRATION_INSTALLATION_ID>and<YOUR_GITHUB_ORG>.
Generate wiki workflow (click to expand)
{
"identifier": "generate_wiki_managed",
"title": "Generate wiki (managed agent)",
"icon": "Book",
"description": "Runs the Claude managed agent for one repository. The agent writes docs/wiki/ and opens a pull request for review. Nothing is merged automatically.",
"allowAnyoneToViewRuns": true,
"nodes": [
{
"identifier": "trigger",
"title": "Generate wiki",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "repository"
}
],
"userInputs": {
"properties": {
"repository": {
"title": "Repository",
"type": "string",
"format": "entity",
"blueprint": "githubRepository"
},
"agentId": {
"title": "Agent",
"type": "string",
"format": "entity",
"blueprint": "claude_agent"
},
"environmentId": {
"title": "Environment",
"type": "string",
"format": "entity",
"blueprint": "claude_environment"
},
"vaultIds": {
"title": "Vaults",
"description": "The vault that holds the GitHub token used to open pull requests.",
"type": "array",
"items": {
"type": "string",
"format": "entity",
"blueprint": "claude_vault"
}
},
"mode": {
"title": "Mode",
"description": "full: generate the whole wiki, for the first run. update: refresh the pages affected by changes since the last documented commit.",
"type": "string",
"enum": ["full", "update"],
"default": "full"
}
},
"required": ["repository", "agentId", "environmentId", "vaultIds", "mode"],
"order": ["repository", "agentId", "environmentId", "vaultIds", "mode"]
},
"actionCardButtonText": "Generate",
"executeActionButtonText": "Generate",
"published": true,
"permissions": { "roles": ["Member", "Admin"] }
}
},
{
"identifier": "trigger_agent",
"title": "Run wiki agent",
"config": {
"type": "INTEGRATION_ACTION",
"installationId": "<YOUR_CLAUDE_INTEGRATION_INSTALLATION_ID>",
"integrationProvider": "claude-managed-agents",
"integrationInvocationType": "trigger_agent",
"integrationActionExecutionProperties": {
"agentId": "{{ .outputs.trigger.agentId }}",
"environmentId": "{{ .outputs.trigger.environmentId }}",
"prompt": "{{ \"Mode: \" + .outputs.trigger.mode + \". Repository: \" + .outputs.trigger.repository + \". Follow the wiki procedure in your instructions.\" }}",
"enablePortMcp": false,
"reportSessionStatus": true,
"config": {
"title": "{{ \"Wiki \" + .outputs.trigger.mode + \": \" + .outputs.trigger.repository }}",
"vault_ids": "{{ .outputs.trigger.vaultIds // [] }}",
"resources": "{{ [{\"type\": \"github_repository\", \"url\": (\"https://github.com/<YOUR_GITHUB_ORG>/\" + .outputs.trigger.repository)}] }}"
}
},
"onFailure": "continue"
}
},
{
"identifier": "record_run",
"title": "Record wiki run",
"config": {
"type": "UPSERT_ENTITY",
"blueprintIdentifier": "wikiRun",
"mapping": {
"identifier": "{{ \"wiki-\" + (.outputs.trigger_agent.sessionId // (now | tostring | gsub(\"[.]\"; \"\"))) }}",
"title": "{{ \"Wiki \" + .outputs.trigger.mode + \": \" + .outputs.trigger.repository }}",
"properties": {
"mode": "{{ .outputs.trigger.mode }}",
"status": "{{ if .outputs.trigger_agent.sessionId then \"completed\" else \"failed\" end }}",
"sessionUrl": "{{ .outputs.trigger_agent.url // \"\" }}",
"inputTokens": "{{ .outputs.trigger_agent.inputTokens // 0 }}",
"outputTokens": "{{ .outputs.trigger_agent.outputTokens // 0 }}",
"totalCost": "{{ .outputs.trigger_agent.costUsd // 0 }}"
},
"relations": {
"repository": "{{.outputs.trigger.repository }}"
}
},
"onFailure": "terminate"
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "trigger_agent"
},
{
"sourceIdentifier": "trigger_agent",
"targetIdentifier": "record_run"
}
]
}
- Click Apply changes.
The Run wiki agent node waits for the session to finish so it can store the token counts and cost. That wait needs live session webhooks, which a Hosted by Port install registers for you. On a self-hosted install without live webhooks, set reportSessionStatus to false on that node. Otherwise the run waits indefinitely and no wiki run is recorded. See trigger agent.
The session mounts https://github.com/<YOUR_GITHUB_ORG>/<repository>. The GitHub integration stores the repository name on its own, so the template adds your organization when it builds that URL.
Refresh the wiki automatically
After the first wiki is merged, a scheduled workflow is what stops it from drifting. Once an hour, Port starts one session that mounts every enrolled repository, and Claude refreshes each repository that has changed.
Create the refresh workflow
- Go to the workflows page.
- Click + Workflow.
- For Name, enter
Refresh wiki, then click Confirm. - Click the
{...}button and paste the JSON below. - Replace the placeholders with your installation ID, agent ID, environment ID, and vault ID. Copy those identifiers from the entities in Port. In
resources, leave a single entry and set its URL to the repository you are about to enroll:https://github.com/<YOUR_GITHUB_ORG>/<YOUR_REPOSITORY>.
The schedule is 17 * * * *, which runs at 17 minutes past every hour, in UTC. See schedule triggers. The same webhook requirement applies here. On a self-hosted install without live webhooks, set reportSessionStatus to false on Refresh enrolled wikis.Refresh wiki workflow (click to expand)
- Click Apply changes. Do not run the workflow yet. A run before the first wiki exists starts a full generation, because a missing
docs/wiki/.last-syncedis treated as a first wiki.
Guardrails
The agent writes a branch and opens a pull request. It cannot merge. Nothing in this path rejects a file outside docs/wiki/ after the session commits, so put these controls on before the first run.
- Protect the default branch. On the repository, open Settings > Rules > Rulesets, create a ruleset for the default branch, and turn on Require a pull request before merging, Require approvals, Block force pushes, and Restrict deletions.
- Review every pull request. Check that the changed files are only under
docs/wiki/. - Scope the tokens. Give the integration token and the vault token access to the enrolled repositories only.
- Assign owners to the wiki. Add a
CODEOWNERSentry such asdocs/wiki/ @your-team, so wiki pull requests reach the right reviewers.
Enroll a repository
-
Run Generate wiki (managed agent) on the repository in
fullmode. Select the repository, the agent, the environment, and the vault.
-
Review the pull request. Its title starts with
docs:. Merge it after someone has read it. -
Add a
github_repositoryentry for that repository to the refresh workflow'sresources, and save. Remove any URL you do not want refreshed.
Show the pages in Port
Once the first wiki pull request is merged, bring the pages into Port. People read them on the dashboard, and they can ask Port AI about them.
Ingest the pages
Each markdown page under the wiki becomes a tech doc, linked to the repository it came from. You add this mapping once. After that, a newly enrolled repository shows up on its own once its wiki is merged.
-
Go to the connectors page and open your GitHub integration.
-
Open the Mapping tab.
-
Click the
{...}Edit YAML button. -
Add the following entry to the
resourceslist:Wiki page mapping (click to expand)
- kind: fileselector:query: >-(.path | startswith("docs/wiki/"))and ((.path | contains("/_context/")) | not)and ((.path | contains("/_reports/")) | not)files:- path: 'docs/wiki/**/*.md'skipParsing: trueport:entity:mappings:identifier: '.repository.name + "-wiki-" + (.path | sub("^docs/wiki/"; "") | gsub("/"; "-") | gsub("[.]"; "-"))'title: '.path | split("/") | .[-1] | sub("[.]md$"; "") | sub("^[0-9]+_"; "") | gsub("_"; " ")'blueprint: '"techDoc"'properties:content: .contentfilePath: .pathfolderPath: .path | split("/") | .[:-1] | join("/")url: '.repository.html_url + "/blob/" + .repository.default_branch + "/" + .path'lastUpdated: >-(try (.commit.commit.committer.date // .commit.commit.author.date //.commit.committer.date // .commit.author.date) catch null)// .repository.pushed_at // .repository.updated_atrelations:repository: .repository.name -
Click Save & Resync.
The repository relation uses the repository name, which is the identifier the GitHub integration creates.
If you already ingest **/*.md into techDoc, add and (.path | startswith("docs/wiki/") | not) to that older block. Otherwise every wiki page shows up twice.
Add the TechDocs plugin
The plugin is how someone reads the wiki, with a folder tree instead of a flat list of entities. Install it here, then add it to the wiki dashboard in the next section, where it lists every tech doc in the catalog.
The TechDocs plugin does not render images embedded in markdown.
- Plugins library
- Plugin repository
Install the TechDocs plugin
- Click on your profile picture
and select Settings.
- Open Plugins and click Library.
- Find TechDocs and click Add plugin.
-
Clone Port's plugin repository.
-
Enter the
techdocsfolder. -
Build the plugin and upload it with the Port plugins CLI:
npm installnpm run buildport-plugins upload \--file dist/index.html \--identifier techdocs-port-plugin \--title "TechDocs Viewer" \--params "$(cat upload-params.json)" \--upsert
Once pages are in the catalog, they also show up in global search and in Port AI. Manage and surface technical documentation covers asking questions against them.
Create a documentation dashboard
This is where people read the wikis. The table lists Generate wiki (managed agent) runs: the session, the status, and the cost. Hourly refreshes do not add a row. Follow those in the Claude session for Refresh wiki.
- Go to the catalog page in Port.
- In the left sidebar, click +, then New dashboard.
- Name the dashboard Technical documentation, choose the Book icon, and add a short description such as "Wikis generated for our repositories".
- Click Create.
Add the TechDocs plugin to this dashboard. It lists every tech doc in the catalog.
- Click + Widget, select Custom, and choose TechDocs Viewer.
- Title it
TechDocs Viewer. - Select
TechDocas the TechDoc blueprint andGitHub Repositoryas the Tech Doc related blueprint. - Click Create.
Then add a table of recent generations, so you can open the session and see the cost of each run.
- Click + Widget and select Table.
- Title it
Wiki runsand choose the Wiki Run blueprint. - Click Save.
- Show the repository, mode, status, Claude session, and total cost columns, and sort by creation time so the newest run is first. See table customization.
Let's test the workflow
Enrollment already ran Generate wiki (managed agent) and merged the pull request. Confirm that run in Port, then run the hourly check once.
-
Open the Technical documentation dashboard and find the row in Wiki runs. The status is
completed, and the row has the session link, the token counts, and the cost. -
After the GitHub integration syncs, the wiki pages appear in the TechDocs plugin on that dashboard.
-
Run Refresh wiki once. The repository should report up to date.
Limitations
- Beta. The integration and the managed agents API can change. Re-check this setup after either one changes.
- No pull request link on the run. The wiki run stores the session, the token counts, and the cost. Find the pull request in the repository by the
docs:title prefix. - The hourly refresh has a cost. A session bills for tokens and for time, including a pass where every repository is already up to date. Repositories with nothing to do are checked and then skipped.
- The enrolled list lives on the workflow. The scheduled session mounts the repositories listed in its resources.
- Five pull requests per run. A large batch of changes takes more than one hourly run to catch up.
Set up the wiki backend
This path runs the wiki from GitHub Actions. We will create one repository, give it the keys it needs, and add the workflows. The application repositories you document do not get workflow files, secrets, or variables of their own.
Create the backend repository
Create a repository named wiki-backend in your GitHub organization. Every wiki, the first one and the hourly refreshes, runs from here.
Create GitHub access tokens
Claude reads the repository it is documenting, and repository files can contain anything, including text that tries to misuse a credential. So we use two fine-grained personal access tokens, and only one of them is ever shown to Claude.
Create both under GitHub > Settings > Developer settings > Fine-grained personal access tokens.
| Token | Secret name | Repository access | Permissions |
|---|---|---|---|
| Checkout, push, and pull requests | PORT_GITHUB_TOKEN | Every enrolled target repository. Leave wiki-backend off this token. | Contents: Read and write. Pull requests: Read and write. Issues: Read and write (the workflow creates the docs:wiki label). Metadata: Read-only. |
| Hourly sync | WIKI_SYNC_TOKEN | wiki-backend and every enrolled target repository. | Actions: Read and write. Contents: Read. Pull requests: Read. Metadata: Read-only. |
Claude receives PORT_GITHUB_TOKEN. Keep that token on the repositories you want documented. Leave wiki-backend, and the rest of the organization, off it. The hourly token never goes to Claude.
Add actions secrets
In wiki-backend, open Settings > Secrets and variables > Actions and click New repository secret for each row below.
| Name | What to paste |
|---|---|
ANTHROPIC_API_KEY | Your Anthropic API key. The writing step uses it. |
PORT_GITHUB_TOKEN | The token that checks out the target repository and opens the pull request. |
PORT_CLIENT_ID | Your Port client ID. |
PORT_CLIENT_SECRET | Your Port client secret. |
WIKI_SYNC_TOKEN | The token the hourly check uses to read repositories and start a refresh. |
You do not need GitHub variables. The skill's repository and pinned commit live in the workflow file, so changing them means a reviewed pull request.
Backend folder structure
When the steps below are done, wiki-backend contains these four files. Each following section fills one in.
wiki-backend/
├── repos.yaml
├── scripts/
│ └── wiki_sync.py
└── .github/workflows/
├── wiki-backend.yaml
└── wiki-sync.yaml
Configure enrolled repositories
repos.yaml is the list the hourly check watches. A repository joins that list only after three things are true: it is listed here, both tokens can see it, and someone has merged its first wiki.repos.yaml (click to expand)
Pin the deepwiki skill
The deepwiki skill is what powers the wiki. Claude loads it as a skill, reads the repository, and follows its steps to write the pages.
We keep the skill on one reviewed commit, 887304e68ff3711a964bcb4b3f33e47ad53c4405 (version 1.0.4), so generation stays on a version you have already looked at. When a newer commit is stable, or you have reviewed it and you are happy with it, update that commit in a pull request.
Add the generation workflow
In wiki-backend, create .github/workflows/wiki-backend.yaml and paste the workflow below. This is the file Port runs when someone clicks Generate wiki, and the same file the hourly check runs when the code has moved on.wiki-backend.yaml (click to expand)
A single wiki is capped at an hour, so a stuck run cannot keep spending. If someone starts a second wiki for the same repository while the first is still going, it waits its turn.
Refresh the wiki automatically
After the first wiki is merged, this workflow is what stops it from drifting. About once an hour it looks at each repository on the list. When real code has landed since the docs were last updated, it asks Claude to refresh the affected pages and open another pull request.
In wiki-backend, create scripts/wiki_sync.py and .github/workflows/wiki-sync.yaml from the files below.scripts/wiki_sync.py (click to expand)
wiki-sync.yaml (click to expand)
The check runs at 17 minutes past every hour. When you want to see what it would do without starting any work, open Actions > Wiki sync > Run workflow and turn on the dry run.
Set up wiki resources in Port
The backend writes the pages. In Port they live in the context lake, where people find them with Port AI and the wiki dashboard, and where they ask for a new wiki.
Ingest the pages
Each markdown page under the wiki becomes a tech doc, linked to the repository it came from. You add this mapping once. After that, a newly enrolled repository shows up on its own once its wiki is merged.
-
Go to the connectors page and open your GitHub integration.
-
Open the Mapping tab.
-
Click the
{...}Edit YAML button. -
Add the following entry to the
resourceslist:Wiki page mapping (click to expand)
- kind: fileselector:query: >-(.path | startswith("docs/wiki/"))and ((.path | contains("/_context/")) | not)and ((.path | contains("/_reports/")) | not)files:- path: 'docs/wiki/**/*.md'skipParsing: trueport:entity:mappings:identifier: '.repository.name + "-wiki-" + (.path | sub("^docs/wiki/"; "") | gsub("/"; "-") | gsub("[.]"; "-"))'title: '.path | split("/") | .[-1] | sub("[.]md$"; "") | sub("^[0-9]+_"; "") | gsub("_"; " ")'blueprint: '"techDoc"'properties:content: .contentfilePath: .pathfolderPath: .path | split("/") | .[:-1] | join("/")url: '.repository.html_url + "/blob/" + .repository.default_branch + "/" + .path'lastUpdated: >-(try (.commit.commit.committer.date // .commit.commit.author.date //.commit.committer.date // .commit.author.date) catch null)// .repository.pushed_at // .repository.updated_atrelations:repository: .repository.name -
Click Save & Resync.
The repository relation uses the repository name, which is the identifier the GitHub integration creates.
If you already ingest **/*.md into techDoc, add and (.path | startswith("docs/wiki/") | not) to that older block. Otherwise every wiki page shows up twice.
Add the TechDocs plugin
The plugin is how someone reads the wiki, with a folder tree instead of a flat list of entities. Install it here, then add it to the wiki dashboard in the next section, where it lists every tech doc in the catalog.
The TechDocs plugin does not render images embedded in markdown.
- Plugins library
- Plugin repository
Install the TechDocs plugin
- Click on your profile picture
and select Settings.
- Open Plugins and click Library.
- Find TechDocs and click Add plugin.
-
Clone Port's plugin repository.
-
Enter the
techdocsfolder. -
Build the plugin and upload it with the Port plugins CLI:
npm installnpm run buildport-plugins upload \--file dist/index.html \--identifier techdocs-port-plugin \--title "TechDocs Viewer" \--params "$(cat upload-params.json)" \--upsert
Once pages are in the catalog, they also show up in global search and in Port AI. Manage and surface technical documentation covers asking questions against them.
Create a documentation dashboard
This is where people read the wikis, and see which generations are still waiting on a review.
- Go to the catalog page in Port.
- In the left sidebar, click +, then New dashboard.
- Name the dashboard Technical documentation, choose the Book icon, and add a short description such as "Wikis generated for our repositories".
- Click Create.
Add the TechDocs plugin to this dashboard. It lists every tech doc in the catalog.
-
Click + Widget, select Custom, and choose TechDocs Viewer.
-
Title it
TechDocs Viewer. -
Select
TechDocas the TechDoc blueprint andGitHub Repositoryas the Tech Doc related blueprint. -
Click Create.
Then add a table of recent generations, so you can see whether the hourly check is keeping up and which pull requests are still open.
-
Click + Widget and select Table.
-
Title it
Wiki runsand choose the Wiki Run blueprint. -
Click Save.
-
Show the repository, mode, status, and pull request columns, and sort by creation time so the newest run is first. See table customization.
Create the generate wiki workflow
This is the button users click in Port. It asks which repository, and whether to write the whole wiki or refresh part of it, then asks GitHub to start the backend workflow. They can also run it as a day-2 action on the repository, which selects that repository for them.
- Go to the workflows page.
- Click + Workflow.
- For Name, enter
Generate wiki, then click Confirm. - Click the
{...}button and paste the JSON below. - Replace
<YOUR_GITHUB_OCEAN_INTEGRATION_ID>and<YOUR_GITHUB_ORG>.
The installation ID is on the GitHub integration's Manage panel. See finding your installation ID.Generate wiki workflow (click to expand)
- Click Apply changes.
GitHub checks the repository out as owner/name. The GitHub integration stores the repository name on its own, so the template adds your organization on the repository input. The wiki run relates back to that name.
Let's test the workflow
Run Generate wiki for one repository, merge the pull request it opens, and confirm the pages show up on the documentation dashboard.
-
Go to the workflows page and click Generate wiki.
-
Select the repository, set Mode to
full, and click Generate.
-
When the run finishes, open the Technical documentation dashboard and find the new row in Wiki runs. The pull request link is on that row.
-
Merge the pull request.
-
After the GitHub integration syncs, the wiki pages appear in the TechDocs plugin on the same dashboard.