Skip to main content

Module load

Module load 

Source
Expand description

Shared project-instruction (AGENTS.md) discovery (ADR-0023, Task 30).

One shared loader — not pack-selectable — walks cwd → project root collecting AGENTS.md files (deepest wins on conflict), plus a global ~/.locode/AGENTS.md, and returns a neutral ProjectInstructions. The engine renders that into a single User-role <system-reminder> message and injects it (ADR-0023 §2).

Discovery reads the files directly, deliberately bypassing the tool path-jail: it legitimately spans ancestors above the cwd-rooted jail, and the jail governs tools, not engine machinery (ADR-0023 implementation note, 2026-07-23). Reads are bounded to the AGENTS.md/AGENTS.override.md names along the bounded ancestor walk. This module lived in locode-host until the crate split (ADR-0002 amendment 2026-07-24); the one host primitive it still needs — the cwd→root marker walk, shared with the settings loader — stays there as locode_host::find_root_from_markers.

Structs§

InstructionEntry
One discovered instruction file: where it came from, and its contents.
InstructionsConfig
How project-instruction discovery behaves. All fields have defaults; a caller (the CLI today, a settings layer later) overrides them.
ProjectInstructions
Discovered project instructions: ordered entries, lowest-precedence first, so a later (deeper) entry wins on conflict. Neutral — the engine owns rendering/injection.

Functions§

load_project_instructions
Discover project instructions for cwd under cfg.