The hierarchical context compressor (hcc) is a CLI tool designed to create AI-optimized hierarchical context maps for codebases. It's easy to install and run, offering a workflow that can integrate seamlessly into GitHub Actions. With its three-phase generation process, hcc produces concise operational manuals tailored to the structure of your project.
The hierarchical-context-compressor is a Command-Line Interface (CLI) tool designed to generate AI-optimized hierarchical context maps for any codebase. This project can be executed locally or integrated into CI workflows using GitHub Actions. It efficiently processes the structure of a codebase to create operational manuals that facilitate better understanding and usage of the code.
Key Features
- Comprehensive Documentation: Generates a root agents.md file, which acts as a table of contents, supplemented by per-directory AGENTS.md operational manuals. For web applications, additional file llms.txt is created at the root level.
- Three-Phase Generation Flow: The tool operates in three phases:
- An AI model selects directories for the creation of AGENTS.md.
- A discovery step identifies which files to analyze within those directories.
- The generation phase produces the concise content for the AGENTS.md files, providing overviews and operational guidance.
Usage
To utilize hcc on any repository:
- Install the tool from Git:
uv tool install git+https://github.com/reyavir/hierarchical-context-compressor.git - Set the OPENAI_API_KEY in your environment.
- Execute the tool on a specified codebase:
This command generates the required documentation.
hcc --root /path/to/your/repo - Optionally, preview changes without writing output files:
hcc --root /path/to/your/repo --dry-run
Customization
Support for custom prompts per folder type allows adjusting templates for different contexts, enhancing the specificity of generated content.
CLI Options
The tool includes several configurable options to customize the analysis and generation process, such as specifying the repository root and selecting different AI models for discovery and generation.
Integration with GitHub Actions
hierarchical-context-compressor can be seamlessly integrated into a CI pipeline. A configuration file can be created within .github/workflows/ to automate the process of running the tool and committing changes to documentation as the codebase evolves. The required environment secret, OPENAI_API_KEY, must be added to the repository settings.
Development
For those interested in contributing to the hierarchical-context-compressor codebase, the source code can be cloned and developed locally. The CLI can be executed directly from the local copy, enabling testing and modification of its functionality.
No comments yet.
Sign in to be the first to comment.