Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

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:

  1. Compression Strategies: Defined Full, Skeleton (AST-based pruning), and Signature strategies.
  2. Risk-Based Budgeting: The SnapshotCompressor now assigns compression levels to files, prioritizing high-risk files for full context while compressing lower-risk files to fit within a token limit.
  3. Context Building: The ContextBuilder now respects the compression_level assigned to each file.
  4. Tree-sitter Integration: SkeletonStrategy uses tree-sitter to robustly identify and prune function bodies while preserving docstrings.

PR created automatically by Jules for task 18144482547153420778 started by @turtacn

- 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.
@google-labs-jules
Copy link
Contributor Author

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

@turtacn turtacn merged commit 2a12d86 into master Nov 23, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants