v38

latestOpenAPI 3.1.0raw.githubusercontent.com2026-06-1793196344.2 KB
Context Documents

Get the latest context document tree

Get the most recent context document tree for the authenticated app.

The sync daemon polls this endpoint to fetch updated files. Default behaviour: serve the latest "ready" tree, where "ready" depends on whether the app has require_review enabled:

  • require_review=False (default): latest COMPLETED ships immediately.
  • require_review=True: latest PUBLISHED only — apps that gate on a curator's approval before the daemon picks up the new tree.

?status=<value> filters to a specific status (case-insensitive). ?include_published=true returns the absolute latest tree (any status) so the dashboard can surface an in-flight PROCESSING generation when the user navigates away mid-gen and back. The daemon path (no include_published) keeps strict status filtering.

Auto-trigger semantics replace the pre-Temporal lazy BackgroundTasks path:

  • If the app has no tree at all and the caller has a user_key, a full TreeGenerationWorkflow is dispatched with user_id=user_key so its in-line Phase 4 populates this user's overrides. The endpoint still 404s on this poll; the daemon will see a PROCESSING tree on its next poll.
  • If the latest COMPLETED tree has no personal_overrides entry for the caller, a lightweight PersonalDocWorkflow is dispatched against that tree to backfill just this user's override block. The response is still served immediately with placeholder personal/*.md content; the next poll merges the generated content in.

Both dispatches use deterministic workflow IDs that also dedupe with Phase 4's child-workflow dispatch from TreeGenerationWorkflow, so concurrent runs never race against each other.

get/context-documents/tree/latest

Query parameters

statusstring nullable
include_publishedboolean

Response

Successful Response

tree_idstring required
statusstring required
versioninteger required
errorstring nullable required
created_atstring date-time required
completed_atstring date-time nullable required
metaobject required