Skip to content

Commit 8271943

Browse files
phernandezclaude
andcommitted
feat(core): add xAFS dataset adapter to the benchmarks package
supermemory's xAFS (CC-BY-4.0, 13 personas / 110 questions) runs under the agent-task harness with tokens-per-correct-answer as the headline. Path-based loader with fail-fast schema validation (vendor-controlled upstream), persona-subset selection, corpus conversion with anti-leakage guarantees (probe/gold files never enter the ingested tree; symlinks rejected; stale files pruned on reconversion), non-markdown skip accounting, a corrections workflow fingerprinted into the run manifest, and audit-sampling tooling for the pre-publication question-quality review. Documented as a secondary dataset pending that audit — never the headline. Tests fully offline against a miniature hand-written fixture. Closes #1402 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014pmKq6bqCi6Zp6BTHuZjrp Signed-off-by: phernandez <paul@basicmachines.co>
1 parent e4cc1fa commit 8271943

24 files changed

Lines changed: 3121 additions & 46 deletions

‎benchmarks/.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ benchmarks/datasets/longmemeval/longmemeval_s.json
2020
benchmarks/datasets/longmemeval/longmemeval_s.provenance.json
2121
benchmarks/datasets/locomo-audit/
2222
benchmarks/datasets/beam/upstream/
23+
benchmarks/datasets/xafs/upstream/
2324
benchmarks/.mem0-qdrant/
2425
benchmarks/datasets/convomem/
2526
benchmarks/.bm-homes/
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# xAFS Dataset
2+
3+
xAFS ("Agentic File System") probes agentic retrieval over persona file trees:
4+
13 synthetic personas whose corpora scale from 5 to ~10K files, with questions
5+
answered by reading the files (single-hop, multi-hop, and format-spanning
6+
across non-markdown formats). Headline metric: tokens spent per correct
7+
answer, judged semantically.
8+
9+
- Upstream: https://huggingface.co/datasets/supermemory/xAFS
10+
- License: **CC-BY-4.0** — attribution required.
11+
- **Vendor caveat:** xAFS is authored by supermemory, a memory-product vendor.
12+
This package reports it as a SECONDARY dataset, never the headline, pending
13+
a question-quality audit (see `bm-bench sample xafs` and
14+
docs/benchmarks.md 6d).
15+
- The data is never vendored into this repo; fetch it locally (below).
16+
17+
## Fetch
18+
19+
The dataset is ~19K files / ~837MB in total, so fetch only the personas you
20+
need. The download is pinned to revision `21142b2c` for reproducibility.
21+
22+
```bash
23+
# Two-persona subset (the cheap default the just targets use):
24+
XAFS_PERSONAS=dp_001,dp_002 bash benchmarks/datasets/xafs/download.sh
25+
# or via just:
26+
just bench-fetch-xafs
27+
28+
# Everything (837MB):
29+
bash benchmarks/datasets/xafs/download.sh
30+
```
31+
32+
This downloads into `benchmarks/datasets/xafs/upstream/` (gitignored) using
33+
the `hf` CLI (`pip install -U huggingface_hub`).
34+
35+
## Layout
36+
37+
Each persona directory `dp_001`..`dp_013` contains:
38+
39+
- `data/` — the persona's file tree (mostly `.md`, including double-suffix
40+
format files like `metrics.csv.md`, plus a handful of real non-markdown
41+
`.eml` mails)
42+
- `question.json` — the persona's questions: `id`, `family`
43+
(`single_hop` | `multi_hop` | `format_spanning`), `prompt`,
44+
`gold_file_ids` (verbatim `data/...` relpaths), `gold_answer`
45+
46+
Only `data/` subtrees are ever ingested; `question.json` (and any
47+
scenario/answer-key files) never reach a corpus.
48+
49+
**Count note:** the upstream README advertises 110 questions (35/50/25 per
50+
family) but the shipped `question.json` files at the pinned revision sum to
51+
33/51/26. The loader trusts the JSON.
52+
53+
## Convert and run
54+
55+
```bash
56+
just bench-convert-xafs # dp_001,dp_002 -> benchmarks/generated/xafs
57+
BM_LOCAL_PATH=.. just bench-run-xafs-agent # agent-task run over the manifest
58+
# or directly:
59+
uv run bm-bench convert xafs --personas dp_001,dp_002
60+
uv run bm-bench run agent-tasks \
61+
--task-manifest benchmarks/generated/xafs/tasks.json \
62+
--surfaces rich,posix \
63+
--model openai-compat:<model>@<base_url> \
64+
--judge claude:claude-sonnet-4-6 \
65+
--bm-local-path <bm-checkout>
66+
```
67+
68+
`conversion.json` in the output dir records the pinned revision, selected
69+
personas, per-persona aggregate sha256 over `(relpath, sha256)` pairs, the
70+
`question.json` checksums, and per-extension file counts.
71+
72+
## Audit sampling
73+
74+
```bash
75+
just bench-xafs-audit-sample # 20 questions, seed 42, stratified by family
76+
```
77+
78+
writes `benchmarks/generated/xafs-audit/` with the sampled prompts, gold
79+
answers, and verbatim copies of every gold source file for human review.
80+
Audit verdicts land in `benchmarks/datasets/xafs/corrections.json` (keyed
81+
`"<persona>/<qid>"`) and feed `bm-bench convert xafs --corrections ...`.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# xAFS benchmark data (CC-BY-4.0) is never vendored into this repo.
5+
# Fetched from Hugging Face at a pinned revision so runs are reproducible.
6+
# Requires the `hf` CLI: pip install -U huggingface_hub (or: uv tool install huggingface_hub)
7+
#
8+
# XAFS_PERSONAS: optional comma-separated persona subset, e.g. "dp_001,dp_002".
9+
# Unset/empty fetches every persona (~19K files / ~837MB) — subset unless you
10+
# really need the full dataset.
11+
12+
dest="benchmarks/datasets/xafs/upstream"
13+
revision="21142b2c01113cb881c80d6c99bcf0f412ed17f2"
14+
15+
include_args=()
16+
if [ -n "${XAFS_PERSONAS:-}" ]; then
17+
IFS=',' read -ra personas <<<"$XAFS_PERSONAS"
18+
for persona in "${personas[@]}"; do
19+
include_args+=(--include "${persona// /}/*")
20+
done
21+
fi
22+
23+
# ${arr[@]+...} guards the empty-array expansion under `set -u` on bash 3.2 (macOS).
24+
hf download supermemory/xAFS \
25+
--repo-type dataset \
26+
--revision "$revision" \
27+
--local-dir "$dest" \
28+
${include_args[@]+"${include_args[@]}"}
29+
30+
echo "xAFS data available under $dest"
31+
echo "Fetch more personas with: XAFS_PERSONAS=dp_003,dp_004 bash benchmarks/datasets/xafs/download.sh"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"dataset_id": "xafs",
3+
"source_url": "https://huggingface.co/datasets/supermemory/xAFS",
4+
"citation": "xAFS (supermemory, 2026), revision 21142b2c01113cb881c80d6c99bcf0f412ed17f2",
5+
"license_note": "CC-BY-4.0; vendor-authored (supermemory) — secondary dataset pending question-quality audit"
6+
}

