Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions performance/agents/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,26 @@ A test on the owner's real data follows [Testing agents on real data](../../docs
With search limited to records from before each question: Gemma 77.7% micro, 74.5% macro (unchanged).
Run-to-run noise: 49 of 280 verdicts change on a plain rerun (17.5%), the total holds to about a point.

- [locomo-memory-agents](locomo-memory-agents/README.md) — 50 public LoCoMo questions (200 for Claude Code), Hermes,
OpenClaw and Claude Code, each with plain files, WireCat memo, Hindsight, Honcho, Mem0 and Supermemory: no engine
beat files, WireCat is within noise of files in every arm (Claude on 200 questions: 175 against 182, −7, interval
−15 to +1), and with DeepSeek Flash in Hermes Hindsight (−5.0), Honcho (−3.0) and Mem0
(−6.7) are below files by the paired test. Other models with WireCat: Gemini +3.7 over DeepSeek Flash on one
run, Grok partial at 19 questions (2026-11-25).

- [telegram-search-agents](telegram-search-agents/README.md) — the owner's real Telegram archive (954,242 messages,
376 chats), 65 questions as he asks them, totals only: one search finds the answer in the top 20 for 42 with WireCat
tg, 33 with qmd, 1 with Telegram's own search and 0 with jackwener/tg-cli. With an agent on 20 held-out questions,
3 runs, tg with its skill ties qmd with its skill (Sonnet 15.7 against 16.4, Haiku 13.25 against 14.5) and reaches
the grep ceiling; Anthropic models only (2026-11-26).

- [source-coverage](source-coverage/README.md) — a real personal Telegram account, WireCat against telegram-mcp and a
plain export, on clean questions over 10 chats (2026-11-13). The setup was simpler than real use; read
[AGENT-TESTS.md](../../docs/dev/AGENT-TESTS.md) before quoting it.

- [openclaw-skills](openclaw-skills/README.md) — OpenClaw lists the six WireCat skills from `~/.agents/skills`
and marks one not ready when its CLI is missing (2026-10-29).

- [mcp-short-listing](mcp-short-listing/README.md) — an agent succeeds as often with the short MCP answer schema
(3,323 characters for the three tools) as with the full one (17,278), on half the input tokens (2026-11-09).

Expand Down
325 changes: 325 additions & 0 deletions performance/agents/locomo-memory-agents/README.md

Large diffs are not rendered by default.

2,060 changes: 2,060 additions & 0 deletions performance/agents/locomo-memory-agents/data/post1-answers.jsonl

Large diffs are not rendered by default.

319 changes: 319 additions & 0 deletions performance/agents/locomo-memory-agents/data/post3-answers.jsonl

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
conv-26-c1-1,conv-26-c2-1,conv-30-c4-1,conv-30-c1-1,conv-41-c1-1,conv-41-c3-1,conv-42-c2-1,conv-42-c4-1,conv-43-c1-1,conv-43-c4-1,conv-44-c2-1,conv-44-c3-1,conv-47-c1-1,conv-47-c2-1,conv-48-c3-1,conv-48-c4-1,conv-49-c1-1,conv-49-c3-1,conv-50-c2-1,conv-50-c4-1
96 changes: 96 additions & 0 deletions performance/agents/locomo-memory-agents/scripts/export_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#!/usr/bin/env python3
"""Turns a bench's run folders into the per-answer JSONL files in data/. Keeps the answer, the judge's label and
counts; drops tool-call arguments, tool results, session ids and the LoCoMo question and gold text (CC BY-NC 4.0:
regenerate them with post1/scripts/pick_questions.py). Usage:
python3 -I export_data.py --bench /var/tmp/locomo-bench --bench-p3 /var/tmp/locomo-bench-p3 --out ../data"""

import argparse
import json
import re
from collections import Counter
from pathlib import Path

# Post 1 publishes stage "full" for every arm except OpenClaw, whose rows come from the sandboxed rerun "full-iso2".
POST1 = {"full": lambda arm: not arm.startswith("openclaw-"), "full-iso2": lambda arm: arm.startswith("openclaw-"),
# The 150 extension questions, Claude Code only.
"ext": lambda arm: arm.startswith("claude-")}
# Post 3's runner flags these markers in tool-call arguments; these three mean the agent fetched the dataset.
P3_NET = ("curl", "wget", "http://", "https://", "git clone", "pip ", "locomo", "huggingface", "urllib", "requests")
P3_DATASET = ("locomo", "huggingface", "git clone")
CHUNK = re.compile(r"(r2)?(s\d+)-(conv-\d+)-\d+")


def cost_of(row):
usage = row.get("usage") or {}
for value in (usage.get("estimated_cost_usd"), row.get("cost_usd"), row.get("cost_usd_list_price")):
if value is not None:
return round(float(value), 6)
return 0.0


def row_out(base, row, judged):
calls = row.get("tool_calls")
if isinstance(calls, int):
# OpenClaw rows hold a call count and the distinct tool names, not one entry per call.
count, tools = calls, sorted(row.get("tools") or [])
else:
names = Counter(str(t.get("name", "")) for t in calls or [] if isinstance(t, dict))
count, tools = sum(names.values()), dict(sorted(names.items()))
label = judged[row["id"]]
return {**base, "conversation": row["conversation"], "id": row["id"], "category": row["category"],
"answer": row["answer"], "label": label["label"], "correct": label["correct"],
"sessions_cited": row.get("sessions_cited") or [], "seconds": row.get("seconds"),
"cost_usd": cost_of(row), "tool_calls": count, "tools": tools}


def labels(chunk):
return {r["id"]: r for r in json.loads((chunk / "judged.json").read_text())["rows"]}


def post1(bench):
network = {(r["stage"], r["arm"], r["setup"], r["run"], r["id"]): r["kind"]
for r in json.loads((bench / "runs/integrity/network.json").read_text())}
for stage, keep in POST1.items():
for answers in sorted((bench / "runs" / stage).glob("*/*/*/*/answers.json")):
arm, setup, run, _ = answers.parent.relative_to(bench / "runs" / stage).parts
if not keep(arm):
continue
judged = labels(answers.parent)
for row in json.loads(answers.read_text()):
base = {"stage": stage, "arm": arm, "setup": setup, "run": run}
yield {**row_out(base, row, judged), "network": network.get((stage, arm, setup, run, row["id"]))}


def post3(bench_p3):
for answers in sorted((bench_p3 / "runs").glob("*/*/answers.json")):
match = CHUNK.fullmatch(answers.parent.name)
if not match:
continue
repeat, stage, _ = match.groups()
judged = labels(answers.parent)
for row in json.loads(answers.read_text()):
text = " ".join(str(c.get("arguments", "")) for c in row.get("tool_calls") or []).lower()
hits = [m for m in P3_NET if m in text]
kind = "dataset" if any(m in hits for m in P3_DATASET) else "web" if hits else None
base = {"model": answers.parent.parent.name, "run": "r2" if repeat else "r1", "stage": stage}
yield {**row_out(base, row, judged), "network": kind}


def write(path, rows):
rows = list(rows)
path.write_text("".join(json.dumps(r, ensure_ascii=False) + "\n" for r in rows))
print(path, len(rows))


def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--bench", type=Path, required=True)
parser.add_argument("--bench-p3", type=Path, required=True)
parser.add_argument("--out", type=Path, required=True)
args = parser.parse_args()
write(args.out / "post1-answers.jsonl", post1(args.bench))
write(args.out / "post3-answers.jsonl", post3(args.bench_p3))


if __name__ == "__main__":
main()
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
#!/usr/bin/env python3
"""LoCoMo through Claude Code (`claude -p`, the owner's subscription) with each memory attached as its MCP server,
or files / memo through Bash. Clean session: safe mode, no slash commands, only the MCP config given here."""

import argparse
import json
import os
import shutil
import subprocess
import time
from datetime import UTC, datetime
from pathlib import Path

