Skip to content

fix: contextual field filtering in interpretResult for core/get-site-…#172

Merged
pluginslab merged 2 commits intodevfrom
fix/79-contextual-site-info-filtering
Mar 27, 2026
Merged

fix: contextual field filtering in interpretResult for core/get-site-…#172
pluginslab merged 2 commits intodevfrom
fix/79-contextual-site-info-filtering

Conversation

@0xLoopTheory
Copy link
Copy Markdown
Collaborator

fix: contextual field filtering in interpretResult for core/get-site-info

Make interpretResult context-aware so small models return focused answers instead of dumping all fields. Uses the userMessage parameter (already passed by the ReAct agent) to detect which fields the user asked about and filters the interpretation accordingly.

Extracts shared FIELD_KEYWORDS map and detectRequestedFields() helper, reused by both interpretResult and parseIntent.

Closes #109

What does this PR do?

Fixes the LLM returning all site info fields when the user asks for a specific one (e.g., "what is my site URL?" now yields only the URL instead of name, tagline, version, email, etc.). The fix filters interpretResult output to match the user's question, so the 1.7B model receives — and relays — only the relevant fields.

Type

  • New ability
  • New workflow
  • Bug fix
  • Enhancement
  • Docs

How to test

  1. Build the plugin: npm run build
  2. Ask "what is my site URL?" — the LLM should respond with just the URL, not all fields
  3. Ask "what is the site name?" — should return only the site name
  4. Ask "tell me about my site" — should still return all fields (general query)
  5. Ask "what is my email and site name?" — should return only those two fields
  6. Run unit tests: npm test — all 88 tests pass, including 17 new contextual filtering tests

Screenshots

image

…info

Make interpretResult context-aware so small models return focused answers
instead of dumping all fields. Uses the userMessage parameter (already
passed by the ReAct agent) to detect which fields the user asked about
and filters the interpretation accordingly.

Extracts shared FIELD_KEYWORDS map and detectRequestedFields() helper,
reused by both interpretResult and parseIntent.

Closes #79

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@0xLoopTheory 0xLoopTheory added the bug Something isn't working label Mar 22, 2026
Copy link
Copy Markdown
Owner

@pluginslab pluginslab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well-structured PR. The shared FIELD_KEYWORDS map and detectRequestedFields() helper cleanly DRY up the field detection logic, and 17 new tests provide good coverage.

One required fix: the test file references #79 but the PR body says #109. Please reconcile the issue number.

Minor suggestions: consider word-boundary matching for keywords like "name" to avoid substring false positives, and add a test for the empty-string userMessage edge case.

#79 was about siteurl and is already closed. #109 is the actual issue
for contextual field filtering in interpretResult.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@pluginslab pluginslab merged commit 46e0099 into dev Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants