Skip to content

[AI-133][AI-134] Add keyword command routing and help discovery hint#62

Merged
stevenarnold-ed-fi merged 12 commits into
mainfrom
ai-134-commands
Jul 7, 2026
Merged

[AI-133][AI-134] Add keyword command routing and help discovery hint#62
stevenarnold-ed-fi merged 12 commits into
mainfrom
ai-134-commands

Conversation

@roberthunterjr

@roberthunterjr roberthunterjr commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • AI-133: Updates the assistant thread greeting to include a help keyword discovery hint, so users in the agent panel know how to access commands
  • AI-134: Adds keyword-based command routing (help, ask, search, and two-word fiona <command> variants) as alternatives to slash commands, which are unavailable in threads and the Slack agent panel
  • Security: Fixes rate-limit bypass — keyword routing now runs inside handleInteractionWithTelemetry (after handleRateLimitedInteraction), matching the existing app_mention.js pattern; renames argsrawArgs in parseCommandKeyword return with JSDoc sanitization warning

Changes

  • command-handler.js (new) — shared module with parseCommandKeyword, handleHelpViaSay, handleComingSoonViaSay, and text constants
  • message.js — keyword routing moved inside telemetry wrapper, after rate-limit check
  • app_mention.js — keyword routing added inside telemetry wrapper with markInteractionRecorded()
  • assistant_thread_started.js — greeting updated with help keyword hint
  • fiona.js — imports text constants from shared module
  • Tests added/updated across all affected files

Test Plan

  • All 455 unit tests pass (npm test in apps/fiona-slack)
  • Manual: open a new assistant thread → greeting includes "type help" hint
  • Manual: type help in agent panel → help text appears (not ephemeral)
  • Manual: type fiona help in agent panel → same help text
  • Manual: type help me understand X → falls through to LLM normally
  • Manual: rate-limited user types help → receives rate-limit message, not help text
  • Manual: /fiona help in a channel → still works unchanged

🤖 Generated with Claude Code

roberthunterjr and others added 3 commits June 16, 2026 14:57
Introduces a shared command-handler module with parseCommandKeyword so
users can invoke help, ask, and search from the agent panel and channel
threads without relying on slash commands. Exact "help" and prefixed
"ask <args>"/"search <args>" are routed before the LLM; all other text
(e.g. "help me understand X") falls through normally. Updates the
assistant greeting to surface the help keyword as a discovery hint.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extends parseCommandKeyword to recognise the "fiona " prefix so users
can type "fiona help", "fiona ask <question>", or "fiona search <query>"
in the agent panel or a thread without needing an @-mention or slash
command. The prefix is stripped before applying the same disambiguation
rules, so "fiona help me with X" still falls through to the LLM.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Move parseCommandKeyword check in message.js inside handleInteractionWithTelemetry
so keyword commands (help, ask, search) go through rate limiting before responding.
Rename args→rawArgs in parseCommandKeyword return with JSDoc sanitization warning
to prevent silent user-input passthrough when ask/search are wired to the LLM.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ance, fix coming-soon wording

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread apps/fiona-slack/src/listeners/assistant/message.js Outdated
Comment thread apps/fiona-slack/src/listeners/events/app_mention.js Outdated
…word map

Eliminates duplicated if/else routing block from message.js and app_mention.js.
Adding a new keyword now requires a single entry in NOT_YET_TEXT in command-handler.js.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@roberthunterjr

Copy link
Copy Markdown
Contributor Author
image

Here is the /fiona help command in channel

image

This is the help key word in the agent panel

image

And finally, help from the Fiona DM

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds keyword-based command routing to the Fiona Slack assistant so that help, ask <…>, search <…>, and fiona <command> variants work in assistant threads and the agent panel (where slash commands aren’t available), and updates the assistant thread greeting to hint users to type help.

Changes:

  • Introduces a shared command-handler.js module for parsing keyword commands and sending help/coming-soon responses via say().
  • Routes keyword commands inside the existing telemetry wrapper and after rate-limit checks for both assistant thread messages and app_mention events.
  • Updates greeting/help messaging and adds/updates tests for keyword routing behavior and discovery hints.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
