Repository navigation
Unix Tree
The file tree every reader sees (the shell, the agent's tools, WASI programs): one mount table for the virtual /proc, /sys, /dev and /etc files and the FAT volume, read-only rules, /etc and /tmp, ringzero's own data under /var/lib/ringzero and the migration of a disk written by ringzero 0.1.
The system SHALL route every path through one mount table in fs.rs (/proc, /sys and /dev virtual, /etc/os-release and /etc/passwd virtual, everything else the FAT volume), so the shell (!ls, !cat), the agent's ls and cat tools and WASI programs see the same entries and content, and ls / SHALL list proc/, sys/ and dev/ next to the FAT entries.
Source: kernel/src/fs.rs mount_of, read, entry, list, ls, open, check_rw; kernel/src/wasm.rs path_open
-
WHEN the user types
!cat /sys/devices/system/cpu/onlineand!run cat /sys/devices/system/cpu/online -
THEN both print the same line, e.g.
0-7
The system SHALL serve a virtual read-only /sys with class/block/vda/{size (512-byte sectors), ro, device (PCI address)}, bus/pci/devices/<0000:BB:DD.F>/{vendor, device, class, driver} for every function on PCI bus 0, devices/system/cpu/{online, possible, inference, cpuN/role} and power/state (disk), one value per file.
Source: kernel/src/sysfs.rs nodes, entry, list, read; kernel/src/procfs.rs pci_scan; kernel/src/blk.rs location, size; kernel/src/smp.rs
-
WHEN the disk is 512 MiB and the user types
!cat /sys/class/block/vda/size - THEN the shell prints 1048576
-
WHEN the user types
!set cores 4and then!cat /sys/devices/system/cpu/inference -
THEN the shell prints
0-3
Every write, append, truncate, create, mkdir, rm or rename under /proc, /sys (but a write of /sys/power/state), /dev (but a write of the data devices and the console), /dev/vda, /etc/os-release or /etc/passwd SHALL fail with read-only file system in the shell and the agent tools and with EROFS (69) for a WASI program.
Source: kernel/src/fs.rs ROFS, mount_of, check_rw, write; kernel/src/wasm.rs data_ro, path_open
- WHEN python3 opens /sys/devices/system/cpu/online for writing
- THEN the open fails with EROFS and nothing changes
A write of disk to /sys/power/state SHALL hibernate and power off (the image of /hibernate, then !poweroff); mem, freeze and standby SHALL fail as not supported (no suspend to RAM) and any other value as an invalid argument (EINVAL 28 for a program).
Source: kernel/src/sysfs.rs POWER, power_write; kernel/src/hib.rs power_disk; kernel/src/fs.rs write; kernel/src/wasm.rs path_open, fd_write
-
WHEN the user types
!run python3 -c "open('/sys/power/state','w').write('disk')" - THEN the log says "hib: disk written to /sys/power/state", the image is saved, the machine powers off and the next boot resumes the conversation
-
WHEN the user types
!write /sys/power/state mem - THEN the shell prints the not-supported error and the machine stays on
The shell's !write and a program run from the shell SHALL act at once (the human typed them); the agent's write_file and a program the agent runs SHALL ask y/N first, as the poweroff tool does, and a no SHALL change nothing.
Source: kernel/src/agent.rs fs_tool; kernel/src/wasm.rs fd_write
- WHEN the model calls write_file with path /sys/power/state and content disk
- THEN the user is asked y/N, and on no the tool result says the call was not run
The system SHALL serve /dev/null (reads end at once), /dev/zero (zero bytes), /dev/random and /dev/urandom (RDRAND bytes, else the TSC-seeded generator), all four discarding writes (also the shell's !write and the agent's write_file), and a WASI fstat SHALL report them as character devices.
Source: kernel/src/devfs.rs NAMES, writable; kernel/src/fs.rs write; kernel/src/wasm.rs path_open, dev_read, fd_write, fd_filestat_get, Fd
-
WHEN the user types
!run head -c 16 /dev/urandom - THEN 16 bytes are written to the console and the run ends with exit code 0
- WHEN a program writes 1 MiB to /dev/null
- THEN every write returns the full length and nothing is stored
/dev/tty and /dev/console SHALL be the console for a WASI run from the shell (raw input, writes printed) and not found for an agent run; /dev/vda SHALL be the raw disk, readable by programs as a block device and never writable. Source: kernel/src/devfs.rs; kernel/src/wasm.rs path_open, tty_read, dev_read; kernel/src/blk.rs read_raw
- WHEN python3 reads 512 bytes from /dev/vda
- THEN it gets the FAT boot sector of the disk
The shell's !cat and the agent's cat SHALL refuse a device file other than /dev/null with is a device: read it with a program, e.g. head -c 16 /dev/urandom, and SHALL print nothing for /dev/null.
Source: kernel/src/fs.rs DEVICE, virt_read, read; kernel/src/agent.rs fs_tool; kernel/src/shell.rs fs_cmd
- WHEN the model calls cat with path /dev/zero
-
THEN the tool result is the
is a deviceerror
The system SHALL keep /etc as a FAT directory the shell, the agent and programs may change, SHALL create /etc/hostname with ringzero at boot when it is missing and log its first line as host: NAME (/etc/hostname) right after the disk mounts.
Source: kernel/src/layout.rs init, hostname; kernel/src/fs.rs mount_of
-
WHEN the user types
!write /etc/hostname laband reboots -
THEN the boot log has the line
host: lab (/etc/hostname)
The system SHALL serve the read-only virtual files /etc/os-release (NAME, ID, ID_LIKE=unix, VERSION, VERSION_ID, PRETTY_NAME with the edition) and /etc/passwd (root:x:0:0:root:/:/bin/sh).
Source: kernel/src/layout.rs etc_virtual; kernel/src/fs.rs mount_of
-
WHEN the user types
!cat /etc/os-release -
THEN the lines include
ID=ringzeroandID_LIKE=unix
The system SHALL keep /tmp as a FAT directory, create it at boot when missing, empty it at a boot that does not resume a hibernation image, keep it when an image resumes, and the file indexer SHALL not walk it. Source: kernel/src/layout.rs init, tmp_clean; kernel/src/hib.rs boot; kernel/src/fs.rs indexed, walk
-
WHEN /tmp/a.txt exists and the user types
/hibernate discardthen!poweroffand boots again - THEN /tmp is empty
The system SHALL keep its own files under /var/lib/ringzero (mem/journal.log, mem/facts.log, mem/episodes.log, mem/index.bin, mem/index.tsv, hib/image.bin, bootsnap.bin, layout), and the file indexer SHALL not walk that tree. Source: kernel/src/layout.rs JOURNAL, FACTS, EPISODES, INDEX, HIB, BOOTSNAP; kernel/src/agentd.rs INDEX_LIST; kernel/src/fs.rs indexed, walk
-
WHEN the user types
/agentdwith a disk mounted - THEN the stores are reported in /var/lib/ringzero/mem
The agent's write_file, mkdir and rm SHALL fail under /var/lib/ringzero with permission denied: ringzero's own data (use remember and forget); reads stay allowed and the shell keeps full access (!rm still asks).
Source: kernel/src/agent.rs fs_tool
- WHEN the model calls write_file with path /var/lib/ringzero/mem/facts.log
-
THEN the call fails with
permission deniedand the file is unchanged
At mount, when FAT /sys exists or /var/lib/ringzero/layout is missing, the system SHALL copy /sys/mem/{journal,facts,episodes}.log and index.bin to /var/lib/ringzero/mem/, and any other file under FAT /sys, /proc or /dev to /var/lib/ringzero/legacy/, and verify each copy by size and FNV-1a 64 read back from the disk, never using rename. Source: kernel/src/layout.rs MOVES, migrate, same; kernel/src/fs.rs RAW, write_parts, read
- WHEN a disk with five facts in /sys/mem/facts.log boots the new kernel
-
THEN
/factslists the five facts, FAT /sys is gone and alayout: migratedsummary line is logged
After every copy verifies, the system SHALL write /var/lib/ringzero/layout (ringzero-layout 2) and sync, and only then remove the sources, /sys/bootsnap.bin and /sys/hib/image.bin (neither is copied: an older image cannot match the new boot key) and the emptied directories, then sync again.
Source: kernel/src/layout.rs DROPS, migrate; kernel/src/fs.rs rm, sync
- WHEN an old disk holds /sys/hib/image.bin
- THEN it is removed after the commit marker and the boot starts a fresh conversation
A migration interrupted at any step SHALL end, at a later boot, in the same state as an uninterrupted one: before the commit marker every source stays and verified copies are skipped, after it the removal resumes. Source: kernel/src/layout.rs migrate, same, halt_at
- WHEN the machine stops after the commit marker and before the removals
- THEN the next boot removes the sources it finds verified and copies nothing again
When a migration step fails (disk full, I/O error) the system SHALL keep every source, run agentd without disk stores for this boot with /agentd showing off (layout migration pending: REASON), write no boot cache and no hibernation image, and retry at the next boot.
Source: kernel/src/layout.rs init, migrate, pending; kernel/src/agentd.rs init, status; kernel/src/hib.rs save; kernel/src/agent.rs init
- WHEN the machine stops after index.bin was half written to /var/lib/ringzero/mem
- THEN the next boot copies it again, verifies it and completes the migration with no record lost
When the commit marker exists and FAT /sys holds files again (an older kernel booted the disk), the system SHALL copy them to /var/lib/ringzero/legacy/sys-/ (the time of the FAT /sys directory, so a retry after a crash uses the same folder), verify and remove them, leave /var/lib/ringzero/mem unchanged and log a warning naming the folder; it SHALL not merge them into the stores on its own (/agentd merge-legacy does, on request).
Source: kernel/src/layout.rs migrate
- WHEN an older kernel wrote /sys/mem/journal.log after the migration and the new kernel boots
- THEN that journal is in /var/lib/ringzero/legacy/sys-/mem/ and a warning says so
Source of this page: openspec/specs/unix-tree/spec.md
Generated from openspec/specs at 0221909 by tools/wiki_gen.py. Do not edit here: change the spec and regenerate.