.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 nameddefaultunless you set[space] name. Requests that name no space go here. - Additional spaces come from
--spaceflags,[[spaces]]in the primary’sconfig.toml, orPOST /api/spaces. - Each space has its own write pipeline, so writes, events, claims, webhooks, and the audit log stay within that space.
Add spaces
- config.toml
- CLI flags
- REST
knowledge/.kiwi/config.toml
Terminal
Route requests to a space
KiwiFS resolves the space for each request in this order: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
Withtype = "perspace", each API key can be limited to one space. A key without space works in every space.
knowledge/.kiwi/config.toml
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
--root already selects one knowledge base directly, so --space is rejected. Use kiwifs mcp --root /data/eng-wiki instead.
Related
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.