feat(agent): answer when the family says its name, not just @-mentions - #56
Conversation
In a group room the agent only replied to an autocompleted Matrix pill, so "Stacky, what's on our list?" was dropped before it saw it. That is the way everyone who does not know what a pill is talks to it. Being addressed by the configured name now counts as a mention: at the start of a message, or tacked on the end, case-insensitively, and after a greeting. A name in the middle of a sentence does not, so the agent stays out of conversations about it. Replies are handled too, since Matrix puts the quoted message first in the body. The name comes from AGENT_NAME, so renaming the agent to "Kit" makes it answer to "kit, whats on the list" with no code change.
|
Verified on the demo rig with the real container and real Matrix, not just the stub. The shim is live against the installed nanobot: Two messages sent into a 3-member room as homer, seconds apart: Only one was picked up: The unaddressed one produced no processing line at all. (The turn then fails on Red-checked both ways: the matcher spec caught a real bug on first run ( Unit lane: 2182 passed, 8 skipped. ruff clean. One deliberate tradeoff worth a reviewer's eye: a sentence opening with the name in third person reads as an address, so "Stacky got that wrong yesterday" gets a reply. Requiring punctuation after the name would fix that and would also drop "Stacky whats on our list", which is the likeliest thing anyone types. Documented in the module docstring. |
In a group room the agent only replied to an autocompleted Matrix pill, so "Stacky, what's on our list?" was dropped before it saw it. That is how everyone who does not know what a pill is talks to it.
Being addressed by the configured name now counts as a mention: at the start of a message or tacked on the end, case-insensitively, and after a greeting. A name mid-sentence does not, so the agent stays out of conversations about it. Replies are handled too, since Matrix puts the quoted message first in the body.
The name comes from
AGENT_NAME, so renaming the agent makes it answer to the new name and stop answering to the old one, with no code change.Implemented as a
sitecustomizeshim like the existing ones, with the patched symbol added to the PIN list so a nanobot upgrade that moves it fails the unit lane.