Commit Graph

40 Commits

Author SHA1 Message Date
王性驊 ec8fe4b398 feat: 追進度、送 token 減量、首字等待依請求大小、摘要分段必成、換模型不掉東西
追進度(follow_up,src/followup.rs、src/app/followup_ui.rs)
- Bot 啟動要等的事後登記檢查指令與 done_when(可選 fail_when、then),就結束這一輪;大腦定期在那台電腦上跑檢查(不叫模型)
- 有進展時聊天記一行(最多每 10 分鐘);好了、失敗、15 分鐘沒變、超時、檢查連續失敗就叫醒 Bot 接著做
- 登記時檢查指令照 shell 規則審批一次(被擋的不登記);存在 Bot 身上,重開照樣追;只有大腦跑
- 系統指示:要等的事不要 sleep、不要說「我去盯」就結束;主動回報。說了就做的提醒也指向 follow_up

送 token 減量
- 收起的步驟,它的長參數(例如三千字 SSH 腳本)送給模型時也只留開頭(fold_called_args);估算同步
- 滾動收起:舊結果累積到可讀長度 15% 就整批收起,一批一次,快取只斷一次

模型怪怪的
- 第一個字的等待依請求大小(120 秒起,每多 1,000 token 多 2 秒,最多 10 分鐘),看門狗同步
- 等不到任何回應時不再原樣重送:先收小對話(收起結果、寫摘要)再問一次

壓縮
- 摘要分段寫(每段 40,000 字內,結果只帶 600 字),模型寫不出來時 AnyBot 本地整理一份,收縮一定成功

換模型
- 換過去的第一輪先收起舊結果;別的模型的思考區塊不送(會被拒);可讀長度改成每個模型各記(model_limits)

feature-map:goal.md 新增 goal-followup(含步驟);chat.md 改寫 chat-compact、chat-stall;models.md 新增 models-switch。FEATURES.md 同步。

已驗證: cargo test 753 通過(新增 followup 5 項、a_follow_up_reports_and_wakes_its_bot_when_done、calls_of_set_aside_steps_go_shortened、old_results_are_set_aside_before_the_chat_is_full、a_long_stretch_is_summarized_in_pieces、a_summary_the_model_cant_write_is_written_here、a_switched_model_starts_from_a_lean_request、首字等待兩項),clippy 無新警告;verify-anybot:goal.md「追進度」(登記後同一輪結束,背景檢查看到 DL_DONE 把 Bot 叫回來,follow_ups 歸零)、chat.md「說了就做」「/ 指令」,ctl down 無殘留
未驗證: 手機頁面畫面(這台沒有 Google Chrome);真的自架模型的首字等待與收小重試(要真的慢模型);跨機器(SSH、帳號裡別台電腦)的檢查實跑;models.md「從手機換回來」步驟(要無頭 Chrome);新增 App 工具 follow_up 與其審批需實機測試+人類簽名,本輪不發佈

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 23:28:52 +08:00
王性驊 bca9203264 fix: 第三輪審查——提醒改用專用事件,回合中途的摘要不再被 120 秒硬切
- 新事件 StreamEvent::Nudged:只有「說了就做」的提醒(含連續第二次)會重設第一次回應的期限;一般的 Retrying 恢復原本的行為(回合中途寫摘要時不再被當成「還沒開始回應」而在 120 秒中止)
- 安靜步驟裡供應商自己的重試照樣重設期限
- 螢幕電腦送不出的 /指令(按鈕送的 /goal clear 等)不放回輸入框,錯誤訊息照實寫

已驗證: cargo test 740 通過、clippy 無新警告;verify-anybot chat.md「說了就做」重跑結果相同,ctl down 無殘留
未驗證: 真的慢模型在安靜步驟的期限(要真的模型);螢幕電腦的指令失敗路徑(要帳號伺服器與第二台電腦)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 22:52:53 +08:00
王性驊 e644d88446 perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮
畫面省資源(舊 Intel Mac)
- 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格)
- Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算
- 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先
- 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速
- 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼
- ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒)
- 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份)
- 手機狀態裡的指令輸出先截短再遮罩金鑰

連線(螢幕電腦 ↔ 大腦)
- 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot
- 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息
- 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓
- 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算
- 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出
- 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的
- 手機頁在背景時不重畫訊息,回到前景再畫

小模型持續做(src/agent/followthrough.rs)
- 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒
- OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀)

智慧模式常開
- 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示

token 壓縮提早
- 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長

feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。

已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修)
未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 22:28:31 +08:00
王性驊 660018c303 智慧模式 (/smart): 一问一决定,不是一步一卡
询问和一律放行中间的设定(CLAUDE.md 改善轮迴的第一块:聊天卡顿的主因是一步一卡)。
- 卡片多一个「这轮都准」: 同类操作这一轮只问一次(Job 就是一轮,按构造就是 per-turn;
  下一轮会再问)。grant 非空的 Action 卡与连接器卡有这按钮;must-ask(付款/传送/删除的
  点击、你的屏幕和 App、保险库、一律询问规则、hook)没有,也不被覆盖。
- 卡片逾时: 你几分钟没回,卡片自己回答——看档案/上网这类先做(步骤结果里写明),敏感操作
  自动拒绝并告诉 Bot 别重试。/smart 中途开关都即时(窗口一个 Arc,Job 共享)。
- 审核缓存: 自动审核的模型判决这一轮按(规则,动作)缓存,重复同一步不再每次付 10–20 秒;
  审查看不见档案全文时照旧自己问(没动)。
- 开关: /smart(/smart off、status)、设定›权限(滑块调时限,默认 300 秒)、输入列旁图标。
  手机/远端只能关不能开(words_loosen + remote setting 只收紧);untrusted 回合永不智慧。
- 锁: 管理员锁住直接操作/本地执行时,智慧模式一起锁。
- feature-map: chat.md / safety.md / autonomy.md / settings.md 同步(featuremap 测试绿)。

已验证: cargo test 全绿 716(含 featuremap::、layout_audit::、approval/tool 锁未动)
未验证: 实机批准卡路径(新按钮、逾时行为)需人类实机点测并签名(CLAUDE.md 审批准则)
2026-11-19 14:59:29 +08:00
王性驊 c3e615c83c fix: ChatGPT 方案第二輪審查的 P2
- 沒有正常結束的回答(response.incomplete)算失敗,那一步的工具不執行。
- 額度用完後,沒人在看的要求(例行任務、訊息管道、檢查)先不送,直到有一次成功。
- 提早更新 token 遇到網路問題時,手上還有幾分鐘的 token 照用(以前那幾分鐘每個要求都失敗)。
- 大腦的帳號狀態隨同步送到螢幕電腦(不含 token),模型選單、Bot 設定不再一律寫「未登入」。
- 螢幕電腦和手機只打開 https://auth.openai.com/ 的登入頁;手機擋彈出視窗時說明再按一次。
- 登出時憑證打不開、沒辦法撤銷,會告訴使用者去 ChatGPT 設定中斷;兩次撤銷之間隔一秒。
- 登入成功後自動抓一次模型清單。

已驗證: cargo test 全綠(chatgpt::、providers:: 新增用量上限暫停、incomplete、提早更新失敗、只開 OpenAI 登入頁)。
未驗證: 真的 ChatGPT 帳號登入與串流;螢幕電腦、手機實機(同上一個 commit)。審批路徑仍需人類簽名。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3KhvSzysuKUobKUTR
2026-11-17 17:46:09 +08:00
王性驊 a03f7c7458 feat: ChatGPT 方案——用 ChatGPT 帳號登入,Bot 用你 ChatGPT 方案的額度,不用 API 金鑰
- 新供應商「ChatGPT 方案」(src/chatgpt.rs):照 OpenAI 給開源 App 的 Sign in with ChatGPT。
  第一次登入註冊 AnyBot(dynamic_agent_client → oaiapp_…)並重用;PKCE、state、nonce;
  ID token 驗 RS256 簽章、iss、aud、exp、nonce;沒同意使用方案算登入但不能用(再登入會要求同意)。
- 要求走 Responses API(api.openai.com/v1/responses,store:false、stream:true、instructions),
  token 只送 OpenAI 自己的網址;收到 response.completed 才算完成;額度用完停下來給管理用量連結,
  不重試、不改用 API 金鑰。token 快到期或 401 時更新(一次一個,refresh token 會輪替)。
- 設定 › 模型 › ChatGPT 方案:使用 ChatGPT 繼續、登出、換帳號、打開登入頁、管理用量;
  連到伺服器大腦的螢幕電腦和手機也能登入(登入頁開在自己這台,打不開的那頁網址貼回給大腦)。
- Bot 工具 chatgpt_login(status、login、logout、switch_account;登出和換帳號先問)。
- 修連接器登入:封存的 token 前綴寫錯("sealed:" 實際是 "enc:v1:"),重開 App 後 token
  沒解開就被當成憑證送出,登入等於每次重開都失效。

已驗證: cargo test 全綠(chatgpt::、providers::、appctl::、remote::、mcp_oauth::、featuremap::、layout_audit::);
  授權網址的參數送到 auth.openai.com 沒被拒(302 到登入頁)。
未驗證: 實際用 ChatGPT 帳號登入、同意、Responses 串流與工具呼叫(要真的 ChatGPT 付費帳號和瀏覽器);
  螢幕電腦貼回網址、手機登入(要實機);Windows 的「打開登入頁」。
  動到審批路徑(appctl::needs_approval 的 chatgpt_login):需要實機測試+人類簽名。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 17:23:10 +08:00
王性驊 6b9d4e6cf2 feat: 沒人在看的一輪遇到模型忙碌時等比較久(共 8 次、最多 30 秒、加減兩成)
計畫 R1(grok-build 試 15 次、2 秒起加倍到 30 秒、±20% 抖動)。早上的 503「第 3 次,共 3 次」就是這個上限。

- providers.rs:每條執行緒一個「沒人在看」的旗子(set_patient)。開著時一次模型呼叫共試 8 次、等待加倍到 30 秒;沒開照舊共 3 次、最多 4 秒。自己算的等待加減兩成(jitter);供應商給的 Retry-After 照它的。已經開始輸出就不重試(不變)。
- agent::Job 多一個 unattended;start_reply 對例行任務/事件觸發的喚醒和別人傳來的訊息設成 true,這一輪的執行緒一開始就 set_patient。
- 拿掉只剩測試在用的 backoff_delay_ms,改用 backoff_up_to。
- 功能地圖 routines.md 陷阱、FEATURES.md。

已驗證:cargo test 570 全過、clippy -D warnings 過。新測試(用共用的假模型):前 4 次都回 503 的模型,有人在看的那一輪 3 次就失敗,沒人在看的第 5 次拿到答案;加倍的上限、抖動在 ±20% 內。
未驗證:真的供應商長時間忙碌時的例行任務。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 11:35:28 +08:00
王性驊 3ef5f8b752 feat: 每一次模型呼叫都記用量;/usage 看最近一天和一週
工程基礎計畫 E8,參考 grok-build 的 `grok usage`。

- providers.rs:StepOutput 多一個 usage(輸入、輸出、快取讀、快取寫、花費)。OpenAI 系的串流最後一段的 usage(OpenAI、xAI、OpenRouter 的請求加 stream_options.include_usage;其他有給也讀);Anthropic 從 message_start 和 message_delta 讀。OpenAI 的 prompt_tokens 包含快取讀的,拆開,兩家的「輸入」同一個意思。OpenRouter 回的 cost 記成百萬分之一美元。拿掉沒人讀的 CACHE_STATS。
- usage.rs:run_step_as_written(每一次模型呼叫都經過)之後寫一行到資料夾的 usage/YYYY-MM.jsonl:時間、供應商、模型、session(看得出哪個 Bot、做什麼:回合、發布前檢查、目標檢查、支線)、token、花費。沒回報用量的呼叫不寫。
- 「/usage」(電腦、螢幕、手機):最近 24 小時和 7 天的呼叫次數、輸入、輸出、快取讀了幾成、花費(有回報才寫),依 Bot、依模型各列前 8 名。不猜價錢。
- / 清單、手機的指令清單多一個 usage;功能地圖 chat.md、FEATURES.md。

已驗證:cargo test 全過、cargo clippy -D warnings 過。新測試:兩種串流的用量讀得對(OpenAI 的快取拆出來、OpenRouter 的花費、Anthropic 的四種),只對認得的服務送 stream_options;session 看得出是誰的;一天和一週的加總、依 Bot 和依模型、七天前的不算;寫一行再讀回來,沒用量的不寫。
未驗證:真的 OpenAI/xAI/OpenRouter 回的 usage(照它們的文件寫,假模型測過格式)。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 11:27:34 +08:00
王性驊 1ad81532cd feat: 所有 HTTP 用戶端信任同一份憑證;連接器連同它帶起來的程式一起關;按停止馬上結束連接器的呼叫
工程基礎計畫 E5,參考 grok-build 的 clippy.toml(HTTP 用戶端只能從一個地方建)和 ProcessScope。

- net.rs:net::config() 是所有 HTTP 用戶端的起點,憑證是公開的加上這台電腦自己信任的(tunnel::trusted_roots);net::agent(秒數) 是常用的那種(整個請求的逾時、錯誤狀態當成回答,一種逾時一個、重複用)。18 個自己建 ureq 的地方全部換成 net::config(),各自的逾時、轉址、User-Agent 不變。以前只有連帳號伺服器的那條看這台電腦信任的憑證:公司自己簽憑證的連接器、模型服務、Webhook 在別處會失敗。帳號伺服器的用戶端改用 net::agent,拿掉它自己的那份快取。
- clippy.toml:disallowed-methods 擋 ureq::Agent::config_builder(net.rs 以外)。
- 連接器:關掉、移除、重新連線、連不上時用 tools::kill_tree 連同子行程一起關(npx/uvx/sh 底下真正的伺服器以前留著)。
- mcp::call_until:本機連接器的呼叫每 0.2 秒看一次停止,按停止馬上回「已停止」;伺服器晚到的答案下一次會跳過。用網址連的還是等它回或 120 秒(ureq 的請求停不下來)。
- 測試用的假連接器多一個 slow 工具(FAKE_SLOW=1 才列出,不影響其他測試的工具數)。

