Problem
The ReAct agent currently sends ALL registered tool descriptions to the LLM on every request. At 14 tools (~2K tokens) this works fine. At 30+ tools, the tool list alone eats most of the 4096-token context window, leaving no room for reasoning.
Goal
Implement a pre-filtering layer that narrows 30+ tools to the 3-5 most relevant before passing them to the LLM.
Proposed Approach (RLM-inspired)
- Phase 1: Use existing keyword matching + ability descriptions to score and rank candidate tools (no LLM cost, instant)
- Phase 2: Inject only selected tool schemas into the ReAct system prompt
- Phase 3: Add a
search-tools meta-ability so the LLM can request additional tools mid-loop if needed
Key Files
src/extensions/services/message-router.js — existing keyword matching
src/extensions/services/react-agent.js — system prompt construction
src/extensions/services/chat-orchestrator.js — tool list building
Context
Skills needed
AI/ML, JS
Problem
The ReAct agent currently sends ALL registered tool descriptions to the LLM on every request. At 14 tools (~2K tokens) this works fine. At 30+ tools, the tool list alone eats most of the 4096-token context window, leaving no room for reasoning.
Goal
Implement a pre-filtering layer that narrows 30+ tools to the 3-5 most relevant before passing them to the LLM.
Proposed Approach (RLM-inspired)
search-toolsmeta-ability so the LLM can request additional tools mid-loop if neededKey Files
src/extensions/services/message-router.js— existing keyword matchingsrc/extensions/services/react-agent.js— system prompt constructionsrc/extensions/services/chat-orchestrator.js— tool list buildingContext
keywordsarray anddescriptionfield on every ability are the existing indexSkills needed
AI/ML, JS