Beautiful, AI-native markdown IDE and LLM wiki
Editing frontmatter vs body
edit({ document: { path, find, replace } }) does NOT change frontmatter (body-only; frontmatter-intersecting find/replace returns HTTP 400). For metadata, use edit({ document: { path, frontmatter: { key: value } } }) — JSON Merge Patch (RFC 7396), null deletes, field-level CRDT merge, atomic per-call. For a full rewrite (body + frontmatter together), call write({ document: { path, content, frontmatter, position: "replace" } }).
Wrong path. edit only changes a document that already exists. When nothing exists at path it returns No document at "<path>" and changes nothing, naming any near match it found (a folder's hub doc, or a document whose trailing path segments match). Paths are relative to the content root, so a document in a subfolder needs every folder segment from that root. Retry at a suggested path or the corrected one; don't retry the same one. write with position: "append" or "prepend" on a missing path creates the document, and its response opens with Created new document. If you meant an existing document, the path is wrong: delete the new one and retry at the intended path.
Stale-session symptom. If edit returns "Text not found" on text you can verify exists on disk (via exec("cat …")), or No document at a path you can cat from the content root, the MCP session is likely stale (e.g., after a folder rename or server restart). Treat this as the escape-hatch trigger from the STOP block: prefix your next user-visible sentence with OpenKnowledge MCP unavailable: and report the inconsistency. Don't loop on retries — the symptom is structural, not transient.
Delete / move. To delete a doc, call delete({ document }) — never rm / unlink / native Bash removal on in-scope markdown. The MCP path closes open agent sessions and unloads the doc from Hocuspocus before unlinking; native rm desynchronizes those. Deletion is irreversible — call checkpoint() first if you may need to roll back (it snapshots the whole project; afterwards restore the doc via restore_version({ document, version }), finding the version in history), and links({ kind: "backlinks", document }) first if you want to fix referrers that will become redlinks. To move or rename a doc instead of delete + rewrite, use move({ from, to }) — it auto-detects document vs folder vs asset and rewrites incoming references atomically.
MDX. To author an MDX doc (the KB renders MDX/JSX components), set extension: ".mdx" on the create: write({ document: { path: "guides/widget", content, extension: ".mdx", position: "replace" } }) lands guides/widget.mdx. A .mdx suffix typed into path works too (the extension field wins if you pass both); omit both and it lands .md. An existing doc keeps its on-disk extension regardless — changing it in place isn't available via the MCP today.
Advisory warnings on writes. write and edit responses may include structuredContent.document.warnings (batch: per-doc structuredContent.documents[].warnings) — advisory entries discriminated by kind, each also summarized as a ⚠ line in the response text. What to do next is the result's outcome and nextStep (references/conflict-resolution.md); the entries say why. Write-integrity kinds come with nextStep: re-read, so re-read the doc (exec("cat <path>")) before continuing: content-divergence ({ kind, intendedBytes, actualBytes, byteDelta, hint } — the converged Y.Text doesn't match what the payload composed to: concurrent peer residue, or — rare — a primitive regression; the write is applied) and disk-edit-reconciled (an out-of-band disk edit was folded in before your write landed on top; mergeOutcome says how: clean, merged, both-kept or kept-live). With "both-kept" the out-of-band edit changed the same blocks as edits made here, and three counts say what landed: duplicatedBlocks blocks are in the doc twice, this doc's version first and the out-of-band version directly under it; restoredDeletedHere blocks deleted here came back with the out-of-band version because it changed them; restoredDeletedOutside blocks the out-of-band edit deleted stayed with this doc's version because they were changed here. With "kept-live" it could not be merged, so the version here stayed and the out-of-band version was saved to the doc's history. In both your write landed: do not retry it. Re-read, and after both-kept remove a duplicate, or delete a block restored over a deletion here, with an ordinary edit if your task calls for it. A mergeOutcome you do not know means the same as merged: re-read. The renderability kind mermaid-parse-error ({ kind, fenceIndex, fenceFirstLine, message, line? }) means that mermaid fence will not render — fix the fence and re-edit. The top-level warning field on write tools is unrelated: it is the preview-attach hint (action: "attach-preview-once" | "start-ui"), not an advisory — a separate key from document.warnings, and the two can coexist on one response.