thread/agents_doc/* because AGENTS.md is part of the workspace thread tree, not the artifact store. Payloads use snake_case field names.
Methods
| Method | Params | Result | Purpose |
|---|---|---|---|
thread/agents_doc/get | ThreadAgentsDocGetParams | ThreadAgentsDocGetResponse | Load the explicit file for one root/folder scope and the effective inherited file. |
thread/agents_doc/save | ThreadAgentsDocSaveParams | ThreadAgentsDocSaveResponse | Create or update the explicit file for one root/folder scope. |
thread/agents_doc/archive | ThreadAgentsDocArchiveParams | ThreadAgentsDocArchiveResponse | Archive the explicit file for one root/folder scope. |
thread/agents_doc/resolve_for_thread | ThreadAgentsDocResolveForThreadParams | ThreadAgentsDocResolveForThreadResponse | Resolve the effective file for one concrete thread. |
thread/tree also returns an agents_docs array containing ThreadAgentsDocSummary items. Summaries never include full file content.
Status And Save Reason
| Type | Values |
|---|---|
ThreadAgentsDocStatus | draft, active, archived |
ThreadAgentsDocSaveReason | autosave, manual |
draft means the explicit document exists but is empty. Drafts are visible to clients but are not effective prompt sources. active means non-empty content and participates in inheritance. archived means deleted from the user-facing tree.
Payloads
ThreadAgentsDocPayload includes full content:
folder_id is omitted or null.
ThreadAgentsDocSummary is the content-free tree shape:
ThreadAgentsDocResolvedPayload describes the effective active file for a requested scope or thread:
source_folder_id is omitted for a root source. source_path is an array of folder names from the thread tree root to the source folder.
Reading A Scope
Callthread/agents_doc/get when opening an AGENTS.md editor for root or folder scope.
explicit can be absent when the requested scope has no local file. effective can be absent when no active file exists in the scope ancestry.
For the root scope, omit folder_id:
Saving
Clients save the explicit file for one scope. The gateway normalizes line endings and computescontent_sha256.
content is empty or whitespace-only after normalization, the saved document status is draft. Drafts are not injected into prompts.
expected_version is optional but recommended for any editor with autosave. If the current server version differs, the gateway returns a JSON-RPC error with code -32600 and a message containing the expected and actual versions.
content is limited to 65536 characters.
Archiving
Archive removes the explicit file from the visible tree and allows inherited parent files to become effective again.archived is false.
Resolving For A Thread
Use this method when a client needs to inspect the effective file for a specific thread.Thread Tree Summaries
thread/tree includes AGENTS.md summaries:
thread/agents_doc/get only when opening the editor.
Notifications
The gateway sendsthread/agents_doc/changed after save or archive:
thread/tree/changed so tree-based clients can refresh summaries. Treat notifications as invalidation hints; reload the affected scope or tree before rendering stale state as authoritative.
Errors
Common validation errors use standard JSON-RPC codes:| Condition | Code |
|---|---|
| Unknown workspace | -32602 |
Empty folder_id | -32602 |
| Folder does not exist in the workspace | -32602 |
| Content over 65536 characters | -32602 |
| Version conflict | -32600 |
| Database or internal processing failure | -32600 |
Schemas
Generated schemas include:/schemas/thread_agents_doc_status.json/schemas/thread_agents_doc_save_reason.json/schemas/thread_agents_doc_payload.json/schemas/thread_agents_doc_summary.json/schemas/thread_agents_doc_resolved_payload.json/schemas/thread_agents_doc_get_params.json/schemas/thread_agents_doc_get_response.json/schemas/thread_agents_doc_save_params.json/schemas/thread_agents_doc_save_response.json/schemas/thread_agents_doc_archive_params.json/schemas/thread_agents_doc_archive_response.json/schemas/thread_agents_doc_resolve_for_thread_params.json/schemas/thread_agents_doc_resolve_for_thread_response.json/schemas/thread_agents_doc_changed_notification.json
Related Pages
- AGENTS.md User Guide explains the desktop workflow.
- AGENTS.md Architecture explains persistence, inheritance, and prompt hook injection.
- Threads API documents thread tree and folder APIs.