from hermes_locomo import FIXTURES, ORACLE_MARKERS, PROMPT, ROOT, sessions_cited
from hermes_runner import parse
from provider_retrieval import keyring_secret

BENCH = ROOT / "bench/claude"
WHERE = {
"files": "The chat is in text files in ./corpus, one session per file (r0001.md is session 1, r0002.md "
"session 2 and so on); each file starts with the session's date.",
"wirecat": "The chat is in memo: use the `memo` command in Bash (`memo skill show` prints its guide). Each note "
"is one session; its first line names the session number and date.",
"supermemory": "The chat is in your Supermemory memory, space `{store}`; search it with the Supermemory tools.",
"mem0": "The chat is in your Mem0 memory, user id `{store}`; search it with the Mem0 tools.",
"hindsight": "The chat is in your Hindsight memory; recall from it with the Hindsight tools.",
"honcho": "The chat is in your Honcho memory; search it with the Honcho tools.",
# Control arm: no memory and no tools, to see what the model already knows about LoCoMo.
"none": "You have no access to the chat; answer only if you already know, else \"unknown\".",
}
# --safe-mode also turns MCP servers off (claude 2.1.330 help), so isolation is --setting-sources "" plus
# --strict-mcp-config; the init event of every question is recorded to show what was loaded.
WRITES = {
# Names from Mem0's MCP docs, not yet checked against a live init event (quota); unknown names deny nothing.
"mem0": ["add_memory", "update_memory", "delete_memory", "delete_all_memories", "delete_entities"],
"hindsight": ["cancel_operation", "clear_memories", "clear_mental_model", "create_directive",
"create_mental_model", "create_page", "create_page_folder", "delete_bank", "delete_directive",
"delete_document", "delete_mental_model", "delete_page_node", "invalidate_memory",
"refresh_mental_model", "retain", "sync_retain", "update_bank", "update_memory",
"update_mental_model", "update_page_node"],
# The live tool list (init event, 2026-11-23) has no add_memory / forget_memory; these are its writes.
"supermemory": ["guided-save", "upload-file", "select-space", "add_memory", "forget_memory"],
"honcho": ["add_messages_to_session", "add_peers_to_session", "add_sessions_to_scope", "create_conclusions",
"create_peer", "create_scope", "create_session", "create_workspace", "delete_conclusion",
"delete_session", "remove_peers_from_session", "remove_session_from_scope", "schedule_dream",
"set_metadata", "set_peer_card", "clone_session"]}
TOOLS = {"mem0": "", "none": "", "files": "Bash,Read", "wirecat": "Bash,Read", "supermemory": "", "hindsight": "", "honcho": ""}


def mcp_config(setup, store):
if setup == "hindsight":
return {"mcpServers": {"hindsight": {"type": "http", "url": f"http://127.0.0.1:18888/mcp/{store}/"}}}
if setup == "supermemory":
return {"mcpServers": {"supermemory": {"type": "http", "url": "https://mcp.supermemory.ai/mcp",
"headers": {"Authorization": "Bearer ${SUPERMEMORY_API_KEY}"}}}}
if setup == "mem0":
# docs/platform/mem0-mcp.mdx: hosted MCP, API key as bearer for headless clients. Not run yet (quota).
return {"mcpServers": {"mem0": {"type": "http", "url": "https://mcp.mem0.ai/mcp",
"headers": {"Authorization": "Bearer ${MEM0_API_KEY}"}}}}
if setup == "honcho":
# Honcho's own MCP package, stdio, against the local server; it needs any non-empty key when auth is off.
return {"mcpServers": {"honcho": {"command": str(Path.home() / ".bun/bin/bun"),
"args": ["--cwd", str(ROOT / "honcho-src/mcp"), "src/stdio.ts"],
"env": {"HONCHO_API_KEY": "local", "HONCHO_API_URL": "http://127.0.0.1:18000",
"HONCHO_WORKSPACE_ID": store}}}}
return {"mcpServers": {}}


def workspace(setup, conv):
place = BENCH / setup / conv
place.mkdir(parents=True, exist_ok=True)
if setup == "files" and not (place / "corpus").exists():
shutil.copytree(ROOT / "bench/hermes/alone" / conv / "workspace/corpus", place / "corpus")
return place


def ask(args, q, stores, raw):
conv = q["conversation"]
manifest = json.loads((FIXTURES / conv / "manifest.json").read_text())
store = stores.get(conv)
place = workspace(args.setup, conv)
config = raw / f"{q['id']}.mcp.json"
config.write_text(json.dumps(mcp_config(args.setup, store)) + "\n")
system = raw / "system.txt"
system.write_text("You answer questions about a chat from the records you are given. Use only your tools.\n")
prompt = PROMPT.format(a=manifest["speakers"]["a"], b=manifest["speakers"]["b"],
where=WHERE[args.setup].format(store=store), question=q["question"])
# An allowlist: Bash runs with bypassPermissions, so no API key of the parent may reach the agent.
env = {k: os.environ[k] for k in ("HOME", "PATH", "LANG", "TERM", "USER", "XDG_RUNTIME_DIR",
"CLAUDE_CONFIG_DIR") if k in os.environ}
env["DBUS_SESSION_BUS_ADDRESS"] = "disabled:"
if args.setup == "wirecat":
env["PATH"] = f"{ROOT / 'bench/hermes/wirecat' / conv / 'bin'}:{env['PATH']}"
if args.setup == "supermemory":
env["SUPERMEMORY_API_KEY"] = keyring_secret("supermemory")
if args.setup == "mem0":
env["MEM0_API_KEY"] = keyring_secret("mem0")
denied = [f"mcp__{args.setup}__{name}" for name in WRITES.get(args.setup, [])]
command = ["claude", "-p", prompt, "--model", args.model, "--tools", TOOLS[args.setup],
"--disable-slash-commands", "--strict-mcp-config", "--mcp-config", str(config),
"--system-prompt-file", str(system), "--output-format", "stream-json", "--verbose",
"--no-session-persistence", "--permission-mode", "bypassPermissions", "--setting-sources", "", *(["--disallowedTools", *denied] if denied else [])]
started = time.perf_counter()
done = subprocess.run(command, env=env, cwd=place, capture_output=True, text=True, timeout=args.timeout)
seconds = time.perf_counter() - started
(raw / f"{q['id']}.stream.jsonl").write_text(done.stdout)
(raw / f"{q['id']}.stderr.txt").write_text(done.stderr)
events = [json.loads(line) for line in done.stdout.splitlines() if line.startswith("{")]
init = next((e for e in events if e.get("type") == "system" and e.get("subtype") == "init"), {})
result = next((e for e in reversed(events) if e.get("type") == "result"), {})
calls = [{"name": block.get("name"), "input": json.dumps(block.get("input"))[:300]}
for e in events if e.get("type") == "assistant"
for block in e.get("message", {}).get("content", []) if block.get("type") == "tool_use"]
reply = parse(result.get("result", ""))
return {"id": q["id"], "conversation": conv, "category": q["category_name"], "question": q["question"],
"gold": q["answer"], "answer": (reply or {}).get("answer", ""), "sessions_cited": sessions_cited(reply),
"seconds": round(seconds, 1), "exit": done.returncode,
"init": {"tools": init.get("tools"), "mcp_servers": init.get("mcp_servers"), "model": init.get("model"),
"skills": init.get("skills"), "plugins": init.get("plugins")},
"usage": result.get("usage"), "cost_usd_list_price": result.get("total_cost_usd"),
"tool_calls": calls, "oracle_seen": any(m in done.stdout for m in ORACLE_MARKERS)}


