Observed since 21 Oct, 09:43 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
A tool to compress Python code into an Abstract Hierarchical Structure (AHS) to optimize interaction with LLMs.
A tool to compress Python code into an Abstract Hierarchical Structure (AHS), designed to optimize code analysis and interaction for Large Language Models (LLMs).
LLMs have a limited context window. Analyzing or modifying large code repositories is inefficient and often impossible, as the full source code doesn't fit into the model's prompt.
AHS-Compressor addresses this problem through "context compression." It doesn't reduce the file size but transforms the code into a high-level structure (the AHS) and a corresponding code map. This allows an LLM to:
libCST).libCST, all comments, whitespace, and code structure are kept intact.ahs-cli) for local use and a web API (FastAPI) for integrations.pip.AHS-Compressor is a free and open-source project that requires significant time and effort to maintain and improve. If you find this tool useful, please consider supporting its development. Your sponsorship helps me dedicate more time to building new features, writing documentation, and providing support to the community.
You can become a sponsor through GitHub Sponsors. Every contribution is greatly appreciated!
To install the tool and its dependencies, you can use pip directly from the repository (once uploaded) or from your local copy.
# Install in editable mode from the local directory
cd /path/to/py-ahs-lmstudio
pip install -e .
This will install all dependencies and make the ahs-cli command available in your system.
The CLI is the primary way to interact with the tool to compress and decompress projects.
1. Encode an entire project:
# Encodes the 'my_project' directory and saves the output to 'compressed_project.json'
ahs-cli encode ./my_project -o compressed_project.json
2. Decode a project:
# Reads 'compressed_project.json' and restores the code in the 'my_project_restored' directory
ahs-cli decode compressed_project.json -o ./my_project_restored
The application also includes a FastAPI for integrations.
To start the server:
# Make sure you have uvicorn installed (it's in the dependencies)
uvicorn app.main:app --reload
The server will be available at http://localhost:8000.
Main Endpoints:
POST /compress-text: Compresses a code snippet sent in the request body.POST /decompress-text: Decompresses an AHS and map sent in the request body.GET /health: A status endpoint to check if the API is running.To contribute to the project, clone the repository, install the dependencies in editable mode as shown above, and start making changes.
pypistats · 40 observations shown. Missing days are unknown. Source category: overall: without mirrors.
| Date / source period | Value | Observed at |
|---|---|---|
| 2026-10-20 – 2026-10-20 | 1 | 2026-10-21T12:37:17.8059096Z |
| 2026-10-18 – 2026-10-18 | 1 | 2026-10-21T12:37:17.8059096Z |
| 2026-10-14 – 2026-10-14 | 4 | 2026-10-21T12:37:17.8059096Z |
| 2026-10-13 – 2026-10-13 | 9 | 2026-10-21T12:37:17.8059096Z |
| 2026-10-12 – 2026-10-12 | 8 | 2026-10-21T12:37:17.8059096Z |
| 2026-10-09 – 2026-10-09 | 1 | 2026-10-21T12:37:17.8059096Z |
| 2026-10-08 – 2026-10-08 | 1 | 2026-10-21T12:37:17.8059096Z |
| 2026-10-07 – 2026-10-07 | 1 | 2026-10-21T12:37:17.8059096Z |
| 2026-10-06 – 2026-10-06 | 1 | 2026-10-21T12:37:17.8059096Z |
| 2026-10-03 – 2026-10-03 | 1 | 2026-10-21T12:37:17.8059096Z |
| 2026-10-02 – 2026-10-02 | 1 | 2026-10-21T12:37:17.8059096Z |
| 2026-09-30 – 2026-09-30 | 1 | 2026-10-21T12:37:17.8059096Z |
| 2026-09-28 – 2026-09-28 | 2 | 2026-10-21T12:37:17.8059096Z |
| 2026-09-27 – 2026-09-27 | 1 | 2026-10-21T12:37:17.8059096Z |
| 2026-09-26 – 2026-09-26 | 1 | 2026-10-21T12:37:17.8059096Z |
| 2026-09-21 – 2026-09-21 | 9 | 2026-10-21T12:37:17.8059096Z |
| 2026-09-19 – 2026-09-19 | 2 | 2026-10-21T12:37:17.8059096Z |
| 2026-09-15 – 2026-09-15 | 6 | 2026-10-21T12:37:17.8059096Z |
| 2026-09-08 – 2026-09-08 | 1 | 2026-10-21T12:37:17.8059096Z |
| 2026-09-07 – 2026-09-07 | 2 | 2026-10-21T12:37:17.8059096Z |
| 2026-09-06 – 2026-09-06 | 6 | 2026-10-21T12:37:17.8059096Z |
| 2026-09-02 – 2026-09-02 | 1 | 2026-10-21T12:37:17.8059096Z |
| 2026-09-01 – 2026-09-01 | 1 | 2026-10-21T12:37:17.8059096Z |
| 2026-08-31 – 2026-08-31 | 1 | 2026-10-21T12:37:17.8059096Z |
| 2026-08-28 – 2026-08-28 | 4 | 2026-10-21T12:37:17.8059096Z |
| 2026-08-25 – 2026-08-25 | 1 | 2026-10-21T12:37:17.8059096Z |
| 2026-08-24 – 2026-08-24 | 8 | 2026-10-21T12:37:17.8059096Z |
| 2026-08-23 – 2026-08-23 | 3 | 2026-10-21T12:37:17.8059096Z |
| 2026-08-21 – 2026-08-21 | 1 | 2026-10-21T12:37:17.8059096Z |
| 2026-08-17 – 2026-08-17 | 2 | 2026-10-21T12:37:17.8059096Z |
| 2026-08-15 – 2026-08-15 | 2 | 2026-10-21T12:37:17.8059096Z |
| 2026-08-14 – 2026-08-14 | 2 | 2026-10-21T12:37:17.8059096Z |
| 2026-08-09 – 2026-08-09 | 4 | 2026-10-21T12:37:17.8059096Z |
| 2026-08-08 – 2026-08-08 | 1 | 2026-10-21T12:37:17.8059096Z |
| 2026-08-04 – 2026-08-04 | 2 | 2026-10-21T12:37:17.8059096Z |
| 2026-08-02 – 2026-08-02 | 1 | 2026-10-21T12:37:17.8059096Z |
| 2026-07-31 – 2026-07-31 | 1 | 2026-10-21T12:37:17.8059096Z |
| 2026-07-27 – 2026-07-27 | 2 | 2026-10-21T12:37:17.8059096Z |
| 2026-07-26 – 2026-07-26 | 3 | 2026-10-21T12:37:17.8059096Z |
| 2026-07-23 – 2026-07-23 | 2 | 2026-10-21T12:37:17.8059096Z |
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 2.0.3 | 20 Jul 2025 | 3 |
This describes our collected data; it is not a security assessment.
Observed since 21 Oct, 09:43 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:2967cd14a8ede0387d38f8a27d182891a0c11362a22d07f43d2803b6d56a23c6