Create a rules file under /etc/udev/rules.d/ with a name like 99-mydevice.rules (lower numbers take precedence).
Match the device using attributes: SUBSYSTEM=="usb", ATTR{idVendor}=="<VENDOR_ID>", ATTR{idProduct}=="<PRODUCT_ID>" — find values with udevadm info --attribute-walk /dev/bus/usb/<BUS>/<DEV>.
Add an ACTION=="add" condition to fire only on plug-in; use ACTION=="remove" for unplug.
Use SYMLINK+="mydevice" to create a stable /dev/mydevice symlink, or RUN+="/usr/local/bin/on_device_connect.sh" to execute a script.
Reload rules and trigger re-evaluation without rebooting: udevadm control --reload && udevadm trigger
Known gotchas
RUN scripts executed by udev run as root in a very restricted environment with no TTY; scripts must be fully self-contained with absolute paths and should log to a file rather than stdout.
Attribute matching is case-sensitive and values must match exactly as reported by udevadm info; a single character mismatch silently skips the rule.
Rules files are processed in lexicographic filename order; place custom rules in /etc/udev/rules.d/ (not /lib/udev/rules.d/) so they survive package updates.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp