> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kiwifs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Init templates

> Scaffold a new knowledge base from one of 12 starter templates with folders, sample pages, schemas, and workflows.

`kiwifs init` creates a knowledge directory from a built-in template. Pick the template closest to how you will use the knowledge base. Everything it creates is plain markdown plus a `.kiwi/` folder, so you can change any of it later.

```bash Terminal theme={null}
kiwifs init --template wiki --root ./knowledge
kiwifs serve --root ./knowledge
```

| Flag | Default | Description |
| - | - | - |
| `--template` | `kb` | Template name (see below) |
| `--root`, `-r` | `./knowledge` | Directory to initialize |

`init` never overwrites existing files, so it is safe to run on a folder that already has content.

## Available templates

| Template | Best for | What you get |
| - | - | - |
| `kb` | Curated knowledge bases | Article types, verification workflow, freshness checks |
| `wiki` | Team wikis | Onboarding, decision records, processes, reference docs |
| `memory` | Agent memory | Episodic and semantic pages, consolidation log |
| `tasks` | Task tracking | Task schema, status workflow with WIP limits, claim fields |
| `data` | Structured records | Collections, DQL dashboards, chart widgets |
| `cms` | Headless CMS | Blog, docs, pages, authors, editorial workflow, feeds |
| `runbook` | Ops and incident response | Severity and service frontmatter, execution staleness |
| `adr` | Architecture decision records | MADR format, status workflow, auto-numbering |
| `prompt` | Prompt registry | System and task prompts, eval rubrics |
| `research` | Literature and papers | Paper tracking, reading workflow, typed citation links |
| `log` | Append-only event logs | Daily files that reject overwrites |
| `blank` | Starting from scratch | Config, rules, and page templates only |

> [!NOTE]
>
> The old template names `knowledge` and `prompt-library` are now `memory` and `prompt`. Using an old name returns an error that names the new one.

## What every template includes

Every template, including `blank`, creates:

* `.kiwi/config.toml` — server, search, versioning, and auth settings. Some templates ship their own; the rest get the default config.
* `.kiwi/rules.md` — agent rules you can export with `kiwifs rules export`.
* `.kiwi/templates/` — page templates for decisions, meeting notes, onboarding, product specs, SOPs, and tasks.
* `.gitignore` — ignores `.kiwi/state/`, which holds rebuildable indexes.
* `README.md`

Every template except `blank` also includes two documents for agents:

* **`SCHEMA.md`** — folder layout, frontmatter fields, and naming conventions.
* **`playbook.md`** — step-by-step MCP tool sequences for common operations. `init` writes it to both the root and `.kiwi/playbook.md`. Agents receive it through `kiwi_context`.

See [Agent playbook](https://docs.kiwifs.com/concepts/agent-playbook.md).

### Export agent rules

Turn `.kiwi/rules.md` into the rules file your agent harness reads:

```bash Terminal theme={null}
kiwifs rules export --format cursor    # default
kiwifs rules export --format claude
kiwifs rules export --format agents
kiwifs rules export --format skill
kiwifs rules export --format openclaw
```

## Template reference

> [accordion] kb — knowledge base
>
> A curated knowledge base where articles are reviewed and kept fresh.
>
> **knowledge**
>
> **SCHEMA.md**
>
> **playbook.md**
>
> **index.md**
>
> **faq**
>
> **getting-started**
>
> **guides**
>
> **reference**
>
> **troubleshooting**
>
> **.kiwi**
>
> **config.toml**
>
> **schemas/article.json**
>
> **workflows/kb.json**
>
> * **Article frontmatter:** `title`, `type` (`how-to`, `troubleshooting`, `faq`, or `reference`), `owner`, `status`, `tags`, and `review_interval` are required.
> * **Workflow:** `draft → review → verified → stale → archived`. Stale articles can go back to review.
> * **Freshness:** the janitor flags pages older than `stale_days = 90`.

> [accordion] wiki — team wiki
>
> A team wiki with onboarding, decisions, and processes. Uses the default config.
>
> **knowledge**
>
> **SCHEMA.md**
>
> **playbook.md**
>
> **index.md**
>
> **welcome.md**
>
> **architecture.md**
>
> **how-we-work.md**
>
> **decisions**
>
> **onboarding**
>
> **processes**
>
> **reference**
>
> **.kiwi**
>
> `processes/` ships with deployment, dev setup, and incident response pages. `reference/` has an FAQ and a glossary.

> [accordion] memory — agent memory
>
> Episodic and semantic memory for agents. Agents write short-lived observations to `episodes/` and consolidate them into durable pages in `pages/`. Uses the default config.
>
> **knowledge**
>
> **SCHEMA.md**
>
> **playbook.md**
>
> **index.md**
>
> **log.md**
>
> **episodes**
>
> **pages**
>
> **.kiwi**
>
> Use `kiwi_remember` to write an episode, `kiwi_memory_report` to find episodes not yet consolidated, and `kiwi_forget` to mark a memory as superseded. See [Episodic memory](https://docs.kiwifs.com/concepts/episodic-memory.md).

> [accordion] tasks — task tracking
>
> Tasks as markdown files, ready for the kanban board and [claims](https://docs.kiwifs.com/concepts/claims.md). Uses the default config.
>
> **knowledge**
>
> **SCHEMA.md**
>
> **WORKFLOW\.md**
>
> **playbook.md**
>
> **index.md**
>
> **tasks**
>
> **.kiwi**
>
> **schemas/task.json**
>
> **workflows/tasks.json**
>
> * **Task frontmatter:** `type: task`, `title`, `status`, and `priority` (an integer) are required. Optional fields include `category`, `effort`, `assignee`, `parent`, `blocked-by`, `due`, and claim fields such as `claimed-by` and `lease-expires`. Workflow actions read `workflow` and `state`, which is what the shipped example pages use.
> * **Workflow:** `backlog → todo → in_progress → review → done`, with `cancelled` reachable from every open state. `in_progress` has a WIP limit of 5 and `review` a limit of 3.
>
> ```yaml tasks/example-task.md theme={null}
> ---
> type: task
> title: Implement auth flow
> workflow: tasks
> state: in_progress
> priority: 1
> assignee: agent:eng-bot
> blocked_by: []
> ---
> ```
>
> Advance a task through the workflow:
>
> ```bash Terminal theme={null}
> curl -X POST 'http://localhost:3333/api/kiwi/workflow/advance' \
>   -H 'Content-Type: application/json' \
>   -d '{"path":"tasks/example-task.md","target_state":"review","actor":"agent:bot"}'
> ```

> [accordion] data — structured records
>
> Collections of structured records with DQL dashboards.
>
> **knowledge**
>
> **SCHEMA.md**
>
> **playbook.md**
>
> **index.md**
>
> **collections**
>
> **dashboards**
>
> **imports**
>
> **.kiwi**
>
> **config.toml**
>
> **schemas/record.json**
>
> Records need `title` and `type`. Dashboards in `dashboards/` combine `kiwi-query` and `kiwi-chart` blocks. Fill collections with [`kiwifs import`](https://docs.kiwifs.com/import/overview). See [DQL](https://docs.kiwifs.com/concepts/dql.md).

> [accordion] cms — headless CMS
>
> A git-native CMS with an editorial workflow, a public reader at `/p/*`, and feeds.
>
> **knowledge**
>
> **SCHEMA.md**
>
> **playbook.md**
>
> **index.md**
>
> **authors**
>
> **blog**
>
> **docs**
>
> **pages**
>
> **.kiwi**
>
> **config.toml**
>
> **schemas/blog-post.json**
>
> **workflows/editorial.json**
>
> * **Post frontmatter:** `title`, `slug`, `type: blog-post`, `author`, `category`, `tags`, `published`, and `published_at` are required.
> * **Workflow:** `draft → review → scheduled → published → archived`. Review can also publish directly.
> * **Feeds:** `GET /api/kiwi/feed.xml` (Atom) and `GET /api/kiwi/feed.json` (JSON Feed).
>
> See [Publishing](https://docs.kiwifs.com/concepts/publishing.md).

> [accordion] runbook — operations
>
> Runbooks with severity, affected services, and execution tracking.
>
> **knowledge**
>
> **SCHEMA.md**
>
> **playbook.md**
>
> **index.md**
>
> **example-high-cpu.md**
>
> **.kiwi**
>
> **config.toml**
>
> **schemas/runbook.json**
>
> **templates/runbook.md**
>
> * **Runbook frontmatter:** `type: runbook`, `title`, `trigger`, `severity` (`P1`–`P4`), `owner`, and `services` are required. Track runs with `last_executed`, `last_outcome`, and `execution_count`.
> * **Execution staleness:** the janitor flags runbooks not executed in 90 days, and runbooks whose `last_outcome` is `failure`.
> * `services` is a typed link field, so services appear as edges in the graph.

> [accordion] adr — architecture decisions
>
> Architecture Decision Records in MADR format.
>
> **knowledge**
>
> **SCHEMA.md**
>
> **playbook.md**
>
> **index.md**
>
> **decisions**
>
> **.kiwi**
>
> **config.toml**
>
> **schemas/adr.json**
>
> **templates/adr.md**
>
> **workflows/adr.json**
>
> * **ADR frontmatter:** `type: adr`, `title`, `status`, `date`, and `deciders` are required.
> * **Workflow:** `proposed → accepted → deprecated → superseded`.
> * **Auto-numbering:** new files in `decisions/` get the next `adr_number`, configured with `[format_hooks.auto_sequence]`.
> * `supersedes`, `superseded_by`, and `contradicts` are typed links, so the graph shows decision chains.

> [accordion] prompt — prompt registry
>
> Versioned prompts with evaluation rubrics. Git history records every prompt change.
>
> **knowledge**
>
> **SCHEMA.md**
>
> **playbook.md**
>
> **index.md**
>
> **system-prompts**
>
> **task-prompts**
>
> **evaluation**
>
> **.kiwi**
>
> **config.toml**
>
> **schemas/prompt.json**
>
> **schemas/rubric.json**
>
> Prompts need `type: prompt`, `title`, `model`, and `label` (`production` or `staging`). Optional fields such as `temperature`, `eval_score`, `success_rate`, and `variant_of` make prompts queryable with DQL.

> [accordion] research — papers and notes
>
> A research library with a reading pipeline and typed citation links.
>
> **knowledge**
>
> **SCHEMA.md**
>
> **playbook.md**
>
> **index.md**
>
> **papers**
>
> **notes**
>
> **reviews**
>
> **.kiwi**
>
> **config.toml**
>
> **schemas/paper.json**
>
> **workflows/reading.json**
>
> * **Paper frontmatter:** `type: paper`, `title`, `authors`, `year`, `venue`, `workflow`, and `state` are required. `doi`, `bibtex_key`, and `cites` are optional.
> * **Workflow:** `unread → reading → annotated → summarized → incorporated`, with a WIP limit of 10 on `reading`.
> * `cites`, `contradicts`, `extends`, and `reviews` are typed links. The `kiwi_cite` MCP tool creates a paper page from a DOI or arXiv ID.

> [accordion] log — append-only events
>
> An append-only event log with one file per day.
>
> **knowledge**
>
> **SCHEMA.md**
>
> **playbook.md**
>
> **index.md**
>
> **events**
>
> **.kiwi**
>
> **config.toml**
>
> **schemas/event.json**
>
> Each daily file sets `append_only: true` in its frontmatter, and KiwiFS rejects overwrites of such files. Add entries with `POST /api/kiwi/file/append` or the `kiwi_append` MCP tool. Each entry is an H2 heading such as `## 2026-06-20T09:00:00Z | system.startup.v1`, and git history provides tamper evidence.

> [accordion] blank — empty
>
> No sample pages, no `SCHEMA.md`, and no playbook. You get the files listed in [What every template includes](#what-every-template-includes) and nothing else.

## List templates over HTTP

A running server lists its templates at `/api/init-templates`, outside the `/api/kiwi` prefix:

```bash Terminal theme={null}
curl http://localhost:3333/api/init-templates
```

```json Response theme={null}
{
  "templates": [
    {
      "id": "adr",
      "label": "Architecture Decision Records",
      "description": "Architecture Decision Records with MADR format, status workflow, and JSON Schema"
    },
    {
      "id": "blank",
      "label": "Blank",
      "description": "Empty workspace with Kiwi config only"
    }
  ]
}
```

Templates are sorted by label, with `blank` last.

## Related

> [card] [Quickstart](https://docs.kiwifs.com/quickstart.md)
>
> Install and run KiwiFS.

> [card] [Agent playbook](https://docs.kiwifs.com/concepts/agent-playbook.md)
>
> How agents use `SCHEMA.md` and `playbook.md`.

> [card] [Workflows](https://docs.kiwifs.com/concepts/workflows.md)
>
> State machines behind kanban boards and editorial pipelines.

> [card] [Schemas](https://docs.kiwifs.com/concepts/schemas.md)
>
> Validate frontmatter on write.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.