# Channel adapter  -  Wiki

> Detailed contract for the `wiki` channel of `/multi-agent:channels`. Split out of `channels.md` in v8.0.0; the parent doc keeps a one-line summary and a link here. Full Case A/Case B handling lives in `$HOME/.claude/multi-agent-refs/wiki-capture.md`.

The Wiki adapter generates component documentation pages  -  main page, platform sub-pages (iOS / Android), screenshots, and index updates. It is the only channel gated by **task type** (`component` only) and the only one that writes to a separate repo (the wiki repo configured in `figma-config.json`).

## Precondition gate

```
state.taskType === "component"  AND  figmaConfig.wiki.enabled === true
```

If both are met → **Case A** (preconditions met)  -  proceed to scope multi-select.
Otherwise → **Case B** (preconditions missing)  -  show the menu from `$HOME/.claude/multi-agent-refs/wiki-capture.md` (setup / skip / disable / manual-note).

In multi-repo tasks, wiki scope is the **primary** repo's `figma-config.wikiRepo` (single repo). Extras are not written to wiki  -  their PRs link back via the `## Related PRs` block injected by the PR adapter.

## Case A  -  scope multi-select

```
What should I update in the wiki?
  [x] Main component page    ({Name}.md  -  variants, overview, testing IDs, a11y, analytics)
  [x] iOS sub-page           ({Name}-iOS.md  -  initializer, usage, Code Connect)
  [x] Screenshots            (assets/  -  Figma LTR+RTL+light+dark + iOS snapshot)
  [x] Index updates          (_Sidebar.md + ComponentImplementationStatus.md)
  [ ] Other                  (skip the adapter dispatch, log "manual wiki override" to agent-log)
```

Defaults reflect `prefs.global.wikiScope`  -  saved selection from the prior run.

## Adapter dispatch

The selected scope routes to a platform skill:

| Platform | Skill | Notes |
|---|---|---|
| iOS / SwiftUI | `ai-ios-toolkit:figma-component-wiki` | Reads `Configuration` + `+Modifiers` from the source, captures Figma screenshots via MCP / REST, runs Snapshot tests for iOS dark/light/RTL. |
| Android / Compose | `ai-android-toolkit:figma-component-wiki` | Reads Compose composables + previews, runs Paparazzi screenshots if available, otherwise generates from layout inspector. |
| Generic | `ai-ios-toolkit:figma-component-wiki` (fallback) | Used when `state.platform` is unknown (fallback path  -  typically a flag). |

Full per-skill contract: `$HOME/.claude/multi-agent-refs/wiki-capture.md`.

## Wiki → Jira auto-link triad

When the adapter writes pages **AND** `state.jiraId` is set **AND** `prefs.global.wikiToJiraComment === true`, the adapter posts a humanizer-passed summary as an additional Jira comment (component name + variant count + wiki URL).

This comment is **independent** of the main `jira` channel comment  -  both can coexist on the same issue. Full triad contract: `$HOME/.claude/multi-agent-refs/issue-jira-triad.md`.

## Wiki adapter modes (figma-config.wiki.mode)

| Mode | Where pages live | When to choose |
|---|---|---|
| `submodule` | Wiki repo cloned under `Wiki/` inside the host project | Internal projects with Bitbucket  -  wiki repo is a submodule, commits land via PR. |
| `in-repo` | Pages directly in the host repo (`docs/components/<Name>/...`) | Open-source projects without a separate wiki  -  Markdown lives in `docs/`. |
| `github-wiki` | GitHub-managed `<repo>.wiki.git` | GitHub-hosted projects using the built-in Wiki feature. |
| `separate-repo` | Independent wiki repo cloned to `~/.cache/multi-agent/wiki/<repo>/` | When the wiki repo is not a submodule of the host but lives under the same org. |

Adapter implementation chooses the right git push target + commit message format based on `mode`. All four modes use the same content generation pipeline  -  only the commit / push step differs.

## Hard rules (must not regress)

- Wiki adapter is the **only** channel allowed to skip silently when its precondition gate fails. PR / Jira / Confluence always run when selected.
- Per the `figma-pipeline.md` rules, every component wiki page must include a variant matrix, accessibility identifiers, analytics events, and 3-layer test summary.
- Screenshots cover light/dark + LTR/RTL  -  wiki adapter refuses to commit if any quadrant is missing.
- Body content language follows `prefs.global.outputLanguage`. Code identifiers, file paths, type names, design token names, and Markdown formatting stay verbatim across languages (wiki pages are `.md` files  -  "wiki markup" in this doc set means Jira's dialect, which never appears here). The template (this doc) is English because `promptLanguage="en"` is locked.
- No decorative/emotive emoji or smileys (    ) in the page prose. Only functional/structural marks a fixed template defines are allowed.
- Autopilot always pauses at the channels menu (per `phase-7-report.md` autopilot contract)  -  even in autopilot mode the user gets to confirm wiki scope.
