Rewrite or append to a document
ragdown_writeCreate, replace, or append Markdown documents at a chosen path, using a base hash to avoid overwriting unread versions and optional headings for appends.
Instructions
Rewrite or append to an existing document, or create one at a path you choose. To change part of a document, use ragdown_edit, which sends only the passages that change. By default text replaces the whole file (frontmatter included), which for an existing document needs base_hash: the hash ragdown_read_doc returned, so you never overwrite a version you have not read. A document this creates gets created_by: ragdown_write in its frontmatter, so the hash returned is of the file as written, not of text. append: true adds text at the end of the document, or with heading at the end of that section, leaving the rest as it is. If the file changed since base_hash, nothing is written: read it again and redo the edit.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path of a Markdown file relative to the documents root, e.g. 'projects/alpha.md' | |
| text | Yes | The document's new Markdown, or with append, what to add | |
| append | No | ||
| heading | No | With append: add to the end of the section under this heading | |
| base_hash | No | The hash from ragdown_read_doc; required to replace an existing document | |
| session_id | No | Stable id of the conversation, recorded in the frontmatter of a document this creates |