在前一篇測試中, 我利用 /new 後的簡單提問, 發現 21k in tokens 似乎是 coding 與 full 模式的 context 基本消費, 暫時接受此事實後採取了 primary + fallback 方式來解決使用 Gemini 模型時碰到的 TPM 問題, 即當 Gemini 2.5 Flash 免費配額用完時, 自動改用付費的備援模型 GPT 5.6. 本篇則是要進一步測試看看 21k context 能否在 minimal 模型下有效降低.
pi@pi4b:~ $ openclaw config schema | python3 -c '
import sys, json
s = json.load(sys.stdin)
tp = s.get("properties", {}).get("tools", {}).get("properties", {}).get("profile", {})
print(json.dumps(tp, indent=2, ensure_ascii=False))
'
│
◇
{
"anyOf": [
{
"type": "string",
"const": "minimal"
},
{
"type": "string",
"const": "coding"
},
{
"type": "string",
"const": "messaging"
},
{
"type": "string",
"const": "full"
}
],
"title": "Tool Profile",
"description": "Global tool profile name used to select a predefined tool policy baseline before applying allow/deny overrides. Use this for consistent environment posture across agents and keep profile names stable."
}
可見此版 OpenClaw 有 full, coding, messaging, 與 minimal 這四種工具模式, 各模式的用途與定位摘要如下表 :
| 模式(Profile) | 工具涵蓋範圍 | 適用場景與定位 |
|---|---|---|
| "full" (完整代理模式) |
包含終端執行(bash/exec)、檔案讀寫(fs)、工作區管理、系統診斷以及網路模組(web_search、web_fetch)等全套工具。 | 自主型 Agent。適用於讓 OpenClaw 自動跑指令、寫檔、建專案、排查主機問題的完整運作場景。In Token 負擔極重 (約 18k ~ 24k+ tokens)。 |
| "coding" (開發專用模式) |
集中在程式開發核心工具(檔案讀寫、終端執行、工作區檔案搜尋),剔除不必要的雜項監控與對話擴充工具。 | 程式碼助手。主要針對在 CLI 或 IDE 環境下進行寫程式、重構代碼、除錯與 Git 操作。In Token 負擔重 (約 12k ~ 18k tokens)。 |
| "messaging" (通訊軟體專用模式) |
停用本機系統級別工具(無終端機指令、無本機檔案系統讀寫),僅保留通訊會話管理、記憶體/上下文標記、以及依設定啟用的外聯能力(如聯網搜尋)。 | 通訊軟體機器人。專為 LINE、Discord、Telegram 等即時通訊設計,避免把巨量 Linux 工具描述塞進每一句日常問答中。 In Token 負擔極輕 (約 1k ~ 3k tokens) |
| "minimal" (極簡/最小化模式) |
關閉所有選用與外部工具,僅保留 Agent 執行環境最底層的生命週期核心指令(Core baseline only),不注入任何龐大的額外 Tool Schemas。 | 純文字對話 / 嚴格 Token 控管。適合將機器人當成純粹的問答助理,或模型配額極為吃緊(避免觸發 429 Rate Limit)時使用。In Token 負擔最輕 (數百 tokens)。 |
以下將使用 minimal 模式來進行測試.
1. 備份 OpenClaw 設定檔 :
在進行模式變更前, 先備份設定檔 :
pi@pi4b:~ $ cp ~/.openclaw/openclaw.json ~/.openclaw/openclaw.json.bak.$(date +%Y%m%d%H%M)
確認 OpenClaw 設定檔備份已建立 :
pi@pi4b:~ $ ls -l ~/.openclaw/openclaw.json*
-rw------- 1 pi pi 2916 10月 8 02:45 /home/pi/.openclaw/openclaw.json
-rw------- 1 pi pi 2855 10月 8 02:45 /home/pi/.openclaw/openclaw.json.bak
-rw------- 1 pi pi 2855 10月 8 02:43 /home/pi/.openclaw/openclaw.json.bak.1
-rw------- 1 pi pi 2864 10月 8 02:33 /home/pi/.openclaw/openclaw.json.bak.2
-rw------- 1 pi pi 2916 10月 8 09:30 /home/pi/.openclaw/openclaw.json.bak.202610080930
-rw------- 1 pi pi 2864 10月 6 23:27 /home/pi/.openclaw/openclaw.json.bak.3
-rw------- 1 pi pi 2903 10月 6 10:53 /home/pi/.openclaw/openclaw.json.bak.4
-rw------- 1 pi pi 2916 10月 8 03:18 /home/pi/.openclaw/openclaw.json.last-good
-rw------- 1 pi pi 1455 9月 5 15:58 /home/pi/.openclaw/openclaw.json.manual.bak
2. 修改 Tool Profile 為 minimal 模式 :
用下列指令將 tool.profile 由 coding 改為 minimal 模式 :
pi@pi4b:~ $ openclaw config set tools.profile "minimal"
│
◇
OpenClaw 2026.7.1-2 (0790d9f) — Hot reload for config, cold sweat for deploys.
Updated tools.profile. No gateway restart needed.
用下列指令讀取 tool.profile 設定值, 確認已變更 :
pi@pi4b:~ $ openclaw config get tools.profile
OpenClaw 2026.7.1-2 (0790d9f)
Your terminal just grew claws—type something and let the bot pinch the busywork.
minimal
驗證設定檔是否合規 :
pi@pi4b:~ $ openclaw config validate
│
◇
OpenClaw 2026.7.1-2 (0790d9f) — Your AI assistant, now without the $3,499 headset.
Config valid: ~/.openclaw/openclaw.json
設定完重啟 OpenClaw 服務 :
pi@pi4b:~ $ pkill -9 -f openclaw
pi@pi4b:~ $
確認行程 PID 已更新且正常運行 :
pi@pi4b:~ $ ps aux | grep openclaw
pi 2334870 103 5.4 27780076 436320 ? Ssl 10:18 1:33 /home/pi/.config/nvm/versions/node/v24.17.0/bin/node /home/pi/.config/nvm/versions/node/v24.17.0/lib/node_modules/openclaw/dist/index.js gateway --port 18789 --bind lan
pi 2336551 0.0 0.0 6112 2112 pts/2 S+ 10:20 0:00 grep --color=auto openclaw
累積運算時間 1:33 表示才剛啟始運行 1 分 33 秒, 行程狀態是健康的 Ssl (S=主迴圈已進入等待請求的待命狀態, s=Session leader, l=多執行緒, 事件迴圈的標準狀態, 沒出現殭屍 Z 或卡死 D 狀態即可), 且 OpenClaw Gateway 核心守護程序已正常綁定 LAN 與通訊埠 18789.
3. 用 LINE/Telegram 測試 :
在 LINE App 中先用 /new 開啟新對話, 然後問一聲早安, in tokens 驟降至 6.3k :
用 /status 檢視狀態 :
minimal 模式的瘦身效果非常顯著! In Tokens 數直接從原本的 21k 斷崖式降到了 6.3k tokens, 整整砍掉了超過 70% (約 15k) 的工具負擔. 這 6.3k 的基本盤主要是 :
- md 檔內容與系統提示 : 約 1k~1.5k
- LINE 通道狀態與核心 Lifecycle : 通訊軟體必要的 session 上下文管理
- minimal 基礎保留工具 : 最核心的系統回報或時間感知工具
以通訊軟體 Agent 來說 6.3k 是一個非常健康, 兼顧功能性與低消耗的平衡點.
但是在 minimal 模式下, OpenClaw 會關閉所有非核心的工具定義, 包含 :
- 網路模組 : web_search, web_fetch
- 檔案系統模組 : fs(讀寫檔案、目錄瀏覽等
所以無法即時搜尋網路查詢台積電 ADR 股價 :
之前安裝的 filesystem 技能包也無法使用 :
這次剛好主模型 Gemini 遇到 TPM 額度限制, fallback 到 GPT 模型, 還正確回應工作區有 7 個 md 檔, 但這並非是 GPT 真的動用外部工具去查檔案系統, 而是從 System Prompt 中找到的資訊. 這是因為在 OpenClaw 的架構中, 即使將工具模式限制為 minimal (完全關閉 fs 檔案讀寫工具), Gateway 在組裝給模型的上下文時, 依然會把這 7 個 Markdown 檔案的內容與標題塞在 System Prompt 的開頭, GPT 就是從這裡拿到資訊的.
只要叫它在工作區下新增一個檔案即可驗證 :
這兩個測試也剛好驗證前一篇做的 fallback 機制確實有用.
以上測試結果證實前一篇的結論, 在 coding 或 full 工具集模式下, 21k 的 in tokens 確實就是基本消費, 如果降級到 minimal 模式, 雖然 context 降到 6.3k 左右, 但只有聊天通訊功能, 能做的事情很少, 失去養龍蝦的意義.





沒有留言 :
張貼留言