MELRA (Modular Execution Layer for Reliable Autonomy) is an open-source local execution runtime for governing AI agent tool calls. Its positioning is: the agent decides what to do, and MELRA is responsible for how tool calls are authorized, verified, and recovered. It only governs calls routed through MELRA; calls made via other tools are outside its control.
Purpose and core problems AI agents edit files, run commands, click web pages, and call APIs. MELRA answers four questions about these operations: Is it allowed (every action is checked against policy, checked again at execution time, and high-risk changes wait for explicit approval)? Did it actually succeed (based on declared evidence, such as the file existing, exit code 0, page content matching expectations, and checking the final state for file writes and memory deletions)? What to do after a crash (every dispatched change is recorded before execution and executed at most once; results that cannot be confirmed enter recovery_required rather than being replayed)? What happened (every action from run to result leaves a redacted, append-only receipt and a certificate with its own digest)?
Main capabilities
- Plan/execution separation: a single task is completed in two steps via melra_plan and melra_execute; the planning phase performs no operations.
- Effect lifecycle governance: every routed effect passes through nine stages, covering policy, approval, budget, verification, receipts, and certificates.
- Evidence verification: a task reaches verified_success only when the declared evidence holds; an action that completes but whose evidence fails is reported as partial.
- At-most-once dispatch: changes are executed at most once, and uncertain results are parked pending reconciliation; exactly-once for external effects still depends on the service provider.
- Crash recovery: after a restart, settlement is based on evidence or the provider; anything that cannot be settled enters recovery_required.
- Auditing: redacted, append-only receipts and SHA-256 execution certificates recording what was executed, the requester, and the reason it was allowed.
- Multi-client support: based on the Model Context Protocol, any MCP client can be used; melra setup --client <name> writes configuration in the client's own format, and melra doctor checks whether each client points to MELRA.
- SDK: provides a TypeScript SDK and a Python SDK, which can start MELRA, or connect to an already running instance via loopback HTTP/private Unix socket; provides framework examples for LangChain/LangGraph, OpenAI Agents SDK, Vercel AI SDK, etc.
- Observability: terminal commands output readable text, and output pure JSON when piped or with --json; melra serve --http --open provides a browser interface with an overview, searchable task list, persistent workflows, and a live event stream.
- Workflows: supports nodes such as operation, approval, condition, parallel, bounded_loop, checkpoint, compensation, human_input, delegation, etc.; effects still pass through the task pipeline.
- Tool surface: twelve core tools plus one persistent workflow controller; setting MELRA_HARNESS_TOOLS=1 additionally exposes common names such as read_file, write_file, run_command, etc., which still go through the same pipeline.
Usage Requires Node.js 22.13 or newer, or 23.4 or newer. Run a single command in the directory where the agent should work to complete setup; that directory becomes the agent's workspace and is the boundary for its file and command operations; setup displays that directory and asks before setting the home directory, its parent directory, or / as the workspace; MELRA_WORKSPACE can be used to specify a different directory. In the terminal, setup is a short wizard: it writes a safe local policy, finds local agent applications, asks which one should use MELRA, and writes MELRA into that application's own configuration file (preserving the rest of the content and saving a .bak first). Then restart the agent application (Claude Code requires approving the project's server once) to let it use MELRA. The first launch creates <MELRA_HOME>/payload.key (private permissions), which must be backed up together with the SQLite file; losing it will make persisted payloads unreadable. Installation is only through the @melra/ npm scope (the CLI is @melra/cli) and the Python SDK wheel in releases; npm packages named melra outside that scope or the PyPI package melra do not belong to this project.
Security modes and limitations The honest gap in the default installation is that MELRA only governs the effects that are requested; if an agent holds both a MELRA terminal and a native terminal, the kernel becomes optional. MELRA_MODE is used to declare the situation. enforced mode rejects --unsafe-local, does not bind beyond loopback (a 0600 Unix socket is allowed), prohibits clients from registering themselves, provides an OS sandbox for each command, and marks the mode on receipts; however, MELRA cannot verify this assertion from its own process, and isolation is the operating system's responsibility. melra serve --unsafe-local (or MELRA_UNHINGED=1) can disable policy, approvals, evidence requirements, workspace restrictions, and target checks in one go. For Claude Code, melra launch claude-code keeps only the built-in Read, Glob, and Grep tools in the launched session and uses melra as the sole MCP server; for OpenClaw and Hermes Agent, setup's --exclusive --write can disable their built-in shell, web, and file modification tools, but these are defaults editable by the agent's OS user, not a boundary.
Use cases Suitable for developers and teams that need to add authorization, approvals, evidence verification, crash recovery, and auditing to agent tool calls, especially scenarios using MCP clients, building their own agents, or needing persistent workflows.
Limitations and status MELRA is alpha software; the local runtime has been tested end to end, but APIs may change before 1.0; it is recommended to use isolated workspaces, keep domain and command allowlists narrow, and read each approval before approving. Database, cloud, and SaaS adapters are designed and on the roadmap but not yet released; semantic memory belongs to the upper-layer harness and is not within MELRA. The execution path does not call models. OS-level isolation must be built by the operator, and a runnable hardened deployment recipe has yet to be provided.