Skip to main content

AGENTASIAN API reference

Status: Ready

Truth label: Current

Audience: System designer

Reader outcome: Call every Forge and Brain route with the correct fields, authentication, and response shape.

Last verified: 2026-09-13

Forge and Brain are FastAPI services. Their live OpenAPI documents are available at /docs and /openapi.json when the caller satisfies the current access policy.

1. Service locations​

ServiceDefault URLPurpose
Forgehttp://127.0.0.1:8080Projects, tasks, workers, pipelines, schedules, checkpoints, traces, analytics
Brainhttp://127.0.0.1:8081Chat, knowledge, CPMI, conversations, rules, feedback, chat traces

2. Authentication​

Fleet perimeter​

If AA_API_TOKEN is set, every non-health request must include:

Authorization: Bearer <fleet-token>

If it is unset, only loopback clients are accepted. OPTIONS and /health are public.

Worker identity​

Credentialed worker routes include:

X-Worker-Token: <worker-token>

The token is returned once when Central first registers the worker identity.

Claimed-run identity​

Lease renewal and terminal result delivery include:

X-Run-Token: <run-token>

The run token is bound to one task and fence. It is returned only in the claim response for a credentialed worker.

An HTTP CPMI or knowledge search requesting scope=all also includes:

X-Operator-Token: <operator-token>

The expected value is AA_OPERATOR_TOKEN. This token protects only the all search scope. It does not protect checkpoint, project, task, document, or knowledge-promotion routes.

3. Common response behavior​

StatusMeaning
200Successful read, update, decision, or result acknowledgment
400Invalid request, enum, path, transition, or verification setting
401Fleet, worker, or run credential rejected
403Remote access disabled, scope denied, or task not assigned to worker
404Resource not found
409State conflict, active references, duplicate claim, or invalid transition
500Unhandled service or storage failure
503Required dependent service unavailable

FastAPI validation failures use status 422.

4. Forge API​

4.1 Health and status​

MethodPathPurpose
GET/healthPublic liveness check
GET/statusProject, task, and worker counts
GET/alertsRecent flap, checkpoint, offline-worker, and stranded-task alerts
GET/config/llmOptional worker provider configuration

/config/llm returns keys only when AA_ALLOW_KEY_DISTRIBUTION=true.

4.2 Workers​

MethodPathPurposeExtra credential
POST/workers/registerRegister or re-register a workerExisting worker token on re-registration
POST/workers/{worker_id}/heartbeatMark worker aliveWorker token
GET/workersList workersnone beyond fleet policy
GET/workers/typesList personas and skillsnone beyond fleet policy
GET/workers/{worker_id}Read one workernone beyond fleet policy
DELETE/workers/{worker_id}Delete stale registrationnone beyond fleet policy

Registration request:

{
"hostname": "worker-host",
"instance_name": "claude-primary",
"ip_address": "192.168.1.50",
"capabilities": ["python", "javascript"],
"engines": ["claude-code", "codex"]
}

A first registration response includes worker_token. Later responses do not return the cleartext token again.

4.3 Projects​

MethodPathPurpose
POST/projectsRegister a project
GET/projectsList projects
GET/projects/{project_id}Read one project
PATCH/projects/{project_id}Update project metadata
DELETE/projects/{project_id}Delete project metadata

Create request:

{
"name": "example",
"path": "/absolute/path/to/example",
"repo_url": "https://example.invalid/repository.git",
"supervision_mode": "checkpoint",
"description": "Example project",
"create_folder": false,
"client_id": null,
"shared": false
}

Rules:

  • shared=true is valid only when client_id is absent.
  • A remote registration must be inside an allowed root.
  • Deletion returns 409 when tasks, sessions, or schedules still refer to the project unless delete_related=true.
  • Related deletion refuses active tasks.

4.4 Tasks​

MethodPathPurposeExtra credential
POST/tasksCreate a tasknone beyond fleet policy
GET/tasksList tasksnone beyond fleet policy
GET/tasks/pendingList pending tasks by prioritynone beyond fleet policy
GET/tasks/nextFind next eligible taskWorker token when worker id supplied
GET/tasks/{task_id}Read one tasknone beyond fleet policy
POST/tasks/{task_id}/claimAtomically claim taskWorker token
POST/tasks/{task_id}/leaseRenew lease and read cancellationRun token when issued
POST/tasks/{task_id}/cancelCancel or request cancellationnone beyond fleet policy
GET/tasks/{task_id}/scopeResolve assigned task scopeWorker token
POST/tasks/{task_id}/logAppend worker log linesRun token when issued
GET/tasks/{task_id}/logsRead log lines after sequencenone beyond fleet policy
POST/tasks/{task_id}/resultDeliver run state or terminal resultRun token when issued
GET/tasks/{task_id}/runsList run traces for tasknone beyond fleet policy
DELETE/tasks/{task_id}Delete one tasknone beyond fleet policy
DELETE/tasksClear tasksnone beyond fleet policy

Create request:

{
"project_id": "project-id",
"title": "Implement the change",
"description": "Detailed objective and acceptance criteria",
"spec_file": null,
"priority": 5,
"supervision_mode": "checkpoint",
"llm_provider": "anthropic",
"llm_model": "",
"engine": "claude-code",
"permission": "write",
"effort": null,
"resume_session_id": null,
"auto_execute": true,
"worker_type": "developer",
"skills": [],
"required_capabilities": ["python"],
"verification_command": ".venv-linux/bin/python -m pytest -q",
"auto_retry_on_failure": false,
"max_verification_retries": 3,
"assigned_worker_id": null,
"session_id": null,
"parent_task_id": null
}

Agent turns are always unlimited. max_iterations is no longer a task field; legacy values in requests, defaults, execution imports, and recurring templates are accepted and ignored. GET /engines no longer advertises default_max_turns or supports_max_turns. Run lease and worker timeouts retain their behavior.

