clankie

API

Conversations

The conversation dispatch route and its ops, conversation heads, Auto rounds, metrics and Clankie's memory routes.

On this page

This page covers the conversation service: the single dispatch route that reads and writes conversations, plus the routes beside it for conversation heads, Auto rounds, metrics and memory. Most routes take the operator token. The dispatch route also takes a device session with Take Control and the lead token, and some memory routes take the lead token or a Discord bridge token.

Dispatch

POST /operator/v1/dispatch is one route for many operations. The JSON body names the operation in op and always carries schemaVersion: 1. The response always carries the same op and schemaVersion: 1, plus the fields listed for that op. Each op below is a ### entry; send it to the same path.

Credentials. The route accepts any of:

  • Operator token: Authorization: Bearer $CLANKIE_OPERATOR_TOKEN.
  • Device session with Take Control: Authorization: Bearer $CLANKIE_DEVICE_TOKEN.
  • Lead token: Authorization: Bearer $CLANKIE_LEAD_TOKEN. Discord bridge tokens are accepted in the same way.

The operator token and a device session with Take Control count as the owner's credential. Ops marked "owner only" refuse the lead token.

Errors every op can return

Status error When
400 invalid_request The body is not valid JSON or does not match the op's schema. Unknown fields are refused.
401 captain_authentication_required No accepted credential was sent.
503 captain_execution_unavailable No owner credential was sent and the service cannot check the lead token.
503 route_unavailable The op, or an option of it, is not served by this service. The body also has message.
503 conversation_store_unreadable A stored conversation could not be read. The body also has message.
503 service_restarting The service is stopping. Retry after it restarts. The body also has message and seatHandoff: "reported".

An op the service does not list here answers 503 route_unavailable.

list

POST /operator/v1/dispatch with "op": "list"

Lists conversations, newest updatedAt first. Side conversations forked from a parent are not listed. There is no pagination; the list holds at most 1000 conversations.

Auth: Operator token, device session with Take Control, or lead token.

Request body (JSON)

Field Type Required Description
op string yes "list".
schemaVersion number yes 1.
scope object no Only conversations with exactly this scope. See the scope kinds below.

Scope kinds (scope.kind): global; room with lane (discord_presence or discord_voice) and targetId; workspace with workspaceId and optional machineId; persona with personaId; seat with seatId; channel with channelId.

Response 200

Field Type Description
conversations object[] Conversation records.
conversations[].conversationId string The conversation id.
conversations[].scope object Its scope, as above.
conversations[].title string Title.
conversations[].isDefault boolean True for the default conversation.
conversations[].createdAt string ISO timestamp.
conversations[].updatedAt string ISO timestamp.
conversations[].sessionState string unbound, waiting, completed or failed.
conversations[].revision number Revision. Pass it as expectedRevision when sending.
conversations[].contextUsage object Optional. tokens (number or null) and contextWindow.
conversations[].designatedHeadConversationId string Optional. The conversation's head (see Conversation heads).
conversations[].roomHandoff object Optional. Room handoff metadata.

Errors

Status error When
503 conversation_store_unreadable A stored conversation could not be read, or more than 1000 exist.
sh
curl -sS http://127.0.0.1:4310/operator/v1/dispatch \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"list","schemaVersion":1}'

get

POST /operator/v1/dispatch with "op": "get"

Reads one conversation. When there is no such conversation, the response has no conversation field.

Auth: Operator token, device session with Take Control, or lead token.

Request body (JSON)

Field Type Required Description
op string yes "get".
schemaVersion number yes 1.
conversationId string yes The conversation id.

Response 200

Field Type Description
conversation object Optional. One conversation record, with the fields listed under list.

Errors

Status error When
503 conversation_store_unreadable The stored conversation could not be read.
sh
curl -sS http://127.0.0.1:4310/operator/v1/dispatch \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"get","schemaVersion":1,"conversationId":"'"$CONVERSATION_ID"'"}'

replay

POST /operator/v1/dispatch with "op": "replay"

Reads one page of a conversation's event journal. It never waits. A cursor problem is answered in the result as a recovery, not as an HTTP error.

Auth: Operator token, device session with Take Control, or lead token.

Pagination. Cursors are decimal strings of up to 12 digits; events carry them in increasing order.

  • Forward (the default): cursor is an exclusive lower bound. Without it the page starts at the oldest retained event. limit defaults to 200 (maximum 500). Pass the page's nextCursor as the next cursor; hasMore is true while more events follow the page.
  • Backward (direction: "backward"): cursor is an exclusive upper bound. Without it the page ends at the newest event. The page holds up to limit events (default and maximum 500), cut to at most turnLimit turns (default 20, maximum 40). Pass previousCursor as the next backward cursor; hasOlder is true while older events remain.

Request body (JSON)

Field Type Required Description
op string yes "replay".
schemaVersion number yes 1.
replay.schemaVersion number yes 1.
replay.conversationId string yes The conversation id.
replay.surfaceClientId string yes Your client's id; echoed back on the page.
replay.cursor string no Where to start, as described above.
replay.limit number no Page size, 1 to 500.
replay.direction string no "backward" to page toward older events.
replay.turnLimit number no Backward only. Most turns in the page, 1 to 40.

Response 200

result.status is page or recover.

Field Type Description
result.status string page.
result.conversationId string The conversation id.
result.surfaceClientId string Echo of the request's value.
result.events object[] Events. Each has schemaVersion, conversationId, cursor, revision, occurredAt and type (activity, auth, context, file, input_requested, input_resolved, message, reaction, reasoning, session, tool, turn, unsupported or worker_transcript), plus that type's fields.
result.retainedFromCursor string Oldest cursor still retained.
result.nextCursor string Forward resume cursor.
result.previousCursor string Backward pages only. Cursor for the next older page.
result.hasOlder boolean Backward pages only. Older events remain.
result.safeCursor string Latest event's cursor.
result.hasMore boolean Forward: more events follow. Backward: same as hasOlder.
Field Type Description
result.status string recover.
result.conversationId string The conversation id.
result.code string unknown_conversation, cursor_invalid, cursor_expired or cursor_reset.
result.recoverable boolean False only for unknown_conversation.
result.resetCursor string Cursor to restart from.
result.message string Plain explanation.

Recovery codes: cursor_invalid when the cursor is not a decimal cursor of up to 12 digits; cursor_expired when it is older than retainedFromCursor; cursor_reset when it is ahead of the newest event; unknown_conversation when there is no such conversation.

Errors

Only the errors every op can return.

sh
curl -sS http://127.0.0.1:4310/operator/v1/dispatch \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"replay","schemaVersion":1,"replay":{"schemaVersion":1,"conversationId":"'"$CONVERSATION_ID"'","surfaceClientId":"my-script","limit":50}}'

tail

POST /operator/v1/dispatch with "op": "tail"

A long-poll version of replay. When the page would be empty and nothing more is waiting, the request waits up to waitMs for the journal to change, then reads again.

Auth: Operator token, device session with Take Control, or lead token.

Pagination. Same cursors and limits as replay. To follow a conversation, call tail again with the last page's nextCursor.

Request body (JSON)

The tail object takes every replay field, plus:

Field Type Required Description
op string yes "tail".
schemaVersion number yes 1.
tail object yes Same fields as replay in the replay op.
tail.waitMs number no How long to wait for news, 0 to 20000 ms. Absent or 0 answers at once.
tail.liveSequence number no Leave absent or 0. Any other value answers at once.

Response 200

Same as replay: result is a page or a recover.

Errors

Only the errors every op can return.

sh
curl -sS http://127.0.0.1:4310/operator/v1/dispatch \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"tail","schemaVersion":1,"tail":{"schemaVersion":1,"conversationId":"'"$CONVERSATION_ID"'","surfaceClientId":"my-script","cursor":"'"$NEXT_CURSOR"'","waitMs":20000}}'

send

POST /operator/v1/dispatch with "op": "send"

Sends a message turn to one of Clankie's own conversations (the global conversation or a workspace conversation on this machine). The turn carries the revision you read: a stale expectedRevision is answered as a conflict and nothing is sent.

Auth: Operator token, device session with Take Control, or lead token.

Request body (JSON)

Field Type Required Description
op string yes "send".
schemaVersion number yes 1.
turn.schemaVersion number yes 1.
turn.kind string yes "message".
turn.conversationId string yes The conversation id.
turn.surfaceClientId string yes Your client's id.
turn.expectedRevision number yes The conversation's current revision.
turn.message string yes The message, up to 16384 characters. Must not be empty.
turn.delivery string no steer to steer a running turn, queue to wait for a separate turn. Absent lets the service decide.

Response 200

result.status is one of accepted, revision_conflict, seat_offline, seat_undelivered or seat_delivery_unconfirmed.

Field Type Description
result.status string Outcome, as above.
result.conversationId string The conversation id.
result.runId string accepted only. The run id; pass it to cancel.
result.revision number accepted only. Revision after the turn.
result.safeCursor string Latest event cursor.
result.deliveryStage string Optional. stored, delivered, uncertain, rejected or unavailable.
result.seatDelivery object Optional, accepted only. state (queued, started or steered) and optional detail.
result.expectedRevision number revision_conflict only. The revision you sent.
result.currentRevision number Not on accepted. The conversation's current revision.
result.detail string seat_undelivered and seat_delivery_unconfirmed only. What happened. Check the conversation before sending again.

Errors

Status error When
403 question_owner_required The owner's credential could not be confirmed.
503 route_unavailable The conversation is not one of Clankie's own conversations, or the turn carries attachments, freeAgent or workHandoff.
sh
curl -sS http://127.0.0.1:4310/operator/v1/dispatch \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"send","schemaVersion":1,"turn":{"schemaVersion":1,"kind":"message","conversationId":"'"$CONVERSATION_ID"'","surfaceClientId":"my-script","expectedRevision":12,"message":"What is the fleet doing?"}}'

cancel

POST /operator/v1/dispatch with "op": "cancel"

Interrupts one running or queued turn. A run that is unknown or already settled answers cancelled: false.

Auth: Operator token, device session with Take Control, or lead token.

Request body (JSON)

Field Type Required Description
op string yes "cancel".
schemaVersion number yes 1.
conversationId string yes The conversation id.
runId string yes The run id from send.

Response 200

Field Type Description
conversationId string Echo.
runId string Echo.
cancelled boolean True when the run was cancelled.

Errors

Status error When
403 question_owner_required The owner's credential could not be confirmed.
sh
curl -sS http://127.0.0.1:4310/operator/v1/dispatch \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"cancel","schemaVersion":1,"conversationId":"'"$CONVERSATION_ID"'","runId":"'"$RUN_ID"'"}'

pending_messages

POST /operator/v1/dispatch with "op": "pending_messages"

Lists or changes the messages waiting for the agent seat a conversation talks to. A conversation with no controllable seat answers unsupported.

Auth: Owner only (operator token or device session with Take Control).

Request body (JSON)

Field Type Required Description
op string yes "pending_messages".
schemaVersion number yes 1.
conversationId string yes The conversation id.
command.action string yes list, remove, send_now or edit.
command.messageId string for remove, send_now, edit The pending message.
command.expectedVersion number for remove, send_now, edit The message's current version.
command.text string for edit New text, 1 to 16384 characters.

Response 200

Field Type Description
result.outcome string listed, edited, removed, picked_up, uncertain, unavailable, conflict or unsupported.
result.messages object[] Up to 100 pending messages.
result.messages[].messageId string Message id.
result.messages[].conversationId string Conversation id.
result.messages[].text string Text.
result.messages[].version number Version, for expectedVersion.
result.messages[].createdAt string ISO timestamp.
result.messages[].state string queued, dispatching, picked_up, removed, uncertain or unavailable.
result.messages[].detail string Optional.
result.detail string Optional. Explanation.

Errors

Status error When
403 operator_authority_required The request did not use the owner's credential.
403 question_owner_required The owner's credential could not be confirmed.
sh
curl -sS http://127.0.0.1:4310/operator/v1/dispatch \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"pending_messages","schemaVersion":1,"conversationId":"'"$CONVERSATION_ID"'","command":{"action":"list"}}'

stop_task

POST /operator/v1/dispatch with "op": "stop_task"

Stops the task running in the agent seat a conversation talks to. A failed stop may already have reached the seat, so it answers uncertain rather than an error.

Auth: Owner only (operator token or device session with Take Control).

Request body (JSON)

Field Type Required Description
op string yes "stop_task".
schemaVersion number yes 1.
conversationId string yes The conversation id.
includeReason boolean no True adds result.reason when there is one.

Response 200

Field Type Description
result.outcome string stopped, already_finished, unsupported, uncertain or unavailable.
result.taskId string Optional. The task that was stopped.
result.detail string Optional. Diagnostic text.
result.reason string Optional, with includeReason only. unsent_draft.

Errors

Status error When
403 operator_authority_required The request did not use the owner's credential.
403 question_owner_required The owner's credential could not be confirmed.
sh
curl -sS http://127.0.0.1:4310/operator/v1/dispatch \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"stop_task","schemaVersion":1,"conversationId":"'"$CONVERSATION_ID"'"}'

channels

POST /operator/v1/dispatch with "op": "channels"

Lists channels (conversations several agents share), most recently updated first.

Auth: Operator token, device session with Take Control, or lead token.

Request body (JSON)

Field Type Required Description
op string yes "channels".
schemaVersion number yes 1.

Response 200

Field Type Description
channels object[] Up to 1000 channels.
channels[].channelId string Channel id.
channels[].conversationId string The channel's conversation.
channels[].title string Title.
channels[].members object[] Up to 12 members: personaId, position (turn order) and joinedAt.
channels[].createdAt string ISO timestamp.
channels[].updatedAt string ISO timestamp.
channels[].discord object Optional. guildId, channelId, optional threadId, and webhookId when the channel is projected onto Discord.

Errors

Only the errors every op can return.

sh
curl -sS http://127.0.0.1:4310/operator/v1/dispatch \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"channels","schemaVersion":1}'

