Skip to content

fix: strict expertise keyword matching using word boundaries #4

@rosspeili

Description

@rosspeili

Description

The current expertise scoring logic uses simple substring matching (kw in context_lower). This results in false positives: for example, the keyword "law" will match inside the word "flaw", triggering a legal expert for a design critique.

Reproduction Steps

  1. Create an agent with "law" in their expertise keywords.
  2. Input a message like "There is a minor flaw in this code."
  3. Observe the expertise score for the legal agent increasing incorrectly.

Expected Behavior

Expertise keywords should only match on full words using regex word boundaries (\b). "law" should only match if the standalone word "law" appears in the context.

Priority

High 🔴

Context

Crucial for the accuracy of 'dynamic' session orchestration. Should be implemented in rooms/session.py using re.search(rf"\b{re.escape(kw)}\b", ...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomerssession-logicChanges related to turn orchestration or agent selection.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions