MartyLake/xmd

★ 0Forks 0PythonGitHub ↗Compare

README

xmd

xmd helps you work with AI chat transcripts as editable files in Vim.

Instead of treating a chat as a disposable terminal session, xmd stores the conversation in a *.x.md file and lets you keep editing, re-running, and restructuring it like normal text.

What Problem It Solves

xmd is for the case where you want:

  • a chat transcript you can inspect and version
  • repeatable prompts that stay attached to the file they belong to
  • a way to send the current file to a model without copying content around
  • optional tool calls and arena-style multi-model runs, while keeping the transcript readable in Vim

In short: it turns AI chat into a file-based workflow instead of an opaque UI session.

Example Transcript

Here is the same *.x.md file as it moves through the workflow:

1. Start

# User -> qwen3.5-27b
Write a short launch note for the new release.

2. After xmd send path/to/file.x.md

# User -> qwen3.5-27b
Write a short launch note for the new release.

# model: qwen3.5-27b [4s]
We are shipping the new release today. It is faster, more focused, and
ready for daily use.

3. After a tool call round

# User -> qwen3.5-27b
Find the current date and include it in the release note.

# tool calls: qwen3.5-27b [3s]
```json
[
  {
    "type": "function",
    "function": {
      "name": "get_date_time",
      "arguments": {}
    }
  }
}
```

# tool: get_date_time
```json
{}
```

2026-04-11 22:54:00 CEST

# model: qwen3.5-27b [5s]
We are shipping the new release today, on 2026-04-11, with a simpler and
faster workflow.

This is the shape xmd keeps in the file: human-written prompts, model replies, and tool traces all live together in one editable transcript.

What You Can Do With It

xmd Executable

The CLI talks to Ollama. Right now that is the only supported backend.

A typical flow looks like this:

  1. Start the queue worker in one terminal:
xmd worker
  1. Keep a second terminal open as a lightweight HUD:
watch xmd status
  1. Create or open a *.x.md transcript in Vim.
  2. Edit the prompt, model blocks, or tool-call transcript as plain text.
  3. Send the current file to the model:
xmd send path/to/file.x.md
  1. If you want the next authoring action instead of a send, ask for it:
xmd suggest path/to/file.x.md --json

Other CLI commands:

  • xmd new topic
  • xmd models
  • xmd ls
  • xmd status

xmd.vim Plugin Helpers

The Vim plugin adds buffer-local behavior for *.x.md files.

When you open a *.x.md file, Vim applies xmd behavior automatically.

Use these exact mappings and commands:

  • [s to jump to the previous section
  • ]s to jump to the next section
  • zT to fold every <think>...</think> block
  • <leader>xs to write and send the current buffer
  • <leader>xm to write and send the current buffer with a chosen model
  • <leader>xl to list files in the current directory
  • :Xmd to ask for the next authoring action and append it
  • :XmdSend to send the current buffer through the CLI
  • :XmdSelectModel to insert a model name at the cursor

The doc/xmd.txt help file describes the full file format, commands, and mappings.

Install

Install this repository as a Vim plugin using your normal plugin manager or a manual runtimepath setup.

Then generate help tags:

:helptags {path-to-xmd}/doc
:help xmd

The CLI executable is xmd. Put it on your PATH, or invoke it from the repository root.

Configure

xmd reads runtime files from XMD_HOME, which defaults to ~/.xmd.

Common configuration points:

  • XMD_HOME
    • runtime state, queue files, tool specs, and the default system prompt
  • XMD_DEFAULT_MODEL
    • fallback model when a file does not specify one
  • LLAMA_SWAP_URL
    • base URL for the backend API, defaulting to http://localhost:11434
  • XMD_TOOLS_FILE
    • optional explicit JSON file with tool definitions

If you want the optional contrib bundle, copy the pieces you want into your own XMD_HOME:

mkdir -p "$XMD_HOME"
cp -R contrib/bin "$XMD_HOME/"
cp -R contrib/tools.d "$XMD_HOME/"
cp -R contrib/system_prompt.txt "$XMD_HOME/"

Repository Layout

  • autoload/, after/, syntax/, ftplugin/: Vim integration
  • xmd: CLI executable
  • doc/xmd.txt: Vim help
  • test_xmd.sh, test_vim_xmd.sh: tests
  • contrib/: optional, unsupported extras you can install manually

Contributors

MartyLake

Issues