已驗證:cargo test 560 全過;cargo clippy 沒有 disallowed 的違規。新測試:按停止 0.3 秒後呼叫在 2 秒內結束、之後同一個連接器照樣能用(sum=3);用 sh 帶起來的連接器關掉後,它帶起來的 sleep 也沒了;所有用戶端的憑證至少是公開那一份。
未驗證:公司自己簽憑證的真的連接器(這台沒有)。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 11:13:59 +08:00
王性驊 9390b70fe7 feat: /plan 先規劃再動手、聊天裡請 Bot 管理連接器、/always-approve 一律放行;輸入框上方的狀態不再破版
/plan(照 Claude Code 的 plan mode、Cursor 的 Plan Mode、Codex 的 update_plan)
- 「/plan 要做的事」:這一輪只給會看的工具(讀檔、搜尋、web_fetch、瀏覽器的打開/讀取/捲動、截圖、anybot_guide、問題卡),在執行那一層擋下其他步驟(回「計畫還沒核准」),不是只靠提示詞。
- Bot 用 submit_plan 交計畫:聊天裡一張「計畫」卡(摘要、步驟、怎麼確認做對了、注意),下面的問題卡「照這個計畫做嗎?」:開始照計畫做/先不要/打字寫要改哪裡。
- 核准後同一輪接著做:工具全開、系統指示換成照計畫做,第 1 步自動進行中;update_plan 每做完一步更新一次(整份清單、只有一步進行中),卡上打勾、輸入框上方「照計畫做 · 2/6 · 這一步」;全部做完留「計畫完成」那一行。
- 「/plan」看狀態、「/plan clear」取消;例行任務、訊息管道、團隊成員的訊息不受影響;群組不能用;支線不帶計畫;清除聊天或新對話一起清;分享 Bot 檔不含。手機:計畫卡、計畫列、取消計畫。
- 新功能地圖 plan.md;研究(Claude Code、Codex、Cursor、Gemini CLI…)的結論寫進提示:只寫建議的做法、通常 3 到 7 步、問題最多 3 題、打勾不要太勤。

聊天裡管理連接器(設定能做的聊天也要能做)
- 新工具 manage_connectors(管理 App 能力):list、add、update(含開關)、reconnect、remove。改的就是大腦上 設定 › 整合 › 連接器 那一份,不會寫到手腳電腦的檔案(進化之神之前叫使用者去 nobledesktop 的 ~/.local/share/AnyBot 設)。
- 新增、修改、移除先跳卡片:指令(在大腦上執行)或網址、環境變數、標頭;TOKEN、KEY、SECRET、PASS、AUTH… 和密碼顯示「••••(已填)」。名稱重複、command 和 url 都給、網址不對、還有「{…}」、沒東西可改,在問之前就回給 Bot。
- 加好後等它連上(最多 90 秒)再回報幾個工具或原因;一輪裡連接器的工具變了,下一步起就換新(加完同一輪就能用)。

/always-approve(也可以 /yolo)
- 使用者自己打(電腦、大腦的螢幕、手機的擁有者)或 設定 › 權限 ›「一律放行」:打開直接操作,之後所有要等「允許」的都自動允許(含一律詢問規則、付款/傳送/刪除的點擊、寄信、傳訊息、打電話、發文、保險庫卡片),自動審核略過;打開時在等的卡片一起放行。
- 照樣擋:安全規則一律拒絕的;別人傳來的訊息那一輪;問題卡、需要處理、計畫卡。Bot、例行任務、訊息管道打不開;管理員和成員打的變成「【名字】/always-approve」。管理員鎖了直接操作就打不開。
- 開著時每個聊天輸入框上方一條「一律放行」和「關閉」;「/always-approve off」關掉,直接操作是它打開的就一起關。

輸入框上方的狀態
- 好幾行的狀態(模型忙碌重試:錯誤、說明、幾秒後重試)以前疊出那一列、壓到輸入框;現在一行:「模型供應商目前負載過高,15 秒後重試(第 3 次,共 3 次)…」。

