A production-grade Context Engineering platform optimizing agent retrieval pipelines, token budget allocation, lost-in-the-middle attention windows, and grounded decision synthesis beyond prompt engineering.
- Beyond Prompt Engineering: Replaces blind prompt stuffing with mathematical token budgeting and salience compression.
- Hybrid RRF & Recency Decay: Blends dense semantic vectors with BM25 sparse keyword indices and exponential time decay.
-
Lost-in-the-Middle Mitigation: Positions high-salience knowledge at prompt boundaries where LLM attention is maximal (
$U$ -shaped curve). -
Grounded Decision Attribution: Every generated assertion links to explicit citations (
$[C_i]$ ) with mathematical groundedness scoring. - Interactive Glassmorphic Studio: Live dashboard with token budget sliders, attention layout visualizer, and bilingual (English/Arabic RTL) UI.
┌─────────────────────────┐
│ Enterprise Query │
└────────────┬────────────┘
│
┌────────────▼────────────┐
│ RetrieverAgent │
│ • Dense Semantic Embed │
│ • Sparse BM25 Keywords │
│ • Recency Decay RRF │
└────────────┬────────────┘
│
┌────────────▼────────────┐
│ ContextBuilder │
│ • Salience Compression │
│ • Token Budget Clamp │
│ • Boundary Placement │
└────────────┬────────────┘
│
┌────────────▼────────────┐
│ DecisionAgent │
│ • Grounded Synthesis │
│ • Explicit Citations │
└─────────────────────────┘
# 1. Clone repository
git clone https://github.com/asadullah48/contextx.git
cd contextx
# 2. Install dependencies
pip install -e .
# 3. Run automated test suite
python -m pytest tests -v
# 4. Start local gateway & frontend dashboard
uvicorn contextx.server:app --host 127.0.0.1 --port 8004 --reload- Interactive Dashboard: http://127.0.0.1:8004/
- Swagger OpenAPI Docs: http://127.0.0.1:8004/docs
ContextX turns "what does the agent see" into an engineered, measurable layer:
-
Autonomy —
RetrieverAgent,ContextBuilder, andDecisionAgenteach own one stage of the retrieval-to-answer pipeline and run without manual curation of what goes into the prompt. -
Resilience — hybrid RRF (dense + sparse BM25) with recency decay keeps
retrieval quality stable as the underlying corpus grows or goes stale, and
every assertion carries an explicit citation (
$[C_i]$ ) with a groundedness score instead of an unverifiable claim. - Adaptivity — token budgets are clamped and salience-compressed per query, and high-value context is repositioned at prompt boundaries to counter the lost-in-the-middle attention curve as context size varies.
- Expand the salience-compression scoring beyond the current heuristics
- Add more retrieval backends alongside dense + BM25 hybrid search
- Tighten integration with the sibling agent repos (GuardrailAI, MarketAgentHub, WorkforceAI)
- DevUnity Portfolio: https://asadullahshafique-devunity.vercel.app
- GuardrailAI: https://github.com/asadullah48/guardrailai
- MarketAgentHub: https://github.com/asadullah48/marketagenthub
- WorkforceAI: https://github.com/asadullah48/workforceai
- DomainX: https://github.com/asadullah48/domainx