hierarchical-agents

Generate hierarchical AGENTS.md structures with lightweight root files and sub-folder guidance.

47|11|Updated Nov 26, 2025
One-click install
npx skills add https://github.com/majesticlabs-dev/majestic-marketplace --skill hierarchical-agents
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hierarchical-agents
Source: https://github.com/majesticlabs-dev/majestic-marketplace/tree/main/plugins/majestic-engineer/skills/hierarchical-agents
Command: npx skills add https://github.com/majesticlabs-dev/majestic-marketplace --skill hierarchical-agents

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

In large codebases and AI-assisted projects, Claude agents suffer from verbose documentation and token bloat. This Skill creates a hierarchical AGENTS.md system with a lightweight root file and detailed sub-folder guidance, enabling efficient agent guidance with near-wins and Just-In-Time indexing.

Core Features & Use Cases

  • Root AGENTS.md is lightweight: index-level guidance with links to sub-folders.
  • Nearest-Wins Hierarchy: sub-folder AGENTS.md files override root guidance for precise context.
  • JIT Indexing: path hints, globs, and quick-find commands for agent navigation.
  • Token Efficiency: compact guidance that scales with codebase complexity.
  • Sub-Folder Details: deeper, technology-specific conventions and examples.

Quick Start

Generate a root AGENTS.md for a new monorepo and create a sub-folder AGENTS.md under critical packages to guide AI agents.

Frequently Asked Questions about hierarchical-agents

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce token usage for AI agents working in large codebases?

Create a hierarchical AGENTS.md system with a lightweight root file (100–200 lines) and detailed sub-folder guidance. This structure minimizes token bloat by using nearest-wins hierarchy and Just-In-Time indexing, so agents load only the context they need for their current directory.

What is a hierarchical AGENTS.md and how does it work?

A hierarchical AGENTS.md is a multi-level documentation structure where a compact root file provides index-level guidance with links to sub-folders, and sub-folder AGENTS.md files override root guidance with technology-specific conventions. Agents resolve context by reading the nearest file first, reducing unnecessary token consumption.

Can I use AGENTS.md in monorepos and multi-package projects?

Yes. Hierarchical AGENTS.md is designed for monorepos and multi-package projects. The root file indexes all packages with links, while each package sub-folder contains its own AGENTS.md with concrete file examples, executable commands, and JIT directory maps tailored to that package's structure.

How do I set up JIT indexing for agent navigation?

JIT indexing uses path hints, glob patterns, and quick-find commands embedded in sub-folder AGENTS.md files. These guide agents to relevant files and executable commands without listing entire directory trees, enabling efficient on-demand lookups that reduce token overhead.

What's the difference between the root AGENTS.md and sub-folder AGENTS.md?

The root AGENTS.md is lightweight, containing only index-level guidance and links to sub-folders. Sub-folder AGENTS.md files are deeper and technology-specific, with conventions, concrete examples, and executable commands. Sub-folder files override root guidance for precise, local context.

When should I create sub-folder AGENTS.md files instead of relying on the root?

Create sub-folder AGENTS.md files for critical packages or directories with distinct technology stacks, build patterns, or dependencies. The nearest-wins hierarchy ensures agents find package-specific guidance first, reducing irrelevant token consumption and improving accuracy.