Merl is a tiny ghost-text engine for markdown notes. Based on other text in a vault, it proposes the next words of the line you're writing. I'm developing it as an inline-completion backend for accent, but because it speaks LSP 3.18, basically any editor with an inline-completion client could use it.
Merl uses an ∞-gram (see credits) to extract text from other files in the vault within milliseconds of typing. In the next stage, I'm planning to extend Merl with a fine-tuned attention model, Wren, to give more precise suggestions. No GPU needed btw.
The runtime indexes a 67 MB vault in 2.4 s with 330 MB of memory on a CPU, so no GPU is needed.
You need a C compiler, make and Git.
Build the runtime and copy it to ~/.local/bin by running:
git clone https://github.com/stroblme/merl.git
cd merl
make installPREFIX changes the install location and CFLAGS the compiler flags (default -O3).
To run the runtime inside a Rust program, add the merl-sys crate from the repo:
[dependencies]
merl-sys = { git = "https://github.com/stroblme/merl" }For training and development, install uv and, in the checkout, run:
uv sync --group dev
uv run fluksio serveKeep the Fluksio engine running for training.
make help lists the build and test chores.
Ask for one suggestion from a vault of notes:
merl-rt --vault ~/notes --suggest "the completion"For an editor, run it as an LSP server on stdio:
merl-rt --vault ~/notesWithout --vault, the vault is the client's first workspace folder, else its rootUri.
In Rust, merl_sys::run does what merl-rt's main does.
That is how accent ships ghost text inside accent-cli.
Training and evaluation live in Python. From a checkout with the engine running, train in another terminal:
uv run merl --train # WikiText base corpus
uv run merl --train records.bin # any byte stream of fill-in-the-middle recordsThis records the training run and saves merl/weights.npz.
Datasets download into data/ on demand (merl.dataset).
The tests include the C runtime, pinned against merl.ngram:
make test- Infini-gram by Jiacheng Liu et al. for the ∞-gram idea.
- libsais by Ilya Grebnov for suffix arrays (Apache-2.0).
- jsmn by Serge Zaitsev for JSON parsing (MIT).
- WikiText by Stephen Merity et al. for the base corpus.