# Lw Init

> Initialize a new LLM Wiki workspace with raw/, wiki/, profiles/, and .llm-wiki/ state files, plus optional outputs/ artifact storage when needed. Usage: /lw-init <workspace-path>

- Skill: `geeksfino/lw-init` (Agent Skill)
- Install (CLI): `npx skillmds@latest add geeksfino/lw-init`
- Raw SKILL.md: https://api.skillmd.com/api/skills/geeksfino/lw-init/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: geeksfino (https://skillmd.com/u/geeksfino)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/geeksfino/lw-init

---


# LLM Wiki Init

Initialize a project-agnostic wiki workspace.

## Purpose

`lw-init` is the canonical initialization contract.
It defines what every new LLM Wiki workspace must contain.

For a more operational repo-backed first run, pair it with:
- `scaffolds/repo-backed-starter/`
- `scripts/bootstrap-repo-backed-wiki.sh`
- the correct guide under `integrations/<agent>/`

## Steps
1. Create the workspace root if missing.
2. Create:
   - `raw/web/`
   - `raw/pdfs/`
   - `raw/images/`
   - `raw/notes/`
   - `raw/repo/`
   - `raw/changes/`
   - `wiki/`
   - `wiki/concepts/`
   - `wiki/entities/`
   - `wiki/topics/`
   - `wiki/comparisons/`
   - `wiki/queries/`
   - `wiki/maps/`
   - `wiki/archive/`
   - `profiles/`
   - `.llm-wiki/`
3. Create `outputs/` only when the workspace expects non-canonical artifacts such as exports, slides, charts, reports, or automation logs.
4. Write `wiki/index.md` with empty sections.
5. Write `wiki/log.md` with a creation entry.
6. Write `.llm-wiki/manifest.json` with an empty generic shape:
   ```json
   {
     "repo_sync": {
       "enabled": false,
       "repo_path": null,
       "repo_remote": "origin",
       "default_branch": "main",
       "provider": null,
       "repo_slug": null,
       "last_checked_at": null,
       "last_seen_default_branch_sha": null,
       "last_compiled_sha": null,
       "last_compiled_at": null,
       "last_repo_summary": null,
       "pending_changes": [],
       "processed_change_units": [],
       "active_background_sync": null,
       "last_sync_report": null,
       "fallback_policy": {
         "retry_github_api": 3,
         "fallback_to_git_only": true
       }
     },
     "staged_artifacts": []
   }
   ```
7. Write `.llm-wiki/reflect_state.json` as `{ "last_reflected_at": null, "synthesized_articles": [] }`.
8. Write `.llm-wiki/profile.json` with a placeholder pointing to a workspace-local profile markdown file.
9. If the wiki is being created from a git repo, create `profiles/project-profile.md` from the shared profile template and tell the operator to fill in the `repo_sync` block.
10. If a more operational first-run baseline is desired, copy or adapt starter templates from `scaffolds/repo-backed-starter/` for:
   - `.llm-wiki/manifest.json`
   - `.llm-wiki/profile.json`
   - `.llm-wiki/reflect_state.json`
   - `wiki/SCHEMA.md`
   - `wiki/index.md`
   - `wiki/log.md`
11. Copy or adapt agent instruction templates for `AGENTS.md` and, when useful, `CLAUDE.md`, `SOUL.md`, and `IDENTITY.md`.
12. Print the initialized path and the next required setup steps, including which integration guide under `integrations/<agent>/` to follow.

## Repo-backed initializer contract

When used for a repo-backed wiki, `lw-init` should ensure the workspace is ready for these next steps:
1. fill in the workspace-local project profile under `profiles/`
2. point `.llm-wiki/profile.json` at that profile using a relative path
3. install the relevant agent adapter files
4. if the user has only a **Git URL**, run `lw-clone-repo` (or bootstrap with `--repo-url`) to create `raw/upstream` and bind `repo_sync`; otherwise set `repo_path` to an existing checkout
5. run `lw-sync-repo` for first inspection
6. continue into ingest, compile, lint, and reflect

## Rules
- Keep compiled content under `wiki/`, not at repository root.
- Keep staged inputs under `raw/`.
- Keep state under `.llm-wiki/`.
- Treat `outputs/` as optional non-canonical artifact storage, not core wiki structure.
- Keep the active profile workspace-local and referenced through a relative path in `.llm-wiki/profile.json`.

