Skip to content

Unify agent entry point with natural language routing#25

Open
cpetersen wants to merge 2 commits intoagent-loopfrom
unified-agent-loop
Open

Unify agent entry point with natural language routing#25
cpetersen wants to merge 2 commits intoagent-loopfrom
unified-agent-loop

Conversation

@cpetersen
Copy link
Copy Markdown
Member

Summary

Eliminates the split between /query (RAG) and /code (agent) — all input now goes through a single Agent that decides whether to search documents or write code based on natural language.

SearchDocs Tool

  • Wraps the RAG retrieval pipeline as a RubyLLM::Tool
  • Returns retrieved context + sources (not LLM-generated answer) so the Agent synthesizes its own response — avoids double-LLM problem
  • New retrieve_context public method on QueryProcessor (DRY extraction of steps 1-5)

Unified Default Handler

  • TUI routes all natural language input through a cached Agent + Orchestrator
  • "What is our password policy?" → Agent calls search_docs
  • "Create fizzbuzz.rb and run it" → Agent uses write_file + bash_exec
  • /query and /code still work as explicit alternatives

Lite Tool Set for Local Models

  • Small local models (Qwen3-8B) get overwhelmed with 9 tools + long descriptions — they output only <think> blocks
  • Lite set: 4 tools with minimal descriptions (LiteReadFile, LiteWriteFile, LiteBashExec, LiteTaskComplete)
  • Agent auto-selects: red_candle → LITE (4 tools), cloud providers → ALL (9 tools)
  • Tested: Qwen3-8B successfully writes files, runs bash, and calls task_complete through the full loop

Other

  • Profile switching clears cached agent/orchestrator
  • /no_think added to Agent system prompt
  • System prompt guides LLM on when to use knowledge base vs coding tools

Test plan

  • 392 specs, 0 failures
  • Qwen3-8B with lite tools: writes files, runs commands, calls task_complete
  • Opus with full tools: all 9 tools work
  • /query and /code still work as explicit commands
  • Profile switching clears and rebuilds agent

🤖 Generated with Claude Code

cpetersen and others added 2 commits March 30, 2026 10:44
…ting

The Agent now decides whether to search documents or write code based on
the user's natural language input. No more choosing between /query and /code.

SearchDocs tool:
- Wraps RAG retrieval pipeline (steps 1-5) as a RubyLLM::Tool
- Returns retrieved context + sources (not LLM-generated answer) to avoid
  double-LLM problem — the Agent synthesizes its own answer
- New retrieve_context public method on QueryProcessor (DRY extraction)

Unified default handler:
- Interactive mode routes all input through cached Agent + Orchestrator
- Agent system prompt guides LLM: questions → search_docs, tasks → coding tools
- Profile switching clears cached agent/orchestrator
- /query and /code still work as explicit alternatives

392 specs, 0 failures (5 new)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Small local models (Qwen3-8B) get overwhelmed when 9 tools with long
descriptions are registered — they output only <think> blocks without
making any tool calls. With 4 tools and short descriptions, they work
reliably.

Lite tools (for red_candle provider):
- LiteReadFile, LiteWriteFile, LiteBashExec, LiteTaskComplete
- Minimal descriptions ("Write a file", "Run a bash command")
- Same functionality, fewer tokens in the tool schema

Agent auto-selects tool set based on provider:
- red_candle → LITE (4 tools, short descriptions)
- anthropic/openai/etc → ALL (9 tools, full descriptions)

Tested: Qwen3-8B successfully writes files, runs bash, and calls
task_complete through the full Agent → Orchestrator loop.

392 specs, 0 failures

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant