Skip to main content

load_memory_content

Function load_memory_content 

Source
pub fn load_memory_content(dir: &Path) -> Option<String>
Expand description

Reads MEMORY.md from the given directory and returns the first 200 lines.

Returns None if the file does not exist or is empty.

Security:

  • Canonicalizes the path and verifies it stays within dir (symlink boundary).
  • Opens the canonical path after the boundary check (no TOCTOU window).
  • Rejects files larger than 256 KiB.
  • Rejects files containing null bytes.