DOCS
API
One API. Every action Korpus has is an op with a name and arguments: a program calls it over HTTP or with the SDK, an AI app calls the same op as an MCP tool. This reference is for developers; to use Korpus with Claude or ChatGPT, the manual is enough, and to connect an app, see Connect.
Overview
| Ops | One per action: list_folder, read_concept, create_concept, update_concept and the rest. Each has a name, a JSON input, an answer (data, and the text a model would read) and the doors it is served at. |
|---|---|
| Doors | API: POST https://api.fra.korpus.cloud/v1/<op>, plain JSON over HTTPS, for the web app, the SDK, the CLI, scripts and CI. MCP: https://mcp.fra.korpus.cloud/ and an address per access, for AI apps. Most ops are at both; a few are only on the API and manual is only on MCP. |
| Auth | A bearer token on every request, from a sign-in, a trusted workload or a key. A credential is bound to one door: at the other, 403 wrong_audience (Connect). |
| Who | me (everything you reach, with your access) or an agent (you, narrowed: a job and its bundles, each at Read, Write or Custom patterns). An op is offered only to those it is for: me alone for managing ops, a reviewer's me for the review ops, which this reference leaves out. |
| SDK | @korpus-cloud/sdk: a typed client for the API, and the korpus command that signs a machine in. |
| Hosting | AWS eu-central-1 (Frankfurt). |
The data model in one breath: a bundle is a folder of concepts; a concept is a markdown document at a path such as auth/token-expiry, with type, tags, relations and a rev. Links in the web app are relations here. See the manual for the rest.
The API
https://api.fra.korpus.cloud/v1
Send the token as Authorization: Bearer …. No CORS: a token in a browser page is a token anyone can read.
GET /v1: what this credential may call.{api, agent, tools}, each op withname,title,description,read_only,destructiveand itsinputas JSON Schema.agent(its name, and its access per bundle id:read,writeor Custom rules) isnullforme.apimoves only on a break.POST /v1/<op>with the arguments as a JSON object:200 {data, text}. A refusal is{"error": {"code", "message", …details}}with the HTTP status the failure has everywhere in Korpus (400 a bad input, 403 restricted or out of room, 404 not found, 409 a conflict, 412rev_mismatch, 429rate_limited, and 503maintenanceordatabase_startingwithRetry-After).
GET https://api.fra.korpus.cloud/v1
200 OK
{ "api": 1, "agent": { "name": "nightly-sync", "grants": { "<bundle id>": "write", … } },
"tools": [ { "name": "list_folder", "title": "List folder", "description": "…",
"read_only": true, "destructive": false, "input": { …JSON Schema… } }, … ] }curl -fsS https://api.fra.korpus.cloud/v1/list_folder \
-H "Authorization: Bearer $KORPUS_KEY" \
-H 'Content-Type: application/json' \
-d '{"bundle": "01JBQ3M7X9VK2NDCTF8ZPYW4RH", "folder": "runbooks"}'200 OK
{ "data": { "entries": [ … ], "hidden": false },
"text": "…" }
412 Precondition Failed
{ "error": { "code": "rev_mismatch",
"message": "concept \"runbooks/deploy\" has changed since you read it (now rev 5); …",
"current_rev": 5, "updated_by": "…", "updated_at": "…" } }Refused before any op runs:
| Code | Meaning |
|---|---|
wrong_audience403 | A credential away from the door and address it was made for: another agent's or another account's address, an agent at /, or the API instead of MCP (or back). The message and details.url name where it works. |
account_blocked403 | The account is blocked. Every request is refused. |
unauthorized401 | No token, or one that is unknown, expired or revoked. |
unknown_op404 | No op of that name for this caller (or not at this door). GET /v1 lists them; over MCP the message names the tool that has it, or lists this tool's ops. |
invalid_arguments400 | The body is not JSON, or does not fit the op's input schema; the message names each field (over MCP with the op's signature). Nothing ran. In a batch, an item that does not fit answers it on its own line, and the others run. |
method_not_allowed405 | GET /v1 and POST /v1/<op> only. |
The data shapes are typed in the SDK (Tools in its type definitions); the text is the one an MCP client reads.
MCP
| Transport | Streamable HTTP, stateless: JSON responses, no session id, no server-sent events. |
|---|---|
| Address | https://mcp.fra.korpus.cloud/ is you, me, whoever signs in. https://mcp.fra.korpus.cloud/<username>/me is the same for one account, and https://mcp.fra.korpus.cloud/<username>/<agent> is an agent. Each request stands alone: JSON-RPC over POST, no stream to open and no session to end. |
| Auth | OAuth 2.1 with PKCE and dynamic client registration, or a key for a host that cannot sign in. Bearer token on every request. How to connect each app: Connect. |
| Server | korpus, titled Korpus · <agent> for an agent: which access the connection is. |
| Tools | The ops served at this door, plus manual. |
| Resources | Bundles and concepts as korpus:// URIs. |
| Prompts | whats_in_korpus, save_session, whats_new, ask_korpus, check_bundle, start_bundle. |
A client reads an address from its config. The .mcp.json shape Claude Code and similar clients read:
{
"mcpServers": {
"korpus": {
"type": "http",
"url": "https://mcp.fra.korpus.cloud/"
}
}
}Instructions
On initialize the server sends instructions a client passes to its model:
- Which Korpus deployment the client reached.
- A short overview: the data model, the tools (area × verb) and the ops used most with their arguments, which only look, the change description every write carries, how to find things (list_folder first).
- The access's name and job (
meor an agent) and, for an agent, its bundles with their access.
Everything longer sits behind the manual tool, so a client that drops the instructions can still read them. Topics:
start | First moves in a bundle you do not know. |
ops | The tools (area × verb) and how they run ops: one op, several in one call, help; then the map of every tool and op this connection is offered. |
concepts | Paths, fields, rev, create versus update, change descriptions, sources, body links and @-mentions, moves, many at once. |
assets | Files with the concepts that explain them, each pair at one path: upload by curl or as text, download, replace, file space. |
find | list_folder first; search (all words, any of a list, none of a list, word beginnings, with examples), regex and body search, digests, date and stale filters; query for items by their fields. |
relations | Relation types and links between concepts. |
collections | Collections: folders of items sharing one shape; defining one (item type, fields, key, sections, refs and on_delete), what a write must fit, changing it. |
views | query and saved views of a collection: filters, sort, group, totals; table, list, board and tree. |
teams | Your personal team and shared teams; members, inviting, join links, joining and leaving; what every member gets of a bundle, sharing one with a person or a team, and the access (Read, Write, Custom patterns); moving, copying, deleting and exporting a bundle; transfer and delete. |
catalog | Templates in the app: finding, reading and cloning one; publishing for review. |
agents | me and your agents, each you narrowed to its bundles (each Read, Write or Custom patterns); the two doors (MCP and the API); connections, sign-in, trust and keys. |
learning | A bundle that teaches the agents using it: read AGENTS and the last retro first, write a retro and apply one change last. |
limits | The ceilings every plan shares, and concept space and file space. |
errors | Every error code and what to do about it. |
support | When and how to file a ticket with send_feedback, so it can be reproduced without asking back. |
MCP: tools
One tool per area and verb, <area>_<verb>: areas concept, bundle, team, agent, account; verbs look (only reads), change (writes) and remove (deletes, moves, ends or takes back), plus manual. Each runs the ops below by name: {op, args}, or {calls: [{op, args}, …]} for up to 50 ops of that tool in one call, run in order with one answer each, not atomic. {op: "help"} lists a tool's ops and their arguments; {op: "help", args: {op}} gives one op's JSON Schema. The tools stay the same while ops are added or changed, so a client never has to refresh its tool list for a new op.
Each tool has a title a client shows and hints it sorts by. The look tools carry readOnlyHint, so most clients let a person allow them for good; the others ask, and remove also carries destructiveHint. Every tool is openWorldHint: false. A person can allow concept_change for good and still be asked for concept_remove or agent_change. Every agent is offered the same tools whatever its access: the look tools of concepts, bundles and its account, concept_change and concept_remove; a write or delete it does not hold answers restricted, so changing an agent's access never changes its tool list. Never a managing tool.
- Change descriptions.
create_concept,update_concept,delete_concept,add_relationandremove_relationtake a requiredchange_description: one line, what changed and why. It is the log; nothing else records why a concept moved. - Index and log. Every folder has an
index(read_index: the titles and descriptions of its concepts) and alog(read_log: its changes, newest first). Both are generated from the content as OKF 0.2 §8 and §9 describe, never stored, so no concept may be namedindexorlog. - Revisions.
read_conceptreturns a concept'srev. Pass it back onupdate_conceptand the call fails withrev_mismatchif someone changed the concept meanwhile. Without it the update lands and says whose revision it changed.update_conceptchanges only the fields given;""clears a text field.
On the wire
A tool call is an ordinary tools/call. Its answer is a tool result with one plain-text content item, written for a model to read; read_asset with inline adds the file itself (an image, text or an embedded resource). There are no resource_links and no structuredContent; a program that wants the data as JSON uses the API door (The API).
POST /
Authorization: Bearer <access token>
Content-Type: application/json
Accept: application/json, text/event-stream
{ "jsonrpc": "2.0", "id": 7, "method": "tools/call",
"params": { "name": "create_concept", "arguments": {
"bundle": "01M3…", "path": "README",
"type": "Guide", "title": "Research",
"body": "# Research\nWhat this bundle is for.",
"change_description": "Said what this bundle is for" } } }
200 OK
{ "jsonrpc": "2.0", "id": 7, "result": {
"isError": false,
"content": [
{ "type": "text", "text": "ok README created, rev 1" }
] } }A call that fails answers the same way with isError: true and the text <code>: <message>. Only transport and account problems are JSON-RPC or HTTP errors: 401 without a valid token, and 403 (-32003) for a credential this address does not take or a blocked account (the list).
Every op
Every op below is served at both doors: POST /v1/<op> on the API, and over MCP through the tool it is listed under ({op, args}), with the same arguments, checks and limits. Parameters with ? are optional. The input schemas (GET /v1, tools/list) carry the same fields with a description each; the manual topics explain the behaviour. manual is MCP only.
Field shapes
| Field | Shape | Meaning |
|---|---|---|
bundle | string | A bundle id (a 26-character ULID) from list_bundles, or the exact name of a bundle you can open (case and outer spaces aside). No bundle of that name answers not_found, two or more ambiguous_bundle: pass the id. |
path | string | Bundle-relative, segments of A–Z a–z 0–9 . _ - starting with a letter or digit, / between, no .md, depth ≤ 10. Umlauts are spelled out (ä → ae), other characters become -. A last segment named index or log is refused. |
type | string | Free text: Decision, Runbook, Guide, … |
status | string | stable | draft | deprecated by convention; left out reads as stable. |
tags | string[] | At most 32. Replaces all tags when given. |
relations | [{type, to}] | type = a relation type of the bundle, to = a path in it (may not exist yet). Replaces all relations when given. |
extra | object | Any other frontmatter keys. Replaces all of them when given. |
edits | [{old_str, new_str}] | update only, instead of body: up to 50 find-and-replace steps in order. Each old_str must occur exactly once in the body, else edit_mismatch and nothing is written. Needs rev. |
set_extra | object | update only, instead of extra: keys merged over the stored ones; null deletes a key. Needs rev. |
folder | string | A folder path, e.g. auth. Left out: the bundle root. |
rev | integer | From read_concept. The update fails with rev_mismatch if the concept changed since. |
change_description | string | One line, what changed and why, at most 200 characters. Required on every change to a concept: create, update, delete, move, a relation, an asset; a batch takes one for all or one per item. It is the log. |
since | string | ISO 8601 UTC, e.g. 2026-09-19T10:00:00Z. |
level | string | Your access on a bundle: own, maintain, write, read or custom (then rules: each a concept path or a pattern, such as notes/**, and its rights). Read reads, searches and exports; write also creates, updates and deletes concepts, files and relations; own and maintain also run the bundle. |
cursor | string | Opaque. A page with more ends its text with a line cursor <token> (search_concepts, query); pass it back with the same filters. |
manual readOnly · every access
| Tool | Parameters and effect |
|---|---|
manualHow Korpus works | topic?The manual, by topic. One topic, or all of them with no argument. |
concept_look · Look at concepts readOnly · idempotent · every access, within its reach
| Tool | Parameters and effect |
|---|---|
list_folderList folder | bundle, folder?, recursive?, cursor?, limit?One folder: its concepts (path, type, title, description) and subfolders, a page at a time (a long folder ends with a cursor). recursive: every concept under it, flat, paged the same way. With a Custom share, a first page also says how many concepts under the folder it leaves out (not_shared), never which. The way to find things; start here. |
read_indexRead folder index | bundle, folder?The folder's index.md: its concepts' titles and descriptions by type, and its subfolders. Generated from the concepts, never stored. A folder of more than 500 entries shows the first 500 and ends with a more: line naming the list_folder cursor for the rest. Like list_folder, it says when some concepts were left out (hidden). |
read_logRead change log | bundle, path?, since?, limit?, cursor?, titles?The log.md of a folder (every change under it), a concept (its own) or the bundle: kind, what changed, who, newest first. A long read stops with a cursor: pass it back for older changes. Generated from the change records, never stored. |
search_conceptsSearch concepts | bundle, q?, any?, none?, regex?, case_sensitive?, body?, digest?, type?, tag?, tags?, status?, stale?, stale_within_days?, date_from?, date_to?, prefix?, limit?, cursor?Search paths, titles, descriptions and tags, ignoring case and umlauts. q: all of its words, each also as a word beginning (sign finds signing), with "a phrase", -word and or as in a search box. any: at least one of a list (OR), none: none of a list (NOT), e.g. q="invoice" any=["2025","2026"] none=["draft"]. body: also the text, quoting the line that hit. digest: a line under each hit saying what it is about. tags: all of them. stale_within_days: what falls due. date_from/date_to: on the concept's date. Pages of 50, up to 200. |
read_conceptRead concept | bundle, path, targets?A whole concept as markdown with its rev, what links to it (relations and body links), and who its body @-mentions. targets: also the title and type of everything it points at or is pointed at from. |
read_conceptsRead concepts | bundle, pathsUp to 50 concepts in one call, each as read_concept shows it. The answer holds at most 2.5 MB; concepts past that come back as left, to read in another call. |
read_assetRead asset file | bundle, path, inline?An asset's file: a download URL valid 60 seconds, or with inline the file itself in the answer (up to 3 MB; images shown, text read). Read its concept first; it usually answers. |
get_collectionShow collection | bundle, nameOne collection: its item type, fields with counts per enum value, required sections, views, item count, and a blank item to fill. |
queryQuery items | bundle, view?, from?, type?, where?, q?, tags?, status?, stale?, prefix?, sort?, group_by?, aggregates?, fields?, limit?, cursor?Items of one collection as rows: path, title and fields, no bodies, a ref shown with its title. A saved view, or filters by any field, sorted by up to three. Or grouped (group_by), or totals (aggregates: count, sum, avg, min, max); the answer's mode says which. type: a type no collection declares, read as stored. Sees every write that committed. |
check_relationsCheck relations | bundleRelations, body links and ref fields pointing at concepts that do not exist, relations naming a type the bundle does not declare, and relation types nothing uses. |
concept_change · Write concepts asks · me, and an agent that may create or update
| Tool | Parameters and effect |
|---|---|
create_conceptCreate concept | bundle, path?, type, body, title?, description?, tags?, relations?, status?, stale_after?, date?, extra?, change_descriptionA new concept. Refused if the path is taken. A path with umlauts or spaces is made valid (schäfer → schaefer) and the answer names it. An item of a collection may leave path out: its key makes it. Every write to a collection is checked against it. |
update_conceptUpdate concept | bundle, path, …fields?, edits?, set_extra?, rev?, change_descriptionChange the fields you send; the rest stay. edits change part of the body (find-and-replace), set_extra some frontmatter keys. Pass the rev you read to fail on a concurrent change; required when sending tags, relations, extra, edits or set_extra. |
create_assetCreate asset | bundle, path, filename, body, bytes + content_type | text, source?, title?, description?, tags?, relations?, …, change_descriptionA file (pdf, zip, docx, csv…) and the concept that explains it, at one path. bytes: the answer is one curl line that uploads it from a shell (100 MB at most). text: a small text file (up to 1 MB) stored at once. body is required. |
update_assetReplace asset file | bundle, path, rev, filename, bytes + content_type | text, …fields?, change_descriptionA new file for an asset, and any document fields sent, in one write. The old file is deleted once it commits. |
create_conceptsCreate concepts | bundle, concepts, change_description?Up to 50 new concepts in one call, each as create_concept takes it. Each is its own write with its own answer line. |
update_conceptsUpdate concepts | bundle, updates, change_description?Up to 50 changes in one call, each as update_concept takes it. |
add_relationAdd relation | bundle, from, type, to, change_descriptionLink one concept to another, keeping its other links; reads from <type> to, and the answer echoes it. Nothing is written if the link is there. |
concept_remove · Remove or move concepts asks · destructive · me, and an agent that may delete
| Tool | Parameters and effect |
|---|---|
delete_conceptDelete concept | bundle, path, change_descriptionDelete one concept. An item others name by a ref field follows its on_delete: restrict refuses, cascade deletes them too, keep leaves the ref dangling. |
delete_assetDelete asset | bundle, path, change_descriptionDelete an asset: its file and its concept. Refused on a concept with no file. |
delete_conceptsDelete concepts | bundle, paths, change_descriptionDelete up to 50 concepts in one call. |
move_conceptMove concept | bundle, from, to, rev?, update_links?, change_descriptionMove or rename a concept; its body, frontmatter, tags and history go with it. Every concept linking to it is rewritten to the new path, unless update_links is false. |
move_conceptsMove concepts | bundle, moves, update_links?, change_descriptionUp to 50 moves in order, one per concept: a folder moves as one move for each concept in it. |
remove_relationRemove relation | bundle, from, type, to, change_descriptionRemove one link, keeping the others. |
bundle_look · Look at bundles readOnly · idempotent · every access, within its reach
| Tool | Parameters and effect |
|---|---|
list_bundlesList bundles | activity?The bundles you reach, with your access on each (Owner, Maintainer, Write, Read, or Custom with its patterns) and how many concepts each holds, then the bundles shared with you that wait for your accept_share. An agent sees only the bundles on its list, each with what it holds there, and no counts. activity: also what is new in each since your last look, and your @-mentions. |
get_bundleShow bundle | bundleOne bundle whole: your access, its maintainer, its state, relation vocabulary, collections and views, and how many people reach it. Its maintainer and its team's owner also see whom it is shared with (a share made by a join link says by link) and the agents at work on it, of everyone who reaches it, each with what it does there. An agent sees what it holds there, the state, vocabulary, collections and views. |
list_activityShow recent activity | bundle?, since?, mentions_only?Without bundle: what is new in each bundle since your last visit, and where you were @-mentioned. With bundle: its latest 50 changes. since: only what came after it; without bundle, counted from the later of since and your last visit. mentions_only: only your @-mentions. |
list_relation_typesList relation types | bundleThe bundle's link vocabulary, and the built-in links_to the server derives from body links. Read it before writing a relation. |
get_schemaShow schema | bundleThe bundle's collections (folders of items sharing one shape: item type, fields, key, item count) and saved views, then the concept types no collection declares. Read it before writing many similar docs. |
list_publicationsList publications | bundleEvery version a bundle of yours published, its last ending, and the copy of the one still filling. Me only. |
list_templatesList templates | category?, tags?, cursor?, limit?The catalog: published templates, the newest version of each, narrowed by category and tags. Me only. |
get_templateShow template | idOne template: its listing, publisher and size. Me only. |
list_blocked_sendersList blocked senders | The people you blocked from sharing with you, newest first, each with the reason you gave and when. Me only. |
bundle_change · Change bundles asks · me only
| Tool | Parameters and effect |
|---|---|
create_bundleCreate bundle | name, description?, team?, team_access?A new bundle, ready at once, under a name no other bundle of its team carries, with a starter set of relation types (relates_to, depends_on, supersedes, contains, precedes). In your personal team, or with team (@handle) in any team you belong to: the team's owner owns it and you maintain it. team_access: what every member of the team gets (none, read, write, the default, or custom: rules whose path is a concept path or a pattern, e.g. roadmap, notes/**, **/drafts/*). |
create_relation_typeDefine relation type | bundle, name, label, kind, inverse_label?, description?Declare or replace one kind of link: symmetric, directed (needs inverse_label) or unidirectional, with a line on when to use it. |
define_collectionDefine collection | bundle, name, item_type, folder, key?, fields?, sections?, title?, description?Declare a collection: a folder holding only its items, all of one item type (plus _meta/README and _meta/AGENTS, which the answer asks you to write), fields (string, number, date, datetime, bool, enum, list, ref, refs) and required sections, and a key their path is made from. Every write is checked against it. What is already there is checked; one that does not fit is named and nothing is declared. Write on the whole bundle. Me only. |
update_collectionChange collection | bundle, name, folder?, fields?, sections?, default_view?, title?, description?Change a collection: fields replaces the whole list, a new folder moves every item there. Every item is checked again; one that does not fit refuses the change. name, item_type and key never change. Write on the whole bundle. Me only. |
define_viewSave view | bundle, name, from, display?, where?, sort?, group_by?, aggregates?, columns?, title?, description?Save a view of a collection: filter, sort, group, totals, and how it shows (table, list, tree). Write on the whole bundle. Me only. |
update_viewChange view | bundle, name, from?, display?, where?, sort?, group_by?, aggregates?, columns?, title?, description?Change a saved view: each key sent replaces its value, null clears it. Write on the whole bundle. Me only. |
update_bundleRename bundle | bundle, name?, description?, relation_types?, team?, maintainer?Change a bundle's name (one no other bundle of its team carries), description or whole relation vocabulary (relation_types replaces the list): Write on the whole bundle. maintainer: name another member to run it; team: move it to another team you own (both its owner only; a move is refused while a version of it is in review, or when it does not fit there). |
copy_bundleCopy bundle | bundle, team?, name?A new bundle of yours, filled from a bundle you read whole, into your personal team or another team of yours (team), counted against its concept space and file space. Its name is name or the source's, numbered when the team has a bundle of that name. Never a catalog version: clone_template takes a published one. In a shared team it lands as create_bundle makes one: the team's owner owns it, you maintain it, its members write. Me only. |
export_bundleExport bundle | bundleThe bundle as an OKF folder in a zip, as a download link valid 15 minutes. |
clone_templateUse template | id, team?Take a template: a new bundle of yours, filled from the published version, in your personal team or another team of yours (team), and counted against its concept space and file space. It takes the template's title, numbered when the team has a bundle of that name. In a shared team it lands as create_bundle makes one: the team's owner owns it, you maintain it, its members write. Me only. |
share_bundleShare bundle | bundle, with, accessShare a bundle you maintain with a person (@username or address) or a team (@handle), or change a share: read, write or custom (rules whose path is a concept path or a pattern: roadmap, notes/**, **/drafts/*, auth/token-*); none only for the bundle's own team (what every member gets). A teammate or the bundle's own team: at once; anyone else: an offer they accept_share, which ends after 7 days when nobody answers. A person's share beats team shares. Me only. |
accept_shareAccept share | bundle, team?Say yes to a bundle shared with you, or (team) with a team you own: bundle is the id the offer names in list_bundles (not yet yours, so its name finds nothing). It joins list_bundles at the access offered. Me only. |
unblock_senderUnblock sender | personLet a person you blocked share with you again; what they offered since then shows in list_bundles. Me only. |
bundle_remove · Remove from bundles asks · destructive · me only
| Tool | Parameters and effect |
|---|---|
delete_relation_typeRemove relation type | bundle, nameRemove one relation type; edges using it stay and check_relations lists them. |
delete_collectionRemove collection | bundle, nameRemove a collection. Its items stay as they are. Refused while a view or a ref field names it. Write on the whole bundle. Me only. |
delete_viewRemove view | bundle, nameRemove a saved view. Refused while a collection opens on it. Write on the whole bundle. Me only. |
delete_bundleDelete bundle | bundle, confirmDelete a bundle you own with everything in it, for good. confirm is its name, typed back. |
end_publicationEnd my publication | publicationAs its publisher: withdraw a pending version, remove a published one, or dismiss one a reviewer ended. Deletes the version; clones stay. Me only. |
unshare_bundleEnd a share | bundle, with?End a share at once (the bundle by id or name): as the bundle's maintainer, anyone's (with); as the one it is shared with, your own (with left out), or a team's you own (with: its @handle). Also declines an offer, by the id the offer names. Their writes stay. Me only. |
decline_all_sharesDecline all offers | Decline every bundle offered to you, and to the teams you own, that waits for your yes, at once. Answers the bundles declined. Me only. |
block_senderBlock sender | person, reason, report?Block a person (@username, as an offer in list_bundles names its sender, by) from sharing with you: every offer of theirs waiting for you or a team you own is declined, and later ones never reach you. They are not told: to them an offer waits unanswered. reason (required): why, kept with the block. report (default true): also file it with Korpus support, as a ticket naming them and the reason, never a bundle; support may then block the account. Me only. |
team_look · Look at teams readOnly · idempotent · me only
| Tool | Parameters and effect |
|---|---|
list_teamsList teams | Your teams: your personal team first (your username), then the shared teams you own, belong to or are invited to, and an offer of one to you. Me only. |
get_teamGet team | teamOne team: its members, its bundles with what every member gets and who maintains each, the bundles shared with it, and its quota (concept space and file space as the share used, bundles, people). Its owner also sees pending invites, shares waiting for a yes, open join links, the agents at work on its bundles (read only), an offer of the team and where its Pro stands. Me only. |
find_peopleFind people | prefixUp to 8 accounts whose username or address starts with prefix, to name someone in an invite. Only on an organisation's own deployment; elsewhere nobody: ask for the @username. Me only. |
get_join_linkGet join link | linkWhat a join link is for, before you open it: the team (its @handle and name), its owner and what it gives, member or a share at read, write or custom; nothing about its people or bundles. Changes nothing. An unknown, used-up or expired link answers not_found, as accept_team would. Me only. |
team_change · Change teams asks · me only
| Tool | Parameters and effect |
|---|---|
create_teamCreate team | handle, name, color?A shared team you own, with an @handle from the namespace usernames share and a colour for its badge (sage, teal, sky, iris, lilac, rose, peach or sand; default sage). Bundles made in it belong to the team; each says what every member gets. Me only. |
update_teamUpdate team | team, name?, color?Rename a shared team you own, or change its colour; its @handle stays. Me only. |
invite_memberInvite to team | team, peopleInvite up to 50 @usernames or addresses into a shared team you own, all or none within its people. Nothing reaches them until they accept_team; then each bundle of the team gives them what it gives every member. An invitation nobody answers ends after 7 days. To share one bundle with someone outside, share_bundle instead. Answers counts only. Me only. |
accept_teamAccept team | team?, link?Join a team that invited you, take a team its owner offered you, or open a join link (link: its token): a member link makes you a member, a share link gives you its bundles. They join list_bundles. Me only. |
decline_teamDecline team | teamSay no to a team its owner offered you: the offer ends, the team stays theirs and you stay a member. The owner sees that you declined. Me only. |
create_join_linkCreate join link | team, shares?, seats, days?A link into a team you own: whoever opens it signed in becomes a member, or, with shares, gets those bundles at their access instead (your personal team: shares only). Up to seats people (1 to 50), for days (1 to 30, default 7). The token is shown once; only its hash is kept. Me only. |
team_remove · Leave or remove from teams asks · destructive · me only
| Tool | Parameters and effect |
|---|---|
delete_teamDelete team | team, confirmDelete a shared team you own (confirm: its @handle, typed back). Its bundles move to your personal team, refused when they do not fit; its members lose them. Refused while the team is on Pro (team_subscribed). Me only. |
transfer_teamTransfer team | team, toOffer a shared team you own to one of its members, named as get_team shows them (to: empty withdraws). Once they accept_team, the team and its bundles are theirs and you stay a member; they can also say no (decline_team) and stay a member. An offer nobody answers ends after 7 days. Refused while the team is on Pro, your subscription (team_subscribed). Me only. |
remove_memberRemove from team | team, personTake a member or an invite out of a team you own, named as get_team shows them. Its bundles are gone for them and their agents at once, the bundles they maintained go back to you; their writes stay. Me only. |
leave_teamLeave team | teamLeave a team or decline its invite; its bundles are gone for you, your writes stay. The owner transfers or deletes it instead. Me only. |
delete_join_linkDelete join link | team, idEnd a join link of a team you own (its id, from get_team). Who joined by it stays. Me only. |
agent_look · Look at agents readOnly · idempotent · me only
| Tool | Parameters and effect |
|---|---|
list_agentsList agents | me, then your agents, each you narrowed to its bundles (each Read, Write or Custom patterns), and its connections. An agent sees only itself. |
list_connectionsList connections | name?Every app connected as me or an agent (or, with name, as that one): sign-ins through the browser or by device code, keys and trusts, each with its id, door and method. Me only. |
get_connectGet connect recipes | name, bundle?How to connect an app as me or one agent, in the order to prefer: sign-in through the browser at its MCP address (me from Claude's connector directory, any access as a custom connector or a claude mcp add line); for me also korpus login, the CLI signed in through the browser; for an agent then a device code for a box with no browser, a trusted AWS role or GitHub repository for a workload, and a key last. Also a CLAUDE.md block with a SessionStart hook so every session reads the bundle first (given bundle, both name it). Me only. |
agent_change · Change agents asks · me only
| Tool | Parameters and effect |
|---|---|
create_agentCreate agent | name, description, bundlesMake an agent: an AI app, an automation or a program acting for you, narrowed to the least its job needs: the bundles it reaches, each Read, Write or Custom ({bundle, access}, the bundle by id or name; a Custom rule's path is a concept path or a pattern: roadmap, notes/**, **/drafts/*). Never more than you in a bundle, now or later. It works at either door, MCP and the API; it signs in through the browser, or last holds a key. Me only. |
update_agentUpdate agent | name, description?, bundles?Change an agent: each field sent replaces its value (bundles: the whole list). Holds from its next request. The name is fixed, as it is in the connector address: make a new agent for another name. Me only. |
create_keyCreate key | name, label, days?, door?A key (kp_…) for one agent at one door (api, the default, or mcp): a bearer for a host that can only send a fixed header, a client_credentials secret for one that fetches its own tokens, or the client secret of an OAuth client an app signs in with (client ID <username>/<name>). A key unused for 90 days stops working. Shown once; expires after 30 (the default), 90 or 365 days. Never for me. |
add_trustTrust a workload | name, provider, issuer?, role_arns?, repository?, environment?, ref?, sub_pattern?, repository_id?, repository_owner_id?Let AWS roles (provider aws: your account issuer and role ARNs) or a GitHub repository (provider github: owner/name, pinned to an environment, a ref or a written sub_pattern) act as an agent with no secret. The workload trades its platform token at /oauth/token for a one-hour token at the API door. Answers the setup. Never for me. |
agent_remove · Remove agents asks · destructive · me only
| Tool | Parameters and effect |
|---|---|
delete_agentDelete agent | nameDelete an agent and end every connection it holds: sign-ins, keys and trusts. Its writes stay. Me only. |
revoke_connectionRevoke connection | name?, idEnd one connection of me or an agent at once: a sign-in, a key or a trust. id: as list_connections prints it, or its first 8 characters as a log shows a key. name: only that access's connections are searched. |
account_look · Look at your account readOnly · idempotent · every access
| Tool | Parameters and effect |
|---|---|
get_usageShow usage | shares?, team?Your plan and how full each space is: concept space (concepts, collections, views) and file space, each as the share used (0 to 1), never bytes; the bundles you own as a count; and the team's bundles and people against its plan (quota). Never refused. shares: also each bundle charged to you with its share of concept space. team: a team you own or belong to (@handle), its plan, spaces, bundles and people instead of your personal team's. Me only: an agent sees no usage, and a limit it hits answers quota_exceeded. |
get_rightsShow my rights | bundle, path?, agent?What this connection may do in a bundle: your access (Owner, Maintainer, Write, Read or Custom patterns) and, for an agent, its own on top; both must allow. path: whether it may read, create, update and delete there. agent (me only): the same for one of your agents. Answers nothing instead of refusing. |
account_change · Contact support asks · me only
| Tool | Parameters and effect |
|---|---|
send_feedbackSend feedback | kind, severity, title, goal, expected, actual, steps, error?, bundle_id?, paths?, workaround?, client?Your agent files a ticket with Korpus support: a bug, something confusing, a missing feature, an idea. It writes what you wanted, what it expected, what happened and the calls that reproduce it; the answer comes to your account email. Only a few an hour, never counted against your usage. Me only. |
Only on the API
These ops are served at the API door alone: the web app's own, and a few a program signed in as you may call. who says who is offered each: you, signed in (your own sign-in, never an agent), the web app (its own session alone: account, billing, support) or no sign-in (the cancel page, which needs no credential). An agent sees none of them. Questions about billing: support@korpus.cloud.
| Op | Parameters and effect |
|---|---|
get_meyou, signed in | Who you are, your plan (free, pro or business, the word get_usage says), billing, theme and Terms, and the bundles deleting you would take with it. |
mark_seenyou, signed in | bundleYou have seen the bundle as it is now: its "new" count starts over. |
accept_termsthe web app | version, username?Agree to the Terms in force; a version that is not current is refused. A first Google sign-up also sends the username it chose. |
set_themethe web app | themeLight, dark or auto: the copy of the choice that travels between devices. |
change_emailthe web app | emailStart an email change: the address must be free, then a code is mailed to it. |
sync_emailthe web app | After the code is confirmed: move the account to the address the pool verified. |
list_sessionsthe web app | The browsers signed in as you, most recently used first. |
clear_sessionsthe web app | Forget every session row, so the list does not name browsers whose tokens no longer work. |
delete_accountthe web app | confirmDelete the account and everything it owns. confirm repeats the username. |
send_supportthe web app | topic, message, context?Write to the operator; the reply goes to your account's address. Five a clock hour. |
create_checkoutthe web app | team?, interval?Start the payment page for Pro, monthly or yearly (interval: month, the default, or year), for a team you own (team: @handle; your personal team without it); answers its url. Refused while its Pro is live, or on Business (billed by invoice). |
sync_billingthe web app | team?After checkout: read the team's subscriptions fresh and record the deciding one. |
cancel_subscriptionthe web app | team?End the team's Pro at the end of the paid period. |
resume_subscriptionthe web app | team?Take back a pending cancellation of the team's Pro. |
create_billing_portalthe web app | team?The payment provider's own page for the team's card and invoices; answers its url. |
wakeno sign-in | Start the database if it paused after idle; answers ready. ready false: it is starting, ask again in a few seconds. |
cancelno sign-in | name?, email?, kind?, reason?Cancel Pro, withdraw from the contract, or cancel for cause, without signing in. The receipt goes to the given address; it answers 202 whatever it found. Only where Pro is sold: elsewhere unknown_op. |
cancel_confirmno sign-in | tokenThe withdrawal link from the receipt: refunds and ends Pro now. Only where Pro is sold. |
Files
An asset is a file (a PDF, a spreadsheet, an archive) and the concept that explains it, at one path: type: asset, with an asset block the server writes (filename, content type, size, source, whether it has landed). The body is required. It says what is in the file, so the next agent reads two kilobytes of prose instead of parsing forty megabytes again. Moving or deleting the concept moves or deletes the file; whoever may read the concept may download it.
- Upload by URL:
create_asset(over MCP or the API) withbytesandcontent_typeanswers one line for a shell:curl -fsS -T <file> -H 'content-type: …' "$(curl -fsS https://mcp.fra.korpus.cloud/u/<id>)". The link is good for 15 minutes; the content type and length are signed, so send exactly what you declared. The file goes straight to storage, up to 100 MB. - Upload as text:
textinstead ofbytesstores a small UTF-8 file (a CSV, JSON or Markdown, up to 1 MB) at once, for an agent with no shell. - Download:
read_assetanswers a URL valid for 60 seconds; withinlinethe file itself comes back in the answer (up to 3 MB): an image as image content, text as text, anything else as an embedded resource. - Replace:
update_assetwith therevyou read takes a new file, and any document fields, in one write; the old file is deleted once it commits.
Files count against their own space, apart from the document space, charged to the bundle's team (quota_exceeded, limit asset_space). In the web app, drop a file on a folder.
Resources and prompts
| URI | What |
|---|---|
korpus://bundle/{bundle_id} | A bundle: name, your access, count, description and its root folder. Listed by resources/list. |
korpus://bundle/{bundle_id}/{+path} | A concept: its rev and markdown. A template; concepts are not listed. |
Both are text/markdown and go through the same access checks as the tools.
| Prompt | What it does |
|---|---|
whats_in_korpus | What's in Korpus: Lists your bundles, then the index of each. Reads only. |
save_session | Save what we learned: Reads what is there, proposes what to write, waits for your OK, then writes it, saying what changed. |
whats_new | What's new: Changes since your last visit, and where you were mentioned. Reads only. |
ask_korpus | Answer from Korpus: Answers your question from your bundles, naming the concepts it rests on. Reads only. |
check_bundle | Check a bundle: Finds dangling relations, unused relation types, stale concepts and old drafts, and proposes a fix for each. Writes nothing until you pick. |
start_bundle | Start a new bundle: Plans a bundle with you, waits for your OK, then creates it with a README and AGENTS. Me only. |
Errors
Over MCP a failure reads <code>: <message>, sometimes followed by details as JSON and a pointer to a manual topic; at the API it is {"error": {"code", "message", …details}}, with the HTTP status the failure has everywhere in Korpus. The message names the fix.
| Code | Meaning |
|---|---|
rev_mismatch | The concept changed since you read it. Read again, merge, update with the new rev the message names. |
rev_required | An update sent tags, relations, extra, edits or set_extra without rev. Read, merge, pass rev. details: current_rev |
edit_mismatch | An old_str in edits is not in the body exactly once; nothing was written. Copy it from a fresh read, widen it until unique. details: index, matches |
change_description_required | A create, update or delete sent a blank change_description, or one over 200 characters: one line saying what changed. Left out altogether, it answers invalid_arguments naming the field. |
not_found | Not there, or not yours to see. Not a permission hint. |
restricted | An agent's narrowing (its bundles, or its access in one) refuses it, or the tool is me only. The message says what it holds. Do not retry; the person changes the agent. |
rate_limited | Far too many writes or reads in a short time: a loop gone wild, not normal work; or too many shares offered outside a team (limited per minute and per day). Nothing ran. details: limit (writes, reads, shares), retry_after (seconds) |
quota_exceeded | Out of room or over a count, per team. details: limit (space for concept space; asset_space for file space; bundles; team_members for its people, a share to a new person included; free_teams for shared teams on the free plan; publications is web only), max. Nothing is taken away; delete something, or put the team on Pro. |
maintenance | An upgrade is running behind a short gate (minutes at most). Wait retry_after seconds and send the call again. HTTP 503. |
database_starting | The database paused after idle and is starting (about 20 s). Rare: every call first waits up to about 22 s for it, at MCP and at the API alike. Nothing ran: wait retry_after seconds and send the call again; the SDK and the korpus command do so by themselves, within wakeWait (30 s). HTTP 503 with Retry-After. |
published_read_only | A published catalog version (web only), which nobody writes. Edit its source bundle instead. |
account_blocked | The account is blocked. Every request is refused. |
internal_error | Our fault. Retry once, then have your agent send_feedback; it quotes the ref, which leads us to the log line. |
support_rate_limited | Too many support messages this hour (send_feedback and the contact form together). details: retry_after (seconds) |
More codes
invalid_path, invalid_concept, invalid_frontmatter, invalid_name | A path, field or name does not fit its rules (charset, depth, a last segment named index or log). |
invalid_agent | An agent or key is malformed: a name, job, bundle list, key label or door. Also me, which is never changed and never holds a key or a trust. |
invalid_access | An access does not fit: read, write, or 1-5 rules {path, rights}, path a concept path or a pattern (roadmap, notes/**, **/drafts/*), as the message explains; none only for a bundle's own team. |
agent_not_found, agent_exists, connection_not_found | No agent of that name, an agent of that name already exists, or no connection with that id. |
invalid_trust, role_claimed | A workload trust does not fit (the message names the field), or the AWS role already acts as another of your agents. |
invalid_relation_type | The relation type is not declared in this bundle: list_relation_types, then create_relation_type. |
invalid_cursor, invalid_regex, invalid_query | Start the search again without the cursor; the regex uses a construct outside the accepted subset; a filter such as date_from is not a day, or comes after date_to. |
not_allowed_here, wrong_type, wrong_path, item_mismatch | A concept does not fit its collection: in a collection folder that is not its item, under _schema, the wrong type, the wrong path (expected_path names the right one) or a field or section missing or of the wrong kind. Every problem is named at once. |
invalid_collection, collection_not_found, still_referenced | A collection definition or change is malformed, or items already there do not fit (named); no collection of that name; or a delete refused because items point at the concept with on_delete restrict (named). |
invalid_view, view_not_found | A view definition is malformed (from names more than one collection, a field the collection does not have, a table grouped by more than one field), or no view of that name. invalid_query also answers a query that cannot run (an unknown field, an op or aggregate that does not fit its kind). |
body_too_large, too_many_tags, too_many_relations, too_many_links, too_many_shares, export_too_large | Over a ceiling; see Limits. too_many_links: the body links more concepts than one may; split it. too_many_shares: the bundle is shared with as many teams as one may be; end one first. |
too_many_open_shares | You have 10 shares offered outside a team that wait for a yes, as many as one may (details: max_open_shares). Wait for answers, or end one you offered (unshare_bundle), then share again. |
invalid_items, invalid_move | A batch list refused before anything ran (empty, too long, too many bytes, one path twice), or a move from a path to itself. |
confirm_mismatch, is_version, in_review | delete_bundle: confirm is not the bundle name (delete_team: not the team handle); the bundle is a catalog version (ended in the web app); a version of it is in review. |
not_an_asset, invalid_asset | The concept has no file, or the filename, content type, size or text of one is wrong, or its upload has not landed yet. |
ambiguous_bundle | A bundle named by a name two or more of your bundles carry. Pass the id from list_bundles (details: ids), or rename one so each name is unique. |
bundle_not_empty, conflict | The state does not allow it right now, e.g. a create at a path already taken, or a bundle name another bundle of the team carries (details: bundle_id). |
forbidden | Your access to the bundle or your place in the team does not allow it, e.g. a Read share writing, or anyone but the owner inviting or deleting. |
team_not_found, invalid_team_name | No team of that handle you belong to, no invite or offer of it for you, or nobody by that name in it (alike whether the team exists); a team name not 1-80 characters. |
team_subscribed | A team on Pro, or with a subscription just bought and not yet settled, is not handed on or deleted: its subscription is its owner's. Once it has ended (cancelled, at the end of the paid period), it can be. |
user_not_found, email_taken, username_taken | People: nobody with that name or address (an invite, on a deployment that lists its people), or a name or address already taken. |
Before a tool runs
Refusals of the request itself, before any tool: over MCP a JSON-RPC error -32003 with the HTTP status, at the API {"error": {"code", "message"}}.
| Code | Meaning |
|---|---|
wrong_audience403 · MCP, API | A credential away from the door and address it was made for: another agent's or another account's address, an agent at /, or the API instead of MCP (or back). The message and details.url name where it works. |
account_blocked403 · MCP, API | The account is blocked. Every request is refused. |
unauthorized401 · API | No token, or one that is unknown, expired or revoked. |
unknown_op404 · API, MCP | No op of that name for this caller (or not at this door). GET /v1 lists them; over MCP the message names the tool that has it, or lists this tool's ops. |
invalid_arguments400 · API, MCP | The body is not JSON, or does not fit the op's input schema; the message names each field (over MCP with the op's signature). Nothing ran. In a batch, an item that does not fit answers it on its own line, and the others run. |
method_not_allowed405 · API | GET /v1 and POST /v1/<op> only. |
The codes are the same on every door and in the SDK's KorpusError. Retry hints: rate_limited, maintenance and database_starting carry retry_after, in seconds. A rate_limited wait is seconds: wait it out, then go on where you stopped. manual topic=errors explains every code.
Limits and usage
| Limit | Value |
|---|---|
| Concept body | 300 KB |
| File (asset) | 100 MB; 1 MB sent as text, 3 MB read inline |
| Upload link / download URL | 15 minutes / 60 seconds |
| change_description | 200 characters |
| Path | depth 10, 900 bytes |
| Tags per concept | 32 |
| Relations per concept | 32 |
| Concepts one body links to | 200 |
| Items per batch call | 50, bodies 2 MB in all |
| read_concepts answer | 2.5 MB |
| Relation types per bundle | 16 |
| Collections per bundle | 16 |
| Fields per collection | 24 |
| Views per bundle | 32 |
| Enum values per field | 50, each 60 characters |
| Items in a list field | 50 |
| query | 8 collections, 10 conditions, 50 values per in, 3 sort keys, 8 aggregates, 1,000 groups, 200 rows a page |
| Search page | 50, up to 200 |
| Regex length | 200 characters |
| Agents per account / rules in a Custom access | 50 / 5 |
| Keys per agent | 5, each 30, 90 or 365 days; off after 90 idle days |
| Trusts per agent | 10 |
| Invites at once / teams one bundle is shared with | 50 / 50 |
| Join links per team | 20 open, each up to 50 seats and 30 days |
| Export | 50 MB of concepts and files; link 15 minutes |
A team’s quota is concept space, file space, bundles and people, counted per team (a person’s personal team holds the bundles they made there). Concept space holds the concepts, collections and views, file space the files kept with them; each is said as the share used, never in bytes. A concept counts its body and fields (title, description, tags, relations, frontmatter), plus 1 KB. People are the owner, the members, open invites and each person a bundle is shared with. Over one, a write, a new bundle or a new person answers quota_exceeded (limit space for concept space, asset_space for file space, bundles, team_members), and nothing is taken away; get_usage shows each to you, and is never refused; an agent sees no usage and meets the limit as that refusal. Writes and reads each have a short-term rate, there only to stop a runaway loop: a call counts 1, a batch 1 per item, a body search or an export 10 reads. Over one, the call answers rate_limited with retry_after in seconds. The rates are higher on Pro and are not published.
The SDK
@korpus-cloud/sdk is Korpus from code: a CI job, a cron script, an app of yours reads and writes the same bundles people and AI apps use, as an agent: you, narrowed to the bundles you give it, each at Read, Write or Custom patterns. Every method is one op of the API.
| Package | @korpus-cloud/sdk on npm. MIT, ESM, no dependencies. Node 20 or later, Bun or Deno. Server side only. |
|---|---|
| Who | An agent. A sign-in as you (me) is not what the SDK is for, and a key or a trust never belongs to me. |
| Credential | new Korpus() finds one at its first call: KORPUS_KEY first, then a GitHub Actions job with KORPUS_AUDIENCE (traded for a one-hour token, renewed before it ends), then a sign-in made on this machine with korpus login, then an AWS workload with KORPUS_AUDIENCE (traded the same way); with none, the call throws no_credential. To choose: new Korpus({ credentials: fromGitHubActions({ audience }) }), or fromAwsWebIdentity, fromOAuth, fromStaticToken. How to get each: Connect. |
| Which Korpus | The baseUrl option; else KORPUS_URL; else the deployment the key names (kp_fra_… is fra.korpus.cloud, kp_dev.fra_… is dev.fra.korpus.cloud); else the one KORPUS_AUDIENCE names; else https://api.fra.korpus.cloud. Any URL of a deployment will do. A key names its deployment and is sent there unless you give another URL. |
Use
import { Korpus } from '@korpus-cloud/sdk';
const korpus = new Korpus(); // KORPUS_KEY, a trusted workload, or a sign-in from korpus login
const notes = korpus.bundle('01JBQ3M7X9VK2NDCTF8ZPYW4RH');
// Find, read, change.
const entries = await notes.folder('runbooks');
const { concept } = await notes.read('runbooks/deploy');
await notes.update('runbooks/deploy', {
rev: concept.rev, // fails with rev_mismatch if someone changed it since
body: concept.body + '\n- Check the dashboard after the deploy.',
change_description: 'Added the post-deploy check',
});
// Many at once: each item answers on its own.
const items = await notes.createMany(
[
{ path: 'log/2026-10-22', type: 'Log', body: 'Nightly sync: 14 records.' },
{ path: 'log/2026-10-23', type: 'Log', body: 'Nightly sync: 9 records.' },
],
'Nightly sync results',
);
for (const item of items.items) if (item.status !== 'ok') console.error(item.path, item.error.message);Every method is one op. korpus.call(name, args) reaches any of them by name, typed, with the text a model would have read beside the data:
const { data, text } = await korpus.call('check_relations', { bundle: notes.id });Every change takes a change_description: one line, what changed and why. It is the log; nothing else records why a concept moved. Paths and fields are those of the ops: Every op has each parameter, Agents and levels what an agent may do.
Every method
korpus is a new Korpus(); bundle is korpus.bundle(id), with the bundle id from listBundles(). why is the change description.
| Method, tool and effect |
|---|
korpus.describe()GET /v1What this credential may call: the API version, the agent, its bundles (each Read, Write or Custom patterns), and every tool with its input schema. |
korpus.wake() / awaitReady()wakeStart the database if it paused after idle, sending no credential: {ready}. awaitReady asks until it is ready, within wakeWait. A call needs neither: it waits by itself. |
korpus.listBundles({activity?})list_bundlesThe bundles on the agent's list, each with what it holds there; with activity, what is new in each. An agent's credential only. |
korpus.listMyBundles({activity?})list_bundlesSigned in as you only: every bundle you reach, each with your access and its concept count; with activity, what is new in each. |
bundle.info()get_bundleThe bundle whole: state, relation vocabulary, collections and views. |
korpus.usage()get_usageSigned in as you only (an agent is refused it): how full your space is, with the team's bundles and people against its plan, or a team's (team). shares: true adds each bundle share. |
korpus.self()list_agentsThe agent itself: its job and its bundles, each Read, Write or Custom patterns. |
korpus.activity({since?, mentions_only?})list_activityWhat is new in every bundle it sees. |
bundle.folder(folder?, {recursive?, cursor?, limit?}) / folderPage(…)list_folderOne folder: its concepts and subfolders. The way to find things. folderPage also answers the cursor for the next page and the folder's README / AGENTS. |
bundle.index(folder?)read_indexThe folder's generated index, as markdown. |
bundle.log({path?, since?, limit?, cursor?}) / logPage({…, titles?})read_logThe changes under a folder or to a concept, newest first. logPage also answers the cursor to pass back for older changes, when you last looked, and with titles each row's concept by title. |
bundle.search(query)search_conceptsSearch paths, titles, descriptions, tags, and with body the text: q all words, any one of a list, none none of a list. |
bundle.read(path, {targets?}) / readMany(paths)read_concept · read_conceptsA concept with its rev and what links to it (with targets, the title and type of both ends of each edge); up to 50 at once. |
bundle.create(path, input) / createMany(concepts, why?)create_concept · create_conceptsA new concept; up to 50, each answering on its own. |
bundle.update(path, input) / updateMany(updates, why?)update_concept · update_conceptsChange the fields sent (edits and set_extra change part of body and extra); pass rev to fail on a concurrent change. |
bundle.delete(path, why) / deleteMany(paths, why)delete_concept · delete_conceptsDelete one concept, or up to 50. |
bundle.move(from, to, opts) / moveMany(moves, opts)move_concept · move_conceptsRename; every link to it is rewritten unless update_links is false. |
bundle.relate(from, type, to, why) / unrelate(…)add_relation · remove_relationAdd or remove one relation. |
bundle.relationTypes() / checkRelations()list_relation_types · check_relationsThe link vocabulary; links that point nowhere. |
bundle.schema() / collection(name)get_schema · get_collectionEvery collection with its item count, the saved views and the types no collection declares; or one collection, with counts per enum value, its views and a blank item. |
bundle.query({view} | {from, where?, sort?, group_by?, aggregates?, fields?, limit?, cursor?})queryItems as rows, by a saved view or by filters; or their groups or totals. mode says which: rows, groups or totals. |
bundle.defineCollection(input) / updateCollection(name, update) / deleteCollection(name), defineView / updateView / deleteViewdefine_collection · update_collection · delete_collection · define_view · update_view · delete_viewDefine, change or remove a collection or a saved view. Me only: an agent is refused. Write on the whole bundle. |
bundle.rights(path, {agent}) / activity()get_rights · list_activityWhat this token may do in the bundle (your access and the agent's), and whether it may read, create, update and delete at a path; with agent (me only), what one of your agents may; its latest changes. |
bundle.readAsset(path, {inline?}) / createAsset / updateAsset / deleteAsset(path, why)read_asset · create_asset · update_asset · delete_assetFiles, tool by tool: a download URL, or the upload URL to PUT to. |
bundle.uploadAsset(path, bytes, input)create_asset · update_asset · read_assetA file in one call: the tool, the PUT straight to storage, then the check that it landed. With rev it replaces the file. |
bundle.downloadAsset(path)read_assetThe file's bytes and its asset block: {asset, bytes}. |
Files
A file (an asset) is kept with the concept that explains it, both at one path; body says what is in it, so the next reader need not open the file. uploadAsset sends the bytes straight to storage, never through Korpus, up to 100 MB; with rev it replaces the file.
const pdf = await readFile('q3-board-pack.pdf');
await notes.uploadAsset('reports/q3-board-pack', pdf, {
filename: 'q3-board-pack.pdf',
content_type: 'application/pdf',
body: 'Q3 board pack. Revenue 1.2 M (+8 %), churn 2.1 %. Hiring freeze until Q1.',
change_description: 'Filed the Q3 board pack',
});
const { bytes } = await notes.downloadAsset('reports/q3-board-pack');Files count against their own space, apart from the space for documents, charged to the bundle's team (quota_exceeded, limit asset_space).
Collections and views
A collection is a folder of items that share one shape: a name (incidents), an item type (Incident), fields, required sections and a key the path is made from. Someone with Write on the bundle defines and changes it (defineCollection, updateCollection, as me), and every write of an item is checked against it (item_mismatch, wrong_path, wrong_type, not_allowed_here). A view is a saved query of one collection, shown as a table, list, board or tree (defineView). An agent reads both and queries the items; a type no collection declares is queried too (type), by its values as stored.
const { collections } = await notes.schema();
const incidents = await notes.collection('incidents'); // fields, views, a blank item
const open = await notes.query({
from: ['incidents'],
where: [{ field: 'severity', op: 'in', value: ['high', 'critical'] }],
sort: [{ field: 'opened', dir: 'desc' }],
limit: 20,
});
if (open.mode === 'rows') for (const row of open.rows) console.log(row.path, row.fields);
const board = await notes.query({ view: 'open-incidents' }); // a saved viewConditions: eq, ne, lt, lte, gt, gte, in, prefix, contains, exists, up to 10, all of which must hold. Sort by up to three fields; path ends the order. A query reads one collection (from); its fields and the core ones (date, status, stale_after, owner, title). group_by and aggregates answer groups or totals instead of rows. The answer's mode says which (rows, groups, totals); rows carry a cursor when there is more.
Errors and retries
A refusal throws KorpusError: status (the HTTP status; 0 when no answer came), code (stable: restricted, not_found, rev_mismatch, rate_limited, …), message (what to do, for a person), retryAfter in seconds where the server names a wait, and details. The codes are those of Errors; a key of another deployment is refused with 401 (give its URL, or let the key name it).
import { KorpusError } from '@korpus-cloud/sdk';
try {
await notes.update('runbooks/deploy', { rev: 4, body, change_description: 'Rewrote step 3' });
} catch (error) {
if (error instanceof KorpusError && error.code === 'rev_mismatch') {
// read again, merge, update with the new rev
} else throw error;
}Writes and reads have the same short-term rates as on every way into Korpus. Over one the call is refused with rate_limited and retryAfter in seconds. new Korpus({ retries: 2 }) waits that long and sends it again. korpus.usage(), signed in as you, says how full your document and file space is and is never refused; an agent is refused it. The ceilings every plan shares: Limits and usage.
The database pauses after a while idle. A call that meets it starting waits for it, up to about 22 s; one that still meets it starting is refused with database_starting before anything ran, so the client waits retryAfter and sends the same call again, by itself, for up to wakeWait seconds all told (30 by default); an upgrade's maintenance gate is waited out alike. korpus.awaitReady() warms it up ahead of time.
Options
new Korpus(options), every one optional:
token | An agent's key (kp_…), sent as the bearer. It names its deployment, so it needs no baseUrl, and is sent there unless baseUrl or KORPUS_URL names another URL. Default: KORPUS_KEY. |
credentials | Where the bearer comes from: fromGitHubActions({audience}), fromAwsWebIdentity({audience}), fromOAuth(), fromStaticToken(key). Default, in order: KORPUS_KEY; a GitHub Actions job with KORPUS_AUDIENCE (a trusted workload); the sign-in korpus login stored on this machine; an AWS workload with KORPUS_AUDIENCE. |
agent | Which stored sign-in, when this machine holds several. Default: KORPUS_AGENT. |
baseUrl | Which Korpus: any URL of the deployment (the app, its API, an MCP address); the ops are called at its API host, https://api.<host>/v1. Default, in order: KORPUS_URL; the deployment the key names; the deployment KORPUS_AUDIENCE names; https://api.fra.korpus.cloud. A platform token is traded only at the deployment its audience names. |
retries | How many times a call refused with rate_limited is sent again, after the wait the server names. Default 0: it throws at once. |
maxRetryWait | The longest wait a retry accepts, in seconds. Default 60. |
wakeWait | How long a call waits, in seconds all told, while the database starts (database_starting) or an upgrade holds every call (maintenance): nothing ran, so it sends the same call again after the Retry-After the server names. Default 30; 0 throws at once. |
fetch | A fetch of your own: a proxy, a test double. |
userAgent | Added to the user agent, e.g. nightly-sync/1.2. |
The variables: KORPUS_KEY (an agent's key, which names its deployment), KORPUS_AUDIENCE (a trusted workload's audience), KORPUS_AGENT (which stored sign-in) and KORPUS_URL (which Korpus, over what the key or the audience names).
What an agent cannot do
It is held to its narrowing: the bundles it names, each with its access, never beyond your own; listings leave out what it may not read. Creating, moving, copying, exporting or deleting bundles, defining collections and views, teams and people, and managing agents stay with you: in the web app, as me over MCP, or with the korpus command.
The CLI
The SDK ships one command, korpus. Install it once: npm install -g @korpus-cloud/sdk.
As you
korpus login [--url <url>] korpus logout
korpus login alone opens Korpus in your browser: you allow Korpus CLI to use Korpus as you, and the browser comes back to the command on 127.0.0.1. Every other command then runs as you, with your own permissions, so it can do what an agent cannot: make and share bundles, invite people, and make agents with their keys and trusts. It never uses KORPUS_KEY, and a program's new Korpus() never picks this sign-in up. It is a connection of me under Agents, where you revoke it.
korpus bundle list | show <bundle> | delete <bundle> --confirm <name> korpus bundle create <name> [--description <text>] [--team <@team> [--team-access none|read|write|<access>]] korpus bundle update <bundle> [--name <name>] [--description <text>] [--maintainer <@username>] korpus bundle share <bundle> <@username|email|@team> read|write|none|<access> | unshare <bundle> [<@username|email|@team>] | accept <bundle> [--team <@team>] korpus schema <bundle> korpus collection list <bundle> | show <bundle> <collection> korpus agent list | create <name> --description <job> --bundle <bundle>[=read|write|<access>]... | update <name> [--description <job>] [--bundle ...] | delete <name> korpus team list | show <@team> | create <handle> --name <name> [--color <color>] | rename <@team> --name <name> | color <@team> <color> | delete <@team> --confirm <@team> korpus team invite <@team> <@user|email>... | remove <@team> <person> korpus team link <@team> --seats <n> [--days <n>] [--bundle <bundle>[=read|write|<access>]]... | unlink <@team> <link id> korpus team peek <token> | join <@team> | --link <token> | decline <@team> | leave <@team> | hand-on <@team> <@member> | --withdraw korpus people find <prefix> korpus key create <agent> --label <what for> [--days 30|90|365] [--door api|mcp] korpus trust github <agent> --repo <owner/name> --environment <env> korpus trust aws <agent> --issuer <url> --role-arn <arn> korpus connection list [me|<agent>] | revoke <me|agent> <id> korpus whoami korpus call <tool> ['<json arguments>']
An <access> is read, write or Custom: up to 5 rules, comma-separated, each a path pattern, a colon and the rights as letters, read always in: 'notes/**:rcu,README:r' reads README and reads, creates and updates under notes. An agent reaches only the bundles named with --bundle, each read unless given; agent update --bundle replaces the whole list. bundle create --team makes it in a team you are in, giving every member write unless --team-access says otherwise; you maintain it. bundle share sets or changes a share as its maintainer (none only for its own team); outside its team the person, or the team's owner, says yes with bundle accept. bundle unshare ends one at once, from either side. team link makes a join link, its token shown once; with --bundle it shares those bundles with whoever opens it instead of making them members. team peek says which team a token is for, its owner and what it gives, before team join --link opens it. What you may do in a team follows from whether you own it: team show says it, and a call you may not make answers forbidden. people find answers only where the deployment lists its people; elsewhere, ask for the @username.
Concepts go in and out as Markdown files, laid out like an export: <path>.md, YAML frontmatter, then the body. type, title, description, tags, relations, status, stale_after and date are the concept's fields; any other key is kept as written. korpus read adds rev, the revision it read, and korpus update sends each file's rev back, so it fails with rev_mismatch if someone changed the concept since; --rev overrides it for one file.
korpus ls <bundle> [<folder>] [-r] korpus read <bundle> <path> [-o <file.md> | --out <dir>] korpus create <bundle> <file.md>... -m <why> [--root <dir> | --path <path>] [--type <type>] korpus update <bundle> <file.md>... -m <why> [--root <dir> | --path <path>] [--rev <n>] korpus delete <bundle> <path>... -m <why>
A file's concept path is the file's path under --root without .md, or --path. Several files go as one batch per 50. Every command prints what the tool answered, or with --json its data; a new key alone goes to stdout. A database still starting is waited out as the SDK does (wakeWait). The deployment: --url, else KORPUS_URL, else the one you signed in to, else production. korpus help lists every command.
As an agent
korpus login <agent> [--user <username>] [--url <url>] korpus logout <agent> [--user <username>] [--url <url>]
korpus login <agent> signs this machine in as the agent by device code (Connect): it prints a short code and a link, you allow it in Korpus, and the sign-in is stored in ~/.config/korpus/sign-ins.json (owner only; $XDG_CONFIG_HOME if set), refreshed at the deployment's API as it ages. new Korpus() finds it; with several stored, name one with KORPUS_AGENT or the agent option. The sign-in is a connection under Agents, where you revoke it. korpus logout forgets it on this machine. --url names any URL of the deployment when it is not production; a bare host (dev.fra.korpus.cloud) is taken as https://. A login that waits for your yes keeps asking through a dropped network until the code expires.
A sign-in made here serves the API, where the SDK calls. An MCP client such as Claude Code signs in at the agent's MCP address itself, or sends a key.
Not on the API
Publishing a bundle to the catalog, reviewing it and the users admin are for reviewers, in the web app or as a reviewer's me; they are not listed here. Billing is the web app's own session's, listed under Only on the API. Questions: support@korpus.cloud.