The worker-pin request field is assigned_worker_id. The returned and stored task field is assigned_worker.

effort is the coding agent's reasoning depth. Levels belong to the engine's own CLI, not to Forge: GET /engines reports effort_levels per engine (claude-code low to max, antigravity low to high, codex minimal to xhigh, codex-oss none), and a worker drops a level its engine does not offer rather than passing a flag the binary would reject. null means the CLI's default.

Claim request uses the worker_id query parameter. A credentialed claim response contains:

  • served task fields
  • run_id
  • run_attempt
  • lease.fence
  • lease.ttl_seconds
  • a cleartext run token

Lease request:

{
"worker_id": "worker-id",
"fence": 2
}

Result request supports:

{
"status": "completed",
"run_id": "run-uuid",
"fence": 2,
"result": "Result text",
"error": null,
"plan": null,
"steps": [],
"verification_result": "pytest exited 0",
"llm_call_count": 4,
"cost_usd": 1.25,
"files_changed": ["src/example.py"],
"run_metadata": {}
}

Terminal outcomes are accepted, duplicate, or superseded. The worker uses these outcomes to drain its durable outbox.

4.5 Pipelines and checkpoints​

MethodPathPurpose
GET/pipelinesList code-owned templates
POST/pipelines/{name}Create session and chained stage tasks
POST/tasks/{task_id}/approveApprove, complete, retry, or override a checkpoint
POST/tasks/{task_id}/rejectRevise or fail a checkpoint

Pipeline request:

{
"project_id": "project-id",
"goal": "Deliver the requested feature",
"assigned_worker_id": "worker-id",
"engine": "claude-code",
"qa_rework_budget": 2,
"verification_command": ".venv-linux/bin/python -m pytest -q"
}

Approval request:

{
"note": "Reviewed and accepted",
"grade": 5,
"override_gate": false,
"complete_now": false
}

Rejection request:

{
"feedback": "Correct the failing acceptance case",
"action": "revise"
}

action is revise or fail. override_gate is accepted only at a failure checkpoint. complete_now is accepted only at a plan checkpoint, where it completes the task instead of releasing the execution stage; it is recorded as approve-complete. Both are refused elsewhere with 400.

4.6 Sessions​

MethodPathPurpose
POST/sessionsCreate a session
GET/sessionsList sessions, optionally by project
GET/sessions/{session_id}Read a session
GET/sessions/{session_id}/tasksList session tasks
GET/sessions/{session_id}/contextBuild completed-task context
POST/sessions/{session_id}/completeMark session complete
PUT/sessions/{session_id}Update session metadata
DELETE/sessions/{session_id}Delete a session

Create request:

{
"name": "Delivery session",
"project_id": "project-id"
}

4.7 Schedules​

See Cortex recurring tasks for timing, migration, overlap, retention and default-resolution behavior.

MethodPathPurpose
GET/schedulesList current schedules; include_deleted=true includes archived definitions
POST/schedulesCompatibility creation with a validated task template
GET/schedules/{id}Read definition, revision, runtime state and retained versions
POST/schedules/{id}/previewReview {base_revision, definition} and return upcoming times, effective task, anchor and hash
PUT/schedules/{id}Save reviewed definition with anchor and preview_hash
PATCH/schedules/{id}Rename, change cadence, pause or resume; Cortex supplies base_revision
DELETE/schedules/{id}Archive definition and cancel waiting occurrences; optional base_revision guard
POST/schedules/{id}/runManual occurrence preserving next appointment; optional {request_id} makes retries idempotent
GET/schedules/{id}/occurrencesRetained evidence with offset and limit (1 to 100)
POST/schedules/{id}/occurrences/{occurrence_id}/cancelCancel a waiting occurrence before task creation

Definitions include name, cadence, timezone, project ID, task, enabled state, overlap (skip, coalesce, queue) and catch-up (latest, skip). The task supports shared intake fields except request/session/parent/resume identities. New definitions use revision zero. Saving requires an unchanged preview and resolved defaults. Legacy POST callers omitting timezone use server-local time.

4.8 Analytics and traces​

MethodPathPurpose
GET/analytics/egress?days=30Summarize task and chat provider egress
GET/analytics/outcomes?days=30Summarize grades, decisions, and observational retrieval lift
GET/analytics/usage/report?days=30Request coverage, lifetime task costs, comparison cohorts and account observations
GET/analytics/usage/export?days=30Download the same usage report as JSON
GET, PUT/analytics/usage/settingsRead/save host-specific transcript roots and refresh interval
POST/analytics/usage/refreshScan configured Central transcript roots now
POST/analytics/usage/ingestIngest up to 500 metadata-only requests and a source report; worker submissions require their worker credential
GET, PUT/analytics/usage/pricesRead/save operator rates per million tokens and source note
GET, PUT/analytics/usage/tasks/{task_id}Pending-attempt comparison labels, advisory budget and operator effort
PUT/analytics/usage/accounts/{record_id}Save/correct/withdraw allowance or actual-charge observations
GET/analytics/usage/history/{kind}/{record_id}Measurement revisions for account, task or settings
GET/runs/{run_id}/traceRead one task-run trace

Usage report/export accept days=0 for all history and cap positive windows at 365 days. Measurement PUT requests require base_revision; stale edits return 409. Unknown fields and invalid counts/rates are rejected. Task labels freeze at claim; operator effort can be added later. Allowance dates require offsets, and charges and percentages are separate observation kinds. See usage metrics for fields and accounting semantics.

The egress and outcome routes cap a positive days at 365 and treat zero or a negative value as all recorded time. Task-run traces currently include raw task result text inside outcome.result.

5. Brain API​

5.1 Health, chat, and capabilities​

MethodPathPurpose
GET/healthPublic liveness check
POST/chatNon-streaming chat
POST/chat/streamServer-sent event chat
GET/chat/providersAvailable provider and model choices
GET/chat/generation-controlsProvider control capabilities
GET/chat/influencesReasoning lenses and voice registers

Chat request:

{
"message": "Explain the current task state",
"history": [],
"provider": "ollama",
"model": "gpt-oss:20b",
"influence_profile": null,
"reasoning_lens": "none",
"voice_register": "plainspoken",
"writing_audience": "team",
"writing_format": "email",
"voice_polish": false,
"temperature": null,
"top_p": null,
"frequency_penalty": null,
"generation_seed": null,
"stop_sequences": null,
"auto_save": false,
"conversation_id": null
}

Both /chat and /chat/stream accept this body. voice_polish was renamed once; the old field name is no longer accepted. BaseModel drops unknown fields, so a client still sending the old name is ignored rather than rejected.

/chat/stream returns SSE events. The final done event contains the authoritative response, conversation and turn ids, usage, generation report, and retrieval trace.

An omitted/null voice register inherits the persisted operator default before configured fallback. Audience and format are optional context fields. Chat also accepts scope; all requires the operator token. Automatic and tool retrieval still have the source-policy differences recorded in the feature plan.

5.1a Cortex writing management​

MethodPathPurpose
GET, PUT/writing/defaultsInspect, set, or reset the operator default using base_revision
GET/writing/profilesLoaded profile definitions and editing revisions
GET/writing/profiles/{register_id}/revisionCurrent pack/file revision for a proposed edit
PUT/writing/profiles/{register_id}Validate, save, and apply a profile definition
GET/writing/draftsList saved drafts with limit and offset
GET, PUT/writing/drafts/{draft_id}Read or save a UUID draft with base_revision
GET/writing/drafts/{draft_id}/versionsRetained draft versions
POST/writing/drafts/{draft_id}/indexRetry the current learning projection
DELETE/writing/drafts/{draft_id}?base_revision=NDelete a draft and its versions; deny future learning use
POST/writing/examples/previewInspect approved examples for query, voice, provider, audience, and format

Draft saves distinguish accepted wording from approved learning consent. Revision conflicts return 409. Index failure returns the saved draft with projection_state: pending; it does not roll back accepted text. Default reads can report apply_state: unavailable for an externally removed profile, while preserving its revision so Cortex can reset it. See the writing guide and generated OpenAPI for field limits and complete schemas.

Forge task creation accepts an optional writing_context JSON snapshot, bounded to 100,000 serialized characters. Brain's bound task tool supplies it directly. The task response, worker prompt, follow-up, and Cortex drawer retain that snapshot. This field does not replace an execution permission or supervision mode.

5.1b Cortex writing comparisons​

MethodPathPurpose
GET/writing/evaluation/casesList cases with limit and offset
GET, PUT/writing/evaluation/cases/{case_id}Read or save a case with base_revision; report duplicate warnings
GET/writing/evaluation/cases/{case_id}/versionsImmutable case versions
DELETE/writing/evaluation/cases/{case_id}?base_revision=NDelete a case and versions; existing comparison snapshots remain
GET/writing/evaluation/runsPaginated run summaries
PUT/writing/evaluation/runs/{run_id}Prepare and start three candidates; return 202 with persisted state
GET/writing/evaluation/runs/{run_id}Progress and blinded candidates; reveal evidence after review
POST/writing/evaluation/runs/{run_id}/cancelCancel remaining generation and reject late results
PUT/writing/evaluation/runs/{run_id}/reviewSave an append-only judgment using base_revision
DELETE/writing/evaluation/runs/{run_id}Delete the comparison and review history
GET/writing/evaluation/suitesList saved case collections
GET, PUT, DELETE/writing/evaluation/suites/{suite_id}Versioned suite CRUD; GET includes versions; DELETE requires base_revision
GET/writing/evaluation/batchesList batches using limit (1 to 200) and offset
PUT, GET, DELETE/writing/evaluation/batches/{batch_id}Prepare a batch, inspect progress, or delete its comparisons/reviews
GET/writing/evaluation/batches/{batch_id}/exportFrozen suite and comparisons, preserving each blind state
POST/writing/evaluation/batches/{batch_id}/cancelCancel pending work and reject late results
GET/writing/evaluation/outcomesReviewed outcome totals with split, review_basis, and optional batch_id

Case/run IDs are UUIDs. Run requests identify the saved case_id, case_revision, register_id, provider, and model; optional controls are temperature, top_p, seed, and reasoning_effort. Reusing a run ID with the same request is idempotent; a different request returns 409. Invalid case revisions return 409 before generation. Case content and review fields are bounded by the generated OpenAPI schemas.

Run states are queued, running, completed, partial, failed, cancelled, or interrupted. GET responses do not expose setup identities, prompts, or per-candidate metrics until the first saved review. Review ratings use candidate labels A/B/C and must cover every completed candidate. A review stores voice rating, factual/instruction judgments, optional edited wording/time, and notes. Subsequent reviews retain prior versions and are labeled non-blind.

Case reference text is reserved for review. Comparisons filter overlapping examples; Studio draft approval rejects overlap with retained held-out versions. Normal chat and legacy example records are not migrated by this workflow. See the comparison guide for the comparison boundaries, recovery behavior, evidence limitations, and import/export semantics.

Suite writes require base_revision, title, and unique case_ids; notes and archived are optional. Batch writes require suite_id, suite_revision, repeats (1 to 3), and settings containing the single-comparison provider/model/register/sampling controls. At most 20 comparisons are allowed. Outcome split is held-out (default), development, or all; review_basis is first (default) or latest.

5.1c Complete voice-pack management​

MethodPathPurpose
GET/writing/packsConfigured and built-in packs with editable/override metadata
GET/writing/packs/{pack_id}Complete portable bundle and content revision
GET/writing/packs/{pack_id}/versionsVerified external content snapshots
POST/writing/packs/{pack_id}/previewValidate a bundle and list affected sections/definitions
PUT/writing/packs/{pack_id}Apply the reviewed bundle and reload the serving registry

Preview and apply require base_revision and bundle. Bundle format is agent-asian-voice-pack-v1 with manifest, registers, lenses, exemplars, style_rules, and tone_corpus. The portable manifest contains metadata rather than paths. The destination pack ID remains fixed. Operator content must be external, the complete pack must load, referenced groups must exist, and active defaults cannot be retired. retired is now an optional boolean in profile/lens definitions. See voice-pack management for publication, history, and import semantics.

5.1d Persistent operator context​

MethodPathPurpose
GET/context/recordsPaginated operator context with limit and offset
GET, PUT, DELETE/context/records/{record_id}Versioned record CRUD; writes/deletes require base_revision
GET/context/records/{record_id}/versionsRetained record versions
POST/context/previewResolve applicability, availability, conflicts, and character allocation
GET/context/tasks/{task_id}?worker_id=...Assignment-verified worker context contract; accepts X-Worker-Token

Kinds are brief, decision, preference, lesson, and rule; statuses are proposed, active, and retired. Optional restrictions include conversation/project/voice, audience, format, channel, and processing privacy. Only active matching records are resolved. conflict_key declares alternatives; priority breaks otherwise equal applicability. API fields and limits are available through OpenAPI. Chat responses expose generation_settings.operator_context; task attempts retain run_metadata.operator_context. See persistent context for scope, history, snapshot timing, and limits.

5.2 Voice examples​

MethodPathPurpose
GET/chat/voice-examplesList approved or available examples
POST/chat/voice-examplesCreate an example
PUT/chat/voice-examples/{example_id}Update approval, privacy, or content
DELETE/chat/voice-examples/{example_id}Delete an example

Privacy is local-only or cloud-allowed. Only approved examples are eligible for retrieval.

5.3 Provider keys​

MethodPathPurpose
GET/config/api-keysReturn configured provider keys to a worker

The route returns 403 unless explicit key distribution is enabled. Keep it disabled for normal CLI-agent execution.

5.4 Knowledge search and learning candidates​

MethodPathPurposeScope behavior
GET/knowledge/searchSearch a Chroma collectionLearnings filtered; general knowledge internal-only
GET/knowledge/candidatesList unresolved graded-run candidatesShows source scope, not run result
POST/knowledge/candidates/{run_id}/promoteAdd generalized methodologyRequires acknowledgment
POST/knowledge/candidates/{run_id}/dismissResolve without promotionnone beyond fleet policy
POST/knowledge/addAdd text knowledgenone beyond fleet policy
POST/knowledge/ingestIngest server-side file or directorynone beyond fleet policy
GET/knowledge/collectionsList Chroma collectionsnone beyond fleet policy

Search query parameters:

  • query
  • collection, default knowledge
  • k, default 5
  • optional project_id
  • worker context: task_id, worker_id, and X-Worker-Token
  • operator context: scope and optional X-Operator-Token

Promotion request:

{
"summary": "Generalized, client-free methodology",
"task_title": "Source task label",
"generalized_acknowledged": true
}

The current promotion route does not verify that the run id is an unresolved candidate.

5.5 Canonical project memory​

MethodPathPurposeScope behavior
POST/cpmi/indexIncrementally index registered project memoryProject list from Forge
GET/cpmi/searchHybrid CPMI searchScoped and audited
GET/cpmi/records/{record_id}Read one full recordCurrently unscoped
GET/cpmi/statsIndex statisticsnone beyond fleet policy

CPMI search query parameters:

  • query
  • optional project_id
  • phase, default coding
  • k, clamped to 1 through 20
  • worker or operator scope parameters as described above

5.6 Learnings​

MethodPathPurpose
POST/learningsStore one task learning in Chroma

The payload includes task identity, project identity, result, status, worker, skills, provider, model, changed files, duration, error classification, and optional lessons learned.

5.7 Conversations​

MethodPathPurpose
POST/conversations/saveSave named history as JSON
GET/conversations/listList saved names
GET/conversations/{name}Load history
DELETE/conversations/{name}Delete saved history

Conversation names are used as filenames. Use simple operator-controlled names and do not expose these routes to untrusted callers.

5.8 Knowledge document CRUD​

MethodPathPurpose
GET/knowledge/{collection}/documentsList documents
GET/knowledge/{collection}/documents/{doc_id}Read document
PUT/knowledge/{collection}/documents/{doc_id}Replace content and metadata
DELETE/knowledge/{collection}/documents/{doc_id}Delete document

These direct document routes do not apply GL-07 result filtering.

5.9 Rules​

MethodPathPurpose
GET/rulesList all rules
GET/rules/activeList enabled rules in priority order
POST/rulesCreate a rule
PUT/rules/{rule_id}Update rule
DELETE/rules/{rule_id}Delete rule

Rules are trusted prompt instructions. Restrict rule mutation to the operator.

5.10 Feedback​

MethodPathPurpose
POST/feedbackStore task feedback and update every exact task-linked learning
GET/feedback/{task_id}Read task feedback
GET/feedbackList feedback

Ratings accept -1 through 5. Feedback can influence future learning retrieval.

5.11 Chat traces​

MethodPathPurpose
GET/chat/turns/{turn_id}/traceRead one chat-turn trace
GET/chat/conversations/{conversation_id}/turnsList turn traces

Conversation ids must be UUIDs. Chat traces store prompt hashes and manifests; raw artifacts remain under the local trace directory.

6. API trust warning​

The fleet bearer is currently both a network perimeter credential and the only authorization on most operator routes. Do not give it to an untrusted process or user. Worker CLI children can inherit it through the environment in the documented deployment path. See Security model.

Cortex influence library​

