Skip to main content

Module project_context

Module project_context 

Source
Expand description

Project-context ingestion — load CLAUDE.md for prompt injection (#1033).

Why: A Claude-Code-compatible harness must give the PM and every sub-agent the same project-specific rules a human Claude Code session sees — the project-root CLAUDE.md. This module reads that file, bounds its size so a runaway file cannot blow the model context budget, and degrades gracefully when the file is absent. What: load_project_context (root then .claude/ lookup, size-capped with a provenance note on truncation) and MAX_CONTEXT_BYTES. Test: project_context::tests::*. Project-context ingestion — load CLAUDE.md for prompt injection (#1033).

Why: A Claude-Code-compatible harness must give the PM and every sub-agent the same project-specific rules a human Claude Code session would see — the CLAUDE.md at the project root. The parity prompt assembler (#1032) already accepts a verbatim project-context section; this module is the missing piece that reads that section off disk, bounds its size so a runaway file cannot blow the model’s context budget, and degrades gracefully when no file exists. What: [load_project_context] walks the project root for CLAUDE.md (and, when present, the nested .claude/CLAUDE.md Claude-Code convention), reads the first one found, caps it at [MAX_CONTEXT_BYTES], and — on truncation — appends a provenance note so the model knows the context was clipped. A missing file yields None, never an error. Test: project_context::tests cover present/oversized/missing/positioning.

Constants§

MAX_CONTEXT_BYTES
Maximum number of bytes of CLAUDE.md content injected into a prompt.

Functions§

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