Back to corpus
proposalexperiment writeup candidatescore 32

Self-Referential Context Penalization for RAG++ Context Gateway

That creates a failure mode: - the gateway retrieves chunks that are semantically relevant but already present in the prompt - those chunks consume scarce tokens without adding novelty - when the top results are all self-referential, the gateway amplifies echo instead of expanding the reasoning surface

Full HTML reader

Read the full artifact

Open in new tab

Extracted abstract or opening context

## Status - Proposed - Target module: `Desktop/Comp-Core/core/retrieval/cc-rag-plus-plus/rag_plusplus/service/routes/context_gateway.py` - Primary integration point: `_compose_response(...)` inside the Smart Context Gateway ## Problem The current gateway composes Graph Kernel and RAG++ results based on retrieval score and token budget, but it has no awareness of what is already inside the model's active context window. That creates a failure mode: - the gateway retrieves chunks that are semantically relevant but already present in the prompt - those chunks consume scarce tokens without adding novelty - when the top results are all self-referential, the gateway amplifies echo instead of expanding the reasoning surface This spec adds a self-referential penalization stage so the gateway prefers novel, adjacent context over duplicate context. ## Goals - Detect overlap between the current context window and retrieved RAG++ / GK candidates using hash-based approximate similarity. - Penalize candidates in proportion to overlap ratio instead of hard-dropping everything. - Trigger adjacent semantic expansion when the top-k set is mostly self-referential. - Keep Graph Kernel admissibility rules unchanged. - Integrate cleanly into `context_gateway.py` without introducing a new service boundary.

Promotion decision

What has to happen next

Attach run IDs, datasets, metrics, and reproduction commands.

Why this is not always a full paper yet

Corpus pages are public-safe readers for discovered workspace artifacts. They are not automatically final papers. A corpus item becomes a polished paper only after the editable source, evidence checkpoints, references, figures, render path, and release status are attached through the paper schema.