pub struct ConfigPaths {
pub user_data_dir: PathBuf,
pub global_data_dir: PathBuf,
pub local_data_dir: PathBuf,
pub project_root: Option<PathBuf>,
pub project_untrusted: bool,
pub layout: Layout,
}Expand description
Unified management of AGENT persistent directory paths: the three tiers’ roots and every path derived from them. A caller asks for the path here rather than joining a name onto a root.
Usually global_data_dir = $HOME/.agix/,
user_data_dir = <global>/scenes/<scope>/,
local_data_dir = <project>/<layout's project dir>/.
Fields§
§user_data_dir: PathBufUser-level, scene-specific override root.
global_data_dir: PathBufUser-level, cross-scene global root (flat, shared by every scene).
local_data_dir: PathBufThe project tier’s root; the state root in a session without a project.
project_root: Option<PathBuf>The project, None for a session without one
(crate::paths::PathSettings::project_root).
project_untrusted: bool§layout: LayoutImplementations§
Source§impl ConfigPaths
impl ConfigPaths
Sourcepub fn new(
global_data_dir: PathBuf,
local_data_dir: PathBuf,
scope: &str,
layout: Layout,
) -> Self
pub fn new( global_data_dir: PathBuf, local_data_dir: PathBuf, scope: &str, layout: Layout, ) -> Self
Build from explicit roots.
There is no constructor that consults the environment, and that is the
point: a process serves one instance, and which directory that
instance owns is the caller’s to decide. Reading $HOME here would
make every downstream module silently agree on the invoking user’s
home, which is wrong for a test, wrong for a service account, and
wrong for any deployment that keeps its state somewhere else.
scope identifies the product instance whose scene-specific override
tree lives under global_data_dir/scenes/<scope>/.
Sourcepub fn of(
global_data_dir: PathBuf,
scene_dir: PathBuf,
project: Option<&Path>,
layout: Layout,
) -> Self
pub fn of( global_data_dir: PathBuf, scene_dir: PathBuf, project: Option<&Path>, layout: Layout, ) -> Self
The paths of a session of scene_dir in project, or in none: the
project tier is layout’s directory in the project, and without a
project it is the state root, as LoadedSettings makes it.
Sourcepub fn from_settings(paths: &PathSettings) -> Self
pub fn from_settings(paths: &PathSettings) -> Self
The same roots [crate::settings::Settings] already
carries — for the call sites that hold Settings and want these
accessors without re-deriving anything.
pub fn state_root(&self) -> StateRoot
pub fn scene_dir(&self) -> &Path
Sourcepub fn project_dir(&self) -> Option<&Path>
pub fn project_dir(&self) -> Option<&Path>
The project’s own directory, None without a project.
Sourcepub fn tier_dir(&self, tier: Tier) -> Option<PathBuf>
pub fn tier_dir(&self, tier: Tier) -> Option<PathBuf>
The directory of a settings tier: the state root, the scene
directory, the project directory. None for the project tier
without a project, the cli and session ones, and the managed one, which is a file.
Sourcepub fn tier_entry(&self, tier: Tier, name: &str) -> Option<PathBuf>
pub fn tier_entry(&self, tier: Tier, name: &str) -> Option<PathBuf>
name, one of entry, in a tier’s directory.
pub fn settings_file(&self, tier: Tier) -> Option<PathBuf>
pub fn settings_local_file(&self, tier: Tier) -> Option<PathBuf>
pub fn global_skills_dir(&self) -> PathBuf
pub fn user_skills_dir(&self) -> PathBuf
Sourcepub fn project_skills_dir(&self) -> Option<PathBuf>
pub fn project_skills_dir(&self) -> Option<PathBuf>
<project>/.agents/skills: beside the project directory, not in it.
pub fn global_agents_dir(&self) -> PathBuf
pub fn user_agents_dir(&self) -> PathBuf
pub fn project_agents_dir(&self) -> Option<PathBuf>
pub fn global_hooks_dir(&self) -> PathBuf
pub fn user_hooks_dir(&self) -> PathBuf
pub fn project_hooks_dir(&self) -> Option<PathBuf>
pub fn global_rules_dir(&self) -> PathBuf
pub fn user_rules_dir(&self) -> PathBuf
pub fn project_rules_dir(&self) -> Option<PathBuf>
pub fn user_output_styles_dir(&self) -> PathBuf
pub fn project_output_styles_dir(&self) -> Option<PathBuf>
pub fn global_plugins_dir(&self) -> PathBuf
pub fn user_plugins_dir(&self) -> PathBuf
Sourcepub fn global_memory_dir(&self) -> PathBuf
pub fn global_memory_dir(&self) -> PathBuf
The state root’s memory, the user’s across every project.
pub fn global_recordings_dir(&self) -> PathBuf
Sourcepub fn project_state_dir(&self) -> Option<PathBuf>
pub fn project_state_dir(&self) -> Option<PathBuf>
The project directory’s state/, None without a project.
Sourcepub fn local_state_dir(&self) -> PathBuf
pub fn local_state_dir(&self) -> PathBuf
Where this machine’s data of the session’s place is: the project
directory’s state/, and without a project the state root, which
has no state/ of its own.
pub fn local_memory_dir(&self) -> PathBuf
pub fn scratchpad_dir(&self) -> PathBuf
pub fn telemetry_dir(&self) -> PathBuf
Sourcepub fn tool_results_dir(&self, session_id: &str) -> PathBuf
pub fn tool_results_dir(&self, session_id: &str) -> PathBuf
Sourcepub fn scheduled_tasks_file(&self) -> PathBuf
pub fn scheduled_tasks_file(&self) -> PathBuf
The scene’s scheduled_tasks.json.
pub fn mcp_oauth_dir(&self) -> PathBuf
Sourcepub fn imported_marker(&self) -> Option<PathBuf>
pub fn imported_marker(&self) -> Option<PathBuf>
Where the import records that its question was answered, None
without a project.
Sourcepub fn teams_dir(&self, cwd: &Path) -> PathBuf
pub fn teams_dir(&self, cwd: &Path) -> PathBuf
The teams of a session working in cwd (Layout::teams_dir).
Sourcepub fn worktrees_dir(&self) -> Option<PathBuf>
pub fn worktrees_dir(&self) -> Option<PathBuf>
The engine’s worktrees of the project (Layout::worktrees_dir).