MoobFS

Experimental · build from main · not for production

Agent memory
as plain files.

An LLM agent that remembers across sessions usually keeps its memories as files and, beside them, a database that records what each one is. The application has to keep the two in step on every write. And who may see which memory is decided in application code, not by the operating system that already holds the files' permissions.

MoobFS is an experimental Linux kernel module that stacks over ext4, btrfs or XFS and moves those two jobs into the filesystem: the fields live on the files, the kernel indexes them, and a query answers only what the caller's file permissions allow.

# (prepared on the lower ext4: alice/ uid 1001 0700, bob/ uid 1002 0700, team/ 0755)
# mount -t moobfs_layer -o lower=/lower none /mnt/layer
# moobfs-attr set /mnt/layer/alice/cache.md kind string decision
# moobfs-attr set /mnt/layer/bob/deploy.md kind string decision
# moobfs-attr set /mnt/layer/team/style.md kind string decision
# moobfs-attr set /mnt/layer/team/salary.md kind string decision
# query --uid 1001 /mnt/layer/alice q2 kind eq string decision
16	cache.md
# query --uid 1001 /mnt/layer/bob q2 kind eq string decision
open: Permission denied
# query --uid 1001 /mnt/layer kind eq string decision
MOOB_IOC_QUERY: Operation not permitted
# query /mnt/layer kind eq string decision
16	alice/cache.md
17	bob/deploy.md
18	team/style.md
19	team/salary.md
Real output from the project's VM test. Lines starting with # are commands run as root; --uid 1001 runs the query as Alice. She sees her own memory, cannot enter Bob's directory, and cannot run the mount-wide query. Full transcript, with a shared directory ↗

Four numbers, one of them a loss and one a cost.

Pilot-grade, from one host: a dedicated machine with a SATA SSD, kernel 6.12.111, ext4 below the layer, one data-set seed, one run per scale. The first three compare the layer's query with the SQLite database of one real memory client, on that client's own six structured queries.

0differences in the answersEvery check against the client's SQLite, from 150 to 60 000 memories.Journal 0068 ↗
5–6.5×faster on one query shapeA set of kinds, warm, median, 2 000 to 60 000 memories. Part of the gap is this client's schema, which keeps the field in a JSON column.Journal 0068 ↗
0.71–0.51×the speed on a long ordered traversalThe layer loses at every scale, by more as the answer grows: about half of SQLite's speed at 60 000 memories.Journal 0068 ↗
2.7 sfor the first query on a domain, cold cacheIt scans that domain's files: 7 459 out of 60 000; 0.1 s warm. The mount itself takes 0.3 s; before journal 0098 it scanned every file, 19 s cold. The client's SQLite file opened cold in 17 to 23 ms.Journal 0098 ↗

Of the other four shapes, the layer is faster on two and ties on two. The comparison counts only the paths returned, not reading the fields of each result. What was measured, with the losses ↓

Three parts.

Typed attributes on ordinary files

A memory is a file. Its fields are user.moob.* extended attributes, each with a type the kernel checks on write. Without the module, the directory is still a plain tree that grep, getfattr, git and rsync read.

An index in the kernel

The module indexes those attributes in RAM and updates the index when an attribute is written. There is no daemon. Nothing is scanned at mount: the first query on a directory builds its part of the index.

A query scoped by directory, authorized by file permissions

One ioctl on a directory answers up to four comparisons joined by AND, optionally ordered by one attribute. It returns only files that everyone allowed into that directory may read.

How to help.

The project has one maintainer and no independent human review of the kernel code yet.

What help is wanted ↗