Chat and streaming chat accept an optional source_selection object. Its modes are legacy (follow the lens), selected, library, and none. It carries include_source_ids, exclude_source_ids, include_group_ids, exclude_group_ids, exclude_passage_ids, and include_general (default true). Source selection never changes voice_register. Reports add source_policy and source_passages.

MethodRouteContract
GET/libraryPaginated source catalog, groups, saved selections, and configured external root
POST/library/catalog-existingCatalog legacy indexed PDF/EPUB and tagged sources without reembedding
GET/library/groupsSource-group definitions with a shared manifest revision
PUT/library/groups/{id}base_revision, label, manual, retired, match, glob, dir, roots; validate and save external manifest
GET/library/group-manifestCurrent parsed/raw manifest, revision, and hash-checked saved versions
POST/library/group-manifest/previewbase_revision, full definition; validate order/retirement/settings and report references without writing
PUT/library/group-manifestApply a validated full definition with revision guard and retained history; reject removal of referenced groups
GET/library/lensesResolved principles, groups, fixed boundaries, editable flags, and revisions
GET/library/lenses/{id}/revisionRevision token for a new or existing lens target
PUT/library/lenses/{id}base_revision, label, description, principles, source_ids; save and reload external pack
PUT/library/uploads/{uuid}?filename=...Raw file body; at most 50 MiB; exact-byte deduplication
GET / PUT/library/sources/{uuid}Source state / metadata edits with base_revision
POST/library/sources/{uuid}/{action}extract, publish, cancel, retire, or restore; requires base_revision
GET / PUT/library/sources/{uuid}/segments/{index}Zero-based extraction segment / reviewed text with base_revision
GET/library/sources/{uuid}/versionsVersioned source and review metadata
GET/library/sources/{uuid}/comparefrom_revision, to_revision, optional offset/limit; changed segments and metadata
GET/library/sources/{uuid}/versions/{revision}/segments/{index}Verified complete historical segment
POST/library/sources/{uuid}/versions/{revision}/restorebase_revision; create a review from historical extraction without publishing
GET/library/sources/{uuid}/exportCurrent extraction plus source/version metadata
GET/library/sources/{uuid}/originalOriginal uploaded bytes
PUT / DELETE/library/selections/{uuid}Named selection and optimistic revision; DELETE revision is a query parameter
POST/library/previewquery, selection, reasoning_lens, optional limit; eligible passages and policy diagnostics
GET/library/passages/{record_id}Exact current/historical indexed passage for operator inspection, with availability label

GET /knowledge/search also accepts a JSON-encoded source_selection query parameter and reasoning_lens. It shares source eligibility, bounded backfill, and learning feedback ranking with automatic retrieval. Existing scope rules still apply. Management routes are operator-facing and do not accept worker scope parameters. Generic document PUT/DELETE returns 409 for managed library passage IDs; use source review/publication or retirement instead. See the workflow and limits.

Group/lens edits and extraction restoration return 409 on revision conflicts. Lens requests reject unknown groups and attempts to edit fixed boundaries or legacy voice links. Group IDs stay stable when editing; a new ID creates a clone. Historical comparison/restore requires retained extraction files with matching hashes. Restoration changes reviewed text, not the active published generation or current source metadata. See the detailed workflow.

Worker knowledge requests include both task_id and worker_id, with the existing worker credential header. Brain resolves /tasks/{id}/retrieval-context from Central to obtain the assigned task's scope and writing snapshot. Caller-supplied source selections and lens IDs do not replace that snapshot. Incomplete identity returns 400; unresolved task context returns 503 without searching. With source_contract=task-v1, the response is {contract, results, policy}. Updated worker planning and knowledge tools require this contract. Other callers retain the result-list response, now with an evidence object on each row.

Source selections also accept include_attachments (default true) and exclude_attachment_ids (up to 40 IDs). Chat generation settings include an attachments manifest of inclusion states, reasons, and available hashes. See worker and attachment behavior.

Shared task intake and defaults​

  • POST /tasks/preview accepts the same body as task creation and returns effective settings, origin labels, defaults revisions, and project location without enqueueing.
  • POST /tasks accepts optional request_id. A repeated identical request returns the original task; changed content returns 409 and a deleted original returns 410. Created tasks include creation_context.
  • GET /task-defaults/operator and GET /task-defaults/project?project_id=... return {revision, values}.
  • PUT on those defaults routes accepts {base_revision, values} and replaces the override set. Omitted or null values inherit; skills: [] explicitly selects none. Stale saves return 409.
  • GET /task-defaults/{level}/versions lists retained versions, with project_id for project settings. Restore by submitting a historical values set with the current revision.
  • PATCH /projects/{id} distinguishes omitted client_id from explicit null. Paused/archived projects reject new intake and claims. Existing assigned work can finish.

See Cortex task defaults for precedence, pipeline/continuation behavior, and preview limits.

Retained attempt deliverables​

  • GET /runs/{run_id}/deliverables returns the bounded capture manifest without file contents, plus latest derived revisions.
  • GET /runs/{run_id}/deliverables/file?path=...&revision=... returns a retained file and its version history. Omit revision for the latest; revision 0 is the original worker output.
  • PUT /runs/{run_id}/deliverables/file accepts {path, base_revision, source_sha256, text, note}. It creates a derived version and returns 409 for stale edits. It does not write to the worker checkout.
  • GET /runs/{run_id}/deliverables/download?path=...&revision=...&side=after downloads retained bytes. side=before selects the baseline content. Missing/unretained bytes return 404.
  • GET /runs/{run_id}/diff retains legacy responses and now also serves workspace-diff-v1, with before/after content, net changes, hashes, capture limits, and provenance. Task history run events include run_id for linking attempts to retained outputs.

See Cortex deliverables for capture and retention limits.

Task briefs and acceptance​

  • POST /tasks and /tasks/preview: optional brief with goal, task_kind, constraints, acceptance_criteria, requested_deliverables and source_references. Criteria have stable id, text, kind and evidence_expectation.
  • GET /tasks/{task_id}/brief: current brief, revision, editable state and history.
  • PUT /tasks/{task_id}/brief: {base_revision, brief}. Pending tasks only; stale revisions return 409.
  • GET /runs/{run_id}/acceptance: frozen brief, current assessments, evidence choices, assessment_digest, unresolved IDs and immutable decision history. Pre-upgrade attempts without a frozen brief return 404.
  • POST /runs/{run_id}/acceptance/assessments: criterion_id, base_assessment_id, result, evidence and note. Artifact evidence names path/revision/sha256; verification and response use their returned sha256; observation supplies its actual check/finding in note.
  • POST /tasks/{task_id}/acceptance: completed tasks only, with assessment_digest and optional override_reason.
  • POST /tasks/{task_id}/approve: accepts acceptance_digest and acceptance_override for final review. Unresolved criteria require an explicit reason; plan and continue actions do not imply final acceptance, but complete_now does, because it closes the task.

Worker run_metadata.verification_evidence with contract verification-v1 retains a detailed check record in trace artifacts. Current CLI execution supplies it. See the Cortex guide for semantics and limits.

Voice-pack configuration​

Brain GET /writing/pack-settings returns revision, registered paths/active order, history, and bootstrap_paths. PUT /writing/pack-settings and POST /writing/pack-settings/preview accept base_revision and packs containing each registered id/active choice exactly once in desired order. Preview does not save. Stale revisions return 409; invalid defaults return 400.

POST /writing/pack-settings/register accepts base_revision, absolute path, initialize, pack_id and label. Initialization creates a new empty directory; registration inspects an existing valid pack. Both register it inactive. POST /writing/pack-settings/unregister accepts base_revision and pack_id, requires an inactive pack and retains all authored files.

GET /writing/packs and pack content endpoints include inactive registered packs and report active separately from editable. Missing inactive directories have a load_error and can be unregistered. See Cortex voice packs.

Brain context budgets​

GET /writing/context-budgets returns revision, profiles and history. PUT /writing/context-budgets accepts base_revision and one to 100 uniquely keyed profiles. Profiles specify provider/model (with * wildcard), context_tokens, answer_reserve and overhead_reserve. Invalid bounds or duplicate keys fail; stale writes return 409.

GET /writing/context-budgets/effective?provider=...&model=... resolves saved settings without generation. Chat generation metadata includes prompt_budget per reasoning round. Writing comparison manifests freeze context_budget, and variants retain prompt_budget checks. Local revision reports include their own allocation evidence. See context budgets for estimator limits and input selection.

GET /writing/context-budgets/active returns only revision and validated active profiles for workers. GET /writing/context-budgets/worker-effective?engine=...&provider=...&model=... previews actual CLI model acceptance and provider mapping without generation. A blank or rejected CLI model uses wildcard model profiles. Worker attempts return run_metadata.context_allocations with frozen profile revisions, phase, input estimate, whole-section inclusion and tool-observation shortening evidence.

Static writing-sample applicability​

Portable pack exemplar records optionally include audiences/formats string lists, scope, retired and note. The existing pack preview/save/history endpoints validate and retain them. Empty restrictions match any context; nonempty restrictions need exact case-insensitive context values. Chat generation metadata static_example_selection records requested audience/format/scope and excluded sample IDs/reasons. Comparison manifests report analogous exclusions for the case audience/genre, with no client scope. See voice packs.

Group retirement stops group-based retrieval and tagging, while individual/all-library book selection remains available. Omitting retired on a quick group edit preserves its saved retirement state. Full imports are limited to 2 MB and 200 groups. See source group lifecycle.

Writing perspective and completed-turn inspection​

Chat and streaming chat accept writing_mode: auto | draft | assist. Both return the same generation report with requested/resolved writing_mode; audience and format appear on both completed responses. Auto resolves from a supplied format or a leading writing verb; explicit choices win. Comparisons freeze draft perspective.

GET /chat/turns/{turn_id}/inspection returns the completed trace, allowlisted retained artifact content/hashes, and missing/oversized-capture events. Captured provider_inputs contain application messages/tool schemas after allocation, before SDK serialization. Reads are bounded to 8 MB per artifact. This is an explicit raw-content route under the existing Brain access policy. The metadata trace endpoint remains unchanged. See writing turns.

POST /context/evidence accepts references (up to 20) and returns exact saved draft/context versions, original correction diffs, current status, and explicit unavailable/note results. It does not activate context or fetch free-text references. See context evidence.

Named conversation snapshots​

  • GET /chat/workspaces?limit=100&offset=0: paginated names, IDs, revision, archive state and draft links.
  • GET /chat/workspaces/{id}: messages and typed saved settings.
  • PUT /chat/workspaces/{id}: base_revision, name, history, settings, archived, optional accepted_draft {id, revision}. Saves a revision; rejects stale edits and nonaccepted/missing draft references.
  • GET /chat/workspaces/{id}/versions: retained snapshots for restore/export.
  • DELETE /chat/workspaces/{id}?base_revision=N: remove named snapshots and revisions; other content lifecycles remain separate.

The existing chat endpoints block archived conversation IDs and supply an explicitly pinned accepted draft with current processing checks. They do not silently apply old saved settings to a request; Cortex restores those controls and sends the selected values. See conversation workspaces.

Queued execution settings​

GET /tasks/{id}/execution returns current settings, status, revision, edit history and claim snapshots. POST /tasks/{id}/execution/preview and PUT /tasks/{id}/execution take {base_revision, values}. Updates require a pending task and the current opaque revision. See Cortex execution settings for editable fields and stage constraints.

