Expand description
Centralised path resolution for per-user and per-workspace state.
Recursive separates state into three buckets:
- Per-user (
~/.recursive/...): config, global memory, facts. - Per-user, per-workspace (
~/.recursive/workspaces/<hash>/...): sessions, shadow-git checkpoints, scratchpad. These are the files this module owns. - Project-bundled (
<workspace>/.recursive/...):skills/,mcp.json. These ship with the project; this module never touches them.
Tests can redirect the per-user root by setting
RECURSIVE_HOME=<dir>.
Functions§
- legacy_
paths_ in_ workspace - Detect any legacy in-tree state files that should now live under the user data dir. Returns the absolute paths that exist.
- user_
data_ dir - Per-user data root. Honors
RECURSIVE_HOMEfor tests, otherwise$HOME/.recursive. - user_
scratchpad_ path <user_workspace_dir>/scratchpad.json.- user_
sessions_ dir <user_workspace_dir>/sessions/.- user_
shadow_ git_ dir <user_workspace_dir>/shadow-git/(parent only — caller is responsible forgit init --bare).- user_
workspace_ dir - Per-user, per-workspace data dir.
- workspace_
hash - 12-char workspace hash. Stable across calls for the same canonical path. Public for diagnostics.