---
name: support-wiki-bootstrap
description: "Use when a command needs to create the aiwiki directory and template-backed wiki scaffolding before work starts."
---

# Wiki Bootstrap

## Overview

Scaffold `aiwiki/` exactly once so gotchas, decisions, conventions, architecture notes, sessions, raw captures, proposals, and schemas have a home before workflow phases write to them.

**Announce at start:** "I'm using the support-wiki-bootstrap skill to ensure aiwiki is ready."

## Procedure

**Honor the opt-in flag.** Before doing anything, read `project.aiwiki_enabled` from `.claude/CLAUDE.md`. If the value is explicitly `false`, do NOT scaffold — return to the caller with:

```
aiwiki disabled — bootstrap skipped. The calling skill should surface an upgrade hint to the user if it would have written to aiwiki/, then continue without the capture leg.
```

Treat a missing key as `true` for backwards compatibility with projects that installed forge before P2-7 shipped. Treat an explicit `aiwiki_enabled: true`, or any project where `aiwiki/` already exists, as a directive to scaffold (existing-aiwiki projects should not regress just because the flag is missing).

If `.claude/templates/aiwiki/` is missing AND the user is asking to scaffold, surface the broken install and stop; the repair path is `npx @jamie-tam/forge init`. (A disabled project where the template was removed by `/setup` Step 4c is normal — the early-return above already covered it.)

The procedure is idempotent — safe to re-run on an existing `aiwiki/`. Re-running picks up new schema files shipped by later forge versions without disturbing user-edited content. Run from the project root:

```bash
# Directories: mkdir -p is a no-op when they exist.
mkdir -p aiwiki/{decisions,gotchas,conventions,architecture,sessions,raw,proposed,schemas,oracles}

# Schema files: copy any the template ships that the project is missing. Do not
# overwrite existing schemas — a user may have annotated them.
added_schemas=()
for src in .claude/templates/aiwiki/schemas/*.md; do
  name=$(basename "$src")
  if [ ! -f "aiwiki/schemas/$name" ]; then
    cp "$src" "aiwiki/schemas/$name"
    added_schemas+=("$name")
  fi
done

# Top-level files: create only if missing. CLAUDE.md may have been customized
# by the user via /setup; preserve it.
[ -f aiwiki/CLAUDE.md ]      || cp .claude/templates/aiwiki/CLAUDE.md.template aiwiki/CLAUDE.md
[ -f aiwiki/INDEX.md ]       || printf "# Wiki Index\n\n(Empty -- populated as work happens.)\n" > aiwiki/INDEX.md
[ -f aiwiki/projectbrief.md ] || printf "# %s\n\n(One-paragraph description.)\n" "$(basename "$(pwd)")" > aiwiki/projectbrief.md
```

Announce the outcome: report the freshly bootstrapped scaffold on first run, or `"aiwiki already initialized; added N new schema files: …"` (or `"aiwiki already initialized; nothing to add"`) on a re-run. Silent skips hide schema drift from users who installed forge before a schema landed.

If the calling command already knows the project name or stack, update `aiwiki/projectbrief.md` after bootstrapping rather than replacing an existing user-edited file.

## I/O Contract

| Field | Value |
|---|---|
| **Requires** | Project root with `.claude/templates/aiwiki/` installed AND `project.aiwiki_enabled` not explicitly `false` |
| **Produces** | When enabled: `aiwiki/` directories, `aiwiki/CLAUDE.md`, schema files, `aiwiki/INDEX.md`, `aiwiki/projectbrief.md`. When disabled: no-op return signaling the caller to skip writes. |
| **Feeds into** | Commands and skills that write gotchas, decisions, conventions, architecture notes, sessions, raw captures, or proposals |
| **Updates manifest** | None |