Managed linear workflows​

  • GET /workflow-templates includes bundled, active and retired definitions. GET /workflow-templates/{id} includes history.
  • POST /workflow-templates/{id}/preview and PUT /workflow-templates/{id} take {base_revision, definition}; bundled IDs are read-only.
  • GET /pipelines lists available stages. POST /pipelines/{id}/preview resolves a launch without enqueueing. POST /pipelines/{id} accepts template_revision and an idempotent request_id, plus project, goal, optional worker/engine/verification/QA budget and writing context.
  • GET /sessions/{id}/workflow returns the actual retained run definition. Missing historic snapshots return 404.

See Cortex workflows for lifecycle, constraints and current limits.

Stage inputs​

GET /tasks/{id}/handoff returns next-claim notes/evidence, note versions and captured attempts. PUT takes {parent_run_id, base_revision, notes} and requires pending work with a completed or held parent. GET /tasks/{id}/handoff/response accepts optional run_id, offset and limit (up to 64,000 characters). Omitting the run reads the current parent; supplying it reads the frozen input for that child attempt. GET /tasks/{id}/handoff/download?run_id=... returns the hash-checked full frozen text with an X-Content-SHA256 header. These routes use existing Central authentication. See stage inputs.

Managed method packages​

GET /methods lists starter and operator methods. GET /methods/{id} includes versions, rendered instructions and dependency report. POST /methods/{id}/preview and PUT /methods/{id} take {base_revision, definition}. GET /methods/source/skill/{name} copies a Central-installed skill and its bounded supporting text files for review. Task intake/defaults, queued execution settings and workflow stages accept method_id and optional method_revision; submitted tasks retain method_context. See managed methods for applicability, dependencies, lifecycle and executor support.

Local processing declarations (Brain)​

GET /writing/local-processing returns exact hosts, revision/history, source and the configured Ollama classification. PUT /writing/local-processing takes {base_revision, hosts}; stale saves return 409. Declarations govern local-only eligibility and do not modify the endpoint URL. Chat generation reports and example previews include provider_locality. See local processing hosts.

Task feedback responses include learning_updated, learnings_matched and learning_update_error. A successful feedback save can have no matching learning or a failed derived update. GET /feedback/{task_id} uses exact metadata lookup and returns newest events first. Cortex preserves prior events when a rating is corrected. See task feedback.

Source lifecycle (Brain)​

POST /library/sources/{id}/replacement/preview takes {base_revision, target_id, target_revision, migrate_selections} and returns exact impact plus preview_hash. Apply through /replacement with the same values and hash. /replacement/undo takes {base_revision, target_revision, restore_selections}.

POST /library/sources/{id}/cleanup/preview takes {base_revision, mode}. Mode is old-generations or all-indexed-passages; the latter requires retirement. /cleanup adds the returned preview_hash, archives before deleting and reports removed_passages plus any error. Original/extraction files remain. GET /library/passages/{record_id} also resolves archived citations and reports their availability. See source lifecycle.

Shared chat defaults​

Brain GET /settings/operator returns saved/effective values, origins, revision, apply state and history. POST /settings/operator/preview and PUT /settings/operator take {base_revision, values}; save returns 409 on stale edits. GET /settings/operator/versions lists retained versions. /writing/defaults shares the same authority. See chat defaults for null semantics and conversation precedence.

Polish meaning review​

Brain GET /chat/turns/{id}/revision reads the retained draft/candidate, report, clauses and judgment history. POST /chat/turns/{id}/revision-verdict takes base_revision, content_hash, verdict, reason, note and optional edited_text. It returns a saved judgment and selected wording; it does not rewrite model evidence or approve learning. GET /chat/revision-cases supports limit/offset. GET, PUT and DELETE /chat/revision-cases/{uuid} inspect, version or delete a private case. PUT takes {base_revision, values}; DELETE takes the current base_revision query. See polish meaning review.

Chat reply ratings​

Brain GET/PUT/DELETE /chat/turns/{id}/feedback manages direct turn ratings. PUT takes {base_revision, rating, reasons, comment}; DELETE takes base_revision. GET /chat/turn-feedback filters by register_id, rating and reason with limit/offset and total/reason counts. Unrecorded turns return 404; conflicting revisions return 409. See reply ratings.

Local meaning verifier trials​

Brain /chat/revision-trials offers public case discovery, POST /preview, guarded PUT /{uuid} creation, paged GET history, GET /{uuid} retained evidence, POST /{uuid}/cancel and terminal DELETE. Cases/settings are frozen and execution is local-only. See meaning trials for request shapes, cancellation, limits and metric semantics.

Source extraction quality​

GET /library/sources/{id}/quality returns the computed report and any matching operator verdict. PUT /library/sources/{id}/quality-review takes {base_revision, quality_sha256, verdict, note}; verdict is usable or needs_repair. A usable flagged extraction requires a note. Stale revisions or report hashes return 409.

POST /library/sources/{id}/segments/{index}/repair-preview takes {base_revision} and returns unchanged persisted state plus before/after text and diagnostics. Saving uses the existing segment endpoint. Publication checks the exact report/verdict and verified retained text. See source quality.

Structured source locators​

Managed source upload also accepts .docx. New Markdown and Word extractions retain heading, heading_path, heading_level, section_index and section_count. Passage previews/traces and exact inspection retain heading locators. Word structures that cannot be represented faithfully in body text add structural warnings to the quality report and require review before publication. Attachments also accept DOCX and include extraction notes. See document structure.

Per-source passage settings​

GET /library/sources/{id}/chunking returns saved/effective/published settings and source history. POST /library/sources/{id}/chunking/preview?offset=0&limit=20 takes {base_revision, settings} and returns actual passages, counts and a preview hash. Settings are {strategy: recursive|paragraphs, chunk_size, chunk_overlap}. PUT /library/sources/{id}/chunking also requires preview_hash; the exact source/settings/output preview is recomputed before saving. The next explicit publication uses those settings. See source passages.

Managed research​

