←Back/Engineering/Jev
AdvancedEngineering

How to Build a Smart Command Bar and App Router with Jev

Create an intelligent command bar (Command-K) that not only finds tools but executes actions within them from a single natural language query. Use a layered decision model to route requests to the right app and then to the right function.

How to Build a Smart Command Bar and App Router with Jev

Before you start

Tools used

  • Jev

    TypeSafe AI’s model for fast structured decisions, including choices, scores, and boolean probabilities.

    VisitJev

Step by step

The workflow

Follow the sequence once, then adapt the prompts, checks, and handoffs to your own setup.

6 steps

Step01

Define Your Tools

Identify the distinct applications or features within your product that can be controlled via the command bar (e.g., 'To-Do App', 'Calendar', 'Search').

Step02

Build the First Layer: Tool Router

Configure the top-level Jev decision call. Its job is to take the user's full text query and identify which of your defined tools is the target. It should handle typos and fuzzy matches (e.g., matching 'to-do' to the 'To-Do App').

Step03

Build the Second Layer: Action Router

For each tool, configure a second Jev decision call. This model's scope is limited to the actions available within that specific tool (e.g., createTask, markAsComplete).

Step04

Process the User Query

When a user types a command, first pass it to the Tool Router (Layer 1). Once the correct tool is identified, pass the rest of the command to that tool's specific Action Router (Layer 2).

Example prompt
Go to the to-do app and mark all the pull requests as low priority.
Step05

Identify Action and Parameters

The Action Router (Layer 2) will parse the remaining text to identify the specific function to call (mark as low priority) and any necessary parameters or targets (all the pull requests).

Step06

Execute the Final Command

With the tool, action, and parameters identified, execute the final command within your application's logic.

This layered or stacked approach is highly scalable. You can build abstractions by wrapping small tools with Jev layers, allowing you to create complex behaviors from simple building blocks.

Build your next product with ChatPRD

Turn an idea into a PRD, user stories, and a plan.

Try ChatPRD free

Start shipping
better products.

Join 100,000+ product managers who use ChatPRD to write better docs, align teams faster, and build products users love.

Free to start
No credit card
SOC 2 certified
Enterprise ready