export_chat — Refreshes the chat’s JSON into its working directory and renders Markdown.
The Markdown export is written to the current working directory.
Installation
The plugin is available for download on the
LM Studio Hub.
Install locally according to the LM Studio documentation (e.g., build and load the plugin from the local folder).
Development
Install deps: npm install
Build (TypeScript → dist/): npm run build
Run in LM Studio dev mode: lms dev
Push to LM Studio (for publishing): lms push
Requirements and assumptions
LM Studio attaches a working directory to the prediction context.
The working directory path is expected to be:
<LM_HOME>/working-directories/<chat_id>
The chat_id is exactly 13 digits (e.g., 1758816879741) and must match the working directory name.
The source JSON is expected at:
<LM_HOME>/conversations/<chat_id>.conversation.json
This plugin is intentionally strict and deterministic: if the SDK working directory is missing or does not match the expected layout, the export fails with a clear error message (no heuristics / no fallback scanning).
How to use
Run:
export_chat {}
Outputs:
<chat_id>.conversation.json (refreshed into the working directory; always overwritten)
overwrite (boolean, default: true) — Overwrite outputs if they exist.
include_thinking (boolean, default: true) — Include “thinking” blocks as collapsible .
include_tool_calls (boolean, default: true) — Include tool calls as pretty-printed JSON.
emit_messages_json (boolean, default: false) — Also write messages-only JSON.
embed_images (boolean, default: true) — Embed local images from the chat working directory into the Markdown as data: URIs.
Conversion behavior
Uses the last version of each message (assumed to be the latest).
Renders roles as Markdown sections:
User, System, Tool
For assistant messages, the heading uses the model (e.g., senderInfo.senderName), or “Assistant” if unknown.
Strips known control markers like:
<|start|>assistant<|channel|>final<|message|> and <|channel|>final<|message|>
Image handling
Attachments: embedded when the message contains base64 / metadata-derived previews.
Chat working directory images: by default embedded into the Markdown (data: URIs) so the .md stays portable when moved out of the chat folder.
If you disable embedding (config embedImages=false or tool param embed_images=false), the Markdown will keep relative links, which only work as long as the .md remains in the chat working directory.