Docs Contracts
Ontology contract
How a business module describes its records, links and actions as data at /v1/ontology, and the generic object, action, proposal and undo routes and agent tools every module with the ontology feature serves.
Version 1. A business module that lists ontology in its manifest's features (contracts/module/README.md) describes, as data, the kinds of records it holds, how they link and which actions can be taken on them, and serves them through the same generic routes as every other such module. Clients, agents and shared services then use any module without code written for it. The idea is Palantir's Ontology (object types, link types, action types, interfaces), federated: each module serves its own part from its own database, and nothing central holds module data.
A module meets the contract if it passes conformance.ts, which speaks only HTTP and MCP, so a module can be written in any language. It calls the agent tools as an agent does: they must be listed the same with no token, answer inside <module_record>, leave never-tier actions out of describe and refuse to draft them, mask every sensitive value, refuse a filter or sort on one, and need their grant action. descriptor.schema.json is the descriptor's shape, and descriptor.ts checks a descriptor against it and against the rules below that a schema can't hold. In Go, t10-modkit/ontology builds all of it from declarations, with a client in ontology/client and a TypeScript client and components in the web kit. guides/use-the-ontology.md shows how to use it in a module, a web app, a service and an agent.
The examples use a property-management module's records (property:work_order), which is outside this workspace; here, t10-collab and t10-modkit's sales-shaped test module (ontology/testdata/ledgermod) serve it.
The reasoning behind it is in design.md.
The descriptor#
GET /v1/ontology answers the descriptor for the caller's tenant, for a person's or a delegated token, with nothing from another tenant and no record data. No token is 401.
{
"module": "property",
"version": 3,
"object_types": { "work_order": { … } },
"action_types": { "work_order.accept": { … } },
"restricted": ["settlement.post"],
"interfaces": ["t10:Assignable"],
"events": { "work_order.overdue": { "on": "work_order" } },
"tenant": { "revision": 0 }
}moduleis the module's ID, andversionis the core's version, an integer that increases whenever the core changes.interfaceslists every interface the module's types implement, andeventsthe event kinds it posts, each with the object type it concerns. Each kind also appears in the manifest'strigger_eventsorevents.restrictedlists the module's actions that post or change money, consent or access scope. Every one of them has tiernever.
Core and tenant layer#
Everything outside tenant is the core: declared in code, identical for every tenant. A module whose tenants configure their own schema, such as a sales pack's stages, roles and person fields, describes that configuration in tenant, with its own revision that follows the tenant's configuration and never changes the core's version. A module with no tenant configuration answers "tenant": {"revision": 0}.
"tenant": {
"revision": 3,
"object_types": {
"deal": {
"values": { "stage": ["线索", "商机", "在跟", "中标待签", "交付"] },
"links": { "stakeholders": { "values": { "role": ["决策人", "使用人"] } } }
},
"stakeholder": {
"properties": { "F": { "type": "text", "name": "Family", "name_zh": "家庭", "sensitivity": "personal" } }
}
},
"action_types": {
"record.add": { "values": { "kind": ["拜访", "情报收集", "需求挖掘"] } }
}
}A tenant layer only adds:
- enum
valuesto core object properties, link properties and action parameters; properties, with their sensitivity, to core object types and links, under names the core doesn't use.
It never adds action types, never removes anything, and never retypes a core property. A tenant layer adds values to an action parameter only when the parameter is declared "label": true, unless the action's tier is never. label: true promises that the action's effect doesn't depend on the value, which the module's own tests keep: it names the kind of change, as a pack's action types name the kinds of record record.add writes. So a tenant's admin can name kinds of fact, but never widen what an agent may do.
Clients cache a descriptor per tenant, by version and tenant.revision.
Object types#
"work_order": {
"label": "Work order",
"label_zh": "工单",
"description": "A repair or complaint from a household, and its handling.",
"title": "summary",
"implements": ["t10:Assignable", "t10:HasDeadline"],
"properties": {
"summary": { "type": "string", "name": "Summary", "name_zh": "摘要" },
"state": { "type": "enum", "values": ["pending", "processing", "completed"] },
"account": { "type": "ref", "to": "property:account" },
"assignee": { "type": "ref", "to": "auth:user" },
"deadline": { "type": "timestamp" }
},
"links": {
"transitions": { "to": "property:work_order_transition", "many": true }
}
}- A type's key is unique within the module, and its objects' references are
<module>:<type>:<id>, such asproperty:work_order:wo_1. titlenames the property that is the object's title.descriptionis one sentence on what the type is for, which agents read.text_search, optional, lists the corestringandtextproperties with nosensitivitythat a search'sqmatches.variant_by, optional, names a coreenumproperty. A tenant property that carriesvariant(one of that property's values) appears only on objects whosevariant_byproperty has that value, such as an item type's own fields.
Each property has a type:
| Type | JSON value |
|---|---|
string |
a short string |
text |
free text people wrote |
integer |
an integer |
decimal |
a decimal, as a string such as "12.50" |
money_fen |
an integer number of fen |
boolean |
true or false |
date |
"2026-11-26" |
timestamp |
RFC 3339, such as "2026-11-26T08:00:00Z" |
enum |
one of values (the core's, then the tenant layer's) |
ref |
a reference to an object of the type to names, as <module>:<type> |
A property may also carry:
nameandname_zh, its labels;description: one English sentence of at most 300 characters on what it means, written for agents. A tenant layer may describe the properties it adds, never a core one;variant, on a tenant property only: seevariant_byabove;sensitivity:contact,identityorpersonal, for personal contact, identity or private-life data;derived: true, for a value computed from other records, withsources: truewhen the module can name those records.
A ref may point to another module's type, such as auth:user or collab:work_item, or, with "to": "*", to any object in any module, such as what a task is about. Only the module holding the reference declares and reads it.
Sensitive properties are masked or left out for every agent, whatever the person's own rights, and an agent can't filter or sort on them.
Derived properties are never set by an action directly, and no action on the type has a parameter with a derived property's name. An action changes a derived value only by writing the records it's computed from, so every value can name its records.
Links#
A link has a to type and many, and may declare its own properties, typed as object properties are, such as the per-deal role of each stakeholder on a deal. Each linked object in an answer carries them under link. A tenant layer may add values and properties to a link, as it does to an object type.
Action types#
"work_order.accept": {
"label": "Accept",
"label_zh": "受理",
"on": "work_order",
"permission": "property:work_order.process",
"params": {
"note": { "type": "text", "required": false }
},
"idempotent": false,
"undo": false,
"agent": "propose"
}onnames the object type it acts on. An action with nooncreates an object.paramsare typed as properties are, each withrequiredand an optionaldescription. A parameter may be"label": true(see the tenant layer).permissionis the business permission the person needs.idempotent: truemeans apply needs anIdempotency-Key. Any action given one replays its answer for it.undo: truemeans apply answers an undo ID, usable forundo_windowseconds.agentis the tier:never: only people apply it;propose: an agent drafts it, and the person confirms, unless the person let their assistant act without asking (see "Auto-apply"), when the agent applies it for them;undoable: an agent applies it for the person, under their rights, and the person can undo it. Anundoableaction is alsoidempotentandundo, with anundo_window.
Interfaces#
Interfaces are defined here, in interfaces.json, and a module never defines one of its own under the t10: prefix. An object type that lists one in implements has its properties, with the same types:
| Interface | Properties |
|---|---|
t10:Assignable |
assignee: ref to auth:user |
t10:HasDeadline |
deadline: timestamp |
t10:Person |
name: string |
t10:Commentable |
comment_count: integer |
A shared reader, such as a list of everything assigned to someone, reads modules through interfaces and so names no module.
Versioning#
Within one manifest api_version, a change to the core only adds object types, properties, links, action types, optional parameters and events, and raises version. Removing or retyping anything needs a new api_version. A module keeps its last published core in docs/ontology.json, and its own test fails when the core removes or retypes anything without a new api_version, or loosens a tier (never to propose, propose to undoable) without raising version and updating the pinned copy.
Objects#
Every object in an answer has this shape:
{
"ref": "property:work_order:wo_1",
"type": "work_order",
"title": "Kitchen leak",
"revision": 4,
"properties": { "state": "pending", "account": "property:account:acc_7" },
"actions": [
{ "action": "work_order.accept", "allowed": true },
{ "action": "work_order.approve", "allowed": false, "reason": "wrong_state" }
]
}propertiesholds only what the caller may see, under the same field rules as the module's own routes, including the tenant layer's properties. A masked property is in its masked form or absent, never hidden plaintext.actionshas one entry for every action type on the object's type.reasonis a stable code whenallowedis false, such asforbiddenorwrong_state. A client uses the list only to show or hide controls, and apply still refuses.titles, when there are any, maps the references inpropertiesto their objects' titles: the module's own objects the caller may see, and other modules' objects the module can name, such asauth:userfrom the member names it keeps. Anything else is left out.
A record the caller can't reach answers 404, exactly as one that doesn't exist.
| Route | Answer |
|---|---|
GET /v1/objects/{type}/{id} |
the object. ?sources=<property> adds sources: {"<property>": [refs]}, newest first, limited to records the caller may see |
POST /v1/objects/{type}/search |
{objects, next_cursor, total, total_capped} |
GET /v1/objects/{type}/{id}/links/{link} |
{objects, next_cursor, total, total_capped}, each object with link, under the same scope and masking. ?limit= and ?cursor= page it. A linked object of another module carries its title when the module can name it |
POST /v1/objects/resolve |
{objects}: {ref, type, title, actions} for each of up to 100 refs the caller can see, in the order given. Refs the caller can't see, that don't exist or belong to another module are left out, with no error |
A search body:
{
"filter": { "and": [
{ "property": "state", "op": "in", "value": ["pending", "processing"] },
{ "property": "deadline", "op": "lt", "value": "2026-11-26T08:00:00Z" }
] },
"sort": { "property": "deadline", "desc": false },
"limit": 50,
"cursor": "…"
}filteris one condition or{"and": [...]}of them, each on a declared property (the core's or the tenant layer's).q, optional, at most 200 characters, keeps the objects where any of the type'stext_searchproperties contains it, ignoring case.qon a type with notext_searchis 400filter_not_allowed.- The ops are
eq,in,lt,gtand, forstringandtext,contains. sortnames one declared property. Without one, objects come in the module's default order.limitis at most 100, and 50 by default.cursoris the opaquenext_cursorof the page before.- The module applies the caller's scope before sorting and paging.
totalis how many objects match the filter andqin the caller's scope, whatever the page. Over 1,000 it is 1,000 withtotal_capped: true.eqandinon a"*"reference take any<module>:<type>:<id>.
A filter or sort on an unknown property, a wrong-typed value, a limit over 100 or a cursor the module didn't issue is 400 invalid_request. A filter the module won't run, such as on an unindexed or masked property, is 400 filter_not_allowed.
Reads of a type whose own routes are audited, such as residents, are audited the same way, with via from the token. The audit commits before the answer, and a failed audit fails the read.
Actions#
| Route | Answer |
|---|---|
POST /v1/actions/{action}/validate |
{valid, errors: [{param, code}]}. param is empty for an error about the whole action, such as forbidden or wrong_state. It changes nothing |
POST /v1/actions/{action}/apply |
{object, undo}: the changed or created object, and, for an undo action, {id, expires_at} |
GET /v1/undo |
{undo: [{id, action, object, agent, created_at, expires_at}]}: the caller's own applied actions that can still be undone, newest first. agent is there when an agent applied it through <prefix>_act, so an app can show the person what was done for them, with Undo |
GET /v1/done |
{done: [{id, action, object, agent, created_at, undo_id, undo_expires_at}]}: what agents applied for the caller through <prefix>_act in the last 7 days, undoable or not, newest first. undo_id and undo_expires_at are there while it can still be undone. Only a module whose manifest lists auto_apply serves it |
POST /v1/undo/{id} |
{object}, after a compensating change |
Both take {object, revision, params}: object is the reference acted on, absent for a create, and revision is the revision the caller last saw.
Apply runs the action as the module's own command: permission and scope checked again, the revision compared, and the change, its audit and its side effects in one transaction. It has exactly the effect of the module's existing route for that command. Its errors:
| Status | error |
When |
|---|---|---|
| 400 | invalid_params |
the params don't validate; the body also has errors |
| 400 | idempotency_key_required |
the action is idempotent and the header is missing |
| 403 | forbidden |
the object is visible but the person may not do this |
| 404 | not_found, unknown_action |
the object isn't visible, or the action isn't declared |
| 409 | wrong_state |
the object's state doesn't allow the action |
| 409 | stale_revision |
revision isn't the current one |
| 409 | idempotency_conflict |
the key was used with another body |
| 409 | request_in_progress |
another request with the same key is still running, or stopped before it answered |
A replay with the same Idempotency-Key and body answers the original result, after checking the person's current rights again. A key covers the module, not one action: the same key on another action is 409 idempotency_conflict. The key is claimed before the action runs, so two requests with one key never both apply it. A request that changed nothing gives its key back, and one that stopped after the change keeps it claimed, so a new key is needed rather than a second apply.
Undo. Only the person an action was applied for can undo it (anyone else gets 404), or an agent acting for them through <prefix>_withdraw when an agent applied it, until undo_window runs out (409 undo_expired). An undo writes a compensating change that names the original and never erases it. After a later change that depends on it, undo is 409 undo_conflict, and once done, 409 undone. An undo that was interrupted after it started can be run again, even past the window, so the module writes the compensating change at most once per undo ID. An entry leaves GET /v1/undo once its undo starts or its window runs out; nobody else's is ever listed.
Proposals#
An agent drafts a propose or undoable action for the person it acts for, and the person confirms it.
| Route | Answer |
|---|---|
GET /v1/proposals |
{proposals: [{id, action, object, revision, params, agent, created_at, expires_at}]}: the caller's own open drafts. revision is the object's when the draft was made |
POST /v1/proposals/{id}/confirm |
the apply answer. The body may carry edited params and a revision, the one the person now sees; without it the draft's own is compared, so a draft whose object changed since is 409 stale_revision and stays open. It applies under the person's current rights, with via: "proposal" and the proposal's ID in the audit |
POST /v1/proposals/{id}/dismiss |
{id, status: "dismissed"}, with no other effect |
A draft expires 7 days after it's made (409 proposal_expired), and one that's closed is 409 proposal_closed. Someone else's draft, or one whose object the person can no longer see, is 404. A person holds at most 50 open drafts per module, and a proposal over that is 409 too_many_proposals.
Who may call#
The object, action, proposal and undo routes take a person's own token only. A delegated token, which carries an act or grant claim, is 401 person_token_required, so an agent can't step around its tier. Agents use the module's MCP tools instead.
Agent tools#
A module with the feature offers these MCP tools, listed with its other tools and reaching harnesses through ai-gateway's /mcp/modules. <prefix> is the manifest's action_prefix.
| Tool | Grant action | Input |
|---|---|---|
<prefix>_describe |
<prefix>:read |
none |
<prefix>_search |
<prefix>:read |
{type, filter, sort, limit, cursor} |
<prefix>_get |
<prefix>:read |
{ref, sources} |
<prefix>_links |
<prefix>:read |
{ref, link, limit, cursor} |
<prefix>_propose |
<prefix>:propose |
{action, object, params} |
<prefix>_activity |
<prefix>:read |
none |
<prefix>_withdraw |
<prefix>:propose, and also <prefix>:act to undo |
{undo_id} or {proposal_id} |
<prefix>_act |
<prefix>:act, and also <prefix>:apply for a propose action |
{action, object, revision, params, request_id} |
<prefix>_actis listed exactly when the core declares anundoableaction, or, in a module whose manifest listsauto_apply, anundoableorproposeaction.- Names, descriptions and input schemas never depend on a tenant, so the gateway lists and caches them with no token. Types, values and actions come from
<prefix>_describe, which answers the tenant's descriptor with only the actions an agent may propose or act on. In a module that listsauto_apply, each carriesagent_applies: whether this agent may apply it now through<prefix>_act. - Each tool also checks that the person holds the action's own permission, so the grant narrows and never widens.
<prefix>_describealso answerstool_prefix, the prefix of the tools that read the module's references.- Search and get answer as the object routes do for the person, with every property that has a sensitivity masked and attachment bytes never returned. A filter or sort on a sensitive property is
filter_not_allowed, andqnever matches one. Search takesq. - In search and links answers, each object lists only the actions the person may take now, among those an agent may propose or act on. Get lists every action an agent may propose or act on, with
allowedandreason. - Get also answers
links: for each link of the object's type,{total, total_capped, objects}with the first 5 objects as{ref, title, link}, or{error}for a link that failed. Links pages one link as the link route does. - Activity answers
{drafts, done}: the person's open drafts, asGET /v1/proposalslists them, and what agents applied for them through<prefix>_actin the last 7 days, asGET /v1/donelists them, each with its object's title. - Withdraw takes back what an agent did, for the person it acts for:
undo_idundoes, asPOST /v1/undo/{id}does, only an entry an agent applied through<prefix>_actfor that person (anything else isnot_found), andproposal_iddismisses that person's open draft. Errors keep the routes' codes, such asundo_expired,undo_conflict,undoneandproposal_closed. - Propose validates as
validatedoes and stores a draft only when the params are valid and the tier isproposeorundoable, answering{proposal, ref}. - Act applies an
undoableaction, or aproposeaction when the grant holds<prefix>:apply, never aneverone. It applies withrequest_idas itsIdempotency-Key, and answers the result, with its undo ID for anundoaction. - An action an agent may not take is the tool error
not_allowed_for_agents. Other tool errors carry the routes' codes, such asforbidden,stale_revisionandtoo_many_proposals. - Results are JSON inside
<module_record module="<id>">…</module_record>, because people wrote the text in them.json.Marshalescapes<, so text can't close the tag.
Auto-apply#
A person may let their assistant apply a module's propose actions without asking. The choice is theirs, per module and per tenant, and auth-server keeps it (GET/PUT /v1/me/auto-apply). It reaches modules only as the grant action <prefix>:apply on the agent's grant chain: auth-server answers a chain with <prefix>:apply only while the chain's principal is a person whose choice lists <prefix>, so turning it on or off reaches a running agent within the verifier's chain cache, and a tenant agent account never holds it. A runtime holds it only when its clients.yaml actions list it.
A module that serves it lists auto_apply in its manifest's features, beside ontology, and then:
- lists
<prefix>_actbeside aproposeaction, and applies one through it under<prefix>:actand<prefix>:apply, with no draft; - marks
agent_applieson each action in<prefix>_describe; - serves
GET /v1/done; - audits an action applied this way with
via: "agent", the agent andauto_apply: true, so it's never mistaken for one the person confirmed.
A never action stays out of an agent's reach, and the person's own permission is checked as for any action. A module that doesn't list auto_apply drafts every propose action, whatever the grant holds, and apps offer no switch for it.
Clients#
A client finds ontologies only from the modules it's configured with, reading each manifest and fetching /v1/ontology only where features lists ontology and api_version is one it supports. resolve(refs) groups references by module, calls each module's resolve once and merges the answers in order, naming the modules that didn't answer. In a browser, calls go through Workbench's /api/modules/{id} proxy or an app's own /api, so no token is in the page. A service calls with the person's own token for this request, never its own or a delegated one. Errors keep their status and error code.
Not in the contract#
- A query language that joins across modules, and a central object index.
- Tools across modules, and tenant policy written in ontology terms.
- Automation triggers from ontology events.
Generated from t10’s own docs (bbc3cde). Spotted a problem? Tell us.