OpenParable
Skip to content
← Back to skills

Contextpilot

Agent Building
contextpilot

Contextpilot is an Agent Skill for agent building published in the EfficientContext/ContextPilot repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Optimize document ordering in LLM context for better retrieval performance

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/EfficientContext/ContextPilot/blob/HEAD/examples/openclaw/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/contextpilot, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

ContextPilot Integration

You have ContextPilot enabled as a transparent proxy. All your LLM API requests are automatically routed through ContextPilot, which reorders documents in your context window for optimal retrieval performance.

What ContextPilot Does

When your request contains multiple documents (in system prompts or tool results), ContextPilot:

  1. Extracts documents from XML tags (<documents>, <files>, etc.), numbered lists, separators, or markdown headers
  2. Clusters documents by semantic similarity using hierarchical clustering
  3. Reorders documents to minimize attention distance between related content
  4. Reconstructs the request preserving the original format

Supported Document Formats

  • XML tags: <documents><document>...</document></documents>, <files><file>...</file></files>
  • Numbered: [1] doc [2] doc [3] doc
  • Separator: docs separated by --- or ===
  • Markdown headers: sections split by # or ## headers

How to Verify

Check the X-ContextPilot-Result response header:

X-ContextPilot-Result: {"intercepted":true,"documents_reordered":true,"total_documents":5,"sources":{"system":1,"tool_results":1}}

Configuration Headers

Send these headers with your API requests to control behavior:

HeaderValuesDefault
X-ContextPilot-Enabledtrue/falsetrue
X-ContextPilot-Modeauto/xml_tag/numbered/separator/markdown_headerauto
X-ContextPilot-Scopeall/system/tool_resultsall
X-ContextPilot-Alphafloat0.001