generic-automation-and-it/smooth-ai-stockanalysis / .agents/skills/context-load-agents-context
context-load-agents-context
VerifiedLoad ancestor AGENTS.md context for a target file. Use when Codex, Claude, Copilot, or another agent needs local domain context before reading or editing source files.
Load AGENTS Context — Skill
TL;DR
Agent-agnostic skill that emits *AGENTS.md context files from ancestor directories for a target source file; each file loads at most once per conversation session. Claude Code runs the script automatically as a PostToolUse hook. Codex, Copilot, and other agents invoke the same skill script explicitly.
Non-Negotiables
- Never load from auto-loaded dirs — skip
.agents/rules/,.ai/rules/,.claude/rules/,.cursor/rules/,.github/instructions/. Those are already in context via the AI tool's built-in loading mechanism. - Exit 0 always — the hook must never return a non-zero exit code; it must not block the triggering tool. File-operation failures (tracker write, content read) are silently tolerated.
- Read/Edit/Write or explicit skill invocation only — skip unrelated hook tools (
Grep,Glob,Bash). Trigger on actual file access for context, or on an explicit skill request. - Session dedup — each
*AGENTS.mdfile must be emitted at most once per conversation session. Paths are canonicalised (physical path) so symlinked access (.claude/...vs.agents/...) is treated as the same file.
Design & Rationale
The sequence diagram, the six LADRs (PostToolUse choice, session-file dedup, git-root walk,
thin-wrapper script, superseded scope injection, skill-on-path injection), the detailed
Key Behaviors list, and the transfer checklist live in references/design.md.
Read that only when modifying the skill or its script — it is not needed to run the skill.
Hook Registration
Add to .agents/settings.json (equivalently .claude/settings.json via symlink) under hooks:
"PostToolUse": [
{
"matcher": "Read|Edit|Write",
"hooks": [
{
"type": "command",
"command": ".agents/hooks/load-agents-context.sh"
}
]
}
]
Invocation
Use the skill as /load-agents-context <path> or run the script directly:
.agents/skills/context-load-agents-context/scripts/load-agents-context.sh --file path/to/source-file
Codex can pass its thread identifier for stable deduplication:
CODEX_SESSION_ID="${CODEX_SESSION_ID:-${CODEX_THREAD_ID:-codex-manual}}" \
.agents/skills/context-load-agents-context/scripts/load-agents-context.sh --tool Codex --file path/to/source-file
Copilot can pass a stable prompt/session identifier:
.agents/skills/context-load-agents-context/scripts/load-agents-context.sh \
--tool Copilot \
--session-id copilot-vscode-session \
--file path/to/source-file
Transferring to Another Repo
See the checklist in references/design.md.
Changelog
| Date | Change | Ref |
|---|---|---|
| 2026-05-30 | Initial version. | |
| 2026-06-06 | Move mermaid/LADRs/Key Behaviors/transfer docs to references/design.md; fix stale context/load-agents-context/ script paths to flat context-load-agents-context/. |
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 470k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |