Mercury CLI
Documentation

Providers

Train a model on your sessions

mercury tune turns your project's sessions into a training book, can add reasoning to its assistant turns, trains a LoRA adapter on a rented GPU, and installs the merged model into your Bank for /localsetup.

Results from the developer's own runs

Mercury's developer trained Minerva on his own sessions. In round one, Minerva scored edits 0/10 and finishes 1/10, against stock finishes 4/10. In round two, Minerva scored edits 0/10 and finishes 0/10, against stock finishes 6/10. Round three was still in training at the time of writing. These are the developer's own results. Neither completed round beat the stock model on finishes, and neither produced a successful edit. This workflow is a way to run your own experiments; it is no promise of improvement.

Prepare your book

Write charter.md with your model's identity and working principles. Check that you have permission to use the sessions and that the base model's licence permits your intended use.

From the project whose sessions you want to use:

mercury tune export --out tune-book --charter charter.md

Export reads this project's sessions and crewmate transcripts. It writes episodes.jsonl, the train.jsonl, valid.jsonl and test.jsonl splits, holdout.json, and summary.json into tune-book. Keep holdout.json when exporting again so the held-out episodes stay out of training.

Home paths and credential-shaped values are scrubbed during export. Review the book before sending it elsewhere: session text can also contain private code, customer data or business information. Export itself stays local.

Add reasoning if you want it

Choose a model you have signed into:

mercury tune think tune-book/episodes.jsonl --model <id>

This writes tune-book/episodes-think.jsonl. Native reasoning already present in a turn is kept as written; only turns without reasoning are sent to the chosen provider. The command shows the per-turn cost when a price is available. The original book stays unchanged. The saved thoughts live beside the output in episodes-think.jsonl.thoughts/; add --resume to reuse them after an interruption. --out <path> chooses another output file.

Think processes the held-out splits as well as the training split. Train and validation must use the same reasoning format. A book with thoughts tested against thought-free answers can trigger the two-rise stopping rule because the format changed.

Train on a rented GPU

Connect Runpod or Vast.ai in /llmhost, then choose your base and allowance:

mercury tune train --book tune-book/episodes-think.jsonl --base author/base --vendor runpod --dollars 25

Use --vendor vast for Vast.ai. If you skip Think, give --book tune-book/episodes.jsonl instead. author/base is a placeholder for your chosen Hugging Face repository. The book and trainer are uploaded to the rented machine; training and the merge run there.

The trainer saves checkpoints and evaluates on the held-out quiz. Two successive rises in quiz loss pause training. At the ten-minute rate it projects the cost of the whole pass and pauses if that exceeds the allowance. A pause leaves the rented machine running and billing. The notice names the machine and hourly rate so you can choose Resume or Terminate.

mercury tune train --resume tune/trained --dollars 25
mercury tune train --finish tune/trained --dollars 25

Resume restores the checkpoint's training state. Finish merges the saved adapter into the base in BF16 and exports a Q4_K_M GGUF. A completed training pass also exports that merged model. The output defaults to tune/trained; --out <folder> chooses another destination. Keep the output folder for a later resume or another round. Its adapter/ directory is the LoRA sidecar; model-Q4_K_M.gguf is the merged model to install.

Bake the charter and install

mercury tune bake --from tune/trained --charter charter.md
mercury tune install Atlas --from tune/trained --bank /path/to/mercury-model-bank

Bake writes chat-template.jinja, charter.md, Modelfile and bake.json under tune/trained/baked. It changes only the default system message: a request without a system message receives the charter, while an explicit system message from the caller still wins. Thinking and tool formatting stay in the base template. Baking changes the template; it does not train weights.

Baking recognises the Nemotron and Qwen empty-system branches used by this workflow. An unfamiliar or changed template is refused without writing a bundle. The charter must be nonempty and cannot contain a triple quote. --out <folder> chooses a fresh baked folder; install accepts that folder with --baked <folder>.

Install checks the training files against artifacts.json and checks the baked bundle before registering the Bank entry. It copies the merged GGUF, the adapter sidecar when present, the template, the charter, the Modelfile and training records. It never overwrites an existing model name. Omit --bank to use your remembered Bank folder.

Open /localsetup, choose Bank, then select local/Atlas/Atlas-Q4_K_M.gguf. The local server loads the baked template with the merged weights. Installation does not change the current model or start a server. The adapter is retained for further training and is never applied again to the already-merged GGUF. The Modelfile likewise points at the merged GGUF and carries the charter as its system message.

Lessons carried into the workflow

  • Keep the quiz and training book in the same format, including reasoning.
  • Drop identical re-issues of refused calls until a successful action changes the state. Repeated refusals are not useful examples of how to recover.
  • Keep an unacted error turn as context, with that turn masked out of the training loss.
  • Deal identity episodes throughout the pass instead of leaving them until the end. Include a charter-only identity turn beside the full-system one.
  • Use the ten-minute rate to price the whole pass. Pause for the user's decision; a short watchdog must not terminate a rental.
  • Restore the exact checkpoint state when resuming.
  • Bake the charter into the template so the model has its default identity even when the caller supplies no system prompt.