🐞 Mercury CLI: an open-source terminal coding agent that drives the debugger itself
In brief
- 💻 Mercury CLI is an AI coding agent for the terminal on macOS, Linux and Windows, open source under Apache 2.0.
- 🐞 When a test fails, the agent can launch it in a debugger, stop at breakpoints and read live values.
- 🌳 It searches and rewrites code by syntax tree in 57 languages and shows the diff first.
- 🔌 It works with 22 cloud providers or local models via Ollama, LM Studio, vLLM or llama.cpp.
💻 Terminal coding agents read code, edit files and run tests. When a test fails, they usually guess from the error message. [Mercury CLI](https://mercury-cli.ai) by Waleed Al Qusous goes a step further: the agent can launch a failing test in a real debugger through the Debug Adapter Protocol, stop at a breakpoint and read the values of the variables at that moment. According to the repository this works for Python, JavaScript and TypeScript, Go and Rust. 🌳 On top of that comes search and edit by syntax tree in 57 languages: the agent finds code by its structure rather than its text and shows a change as a diff first. Several agents can run in parallel, each in its own git worktree and, if wanted, on its own model. Mercury connects to 22 providers, among them OpenAI, Anthropic and Google, or to local models, and the model can be switched in the middle of a task. 📦 According to the repository the program is freely available under the Apache License 2.0 and installs via script, npm, bun, Homebrew or mise; git is the only requirement. Anyone using cloud models pays that provider's costs. Al Qusous develops the tool on his own.
🐞 The debugger as the agent's tool. The Debug Adapter Protocol is the interface editors such as VS Code use to talk to debuggers. Mercury bundles the debugpy adapter for Python and js-debug for JavaScript. In practice, instead of writing a guess into the code after a red test and trying again, the agent can step through the test and look at what value a variable really holds. There are also persistent Python and JavaScript code cells in which the agent can evaluate expressions.
🌳 Structure instead of text. The syntax-tree search is built on tree-sitter. An example in the repository shows the agent finding three `console.log` calls across three files by their shape and rewriting them to `logger.debug` in a dry run before applying the change. Through language servers (LSP) it can look up definitions and propose refactors that you preview before they apply; the directory listing says the TypeScript and Pyright language servers are bundled.
👥 Several agents, separate working copies. So-called crewmates run in parallel, each in its own git worktree checkout and with leases on project files so they do not overwrite each other. When a session ends it writes a handoff note that the next one reads once at startup. The project memory, called Mneme, runs on your own machine: it combines a bundled 118 MB embedding model with classic word ranking, so it searches by meaning and by terms.
🧰 What else is included. Web search without your own API key, fetching pages as markdown, control of the active window (computer use), voice dictation with Whisper on the device, scheduled sessions and bridges to VS Code, Unity, Blender, Godot and Aseprite. With `mercury run` and SDKs for TypeScript and Python the agent can also be used headless in scripts. Permission modes range from strict ask-first to fully autonomous.
⚖️ Who it suits. Mercury is aimed at developers who work in the terminal, want to pick their own model or prefer local models, and expect more than another guess when something breaks. The feature set is large and the command list long accordingly; anyone who only wants the occasional suggestion for a function is probably faster with a simpler assistant in the editor. According to the repository, Al Qusous built the project alone in seven months, with 59 public releases so far; bugs are reported through a form or from inside the program with `/bug`. 🛠️