# b02j — 验证三檔:`claims.rs`(615) + `evidence.rs`(135) + `tasks.rs`(1403) ## claims.rs — 完成宣稱關卡(程序把回话的宣称对上一轮实际做过的比对) - WAKE_TAG="[核對]";MAX_LATER_LINES=3;MAX_LINES=6;MAX_SCAN_LINES=80;MAX_REPLY_CHARS=800。 - Kind{Undone,NoFile,DeadLink,FileLink,Count};Claim{kind,what};hard()(使用者拿不到回话说的东西);soft()(Count/Undone);lines(≤6 条 80 字)。 - **check(turn,dir)**:取最后一条 assistant;无真动作(无 tool_calls 或全 Ask/QuickRun)→跳过;沙箱(sandbox::locked)→不查。claim_lines:扫 ≤80 行,只查「做完|完成|搞定了|完成了|已完成|已做好|做好了|寫好了|记好了|搞掂|已交付|已上線/上线|已发出|已发送|done|finished|completed|i'm done|交付|上線|已发布/已發佈」行;DeadLink/FileLink 看 ≤3 行后(http 链接、档案路径)。 - Undone:行前词我來|我會|接下來|讓我|i'll|let me → 本轮做过该类别工具(shell|edit_file|edit|write_file|list_dir|read_file|search|browser_*|memory_*|schedule|task|contact|card|show_card|message_bot|send_to_device|send_file|react|show_file|search_file|write|append…)→OK。 - NoFile:行内路径(abs 开头 或 含 /;split 非空白)→ 本轮 edit_file/write_file 的 path 参数==→OK;exists_on(盘查)→OK;无 → claim。 - DeadLink/FileLink:url_ok(scheme http/https、host 非空、无空白/中文/空格/控制字符/尖括号);file_ok(abs→exists_on;相对→沙箱内 exists;含 ../ →拒)。 - Count:数字(千分位去、万/百换算)+ 量词 條|个|個|项|項|位|封|首|篇|页|張|条|顆|人|筆|次|件|record|entries|items|photos|images|files|messages|contacts|rows|entries → 与 tally.steps 比(steps>=num→OK;0→claim)。 - **wake(text,claims,at)**:「[核對]你的回覆說『X』,程序查过这一轮做过的动作和结果:没有对应记录…」逐条;「你傳一句話後,Bot 會照實重答」;at==head.at 才发(回滚后旧核对失效)。 - **card**:「程序查了:Bot 說的『…』沒有對應的動作記錄。」(「照實重答/就這次說明」卡,卡文==title)。 - **publish_claim**(轮末):「已上線:http://127.0.0.1:…」→本机 200 检查→Event::Site{site_id,title};404/400→Event::SiteMissing;其他码→Event::SiteNotReady;非本机→Event::SitePublished。 - 测试锁:check_catches_a_file_claim_with_no_write、check_catches_a_delivery_claim_that_no_send_backs、check_catches_done_with_nothing_done、links_are_checked_against_the_local_sandbox 等。 ## evidence.rs — 一轮证据统计 - Tally{steps,failed,sent,sends};tally(turn):assistant 的 tool_calls status==Done→steps(Ask/QuickRun 不计),Failed→failed;sends(evidence::sends(call) 命中)→sent+sends 文。 - **sends(call)**:browser_press/submit Enter;browser_type 含 submit;browser_click target 含 送出|發送|发送|發佈|发布|post|send|submit|提交|上線|上线;send_sms/post_to_x/message_bot/send_to_device;macapps SEND_MESSAGE。 - **sends_words**(10 中+5 英宣称词);**sends_claim**(reply 含宣称词+动作词〔已|已經|已將|我send|done|sent|posted|published|上線|上线|發佈|发布|提交|送出|發了|发了〕);**hard_claim**(+发送对象 words)。 - step_line(name,args)→动作中文一行(每工具→文;「送給裝置:X」;「打開網頁:host」;「查網頁:host」;computer 加「在「X」上」;「執行指令:cmd」「寫檔:p」「讀檔:p」「列出:p」「搜尋:p(in)」;未知名→名)。 - 测试锁:a_press_on_enter_counts_as_a_send、only_sending_words_count。 ## tasks.rs — 任务清单(一切交给 Bot 的工作,状态由程序从证据算,绝不出自 Bot 自述) - 常量:KEEP=40(每 bot 事件数)、SHOWN=60、RECENT=30(每聊天)、TEXT_CHARS=60、START_GRACE_MS=15000、STALL_MS=15min、TOOL=list_tasks、CONFIRM_REACTION="👍"。 - Status 12 态(Running/Waiting/Following/Verifying/Produced/Delivered/Confirmed/Answered/Verified/Failed/Stopped/Unverified,各 label 中文);Source 11(Owner/Member/Routine/Trigger/Goal/Plan/FollowUp/Monitor/Channel/Bot/Delivery);Level{B 亲眼/A 系统/C 转述/Nothing};End{Success/Cancelled/Error/Interrupted/NoReply};Dlv{InChat/Shown/Opened/Failed};Artifact{name,id,delivery,device,why,line()}。 - **status(facts) 纯函数序**:Waiting→Running→Following→Verifying→(Impossible→Failed)→End 分岔→Confirmed/Delivered/Produced/Verified/Answered/Unverified;`backed()`(每态须有证据支撑);`legal()`(状态转换只前进:Produced→Delivered→Confirmed;record 永不倒退)。 - **work_out(Read)**:逐轮 evidence::tally 累加 steps/failed/sends;note 消息「目標達成/做不到」→GoalEnd;👍 reactions;last_step;step_open(Running 步=系统还看着,不算卡住);follows/monitors 登记(registered_follow/monitor 前缀解析);attachments→Artifact::of(attach::Delivery/SeenKind 映射,guest seen 不算 owner);goal 关联(Key::Goal/Follow/Monitor/Attach 归属表);live.running/waiting/checking;settled(Bot::last_turn)→End;START_GRACE 内无回复→算在路上;evidence B>A>C;STALL_MS 标「疑似卡住」(状态不变只标记,有步在跑免标);doing/why/proof 文;computer(步骤 args 里取,默认 BOT_COMPUTER_NAME→own_computer_name)。 - **from_chat**:starts_turn(User、非 steer/branch/note/summary/interrupted)切轮;continues(wake 前缀:goal::TAG/[追進度 #/[監看 #/DELIVER_WAKE="[交付]你傳的附件 ")→并入前任务;source_of(tag 前缀群);opening(去 […]/⏰⚡💬📨 前缀,60 字);ended_by_chat。 - **of_bot**:聊天任务 + record 里聊天已没有的(kept=true,active→Unverified 说明);record 压过非法前进。 - **all/newest**(rank:Waiting 0,Running 1,Verified/Failed/Stopped 3,其余 2;同级比心跳);**note**(状态变化才追加,Running 不记;>KEEP 削旧);attention(活跃+24h 内失败)。 - **spec/answer/describe/json**:list_tasks 只读工具;answer 权限(outsider 轮只列同发送者的任务;all 仅 owner 轮);describe 中文清单(含证据/产物行)。 - 测试锁 14 项:状态表全枚举、a_state_needs_its_evidence、a_record_only_goes_forward、steer 并入、交付三态(guest 设备不算)、👍 在使用者消息上不算、ask_bot=转述、goal 跨轮一任务、follow-up wake 续同一任务、清聊天后 record 保留、record 不倒退、跑了再动的前进(interrupted→继续→Answered)、outsider 只列自己的、wake 文与 continues 互相锁。 ## 迁移笔记 三档进 core::verify(claims/evidence)与 core::tasks;tasks 依赖 attach/model/evidence/goal/followup/routines(tz_of)/tools::args_of/ui 卡(app/tasks_ui.rs 读 Brain 同一 list)。list_tasks spec 进 tools specs 域。