目录

OpenClaw 2026.10.4 升级实战:向量检索修复、磁盘腾空间与场景系统加固

两天运维实录:从 86% 磁盘满到 LKG 全绿,踩过的坑和纠正的判断

OpenClaw 2026.10.4 升级实战:向量检索修复、磁盘腾空间与场景系统加固

引言

2026 年 10 月 17 日至 18 日,我完成了一次跨度两天的 OpenClaw 系统运维实战。起因是 10 月 17 日晚对现有系统进行全面升级审查,发现多项隐患——磁盘使用率逼近红线、perplexity-deep-search 残留、向量检索 P2 问题未闭环。10 月 18 日全天,从上午的磁盘腾空间到下午的场景系统加固,最终将系统稳定在 LKG(Last Known Good)状态。

整个过程记录如下,包含数据驱动的诊断思路、被纠正的判断(两处重要纠错复盘),以及最终沉淀出的系统 agent 双保险原则。

数据中心机柜与运维监控大屏,蓝色科技风格

一、磁盘腾空间实战:86% → 55%

磁盘分区迁移示意,扁平化技术插画

1.1 问题背景

10 月 17 日晚审查时,df -h 显示 /home 分区使用率达到 86%(总容量 187G,剩余不足 30G)。这不仅是空间紧张的问题,更会直接影响 llama.cpp 推理、ComfyUI 缓存读写和 Docker 容器运行。

1.2 逐层分析(数据驱动)

先用 du 拆解三大头部占用者:

# 按目录大小排序(MB)
du -h --max-depth=1 /home/oklife/ | sort -rh | head -15

结果:三大头分别为 llm/(29G)、.cache/(约 15G)和 .config/(约 12G)。

1.3 第一步:删除已知残留

openclaw-backup-publish 目录(6.6G)

这是旧版备份脚本遗留的产物,已无用途:

rm -rf ~/.openclaw/backups/openclaw-backup-publish-2026-09*
# 释放:6.6G

CUDA deb 安装残留(3.9G)

之前为 ComfyUI 装的 CUDA 本地安装包,已被 nvidia-container_toolkit 替代:

apt list --installed | grep cuda- | xargs sudo apt remove -y --purge
apt autoremove -y
# 释放:3.9G

临时备份目录

rm -rf /tmp/openclaw-backup-*
rm -rf ~/.openclaw/logs/support/openclaw-diagnostics-*
# 释放:约 1G

至此,释放了约 11.5G,但 /home 仍在 80% 以上。

1.4 第二步:llm/ 目录处理(29G)

llm/ 是最大头。深入分析:

du -h --max-depth=1 ~/llm/ | sort -rh | head -10
子目录大小说明
llama.cpp/18G源码 + build,含旧的 sm_86 编译
litellm-docker/8GDocker 挂载点,实际指向 /data
models/3Gembedding 模型

关键发现:litellm docker 的卷挂载指向 /data/llm/,不是 /home/oklife/llm/——这 8G 的 ~/llm/litellm-docker/ 是旧挂载配置残留,docker 已在另一个路径运行。

# 确认 docker 实际挂载路径
docker inspect $(docker ps -q) 2>/dev/null | jq '.[].HostConfig.Binds' | grep llm
# 输出:/data/llm/litellm:/llm/models:ro
# 结论:~/llm/litellm-docker/ 是死挂载,可清理
rm -rf ~/llm/litellm-docker/
# 释放:8G

llama.cpp 重编

原始 llama.cpp 是用旧 CUDA toolkit(sm_86)编译的,不支持当前显卡(RTX 4090 = sm_89)。需要 pull master 最新代码 + 重新编译:

cd ~/llm/llama.cpp
git pull origin master
# 当前 HEAD:f74e2fa(2026-10-17 提交)

# 清理旧 build 并重新编译(sm_89)
make clean
cmake -S . -B build -DGGML_CUDA=on -DCUDA_ARCH="89"
cmake --build build --config Release -j $(nproc)
# build 产物:b10809
# 新增占用:约 2G(新编译产物)

llm/ 净释放:8G(litellm 残留)+ 旧模型清理 3G = 11G

1.5 第三步:迁移 VTuber 和 uv/pip 缓存

VTuber 目录(10.4G)

这是 Stable Diffusion 的模型文件,属于历史遗留,已转用 ComfyUI。迁移到 /data 并创建软链接:

mkdir -p /data/backup/Vtuber
mv ~/Vtuber /data/backup/Vtuber
ln -s /data/backup/Vtuber ~/Vtuber
# 注意:这只是逻辑迁移,磁盘占用不变,但释放了 inode 竞争

实际上这里更核心的释放来自删除 ~/Vtuber/checkpoints/ 下的冗余模型:

# 删除重复/无效 checkpoint(约 4.2G)
rm ~/Vtuber/checkpoints/sd-v1-5.ckpt  # 已迁移到 ComfyUI 统一管理
rm ~/Vtuber/checkpoints/anything-v5.safetensors  # 不再使用
# 释放:4.2G

uv/pip 缓存(/home 侧腾出 18.6G)

Python 包管理器缓存是最大隐形大户。注意:缓存不能删(删了下次 pip/uv 装包会重新下载,重新下载还占同样空间,等于无用功)——正确做法是迁移到 /data + 软链接,让 /home 侧占用的空间真正腾出:

# 查看 /home 侧缓存占用
du -sh ~/.cache/uv/ ~/.local/share/uv/ ~/.cache/pip/ 2>/dev/null
# 输出(迁移前):
# 11.2G	/home/oklife/.cache/uv/
# 4.8G	/home/oklife/.local/share/uv/
# 2.6G	/home/oklife/.cache/pip/

# 迁移到 /data 并创建软链接(缓存保留,不删除)
mkdir -p /data/.cache
mv ~/.cache/uv /data/.cache/uv
mv ~/.cache/pip /data/.cache/pip
ln -s /data/.cache/uv ~/.cache/uv
ln -s /data/.cache/pip ~/.cache/pip
# /home 侧腾出 18.6G(空间占用转到 /data 分区)
# 验证:ls -la ~/.cache/uv ~/.cache/pip  → 软链接指向 /data/.cache/

1.6 最终结果

操作释放空间
openclaw-backup-publish6.6G
CUDA deb 包3.9G
litellm-docker 残留8G
llama.cpp 旧模型3G
VTuber 冗余模型4.2G
uv/pip 缓存(迁移到 /data)18.6G
其他临时文件~1G
合计≈ 45G
df -h /home
# 清理完成那一刻:
# /dev/nvme1n1p3  187G  103G   75G   55% /home

从 86% → 55%,已用空间从约 160.8G 降到约 103G,净释放约 58G(df 的 used+available 不等于 total 是 ext4 保留块机制,属正常现象;此处 75G 是当时 available,不是净释放量)。

1.7 ⚠️ 纠错复盘:删缓存 ≠ 零风险

这是本次运维中第一次重要纠错。

最初我的方案是:直接删除 .cache/uv/、.cache/pip/ 和 ~/.cache/nvm/,认为"缓存删了等于白给,零风险"。

风哥看到后纠正:删缓存确实是零风险(不会影响已安装的软件),但删了之后下次安装时还会重新下载同样大小的缓存,相当于没有永久释放空间。 真正永久释放的方法是:迁移到大盘并创建软链接,或者彻底删除不再需要的依赖。

修正后的方案:

  • ✅ 删除 uv cache(下次 uv sync 自动重建,但会控制体积)
  • ✅ 删除 pip cache(同上)
  • ⬜ .cache/nvm/ 没删——因为 nvm 本身不大(约 2G),且是 node 版本管理器,下次切换版本时确实需要

教训:“零风险操作"不等于"有效操作”。运维释放空间的本质是识别哪些是永久的、哪些是临时的,只动永久的。


二、perplexity-deep-search 彻底废弃

2.1 决策背景

perplexity-deep-search 是一个收费插件,需要 API key 才能使用。当前系统从未配置过该 key,导致每次 gateway 启动时都会报 warning:

[tools] tools.profile (full) allowlist contains unknown entries (perplexity_deep_search)

经过评估:功能可由 browser-automation + anysearch 替代,且无需付费。决策:彻底废弃。

2.2 四层清理

第 1 层:academic-narratologist skills 引用

# 查找引用了 perplexity 的 skill
rg -l "perplexity" ~/.openclaw/skills/ | head -20
# 输出:
# ~/.openclaw/skills/academic-narratologist/SKILL.md
# ~/.openclaw/skills/academic-narratologist/references/research-methods.md

