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:

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:

  1. In MrTerminal, choose Shell → Install 'mrt' Command…
  2. Install the skill:
    mrt skill install
    This writes ~/.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 through mrt and reuse the terminals already open without being reminded. To keep the skill with one repository instead, run mrt skill install --dir .agents/skills/mrt in it.
  3. An agent that reads its instructions from somewhere else can be pointed at skill.md, or you can paste the output of mrt skill show into 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)

  1. Long-running commands go through MrTerminal, never your own shell. Dev servers, watchers, workers, docker compose up, tail -f: start them with mrt run, not with &, nohup, a background job or your own tool’s background mode. The user should never have to remind you.
  2. 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> and mrt open -- <command> pick it up on their own (running: left alone; stopped: started again). Never pass --new unless the user asked for a second copy.
  3. 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 (the last: in mrt ls), whether that came from the sidebar, the user or an agent. Don’t close it and open a new one.
  4. Name the shells you open (mrt open --title agent), so the next session reuses that shell instead of opening another.

Use it when:

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

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

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" } ] }