Pixir.Paths (pixir v0.1.0)

Copy Markdown View Source

Filesystem conventions for Pixir.

Two roots (ADR 0002 / 0003):

  • Global ~/.pixir/ — cross-project, user-level state: auth.json, config.json. Created lazily, 0700.
  • Project .pixir/ — per-Workspace state, rooted at the current working directory. Sessions live in .pixir/sessions/<id>.ndjson and are the source of truth for the Log. Session Resources live next to the Log under .pixir/sessions/<id>/resources/. This subtree is gitignored.

All helpers return absolute paths. ensure_* variants create the directory (idempotently) before returning it.

Summary

Functions

Global auth.json path (OAuth credentials).

Global config.json path.

Ensure the global root exists (mode 0700) and return it.

Ensure the Session Resources dir exists and return it.

Ensure the project sessions dir exists and return it.

Global root: ~/.pixir (override with PIXIR_HOME).

Pixir-global Skills root: ~/.pixir/skills (respects PIXIR_HOME).

Project root: <workspace>/.pixir (workspace defaults to cwd).

NDJSON Log path for a given session id.

Directory for durable Session Resources attached to a Session.

Project sessions directory: <workspace>/.pixir/sessions.

Functions

auth_file()

@spec auth_file() :: String.t()

Global auth.json path (OAuth credentials).

config_file()

@spec config_file() :: String.t()

Global config.json path.

ensure_global_root()

@spec ensure_global_root() :: String.t()

Ensure the global root exists (mode 0700) and return it.

ensure_session_resources_dir(session_id, workspace \\ File.cwd!())

@spec ensure_session_resources_dir(String.t(), String.t()) :: String.t()

Ensure the Session Resources dir exists and return it.

ensure_sessions_dir(workspace \\ File.cwd!())

@spec ensure_sessions_dir(String.t()) :: String.t()

Ensure the project sessions dir exists and return it.

global_root()

@spec global_root() :: String.t()

Global root: ~/.pixir (override with PIXIR_HOME).

global_skills_dir()

@spec global_skills_dir() :: String.t()

Pixir-global Skills root: ~/.pixir/skills (respects PIXIR_HOME).

project_root(workspace \\ File.cwd!())

@spec project_root(String.t()) :: String.t()

Project root: <workspace>/.pixir (workspace defaults to cwd).

session_log(session_id, workspace \\ File.cwd!())

@spec session_log(String.t(), String.t()) :: String.t()

NDJSON Log path for a given session id.

session_resources_dir(session_id, workspace \\ File.cwd!())

@spec session_resources_dir(String.t(), String.t()) :: String.t()

Directory for durable Session Resources attached to a Session.

sessions_dir(workspace \\ File.cwd!())

@spec sessions_dir(String.t()) :: String.t()

Project sessions directory: <workspace>/.pixir/sessions.