This directory contains benchmark helpers and datasets for comparing OpenClaw's built-in file memory against mem9.
Run the benchmark script directly:
export BENCH_PROMPT_FILE=benchmark/prompts/example.yaml
bash benchmark/scripts/benchmark.shIf you are already inside benchmark/, use a prompt path relative to that directory:
cd benchmark
export BENCH_PROMPT_FILE=prompts/example.yaml
bash scripts/benchmark.sh# Provide one Anthropic credential source.
export CLAUDE_CODE_TOKEN=...
# or
export ANTHROPIC_API_KEY=...If both CLAUDE_CODE_TOKEN and ANTHROPIC_API_KEY are set, the script prefers CLAUDE_CODE_TOKEN.
The script validates the selected Anthropic credential against https://api.anthropic.com/v1/models before it starts provisioning profiles. If that preflight returns 401 invalid x-api-key, the benchmark stops immediately because the model provider key is invalid.
The benchmark starts standalone openclaw gateway run processes and injects ANTHROPIC_API_KEY directly into those processes. It does not rely on launchd-managed gateway services, which avoids profile daemon environment drift during repeated local runs.
# Defaults to the hosted mem9 service.
export MEM9_BASE_URL=https://api.mem9.ai
# Optional: per-prompt timeout in seconds.
export BENCH_PROMPT_TIMEOUT=600If MEM9_BASE_URL is unset, the harness uses the hosted mem9 API at https://api.mem9.ai and provisions a fresh mem9 space for every benchmark run.
scripts/benchmark.sh— top-level A/B benchmark runnerscripts/drive-session.py— sends the same prompt sequence to baseline and mem9 profilesscripts/report.py— renders the HTML comparison reportMR-NIAH/— dataset bridge for the MR-NIAH benchmarklocomo/— LoCoMo benchmark harnessworkspace/— shared workspace context copied into temporary benchmark profilesresults/— benchmark outputs
- Profile A uses OpenClaw's native memory files.
- Profile B installs the local
openclaw-plugin, points it at mem9, and gets a fresh space for each run. - The benchmark leaves the OpenClaw gateways running after completion for manual inspection.