channel

POST /operator/v1/dispatch with "op": "channel"

Creates a channel, or restates an existing one's title and members. Members are the whole list in turn order; a member who stays keeps its joinedAt. Each member gets its own persona conversation if it has none. The optional discord field projects the channel onto the managed Discord server.

Auth: Operator token, device session with Take Control, or lead token. A request with discord is owner only.

Request body (JSON)

Field Type Required Description
op string yes "channel".
schemaVersion number yes 1.
channel.schemaVersion number yes 1.
channel.channelId string no Absent creates a new channel.
channel.title string yes Title, up to 256 characters.
channel.members string[] yes Persona ids, at most 12.
channel.discord object no {"kind":"provision"} (optional room with kind channel or forum and channelId), {"kind":"webhook","webhookUrl":"..."}, or {"kind":"off"}. Absent leaves the projection as it is.

Response 200

Field Type Description
channel object The channel, with the fields listed under channels.
conversation object The channel's conversation record, with the fields listed under list.

Errors

Status error When
403 question_owner_required discord was sent without the owner's credential.
409 channel_projection_refused Discord refused the projection before anything was written. The body also has message.
sh
curl -sS http://127.0.0.1:4310/operator/v1/dispatch \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"channel","schemaVersion":1,"channel":{"schemaVersion":1,"title":"Release room","members":["'"$PERSONA_ID"'"]}}'

discord_rooms

POST /operator/v1/dispatch with "op": "discord_rooms"

Lists the rooms in the managed Discord server that a channel can be projected onto. The list is empty when Discord is not set up.

Auth: Operator token, device session with Take Control, or lead token.

Request body (JSON)

Field Type Required Description
op string yes "discord_rooms".
schemaVersion number yes 1.

Response 200

Field Type Description
rooms object[] Up to 500 rooms.
rooms[].kind string channel or forum.
rooms[].channelId string Discord channel id.
rooms[].name string Room name.

Errors

Status error When
409 channel_projection_refused Discord did not list the rooms. The body also has message.
sh
curl -sS http://127.0.0.1:4310/operator/v1/dispatch \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"discord_rooms","schemaVersion":1}'

autonomy

POST /operator/v1/dispatch with "op": "autonomy"

Reads or changes Auto for one of Clankie's own conversations: whether Auto is on, the conversation's pending wake, and the lead's reported next step. Every command answers the status after it.

Auth: Operator token, device session with Take Control, or lead token. Turning Auto on (set_enabled with enabled: true) is owner only.

Request body (JSON)

Field Type Required Description
op string yes "autonomy".
schemaVersion number yes 1.
conversationId string yes The global conversation or a workspace conversation on this machine.
command.action string yes status, set_enabled, clear_wake or report_continuation.
command.enabled boolean for set_enabled Turn Auto on or off.
command.continuation.mode string for report_continuation active, paused, complete or blocked_on_owner.
command.continuation.question string with blocked_on_owner only The decision the owner must make, up to 512 characters.

Response 200

Field Type Description
status.enabled boolean Whether Auto is on.
status.error string Optional. state_unreadable when the stored Auto state could not be read.
status.wake object Optional. at, reason and createdAt of the pending wake.
status.continuation object Optional. mode, optional question, and updatedAt.

Errors

Status error When
403 goal_owner_required Turning Auto on without the owner's credential.
500 (none) The conversation does not exist or is not one of Clankie's own conversations, or a continuation report met an unreadable store.
sh
curl -sS http://127.0.0.1:4310/operator/v1/dispatch \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"autonomy","schemaVersion":1,"conversationId":"'"$CONVERSATION_ID"'","command":{"action":"status"}}'

owner_update_list

POST /operator/v1/dispatch with "op": "owner_update_list"

Lists updates the lead mailed to the owner, newest first. Dismissed updates are left out unless asked for. There is no pagination; at most 1000 are returned.

Auth: Owner only (operator token or device session with Take Control).

Request body (JSON)

Field Type Required Description
op string yes "owner_update_list".
schemaVersion number yes 1.
conversationId string no Only updates from this conversation.
state string no unread, read, dismissed or all.

Response 200

Field Type Description
result.updates object[] Updates.
result.updates[].id string Update id (UUID).
result.updates[].conversationId string Conversation it came from.
result.updates[].at string ISO timestamp.
result.updates[].title string Title.
result.updates[].body string Body.
result.updates[].state string unread, read or dismissed.
result.updates[].readAt string Optional. ISO timestamp.
result.updates[].dismissedAt string Optional. ISO timestamp.
result.updates[].source object conversationId and optional seatId.
result.updates[].issue object Optional. A linked work item.
result.updates[].links object[] Optional. Up to 8, each label and url.
result.updates[].media object[] Optional. Up to 8, each url, mimeType and optional alt.
result.updates[].details string Optional. Technical details.
result.updates[].routine boolean Optional. true for routine news kept out of the feed.

Errors

Status error When
403 question_owner_required The request did not use the owner's credential.
sh
curl -sS http://127.0.0.1:4310/operator/v1/dispatch \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"owner_update_list","schemaVersion":1,"state":"unread"}'

owner_update_read

POST /operator/v1/dispatch with "op": "owner_update_read"

Marks one owner update as read.

Auth: Owner only (operator token or device session with Take Control).

Request body (JSON)

Field Type Required Description
op string yes "owner_update_read".
schemaVersion number yes 1.
id string yes The update id (UUID).

Response 200

Field Type Description
result.status string resolved or refused.
result.update object With resolved. The update, with the fields listed under owner_update_list.
result.reason string With refused. unknown_update.

Errors

Status error When
403 question_owner_required The request did not use the owner's credential.
sh
curl -sS http://127.0.0.1:4310/operator/v1/dispatch \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"owner_update_read","schemaVersion":1,"id":"'"$UPDATE_ID"'"}'

owner_update_dismiss

POST /operator/v1/dispatch with "op": "owner_update_dismiss"

Dismisses one owner update. It then leaves the default owner_update_list.

Auth: Owner only (operator token or device session with Take Control).

Request body (JSON)

Field Type Required Description
op string yes "owner_update_dismiss".
schemaVersion number yes 1.
id string yes The update id (UUID).

Response 200

Same as owner_update_read.

Errors

Status error When
403 question_owner_required The request did not use the owner's credential.
sh
curl -sS http://127.0.0.1:4310/operator/v1/dispatch \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"owner_update_dismiss","schemaVersion":1,"id":"'"$UPDATE_ID"'"}'

input_list

POST /operator/v1/dispatch with "op": "input_list"

Lists the questions the lead and its workers asked the owner, newest first. There is no pagination; at most 1000 are returned.

Auth: Owner only (operator token or device session with Take Control).

Request body (JSON)

Field Type Required Description
op string yes "input_list".
schemaVersion number yes 1.
conversationId string no Only questions from this conversation.
status string no pending (default), submitted or cancelled.

Response 200

Field Type Description
result.questions object[] Question results, each shaped as in input_get.

Errors

Status error When
403 question_owner_required The request did not use the owner's credential.
sh
curl -sS http://127.0.0.1:4310/operator/v1/dispatch \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"input_list","schemaVersion":1}'

input_get

POST /operator/v1/dispatch with "op": "input_get"

Reads one question. Without requestId it reads the conversation's first pending question.

Auth: Owner only (operator token or device session with Take Control).

Request body (JSON)

Field Type Required Description
op string yes "input_get".
schemaVersion number yes 1.
conversationId string yes The conversation id.
requestId string no The question's request id (UUID).

Response 200

Field Type Description
result.status string ready, resolved, revision_conflict or refused.
result.conversationId string The conversation id.
result.incarnationId string Optional. Pass it back when answering or cancelling.
result.revision number Optional. The conversation's revision.
result.safeCursor string Optional. Latest event cursor.
result.question object Optional. The question.
result.question.requestId string Request id (UUID).
result.question.purpose string preference, decision, approval, owner_action, verify or gate.
result.question.kind string text or choice.
result.question.prompt string The question.
result.question.options object[] Up to 8: optionId (UUID), label, optional description.
result.question.allowFreeform boolean Whether a text answer is allowed.
result.question.status string pending, submitted or cancelled.
result.question.createdAt string ISO timestamp.
result.question.recommendation string Optional. The asker's recommendation.
result.question.waitingOn string Optional. What is waiting on the answer.
result.question.steps string[] Optional. Exact steps for the owner.
result.question.check string Optional. One line saying what to look at.
result.question.evidence string Optional. An evidence link.
result.question.workerQuestion object Optional. A worker's own question: seatId, requestId, sessionId and questions[] (each id, question, optional header, options, isOther, isSecret).
result.question.answer object Optional. The answer given.
result.question.resolvedAt string Optional. ISO timestamp.
result.question.resolvedBy object Optional. kind (operator, device or service) and id.
result.question.reason string Optional. Why it was cancelled.
result.reason string Optional. With ready: unknown_request when no such question exists.

The question also carries incarnationId, conversationId, originRunId and, when set, workspace, gate, issue, longer, projectId, continuation and settingChange.

Errors

Status error When
403 question_owner_required The request did not use the owner's credential.

A missing conversation answers 200 with result.status: "refused" and reason: "unknown_conversation".

sh
curl -sS http://127.0.0.1:4310/operator/v1/dispatch \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"input_get","schemaVersion":1,"conversationId":"'"$CONVERSATION_ID"'","requestId":"'"$REQUEST_ID"'"}'

input_answer

POST /operator/v1/dispatch with "op": "input_answer"

Answers one pending question. The answer runs as the owner's own turn in the conversation. Sending the same answer again returns the original result and is never sent twice.

Auth: Owner only (operator token or device session with Take Control).

Request body (JSON)

Field Type Required Description
op string yes "input_answer".
schemaVersion number yes 1.
conversationId string yes The conversation id.
incarnationId string yes From input_get.
requestId string yes The question's request id.
expectedRevision number yes The conversation's revision from input_get.
answer.kind string yes choice, text or worker.
answer.optionId string for choice The chosen option's id.
answer.text string for text The answer, up to 4000 characters.
answer.answers object for worker Map from each worker question id to {"answers": ["..."]}.

Response 200

Same shape as input_get. resolved means the answer was taken. refused carries a reason: stale_request, context_changed, worker_question_returned_to_lead, project_confirmation_consumed, conflicting_answer, invalid_answer, invalid_worker_answer, ask_persistence_uncertain or unknown_conversation. ready with answer_in_progress means an answer to this worker question is already being delivered.

Errors

Status error When
403 question_owner_required The request did not use the owner's credential.
503 route_unavailable The conversation is not one of Clankie's own conversations.
sh
curl -sS http://127.0.0.1:4310/operator/v1/dispatch \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"input_answer","schemaVersion":1,"conversationId":"'"$CONVERSATION_ID"'","incarnationId":"'"$INCARNATION_ID"'","requestId":"'"$REQUEST_ID"'","expectedRevision":12,"answer":{"kind":"text","text":"Ship it."}}'

input_cancel

POST /operator/v1/dispatch with "op": "input_cancel"

Cancels one pending question.

Auth: Owner only (operator token or device session with Take Control).

Request body (JSON)

Field Type Required Description
op string yes "input_cancel".
schemaVersion number yes 1.
conversationId string yes The conversation id.
incarnationId string yes From input_get.
requestId string yes The question's request id.
expectedRevision number yes The conversation's revision from input_get.

Response 200

Same shape as input_get. resolved means the question is cancelled (or was already settled). refused carries stale_request, context_changed, worker_question_returned_to_lead, project_confirmation_consumed or unknown_conversation.

Errors

Status error When
403 question_owner_required The request did not use the owner's credential.
sh
curl -sS http://127.0.0.1:4310/operator/v1/dispatch \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"input_cancel","schemaVersion":1,"conversationId":"'"$CONVERSATION_ID"'","incarnationId":"'"$INCARNATION_ID"'","requestId":"'"$REQUEST_ID"'","expectedRevision":12}'

project_proposal_get

POST /operator/v1/dispatch with "op": "project_proposal_get"

Reads the project proposal attached to a question, with its receipt once the project was created. A proposal still pending answers refused with owner_context_lost.

Auth: Owner only (operator token or device session with Take Control), and only the owner the proposal was asked of.

Request body (JSON)

Field Type Required Description
op string yes "project_proposal_get".
schemaVersion number yes 1.
conversationId string yes The conversation id.
incarnationId string yes The question's incarnation id.
requestId string yes The question's request id.

Response 200

Field Type Description
result.status string committing, created, uncertain or refused.
result.reason string With refused: unknown_conversation, stale_proposal or owner_context_lost.
result.proposal.target object conversationId, incarnationId, requestId, expectedRevision, proposalId, artifactSha256, expectedProjectsRevision.
result.proposal.command object The proposed project settings.
result.proposal.project object The project as it would be created.
result.proposal.effectiveRoles object[] The project's roles.
result.proposal.evidence string[] Up to 8 evidence notes.
result.receipt object Optional. projectId and projectsRevision once created.

Errors

Status error When
403 question_owner_required Not the owner's credential, or not the owner the proposal was asked of.
sh
curl -sS http://127.0.0.1:4310/operator/v1/dispatch \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"project_proposal_get","schemaVersion":1,"conversationId":"'"$CONVERSATION_ID"'","incarnationId":"'"$INCARNATION_ID"'","requestId":"'"$REQUEST_ID"'"}'

seat_bridges

POST /operator/v1/dispatch with "op": "seat_bridges"

Reports, for each conversation with an external agent seat bound to it, whether that seat's bridge is current.

Auth: Operator token, device session with Take Control, or lead token.

Request body (JSON)

Field Type Required Description
op string yes "seat_bridges".
schemaVersion number yes 1.

Response 200

Field Type Description
bridges object[] One per bound conversation.
bridges[].conversationId string Conversation id.
bridges[].state string current, stale, reconnecting or disconnected.
bridges[].eventKinds string[] Event kinds the seat takes: wake, watch, escalation, message, turn.
bridges[].ownerOrigin boolean Whether the seat takes the owner's own turns.
bridges[].lastSeenAt string Optional. When the seat was last seen.
bridges[].sourceHash string Optional. Hash of the seat's bridge source.
bridges[].detail string Plain description, prefixed with the conversation title.
bridges[].usageLimit object Optional. window (session, weekly or other) and until, when the seat hit a usage limit.

Errors

Only the errors every op can return.

sh
curl -sS http://127.0.0.1:4310/operator/v1/dispatch \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"seat_bridges","schemaVersion":1}'

seat_deliveries

POST /operator/v1/dispatch with "op": "seat_deliveries"

Lists deliveries to agent seats whose receipt never resolved, one row per receipt and conversation.

Auth: Operator token, device session with Take Control, or lead token.

Request body (JSON)

Field Type Required Description
op string yes "seat_deliveries".
schemaVersion number yes 1.

Response 200

Field Type Description
unresolved object[] Unresolved deliveries.
unresolved[].conversationId string Conversation the delivery belongs to.
unresolved[].receiptId string Receipt id; pass it to settle_seat_delivery.
unresolved[].seatId string Optional. The seat.
unresolved[].beganAt number Optional. Start time in epoch milliseconds.
unresolved[].ageMs number Optional. Age in milliseconds.

Errors

Only the errors every op can return.

sh
curl -sS http://127.0.0.1:4310/operator/v1/dispatch \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"seat_deliveries","schemaVersion":1}'

settle_seat_delivery

POST /operator/v1/dispatch with "op": "settle_seat_delivery"

Settles one unresolved seat delivery as abandoned-unknown: nobody knows whether it landed. It never claims receipt and never resends the original.

Auth: Owner only (operator token or device session with Take Control). Other credentials get a refused result.

Request body (JSON)

Field Type Required Description
op string yes "settle_seat_delivery".
schemaVersion number yes 1.
conversationId string yes The delivery's conversation.
receiptId string yes The receipt id from seat_deliveries.
disposition string yes "abandoned-unknown".

Response 200

Field Type Description
result.state string abandoned-unknown or refused.
result.conversationId string Echo.
result.receiptId string Echo.
result.evidence object With abandoned-unknown: disposition, journal (owner-settled-unknown), receiptId, fingerprint, optional beganAt, and abandonedAt (epoch ms).
result.detail string With refused: why it was refused.

Errors

Only the errors every op can return.

sh
curl -sS http://127.0.0.1:4310/operator/v1/dispatch \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"settle_seat_delivery","schemaVersion":1,"conversationId":"'"$CONVERSATION_ID"'","receiptId":"'"$RECEIPT_ID"'","disposition":"abandoned-unknown"}'

state_work

POST /operator/v1/dispatch with "op": "state_work"

An agent states what it is working on from its own Herdr pane, or clears it. This is what clankie work-on sends. A pane that holds no agent seat answers unseated and nothing is written.

Auth: Operator token, device session with Take Control, or lead token. The request must also carry the x-clankie-herdr-socket header with the service's Herdr session socket path.

Request body (JSON)

Field Type Required Description
op string yes "state_work".
schemaVersion number yes 1.
work.herdrPaneId string yes The caller's own pane id.
work.assignment object or null yes null clears the assignment.
work.assignment.objective string yes, unless null What the agent is doing, up to 512 characters.
work.assignment.issue object no repoId and itemId of the work item.

Response 200

Field Type Description
result.outcome string stated, cleared or unseated.
result.seatId string With stated and cleared. The seat.
result.assignment object With stated. objective, optional issue, and updatedAt.
result.herdrPaneId string With unseated. The pane you named.

Errors

Status error When
409 herdr_session_mismatch The x-clankie-herdr-socket header does not name the service's Herdr session.
503 herdr_unavailable No agent host is available on this machine. The body also has message.
sh
curl -sS http://127.0.0.1:4310/operator/v1/dispatch \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "x-clankie-herdr-socket: $HERDR_SOCKET" \
  -H "Content-Type: application/json" \
  -d '{"op":"state_work","schemaVersion":1,"work":{"herdrPaneId":"'"$PANE_ID"'","assignment":{"objective":"Fix the login bug"}}}'

fleet_capacity

POST /operator/v1/dispatch with "op": "fleet_capacity"

Reports what the fleet can afford before a hire: accounts and their usage windows, spending pace, a suggested split of new hires, heavy-command slots and tracker request budgets. Read only. Values that could not be read are the string "unknown".

Auth: Operator token, device session with Take Control, or lead token.

Request body (JSON)

Field Type Required Description
op string yes "fleet_capacity".
schemaVersion number yes 1.
includeMachineResources boolean no True adds result.machineResources.

Response 200

Field Type Description
result.observedAt string ISO timestamp.
result.accounts object[] Worker accounts, each with machine, harness, account, plan and usage windows.
result.burn object[] Optional. Per account: harness, account, plan, machines, observedAt, windows, lastHour.
result.allocation object Optional. harness, accounts[] (account, plan, machines, share, sparePerDay, reason) and summary.
result.panes object[] Agent panes with agent, machine, harness, account and context details.
result.heavy object or "unknown" Heavy-command slots: slots, used, remaining, queued, lightSlots, lightUsed, and optional load readings.
result.tracker object or "unknown" Tracker request budgets: requestWindowMs, writeWindowMs, actors[].
result.reviewBudgets object leadTokens and workerTokens.
result.notices string[] Up to 32 plain notices about what could not be read.
result.machineResources object With includeMachineResources only. Per machine id, an available or unavailable resource reading.

Errors

Only the errors every op can return.

sh
curl -sS http://127.0.0.1:4310/operator/v1/dispatch \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"fleet_capacity","schemaVersion":1}'

extension_tools

POST /operator/v1/dispatch with "op": "extension_tools"

Lists the tools that running extensions add. An extension the owner never set up lists nothing.

Auth: Owner only (operator token or device session with Take Control).

Request body (JSON)

Field Type Required Description
op string yes "extension_tools".
schemaVersion number yes 1.

Response 200

Field Type Description
tools object[] Up to 64 tools.
tools[].extension string The extension that adds it.
tools[].name string Tool name, for extension_tool_call.
tools[].title string Title.
tools[].description string Description.
tools[].inputSchema object JSON Schema for the arguments.

Errors

Status error When
403 app_author_required Sent with the lead token.
403 operator_authority_required Sent without the owner's credential.
sh
curl -sS http://127.0.0.1:4310/operator/v1/dispatch \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"extension_tools","schemaVersion":1}'

extension_tool_call

POST /operator/v1/dispatch with "op": "extension_tool_call"

Calls one running extension's tool by name. Arguments and results are never logged.

Auth: Owner only (operator token or device session with Take Control).

Request body (JSON)

Field Type Required Description
op string yes "extension_tool_call".
schemaVersion number yes 1.
name string yes Tool name from extension_tools.
arguments object yes The tool's arguments as JSON, at most 16384 characters serialized.

Response 200

Field Type Description
name string Echo.
result.outcome string ok or refused.
result.details object With ok. The tool's result.
result.error string With refused. A fixed code, for example tool_unavailable.
result.message string Optional, with refused. A fixed sentence.

Errors

Status error When
403 app_author_required Sent with the lead token.
403 operator_authority_required Sent without the owner's credential.
sh
curl -sS http://127.0.0.1:4310/operator/v1/dispatch \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"op":"extension_tool_call","schemaVersion":1,"name":"'"$TOOL_NAME"'","arguments":{}}'

Conversation heads

A conversation can name a head: one of Clankie's own conversations that it routes to.

Set a conversation's head

POST /v1/conversation-heads

Sets or clears the head of a conversation. The source must be one of Clankie's own conversations or a transport room, the head must be one of Clankie's own conversations, and heads may not form a cycle.

Auth: Operator token.

Request body (JSON)

Field Type Required Description
conversationId string yes The conversation to change.
headConversationId string or null yes The new head, or null to clear it.

Response 200

The updated conversation record, with the fields listed under the list op (conversationId, scope, title, isDefault, createdAt, updatedAt, sessionState, revision, and optional designatedHeadConversationId, contextUsage, roomHandoff).

Errors

Status error When
400 invalid_conversation_head The body does not match the schema.
401 operator_authentication_required No valid operator token.
409 conversation_head_unavailable Either conversation is unknown or not allowed, or the head would form a cycle.
409 request_aborted The client went away before the write.
sh
curl -sS http://127.0.0.1:4310/v1/conversation-heads \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"conversationId":"'"$CONVERSATION_ID"'","headConversationId":"'"$HEAD_CONVERSATION_ID"'"}'

Auto rounds

An Auto round measures each project's velocity and staffing. This route reads the recorded rounds, or replays past days read-only.

List Auto rounds

GET /v1/auto/rounds

Without replay, returns recorded rounds, newest first. With replay=true, re-measures each complete local day between since and until for one project and writes nothing. Staffing, Auto update and work-policy fields are left out unless their include… flag is set.

Auth: Operator token.

Query parameters

Name Type Required Description
project string with replay Only this project's measurements.
limit number no Recorded rounds only. 1 to 200, default 20.
replay string no true to replay instead of reading the record.
since string with replay ISO timestamp with offset.
until string with replay ISO timestamp with offset, after since, at most 14 days later.
includeStaffing string no true adds staffing to rounds and projects.
includeAutoUpdates string no true adds autoUpdates and progress.
includeWorkPolicy string no true adds ownerLoop, landings and the work-in-progress cap.

Other query parameters are refused.

Response 200

Field Type Description
schemaVersion number 1.
rounds object[] Rounds.
rounds[].roundId string Round id.
rounds[].conversationId string Conversation the round ran for.
rounds[].at string When it ran.
rounds[].delivery object or null delivered, at and optional reason; null while unsettled.
rounds[].projects object[] One velocity measurement per project.
rounds[].staffing object Optional, with includeStaffing. Fleet staffing totals.

Each rounds[].projects[] entry:

Field Type Description
projectId string Project id.
name string Project name.
measuredAt string When it was measured.
timeZone string Time zone the days are counted in.
window object since, until and from (milestone or lookback).
lastMilestone object or null kind, ref, at, optional id.
milestones object[] Milestones in the window.
closures object state: "known" with ownerFacing, tooling, unlinked, unclassified issue lists, or state: "unknown" with reason.
started object state: "known" with total, byState and cap, or unknown.
churn object state: "known" with lines (product, tooling, docs, excluded) and commits, or unknown.
days object[] Per day: date, inWindow, working, lines, closed, stateChanges.
caveats string[] Plain caveats about the measurement.
tracker object Optional. kind (linear or built-in) and projectId.
statusUpdates object Optional. Known status updates, or unknown.
report object Optional. milestones, updates, and progress when included.
drift object[] Optional. Drift signals: signal (tooling_lead, nothing_closed or over_wip), day, numbers.
correction object Optional. A recorded drift correction.
correctionCheck object Optional. Whether that correction held.

Errors

Status error When
400 invalid_query The query does not match the schema.
400 auto_replay_unavailable Replay of an unknown project, a window in the future, or no complete day. The body also has reason.
401 operator_authentication_required No valid operator token.
503 auto_replay_unavailable Replay could not read what it needs. The body may have reason.
503 operator_authentication_unavailable The service cannot check the operator token.
sh
curl -sS "http://127.0.0.1:4310/v1/auto/rounds?limit=5&includeStaffing=true" \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"

Metrics

Read-only measurements of the lead's turns, issue work and the owner's apps, plus the route the apps post their timings to.

Read the lead's turn metrics

GET /v1/captain/turn-metrics

Returns one row per settled lead turn, newest first.

Auth: Operator token.

Query parameters

Name Type Required Description
limit number no 1 to 100, default 20. Out-of-range values are clamped.
runId string no Only this run.

Response 200

Field Type Description
schemaVersion number 1.
items object[] Settled turns.
items[].type string captain.turn.settled.
items[].conversationId string Conversation.
items[].lane string operator, discord_voice, discord_presence or gameplay.
items[].runId string Run id.
items[].acceptedAt string ISO timestamp.
items[].completedAt string Optional. Set on completed turns.
items[].failedAt string Optional. Set on failed and interrupted turns.
items[].outcome string completed, failed or interrupted.
items[].toolCount object Calls per tool name.
items[].mutatingCount number Tool calls that changed something.
items[].firstMutatingAt string Optional.
items[].firstMutatingTool string Optional.
items[].surveyToolCountBeforeFirstMutation number Optional.
items[].contextTokensStart number Optional. Context occupancy at the start.
items[].contextTokensEnd number Optional. Context occupancy at the end.
items[].execution object or null model, provider and effort; null when not recorded.
items[].usage object or null totalTokens and reports; null when nothing was reported.

Errors

Status error When
401 operator_authentication_required No valid operator token.
503 operator_authentication_unavailable The service cannot check the operator token.
sh
curl -sS "http://127.0.0.1:4310/v1/captain/turn-metrics?limit=10" \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"

Read issue metrics

GET /v1/captain/issue-metrics

Summarizes work per issue and per worker in a time window: wall time, reported tokens, checks, reviews and rework. The window defaults to the last 24 hours. summary.current reports its live counts as null with the warning "Live fleet census unavailable".

Auth: Operator token.

Query parameters

Name Type Required Description
since string no ISO timestamp with offset. Default: 24 hours before until.
until string no ISO timestamp with offset. Default: now. At most 366 days after since.
issue string no One issue, such as ABC-12 or LOCAL-ABC-12.
project string no One project.
worker string no One worker.

Response 200

Field Type Description
schemaVersion number 1.
window object since and until.
issues object[] Per issue: issueId, status (accepted or in_progress), startedAt, acceptedAt, wallTimeMs, reportedTokens, usageReports, fullCheckRuns, reviewRounds, reworkRounds, leadReportedTokens, leadUsageReports, workers[], and optional efficiency fields.
workers object[] Per worker: workerId, label, issueIds, wallTimeMs and the same totals.
sessions object[] Optional. Per worker session: workerId, nativeSessionId, harness, hired, startedAt, lastAt, wait and review counts.
summary object Optional. Fleet-wide totals and rates, the lead's busy time, leadInboxVolumePerDay, and current.
coverage object How complete each figure is: tokens, wallTime, fullChecks, reviews, optional efficiency and missingHistories, and warnings.

Errors

Status error When
400 invalid_metrics_query The query does not match the schema.
400 Metrics window must be positive and at most 366 days The window is empty, reversed or too long.
401 operator_authentication_required No valid operator token.
503 operator_authentication_unavailable The service cannot check the operator token.
sh
curl -sS "http://127.0.0.1:4310/v1/captain/issue-metrics?since=2026-11-01T00:00:00Z&until=2026-11-08T00:00:00Z" \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"

Read app metrics

GET /v1/app/metrics

Returns the latest navigation timing summary each paired device posted, per platform. Summaries are kept in memory for one hour and dropped when the device is no longer active.

Auth: Operator token.

Response 200

Field Type Description
devices object[] Up to 64 device and platform pairs.
devices[].deviceId string The device that posted it.
devices[].platform string ios, ipados, macos, android or web.
devices[].summaries object[] The summaries, as posted (see below).

Errors

Status error When
401 operator_authentication_required No valid operator token.
503 operator_authentication_unavailable The service cannot check the operator token.
sh
curl -sS http://127.0.0.1:4310/v1/app/metrics \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"

Post app metrics

POST /v1/devices/self/app-metrics

A paired app posts its rolling navigation timings. A new report replaces the previous one for the same device and platform. Reports carry no content.

Auth: Device session.

Request body (JSON, at most 4 KiB)

Field Type Required Description
platform string yes ios, ipados, macos, android or web.
summaries object[] yes 1 to 8, one per destination.
summaries[].destination string yes world, messages, feed, work, terminal, settings, search, mailbox or usage.
summaries[].count number yes Samples, 1 to 64.
summaries[].firstFrameMs object yes p50 and p95 in ms (0 to 60000, p50 not above p95).
summaries[].longTaskMs object or null yes Same shape, or null when not measured.
summaries[].slowCount number yes First frames over 100 ms, not above count.

Response 202

Field Type Description
accepted number How many summaries were stored.

Errors

Status error When
400 invalid_app_metrics The body does not match the schema.
401 device_authentication_required No valid device session.
429 app_metrics_throttled Posted again within one second for the same platform. Retry-After: 1.
503 device_authentication_unavailable The service cannot check device sessions.
sh
curl -sS http://127.0.0.1:4310/v1/devices/self/app-metrics \
  -H "Authorization: Bearer $CLANKIE_DEVICE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"platform":"ios","summaries":[{"destination":"feed","count":12,"firstFrameMs":{"p50":40,"p95":90},"longTaskMs":null,"slowCount":0}]}'

Memory

Clankie keeps two kinds of memory: subject facts about any user, agent, channel, or project it works with, and episodes, which are the lead's own notes about what it did. The owner browses and edits both with the operator token.

Browse all memory

GET /v1/memory

Returns every subject fact, every episode, and any legacy Discord person facts, including private ones.

Auth: Operator token.

Response 200

Field Type Description
schemaVersion number 1.
subjects object[] Per subject: subject (kind: user, agent, channel, or project; id) and facts (up to 128).
captainEpisodes object[] Episodes (see the episode fields below).
discordPeople object[] Legacy Discord-scoped person records (subject with guildId and userId, plus facts).
retention.retained number Episodes kept in the durable set.
retention.capacity number Size of the durable set.
retention.recentCapacity number Size of the recent set.

A subject fact has schemaVersion, factId, subject (kind of user, agent, channel, or project, plus id), kind (fact, preference, relationship, or working-style), body, visibility (scope of global, room with roomId, or operator_private), provenance (correlationId, sourceEventId, sourceSurface, rawTranscript: false), confidence (0 to 1), createdAt, updatedAt, and optional expiresAt and supersedesFactId.

An episode has schemaVersion, episodeId, lane, targetId, summary, visibility (shareable or operator_private), retained, provenance (characterId, sessionId, selfAuthored, rawTranscript), occurredAt, and optional sourceConversationId and correctedAt.

Errors

Status error When
401 operator_authentication_required No valid operator token.
503 operator_authentication_unavailable The service cannot check the operator token.
sh
curl -sS http://127.0.0.1:4310/v1/memory \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"

Store a subject fact

POST /v1/memory/subjects

Stores one fact about a user, agent, channel, or project. Operator tokens may upsert by factId; lead and bridge tokens are conflict-checked (byte-identical retries succeed, differing collisions return 409). A Discord bridge token is fenced to room visibility with a discord: roomId prefix and a matching sourceSurface.

Auth: Operator token, lead token, or Discord bridge token.

Request body (JSON)

Field Type Required Description
schemaVersion number yes 1.
proposalId string no Optional caller id echoed back on the response, up to 256 characters.
fact object yes A complete subject fact, with the fields listed under "Browse all memory". updatedAt must not precede createdAt.

Response 201

Field Type Description
schemaVersion number 1.
proposalId string Present when supplied.
fact object The stored fact.

Errors

Status error When
400 invalid_subject_memory_fact The body does not match the schema.
401 subject_memory_authentication_required No valid token.
403 subject_memory_scope_forbidden The caller is not allowed to write that visibility scope, room namespace, or source surface.
409 subject_memory_fact_conflict A non-operator caller sent a differing fact under an existing factId.
409 subject_memory_capacity_exceeded The subject already holds 128 protected (global / operator_private) facts and cannot accept another room-scoped write.
503 subject_memory_authentication_unavailable The service cannot check the token.
sh
curl -sS http://127.0.0.1:4310/v1/memory/subjects \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"schemaVersion":1,"fact":{"schemaVersion":1,"factId":"f-1","subject":{"kind":"user","id":"james"},"kind":"preference","body":"Prefers concise diffs and squash merges.","visibility":{"scope":"global"},"provenance":{"correlationId":"c-1","sourceEventId":"e-1","sourceSurface":"operator","rawTranscript":false},"confidence":0.9,"createdAt":"2026-11-22T12:00:00Z","updatedAt":"2026-11-22T12:00:00Z"}}'

Recall a subject

GET /v1/memory/subjects/:kind/:id

Returns the non-expired facts about one subject that the caller may see: global facts, plus facts scoped to roomId when supplied. Private (operator_private) facts are never included. With query, it also returns a rendered recall card.

Auth: Operator token, lead token, or Discord bridge token.

Path parameters

Name Type Description
kind string user, agent, channel, or project.
id string Stable subject id (up to 128 characters).

Query parameters

Name Type Required Description
roomId string no Also include facts scoped to this room or channel.
query string no Text to recall against, up to 512 characters.

Response 200

Field Type Description
schemaVersion number 1.
subject object kind and id.
facts object[] Up to 128 visible facts.
recallCard string Optional, with query. Rendered recall text.

Errors

Status error When
400 invalid_subject_memory_recall Bad path or query parameters.
401 subject_memory_authentication_required No valid token.
403 subject_memory_scope_forbidden A Discord bridge token asked for a non-discord: roomId, or the caller's lane is unscoped.
503 subject_memory_authentication_unavailable The service cannot check the token.
sh
curl -sS "http://127.0.0.1:4310/v1/memory/subjects/agent/grok-bot?roomId=slack:C-releases&query=releases" \
  -H "Authorization: Bearer $CLANKIE_LEAD_TOKEN"

Export a subject

GET /v1/memory/subjects/:kind/:id/export

Returns every fact about one subject, private (operator_private) facts included.

Auth: Operator token.

Path parameters

Name Type Description
kind string user, agent, channel, or project.
id string Stable subject id.

Response 200

Field Type Description
schemaVersion number 1.
subject object kind and id.
exportedAt string ISO timestamp.
facts object[] Up to 128 facts.

Errors

Status error When
400 invalid_subject_memory_identity Bad path parameters.
401 operator_authentication_required No valid operator token.
503 operator_authentication_unavailable The service cannot check the operator token.
sh
curl -sS http://127.0.0.1:4310/v1/memory/subjects/user/james/export \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"

Forget a subject

DELETE /v1/memory/subjects/:kind/:id

Deletes every fact about one subject.

Auth: Operator token.

Path parameters

Name Type Description
kind string user, agent, channel, or project.
id string Stable subject id.

Response 200

Field Type Description
schemaVersion number 1.
subject object kind and id.
deletedFactIds string[] Ids of the deleted facts.

Errors

Status error When
400 invalid_subject_memory_identity Bad path parameters.
401 operator_authentication_required No valid operator token.
503 operator_authentication_unavailable The service cannot check the operator token.
sh
curl -sS -X DELETE http://127.0.0.1:4310/v1/memory/subjects/user/james \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"

Edit a subject fact

PATCH /v1/memory/subjects/:kind/:id/:factId

Changes one fact without altering its identity or provenance. Send at least one field.

Auth: Operator token.

Path parameters

Name Type Description
kind string user, agent, channel, or project.
id string Stable subject id.
factId string The fact id.

Request body (JSON)

Field Type Required Description
body string no New text, up to 2048 characters.
kind string no fact, preference, relationship, or working-style.
visibility object no {"scope":"global"}, {"scope":"room","roomId":"..."}, or {"scope":"operator_private"}.
confidence number no 0 to 1.
expiresAt string or null no ISO timestamp, or null to clear it.

Response 200

The updated fact.

Errors

Status error When
400 invalid_subject_memory_edit Bad path parameters, an invalid body, or an edit the fact cannot take.
401 operator_authentication_required No valid operator token.
404 subject_memory_fact_not_found No such fact.
503 operator_authentication_unavailable The service cannot check the operator token.
sh
curl -sS -X PATCH http://127.0.0.1:4310/v1/memory/subjects/user/james/$FACT_ID \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"visibility":{"scope":"operator_private"}}'

Delete a subject fact

DELETE /v1/memory/subjects/:kind/:id/:factId

Deletes one fact.

Auth: Operator token.

Path parameters

Name Type Description
kind string user, agent, channel, or project.
id string Stable subject id.
factId string The fact id.

Response 204

No body.

Errors

Status error When
400 invalid_subject_memory_identity Bad path parameters.
401 operator_authentication_required No valid operator token.
404 subject_memory_fact_not_found No such fact.
503 operator_authentication_unavailable The service cannot check the operator token.
sh
curl -sS -X DELETE http://127.0.0.1:4310/v1/memory/subjects/user/james/$FACT_ID \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"

Recall episodes

GET /v1/memory/captain-episodes

Returns a rendered recall card of the lead's episodes for one lane. Without query it is the recent card; with query it searches every episode the lane can see. A Discord bridge token cannot read the operator lane.

Auth: Lead token or Discord bridge token.

Query parameters

Name Type Required Description
lane string yes operator, discord_voice, discord_presence or gameplay.
query string no Text to search for.
limit number no With query only. Most matches, default 8, clamped to 1 to 32.

Response 200

Field Type Description
schemaVersion number 1.
lane string Echo.
query string Present when a query was given.
recallCard string Rendered recall text. Empty when a search found nothing.

Errors

Status error When
400 invalid_captain_episode_lane Missing or unknown lane.
401 episode_authentication_required No valid token.
403 operator_lane_recall_forbidden A Discord bridge token asked for the operator lane.
503 episode_authentication_unavailable The service cannot check the token.
sh
curl -sS "http://127.0.0.1:4310/v1/memory/captain-episodes?lane=operator&query=release" \
  -H "Authorization: Bearer $CLANKIE_LEAD_TOKEN"

Edit an episode

PATCH /v1/memory/captain-episodes/:lane/:episodeId

Changes one episode's summary, visibility or retention. Its room and provenance never change. Send at least one field.

Auth: Operator token.

Path parameters

Name Type Description
lane string operator, discord_voice, discord_presence or gameplay.
episodeId string The episode id.

Request body (JSON)

Field Type Required Description
summary string no New summary.
visibility string no shareable or operator_private.
retained boolean no True keeps the episode in the durable set.

Response 200

The updated episode, with the fields listed under "Browse all memory".

Errors

Status error When
400 invalid_captain_episode_edit Bad path parameters or body.
401 operator_authentication_required No valid operator token.
404 captain_episode_not_found No such episode in that lane.
503 operator_authentication_unavailable The service cannot check the operator token.
sh
curl -sS -X PATCH http://127.0.0.1:4310/v1/memory/captain-episodes/operator/$EPISODE_ID \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"retained":true}'

Delete an episode

DELETE /v1/memory/captain-episodes/:lane/:episodeId

Deletes one episode.

Auth: Operator token.

Path parameters

Name Type Description
lane string operator, discord_voice, discord_presence or gameplay.
episodeId string The episode id.

Response 204

No body.

Errors

Status error When
400 invalid_captain_episode_identity Bad path parameters.
401 operator_authentication_required No valid operator token.
404 captain_episode_not_found No such episode in that lane.
503 operator_authentication_unavailable The service cannot check the operator token.
sh
curl -sS -X DELETE http://127.0.0.1:4310/v1/memory/captain-episodes/operator/$EPISODE_ID \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"

Discord person aliases (legacy)

Existing Discord bridges continue to work through the guild-scoped compatibility routes:

Method & path Auth Purpose
POST /v1/memory/discord-people/proposals Discord bridge token Upsert a fact scoped to { guildId, userId }.
GET /v1/memory/discord-people/:guildId/:userId Discord bridge token Recall guild and optional channelId facts (plus recallCard with query).
GET /v1/memory/discord-people/:guildId/:userId/export Operator token Export every fact for that Discord user, private facts included.
DELETE /v1/memory/discord-people/:guildId/:userId Operator token Delete every fact for that Discord user.
PATCH /v1/memory/discord-people/:guildId/:userId/:factId Operator token Edit one Discord person fact.
DELETE /v1/memory/discord-people/:guildId/:userId/:factId Operator token Delete one Discord person fact.