Qompressor
The Qompressor agent is the “Skeletonizer” for QonQrete. It creates lightweight structural representations of the codebase, mirroring qodeyard into bloq.d with implementation details stripped out.
How it works
1. Input and Output:
- Takes
source_dir(typicallyqodeyard) anddest_dir(typicallybloq.d) - Expects
qodeyardto be the source of full code
2. Directory Mirroring and Cleaning:
- Aggressively cleans
bloq.dby removing its entire contents - Recreates fresh directory structure
- Ensures
bloq.dis always an up-to-date mirror
3. File Processing Logic:
Files are categorized by filename and extension:
- COPY_FILENAMES: Files like
Dockerfile,Makefilecopied as-is (critical context, low tokens) - COPY_EXTENSIONS: Files like
.yaml,.json,.mdcopied as-is - COMPRESS_EXTENSIONS: Code files (
.py,.js,.go) undergo compression
4. Compression Methods:
Python (compress_python):
- Uses Python AST to parse code
- Keeps: import statements, class definitions, function/method signatures, docstrings
- Strips: Implementation bodies → replaced with
# ... (body stripped by Qompressor) ...
Generic (compress_generic):
- Regex-based approach for other languages
- Keeps: comments, structural keywords (
function,class,def), block openers - Less precise than AST but still effective
Benefits
- Token Cost Reduction: Dramatically reduces context token count
- Architectural Focus: LLMs focus on structure and interfaces, not implementation details
- Speed: Fast and deterministic processing
What’s configurable
Internal Configuration:
COMPRESS_EXTENSIONS(set): File extensions for compressionCOPY_EXTENSIONS(set): File extensions for direct copyCOPY_FILENAMES(set): Specific filenames for direct copy
Implicit via config.yaml:
options.use_qompressor(boolean): Whether Qrane runs Qompressor at all