Move campaign data to ~/.storied and add a user homebrew layer
Paths used to be threaded through every function as base_path kwargs,
defaulting to cwd — a holdover from when storied ran out of the repo
root. That pattern stopped making sense once worlds/ and players/
moved to ~/.storied/, and it meant a forgotten kwarg in a test would
silently write to the user's real home dir.
Centralize all filesystem roots in storied.paths as module globals,
configured once at CLI startup via configure(). Everything downstream
reads through getters (world_path, player_path, etc.). Drop base_path
from every library function, class, and tool wrapper; delete the
StorageRoot() dep and the base_path field on ToolContext.
While the paths layer was already in pieces, add a third content layer
for personal homebrew at ~/.storied/rules/. Priority is
world > user > shipped — a campaign override beats your homebrew which
beats the stock SRD. The vector index tags rows by source (srd/user/
world) and recall(scope="rules") now covers all three, so dropping a
spell into ~/.storied/rules/spells/ shows up across every campaign
after a `storied index rebuild`.
Test isolation is now an autouse fixture that points paths at tmp_path
for every function, with STORIED_HOME belt-and-suspenders for any
subprocess that re-enters storied. The sandbox mode keeps user homebrew
accessible — only worlds/players move to the tempdir.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This is a binary file and will not be displayed.
This is a binary file and will not be displayed.