def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--setup", choices=list(WHERE), required=True)
parser.add_argument("--questions", required=True)
parser.add_argument("--stores", help='JSON {"conv-26": "<tag or bank>"}')
parser.add_argument("--output", type=Path, required=True)
parser.add_argument("--model", default="sonnet")
parser.add_argument("--timeout", type=int, default=600)
args = parser.parse_args()
questions = {q["id"]: q for q in json.loads((ROOT / "questions.json").read_text())["questions"]}
stores = json.loads(args.stores) if args.stores else {}
args.output.mkdir(parents=True, exist_ok=False)
raw = args.output / "raw"
raw.mkdir()
rows = []
for qid in args.questions.split(","):
rows.append(ask(args, questions[qid], stores, raw))
row = rows[-1]
print(f"{qid} {row['seconds']}s exit={row['exit']} answer={row['answer']!r} "
f"tools={[c['name'] for c in row['tool_calls']]}", flush=True)
(args.output / "answers.json").write_text(json.dumps(rows, ensure_ascii=False, indent=2) + "\n")
meta = {"agent": "claude-code", "version": subprocess.run(["claude", "--version"], capture_output=True,
text=True).stdout.strip(),
"setup": args.setup, "model": args.model, "stores": stores,
"date": datetime.now(UTC).isoformat(timespec="seconds")}
(args.output / "run.json").write_text(json.dumps(meta, indent=2) + "\n")


if __name__ == "__main__":
main()
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/usr/bin/env python3
"""Control arm: a DeepSeek model with no memory and no tools, one plain API call per question, the same prompt as
the agents with the 'answer only if you already know' line of the Claude Code control."""

import argparse
import json
import os
import time
import urllib.request
from datetime import UTC, datetime
from pathlib import Path

from claude_locomo import WHERE
from hermes_locomo import FIXTURES, PROMPT, ROOT, sessions_cited
from hermes_runner import parse

# usage_pricing.py in Hermes 0.23.3, DeepSeek's pricing page snapshot of 2026-09-10 (off-peak, USD per 1M tokens).
PRICES = {"deepseek-flash": (0.15, 0.60, 0.003), "deepseek-v4-pro": (0.66, 1.98, 0.022)}


def ask(model, prompt):
body = {"model": model, "messages": [{"role": "user", "content": prompt}]}
req = urllib.request.Request("https://api.deepseek.com/chat/completions", data=json.dumps(body).encode(),
headers={"Authorization": "Bearer " + os.environ["DEEPSEEK_API_KEY"],
"Content-Type": "application/json"})
with urllib.request.urlopen(req, timeout=300) as reply:
return json.load(reply)


def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--questions", required=True)
parser.add_argument("--output", type=Path, required=True)
parser.add_argument("--model", default="deepseek-flash")
args = parser.parse_args()
questions = {q["id"]: q for q in json.loads((ROOT / "questions.json").read_text())["questions"]}
args.output.mkdir(parents=True, exist_ok=False)
rows = []
for qid in args.questions.split(","):
q = questions[qid]
manifest = json.loads((FIXTURES / q["conversation"] / "manifest.json").read_text())
prompt = PROMPT.format(a=manifest["speakers"]["a"], b=manifest["speakers"]["b"], where=WHERE["none"],
question=q["question"])
started = time.perf_counter()
data = ask(args.model, prompt)
usage = data.get("usage", {})
cached = usage.get("prompt_cache_hit_tokens", 0)
price_in, price_out, price_cache = PRICES[args.model]
cost = ((usage.get("prompt_tokens", 0) - cached) * price_in + cached * price_cache
+ usage.get("completion_tokens", 0) * price_out) / 1e6
reply = parse(data["choices"][0]["message"].get("content") or "")
rows.append({"id": qid, "conversation": q["conversation"], "category": q["category_name"],
"question": q["question"], "gold": q["answer"], "answer": (reply or {}).get("answer", ""),
"sessions_cited": sessions_cited(reply), "seconds": round(time.perf_counter() - started, 1),
"usage": {**usage, "estimated_cost_usd": cost}, "tool_calls": []})
(args.output / "answers.json").write_text(json.dumps(rows, ensure_ascii=False, indent=2) + "\n")
(args.output / "run.json").write_text(json.dumps({"agent": "deepseek-api", "setup": "none", "model": args.model,
"date": datetime.now(UTC).isoformat(timespec="seconds")})
+ "\n")


if __name__ == "__main__":
main()
Loading