fix: word-boundary routing + debug route command (#31)

- Replace substring matching with word-boundary regex in route_request()
- "fix the bug" now correctly routes to coder
- Multi-word patterns match if all words appear (any order)
- Add "timmy route" CLI command for debugging routing
- Add route_request_with_match() for pattern visibility
- Expand routing keywords in agents.yaml
- 22 new routing tests, all passing
This commit is contained in:
2026-03-14 19:21:30 -04:00
parent b01c1cb582
commit 67497133fd
4 changed files with 215 additions and 2 deletions

View File

@@ -325,5 +325,19 @@ def voice(
loop.run()
@app.command()
def route(
message: str = typer.Argument(..., help="Message to route"),
):
"""Show which agent would handle a message (debug routing)."""
from timmy.agents.loader import route_request_with_match
agent_id, matched_pattern = route_request_with_match(message)
if agent_id:
typer.echo(f"{agent_id} (matched: {matched_pattern})")
else:
typer.echo("→ orchestrator (no pattern match)")
def main():
app()