Skip to content

[dev] feat: per-agent mention detection, sender context, and reply handling#6

Closed
sherodtaylor wants to merge 5 commits into
mainfrom
feat/sender-context-and-mention-clarity
Closed

[dev] feat: per-agent mention detection, sender context, and reply handling#6
sherodtaylor wants to merge 5 commits into
mainfrom
feat/sender-context-and-mention-clarity

Conversation

@sherodtaylor

@sherodtaylor sherodtaylor commented May 24, 2026

Copy link
Copy Markdown
Owner

What was asked

  • Ensure each agent responds when mentioned (including via Element X display-name links)
  • Reply context: respond when mentioned in a reply, or when the message being replied to was sent by that agent
  • Personalise responses based on who is speaking (sender context)
  • Rules should live in each agent's own CLAUDE.md

What changed

agents/devbot/CLAUDE.md and agents/infrabot/CLAUDE.md

Each file now has a "When to respond" section with three explicit triggers:

  1. Direct mention — name appears anywhere in raw message text (plain text, markdown link, or full Matrix ID). Concrete Element X link example is included so the agent recognises the [name 💕](https://matrix.to/...) form.

  2. Reply to own message — the plugin surfaces a quoted > block; if the original message was sent by that agent's Matrix ID, the agent responds and incorporates the original context.

  3. Mention inside a reply — name appears in reply text (same as trigger 1, just clarified in reply context).

Each file also has a "Sender context" section instructing the agent to read the sender attribute from the <channel> tag:

  • @sherod → team lead, address directly and concisely
  • Peer agent → colleague, follow loop-prevention rules
  • Unknown → guest, helpful but cautious

How to verify

  1. Send @infrabot check cluster status in Element X → InfraBot replies.
  2. Reply to one of InfraBot's messages without mentioning it → InfraBot replies (reply-to-own-message trigger).
  3. @devbot what's the status? in a thread → DevBot replies and references thread context.
  4. Neither bot replies to a bare check cluster with no name.
  5. Bots address Sherod by name/directly rather than generically.

🤖 Generated with Claude Code

devbot and others added 3 commits May 24, 2026 03:17
- Replace vague "display name" hint with a concrete example of Element X's
  markdown link format so bots reliably detect mentions in that form.
- Add Sender context section so bots know who they are speaking with and
  can personalize responses (sherod = team lead, agents = peers, etc.).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add to each agent's CLAUDE.md:
- Explicit name-matching rules (plain text, markdown link, full Matrix ID)
  with a concrete Element X link example for that agent's identity.
- Reply-context trigger: respond when a Matrix reply targets the agent's
  own prior message, incorporating the quoted context in the response.
- Sender context: read the `sender` attribute and address @sherod directly,
  treat peer agents as colleagues, and guests with caution.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sherodtaylor sherodtaylor changed the title [dev] fix mention detection + add sender context to shared CLAUDE.md [dev] feat: per-agent mention detection, sender context, and reply handling May 24, 2026
devbot and others added 2 commits May 24, 2026 03:42
- Add '## Message verbosity' section to shared CLAUDE.md: 1-2 sentence
  cap for confirmations, bullets for multi-item info, no filler openers.
- Add UserPromptSubmit hook to shared settings.json that injects an
  additionalContext verbosity reminder on every incoming Matrix message,
  reinforcing the CLAUDE.md rules at the hook layer.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Never print/echo/log secrets. Generate and pipe directly to destination.
Redirect sensitive stdout to /dev/null or the consuming tool.

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

Copy link
Copy Markdown
Owner Author

Closing — superseded by a clean branch off main. The unique changes (secret handling + verbosity hook) are in a new PR.

sherodtaylor added a commit that referenced this pull request May 26, 2026
Dockerfile sets zsh as root's default shell (chsh -s /bin/zsh root).
entrypoint.sh starts both panes explicitly with zsh instead of bash.

The previous bash workaround was added to avoid dotfiles .zshrc sourcing
workspace paths that don't exist in the container. That root cause is
addressed in sherodtaylor/dotfiles PR #6 (guarded source calls + bootstrap.sh
for proper curl|bash install). With that fix in place, zsh panes work as
intended.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
sherodtaylor pushed a commit that referenced this pull request Jun 27, 2026
- Move file to docs/product/agent-smith/prds/ — agent-smith is an
  external product with its own product-area home (D2 reworded;
  homelab references removed per Sherod 2026-06-27).
- Drop NATS publishing from v1 per devbot's YAGNI consult; lock the
  transport-agnostic JSON schema in D10 + AC body so dropping it onto
  NATS later is additive.
- Loosen latency AC to ~30s for v1 polling, tightens to ~5s when
  sidecar moves to Claude Code hook registration (finding #4).
- Fix Open Q #2: claude --output-format=json is response output, not
  state events — point at Claude Code hooks instead (finding #3).
- Add herdr-vocabulary interop note to D6 (finding #6).
- Add Tailscale prereq to AC #1 (nit).
- Clarify brandbot consumer is out of scope (nit).
- Add explicit per-tool-call telemetry non-goal.
- Revision history section.

Co-Authored-By: Claude Opus 4.7 <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