Skip to content
healeycodesPublic

About

🗂️ FUSE filesystem where file operations are handled by an LLM.

Topics

Resources

Stars

10 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

Repository files navigation

🗂️ llmfs

My blog post: Filesystem Backed by an LLM


FUSE filesystem where file operations are handled by an LLM.

Just a fun demo for now.


demo.mp4

  • The kernel forwards each VFS call on /mnt/llmfs to the Go daemon via /dev/fuse.
  • The daemon converts the call into a chat prompt and sends it to the OpenAI API.
  • An in‑memory history log tracks the operations and provides context for the LLM (nothing is persisted to disk).
  • Standard tools (cat, echo, dd) work but directory listings are not supported yet.

# generate scripts on the fly, content stored in history log (not disk)
root@806a918764f4:/mnt/llmfs# cat generate_20_bytes_of_binary_data.py | python3
b'\x94\xc2(\xbd\x17<|\xd7\x01*\x01\xdeWvM\xaa\x8fX\xfa\xb1'

# writes are confirmed by llm and then stored in history log
root@806a918764f4:/mnt/llmfs# echo "andrew" > my_name.txt

# llm receives the history log each time, so written data can be recalled
root@806a918764f4:/mnt/llmfs# cat my_name.txt
andrew

# files can be overwritten
root@806a918764f4:/mnt/llmfs# echo "bob" > my_name.txt
root@806a918764f4:/mnt/llmfs# cat my_name.txt
bob

# or written at offset
root@28f6b83ef6cb:/mnt/llmfs# echo "123" > nums.txt
root@28f6b83ef6cb:/mnt/llmfs# echo "456" | dd of=nums.txt seek=4 oflag=seek_bytes conv=notrunc bs=4 status=none
root@28f6b83ef6cb:/mnt/llmfs# cat nums.txt
123
456

# history log has the system prompt at the start
# and operations are stored like:
#   user: Write notes.txt offset 0 data "123\n"
#   assistant: ok
#   user: Write notes.txt offset 4 data "567\n"
#   assistant: ok

# unix file errors are non-deterministic!
root@806a918764f4:/mnt/llmfs# cat private_data
cat: private_data: Permission denied

Quick Start

Requires docker.

# set your OpenAI API key with access to gpt-4o-mini
export OPENAI_API_KEY="your-api-key-here"

# launch the filesystem
./run.sh

run.sh builds the image and starts the container with the mandatory FUSE flags:

--device /dev/fuse            # expose the kernel FUSE device
--cap-add SYS_ADMIN           # allow mount(2) inside the container
--security-opt apparmor:unconfined  # disable AppArmor restrictions on FUSE

You'll be dropped into a shell with the filesystem mounted at /mnt/llmfs.

cat hello_world.txt       # on‑the‑fly content from the model
echo "test" > myfile.txt  # write confirmation round‑tripped through the model
cat myfile.txt            # read is round-tripped through the model

Examples

Demonstrate sparse writes (two separate write(2) calls):

# f = open('notes.txt', 'wb+')
# f.write(b'1234')
# print("wrote 1234 to notes.txt at offset 0")
# f.seek(5)
# f.write(b'5678')
# print("wrote 5678 to notes.txt at offset 5")
# f.close()
python3 /app/separate_writes.py

Expected output:

wrote 1234 to notes.txt at offset 0
wrote 5678 to notes.txt at offset 5

Debug Logs

Tail the history log:

docker logs -f llmfs_container

Sample log snippet:

user: Write notes.txt offset 0 data "1234"
assistant: ok
user: Write notes.txt offset 5 data "5678"
assistant: ok

About

🗂️ FUSE filesystem where file operations are handled by an LLM.

Topics

Resources

Stars

10 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages