Có gì mới trong 0.30.0
## Mermaid 0.30.0
### Added
• **`/usage` shows what the session cost.** Below the token counts it now
lists each model the session used, subagents included, with an estimate
at list prices and a total. A price comes from `[pricing.models."<model>"]`
in your config first, then from the public catalog at models.dev (fetched
at most once a day and cached; set `[pricing] catalog_url = ""` to never
fetch it, and it is never fetched under `safety.network = "deny"`). Local
Ollama models cost $0. A model with no price says so and is left out of
the total. Saved sessions now record their usage per model, so a resumed
session keeps its cost.
• **Ctrl+R searches the prompts you sent before.** It lists this session's
prompts at once and adds those of the project's last 50 saved sessions
as they load, newest first. Type to filter (every word must match, case
does not matter); Ctrl+R or Down goes to the next match; Enter puts the
prompt in the composer to edit or send; Esc leaves the draft as it was.
• **`/init` asks the agent to write AGENTS.md.** It sends one ordinary
prompt:write the file at the project root with the build, test, lint
and run commands, the layout and the pitfalls an agent cannot learn
quickly from the code, or improve the file that is there. Words after
`/init` are added to the request.
• **`--add-dir <dir>` and `/add-dir <path>` let the agent work in more than
one directory.** Each added directory gets the project directory's trust:
the file tools and the policy gate treat paths inside it as project paths
(no outside-the-project approval or Auto-mode review, edits checkpointed,
writes confined beneath it), `execute_command` with a `working_dir` there
is not escalated, and `--confine-fs` / `--sandbox` let shell commands write
there. `read_only` still blocks writes everywhere. The flag repeats and adds
to a new user-config key, `[workspace] additional_dirs`; `/add-dir <path>`
adds one for the rest of the session and bare `/add-dir` lists them.
Paths are canonicalized when added, and a missing one is an error. Symlinks
get the project root's rules:a link inside an added directory that points
out of it is not inside it. Subagents inherit the list, and `/doctor` and
the model's session facts name it. A repository's `.mermaid/config.toml`
cannot set the key.
• **MCP resources and prompts.** A server that declares the `resources`
capability gives the model two built-in tools, `list_mcp_resources`
(optionally filtered by `server`; each resource's uri, name, description
and mimeType) and `read_mcp_resource` (`server`, `uri`; text verbatim,
images attached, other binary content summarized by type and size, output
capped at 100,000 characters). They are advertised only while such a server
is ready, are never deferred behind `tool_search`, and pass the same policy
gate as MCP tool calls, so `read_only` blocks them as it blocks MCP tools. A
server that declares `prompts` puts each prompt in the `/` palette as
`/mcp__<server>__<prompt>`, tagged `(mcp:<server>)`:running it maps the
typed words onto the prompt's declared arguments in order (quotes group
words; the last argument takes the rest), prints a usage line when a
required one is missing, and otherwise fetches the prompt and sends its
text as your message. `/doctor` lists each ready server's tool, prompt and
resource support.
• **Gemini models get Gemini's own computer use tool.** With `[tools]
computer` and `provider_native` on, Gemini gets its `computer_use` tool for
the desktop in place of Mermaid's schema. Each call runs through Mermaid's
`computer` tool with the same approval and mouse-move stop, its
coordinates (out of 1000 across the screen) are scaled to the screen, and
the screenshot after it goes back in the function response. A call Gemini
asks to confirm is shown with that request; a call it blocks does not run.
• **OpenAI models get OpenAI's own computer tool.** With `[tools] computer`
and `provider_native` on, an OpenAI model on the Responses API gets the
`computer` tool it is trained on in place of Mermaid's schema. Each call's
actions run in order through Mermaid's `computer` tool, with one approval
for the call and the same mouse-move stop, and the screenshot after them
goes back to the model. OpenAI's safety warnings on a call are shown with
the approval. A model that refuses the tool gets Mermaid's schema from
then on.
• **Evals for computer use and pictures.** `settings-window` asks the model to
change a value in a Settings window with the mouse and keyboard. The harness
starts a private Xvfb display for the run, so it never touches your screen,
and the window saves outside the project, so only the screen can pass it.
`chart-value` asks for a number that is only in a chart picture.
`MERMAID_EVAL_CONFIG` adds config overrides to live runs, for ablations such
as the native computer toolset against the plain tool. CI now runs the
`computer` tool's X11 tests and the screen eval on Xvfb.
• **`/btw` asks a side question without touching the conversation.** Type
`/btw what was that config file called?` at any time, also while the agent
works. The model answers from the session so far in a pane under the
composer, as a separate call that does not interrupt the running turn. The
question and answer are never saved, compacted, or sent with later turns;
later side questions see the newest 20 earlier ones. The side call has no
tools. Esc closes the pane, Up/Down scrolls, Left/Right steps through
earlier answers, `c` copies the answer, `x` clears the earlier ones, and a
bare `/btw` reopens the newest answer. `f` forks the answer into a
background agent that carries on from it with full tools; `/agents` lists
it and its report is posted to the conversation.
• **`/goal` keeps Mermaid working until a condition is met.** `/goal all tests
pass and clippy is clean` starts a turn with the condition as the request.
Each time the run would end, a separate model call with no tools reads the
end of the conversation and answers met, not met, or impossible. Not met
starts the next turn with the check's reason and the goal restated, both
visible in the transcript; met or impossible clears the goal. Esc, a failed
turn, `[goal] max_turns` turns without a message from you (default 50), or 3
turns in a row with no tool call pause the goal with it still set. `/goal`
alone shows the condition, time, checks and tokens; `/goal clear` removes
it; the footer shows `goal 4m`. The check uses the session's model unless
`[goal] model` names another. `--resume` keeps the goal, and
`mermaid run "/goal ..."` runs the loop headless, with a `goal:` error when
it ends unmet. Claude Code, Codex and Cursor have the same command.
• **Mermaid speaks MCP 2026-07-28, the newest protocol revision.** Each
server gets a `server/discover` request first. A 2026-07-28 server then
gets stateless requests with the version, client info and capabilities in
`_meta`, with no `initialize` handshake or session. Over HTTP the requests
also carry `Mcp-Method`, `Mcp-Name` and the `Mcp-Param-*` headers a tool
asks for with `x-mcp-header`, and a tool with invalid annotations is left
out. A tool call that answers `input_required` with only a `requestState`
is sent again with it. Servers that speak only 2025-11-25 keep working:
an error, an HTTP `4xx` or a silent stdio server falls back to the
`initialize` handshake, and a stdio server that exits on the probe is
started again for it. `x-mcp-header` is removed from the schemas the
model sees.
• **Mermaid reads Claude Code's files.** A user who moved from Claude Code
used to lose their instructions, skills, commands and agents, because
Mermaid read only `AGENTS.md`, `MERMAID.md` and `.mermaid/skills/`. Now
`CLAUDE.md` (or `.claude/CLAUDE.md`) loads when a directory has no
`AGENTS.md`, and Mermaid reads `skills/`, `commands/` and `agents/` from
`.mermaid/`, `.claude/` and `.agents/` in the project and from
`~/.config/mermaid/`, `~/.claude/` and `~/.agents/`; `.mermaid/` wins on a
same name. A `commands/*.md` file is a prompt command (`$ARGUMENTS`, `$1`,
`$2`, ...), so you can add your own commands without writing a plugin. An
`agents/*.md` file is an agent type:Claude Code tool names map to
Mermaid's, an agent that cannot write gets a `read_only` ceiling, and a
project file cannot redefine `general` or `explore`. The `agent` tool now
lists the configured types with their new `description`, so the model knows
they exist. See docs/plugins.md, "Files from other tools".
• **Remote MCP servers that need an OAuth sign-in now connect.** Hosted
servers such as Linear, Notion, Sentry and Atlassian answer `401` until the
user signs in, so Mermaid could not use them. `mermaid add <name> --url
<URL>` now opens the browser to sign in when the server asks for it, and
`mermaid mcp login <name>` / `mermaid mcp logout <name>` sign in again or
delete the sign-in. The flow follows the MCP authorization spec
(2026-07-28):resource and authorization-server metadata discovery, PKCE
`S256`, the `resource` indicator, and the `iss` check before the code is
redeemed. Mermaid identifies itself with a Client ID Metadata Document,
and uses Dynamic Client Registration only for servers without it. Tokens
go to the OS keyring, bound to the server's URL, and refresh on their own;
`mermaid mcp` marks the servers that are signed in. A server that needs a
client registered by hand takes `[mcp_servers.<name>.oauth]` (`client_id`,
`client_secret_env`, `callback_port`, `scopes`), or the matching
`--client-id`, `--client-secret-env` and `--callback-port` flags on
`mermaid add --url`. `mermaid remove <name>` also deletes the server's
stored sign-in.
• **Mermaid cleans up the config keys it no longer reads.** A config file
written by an olde