Execute proactive auto-loading: automatically detects and loads agents.md files.
Use when appropriate context detected. Trigger with relevant phrases based on skill purpose.
Automatic discovery and loading of AGENTS.md files across project hierarchies for AI coding agents. This skill scans the current workspace and its parent directories to locate agent instruction files, then surfaces their contents so the active agent session has full operational context.
Prerequisites
A project workspace containing one or more AGENTS.md files at any directory depth
Read and Glob permissions to traverse the directory tree
Grep access for searching file contents when multiple candidates exist
Instructions
Scan the current working directory and all ancestor directories (up to the filesystem root or repository root) for files named AGENTS.md or agents.md.
Search subdirectories of the current workspace for additional AGENTS.md files that may apply to sub-projects or modules.
Determine load order: files closer to the repository root load first (global context), files in deeper directories load later (override or supplement).
Read each discovered AGENTS.md file and extract its instruction blocks, workflow definitions, and constraint declarations.
Merge instructions into a unified context, noting any conflicts between levels (e.g., a subdirectory agent overriding a root-level rule).
Present the loaded context as a structured summary: source file path, instruction count, and any detected conflicts.
Cache the discovery results for the current session to avoid redundant filesystem scans on subsequent activations.
Output
Ordered list of discovered AGENTS.md file paths with their directory depth
Merged instruction set combining all discovered agent contexts
Conflict report highlighting any contradictory directives between levels
Session cache status indicating whether results are fresh or reused
Error Handling
Error
Cause
Solution
No AGENTS.md found
Workspace has no agent instruction files
Confirm the correct working directory; create an AGENTS.md at the project root if needed
Permission denied on directory traversal
Restricted parent directories above the workspace
Limit scan depth to the repository root (detected via .git/ presence)
Circular symlink detected
Symlinked directories create an infinite traversal loop
Skip symlinked directories during the scan; log a warning with the symlink path
Conflicting instructions across levels
A subdirectory AGENTS.md contradicts the root-level file
Flag the conflict in the output; apply the more specific (deeper) instruction by default
File encoding error
AGENTS.md uses a non-UTF-8 encoding
Attempt latin-1 fallback; report the file path and encoding issue
Examples
Example 1: Monorepo with per-package agent instructions