Skip to main content

load_project_context

Function load_project_context 

Source
pub fn load_project_context(project_root: &Path) -> Option<String>
Expand description

Load the project’s CLAUDE.md context, size-capped and provenance-annotated.

Why: The PM and sub-agents must see the project’s own rules; this is the single entry point the run-task handler and the in-process runner use to obtain the verbatim context section for assemble_system_prompt. What: Resolves the first existing of <root>/CLAUDE.md then <root>/.claude/CLAUDE.md; reads it; returns Some(content) capped at MAX_CONTEXT_BYTES (with a truncation note appended when clipped). Returns None when no file exists or the file cannot be read (absence is not an error — a project simply may not define project context). Test: loads_root_claude_md, loads_nested_claude_md, missing_file_returns_none, oversized_context_is_truncated_with_note.