from pathlib import Path p=Path('/root/.openclaw/workspace/AGENTS.md') text=p.read_text(encoding='utf-8') old='''Required behavior: - When user asks to push result to Feishu Bitable, run write action first (feishu_bitable_create_record or feishu_bitable_update_record). - In final reply, always include: 1) push status (success/failed) 2) target sheet link (the user-provided wiki/base URL) 3) written record_id (or updated count) - If write partially fails, return succeeded records and failed reason list separately. - If user explicitly asks for "只要结果", keep reasoning short but still include the sheet link and write status line. ''' new='''Required behavior: - When user asks to push result to Feishu Bitable, run write action first (feishu_bitable_create_record or feishu_bitable_update_record). - In continuous chat, if user says "把上一个结果推到飞书", use the previous assistant result as write payload. - If target sheet link is omitted this turn, reuse the most recent Feishu wiki/base link from this conversation; if no link exists, ask one short question for the link. - In final reply, always include: 1) push status (success/failed) 2) target sheet link (the user-provided wiki/base URL) 3) written record_id (or updated count) - If write partially fails, return succeeded records and failed reason list separately. - If user explicitly asks for "只要结果", keep reasoning short but still include the sheet link and write status line. ''' if old not in text: raise SystemExit('target block not found') text=text.replace(old,new,1) p.write_text(text,encoding='utf-8') print('updated',p)