See Cortex research. Both /chat transports accept optional research_run_id; it must identify an open run with the conversation's scope. Ordinary chat does not bind the public research tools.

MethodPathPurpose
GET/research/briefsList current versioned briefs, including retired definitions
GET/research/briefs/{id}Read a brief and its history
POST/research/briefs/{id}/previewValidate {base_revision, definition} and return a review hash
PUT/research/briefs/{id}Save reviewed definition with preview_hash
GET/research/runsList runs, optionally by brief_id
PUT/research/runs/{id}Freeze {brief_id, brief_revision, writing_context} with retry identity
GET/research/runs/{id}Read retained input, operations, evidence and findings
POST/research/runs/{id}/searchSpend a search request with {query, max_results}
POST/research/runs/{id}/inspectInspect {url, refresh} within the source/page policy
GET/research/runs/{id}/evidence/{evidence_id}/passages/{index}Exact passage, citation reference and hash
PUT/research/runs/{id}/evidence/{evidence_id}/reviewSave {base_revision, excluded, note} and invalidate affected accepted findings
PUT/research/runs/{id}/findings/{finding_id}Save {base_revision, values} with exact reference validation
GET/research/runs/{id}/findings/{finding_id}/historyRetained finding review versions
POST/research/runs/{id}/completeClose collection with optional {note}
POST/research/runs/{id}/cancelClose collection and fence late writes with optional {note}
GET/research/runs/{id}/cited-briefBounded cited package; accepted_only=true by default

The run status describes evidence collection. Finding acceptance remains a separate operator judgment. Model tools force newly proposed findings to the proposed verdict, even if they try to request acceptance.

GET /research/runs/{run_id}/findings/{finding_id}/context-proposal?revision=N returns an inactive context seed and inspected evidence for an exact currently accepted finding. It creates no context record. /context/evidence resolves research:<encoded-run-id>:<encoded-finding-id>:vN references. Context activation and later selection check current finding/evidence eligibility.

Imported research evidence adds library_selection, max_library_searches (0..10) and max_library_passages (0..30) to research brief definitions. Web max_pages also accepts zero. Runs freeze library_policy and retain separate library operation counters. GET /research/library-choices?offset=N pages the managed source catalog. POST /research/runs/{id}/library-search accepts query and max_results; /library-inspect accepts a record_id. Retained library evidence uses the same exact finding-reference contract and records library_trace. Cited-brief responses include omission reasons for unavailable sources and budget.

Recurring-result review adds include_last_result (default true) to schedule definitions. GET /schedules/{id}/results returns current cursor, versions and reviews; GET /schedules/{id}/occurrences/{oid}/result returns current output, acceptance, comparison and the digest required for review. POST to that same occurrence-result path accepts request_id, base_revision, output_digest, disposition (changed/unchanged/rejected), source_cursor, source_fingerprint, brief and note. PUT /schedules/{id}/cursor accepts an explained manual edit with the same cursor fields and a base_revision. Accepted completed output advances the cursor atomically with its retained review.

Task feedback now accepts optional run_id, request_id and base_revision. Omit run_id for whole-task feedback. POST /feedback returns canonical revision, retry status and separate learning/index projection status. GET /feedback/{id} accepts run_id, limit (1..200), offset and all_targets; it returns current target revision and paged history. POST /feedback/{id}/reconcile applies current target ratings and retries event indexing. GET /feedback includes canonical events when their derived index is unavailable and declares its bounded legacy window. Worker POST /learnings accepts run_id and reconciles existing feedback after saving a new outcome. No attempt identity is inferred for older outcomes.

Brain POST /feedback-targets/inspect validates a typed lesson or artifact target and returns verified evidence, its deterministic target ID and current history. POST /feedback-targets takes {target, rating, comment, active, base_revision, request_id}. Ratings are -1, 0 or 1. Lesson targets require kind, lesson_id and sha256; artifact targets require kind, run_id, path, revision and sha256. Client task IDs are not accepted as artifact provenance. Inactive saves withdraw an existing judgment without requiring its source to still exist. GET /feedback-targets lists current targets with optional kind and limit/offset; GET /feedback-targets/{target_id} reads paged exact history. Both return totals. Stale ratings or content produce 409. Saved request retries succeed without rechecking a subsequently unavailable source. See feedback.

Schedule definitions now require exactly one non-null target: task or workflow. Workflow fields are template_id, required template_revision, optional template_hash, goal, writing_context, assigned_worker_id, engine, verification_command and qa_rework_budget. Existing task definitions remain valid. Preview returns resolved stages and the reviewed template. Saved records and versions retain workflow_snapshot; occurrence records add session_id, ordered task_ids and stage statuses. The existing result-review routes check every required stage. Template reads include a content hash, which lets Cortex explicitly refresh a bundled template without inventing a new numeric revision. Interactive launch behavior stays unchanged. Internal scheduled launch accepts only the retained server-side snapshot. See recurring workflows.

Memory collection corrections​

GET /memory-management/{collection}?limit=50&offset=0 returns bounded previews, total and next_offset for knowledge, notes, learnings or conversations. GET /memory-management/{collection}/changes pages the latest change for each corrected record, including removed records.

Record identities use an id query parameter so slash-containing IDs remain reachable. GET /memory-management/{collection}/record?id=... returns document, sha256 and editable. POST at that URL accepts request_id, base_sha256, action (edit/delete/restore), optional content and metadata, and restore_event/restore_side for an exact historical reference. Responses distinguish applied, failed and conflicting index outcomes. Stale source or request reuse returns 409.

GET /memory-management/{collection}/history?id=... pages compact history. GET .../history/{event_id}?id=... returns exact retained evidence; POST .../history/{event_id}/retry?id=... retries that intent. DELETE .../history?id=...&base_event_id=... removes the reviewed history and retains opaque retry receipts. Managed imported passages reject mutation. See Memory collections for scope and storage limits.