Obsidian Vault — safe CLI scoping
The Obsidian CLI (obsidian, used by obsidian-cli, obsidian-graph-colors)
can act on any vault registered on the machine. This skill is the convention
that keeps an agent inside the one vault it was asked to work on — the
behavioural twin of the firewall hook, which enforces the same boundary on the
write path.
The rule
- Resolve the vault first.
VAULT=$(bash scripts/resolve-vault.sh && …)— use the four-tier resolution, never a hard-coded path. The resolved path is the only vault you may touch. - Always pass the vault explicitly. Every Obsidian CLI call carries
--vault "$VAULT"(or the CLI's equivalent). Never rely on the CLI's "current"/"default" vault — that is whatever the user last opened. - Never operate on a different vault name. If a task names another vault, stop and surface it; do not switch vaults to satisfy it.
- File operations stay inside the vault. Reads/writes you issue alongside
the CLI must resolve under
$VAULT. Writes outside it are rejected by the firewall hook anyway — treat that block as a contract, not an obstacle to work around.
Why both a skill and a hook
- The hook (
scripts/firewall.sh,firewallengine command) is the enforcement: it blocks an out-of-vault Write/Edit regardless of intent. - This skill is the intent: it teaches an agent to scope correctly in the first place, so the hook rarely has to fire. Defence in depth — a confused agent is stopped by the hook; a careful agent never reaches it.
Configuration
Vault isolation is configured under firewall in claude-wiki-pages.json
(enabled, mode = enforce/warn/off, allowPaths, denyPaths). To let
an agent write to an extra root (e.g. a shared notes directory), add it to
firewall.allowPaths — do not disable the firewall.