Skip to main content

Module paths

Module paths 

Source
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_HOME for 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 for git 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.