Context Query Rewrite Skill
Rewrites user queries for better semantic retrieval by:
- •Extracting intent from natural language
- •Adding lane/domain filters automatically
- •Inferring temporal windows (recent vs. all-time)
Phase
pre_retrieval - Runs before semantic search retrieval
Priority
10 (runs early in pre-retrieval phase)
Activation
- •Lanes: ops (via
lanefield) - •Modes: COO, CFO (via
activation.modes) - •Agent Types: cursor, codex (via
activation.agent_types)
Mutations
- •
rewrite_query- Transforms the user query into a better retrieval query
Example
Input:
json
{
"user_query": "how do we deploy?",
"lane": "ops",
"agent_type": "cursor"
}
Output:
json
{
"rewritten_query": "deployment process configuration",
"filters": {
"lane": "ops",
"source": "chatgpt"
},
"time_window": 90
}
Implementation
Located at: app/services/chat-gateway/context_engineering/skills/query_rewrite.py
The skill analyzes the user query to:
- •Extract key concepts and intent
- •Add lane-specific filters
- •Determine if query needs recent context (last 90 days) or all-time context