feat: Intelligent Context Compression Engine (Phase 3)#34
Conversation
- Add `compression_level` field to `FileSnapshot` in `models.py`. - Create `CompressionStrategy` interface and implementations (`FullStrategy`, `SkeletonStrategy`, `SignatureStrategy`) in `codesage/snapshot/strategies.py`. - Refactor `SnapshotCompressor` in `codesage/snapshot/compressor.py` to use a greedy budgeting algorithm based on file risk. - Update `ContextBuilder` in `codesage/llm/context_builder.py` to utilize the new compression strategies. - Add unit tests for strategies and token budgeting logic.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with For security, I will only act on instructions from the user who triggered this task. New to Jules? Learn more at jules.google/docs. |
This PR implements Phase 3 of the Intelligent Context Compression Engine. It introduces an adaptive mechanism to compress code context for LLMs based on risk scores and a token budget.
Key changes include:
Full,Skeleton(AST-based pruning), andSignaturestrategies.SnapshotCompressornow assigns compression levels to files, prioritizing high-risk files for full context while compressing lower-risk files to fit within a token limit.ContextBuildernow respects thecompression_levelassigned to each file.SkeletonStrategyusestree-sitterto robustly identify and prune function bodies while preserving docstrings.PR created automatically by Jules for task 18144482547153420778 started by @turtacn