The list is short and sorted by how much kernel knowledge each item takes:

  • If you know Linux filesystems or the VFS: review the credential model or the locking of the index.
  • If you build memory for agents: check whether your system fits one file per memory, fields as attributes and scopes as directories.
  • If you want to test: reproduce the stage-2 test evidence on your own KVM host (open call #195 ↗), run the suite in a VM, try another kernel, or repeat a measurement on your hardware.
  • If you do not touch kernels: review the documentation or reproduce the tool commands and report concrete gaps.

Rules for changes are in the contribution guide ↗. A defect that crashes the kernel or that one user could use against another goes privately through SECURITY.md ↗.

How it works.

Writing a memory is an ordinary file write plus setxattr. Finding memories is one call on a directory.

Attributes are real user.moob.* xattrs on the lower filesystem, one type byte plus a payload (string, int64, double, bool, time, raw). The layer refuses invalid encodings on write and keeps an index in RAM, partitioned by permission domain: by default, each top-level directory of the mount. QUERY2 on a domain directory takes up to four predicates joined by AND and answers from that domain's partition after one permission check on the directory. The older mount-wide QUERY checks each result and is for administrators. GET_INFO reports the index state and the lower filesystem's capabilities.

Storage and context have distinct roles

The filesystem stores, validates and queries. The agent application selects what is relevant and assembles the context sent to the LLM. There is no semantic or vector search in the kernel and no daemon. MoobFS does not assemble prompts or extend a model's context window; memory frameworks are potential clients, not competitors.

Nothing is trapped: unmount the layer and the lower directory is a plain tree that grep, getfattr, git and rsync read without the module.

Architecture overview ↗ · What a memory system needs to use it ↗

The MoobFS layer between clients and a mature lower filesystemClients write files and typed user.moob.* attributes or issue a QUERY2 ioctl on a domain directory. The Linux VFS passes the operations to the moobfs layer, which validates attributes, keeps an in-memory index partitioned by domain, checks the caller's permission on the directory and delegates I/O to the lower filesystem: ext4, btrfs or XFS on disk.Client writes a memoryfile + user.moob.* xattrsClient asks QUERY2kind = decision AND score ≥ 40Linux VFSMOOBFS LAYER · moobfs_layer.koValidate, index, authorize, delegatetyped attributes checked on write · in-RAM index built per domain on first querya query answers only what the caller's file permissions allowLower filesystem: ext4, btrfs or XFSreal files, real xattrs, journal, reflink · readable without the layerOne kernel series tested, in a VM. Measurements are pilot-grade.
What exists today, tested over ext4, btrfs and XFS in a QEMU VM.

What was measured.

The report ↗ that answers the four questions of the benchmark plan is a pilot-grade report.

The early SQLite and client campaigns are pilot-grade: one data-set seed, three repetitions at most, often one run, and run-to-run noise of about 20 to 25 % on values of tens of microseconds. These are historical results for the modules in the linked journals. Numbers from different hosts are not compared with each other.

What the layer added per operation in the M4 report's campaign (10 000 memories, medians, bare lower against the layer): a read by path goes from 8.5 to 11.0 µs on ext4; setting one attribute from 8.9 to 21.7 µs; creating a memory durably is unchanged within noise, because the device flushes take 12 to 14 ms.

What a side database costs at write time, which this project had assumed and never measured: almost nothing. Publishing a memory durably takes 6.6 to 8.5 ms with the file alone and 6.6 to 8.7 ms with a row added to a SQLite database in its usual mode; through the layer, with eight attributes, 7.0 to 9.8 ms. The layer does not make writes cheaper. What it removes is the second copy of the fields, which can disagree with the files after a crash.

Where the layer wins

  • Selective queries inside one directory. On a synthetic set of 60 000 memories, 1.1 to 6 times faster than SQLite with composite indexes on the five shapes measured; the low end is a tie at SQLite's best case.
  • Three of a real client's six query shapes are faster, by 5 to 6.5 times and 1.6 to 3.8 times on the two clearest, with equal answers in every check.
  • That client runs unchanged on the layer. Its 1 147 tests pass and its retrieval results are identical, after a layer defect it exposed was fixed.

Where it loses, ties or costs

  • Long ordered traversal. 0.71 to 0.51 of SQLite's speed, worse as the answer grows. Two other shapes of the same client are ties.
  • The first interface (the mount-wide QUERY) is slower than SQLite on every shape that returns results: 18 times slower at 60 000 memories in one campaign.
  • Fields of the results. A query returns paths. Reading all attributes of a result costs about 16 µs per file, against about 0.9 µs per result for the query; SQL returns columns in the same call, and no comparison here counts this.
  • Mount time. 0.7 s warm and 18.5 to 19.3 s cold for 60 000 files on a SATA SSD; 126 s cold on a cloud disk.
  • Memory. About 0.5 to 0.6 KiB of kernel memory per file that cannot be paged out, by the index's own accounting, which undercounts.
  • The real client's writes were about 10 % slower in one run, and a page it writes is queryable about 11 ms later: a separate process copies its fields into attributes. The client itself never called the query; a test tool did.
  • Reflink and dedupe work through the layer, but the saving is the lower filesystem's and is small for small files: 6.7 % on btrfs and 13.6 % on XFS where 15 % of the files are copies, none on ext4.

A later 40-repetition module comparison, with held CPU frequency and confidence intervals, found and fixed a roughly 2x query regression. That confirmation measured p50 1 to 3 % above module 0102 on filtered queries; the on-demand design costs 7.6 to 12.5 % against the earlier module built at mount. Some p99 results differ more: the two-equality query has a 54 % increase in the median of per-run p99 (+51 to +55 % interval). This does not repeat the SQLite or client comparisons. Confirmation and limits ↗

Update, 2026-11-19: an outside contributor's run on a second machine (issue #68) showed later merges had made steady-state queries 50 to 69 % slower than module 0.3.0. With the two causes fixed, main is 14 to 25 % faster than 0.3.0 in p50 on the filtered shapes; the two-equality p99 stays 38 % above it. Journal 0313 ↗

Still missing: CPU and memory per query, throughput under concurrency, a second client's latency, and repeated SQLite/client comparisons with confidence intervals. Raw results and scripts ↗

Try it in a VM.

One command builds the tools and the modules and boots a disposable QEMU VM with the pinned Linux kernel. Docker supplies the toolchain; the host kernel stays outside the experiment. Never load the modules on a machine you care about. To mount it on a dedicated test host instead, follow the installation guide.

Native test instructions →
git clone https://github.com/studiomoob/llmoobfs.git
cd llmoobfs
make vm-test

# only the demonstration at the top of this page
MOOB_ONLY=demo make vm-test
grep '^DEMO| ' build/vm/console.log

Requires Docker. Runs Debian kernel 6.12.111+deb13-amd64. A passing full run ends with MOOBFS_VM_PASS, LAYER_LOWER_PASS for ext4, btrfs and xfs, MOOBFS_ACCEPTANCE_PASS and MOOBFS_LAYER_PASS; a MOOB_ONLY run ends with MOOBFS_ONLY_PASS, which is not a complete run. Logs and environment details are written to build/vm/.

View CI runs ↗

Limitations.

For anything beyond a disposable VM today, SQLite or plain files remain the recommendation.

The review corrections are on main. They synchronize backing-file flags after F_SETFL and propagate operational getxattr errors. v0.4.1-experimental contains both original defects; v0.5.0-experimental has the corrections. The integrated run at 49098aa passed clearing and setting append on ext4, btrfs and XFS, the injected-error regression, and acceptance/layer suites. The local Linux 6.12.112 sanitizer run reported MOOBFS_KASAN_PASS, and the required pull-request checks passed before that batch merged. Negative rounds detected both defects. Injected results do not reproduce a real lower-filesystem I/O fault. R1 validation ↗ · R2 validation ↗

3lower filesystems validated
3kernel series tested
3kernel defects found by an external reviewer's AI-assisted reports, all fixed

Comparison and when not to use MoobFS ↗ · Adoption risks ↗

Facts verified in the repository as of 2026-11-12:

  • Tested on three kernel series in a VM (Debian 6.12.111, 6.12.113, 6.12.115, 7.3.3 and 7.3.4 and Ubuntu 7.0.0-43-generic in QEMU; upstream 6.12.116, 7.0.14, 7.3.3 and 7.3.4 under KASAN/UBSAN/lockdep; the M1 module on 6.12 only), x86-64, over ext4, btrfs and XFS only; under KASAN, UBSAN and lockdep on every pull request that touches the module, with fault injection, fstests' quick group (and one run of its auto group) and syzkaller. Exploratory and not supported: big-endian s390x on IBM LinuxONE Community Cloud, where the full suite passed under KVM.
  • The attribute index lives only in RAM, cannot be paged out, is bounded by a budget (128 MiB by default) and is built per domain by the first query on it; built domains are released under memory pressure or to stay within the budget. An unprivileged build is also bounded by index_build_work (default 32,768 units; a mounter may choose 1,024–65,536), a cooperative deadline of ten seconds of the builder's CPU time with a 120 s elapsed backstop, and rebuild-frequency limits; waiting for a slow lower does not count against the ten seconds (ADR-0031, proposed). The default denies the measured 17,000-file domain (ADR-0020).
  • Mounting requires CAP_SYS_ADMIN in the initial user namespace; user-namespace and idmapped mounts are refused, and so is an idmapped mount as lower=.
  • The interface (UAPI v1 and v2) may change, with no compatibility promise. The tags are source snapshots, without binaries, packaging or support.
  • Measurements are pilot-grade and are not a general speed claim.
  • No independent human review of the kernel code. Two source reviews by AI assistants, AI-assisted private reports from an external reviewer and the project's own tests found and fixed kernel-side defects, security ones among them (findings F1 to F17 of ADR-0011 and GHSA-756j-cgwq-gvwm); syzkaller ran for seven six-hour rounds; fstests' quick group passes with an exclusion list and its auto group ran once, with no layer defect among its failures. Tags up to v0.4.1-experimental carry defects fixed later; v0.6.0-experimental has every fix up to 2026-11-15, later ones land on main.
  • Reflink, deduplication and durability come from the lower filesystem, not from MoobFS.

What the tests do show, within those limits: kernel answers are compared with a user-space oracle; two users on the same mount do not see each other's memories; git and WAL-mode SQLite run unchanged on the mount; power-loss replay keeps every synced memory.

Full list in the README ↗

Documentation.

Code explains what changed. Decisions and experiments explain why.

Done with evidence.
Planned without dates.

  1. DONE · M1

    Native shared reads

    Read-only image, two inodes sharing one payload, 15 malformed images rejected; frozen, runs as a regression.

  2. DONE · M2 2a–2e

    Stacked layer, typed attributes, index, QUERY

    Pass-through over ext4, btrfs and XFS with fsx; typed user.moob.* validated in the kernel; in-memory index; QUERY and GET_INFO equal to the oracle; acceptance with git, SQLite WAL, dm-log-writes and dm-flakey.

  3. DONE · KASAN

    Instrumented kernel harness

    Upstream 6.12.116, 7.0.14, 7.3.3 and 7.3.4 with KASAN, UBSAN and lockdep run the same suite on every pull request that touches the module (required before merge) and weekly.

  4. DONE · M3 3b

    POSIX authorization in QUERY

    Each result resolved with the caller's credentials; two users, ACLs, remount, idmapped and user-namespace mounts refused, race test; passed in the VM and under KASAN.

  5. DONE · QUERY2

    Query per directory

    Issued on a domain directory, index partitioned by domain, ordering and cursor, batches; answers equal to the oracle on ext4, btrfs and XFS.

  6. DONE · ADR-0012

    Index on demand

    Each domain's part of the index is built by its first query and released under memory pressure or over its budget; nothing is scanned at mount.

  7. REVIEW · CURRENT MODULE

    Hardening what exists

    Fault injection, fstests, syzkaller, KCSAN and SELinux runs; findings F1 to F17 fixed, F2's fair shares of the index budget by ADR-0027 after v0.5.0-experimental. The fifth syzkaller run reached the aggregate coverage target; the sixth and seventh, on the hardened KASAN kernel and the current code, cover every handler function, xattr-get included, and reach 88.1 % of the handlers' KCOV call sites, above the 85 % target; S3 is done (journals 0239 and 0245, ADR-0032). New features wait for project review and the maintainer’s decision.

  8. PILOT COMPLETE · M4

    Measurement report

    Early SQLite, client and per-operation measurements are recorded, including losses. Later module comparisons have 40 repetitions and intervals; fresh SQLite comparisons and independent reproduction remain open.

  9. DEPENDS ON VALIDATION

    Persistence, attribute values with results, release

    Index persistence, returning attribute values with query results (specified in ADR-0014), a change cursor and any public release wait for the stabilization round, the measurements and the security roadmap.

Interactive plan: inputs, processing and outputs → · Full roadmap with journal links ↗

License.

The entire project is licensed under GPL-2.0-only. LICENSE ↗ · How to cite ↗