已驗證:cargo test 548 通過、1 個失敗(layout_audit 的 設定 › 電腦 被這台 Mac 的 Docker 位址 unix:///Users/daniel/.lima/anybot-gvisor 撐寬;把這次的改動 stash 掉一樣失敗,跟這次無關)。新測試:plan:: 7 個;agent 的計畫模式三個(只看到卡片說開始、先不要什麼都不做、修改後重交);app 的 /plan 從打字到計畫完成、Bot 從聊天加連接器(卡片不露 Token、同一輪就用它的工具算出 sum=5)、/always-approve(之前會問、之後不問直接在這台跑、陌生人的訊息照樣問、off 回原樣);mcp::manage_tests 4 個;狀態一行。截圖看過:計畫卡等你決定/照著做打勾、503 重試那一行。手機頁面 JS 語法檢查和計畫卡四種狀態的 HTML。
未驗證:真的模型走一次 /plan 和加 GitLab 連接器;手機實機;伺服器上的大腦(要 make update-server)。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 10:55:37 +08:00
王性驊 9c84ec69c5 feat: 本機或區網的模型看不到圖時,可以請雲端模型看截圖和附件
設定 › 模型 › 本機或區網的供應商(Ollama、這個網路或 Tailscale 上的伺服器)多一個
「看不到圖時,請雲端模型看截圖和附件」,預設關。關著時跟以前一樣,圖片只找本機的看圖
小幫手;打開後,那個供應商的 Bot 看不到的圖會送給帳號裡看得懂圖的雲端模型(例如 xAI
Grok)描述成文字。

用哈士奇(Tailscale 上的 OpenAI 相容服務,模型不收圖)實測計算機題:沒開 59 步、225
秒還讀不到答案;打開後 7 步、118 秒答對。8 題各 4 次 32/32 成功。

也把「is not a multimodal model」認成模型不收圖的錯誤。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha4mzWbjJAWAsDVuBun
2026-11-15 20:00:06 +08:00
王性驊 eb70608160 feat: AnyBot 功能地圖——Bot 用 anybot_guide 認識 AnyBot 本身;修好地圖整理時找到的七個問題
功能地圖(照 Lauren Tan 的 feature map,poteto/verification-skill-example)
- docs/feature-map/:20 區加索引,每區四段(子功能/使用者怎麼到/怎麼操作(Bot:、驗證:)/陷阱),內容逐條對照程式;索引寫共同前提、證據與略過的回報、全面檢查順序
- Bot 的系統提示多一行區塊目錄;新工具 anybot_guide 一次讀一區(唯讀)
- cargo test featuremap:: 擋漏寫:Bot 能拿到的每個工具、browser/computer 的每個動作、設定視窗每個分頁和區塊、update_settings 的鍵;每區要有四段、不能太長
- 自動學技能:AnyBot 本身怎麼用不抄進技能,地圖錯漏記成待改進;園丁在重複的待改進旁提醒補地圖
- CLAUDE.md:改功能時同一個 commit 一起改地圖
- 側邊欄「分區」工具的說明寫清楚:不是群組聊天

修正
1. 別人傳來的訊息(訊息管道、團隊成員)那一輪不給 AnyBot 瀏覽器、保險庫和已送紀錄(瀏覽器帶著使用者的登入);硬叫也擋下,公開網頁仍可 web_fetch
2. 自動學會的技能加進那個 Bot 自己的技能清單(支線的算主 Bot 的)
3. 按停止一併停掉這個 Bot 的互動終端機(一般背景指令照舊)
4. 設定 › 整合 › 技能、頁面的「刪除」要再按一次確定
5. update_bot 先跳確認卡片,列出每一項要改成什麼
6. Bot 範本的頭像形狀改成存在的形狀,並加測試
7. 文字:直接操作的提示改「設定 → 權限」、金鑰錯誤改「設定 → 模型」、等核准逾時照實說是什麼在等

Mac 490 個測試通過。

Refs: cl3xk7

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 11:15:09 +08:00
王性驊 c7f6da7fe8 feat: 發布關卡——已送帳本、發布前檢查、送出後讀頁面留證據、例行任務完成條件、重播可填空格
1. 已送帳本(publish.rs):Bot 用 AnyBot 瀏覽器送出前,系統先讀頁面,看是哪個帳號、回哪一篇(回覆對話框或文章裡的貼文網址、或頁面本身);同一帳號回過同一篇就擋下(記 60 天),頁面看不出回哪篇時只擋 24 小時內同頁同字。搜尋框按 Enter 不算送出。瀏覽器新增 sent 動作,直接從帳本列出帳號回過誰,不必每輪讀完網站的回覆頁
2. 發布前檢查:送出前請另一家供應商的快速模型照基本規則(簡體字、AI 腔、不該公開的內容)、這一輪讀過的技能與自訂規則檢查,沒過就不送並說原因;固定不變的放在系統提示最前面方便快取,同一段字一輪只問一次;設定可關、可加規則
3. 送出後的證據:系統重讀頁面,確認文字出現、輸入框清空,抓出留言自己的網址;寫進 Message.sent(頁面文字偽造不了),送出計數、例行任務紀錄、/goal 評審、手機頁面都以它為準;框裡還留著字就記為沒有送出
4. 完成條件:例行任務可設 target_sends,系統自己數:到數就不准再送,結束時不到算失敗,連續兩輪(50 步)沒有新的送出就停下;喚醒訊息與進展檢查都說明目前計數
5. 重播空格:自動學技能時把每次不同的內容(留言、貼文網址)存成 {{名稱}},replay_skill 用 values 填這次的內容,缺哪格就說哪格
6. 間隔從真正送出那一刻算起;送出後確認最多等 8 秒,框清空 4 秒仍沒看到就先記「還沒確認」

Mac 480 個測試通過;送出前後讀頁面在 Brave、Firefox 實機測試通過。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 01:48:13 +08:00
王性驊 98fc63e65b feat: 借鏡 pstack/Grok Bot——例行任務執行紀錄、完成看證據、教訓分流、園丁報告、減少操作步驟、網站地圖
1. 例行任務執行紀錄:每次執行記開始/結束、完成/失敗/被停止/中斷、步數與失敗步數、原因,保留最近 20 次(Grok Bot 官方規格);上次失敗或中斷的原因帶進下一次;連續失敗 2 次自動暫停並說明原因;設定頁、手機詳細頁、list_routines 都看得到,沒有紀錄時說「查不到」不說「沒跑過」
2. 完成看證據:evidence.rs 從步驟算出實際成功送出幾次,寫進例行任務紀錄;/goal 評審的摘錄把 Bot 的話標成「不是證據」並附系統統計,對不上以系統為準;評審優先用另一家供應商的模型,失敗退回原本的
3. 教訓分流:自動學技能時,AnyBot 自己的工具問題寫進 tool_issues → 「待改進」清單(同一工具合併計次),不寫進技能;設定 › 更新可看可清除
4. 園丁報告(garden.rs):平日 8:44 掃過去一天的失敗、走冤枉路的執行、自動暫停與重複出現的待改進;週一 8:49 列出失敗多或太耗時的例行任務;沒事不報,可在設定關掉
5. 減少步驟:browser type 多行文字一次放進欄位(先試貼上事件、檢查沒進再用 insertText,Firefox 也行)並回報欄位內容;點進輸入框回「游標已在…」不再說「沒有變化」;元素編號在同一頁重讀時不變;wait 的 after_send 從上次送出算間隔
6. 網站地圖:學技能時同一網站的操作知識整理進「<網站> 網站地圖」(功能/怎麼到/怎麼操作/陷阱),做事的技能只寫特有規則

Mac 465、Linux 469 個測試通過;多行輸入與編號實機測試在 Brave、Firefox 通過。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 23:52:44 +08:00
王性驊 0a25db7199 fix: 模型說對話太長時自己騰出空間再試——先拿掉截圖、再收起舊結果、再摘要(一輪中間也能切);記下模型真正的上限,把圖當文字算的模型不再傳圖
一台 Linux 換成自訂端點的模型後,一張網頁截圖讓請求從約 1.8 萬 tokens 變成 178,553(上限 131,072):那個端點把圖的 base64 當文字算。AnyBot 一張圖只估 3,200、也沒算工具說明,所以沒先壓縮;模型說太長時,最新 6 則一律保留(截圖就在裡面),這一輪又只有一則指令沒地方摘要,直接報錯;下一輪截圖還在記憶體裡又送一次。

- 模型說太長:依序拿掉圖片(聊天裡的步驟截圖也放掉,下一輪不再送)→ 收起除了最新 2 步以外的長結果 → 摘要(只有一則指令的長回合在這一輪中間切,指令原文保留)→ 都試過才報錯,並說明指示、工具說明、對話各多大
- 從錯誤訊息讀出上限(husky、OpenAI、vLLM、Anthropic 的寫法),比 Bot 設定小就記下來(StreamEvent::ContextLimit)
- 實際用量比估算每張圖多 2 萬 tokens 以上(圖被當文字算)時,拿掉圖片成功後這個模型不再傳圖(改用文字描述);看得到圖、只是剛好超過一點的模型照樣看螢幕
- 估算加進工具說明(約 1.2 萬 tokens)

測試:husky 那次的截圖情境、一則指令的長回合、看圖模型只超過一點點、各家錯誤訊息的上限與用量解析。Mac 451 個測試通過。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 18:57:51 +08:00
王性驊 69080f9117 fix: Linux 操作恢復順暢——保險箱空的不給填入工具、同一個錯誤不再鬼打牆;Wayland 可一律允許、長網頁有編號、Enter 只看游標那格;做完就關掉瀏覽器
一台 Linux(Ubuntu 26.04、X11)上一輪 Threads 海巡 40 分鐘只送出 1 則:小模型一直誤叫保險箱填入(171 次),而 4b53ad4 之後回的是「沒有開著的分頁,請先 browser_open」,Bot 照做又再誤叫。

- 保險箱:只給有東西可填的種類(空的就沒有 vault 工具、browser 也沒有 fill);填入先查 id 在不在,錯誤講對、指向 type;規劃與填入都在這個任務自己的分頁上(本機、box、遠端手腳)
- 同一個工具連續 3 次回一樣的錯誤(換參數也一樣):這一回合不再執行
- Wayland(GNOME/KDE,wlroots 的座標點擊)認不出 App 時,改給「操作這台電腦的螢幕」一律允許(一律允許清單裡可移除)
- 元素樹走訪上限 4000 → 20000:長網頁捲下去,看得到的部分也有編號
- 敏感動作關卡:Enter/送出只看游標所在(或正在打字)的欄位;座標點擊只看點到的最內層控制項;英文整字比對(PayPal 不是 pay);步驟在別台電腦時不查大腦本機的編號
- 打字先點欄位再檢查最前面是不是 AnyBot;批次從 AnyBot 切到要操作的 App 不再中斷,切到第三個 App 或回到 AnyBot 才停
- 估算對話長度只算真的會送出的最新 3 張截圖
- 做完就關掉瀏覽器(設定 › 電腦 › AnyBot 瀏覽器設定檔,預設開):一輪結束關掉用過的 Firefox/Chrome,別的 Bot 還在用就只關自己的分頁;box 的 Chromium 不變

Mac 444、Linux 448 個測試通過;Firefox 收尾實機測試(Mac、Linux Snap 版)通過;已在那台 Linux 上部署驗證。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 16:21:32 +08:00
王性驊 8ed7132e6b /btw 支線、送出先顯示;公測前的安全與資源修正(帳號盜用、灌爆、團隊權限、背景指令與連線的上限和清理)
支線與介面
- /btw:Bot 的分身帶著同一段對話和記憶平行做另一件事,做完回報到主聊天;主線在忙時先判斷會不會衝突,會就等主線做完
- 螢幕一次只給一輪工作操作(所有 Bot 適用)
- 「/」只列指令,打字才找這個 Bot 自己的技能
- Bot 工作中送出的訊息立刻以淡色顯示(電腦、手機)
- 支線修正:沒被讀到的回報照常進聊天、卡片顯示結果、可回答支線的問題、重新產生不吃掉卡片和回報

安全(中繼伺服器)
- 大腦回傳的內容只放行安全類型並加沙箱;團隊改成邀請制;手機不照大腦說的類型開檔案
- 沒登入的請求最多 256 KB、接收中的上傳有總量上限、單一 IP 連線上限、常駐連線另計
- 登入次數加上每帳號上限並先計數再驗證;密碼雜湊同時最多 4 個
- 新增電腦要 15 分鐘內剛登入;可改密碼;註冊限速,有邀請碼時第一個帳號也要
- 發布的網站不能送表單和對外連線;Caddy 加安全標頭

安全(大腦)
- 區網(明文)不能打開直接操作、加一律允許規則、加連接器;區網登入 30 天沒用失效
- 團隊成員只看得到勾選「團隊成員可以使用」的 Bot
- 沒有角色的請求一律拒絕;環境變數的金鑰只送官方位址

資源
- 中繼:小變動每分鐘寫一次、回應有總時限、每台電腦呼叫上限、網站/登入/電腦/配對碼上限、資料檔壞掉不啟動
- App:伺服器回錯誤和連線秒斷時逐次退避;區網看螢幕偵測斷線
- 背景指令:刪 Bot 和支線結束時停掉、最多 24 個、結束 10 分鐘後移除、可用 stop 停掉
- 截圖在收起和歸檔時釋放;刪 Bot 時刪附件和對照表;每晚清稽核資料和暫存;手機圖片快取上限

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3a7riWESpv471gDgC
2026-11-13 23:36:34 +08:00
王性驊 66dce03cee 思考模式、連接器帳密、圖表: a bot's thinking mode, connectors that log in with a username and password, native charts
思考模式: each bot picks 自動/快速/平衡/深入. Claude gets output_config.effort,
OpenAI-compatible services get reasoning_effort; a model that refuses the
setting is retried without it and not sent it again.

連接器: a connector takes a 帳號 and 密碼. {username}/{password} written in the
command, env, address or header are filled in there; written nowhere, a local
server gets MCP_USERNAME/MCP_PASSWORD and a remote one Authorization: Basic.
The password is kept like a key: screens see only 已設定, and the brain clears
it when a screen changes the command or address. A test now covers a screen's
switch stopping and restarting the brain's connector.

Also in this tree (written by pi-bolt earlier): ```chart blocks drawn as
native charts, older images sent as summaries with a look_image tool, and
image tokens counted in the history size.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha4t4P58pvWECQYXBjo
2026-11-12 21:00:14 +08:00
王性驊 eb3157852a 安全、修正: harden sandboxes, approval gates, vault, relay roles, and fix protocol/UI bugs
- macOS 沙盒與工具 (tools.rs, policy.rs, docindex.rs): block AppleScript raw events and
  concatenation outside the sandbox; stop exposing ~/.ssh or localhost sockets in Sealed
  mode; deny writes to shell profiles, LaunchAgents and .git/hooks; expand secret-file
  ignores and enforce symlink/policy checks across SSH, device and document search.
- 電腦操作與遮罩 (computer.rs, agent.rs, marks.rs, desktop.rs, cloudbox.rs, portal.rs):
  forbid clicking or typing into AnyBot's own windows; extend the sensitive-action hard
  gate to raw coordinates, Return/Delete submits and remote devices; stop batch steps if
  the front app changes; black out secrets on zoom, show, >600-node trees, adjacent OTP
  labels, box screenshots and control text lists; preserve non-text Wayland clipboards.
- 保險庫與瀏覽器 (vault.rs, vault_store.rs, browser.rs, botbrowser.rs, web.rs, box/browser):
  verify tab host and HTTPS atomically at fill time; taint filled tabs against browser_eval
  and PDF export while masking card/CVC values and screenshots; remember sites only on
  always-allow; drop --remote-allow-origins=*; gate private URLs and block metadata/Docker
  ports, OrbStack 198.18/15 and IPv6 transition ranges.
- 帳號伺服器、同步與傳送 (relay/, remote.rs, mirror_ui.rs, share.rs, drops.rs): isolate
  paired hands hosts from brain sync, tickets, pairing and backup overwrites; redact
  routine trigger secrets and clear REDACTED when endpoints change; isolate channel and
  team-member turns from owner memories, appctl and grants; scrub shared bot exports and
  reset grants/routines on import; validate drop IDs and serialize chunk writes.
- 網路與協定穩定性 (httpd.rs, tunnel.rs, vnc.rs, Caddyfile*): fix chunked integer overflow
  and CRLF header injection; enforce Origin checks, connection/job caps, 200 MB backup
  reads, unique atomic temp files and ASCII hex guards; bound deflate unzip and VNC sniff
  buffers; move VNC stdin/text off the tunnel loop.
- 介面、排程、語言與其他修正 (app.rs, i18n.rs, providers.rs, skills.rs, routines.rs,
  setup.rs, store.rs, preview.rs, attach.rs, speech.rs, teams.rs, mcp.rs, voice.rs):
  wire up the delete-routine confirmation dialog and mirror run-now; preserve unsaved
  mirror edits across brief disconnects; give Chinese skills distinct folders and approval
  gates; convert parsed tool JSON fields without corrupting code fences, URLs or paths;
  fix Hourly DST offsets and time out unattended routine approvals; lock --install-skill,
  cap docx/xlsx unzip sizes, isolate test env keys, and tighten local file permissions.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-12 14:34:10 +08:00
王性驊 935cee9346 繁體中文、換電腦: what a model writes is put into Traditional Chinese whatever the setting's system; a work folder from another computer lands under this home
- 繁體中文: converted at the one place every model call comes back (providers::run_step),
  decided from the request itself: the setting is 繁體中文, or it follows the system and
  the person writes Traditional. It used to be on only for the explicit setting, so a
  brain on an English server with 跟著系統 never converted, whatever the instructions said.
  Not when another language is chosen, nor when the latest message asks for Simplified.
- Converted: the reply, the thinking, and steps whose words are for the person (question
  card, card, page, memory, routine). Left as written: code blocks and `inline code`, a
  line of Japanese, file names, commands, searches, recipients.
- Taiwan wording after the characters: about 55 one-meaning computer terms (網絡→網路,
  文件夾→資料夾, 默認→預設…), and zhconv's OpenCC tables on (设置里的 → 設定裡的).
- The reply instruction says it too: no Simplified characters, no mainland wording.
- 換電腦: a bot's work folder chosen on one computer (/Users/daniel on a Mac) no longer
  breaks every file and command step on another (Linux, another user). It is sent as ~/…
  with the folder as chosen alongside; the receiving computer uses the folder if it is
  there, else the same place under its own home, else its home.
- FEATURES.md.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-12 10:29:02 +08:00
王性驊 3720ee501e 問題卡、搜尋: the bot asks with a card; every chat is searched; a refusal holds for the turn
- 問題卡 (ask_person, src/ask.rs): up to 6 questions on a card above the input, one at a
  time — a choice (one click moves on), several choices, or a field that arrives filled
  for the person to correct; 「自己回答」 on every question, 上一題 and 略過. The turn waits;
  a message typed instead leaves the card unanswered. Travels as an approval of kind
  Question (questions as JSON) with a new answer Answered, so the window, a screen of
  another brain and the phone draw the same card.
- 搜尋所有聊天 (src/find.rs): the sidebar's search also lists what the person and the bots
  said in every chat, past conversations included, and attachment names; newest first,
  40 at most. A click opens the bot (bringing a past conversation back first), scrolls to
  the message and lights it for a moment.
- 拒絕後停下: a step the person refused is refused for them when it comes back unchanged
  in the same turn — no second card, no second review — until they write again.
- The bot's instructions: stop after a refusal instead of trying another way; before
  sending, posting, buying or deleting, check the person's own messages asked for exactly
  that, and ask with the card when they didn't.
- 直接操作 no longer answers a hand-off (or a question) on the person's behalf.
- The repeated-step check leaves questions to the person alone.
- Screenshot views `ask` and `find`; FEATURES.md.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-12 10:17:32 +08:00
王性驊 908433967a 長對話: old step results are set aside first; a summary only if that isn't enough, written by the quick model
- at 70% of the context, results of older steps longer than 600 characters keep their first 200 for the model
  (the newest 6 messages stay whole): no model call, no wait — 20 file reads went from about 128k to 22k
  tokens in 10 ms in the test
- the chat keeps every result whole for the person; the mark (Message::folded) is kept, so the model reads the
  same thing each turn
- the summary, when still needed, is written by the bot's step model when it has one

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-12 00:02:32 +08:00
王性驊 31f41f62c6 目標: /goal keeps a bot working turn after turn until a second model, reading the chat, says the goal holds
- goal.rs: the command (/goal, /goal clear, /goal <condition>), the judge's brief and how its
  answer is read (met / not_met / waiting / impossible), and the brakes: 20 turns, 3 idle turns,
  a question for the person, a failed turn, a stop, a silent judge or a restart pause it; the
  person's next message takes it up again
- app/goal_ui.rs: on the brain, each finished turn of a goal is checked on a thread with the bot's
  quick model; not yet met wakes it with 「[目標]還沒達成:…」, the rest leave a note in the chat
  (never sent to the model) and tell the person when away; the line above the input with 清除目標
- typed on the computer, a screen or the phone, the brain acts on it; /goal leads the / list on
  both; the phone shows the bar, the notes and the 目標 tag
- anybot --ask "/goal …" runs to the end, like claude -p "/goal …"
- tests for the command, the verdicts, the brakes, the brief and the slash list; FEATURES.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-11 20:24:27 +08:00
王性驊 28784232a5 記憶: a page to see it, a few lines picked while typing, a local model
The memory had grown into a list carried whole, a top-14 recalled by a
trigram index and pasted into the system prompt with the clock, and a
page that broke its own layout. Nobody could see what went to the
model, the prompt cache missed every message, and 「記住」 kept saying
the same thing twice. Rebuilt per the spec (docs/memory.md):

- Three kinds in memory.db: 記得的事 (fact), 做過的事 (event, a line per
  finished turn), 整理過的 (rollup). Each keeps pinned, uses,
  last_used, deleted, superseded_by, span. state.json keeps the facts
  as the copy that syncs; the page reads SQLite.
- Search: jieba words ∪ CJK bigrams in an FTS5 unicode61 table
  (Traditional text goes through Simplified first), weighted share of
  query terms hit; plus local vectors, vec = clamp((cos−0.35)/0.35).
  score = max + 0.15×min, events ×0.9. ≥0.15 suggested, ≥0.5 ticked,
  ≥0.55 carried when nobody chose (3 at most).
- What the model gets: the system prompt has the time zone and the
  pinned memories only, the same every turn. Each person message gets
  〔送出時間〕 and 〔相關記憶〕 from Message.memories, built in
  group_history into a transient Message.context, so the beginning of
  a chat reads the same next turn (cache hits) and the event log,
  skills and audit see only what was typed. A memory already carried
  in view isn't carried again; each carry counts a use.
- Picks travel with the message: Cmd::Send / POST send / sync act
  "memories" (empty = none; absent = the brain chooses, once, saved).
- remember finds the like one (cos ≥ 0.85 or the same words) and asks
  for `replaces`; the old one is superseded, never carried. A fact
  forgotten and remembered again comes back. New search_memory
  (query, kind), with dates; read-only.
- Nightly on the brain, no model: events past 30 days fold into a line
  per week (「11/3–11/9 做過的事(14 件):整理照片 ×3…」, ≤400 chars,
  like with like by words or vectors), weeks past 180 days into months;
  the folded go to 最近刪除 for 30 days. Facts are never removed. The
  page offers duplicates, facts unused for half a year, and what can
  fold now.
- Local model: minishlab/potion-multilingual-128M through m2v.rs (same
  token ids as model2vec-rs on 13/13 sentences, cos ≥ 0.9999, without
  tokenizers' 1.1 GB). Converted while downloading: vocab.bin,
  table.i8 (int8 + row scales), dims.json, 137 MB kept of 530 MB;
  ANYBOT_HF_BASE picks a mirror (now passed into the server's brain
  container too). Loaded when first needed (34 ms), let go after 10
  idle minutes. The brain loads it; a screen only with a document
  folder set; hands and phones never. 設定 › 一般 › 語意搜尋:
  本機模型/Ollama/關閉; a new engine clears every vector.
- Three files, three connections: memory.db (backed up nightly, 7
  kept), docs.db (a cache), oplog/audit.db (30 days). An old audit.db
  hands its memories and documents over once and shrinks (a real one:
  172 MB → 16 KB). docs_search scans every chunk now, vectors cached
  in RAM (it stopped at 8000); FTS optimize + VACUUM daily (260 MB of
  tombstones over 31 MB of text).
- API: POST /api/memory (owner) and /api/sync/memory (mirror). Reads
  answer on the HTTP thread; writes go through phone_act("memory").
- Screens: a memory dialog (Bot menu 記憶…, Bot settings 打開記憶) with
  counts, live search, filters, suggestions, per-item kind/date/uses
  and pin/edit/forget/restore; chips above the composer 300 ms after
  typing stops, with a token estimate; 「帶了 N 條記憶」 under person
  messages. The phone has the same as a 記憶 tab, chips and tag.

Checked: make test passes (app 297, relay 16), with new tests for the
scores and thresholds, Traditional Chinese segmentation, remember's
dedupe and replaces, two turns sending the same beginning, no double
carry, weekly/monthly folding and the trash, and the audit.db move.
Brain idle 37 MB as before, ~230 MB with the model loaded; search on
the brain 0.2–0.5 ms, 7–44 ms from the phone page. A deadlock found on
the way (stats re-taking the lock) is fixed and tested.

Docs: docs/memory.md has the whole design; FEATURES.md, protocol,
architecture (zh/en), multi-device and install say what changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3SYw9JJ9dXwaNvYh4
2026-11-11 07:46:50 +08:00
daniel wang db20659ffb Merge c1/prompt-cache: Anthropic prompt caching 2026-11-09 16:44:57 +08:00
AnyBot Dev dbb78dc931 Anthropic prompt caching: ephemeral breakpoints on system, tools and the history tail, with cache-hit counters
A computer-use turn sends the same system + tool schemas every step, and the
history is append-only between steps: three breakpoints (system, last tool,
last content block) let steps 2..n of a turn read the cache the first step
wrote. CACHE_STATS counts input/cache_read/cache_creation tokens for make
doctor and the bench (target: cache_read > 70% of input on Claude routes).

Follow-ups in the plan (same item): freeze facts into the request at turn
start, keep the quick-model tool list constant per step (stable prefixes).
2026-11-09 16:42:06 +08:00
AnyBot Dev 1bc2fdcec9 Rewrite decompilation comments as behaviour specs; move reverse-engineering docs out of the repo; drop third-party marks from UI strings (i18n tables synced) 2026-11-09 16:37:33 +08:00
王性驊 b92abeb79a Merge harness-durable: the work log and 「繼續」 card join the planned, quick-model turn
One model call per step now: a replay step needs none; the quick model's step falls back to the
bot's model when it can't be used (but a too-long chat is folded and asked again, whichever model
asked); each attempt is in the work log. A zoom is a look (safe to do again after a crash).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha5F5gJt93t3yEx3XcS
2026-11-09 09:02:46 +08:00
王性驊 1202de93ad Bots work like someone who knows the computer: they know each machine, reach what they see, plan, and hand the planned steps to a quick model
Measured on the bot's own box (8 tasks x 2, grok-4.7): 14/16 done, 120 steps, 1114 s before;
16/16, 102 steps, 574 s after (model time 1015 -> 471 s). A replayed skill: 49 s -> 15 s.

Knowing the machine
- facts.rs: 電腦現況 per computer (system, desktop, systemd, sudo, network, package manager,
  tools, apps, a fixed TZ), read once by a small read-only probe, kept 30 min, in the
  instructions at the start of a turn.
- The box's sudo is the bot's: only what follows sudo is checked against the always-denied
  list (it was refused outright, while the instructions said it could sudo), and commands with
  sudo run as the box's root (setuid does nothing under gVisor).
- Box image v8 drops ENV TZ=UTC (it overrode /etc/localtime). ANYBOT_BOX_IMAGE /
  ANYBOT_BOX_VOLUME give a throwaway box its own image and volume, never adopting the real one.
- Mac shell sandbox: App Store app CLIs (they carry their own app sandbox) and ps/top run
  outside it; plain `osascript -e` too, asked the first time even in direct mode, refusing do
  shell script, terminals, keystrokes, file reads, ObjC and the secret folders. A command the
  sandbox broke says so, instead of looking like a broken program.

Reaching what it sees
- The Mac menu bar's status icons are numbered (each app's AXExtrasMenuBar, named from inside
  for the system's own), computer_use_zoom looks closer at full sharpness.
- Numbers stay with their controls from look to look (they were reassigned every look, so a
  step's second click landed elsewhere); the box's front window is listed first; a control can
  be named instead of numbered (name "4").
- Web page numbering walks open shadow DOM (Chromium settings, web components).
- A box on a Docker host elsewhere retries the next port when the usual one is taken (a retry
  without it came up with no network).

Working like a person
- Instructions: pick the route, know what done looks like, one route, check once, say what's
  stuck instead of faking it with a substitute, ask before cutting the connection.
- StepPlan: the bot's model takes the first step, the step after trouble (failed, refused,
  repeated, nothing changed on screen, the quick model switching routes), one in four, and the
  final check; a quick model (Bot.step_model, auto: grok-4.20-0309-non-reasoning on xAI) does
  the planned steps in between, falling back to the bot's model if it can't be used.
- Skills keep the steps that worked (with what each acted on, not numbers); replay_skill does
  them again with no model in between, finding each control again, handing back on a mismatch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha5F5gJt93t3yEx3XcS
2026-11-09 09:01:03 +08:00
王性驊 2f603c2362 A turn cut off by a crash leaves a 「繼續」 card, and nothing it may have done runs twice
Each bot keeps a work log (oplog/bot-<id>.jsonl, after pi's durable-harness design, cut down):
before something happens a line says it is about to — the turn, each model call, each step once
its checks passed (with the arguments it runs with and whether it may run again), each message
typed mid-turn — synced to disk first. When the turn ends the file shrinks to the messages still
waiting, usually nothing.

On the next start after AnyBot was killed mid-turn, the log puts the chat right before anything
runs: the message the turn answered comes back if the chat lost it; a step that was running and
reaches outside (a text, a click, a file, a published site) shows as 「可能已經執行了」, both to the
person and in the result the bot reads — no longer as "not allowed"; a step that only looked shows
as cut off; messages typed mid-turn that never reached the bot go back into the chat. The chat is
saved, then the log closes the turn. A turn the person didn't stop ends with a 「繼續」 card (what
it was doing, what may have run, the messages put back); it goes on only when they press it — in
the window, on a screen of the brain, or on the phone — from where its steps stand, never running
a step that may have run again. Pressing stop is on disk at once, and a stopped turn stays
stopped.

Also in the turn loop:
- 自動審核 that doesn't answer (or answers something that isn't a verdict) asks the person; in
  直接操作 mode it used to let the step through unchecked.
- "Too long for this model" folds older messages into a summary and asks the same step again,
  once per thing the person said, instead of ending the turn.
- Folding keeps the person's chat whole: the summary goes in at the fold and the model reads from
  the newest summary on (it used to delete what it folded).
- A step moved to the chosen computer runs there, but the chat keeps the call as the model wrote
  it; the result says where it ran.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha5F5gJt93t3yEx3XcS
2026-11-09 00:49:12 +08:00
王性驊 cbada6bdb1 Bots learn from what they did; the box's browser works with the box's own disk
- A job of five or more real steps is looked back on after the answer: the short way that
  worked becomes a skill (or improves the one it followed); the reply says so. The prompt has
  the bot check its skills before starting.
- Upload, download and PDF on Bot 的電腦's browser look for and save files in the box, not on
  the brain (a picture in a Threads post took 24 steps).
- The bot's browser keeps the six tabs used last (19 Threads tabs had filled the box's 2 GB).
- Words name the control, not the box around it: a form's 「Customer name:」, 「Large」 and
  「Submit order」 used to land on the <p> holding them and do nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha2RVfSYmrhqNnqx9Z4
2026-11-06 23:12:53 +08:00
王性驊 ee92da8519 Looking at the person's screen is quick; a busy model is waited out in words; files go straight from their computer
From the second round of real runs:
- Direct mode no longer asks the model to check "always ask" rules before steps that only look
  (screenshot, showing the screen, reading a page or file): none of those rules can be about them,
  and the check cost each look at the person's Mac 10-20 s. Clicks and typing are still checked.
- An error inside the model's answer stream ("The model is currently at capacity…") is retried after
  8 s and said in Chinese; it used to become the bot's reply, in English, never retried.
- send_file says it sends from any computer, the person's included (the bot copied a file to its own
  computer first, which only works for text).
- A shown screen's file name carries no time (a server's clock is UTC).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha2RVfSYmrhqNnqx9Z4
2026-11-06 19:47:43 +08:00
王性驊 76a76c7d7a Whole control flow checked against real chats: what the bot sees is what is there, every step lands, nothing done twice
Web
- web_fetch kept pages with a <header> only up to it (taken for <head>): articles came back as their menus.
- browser_open waits for the page to load and returns it like browser_read (one step fewer per page);
  actions wait for the page to hold still instead of fixed 1-2.5 s sleeps; one way to reach the tab.

The bot's computer (box v6)
- Numbers only on what can be seen: clipped to the window and the page's visible area, none under
  another app's window (a link scrolled under the toolbar was numbered on Back).
- press_key with a typed character no longer swallows the keys after it (xdotool type --args 1).
- The person's input through noVNC/TigerVNC is noticed again (fence, continuous updates, QEMU keys).
- "Nothing changed" only after clicks, scrolls and drags; long text is pasted; one screen step at a
  time; one docker inspect per step when the box is known ready; poppler-utils for long PDFs.
- One typing path and fewer round trips (stdin variant, unused picture path, extra batch execs gone).

The person's computers
- Linux: the window system's front app when it has one, and the reason when there is none (was 「」);
  hidden and off-screen controls get no number; wording no longer names a tool that doesn't exist.

The loop
- Without Docker, the bot's own computer runs no commands where there is no sandbox (Linux, Windows):
  it was a plain shell on the brain itself, keys in reach, asked nothing.
- The bot's own computer is re-checked each step; unreachable computers are failures, not safety
  blocks; no direct-mode note on every result; an empty reply is asked again; scrolling and keys
  aren't counted as going in circles; steps aren't moved to a computer that can't do them.
- One finish() for every step's result, keep_grant(), dead appctl list_computers/SERVING and the
  impossible server branches removed; duplicated prompt instructions merged.

Tests: 162 (Mac) / 166 (Linux) unit; real box drills 6/6 on box v6; a brain without Chrome browses
on its box; remote E2E 28/28.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha2RVfSYmrhqNnqx9Z4
2026-11-06 17:44:59 +08:00
王性驊 8e9736a7db Long tasks finish and the box's browser works from a cloud brain
- A turn may take up to 100 steps (was 25, which cut off real work; Grok Bot sets no limit).
  Every 25 steps the bot is asked whether it is still getting anywhere.
- The system prompt asks for independent tools in one step and combined commands.
- Browser steps for the box always go to the box's Chromium. They used to depend on whether
  the brain itself had a Chrome, so a cloud brain sent them to "the person's browser".
- The box's DevTools forward passes bytes with a plain read/write loop. std::io::copy splices
  on Linux and held back short requests, so the box browser never opened from a Linux brain.
- A gateway's HTML error page shows as plain words.
- Real test a_brain_without_chrome_browses_on_its_box (ignored): passes in a Linux container
  with no Chrome against a real box, and fails without the routing fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha2RVfSYmrhqNnqx9Z4
2026-11-06 16:51:25 +08:00
王性驊 46c0684cb4 需要處理: a bot hands a step to the person with its computer's live screen in the chat; the window fills to the top; the 電腦 card and viewer keep their text in place
- hand_over_computer (the original's box hand-off card): instruction, live screen with 接管,
  跳過 / 我完成了 / 接管; 我完成了 also in the viewer; a typed message answers it too. Header,
  sidebar and notifications say 等你處理 / 「{name}:需要你」; the phone shows it with 接管.
- Mac: the content reaches the top (no grey title bar); the top strip drags the window.
- Panel 電腦 card: each line stops before the picture; the brain's name on its own line.
- Viewer: buttons first, the title ends in … when narrow; the picture is centred.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 17:29:55 +08:00
王性驊 96174c4776 Stream deltas keep tool-call slots; chunked bodies accepted; portal sessions race-safe 2026-11-05 15:48:20 +08:00
王性驊 c1e4994219 Cloud brain uses a model on the person's network through their computer; the chosen computer is where a bot works
- A brain that can't reach a model at a private address (e.g. Qwen at 10.x) sends the request
  through its hands; the hands only forward to addresses on their own network, and only for
  their brain (uses the existing device channel, so the account server is unchanged).
- The computer chosen for a bot is binding: a step naming another computer goes to the chosen
  one unless the person's message names that one (「在我的 Mac 上」).
- Browser steps follow the computer: Bot 的電腦 drives the Chromium on its own desktop (through
  docker exec, no new port), 你的電腦 its browser; before, they always used this computer's.

Checked: on this Mac, Bot 的電腦 browsing opened example.com in the box's Chromium and an
unasked 你的電腦 command ran in the box; 「在我的 Mac 上」 ran on the Mac. Linux brain in Docker
with 10.0.0.0/8 blocked + this Mac as hands: model calls went through the Mac, shell on
你的電腦 answered from the Mac, browser defaulted to the Mac's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 15:00:31 +08:00
王性驊 f2d89ca358 看圖小幫手 also looks at the newest screenshot
A model that can't see pictures got only 「截圖已拍好,但看不到」 for computer_use_screenshot.
Now the newest screenshot is described by a model of the person's that can (windows, text,
buttons and roughly where they are); older screenshots stay a short note.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-05 08:21:34 +08:00
王性驊 64e67673c8 Pictures for models that can't see them; bots can read the chat's attachments
- 看圖小幫手: when a bot's model can't take pictures, a model of the
  person's that can (Grok, Claude, GPT, Gemini… whichever has a key)
  describes each picture the person sent, text and numbers included, and
  the bot gets that description. Remembered per picture; helpers that
  fail are skipped for ten minutes.
- On the Mac, commands still can't read AnyBot's data folder (the keys),
  but may read the chat's attachments in it (not write them).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 21:52:06 +08:00
王性驊 d7ee3f5db9 AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 16:51:51 +08:00