Why not use a regex in Tinderbox. I made this stamp:
$Name = "[" + $Name.replace("^([^ ]+ \w)(.*)$",$1+"]"+$2);
It works fine on your test strings, such that “⇧⌥⌘ F Menu text
” becomes “[⇧⌥⌘ F] Menu text
”.
Regex ASSUMPTION: the names of notes to be processed take the form of one or more control characters followed by a space followed by a single letter or number followed by a single space and then the rest of the title, e.g. “⌘ L Menu text” or “⇧⌥⌘ F Menu text”.
Regex’s logic: from string start, open back-reference #1, match one or more non-space characters, a space, a single word character†, close back-reference #1, open back-reference #2, match to end of string and close back-reference #2
†. This is generally held to mean a letter or number, i.e. A–Z, a–z, 0–9
I used a stamp for control. If you used an agent action you’d need to add extra code to stop the action occurring a second time on already corrected notes. Either include a query term that ignores notes whose $Name starts with a '[", such as:
$Name.beginsWith("[")==false
Or put a conditional block in the agent action
if($Name.beginsWith("[")==false){
$Name = "[" + $Name.replace("^([^ ]+ \w)(.*)$",$1+"]"+$2);
}