‎benchmarks/docs/benchmarks.md‎

Lines changed: 143 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ It covers:
1717
| `just` retrieval and QA workflows (`bench-full`, `bench-qa`) | Implemented |
1818
| Artifact generation and publish/compare commands | Implemented |
1919
| Manual BM revision comparison via worktrees + `--bm-local-path` | Implemented workflow, manual orchestration |
20+
| xAFS agent-path eval (`convert xafs`, `run agent-tasks --task-manifest`) | Implemented (secondary dataset; see 6d) |
21+
| xAFS retrieval diagnostic (`queries.json` for single/multi-hop) | Planned — blocked on the provider doc-id seam (see 6d) |
2022
| `bm-bench run revision-matrix` | Planned, not implemented yet |
2123

2224
## 1) Purpose and Scope
@@ -83,11 +85,18 @@ just bench-prepare-long
8385
- `bench-prepare-short`
8486
- `bench-prepare-long`
8587
- `bench-prepare-beam`
88+
- `bench-fetch-xafs`
89+
- `bench-convert-xafs`
90+
- `bench-prepare-xafs`
91+
- `bench-run-xafs-agent`
92+
- `bench-xafs-audit-sample`
8693
- `bench-run-short`
8794
- `bench-run-long`
8895
- `bench-run-full`
8996
- `bench-run-beam-100k`
9097
- `bench-beam-score`
98+
- `bench-agent-smoke`
99+
- `bench-agent-tasks`
91100
- `bench-validate`
92101
- `bench-publish`
93102
- `bench-compare`
@@ -100,13 +109,16 @@ Top-level commands:
100109
- `datasets fetch`
101110
- `convert locomo`
102111
- `convert beam`
112+
- `convert xafs`
103113
- `run retrieval`
104114
- `run concurrent-write`
115+
- `run agent-tasks`
105116
- `run full`
106117
- `run qa`
107118
- `run beam-score`
108119
- `run rejudge`
109120
- `run review`
121+
- `sample xafs`
110122
- `compare`
111123
- `validate-artifacts`
112124
- `publish`
@@ -424,14 +436,144 @@ quality.
424436
### Artifacts
425437

