AgentSkillsCN

Context Query Rewrite

上下文查询改写

SKILL.md

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 lane field)
  • 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:

  1. Extract key concepts and intent
  2. Add lane-specific filters
  3. Determine if query needs recent context (last 90 days) or all-time context