MetaClaw Benchmark CLI

April 11, 2026 · View on GitHub

Command-line interface for running and evaluating the MetaClaw Evolution Benchmark.

Entry point

metaclaw-bench <command> [options]

Or via Python module (run from the benchmark/ directory):

python -m src.cli <command> [options]

All relative paths are resolved against the project root (the directory that contains benchmark/), not against benchmark/ itself.


Commands

check

Validate a benchmark dataset before running inference.

metaclaw-bench check -p <path/to/all_tests.json>

Options

FlagRequiredDescription
-p, --pathyesPath to all_tests.json

Checks performed (8 total)

#CheckerDescription
1AllTests StructureTop-level fields and test array structure; unique agent ID
2Basic IntegrityAll referenced files exist on disk
3ID ConsistencySession IDs unique; internal IDs match filenames
4File FormatJSONL and questions.json files are valid JSON
5Directory Structureeval/ and sessions/ directories exist
6Workspace Integrityworkspace_src contains required identity files
7Session FormatSession JSONL first/second line roles are correct
8Questions IntegrityRound types, feedback strings, and eval field structure

Example

# Run from the project root (MetaClaw/)
metaclaw-bench check -p benchmark/data/metaclaw-bench/all_tests.json

infer

Run the openclaw agent for each test scenario and save per-question results.

metaclaw-bench infer -i <input> -o <output> [options]

Options

FlagRequiredDefaultDescription
-i, --inputyesPath to all_tests.json, a directory of all_tests.json files, or a JSON list of paths
-o, --outputyesOutput directory
-w, --workersno1Maximum concurrent tests
-n, --retryno0Retries per failed question
--scene-per-trainnodisabledTrigger metaclaw train-step every N scenes
--memorynooffTrigger POST /v1/memory/ingest after each scene
--memory-proxy-portno30000MetaClaw proxy port for memory ingest

Note: Tests always run serially (workers=1) when --scene-per-train or --memory is active, because these features require strict ordering.

questions.json format

{
  "id": "day01",
  "desc": "Time format preference",
  "rounds": [
    {
      "id": "r1",
      "type": "file_check",
      "question": "Save meeting notes to tasks/day01/meeting.json.",
      "feedback": {
        "correct": "Format is correct!",
        "incorrect": "Please use ISO 8601 for time fields."
      },
      "eval": {
        "command": "python scripts/check_meeting.py day01/meeting.json",
        "expect_exit": 0,
        "expect_stdout": "OK"
      }
    },
    {
      "id": "r2",
      "type": "multi_choice",
      "question": "Which time format did you use?",
      "feedback": { "correct": "Correct!", "incorrect": "Review ISO 8601." },
      "eval": {
        "options": { "A": "ISO 8601", "B": "Unix timestamp", "C": "Plain text" },
        "answer": ["A"]
      }
    }
  ]
}

Feedback injection: each round (except the first) receives the previous round's feedback prepended as [Previous Feedback] <text>\n\n<question>. A standalone feedback message is sent after the last round.

Example

metaclaw-bench infer \
  -i benchmark/data/metaclaw-bench/all_tests.json \
  -o /tmp/infer_out \
  -n 1

scoring

Score inference results against correct answers.

metaclaw-bench scoring -i <input> -r <result_dir>

Options

FlagRequiredDescription
-i, --inputyesPath to all_tests.json
-r, --resultyesDirectory to search recursively for infer_result.json files

Scoring rules:

  • file_check rounds: scored from the inline_score.passed field written during inference.
  • multi_choice rounds: extracts \bbox{X} from the agent response and compares to eval.answer.

Example

metaclaw-bench scoring \
  -i benchmark/data/metaclaw-bench/all_tests.json \
  -r /tmp/infer_out

report

Generate an accuracy and token-usage report from scoring results.

metaclaw-bench report -r <result_dir> [-c <compaction_results.json>] [-o <output_dir>]

Options

FlagRequiredDescription
-r, --resultyesDirectory containing scoring.json files
-c, --compactionnoPath to compaction_results.json for token aggregation
-o, --outputnoOutput directory for report.json and report.md; prints to terminal if omitted

Example

metaclaw-bench report -r /tmp/infer_out -o /tmp/report_out

run

Full pipeline: infer → scoring → report.

metaclaw-bench run -i <input> -o <output> [options]

Accepts the same options as infer. If a compaction_results.json exists alongside all_tests.json it is automatically picked up for the report step. When multiple test sets are processed, a combined reports.md is written to the output root.

Options

FlagRequiredDefaultDescription
-i, --inputyesPath to all_tests.json or a directory of them
-o, --outputyesOutput directory
-w, --workersno1Maximum concurrent tests
-n, --retryno0Retries per failed question
--scene-per-trainnodisabledTrigger metaclaw train-step every N scenes
--memorynooffTrigger memory ingest after each scene
--memory-proxy-portno30000MetaClaw proxy port for memory ingest

Example

# Run from the project root (MetaClaw/)
metaclaw-bench run \
  -i benchmark/data/metaclaw-bench/all_tests.json \
  -o /tmp/run_out

clean

Remove work/ isolation directories created by infer.

metaclaw-bench clean -p <root_dir>

Options

FlagRequiredDescription
-p, --pathyesRoot directory to search recursively for work/ directories

Example

metaclaw-bench clean -p benchmark/data/metaclaw-bench