How PromptBus Classifies Your Tasks
By PromptBus Team
One of the most common questions we get is: *"How does PromptBus decide whether a task is simple or complex?"*
The short answer: **keyword heuristics**. The longer answer involves signals, confidence scoring, and a safety-first design.
Why Not Use an LLM?
It might seem natural to use a small LLM to classify tasks — after all, that's what we're optimizing for. But there are two problems with that approach:
1. **Latency** — Every request would need a round-trip to an LLM before even being forwarded. That adds 200-500ms per request, defeating the purpose of a transparent proxy.
2. **Cost** — You'd be paying for classification *and* the actual response. That's counterproductive.
Instead, PromptBus uses a lightweight keyword matcher that runs in microseconds.
Signals
The classifier extracts several signals from the last user message:
### 1. Prompt Length (tokens) Short prompts (under 50 tokens) are likely simple questions. Long prompts (200+ tokens) often involve complex reasoning or multi-step instructions.
### 2. Files in Context If the user has added 3+ files to context, they're probably working on something significant — not just asking a quick question.
### 3. Keyword Matches This is the primary signal. We look for keywords that correlate with different task types:
### 4. Tool Calls If Claude is already in a multi-step debugging session (3+ tool calls in the current turn), it's likely a complex task.
### 5. Extended Thinking History If the prior turn used extended thinking, the current task is likely complex.
Confidence Scoring
Each signal contributes to a confidence score (0.0 - 1.0). The default confidence floor is 0.6 — meaning the classifier must be at least 60% confident before any downgrade is allowed.
Safety Guarantees
- If confidence < threshold → no downgrade - If keyword match fails → classified as "unknown" → no downgrade - If classifier throws an error → request passes through unmodified - If the request body is empty or malformed → no classification → no downgrade
This multi-layer safety approach ensures that PromptBus never makes things worse — it can only make them cheaper.