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.
Directory tree
Retrieve the directory tree as a JSON array.
Root path to list. Omit to list the entire knowledge base.
curl 'http://localhost:3333/api/kiwi/tree?path=concepts'
Array of tree nodes.
Full path relative to root.
Whether this node is a directory.
File size in bytes (0 for directories).
Nested tree nodes (directories only).
[
{
"path" : "concepts" ,
"name" : "concepts" ,
"isDir" : true ,
"size" : 0 ,
"children" : [
{ "path" : "concepts/auth.md" , "name" : "auth.md" , "isDir" : false , "size" : 1420 , "children" : null }
]
}
]
Read a file
Retrieve raw markdown content. The response includes an ETag header containing the git blob SHA for optimistic locking.
File path relative to the knowledge root.
curl -i 'http://localhost:3333/api/kiwi/file?path=concepts/auth.md'
HTTP/1.1 200 OK
Content-Type: text/markdown
ETag: "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2"
# Authentication
OAuth2 + JWT based authentication system...
Write a file
Create or update a file. The request body is raw markdown. KiwiFS creates a git commit for each write.
File path relative to the knowledge root.
Git commit author attribution (e.g. agent:my-agent).
Lineage tracking (e.g. run:run-249).
ETag from a previous read. If the file has changed since your read, the server returns 409 Conflict.
Create a new file
Update with optimistic locking
curl -X PUT 'http://localhost:3333/api/kiwi/file?path=concepts/auth.md' \
-H "Content-Type: text/markdown" \
-H "X-Actor: agent:docs-writer" \
-d '# Authentication
OAuth2 + JWT based authentication system.'
If you pass If-Match and the file has been modified since your read, the server returns 409 Conflict with an error message. Fetch the latest version, merge your changes, and retry.
Delete a file
Delete a file and create a git commit recording the deletion.
curl -X DELETE 'http://localhost:3333/api/kiwi/file?path=concepts/auth.md' \
-H "X-Actor: agent:cleanup"
Bulk write
Write multiple files in a single git commit. This is more efficient than individual writes and keeps your git history clean.
Git commit author attribution.
curl -X POST 'http://localhost:3333/api/kiwi/bulk' \
-H "Content-Type: application/json" \
-H "X-Actor: agent:importer" \
-d '{
"files": [
{"path": "concepts/auth.md", "content": "# Authentication\n\nOAuth2 flow."},
{"path": "concepts/billing.md", "content": "# Billing\n\nStripe integration."},
{"path": "concepts/users.md", "content": "# Users\n\nUser management."}
]
}'
Use bulk writes when importing data or making batch updates. All files are committed atomically in a single git commit.
Upload assets
Upload binary files (images, PDFs, etc.) as multipart form data.
curl -X POST 'http://localhost:3333/api/kiwi/assets' \
-F "file=@diagram.png" \
-H "X-Actor: agent:uploader"
The response returns the asset path you can reference in markdown:
{ "path" : "assets/diagram.png" }
Table of contents
Get the heading outline for a file.
File path to extract headings from.
curl 'http://localhost:3333/api/kiwi/toc?path=concepts/auth.md'
[
{ "level" : 1 , "text" : "Authentication" , "slug" : "authentication" },
{ "level" : 2 , "text" : "OAuth2 flow" , "slug" : "oauth2-flow" },
{ "level" : 2 , "text" : "JWT tokens" , "slug" : "jwt-tokens" }
]
Append to a file
Append content to an existing file without reading it first.
POST /api/kiwi/file/append
String inserted between existing content and new content.
curl -X POST 'http://localhost:3333/api/kiwi/file/append?path=log/agent.md' \
-H "X-Actor: agent:logger" \
-d '## Entry 42
New finding from run 249.'
{ "path" : "log/agent.md" , "etag" : "b2c3d4e5f6..." }
Append is useful for agent logs, episodic memory, and audit trails where you want to add content without read-modify-write cycles.
Rename a file
Rename or move a file. Wiki links pointing to the old path are automatically updated.
Rewrite wiki links in other files that point to the old path.
curl -X POST 'http://localhost:3333/api/kiwi/rename' \
-H "Content-Type: application/json" \
-d '{"from": "concepts/auth.md", "to": "concepts/authentication.md"}'
{
"from" : "concepts/auth.md" ,
"to" : "concepts/authentication.md" ,
"etag" : "c3d4e5f6..." ,
"updated_links" : 8
}
Rename a directory
Move an entire directory and update all internal links.
POST /api/kiwi/rename-dir
curl -X POST 'http://localhost:3333/api/kiwi/rename-dir' \
-H "Content-Type: application/json" \
-d '{"from": "concepts", "to": "docs/concepts"}'
{ "from" : "concepts" , "to" : "docs/concepts" , "renamed" : 15 }
Templates
List and read page templates stored in .kiwi/templates/.
List templates
curl 'http://localhost:3333/api/kiwi/templates'
[ "runbook" , "decision" , "episode" , "concept" ]
Read a template
curl 'http://localhost:3333/api/kiwi/templates?name=runbook'
{ "name" : "runbook" , "content" : "--- \n type: runbook \n title: \n status: draft \n --- \n\n # Title \n\n ## Steps \n\n 1. ..." }
Resolve wiki links
Resolve [[wiki-links]] to their canonical file paths and permalinks.
curl -X POST 'http://localhost:3333/api/kiwi/resolve-links' \
-H "Content-Type: application/json" \
-d '{"links": ["auth", "billing", "nonexistent"]}'
{
"resolved" : {
"auth" : { "path" : "concepts/auth.md" , "title" : "Authentication" },
"billing" : { "path" : "concepts/billing.md" , "title" : "Billing" }
},
"unresolved" : [ "nonexistent" ]
}