Skip to main content

locate_agents_dir

Function locate_agents_dir 

Source
pub fn locate_agents_dir(project_root: &Path) -> PathBuf
Expand description

Locate the agents directory for the given project root.

Why: this crate’s agents live under Trusty Code’s OWN .trusty-code/agents (#5426); .claude/agents and .open-mpm/agents remain readable so no existing project breaks. Shared between main.rs’s run-task CLI path and (#2056) serve::build_router’s task.run wiring, so a project’s agents resolve identically whether driven from the CLI or the daemon. What: delegates to crate::paths::agents_dir — the single precedence rule (.trusty-code → .claude → .open-mpm) — and keeps only its path. Falls back to .trusty-code/agents, which may not exist yet; callers that need it to exist check separately, e.g. via md_loader::load_md_agent’s own error. Callers wanting to know WHICH root won call paths::agents_dir directly. Test: agents::tests::locate_agents_dir_prefers_claude_then_open_mpm_then_default, paths::tests::agents_dir_prefers_trusty_code.