Skip to main content
A space is one knowledge base: a root directory with its own git history, search index, and .kiwi/state/. Multi-space mode serves several spaces from one KiwiFS process and port. Use it for separate team wikis on one host, per-tenant knowledge bases, or workspaces you create on demand.

How it works

  • The primary space is the directory you pass to --root. It is named default unless you set [space] name. Requests that name no space go here.
  • Additional spaces come from --space flags, [[spaces]] in the primary’s config.toml, or POST /api/spaces.
  • Each space has its own write pipeline, so writes, events, claims, webhooks, and the audit log stay within that space.

Add spaces

knowledge/.kiwi/config.toml
Terminal
Every space runs with the primary space’s config.toml. A space’s own .kiwi/config.toml is not read at startup, so settings such as [search], [auth], and [space] visibility are shared across spaces.

Route requests to a space

KiwiFS resolves the space for each request in this order:
If X-Kiwi-Space names a space that does not exist, the request returns 404 instead of falling back to the primary space. A URL prefix that is not a space name is treated as part of the normal path. The header works on every route, including /p/..., /raw/..., /mcp, and the web UI. That makes subdomain routing straightforward:
Caddyfile

Web UI

The space selector in the sidebar switches between spaces. Page URLs show which space you are in:

Authentication per space

With type = "perspace", each API key can be limited to one space. A key without space works in every space.
knowledge/.kiwi/config.toml
The space management routes under /api/spaces are not covered by API key auth. On a shared network, block or authenticate /api/spaces at your reverse proxy.

Manage spaces

Deleting a space renames its root directory to {root}.deleted-{timestamp}, so the files stay recoverable and the name is free to reuse.

Agents and MCP

Each space serves its own Streamable HTTP MCP endpoint. Reach it at /mcp with an X-Kiwi-Space header; without the header, /mcp serves the primary space. For a stdio MCP client, point kiwifs mcp at the server and pick a space:
Terminal
In local mode, --root already selects one knowledge base directly, so --space is rejected. Use kiwifs mcp --root /data/eng-wiki instead.

Spaces API

Create, list, and delete spaces.

Configuration

[space] and [[spaces]] syntax.

Draft spaces

Temporary branches of one knowledge base.

Authentication

API keys, per-space keys, and OIDC.
Last modified on October 19, 2026