Skillshub agent-context-loader
install
source · Clone the upstream repo
git clone https://github.com/ComeOnOliver/skillshub
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ComeOnOliver/skillshub "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/jeremylongshore/claude-code-plugins-plus-skills/agent-context-loader" ~/.claude/skills/comeonoliver-skillshub-agent-context-loader && rm -rf "$T"
manifest:
skills/jeremylongshore/claude-code-plugins-plus-skills/agent-context-loader/SKILL.mdsource content
Agent Context Loader
Overview
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
files at any directory depthAGENTS.md - 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
orAGENTS.md
.agents.md - Search subdirectories of the current workspace for additional
files that may apply to sub-projects or modules.AGENTS.md - 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
file and extract its instruction blocks, workflow definitions, and constraint declarations.AGENTS.md - 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
file paths with their directory depthAGENTS.md - 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 found | Workspace has no agent instruction files | Confirm the correct working directory; create an 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 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 contradicts the root-level file | Flag the conflict in the output; apply the more specific (deeper) instruction by default |
| File encoding error | 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
- Structure: Root
sets global conventions;AGENTS.md
adds API-specific tooling rules.packages/api/AGENTS.md - Result: Both files loaded in order. The API-specific rules supplement the global context without conflict.
Example 2: Nested workspace with conflicting commit policies
- Structure: Root
says "always sign commits";AGENTS.md
says "skip commit signing."services/legacy/AGENTS.md - Result: Conflict detected and reported. The deeper (legacy) directive is applied with a warning noting the override.
Example 3: First-time setup with no agent files
- Structure: A freshly cloned repository with no
anywhere.AGENTS.md - Result: Scan completes with zero files found. Output includes a suggestion to create
at the repository root with a minimal template.AGENTS.md
Resources
- Claude Code AGENTS.md specification: https://docs.anthropic.com/en/docs/agents
- Monorepo workspace patterns for agent configuration: https://docs.anthropic.com/en/docs/claude-code
- File discovery best practices for hierarchical configuration loading