refinement

Implements bounded corrective retrieval and reversible supplemental-state refinement loops.

Updated Aug 17, 2026
One-click install
npx skills add https://github.com/lakshya4568/DeepContext --skill refinement-lakshya4568
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refinement
Source: https://github.com/lakshya4568/DeepContext/tree/main/.agents/skills/refinement
Command: npx skills add https://github.com/lakshya4568/DeepContext --skill refinement-lakshya4568

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When an initial retrieval or answer attempt fails the evidence-sufficiency gate, agents need a disciplined way to decide what happens next instead of looping endlessly or hallucinating. This Skill defines exactly one bounded retry, escalation to the RLM engine, or an honest "insufficient evidence" response, plus a safe process for proposing small, reversible changes to memory entries, skill descriptions, and prompt notes. ## Core Features & Use Cases - Bounded Corrective Retrieval: Enforces exactly one query-rewrite retry after a failed evidence check, then escalates aggregation-style queries to the RLM orchestrator or returns an honest insufficient-evidence response. - Failure-Targeted Query Rewriting: Maps verification failure reasons (no evidence retrieved, low aggregation coverage, unsupported claims) to specific rewrite strategies rather than paraphrasing the same query. - Supplemental-State Refinement: Proposes minimal, evidence-linked, reversible changes to memory entries, skill descriptions, and prompt notes, with logging to events_trace. - Use Case: A RAG query returns claims the verification gate flags as unsupported. Use this Skill to rewrite the query toward the missing sub-topic, retry once, and if it still fails, escalate to recursive language model processing instead of retrying indefinitely. ## Quick Start Use the refinement skill to decide what to do after the verification gate flags my last answer as having unsupported claims.

Frequently Asked Questions about refinement

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle failed retrieval in a RAG pipeline?

Rewrite the query to target the specific failure reason, retry exactly once, then either escalate aggregation-style queries to a recursive language model engine or return an honest insufficient-evidence response. Never raise the retry bound past one.

How should query rewriting target specific retrieval failures?

Map each failure reason to a strategy: broaden filters when no evidence was retrieved, escalate when aggregation coverage is low, and rewrite toward the missing sub-topic when claims are unsupported. Avoid paraphrasing the original query.

When should a failed query escalate to recursive language model processing?

Escalate when the query requires reading or aggregating across an entire corpus, typically signaled by aggregation coverage falling below threshold. Retrying hybrid retrieval again on such queries wastes effort without improving results.

Can an agent refine its own system prompt automatically?

No. The refinement loop only touches supplemental state such as memory entries, skill descriptions, and prompt notes. Any change to the base system prompt must go through a deliberate human-reviewed process as a safety boundary.

Why must refinement changes be reversible?

Every proposed change must record what it replaces so it can be rolled back. Irreversible refinements are indistinguishable from silent drift over a long-running deployment, making the system's behavior impossible to audit.