apps/fiona-slack/src/listeners/commands/command-handler.js New shared parsing + routing helpers and shared help/coming-soon text constants.
apps/fiona-slack/src/listeners/assistant/message.js Adds keyword routing for assistant thread messages before LLM invocation (post rate-limit).
apps/fiona-slack/src/listeners/events/app_mention.js Adds keyword routing for app mentions before LLM invocation (post rate-limit).
apps/fiona-slack/src/listeners/assistant/assistant_thread_started.js Updates greeting to include a help discovery hint.
apps/fiona-slack/src/listeners/commands/fiona.js Refactors to import shared text constants from the new command-handler module.
apps/fiona-slack/tests/listeners/commands/command-handler.test.js New unit tests for keyword parsing/routing and message constants.
apps/fiona-slack/tests/listeners/assistant/message.test.js Adds keyword routing tests, including rate-limit behavior expectations.
apps/fiona-slack/tests/listeners/events/app-mention.test.js Adds keyword routing tests for mention flows.
apps/fiona-slack/tests/listeners/assistant/assistant-thread-started.test.js Adds test asserting greeting includes a “type help” discovery hint.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/fiona-slack/src/listeners/events/app_mention.js
Comment thread apps/fiona-slack/src/listeners/assistant/message.js
Comment thread apps/fiona-slack/src/listeners/commands/command-handler.js
roberthunterjr and others added 3 commits June 24, 2026 12:13
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…cord telemetry

command-handler.js: re-escape backticks inside the HELP_TEXT template literal.
The previous commit replaced \` with unescaped ` which broke the JS parse and
caused Biome lint failures.

app_mention.js / message.js: remove markInteractionRecorded() from keyword-routing
paths. Previously this suppressed handleInteractionWithTelemetry's finally-block
recordInteraction() call, leaving help/ask/search commands with no telemetry.
Letting the wrapper run its finally block records a standard success interaction.

Tests: update keyword routing tests to reflect that callLLM is skipped and say
is called. Telemetry-finally-block coverage lives in interaction-telemetry.test.js.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…key guard, fire-and-forget capture

- Restore cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 to setup:emulator npm script
- Add DEPLOYMENT_TYPE production guard to interaction-store.js and feedback-store.js getContainer, matching conversation-capture-store.js pattern
- Change captureConversation from await to fire-and-forget (.catch) in app_mention.js and message.js

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread apps/fiona-slack/src/listeners/events/app_mention.js Outdated
Comment thread apps/fiona-slack/package.json Outdated
Comment thread apps/fiona-slack/src/agent/feedback-store.js
@roberthunterjr roberthunterjr marked this pull request as ready for review June 24, 2026 20:03
roberthunterjr and others added 2 commits June 24, 2026 15:10
NODE_TLS_REJECT_UNAUTHORIZED=0 was intentionally removed from this script in a prior PR. Developers set it inline when needed: $env:NODE_TLS_REJECT_UNAUTHORIZED=0; npm run setup:emulator

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The Cosmos DB Emulator uses a self-signed certificate. NODE_TLS_REJECT_UNAUTHORIZED=0 must be set when running setup:emulator. Updates docs/testing-with-cosmos-emulator.md and apps/fiona-slack/README.md to show the correct inline env var pattern, consistent with how it was already documented in apps/usage-report-function/README.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment on lines +11 to +13
/fiona help Show this help message
/fiona ask <question> Ask a question about Ed-Fi (coming soon)
/fiona search <query> Search Ed-Fi documentation (coming soon)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Discussed with Steven A and deciding to remove the /fiona portion from the front to just leave a list of available commands here, then using the "How to reach Fiona" below to communicate how the user can call the commands.

…rip /fiona prefix from HELP_TEXT

- Wrap captureConversation in await/try-catch in both app_mention.js and
  message.js for consistency and uniform error handling
- Remove /fiona prefix from HELP_TEXT command list; bare keyword forms
  (help, ask <question>, search <query>) now shown, with slash-command
  usage explained in the How to reach Fiona section below
- Update tests to assert on Available commands instead of /fiona help

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@roberthunterjr

Copy link
Copy Markdown
Contributor Author

Updated the help text to display the following:

image

@stevenarnold-ed-fi stevenarnold-ed-fi merged commit aa17109 into main Jul 7, 2026
7 checks passed
@stevenarnold-ed-fi stevenarnold-ed-fi deleted the ai-134-commands branch July 7, 2026 19:46
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.

4 participants