POST /v1/compose
Compose a structured markdown document from a scope's memory, with inline citations.
Authorization
bearer PASETO v4 public token (or deployment gate key). Auth-disabled dev instances accept any caller.
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
curl -X POST "https://example.com/v1/compose" \ -H "Content-Type: application/json" \ -d '{ "scope": "string", "brief": "string" }'What it does
/v1/compose is recall composed with an LLM writing pass: it retrieves a pack for the scope, then
asks the answer model to write a structured markdown document that fulfils your brief, with inline
citation markers back to the evidence. Think of it as /v1/answer for long-form output — a briefing,
dossier, or summary rather than a single answer.
The response is { pack_id, document, citations, provenance, diagnostics }:
document— the composed markdown, with inline markers like[S1],[S2].citations—[{ marker, layer, id, support_strength }]mapping each marker indocumentto the memory it came from (verified live: markers resolve tolayer: "event"ids with asupport_strength).provenance/diagnostics— the same recall provenance contract as recall and answer.
Shaping the document
| Field | Effect |
|---|---|
brief (required) | The instruction — what the document should cover. |
length | brief · standard · deep — overall length target. |
depth | standard · exhaustive — how hard recall works to gather evidence. |
structure | An array of section headings to force a specific outline. |
citations | Toggle inline citation markers on/off. |
filters | Same recall filters.metadata shape as recall. |
max_tokens | Output ceiling for the composed document. |
include_context | Return the recalled context block alongside the document. |
Needs the answer lane — same as /v1/answer
Composition runs the LLM, so self-hosted it requires the answer lane (CORTEX_ANSWER_*) to be
configured and is disabled until it's set — the claude-* default is a managed-cloud value. On a
content-only instance with no answer lane, use recall for retrieval without
generation. See Self-hosting defaults.
Composition is not instant
Like /v1/answer, a compose call blocks on the LLM — a multi-paragraph document can take tens of seconds
depending on length/depth and your answer model. Budget your client timeout accordingly.