Coding agents
MrTerminal is built for you and your agents to share. You get buttons, layouts and shortcuts; the agent gets
mrt, a command line over the same terminals.
Coding agents are good at running commands and bad at keeping them running. A dev server started in an agent's
own shell blocks it or disappears with it, and you can't see what it printed. With mrt, the agent
runs long-lived commands in your MrTerminal window instead:
- You see everything. Every terminal the agent opens or types into is a normal tab, brought on screen as it happens. Nothing runs in the background.
- You stay in control. Press Ctrl-C, type into the same terminal, or close it, just as with any other tab. Your keyboard focus is never taken away.
- No pile of duplicate tabs. Agents check what is already open and reuse it, so
mrt run devrestarts the dev server you already have instead of starting a second one. - The agent gets clean results.
mrt run test --waitreturns only the test run's output and its real exit code.mrt wait --matchwaits for a server's "ready" line.
Start an agent
The arrow next to + Terminal lists Claude Code, Codex, Cursor, Antigravity and Grok, wherever they're installed. Pick one and it starts in the project's folder, in a terminal like any other. Add your own agents and flags under Settings → Global commands.
Set it up
The quickest way is to let the agent do it. Paste this into your agent:
Read https://kthilagarajan.github.io/mrterminal/setup.md and set up MrTerminal for me.
setup.md walks the agent through installing the app (after asking you), linking
mrt onto the PATH, and installing the skill. To do it yourself:
- In MrTerminal, choose Shell → Install 'mrt' Command…
-
Install the skill:
This writesmrt skill install~/.agents/skills/mrt/SKILL.md, the folder coding agents share, so there is one copy for every agent. Claude Code reads~/.claude/skills, so it gets a link,~/.claude/skills/mrt, to that folder. It also adds a short, marked MrTerminal section to~/.claude/CLAUDE.md(and~/.codex/AGENTS.md), which agents read every session, so they run long-lived commands throughmrtand reuse the terminals already open without being reminded. To keep the skill with one repository instead, runmrt skill install --dir .agents/skills/mrtin it. -
An agent that reads its instructions from somewhere else can be pointed at
skill.md, or you can paste the output of
mrt skill showinto its rules file.
Then just ask, for example: "start the dev server in MrTerminal and fix the failing checkout test".
The skill
This is what the agent reads. It is also published as skill.md.
MrTerminal (mrt)
MrTerminal is a desktop app that keeps a project’s terminals in one window:
the dev server, the tests, the worker, side by side. mrt drives it. Every
terminal you open or type into appears in the app, so the user can see
what you do and step in. Nothing runs hidden in the background.
Rules (always follow these when mrt is installed)
- Long-running commands go through MrTerminal, never your own shell.
Dev servers, watchers, workers,
docker compose up,tail -f: start them withmrt run, not with&,nohup, a background job or your own tool’s background mode. The user should never have to remind you. - Reuse before you open. Start every session in a project with
mrt ls. If a terminal for the command is already there, use it:mrt run <command>andmrt open -- <command>pick it up on their own (running: left alone; stopped: started again). Never pass--newunless the user asked for a second copy. - Restart, don’t recreate. To start a stopped terminal again use
mrt restart <terminal>: it re-runs the terminal’s command, or the last command that ran in it (thelast:inmrt ls), whether that came from the sidebar, the user or an agent. Don’t close it and open a new one. - Name the shells you open (
mrt open --title agent), so the next session reuses that shell instead of opening another.
Use it when:
- a command keeps running (a dev server,
--watch, a queue worker,docker compose up,tail -f). Your own shell would block or lose it. - the user asks you to start, restart or stop something “in MrTerminal” or “in my terminal”.
- you need to see what a running process printed:
mrt read. - you want to run tests and get back only their output and exit code:
mrt run test --wait.
For quick one-off commands whose output you need straight away (ls,
git status), use your own shell as usual.
Check that it is available with mrt status. If mrt isn’t installed,
follow https://kthilagarajan.github.io/mrterminal/setup.md, or ask the user to
choose Shell → Install ‘mrt’ Command… in MrTerminal.
Core loop
mrt status # app running? projects, terminals, what runs
mrt scripts # what this project can run (package.json, Makefile, ...)
mrt run dev # start the "dev" script in its own terminal
mrt wait dev --match 'ready|listening on' --timeout 60 # until the server is up
mrt read dev --lines 40 # look at its recent output
mrt run test --wait # run tests; prints output, exits with their code
mrt stop dev # Ctrl-C
Add --json to any command when you will parse the output.
Choosing the project and terminal
- Project: by default, the one whose folder contains your current
directory. Override with
-p <name|id|folder>. Add a folder withmrt project add <folder>, list them withmrt projects, and bring one on screen withmrt project show <name>.mrt project remove <name>takes it out of the sidebar but doesn’t touch the files. - Terminal (
<terminal>): an id frommrt ls, a tab title (dev), or the command line ("npm run dev").selfis the terminal you are running in, when your own shell is inside MrTerminal ($MRT_TERMINAL_IDis set). If a name matches several terminals, mrt lists them; use the id.
Commands
| Command | What it does |
|---|---|
mrt status |
Whether the app runs; each project with its terminals and their state |
mrt ls [-p P] |
Open terminals: id, state (running, idle (last: exit 1)), title, command |
mrt projects |
Projects in the sidebar |
mrt project add <folder> [--name N] / remove <p> / show <p> |
Manage projects |
mrt scripts |
Detected scripts (with the names run accepts) and custom commands |
mrt open [--cwd D] [--title T] [--split right|below|tab] [--new] [-- <command>] |
A terminal running a command, or a shell. Reuses the terminal already open for that command (or a shell where it last ran), and re-runs it if it had stopped; a titled shell reuses the shell of that title. --new opens another one |
mrt run <script|command> [--wait] [--timeout S] [--new] [--cwd D] [--title T] |
Run a script by name (dev, web:dev, a custom command’s name) or any command line. Reuses the terminal already open for it, and re-runs it if it had stopped. --new opens another one |
mrt send <terminal> <text> [--no-enter] [--wait] |
Type a line into a terminal and press Enter. With --wait, return that command’s output and exit code |
mrt keys <terminal> <key>... |
Press keys: ctrl-c, ctrl-d, enter, tab, esc, up, down, left, right, pageup… (text goes through send) |
mrt stop <terminal> |
Ctrl-C |
mrt restart <terminal> |
Start the terminal again and re-run its command, or the last command that ran in it |
mrt close <terminal> |
Close the tab; whatever runs in it stops |
mrt show <terminal> |
Bring it on screen for the user |
mrt rename <terminal> <title> |
Rename the tab |
mrt read <terminal> |
The screen, as the user sees it (best for TUIs and prompts) |
mrt read <terminal> --lines N / --all |
The last N lines / the whole scrollback |
mrt read <terminal> --command |
Only the output of the last command, plus its exit code (stderr says exit N) |
mrt wait <terminal> [--timeout S] |
Wait for the running command to finish; prints its output, exits with its code |
mrt wait <terminal> --match RE |
Wait for output matching a regular expression (case-insensitive) since the current command started |
mrt preset list / launch <name> / save <name> / delete <name> |
Presets: saved sets of terminals and their layout. save captures what is open now |
mrt command add <name> <command> [--cwd D] / remove <name> |
The project’s own commands in the sidebar; run <name> then works |
mrt config path / show / schema |
The config file, its contents, its JSON Schema |
mrt skill show / install [--dir D] |
This file. install writes it to ~/.agents/skills/mrt, links it for Claude Code, and adds a short “use mrt, reuse terminals” section to ~/.claude/CLAUDE.md / ~/.codex/AGENTS.md |
Exit codes: 0 ok, 1 error, 2 bad usage, 3 MrTerminal is not running
(mrt starts it unless --no-launch is given), 124 timed out. With --wait,
mrt exits with the command’s own exit code.
Good habits
- Reuse before you open.
mrt run devfinds the dev server’s terminal if it is open, also a shell wherenpm run devwas last run by hand.mrt lsshows each shell’s last command as(shell, last: ...). - Waits are bounded.
--timeoutdefaults to 60 seconds. On a timeout the command keeps running. Read it withmrt read, or wait again. - Don’t wait on servers to finish. They don’t. Wait with
--matchfor their ready line, then carry on. - Clean up what you started when the task is done, unless the user wants
it left running:
mrt stopormrt close. Leave the user’s own terminals alone unless asked. - Interactive prompts:
mrt read <t>shows the question; answer withmrt send <t> yormrt keys <t> down enter. - Exit codes and
--commandoutput come from shell integration (zsh, bash 4.4+, fish). In other shells--waitstill waits, but reports no exit code.
Configuration
Everything is stored as JSON in ~/.mrterminal/config.json (mrt config path). That includes projects, open terminals and their layout, presets,
custom commands, script aliases and settings. The format is described by a
JSON Schema (mrt config schema, also linked from the file’s $schema).
While the app is running it owns that file and rewrites it within a
second of any change, so edits made there are lost. Change things through
mrt (project add, command add, preset save, …). Edit the JSON
directly only while MrTerminal is closed. It is read and tidied at the next
start, and any missing field gets its default.
Each project also has its own .mrterminal/project.json in its folder:
its terminals (with their last commands), layout, custom commands and
presets, with folders relative to the project. The app keeps it in step with
the global file; when present it wins at start and when the folder is added,
so a checked-in copy brings the same terminals to another machine. The same
rule applies: edit it only while MrTerminal is closed.
A preset written by hand needs only terminals; a null layout tiles them:
{ "id": "p1", "name": "Full stack", "layout": null,
"terminals": [
{ "id": "1", "title": "web", "cwd": "/abs/path/web", "command": "npm run dev" },
{ "id": "2", "title": "api", "cwd": "/abs/path/api", "command": "make run" } ] }