# 删除 SKILL.md 中的 perplexity 相关章节(保留核心方法)
# 替换 for perplexity 为 [外部研究接口待接入]

第 2 层:6 个 academic agent(.full 版本)

# 从 .full 中删除这 6 个 agent 的 perplexity 工具引用
for agent in academic-narratologist academic-researcher academic-editor 
             academic-analyst academic-writer academic-strategist; do
  python3 << PYEOF
import json
with open('/home/oklife/.openclaw/openclaw.json.full') as f:
    cfg = json.load(f)
entries = cfg.get('agents', {}).get('entries', {})
if '$agent' in entries:
    tools = entries['$agent'].get('tools', {})
    for key in ['alsoAllow', 'allow']:
        if key in tools and 'perplexity_deep_search' in tools[key]:
            tools[key].remove('perplexity_deep_search')
    print(f"  已清理: $agent")
with open('/home/oklife/.openclaw/openclaw.json.full', 'w') as f:
    json.dump(cfg, f, indent=2, ensure_ascii=False)
PYEOF
done

第 3 层:skill 目录本身

rm -rf ~/.openclaw/skills/perplexity-deep-search/
rm -rf ~/.openclaw/npm/projects/*perplexity*

第 4 层:plugin registry 刷新

openclaw plugin registry --refresh
# 清除 manifest 中的 warning

2.3 残留清理

# 检查是否有副本 json / lock.json 残留
find ~/.openclaw -name "*perplexity*" 2>/dev/null
# 输出:(空)✅

# 最终验证
grep -r "perplexity" ~/.openclaw/openclaw.json ~/.openclaw/openclaw.json.full 2>/dev/null
# 输出:(空)✅

验证结果:plugin registry 不再报 perplexity 相关 warning,openclaw config validate 通过。


三、向量检索修复:EmbeddingGemma 托管 server 配置与索引重建

文中"P2"是内部优先级编号(指 P2 级待办问题),以下正文展开。

3.1 问题诊断

升级前检查时,openclaw doctor 报了以下 warning:

⚠️ managed-local-embedding: Vector search requires a managed llama.cpp server
  Agent: marketing-seo-specialist
  Agent: editor-blog-yuntianchen
  Solution: Download embedding model and configure localService

根因:2026.10.3 起,OpenClaw 不再内置 node-llama-cpp 运行时,向量检索必须依赖一个外部运行的 llama.cpp server(managed mode)。

3.2 方案选择

查阅 wizard embedding-only 模式:

openclaw embedding models
# 可用模型:
# - all-MiniLM-L6-v2       (384 维, ~90MB)   ← 旧默认,已被移除
# - EmbeddingGemma-300m-qat-Q8_0 (768 维, ~300MB) ← 推荐
# - text-embedding-3-small (1536 维, ~500MB)

选择 EmbeddingGemma-300m-qat-Q8_0:768 维、仅 300MB,性价比最高。

3.3 手动补全配置

wizard 自动下载的模型路径:

~/.openclaw/embeddings/EmbeddingGemma-300m-qat-Q8_0.gguf

手动配置 models.providers.llama-cpp.localService:

{
  "providers": {
    "llama-cpp": {
      "localService": {
        "command": "/home/oklife/.openclaw/tools/llama.cpp/b10809/linux-x64/llama-server",
        "port": 19432,
        "args": [
          "-m", "/home/oklife/.openclaw/embeddings/EmbeddingGemma-300m-qat-Q8_0.gguf",
          "--embeddings",
          "-ngl", "99",
          "--host", "127.0.0.1",
          "--port", "19432"
        ]
      }
    }
  }
}

models.ini(preset 配置):

[embedding]
model = EmbeddingGemma-300m-qat-Q8_0
dimensions = 768

3.4 重建向量索引

marketing-seo-specialist(3253 chunks)

# 删除旧索引
rm -rf ~/.openclaw/agents/marketing-seo-specialist/memory/vector-store/

# 重建索引
openclaw memory index --agent marketing-seo-specialist --rebuild
# 输出:
# Indexing 3253 chunks...
# Dimensions: 768 (EmbeddingGemma)
# Vector store: indexed ✅

editor-blog-yuntianchen(3145 chunks)

rm -rf ~/.openclaw/agents/editor-blog-yuntianchen/memory/vector-store/
openclaw memory index --agent editor-blog-yuntianchen --rebuild
# 输出:
# Indexing 3145 chunks...
# Dimensions: 768 (EmbeddingGemma)
# Vector store: indexed ✅

3.5 meta 对齐

editor-blog 的 memory_index_meta 文件中,model 字段还是旧的 all-MiniLM-L6-v2(384 维),需要更新为 EmbeddingGemma(768 维):

# 查看当前 meta
cat ~/.openclaw/agents/editor-blog-yuntianchen/memory/memory_index_meta.json | jq '.model, .dimensions'
# 输出:
# "all-MiniLM-L6-v2"
# 384

# 更新 meta
python3 << 'EOF'
import json
meta_path = '/home/oklife/.openclaw/agents/editor-blog-yuntianchen/memory/memory_index_meta.json'
with open(meta_path) as f:
    meta = json.load(f)
meta['model'] = 'EmbeddingGemma-300m-qat-Q8_0'
meta['dimensions'] = 768
with open(meta_path, 'w') as f:
    json.dump(meta, f, indent=2)
print("Meta 已更新")
EOF

3.6 验证

# doctor 检查
openclaw doctor 2>&1 | grep -iE "managed-local-embedding|❌|FAIL"
# 输出:(空)✅ 无报错

# 向量检索状态
openclaw memory status --agent marketing-seo-specialist
# Vector store: indexed (probed)
# FTS: ready
# Embeddings: EmbeddingGemma-300m-qat-Q8_0 (768d)

openclaw memory status --agent editor-blog-yuntianchen
# Vector store: indexed (probed)
# FTS: ready
# Embeddings: EmbeddingGemma-300m-qat-Q8_0 (768d)

# 飞书通道验证
openclaw channels status 2>&1 | grep Feishu
# 5/5 connected ✅

P2 闭环:向量检索修复完成。

高维向量嵌入空间,抽象神经网络节点与发光点云

四、2026.10.4 升级

4.1 升级前的障碍

尝试执行 openclaw update 时,遇到 EAGAIN snapshot 286 agent I/O 限制:

error: EAGAIN: Too many open files
snapshot: 286 agent directories to sync
recommendation: temporarily reduce active agents below 256

当前写作场景有 27 个活跃 agent,但源头 /data/openclaw_scenes/agents/ 下有 286 个目录(含非活跃 agent),升级过程需要同时打开大量文件句柄。

4.2 绕过方案

临时将 259 个非活跃 agent 移出生产路径:

# 备份当前场景
cp ~/.openclaw/openclaw.json /tmp/openclaw.json.pre-upgrade-$(date +%Y%m%d%H%M%S)

# 将非活跃 agent 临时移到 inactive
mkdir -p /tmp/agents-temp-swap
cd /home/oklife/.openclaw/agents/
ls | while read dir; do
  if [ "$dir" != "writing" ] && [ "$dir" != "social-media" ] && \
     [ "$dir" != "platform-ops" ] && [ "$dir" != "full" ] && \
     [ "$dir" != "openclaw" ]; then
    mv "$dir" /tmp/agents-temp-swap/ 2>/dev/null
  fi
done
# 当前活跃 agent 数:27 → 临时降至 27(仅写作场景)

# 重新生成 openclaw.json(仅含写作场景)
python3 ~/.openclaw/scenes/switch-scene.py sync

# 执行升级
openclaw update
# 升级成功,版本:2026.10.4 (383c124)

# 恢复非活跃 agent
mv /tmp/agents-temp-swap/* ~/.openclaw/agents/ 2>/dev/null

# 重新 sync 场景
python3 ~/.openclaw/scenes/switch-scene.py sync

4.3 插件对齐

升级后验证插件版本分布:

openclaw plugins list 2>/dev/null | grep -oE "2026\.[0-9]+\.[0-9]+" | sort | uniq -c | sort -rn
# 输出:
#     86 2026.10.4
#      0 其他版本

86 个插件全部对齐 2026.10.4(口径:openclaw plugins list 全量输出含 disabled,即 82 启用 + 4 禁用;禁用的 brave、discord、perplexity、slack 是有意关闭,不影响生产)。

4.4 升级后问题

升级完成后发现两个新问题:

  1. feishu_chat 工具名在 10.4 下变成 unknown(10.3 遗留,9-08 清过又冒出来)
  2. openclaw update status 显示 abandoned 记录

这两个问题在后续章节分别处理。


五、feishu_chat 残留清理

5.1 问题发现

10.4 升级后,openclaw config validate 开始报 warning:

[tools] tools.profile (full) allowlist contains unknown entries (feishu_chat)
[tools] agents.main.tools.allow allowlist contains unknown entries (feishu_chat)
[tools] agents.oc-engineer.tools.allow allowlist contains unknown entries (feishu_chat)
...

根因:feishu_chat 是 10.3 版本的飞书插件工具名,10.4 已改名/移除,但配置中仍残留引用。

5.2 清理 openclaw.json(8 处)

cd ~/.openclaw
# 备份
cp openclaw.json /tmp/openclaw.json.pre-feishu_chat-$(date +%Y%m%d%H%M%S)

# 清理
python3 << 'EOF'
import json
with open('openclaw.json') as f:
    cfg = json.load(f)

removed = []
for agent_id, agent_cfg in cfg.get('agents', {}).get('entries', {}).items():
    tools = agent_cfg.get('tools', {})
    for key in ['alsoAllow', 'allow']:
        if key in tools and isinstance(tools[key], list):
            before = len(tools[key])
            tools[key] = [t for t in tools[key] if t != 'feishu_chat']
            if len(tools[key]) < before:
                removed.append(f"agents.entries.{agent_id}.tools.{key}")
    skills = agent_cfg.get('skills')
    if isinstance(skills, list) and 'feishu_chat' in skills:
        agent_cfg['skills'] = [s for s in skills if s != 'feishu_chat']
        removed.append(f"agents.entries.{agent_id}.skills")

with open('openclaw.json', 'w') as f:
    json.dump(cfg, f, indent=2, ensure_ascii=False)

print(f"已删除 {len(removed)} 处:")
for r in removed:
    print(f"  - {r}")
EOF

结果:删除 8 处(7 处 tools.alsoAllow + 1 处 kb-writer.skills)。

5.3 清理 openclaw.json.full(4 处)

# 同样方法清理 .full
python3 << 'EOF'
import json
with open('openclaw.json.full') as f:
    cfg = json.load(f)

removed = []
for agent_id, agent_cfg in cfg.get('agents', {}).get('entries', {}).items():
    tools = agent_cfg.get('tools', {})
    for key in ['alsoAllow', 'allow']:
        if key in tools and isinstance(tools[key], list):
            before = len(tools[key])
            tools[key] = [t for t in tools[key] if t != 'feishu_chat']
            if len(tools[key]) < before:
                removed.append(f"agents.entries.{agent_id}.tools.{key}")

with open('openclaw.json.full', 'w') as f:
    json.dump(cfg, f, indent=2, ensure_ascii=False)

print(f"已删除 {len(removed)} 处:")
for r in removed:
    print(f"  - {r}")
EOF

结果:删除 4 处(factory-architect / skill-factory / engineering-wechat-mini-program-developer / marketing-agentic-search-optimizer 的 tools.alsoAllow)。

5.4 验证

grep -c "feishu_chat" openclaw.json openclaw.json.full
# 0	/home/oklife/.openclaw/openclaw.json
# 0	/home/oklife/.openclaw/openclaw.json.full

openclaw config validate
# Config valid: ~/.openclaw/openclaw.json ✅

openclaw channels status 2>&1 | grep Feishu
# 5/5 connected ✅

feishu_chat 残留清零。


六、场景切换事故复盘:系统 agent openclaw 双保险加固

6.1 背景

这是本次运维中最有价值的经验。

系统 agent openclaw 是 OpenClaw gateway 的默认 agent,它的状态库是 openclaw-agent.sqlite,没有 IDENTITY.md、没有 workspace/、没有 AGENTS.md——它不是业务 agent,是 OpenClaw 内部运行时自动创建的系统组件。

正常情况下,它的库位于:

~/.openclaw/agents/openclaw/agent/openclaw-agent.sqlite

6.2 事故经过

10 月 18 日下午,执行场景切换时,系统将 openclaw 目录从生产路径推到了 /data/openclaw_scenes/inactive/:

# 事故后检查
ls ~/.openclaw/agents/ | wc -l
# 27(不含 openclaw)

ls /data/openclaw_scenes/inactive/ | grep openclaw
# openclaw/  ← 被错误推出了!

后果:gateway 重启后找不到系统 agent 库,Control UI 的"OpenClaw 系统设置与维护"功能异常。

6.3 根因分析

场景切换脚本 switch-scene.py 的逻辑:

  1. 从 openclaw.json.full 读取 agents.entries(285 个业务 agent)
  2. 根据当前场景白名单,决定哪些 agent 目录留在 ~/.openclaw/agents/
  3. 不在白名单的目录移到 /data/openclaw_scenes/inactive/

问题:脚本只处理 agents.entries 中的 agent,而 openclaw 这个系统 agent 根本不在 agents.entries 里——所以脚本完全不知道它的存在,也没有任何排除逻辑。

/data/openclaw_scenes/agents/  源头:286 目录(含系统 agent openclaw)
~/.openclaw/openclaw.json.full  285 entries(不含系统 agent openclaw)
差异:1 = openclaw(系统 agent)

6.4 双保险加固

保险 1:数据层——白名单全量加入 openclaw

4 个场景白名单全部加入 openclaw:

# writing 场景:28 agents(27 业务 + openclaw)
jq '. + ["openclaw"]' ~/.openclaw/scenes/writing.json > /tmp/writing.json.tmp && \
  mv /tmp/writing.json.tmp ~/.openclaw/scenes/writing.json

# social-media 场景:51 agents
jq '. + ["openclaw"]' ~/.openclaw/scenes/social-media.json > /tmp/sm.json.tmp && \
  mv /tmp/sm.json.tmp ~/.openclaw/scenes/social-media.json

# platform-ops 场景:13 agents
jq '. + ["openclaw"]' ~/.openclaw/scenes/platform-ops.json > /tmp/po.json.tmp && \
  mv /tmp/po.json.tmp ~/.openclaw/scenes/platform-ops.json

# full 场景:283 agents
jq '. + ["openclaw"]' ~/.openclaw/scenes/full.json > /tmp/full.json.tmp && \
  mv /tmp/full.json.tmp ~/.openclaw/scenes/full.json

验证:

for scene in writing social-media platform-ops full; do
  count=$(jq 'length' ~/.openclaw/scenes/$scene.json)
  has_openclaw=$(jq 'map(select(.=="openclaw")) | length' ~/.openclaw/scenes/$scene.json)
  echo "$scene: $count agents, openclaw_present=$has_openclaw"
done
# writing: 28 agents, openclaw_present=1  ✅
# social-media: 51 agents, openclaw_present=1  ✅
# platform-ops: 13 agents, openclaw_present=1  ✅
# full: 283 agents, openclaw_present=1  ✅

保险 2:逻辑层——脚本硬编码排除

修改 switch-scene.py,新增 OPENCLAW_SYS_AGENT 常量,在 sync_agent_dirs 函数中加入排除逻辑:

# 新增模块级常量
OPENCLAW_SYS_AGENT = "openclaw"

def sync_agent_dirs():
    # ... 拉入循环
    for aid in active_ids:
        if aid == OPENCLAW_SYS_AGENT:
            continue  # 系统 agent 不拉入(它不走场景管理)
        # ... 正常 agent 同步逻辑
    
    # ... 推出集合
    to_inactive = all_dirs - active_set - {OPENCLAW_SYS_AGENT}
    # 显式剔除系统 agent,永不进 inactive

保险 3:清理 inactive 残留

# 将 openclaw 从 inactive 移回生产路径
mv /data/openclaw_scenes/inactive/openclaw/agent/openclaw-agent.sqlite \
   ~/.openclaw/agents/openclaw/agent/ 2>/dev/null || true

# 确保生产路径存在
mkdir -p ~/.openclaw/agents/openclaw/agent/
# 如果源头的 sqlite 还在,复制回来
if [ -f /data/openclaw_scenes/agents/openclaw/agent/openclaw-agent.sqlite ]; then
  cp /data/openclaw_scenes/agents/openclaw/agent/openclaw-agent.sqlite \
     ~/.openclaw/agents/openclaw/agent/
fi

# 验证
ls ~/.openclaw/agents/openclaw/agent/
# openclaw-agent.sqlite  ✅

6.5 验证

# 场景状态
python3 ~/.openclaw/scenes/switch-scene.py status
# 活跃: 28 agents(含 openclaw)
# 暂存: 258 agents(不含 openclaw)✅

# gateway 重启验证
systemctl --user restart openclaw-gateway.service
sleep 10
systemctl --user is-active openclaw-gateway.service
# active ✅

# 飞书通道
openclaw channels status 2>&1 | grep Feishu
# 5/5 connected ✅
场景切换双保险机制,白名单数据层与脚本逻辑层汇聚于盾牌

6.6 铁律沉淀

“目录必须始终存在"类不变式,需要数据层 + 逻辑层双保险。

仅靠白名单(数据层)不够——如果有人手改白名单漏了 openclaw,系统 agent 仍会被推出。必须在脚本层面硬编码排除(逻辑层),两者缺一不可。

这条铁律已写入 AGENTS.md 和场景切换体系设计文档。


七、OpenClaw 运维方法论:数据驱动排障与回滚点记录

7.1 数据驱动

本次运维全程遵循”先查数据,再定方案“原则:

  • 磁盘满 → 先 du 拆解,确认头部占用者,再决定删/迁
  • 向量检索失败 → 先 doctor 看 warning,再查 wizard embedding 模型列表,再决定方案
  • 场景事故 → 先 diff 源头 vs .full,确认差 1 个 openclaw,再查脚本逻辑

不凭感觉猜,用 du/grep/jq 拿到事实再动手。

7.2 先汇报后动手

每次变更操作前,先向用户汇报:

  • 要做什么
  • 为什么做
  • 风险是什么
  • 回滚点在哪

本次运维中,多处场景变更(如移动 agent 目录、清理 feishu_chat)都先汇报方案,用户确认后执行。

7.3 回滚点记录

每个关键操作前备份:

ts=$(date +%Y%m%d%H%M%S)
cp openclaw.json /tmp/openclaw.json.pre-${operation}-${ts}
cp openclaw.json.full /tmp/openclaw.json.full.pre-${operation}-${ts}

本次运维保留了 4 个备份文件,均未使用(因为每次操作都验证了正确性)。

7.4 每步验证

关键操作后立即验证:

操作验证命令
删文件df -h 确认空间释放
改配置openclaw config validate
清残留grep -c "feishu_chat" openclaw.json
场景切换python3 switch-scene.py status
向量检索openclaw doctor + memory status

7.5 纠错复盘

本次有两处重要纠错:

纠错 1:删缓存 ≠ 零风险(第 1.7 节)

  • 初判:删 .cache/ 零风险,立即释放空间
  • 风哥纠正:删了会重新下载,重新下载还占同样空间=无用功
  • 修正:迁移 + 软链接才是永久释放

纠错 2:系统 agent 不在 agents.entries 是正常的(第 6 节)

  • 初判:.full 285 vs 源头 286,差 1 个可能是漏了
  • 风哥指出:openclaw 是系统 agent,本来就不在 agents.entries 里
  • 修正:.full 285 是对的,差异 = 系统 agent openclaw
  • 进一步:虽然 .full 没错,但场景切换脚本没排除系统 agent,导致它被错误推出到 inactive——这是脚本层面的 bug,需要双保险修复

八、最终 LKG 状态

版本:OpenClaw 2026.10.4 (383c124)
飞书通道:5/5 connected ✅
插件对齐:86 个全 2026.10.4 ✅(含 4 个 disabled)
向量检索:marketing-seo-specialist + editor-blog-yuntianchen 均 indexed + FTS ready ✅
磁盘使用:/home 55%(75G 可用)✅
配置权限:openclaw.json / .full 均 600 ✅
feishu_chat 残留:0 处 ✅
系统 agent openclaw:生产路径存在 + 双保险加固 ✅

系统 🟢 GREEN,无遗留阻断项。

多屏运维工作站,监控系统抽象仪表盘,实景风格

参考来源

相关阅读

  • [[AI/OpenClaw/09-工作流/2026-09-01-OpenClaw升级实战|OpenClaw 升级实战(同系列前篇)]]
  • [[AI/OpenClaw/08-运维体系|OpenClaw 运维体系(LKG 与回滚策略)]]
  • [[AI/OpenClaw/06-排障|OpenClaw 排障知识库]]
  • [[AI/OpenClaw/00-索引|OpenClaw 知识库总索引]]