DEV Community

Atul Srivastava
Atul Srivastava

Posted on

I built a VS Code extension that auto-selects Ask/Plan/Agent mode for every Copilot prompt

If you use GitHub Copilot, you've probably noticed something: most developers leave it on Agent mode all the time. It's the default. It feels powerful. But it's also expensive — Agent mode burns through 3,000+ tokens even for a question like "what does useState do?"

Ask mode handles that in ~500 tokens. But who switches manually every time?

That's the problem I built Prompt Router to solve. It watches your prompt, classifies it in milliseconds, and opens Copilot in the right mode automatically — no clicks, no thinking, no token waste.


How it classifies prompts

It uses a hybrid approach: a heuristic keyword classifier blended 40/60 with a Naive Bayes ML model. Both run entirely locally — no network calls, no telemetry, nothing leaves your machine.

Mode Triggered by Approximate token cost
Ask Explanations, definitions, debugging concepts ~500 tokens
Plan Architecture, design, step-by-step approach ~800 tokens
Agent Write/fix/create code, run terminal commands ~3,000+ tokens

The ML model also learns from your corrections. Every time you dismiss or override its suggestion, it adjusts. Over time it personalises to how you actually write prompts.


The three ways to use it

1. Ctrl+Shift+R quick input (recommended)
Press the shortcut, type your prompt, and VS Code opens Copilot in the right mode with your prompt pre-filled. Zero friction.

2. @smart participant
In any Copilot chat, type @smart followed by your question. It shows the detected mode label and a one-click button if you want to switch.

3. @router participant
Type @router to get a full score breakdown — Ask / Plan / Agent percentages — so you can see exactly why it made the call it did.

There's also a Token Savings Dashboard in the Command Palette that shows your cumulative savings over time.


The license system

It's a one-time purchase: $2.9 / ₹19. You get a license key instantly by email. Paste it into VS Code once (Prompt Router: Activate License), and it works forever — no subscription, no cloud check-in.

The key is a JWT signed with RSA-256. The extension verifies it offline using a baked-in public key. Up to 3 device activations; you can deactivate any slot at any time.


Links

Dropped this last week. Would love feedback — especially if you've got ideas on improving the classifier for edge cases.

Top comments (0)