426438
`benchmarks/runs/<run-id>/`: `manifest.json` (BM SHA/version, model + judge
427-
specs, budget, corpus checksum + file count, full surface echoes),
439+
specs, budget, corpus checksum + file count, the `tasks.json` checksum for
440+
dataset-driven runs — a corrections re-run changes gold answers without
441+
touching the corpus — full surface echoes),
428442
`surface-status.json` (ok/skipped/error per surface, explicit reasons),
429443
`per-turn.jsonl` (per model turn and tool dispatch: tokens, tool name,
430444
latency, result size), `per-task-agent.jsonl`, `agent-tasks-summary.json`,
431445
`summary.md` (which repeats any skipped surface so the report cannot be
432446
misread as a completed A/B). `validate-artifacts` remains retrieval-only for now (as for
433447
concurrent-write); a kind-aware variant is a follow-up.
434448

449+
## 6d) xAFS (supermemory, HF `supermemory/xAFS` @ 21142b2c)
450+
451+
**Provenance caveat first: xAFS is authored by supermemory, a memory-product
452+
vendor. Numbers from it are reported as a SECONDARY dataset, never the
453+
headline, pending a ~20-question quality audit (tooling:
454+
`bm-bench sample xafs`; verdicts feed the corrections hook below).**
455+
456+
xAFS ("Agentic File System") probes agentic retrieval over persona file
457+
trees: 13 synthetic personas whose corpora scale from 5 to ~10K files (~19K
458+
files / ~837MB total), questioned in three families — single-hop, multi-hop,
459+
and format-spanning (questions whose sources include non-markdown files, e.g.
460+
`.eml` mails). The headline is tokens spent per correct answer, judged
461+
semantically — exactly the agent-task harness's framing (6c), which is where
462+
xAFS runs.
463+
464+
Count note: the upstream README advertises 110 questions (35/50/25 per
465+
family); the shipped `question.json` files at the pinned revision sum to
466+
33/51/26. The loader trusts the JSON and asserts nothing about totals.
467+
468+
### Fetch (never vendored)
469+
470+
```bash
471+
XAFS_PERSONAS=dp_001,dp_002 bash benchmarks/datasets/xafs/download.sh
472+
# just bench-fetch-xafs — same subset default; personas="" fetches all 837MB
473+
```
474+
475+
The download is a pinned `hf download supermemory/xAFS --repo-type dataset
476+
--revision 21142b2c...` into `benchmarks/datasets/xafs/upstream/`
477+
(gitignored). Persona subsetting via `--include 'dp_NNN/*'` patterns is the
478+
normal mode — full ingestion is ~837MB, and the loader accepts partial
479+
snapshots (unknown *requested* personas fail fast listing what is on disk).
480+
481+
### Workflow
482+
483+
```bash
484+
just bench-fetch-xafs # pinned snapshot (subset default)
485+
just bench-convert-xafs # -> benchmarks/generated/xafs/{groups,tasks.json,conversion.json}
486+
BM_LOCAL_PATH=.. just bench-run-xafs-agent # agent-task run over the manifest
487+
just bench-xafs-audit-sample # seeded human-review sample
488+
```
489+
490+
Conversion copies each persona's `data/` tree byte-for-byte (relpaths
491+
preserved, no frontmatter render — questions cite exact file content) into
492+
`groups/xafs-dpNNN/docs/`. BM's sync ingests `.md` files as notes and
493+
non-markdown files as file resources reachable via `read_content` (rich) or
494+
`cat`/`grep` (posix) — nothing is skipped, and `conversion.json` records
495+
per-extension counts plus a `skipped` list that must stay empty (a file the
496+
copy policy cannot place aborts the conversion). Gold answers and prompts
497+
exist only in `tasks.json`; an answer-key/scenario filename appearing inside
498+
`data/` aborts conversion (anti-leakage).
499+
500+
### Execution split per question family
501+
502+
| Family | Path | Rationale |
503+
| --- | --- | --- |
504+
| format_spanning (26) | Agent harness only | Verbatim file reading (`read_content` / `cat`+`grep`) is the point; the retrieval path only searches notes |
505+
| single_hop (33), multi_hop (51) | Agent harness (headline) | Tokens-per-correct-answer is literally the harness headline; a retrieval+QA diagnostic is deferred (below) |
506+
507+
The retrieval diagnostic for single/multi-hop is deliberately NOT emitted in
508+
v1: the `bm-local` provider normalizes result doc ids to the basename sans
509+
`.md`, which is unique for rendered corpora but collides across xAFS's
510+
persona-shaped trees (repeated `notes.md`-style basenames), so recall against
511+
`gold_file_ids` would be silently wrong. It is planned behind widening the
512+
provider doc-id seam to full relpaths; at that point a converter
513+
`--emit-queries` flag plus a dataset-keyed breakout in `scoring/retrieval.py`
514+
(the BEAM precedent) keeps xAFS's `single_hop`/`multi_hop` labels out of the
515+
LoCoMo `official_headline` container despite the name collision.
516+
517+
Manifest runs are grouped and read-only: each persona is ingested ONCE per
518+
(surface, group) as project `at-<run-id>-xafs-dpNNN` and every question in
519+
the group reuses that warm project (copying 837MB per question is untenable).
520+
To keep reuse safe AND fair, the shared write verbs (`write_note`,
521+
`edit_note`, `move_note`, `delete_note`) are dropped from BOTH surfaces
522+
symmetrically — rich becomes `search_notes, read_note, read_content,
523+
list_directory, recent_activity, build_context`; posix becomes `cat, grep,
524+
ls, find, tail, man` — matching upstream's read-only reference agent
525+
(grep/find/cat). The reduced allowlists are echoed into `manifest.json` via
526+
`SurfaceEcho`. State-free tasks (all xAFS tasks: judge-graded answers) skip
527+
the per-task baseline snapshot and post-loop settle. The per-group table in
528+
`summary.md` (tokens/correct per persona) is the corpus-scaling curve —
529+
xAFS's central claim — read alongside per-family (skill) accuracy.
530+
531+
### Scoring definition
532+
533+
- Headline: `(total agent tokens over ALL attempted tasks) / (judge-CORRECT
534+
tasks)` per surface — the 6c headline, unchanged. Accuracy, tool calls,
535+
turns, and wall time always appear in the same table.
536+
- The judge is the package judge seam (`JudgeRubric` →
537+
`AGENT_JUDGE_PROMPT_TEMPLATE`, one CORRECT/INCORRECT line); judge tokens
538+
are accounted separately and never enter the headline.
539+
- Errored tasks are excluded from means and never zero-scored (6c rules
540+
inherited unchanged).
541+
542+
### Runner provenance (divergences from supermemory's published setup)
543+
544+
1. Judge model is operator-chosen (`--judge`; the just target defaults to
545+
`claude:claude-sonnet-4-6`), not Gemini 3.1 Pro Preview — the dataset card
546+
itself allows an equivalently-capable judge; `judge_spec` is pinned in
547+
`manifest.json`.
548+
2. Upstream ships no judge prompt; ours is the fixed package template with a
549+
rubric built deterministically from the upstream prompt + gold answer,
550+
mirroring the card's semantic-equivalence criteria (paraphrase/format
551+
tolerant; exact values, named entities, and multi-part coverage required).
552+
3. We judge the agent's full final message (including its fenced-JSON close),
553+
not an extracted answer string.
554+
4. The harness adds the fixed `TASK_PROMPT_TEMPLATE` preamble and fenced-JSON
555+
finalization (upstream is bring-your-own-runner).
556+
5. Correct-answer denominator = judge-CORRECT tasks; token numerator = agent
557+
loop in+out over ALL attempted tasks; judge tokens excluded (upstream
558+
unspecified); errored tasks excluded from means, never zero-scored.
559+
6. Family counts follow the shipped JSON (33/51/26), not the README
560+
(35/50/25).
561+
7. Secondary-dataset caveat: vendor-authored; reported as secondary, never
562+
the headline, pending the question-quality audit.
563+
564+
### Audit sampling and corrections
565+
566+
`bm-bench sample xafs --n 20 --seed 42` writes a seeded, family-stratified
567+
sample to `benchmarks/generated/xafs-audit/`: `audit-sample.json`,
568+
human-readable `sample.md`, and verbatim copies of every gold source file
569+
under `sources/<persona>-<qid>/`. The post-merge audit's verdicts land in
570+
`benchmarks/datasets/xafs/corrections.json` — records keyed
571+
`"<persona>/<qid>"` carrying the upstream `prompt` (cross-checked; drift
572+
fails the conversion loudly) plus either a corrected `gold_answer` or
573+
`"excluded": true` with a `reason`. `convert xafs --corrections` applies
574+
them; exclusions are dropped from `tasks.json` and counted in
575+
`conversion.json`.
576+
435577
## 7) Commit-to-Commit Comparison (Current Manual Method)
436578

437579
Use this workflow today to compare BM revisions while keeping benchmark tooling fixed.

‎benchmarks/justfile‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ longmemeval_dev_output_dir := "benchmarks/generated/longmemeval-s-dev"
1515
beam_root := "benchmarks/datasets/beam/upstream/chats"
1616
beam_100k_output_dir := "benchmarks/generated/beam-100k"
1717
beam_500k_output_dir := "benchmarks/generated/beam-500k"
18+
xafs_root := "benchmarks/datasets/xafs/upstream"
19+
xafs_output_dir := "benchmarks/generated/xafs"
1820

1921
# --- Repo maintenance ---
2022

@@ -106,6 +108,38 @@ bench-fetch-locomo-audit:
106108
bench-convert-locomo-corrected: bench-fetch-locomo bench-fetch-locomo-audit
107109
uv run bm-bench convert locomo --dataset-path {{locomo_dataset_path}} --output-dir benchmarks/generated/locomo-corrected --audit-corrections benchmarks/datasets/locomo-audit/corrections.json
108110

111+
# xAFS data is never vendored: pinned hf download, persona-subset by default
112+
# (the full dataset is ~837MB). personas="" fetches everything.
113+
bench-fetch-xafs personas="dp_001,dp_002":
114+
XAFS_PERSONAS="{{personas}}" bash benchmarks/datasets/xafs/download.sh
115+
116+
# Cheap two-persona smoke by default; personas="all" converts every downloaded persona
117+
bench-convert-xafs personas="dp_001,dp_002":
118+
uv run bm-bench convert xafs --dataset-root {{xafs_root}} --output-dir {{xafs_output_dir}} --personas "{{personas}}"
119+
120+
bench-prepare-xafs: bench-fetch-xafs bench-convert-xafs
121+
122+
# xAFS agent-task run: grouped per-persona corpora, read-only surfaces,
123+
# tokens-per-correct-answer headline judged semantically (docs/benchmarks.md 6d)
124+
bench-run-xafs-agent surfaces="rich,posix" model="openai-compat:qwen3@http://localhost:11434/v1" judge="claude:claude-sonnet-4-6":
125+
#!/usr/bin/env bash
126+
set -euo pipefail
127+
if [[ -z "{{bm_local_path}}" ]]; then
128+
echo "BM_LOCAL_PATH must point to the Basic Memory git checkout under test" >&2
129+
exit 2
130+
fi
131+
uv run bm-bench run agent-tasks \
132+
--task-manifest {{xafs_output_dir}}/tasks.json \
133+
--corpus-dir {{xafs_output_dir}}/groups \
134+
--surfaces "{{surfaces}}" \
135+
--model "{{model}}" \
136+
--judge "{{judge}}" \
137+
--bm-local-path "{{bm_local_path}}"
138+
139+
# Seeded question sample (+ gold answers + gold source files) for human audit
140+
bench-xafs-audit-sample n="20" seed="42":
141+
uv run bm-bench sample xafs --dataset-root {{xafs_root}} --n {{n}} --seed {{seed}} --output benchmarks/generated/xafs-audit
142+
109143
# Grouped retrieval over the LongMemEval-S dev slice (bm-local only)
110144
bench-run-longmemeval-dev:
111145
uv run bm-bench run retrieval \

0 commit comments

Comments
 (0)