kernex-sandbox
OS-level system protection for AI agent subprocesses.
Uses a blocklist approach: everything is allowed by default, then dangerous system directories and the runtime's core data are blocked.
- macOS: Apple Seatbelt via
sandbox-exec -p <profile>— denies reads and writes to{data_dir}/data/(memory.db) andconfig.toml; denies writes to/System,/bin,/sbin,/usr/{bin,sbin,lib,libexec},/private/etc,/Library. - Linux: Landlock LSM via
pre_exechook (kernel 5.13+) — broad read-only on/with full access to$HOME,/tmp,/var/tmp,/opt,/srv,/run,/media,/mnt; restricted access to{data_dir}/data/andconfig.toml. - Other: Falls back to a plain command with a warning.
Also provides [is_write_blocked] and [is_read_blocked] for code-level
enforcement in tool executors (protects memory.db and config.toml on all
platforms).
This crate is intentionally standalone with zero internal dependencies, making it usable outside the Kernex ecosystem.