META-HARNESS LANGUAGE · v1.4 RELEASE CANDIDATE

AI workflows you can read, test and audit.

MHL is a small executable language for orchestrating agents, prompts, tools, memory and external services. Your program owns the flow; AI contributes judgment where it helps.

Install in 30 seconds → Read a real workflow
deterministic flow local-first auditable state native MCP + A2A

01 · CONTROL

You write the flow

Ordered steps, conditions, bounded loops and checkpoints — not a chain of prompts hoping for the best.

02 · EVIDENCE

Every run leaves a trace

Cost, retries, cache hits, inputs and outputs per step, in append-only memory you can version.

03 · REACH

Serve it as MCP or A2A

A directory of workflows becomes MCP tools or Agent2Agent skills with one command.

01 · WHY IT EXISTS

Prompt glue is not architecture.

The same logic written as an imperative script with model calls sprinkled through it, versus written as MHL declarations. Same outcome; only one of them can be reviewed, tested and explained to an auditor.

Without a language implicit
risk = call_model(
  f"Classify the risk...\n{diff}",
  retries=3,            # policy buried in code
  timeout=45,
)
if "high" in risk.lower():   # parsing prose
    requests.post(HOOK, json={"risk": risk})
# where is the audit trail?
# what did run #482 actually do?
# can a reviewer read this as a process?
With MHL explicit
step Classify {
    var risk = Reviewer.run(
        prompt: Triage(diff: diff)
    )
    Audit.append({ risk: risk, at: time.now() })
}

step Escalate {
    if (risk == "high") {
        Hooks.notify(risk: risk)
    }
}
Policy is a declaration

retry, timeout, cache and fallback live on the agent, not scattered through logic.

Prompts are typed

Explicit signatures and composition, so lint catches the mistake before the run.

State is named

memory says what survives the next step, and where it is written down.

02 · ANATOMY OF A WORKFLOW

Read one MHL file, top to bottom.

A real pull-request reviewer in 42 lines. Walk the steps — the file highlights the part being explained.

review.mh
import { Diff } from "./review-types.mh"

agent Reviewer {
    command: "claude"
    args: ["-p", "${prompt}"]
    retry: { max_attempts: 2 }
    cache: { ttl: 1h, storage: "disk" }
}

prompt Triage(diff: string) {
    """
    Classify the risk of this change.
    Answer with low, medium or high.

    ${diff}
    """
}

memory Audit {
    type: "jsonl"
    path: ".mhl/audit.jsonl"
}

pipeline ReviewPullRequest {
    input diff: Diff
    var risk = ""

    step Classify timeout 45s {
        risk = Reviewer.run(prompt: Triage(diff: diff))
        Audit.append({ risk: risk, at: time.now() })
    }

    step FanOut {
        spawn a = Reviewer.run(prompt: "Review ${x}") for x in []
        wait a
    }

    step Escalate {
        if (risk == "high") {
            http.post("https://hooks.example.com/review", body: { risk: risk })
        }
    }
}

8 parts

Full pipeline and step syntax →

03 · DETERMINISM AND AUDIT

If you can't explain the run, you can't ship it.

The runtime executes the flow you wrote and reports every step: policy applied, cache, retries, duration and the value that came out. Loops are bounded; long runs can checkpoint and resume.

TERMINAL
$ mhl run review.mh --input diff="$(cat patch.diff)"

▸ step Classify   agent Reviewer   cache miss   1.84s
  ├ retry 0/2     tokens 1420 → 38
  └ risk = "high"
▸ step Escalate   http.post        200 OK       121ms
✔ ReviewPullRequest                             2.09s
  audit .mhl/audit.jsonl  +1 entry
  checkpoint .mhl/state/review-482.json
loop pipeline Refine max 3 {
    mem draft = ""

    step Improve {
        var review = Reviewer.run(prompt: Critique(draft: draft))
        if (json.parse(review).score >= 0.9) break "good enough"
        draft = Editor.run(prompt: Revise(draft: draft, notes: review))
    }
}
Bounded on purpose max N (or repeat { max_iterations }) caps the iterations; stop_when ends it sooner.
Executable tests describe and test run under mhl test.
Resume pause hands control to a human and continues later.

04 · INTEGRATIONS

Your workflows as MCP tools or A2A skills.

Point the runtime at a directory and every workflow is published with its input and output contract. One workflow, one tool.

MCP · STDIO

Local client

Newline-delimited JSON-RPC over a subprocess. The client spawns the process.

mhl serve mcp ./workflows
MCP · HTTP

Networked client

The same workflows over Streamable HTTP, with sessions and async runs.

mhl serve mcp --http \
  --addr 127.0.0.1:8711 ./workflows
A2A · HTTP

Agent interop

Publishes workflows as Agent2Agent tasks, with an Agent Card and task lifecycle.

mhl serve a2a \
  --addr 127.0.0.1:8710 ./workflows
!
Before exposing a server

Bind deliberately, configure authentication for non-local use, choose a state directory for resumable runs, and review the permissions of every workflow.

Serving guide →

05 · START IN 30 SECONDS

From an empty folder to a running pipeline.

Install the runtime, save the example as hello.mh and run it. The echo agent needs no API key and no network.

macOS / Linux
curl -fsSL https://raw.githubusercontent.com/mh-language/mhl-core-runtime/main/install.sh | sh
Windows / PowerShell
irm https://raw.githubusercontent.com/mh-language/mhl-core-runtime/main/install.ps1 | iex
run mhl run hello.mh --input name=Ana
check mhl lint hello.mh mhl test hello.mh
output Hello, Ana. Your first pipeline is running.
hello.mh
agent Echo {
    command: "echo"
    args: ["${prompt}"]
}

prompt Greeting(name: string) {
    "Hello, ${name}. Your first pipeline is running."
}

pipeline Hello {
    input name: string

    step Greet {
        var answer = Echo.run(prompt: Greeting(name: name))
        log(answer)
    }
}

06 · DOCUMENTATION

Use the right document for the next question.

This page is the map. Formal language behavior lives in the ECMA-style specification and the focused guides below.

01 Language specification Formal grammar, types, expressions, statements, standard library, extensions, serving and security. 02 Practical reference Copyable examples for constructs, pipelines, tests, diagnostics and CLI behavior. 03 Extensions Manifest, permissions, the JSON-RPC process protocol and locked installation. 04 MCP and A2A servers stdio and HTTP transports, run/* methods, human-in-the-loop resume and the state directory.
SHORTCUT Press / anywhere to search this page.