Folder hierarchies organized for humans - sorted by date or department - often confuse AI agents and complicate prompts. Giving agents direct write access to those same folders also risks accidental overwrites.

Built in Rust by the NomaDamas team, the open-source agentdir tool solves both problems by leaving original folders untouched and projecting clean, task-oriented virtual file trees for agents.

Task-Oriented Views Without Moving Files

Agents perform best when workspaces reflect task intent rather than historical folder clutter. Instead of digging through date-stamped directories, an agent sees clean buckets like inputs, references, and outputs.

For example, agentdir can map a messy file like meeting_notes_final_really_final.md to customer-kickoff.md and expose report_v2.pdf as current-report.pdf without moving or renaming the underlying files. Prompts get simpler immediately because file paths already express each file’s role.

On Copy-on-Write (CoW) filesystems, exposing large datasets across multiple virtual layouts consumes almost zero extra disk space, satisfying both “never touch or duplicate my originals” and “give the agent a clean workspace.”

Pointing an agent at a writable directory invites stray write or rm commands to corrupt source data. agentdir mounts virtual views with 0o444 read-only permissions so agents can read and process inputs without altering originals.

In a test on macOS (APFS) with one 300MB dataset and six scattered documents projected across five separate workspace layouts, du reported a logical total of 1.5GB while actual added disk usage stayed near zero - compared with 0.23 seconds and 1.5GB of real storage consumed by standard file copies.

Zero-copy reflinks work on APFS, Btrfs, and XFS, falling back automatically to byte-copy on ext4 or NTFS. Snapshot isolation also keeps writes inside a snapshot from leaking back into the base workspace.

Internal Architecture and Operational Caveats

agentdir wraps a Rust core library with CLI, Python, and Node.js bindings. Three components handle execution: Catalog manages virtual-to-physical path mappings, Materializer projects files onto disk via reflinks with 0o444 permissions, and Reconciler tracks changes via mtime and file size checks (with optional SHA-256 hashing) while writing state atomically to manifest.json.

Engineers should keep four caveats in mind: 0o444 read-only protection applies only to the virtual view (if an agent runtime can still reach original paths directly, OS-level sandboxing is still needed); non-CoW filesystems duplicate disk usage; snapshots rely on symlinks rather than reflinks; and mtime/size checks alone can miss silent in-place edits unless SHA-256 verification is enabled.

Separating human storage layouts from read-only agent views is a clean, practical pattern for protecting local data integrity.

Summary

  • Decouples messy human folder structures from clean, task-oriented file views (inputs, references, outputs) for AI agents.
  • Uses Copy-on-Write reflinks on APFS, Btrfs, and XFS to expose large files across multiple layouts with near-zero extra disk usage.
  • Protects source data integrity through 0o444 read-only permissions, atomic manifest.json tracking, and optional SHA-256 verification.