import io

p = r'C:\Users\decid\Documents\projects\spt-claude-code\adapter\strings\briefs\messaging-perch.md'
s = io.open(p, encoding='utf-8').read()
NL = chr(10)

old_head = 'Shortform — embed a tag in your OWN reply text and the adapter sends it for you (no shell tool needed):'
new_head = 'Shortform — embed a tag in your OWN reply text and it is sent for you (no shell tool needed):'
assert s.count(old_head) == 1
s = s.replace(old_head, new_head)

old = s[s.index('- Peer message: `@<t1,t2 body @>`'):]
old = old[:old.index(NL)]

new = (
 "- Peer message: `@<t1,t2 body @>` — the `@<` opens, comma-separated ids run to the first space "
 "(no spaces inside the id list), the body runs to the first `@>`. Each id is delivered `body`. "
 "Several blocks in one reply all fire, and a tag that never closes sends nothing — an author still "
 "typing has not dispatched anything. Write the tag BARE: a tag inside backticks or a fenced code "
 "block is a quotation and fires nothing, so you can show an example safely. **Outcomes arrive in "
 "the `<DISPATCH_RESULTS>` section of your next turn's briefing — that is the only place they are "
 "reported.** A dispatch does not echo into your output and prints no confirmation line, so seeing "
 "nothing back in the same turn does NOT mean unsent; never resend on that basis. This is the "
 "FASTEST method for short messages and replies to one or more agents; longer messages should use "
 "the `spt send` CLI above when you have shell access.\n"
 "- Seal a passage: wrap it in a pair of `;;` markers and the wax-seal ceremony runs over exactly "
 "that text. Each pair is its own ceremony. A marker with no partner seals everything after it "
 "through the end of your output — which works at a turn's end but is REFUSED mid-turn "
 "(`SEAL_BARE_MIDTURN`), because mid-turn there is no end yet to seal up to and a short seal looks "
 "exactly like a correct one. Close the pair and it mints anywhere. The same backtick/fence "
 "suppression applies."
)
s = s.replace(old, new)

io.open(p, 'w', encoding='utf-8', newline=NL).write(s)
print('brief updated')
