context-engine  by melonelish

Context compression engine for LLM inputs

Created 3 weeks ago

New!

320 stars

Top 84.4% on SourcePulse

GitHubView on GitHub
Project Summary

Context Engine addresses the challenge of noisy, lengthy, and disorganized context in LLM applications like Agents, RAG, and AI Coding. It provides a task-aware compression layer that preprocesses input, transforming raw data into high-signal, structured context optimized for LLM consumption, thereby improving efficiency and accuracy.

How It Works

The core pipeline standardizes inputs into ContextItem lists, deduplicates content, applies budget constraints, and then utilizes task-specific compressors. The logs compressor identifies root causes and folds noise; rag reorders retrieved chunks by relevance to the question; code prioritizes hotspot files and failure signals from issues or test outputs. This approach creates interpretable, budgetable, and consumable context, moving beyond simple summarization to targeted engineering.

Quick Start & Requirements

Requires Python 3.11-3.13 and pip. Installation can be done via editable install (python -m pip install -e .[dev,mcp]) or PyPI (python -m pip install "melonelish-context-engine[mcp]"). Examples can be run using python -m pytest -q. A CLI tool (context-engine) and an MCP server (context-engine-mcp) are provided for local processing and integration.

Highlighted Details

  • Supports three primary modes: logs (root cause analysis), rag (question-aware evidence reordering), and code (focused AI coding context).
  • Offers CLI, Python API (SDK), and MCP Server interfaces for flexible integration.
  • Outputs a structured JSON envelope indicating success or failure, including summary, key facts, and LLM-ready context.
  • Implements safety boundaries for input size (text length, list items, file size) to prevent payload abuse.
  • Includes benchmark case and result files for regression testing and demonstration.

Maintenance & Community

Continuous integration is handled via GitHub Actions, running installation, tests, and benchmark generation on pushes and pull requests. The roadmap includes enhancing RAG capabilities, improving code analysis, expanding benchmarks, and formalizing releases. No explicit community channels (e.g., Discord, Slack) are listed in the provided text.

Licensing & Compatibility

The project is licensed under the MIT License, which permits broad use, including commercial applications and linking within closed-source projects.

Limitations & Caveats

Currently in an "early beta" state, suitable for trials and validation rather than full production deployment. It does not support binary inputs like PDF, images, or Office files. Advanced features like embedding-aware reranking, robust code analysis, and production-grade monitoring are planned for future releases.

Health Check
Last Commit

2 weeks ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
321 stars in the last 24 days

Explore Similar Projects

Feedback? Help us improve.