merry
Health Pass
- License — License: Apache-2.0
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Community trust — 36 GitHub stars
Code Fail
- rm -rf — Recursive force deletion command in .github/scripts/tests/cargo-test-scenario.sh
Permissions Pass
- Permissions — No dangerous permissions requested
No AI report is available for this listing yet.
A lightweight terminal coding agent powered by a unified Rust runtime, with CLI/TUI, Rust, Python, and Swift APIs.
Merry
A lightweight terminal coding agent powered by a unified Rust runtime.
English · 简体中文
Features · Memory · Quick Start · Headless & CI · Shortcuts · Sandbox · SDKs · Config
https://github.com/user-attachments/assets/f7272d03-d4b8-4ae4-9ba7-547e3bc726f2
Why
Honestly, there isn't much of a why. I just wanted an agent of my own — it sounded fun, so I built one.
Features
One Rust runtime owns sessions, tool admission, context compilation, permissions, and lifecycle — serving the terminal UI, headless CLI, Rust crate, and Python SDK from the same core.
- Lightweight Footprint — Single native Rust binary with no JS runtime or background daemon, idling at ~23 MiB RSS in the full interactive TUI (comparison).
- Streaming TUI — Markdown & syntax-highlighted diffs, Plan Mode (
Alt+P), inline review comments (Alt+C),/copy& reply-anchor navigation, image paste, and built-in themes (Sakura,Tokyo Night,Catppuccin Mocha,Nord,Paper Light,Everforest,ANSI) with optional transparency. - Parallel Subagents — Built-in
explore,coder, andreviewroles plus custom roles, Git worktree isolation, and live monitoring in theTasksdock. - Sandboxed by Default — Confines every process action via Linux Landlock + seccomp or macOS Seatbelt with workspace trust,
MERRY_*environment isolation, and AI/human permission review (Windows defaults to host mode with permission review and Job Object process cleanup). - Structured Runtime — Automatic turn-preserving context compaction, cross-process session locking, on-demand
SKILL.mdskills, durable memory, HTTP MCP servers, and resumable sessions. - Multi-Provider — OpenAI Responses & Chat Completions, Anthropic Messages, per-role model overrides, and zero-disk
MERRY_*environment-variable provider config for CI.
Memory Footprint
Cold-start idle memory compared across coding agents on the same machine:
| Agent | Version | Idle RSS | Peak RSS (VmHWM) |
vs. Merry |
|---|---|---|---|---|
| Merry | 0.1.1 |
23.4 MiB | 23.4 MiB | 1.0× |
| Grok CLI | 1.0.89 |
114.1 MiB | 114.1 MiB | 4.9× |
| Codex CLI | 0.171.0 |
125.9 MiB | 125.9 MiB | 5.4× |
| Claude Code | 2.1.330 |
126.5 MiB | 137.2 MiB | 5.4× |
Antigravity CLI (agy) |
1.5.13 |
224.9 MiB | 224.9 MiB | 9.6× |
| OpenCode CLI | 2.3.0 |
514.6 MiB | 703.7 MiB | 22.0× |
| DeepSeek Harness (server only) | 0.2.2-rc.5 |
416.5 MiB | 416.5 MiB | 17.8× |
| DeepSeek Harness (server + Chrome) | 0.2.2-rc.5 |
789.9 MiB* | — | 33.8× |
Measured on Linux x86_64 by cold-starting each agent in a 120×40 PTY inside the same repository directory with zero prompts sent, reading total process-tree VmRSS / VmHWM from /proc after settling (8s). Numbers vary with OS, version, plugins, and active sessions. Claude Code was measured at its initial workspace trust screen. DeepSeek Harness (dsh web) excludes the npx wrapper; * adds headless Chrome's deduplicated PSS (334.0 MiB across all browser processes; renderer processes alone: 178.3 MiB PSS) to the connected dsh server (455.9 MiB VmRSS) to avoid double-counting shared browser pages.
Quick Start
Supported on Linux (5.13+ for Landlock), macOS (Seatbelt), and Windows (host mode with PowerShell 7 / Windows PowerShell).
Prebuilt binaries (no Rust or Node.js required; includes Alt+G Web viewer)
# Linux (static musl, x86_64 / arm64) & macOS (Apple Silicon / Intel)
curl -fsSL https://github.com/locez/merry/releases/latest/download/install.sh | sh
# Windows (x86_64)
irm https://github.com/locez/merry/releases/latest/download/install.ps1 | iex
Or download directly from GitHub Releases, or use cargo binstall merry-cli.
From crates.io (requires Rust 1.95+)
cargo install --locked merry-cli
# or with the local Web trajectory viewer (Alt+G), no Node.js required:
cargo install --locked merry-cli --features web
Nix & Home Manager
nix run github:locez/merry
# or add `inputs.merry.homeManagerModules.default` in your Home Manager flake
Launch Merry in any project directory — on first launch, the TUI guides you through provider setup, and settings can be adjusted anytime via Alt+X → Settings:
merry # interactive TUI
merry resume # pick and resume a saved session
merry run "fix the failing tests" # headless coding run (inherits TUI settings)
merry cmd "find the largest Rust files" # generate a command plan without executing
merry completions fish # print shell completions (bash, zsh, fish, powershell, elvish)
For file-based configuration (custom providers, subagent roles, MCP servers, skills, themes, and keymaps), copy examples/config.toml to ~/.config/merry/config.toml (Linux/macOS) or %APPDATA%\merry\config.toml (Windows).
main
cargo install --locked --git https://github.com/locez/merry merry-cli
To build the local Web trajectory viewer from source, build web/dist/ first (requires Node.js/npm):
git clone https://github.com/locez/merry.git && cd merry
(cd web && npm ci && npm run build)
cargo install --locked --path crates/merry-cli --features web
Headless & CI Automation
merry run and merry cmd share Merry's coding runtime, managed providers, and persisted preferences (defaults < config.toml < tui-preferences.toml < MERRY_* env < CLI flags). Pass --no-preferences in CI to ignore local TUI preferences.
# Zero-disk-config CI run using MERRY_* environment variables
MERRY_BASE_URL="https://api.openai.com/v1" \
MERRY_API_KEY="sk-..." \
MERRY_MODEL="gpt-5.4" \
merry run --no-preferences --events-jsonl --max-turns 20 -C /path/to/repo "Fix the failing unit tests"
# Enforce structured final output and override provider/model from CLI
merry run --provider anthropic --model claude-sonnet-4-5 --output-schema ./schema.json "Summarize changes"
All MERRY_* environment variables are automatically stripped by merry-process from child workspace commands (and MERRY_API_KEY_FILE is added to the denied path policy) so provider credentials never leak to tools or shell processes.
MERRY_* provider environment variables
- Common overrides:
MERRY_MODEL,MERRY_REASONING_EFFORT,MERRY_SERVICE_TIER,MERRY_CONTEXT_WINDOW_TOKENS - Named mode (selects a configured alias; mutually exclusive with inline vars):
MERRY_PROVIDER - Inline mode (standalone ephemeral provider):
MERRY_API_KEYorMERRY_API_KEY_FILE,MERRY_BASE_URL,MERRY_PROVIDER_TYPE(openai-compatible|anthropic),MERRY_PROVIDER_PROTOCOL(responses|chat_completions),MERRY_ANTHROPIC_API_VERSION,MERRY_ANTHROPIC_MAX_OUTPUT_TOKENS
TUI Shortcuts
Customize bindings in [tui.keymap] (config accepts both alt+ and option+). On macOS, Option shortcuts below work out of the box on the standard ABC layout; enable "Use Option as Meta Key" in your terminal if you use a non-ABC layout or dead-key chords such as Option+U.
| Linux / Windows | macOS | Action |
|---|---|---|
Alt+X |
Option+X |
Command palette & Settings (models, themes, transparency) |
Alt+P |
Option+P |
Toggle Plan Mode |
Alt+C |
Option+C |
Quote timeline text and attach inline review comments |
Alt+T |
Option+T |
Inspect full output of executed commands |
Alt+G |
Option+G |
Open local Web trajectory viewer (--features web) |
Ctrl+V |
Ctrl+V / ⌘+V |
Paste image from clipboard |
Esc |
Esc |
Interrupt active turn |
Sandbox & Permissions
--sandbox workspace is on by default on Linux and macOS: process actions stay confined to the workspace with network closed unless approved and inherited MERRY_* variables scrubbed, while Merry's own model and MCP connections remain on the host. On Windows, Merry currently defaults to host mode (--sandbox off) using pwsh / powershell.exe (overridable via MERRY_SHELL) with Job Object process-tree cleanup; passing --sandbox workspace explicitly fails closed because a native Windows kernel sandbox is not yet implemented. Permission review defaults to --permission-mode auto (ask, always-approve, and deny are also available).
See SANDBOX.md for Landlock/seccomp, Seatbelt, Windows host mode, workspace trust, environment isolation, and host socket integrations.
SDKs
Rust (merry)
cargo add merry --features anthropic
use merry::{AgentBuilder, SessionId, providers::anthropic};
let provider = anthropic()
.api_key("sk-ant-...")?
.model_name("claude-sonnet-4-5")?
.build()?;
let agent = AgentBuilder::new(SessionId::new("example")?)
.provider(provider)
.build()?;
let result = agent.run("Inspect the repository and summarize key modules.").await?;
Declare typed async tools with #[merry::tool], configure context windows and compaction on providers or AgentBuilder, protect concurrent access with cross-process session locks, and intercept model or tool turns with HookRegistry. See docs.rs/merry and crates/merry/src/lib.rs.
Python (merry-agent)
pip install merry-agent # imports as `merry` (currently sdist; requires Rust 1.95+)
from typing import Annotated
from pydantic import Field
import merry
from merry import events
@merry.tool(parallel_safe=True)
async def lookup_order(
order_id: Annotated[str, Field(description="Order identifier.")],
) -> str:
"""Look up an order status by id."""
return f"order {order_id}: shipped"
agent = merry.Agent(
session_id="example",
provider=merry.Anthropic(api_key="sk-ant-...", model="claude-sonnet-4-5"),
system_prompt="You are a concise assistant.",
tools=[lookup_order],
)
async with agent.stream("Check order A123.") as run:
async for message in run:
if isinstance(message, merry.ToolCallBatch):
await agent.execute_tool_batch(message)
elif isinstance(message.payload, events.AssistantMessageDeltaPayload):
print(message.payload.delta, end="")
result = await run.result()
Supports Agent(...) / await Agent.resume(...) with session locking and explicit close lifecycle, @merry.tool decorators, context window and compaction config, lifecycle hooks (merry.Hooks), structured outputs, and interactive sessions (agent.interactive()). See sdks/python/README.md and sdks/python/CAPABILITY_MATRIX.md.
Docs & Development
examples/config.toml— annotated configuration reference- SANDBOX.md — sandbox isolation and permission model
- CONTRIBUTING.md — contribution guidelines, UI screenshot requirements, and review expectations
- AGENTS.md — workspace architecture, crate boundaries, and contributor standards
cargo fmt --all --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test --all
License
Dual-licensed under either of Apache License, Version 2.0 or MIT License, at your option.
Unless explicitly stated otherwise, any contribution intentionally submitted for inclusion in Merry, as defined in the Apache-2.0 license, is dual-licensed as above without additional terms or conditions.
Reviews (0)
Sign in to leave a review.
Leave a reviewNo results found