Agent 上下文 Loader
- 作者仓库星标 2,235
- 作者仓库 claude-code-plugins-plus-skills
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
AGENTS.mdfiles 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.mdoragents.md. - Search subdirectories of the current workspace for additional
AGENTS.mdfiles 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.mdfile 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.mdfile 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
- Structure: Root
AGENTS.mdsets global conventions;packages/api/AGENTS.mdadds API-specific tooling rules. - 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
AGENTS.mdsays "always sign commits";services/legacy/AGENTS.mdsays "skip commit signing." - 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
AGENTS.mdanywhere. - Result: Scan completes with zero files found. Output includes a suggestion to create
AGENTS.mdat the repository root with a minimal template.
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
- 流狐分类
- 效率工具
- 作者声明 Agent
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 作者 / 版本 / 许可
- @jeremylongshore · 未声明 license
- 流狐 Token 估算
- 低消耗
- 流狐接入估算
- 即装即用
- 是否需要外部 API Key
- 未发现要求
- 检测到的系统要求
- 未声明
- 底层运行要求
- 未声明
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 检测到的网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
作者没有在当前 SKILL.md 中定义固定输出样例。 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…
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
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…
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
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…
Example 1: Monorepo with per-package agent instructions Structure: Root AGENTS.md sets global conventions; packages/api/AGENTS.md adds API-specific tooling rules. Result: Both files loaded in order. The API-specific rules supplement the global context without…
# 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 `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
1. 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`.
2. Search subdirectories of the current workspace for additional `AGENTS.md` files that may apply to sub-projects or modules.
3. Determine load order: files closer to the repository root load first (global context), files in deeper directories load later (override or supplement).
4. Read each discovered `AGENTS.md` file and extract its instruction blocks, workflow definitions, and constraint declarations.
5. Merge instructions into a unified context, noting any conflicts between levels (e.g., a subdirectory agent overriding a root-level rule).
6. Present the loaded context as a structured summary: source file path, instruction count, and any detected conflicts.
7. 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
… 作者原文负责流程事实;流狐只索引当前章节、要点、文件与命令。
章节 -> Overview → Prerequisites → Instructions → Output → Error Handling → Examples
要点 -> Example 1: Monorepo with per-package agent instructions · Example 2: Nested workspace with conflicting commit policies · Example 3: First-time setup with no agent files · Automatic discovery and loading of AGENTS.md files across project hierarchies for AI coding agents. · - Structure: Root AGENTS.md sets global conventions; packages/api/AGENTS.md adds API-specific tooling rules. · - Structure: A freshly cloned repository with no AGENTS.md anywhere.
文件/命令 -> AGENTS.md · agents.md · .git/ · packages/api/AGENTS.md · services/legacy/AGENTS.md
内容 SHA-256 -> a45b85ffa4d5
原文结构
适用与边界
原文中的明确线索
AGENTS.md、agents.md、.git/、packages/api/AGENTS.md、services/legacy/AGENTS.md