route-by-query-shape

Routes relationship-shaped memory_search queries to the knowledge graph backend.

2.5k|415|Updated Mar 28, 2026
One-click install
npx skills add https://github.com/Bitterbot-AI/bitterbot-desktop --skill route-by-query-shape
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: route-by-query-shape
Source: https://github.com/Bitterbot-AI/bitterbot-desktop/tree/main/skills/route-by-query-shape
Command: npx skills add https://github.com/Bitterbot-AI/bitterbot-desktop --skill route-by-query-shape

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Relationship questions like "who did I talk to about Q4?" often fail against vector-based memory search because the answer lives in entity relationships rather than chunk text, causing missed results.

Core Features & Use Cases

  • Query Shape Detection: Watches memory_search calls and detects relationship-shaped queries before execution.
  • Entity Extraction: Extracts the salient entity from the query to target the graph lookup.
  • Backend Rerouting: Redirects the call to the knowledge_graph backend where entity relationships are stored.
  • Use Case: When you ask "who worked with me on project Foo?", the interceptor reroutes the search to the graph backend, returning the correct person instead of irrelevant text chunks.

Quick Start

Ask Bitterbot a relationship question such as "who did I talk to about the Q4 budget?" and the interceptor will route the lookup to the knowledge graph automatically.

Frequently Asked Questions about route-by-query-shape

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

FAQPage Schema
How do I improve memory search results for relationship questions?

Route relationship-shaped queries to a knowledge graph backend instead of vector search. The route-by-query-shape interceptor detects questions like "who did I talk to about X" and redirects memory_search calls to the graph where entity relationships are stored.

Why does vector memory search miss "who did I talk to" questions?

Vector search matches chunk text by semantic similarity, but answers to relationship questions live in entity relationships rather than text chunks. A knowledge graph backend stores these connections explicitly and resolves them correctly.

Does the interceptor run on every memory_search call?

No. It only fires when the query matches a relationship shape, and it is capped at 12 activations per session. Non-relationship queries continue to use the standard vector-based memory_search backend.

Where is the route-by-query-shape interceptor implemented?

The built-in interceptor lives in src/agents/skills/builtin-interceptors/route-by-query-shape.ts. It watches memory_search calls, extracts the salient entity, and modifies the call to target the knowledge_graph backend before execution.

When should I not rely on knowledge graph routing for memory search?

Graph routing only helps for relationship-shaped queries about entities and their connections. For general semantic recall of notes, documents, or conversations, the standard vector-based memory_search remains the appropriate backend.