← Back to Skills Marketplace
zhs0430-sudo

Feishu Cache Guardian

by zhs0430-sudo · GitHub ↗ · v1.0.0
cross-platform ⚠ suspicious
381
Downloads
0
Stars
1
Active Installs
1
Versions
Install in OpenClaw
/install feishu-cache-guardian
Description
飞书缓存配置守护工具。用于检查和修复 OpenClaw 飞书插件的 probe.ts 缓存配置。当飞书 API 健康检查的缓存时间被重置为默认值时,自动修复为60分钟缓存,避免API配额被快速耗尽。使用场景:OpenClaw升级后、飞书插件被覆盖后、定期检查缓存配置是否正常。
README (SKILL.md)

Feishu Cache Guardian - 飞书缓存守护

背景

OpenClaw 的飞书通道每分钟会执行一次健康检查,调用 probeFeishu() 函数获取机器人信息。如果没有缓存机制,每月会产生约 43,200 次 API 调用,远超飞书免费配额的 10,000 次/月。

郑工长的优化方案添加了缓存机制:

  • 成功响应缓存 60 分钟
  • 失败响应缓存 60 分钟

问题:每次 OpenClaw 升级都会覆盖 probe.ts 文件,导致优化失效。

功能

本技能提供自动检查和修复功能:

  1. 检查 probe.ts 的缓存配置是否为 60 分钟
  2. 如果被重置为默认值,自动修复
  3. 修复后自动重启 Gateway 使配置生效

使用方法

手动检查/修复

node ~/.openclaw/workspace/skills/feishu-cache-guardian/scripts/check-and-fix.js

设置定时检查(推荐)

使用 OpenClaw 的 cron 功能,每天检查一次:

openclaw cron add \
  --name "feishu-cache-check" \
  --schedule "0 9 * * *" \
  --command "node ~/.openclaw/workspace/skills/feishu-cache-guardian/scripts/check-and-fix.js"

或在升级后立即检查:

openclaw cron add \
  --name "feishu-cache-post-upgrade" \
  --schedule "@reboot" \
  --command "sleep 30 && node ~/.openclaw/workspace/skills/feishu-cache-guardian/scripts/check-and-fix.js"

文件位置

  • 脚本:scripts/check-and-fix.js
  • 目标文件:/opt/homebrew/lib/node_modules/openclaw/extensions/feishu/src/probe.ts

缓存配置说明

修改的内容:

// 修改前(默认)
const PROBE_SUCCESS_TTL_MS = 10 * 60 * 1000; // 10 minutes
const PROBE_ERROR_TTL_MS = 60 * 1000;        // 1 minute

// 修改后(优化)
const PROBE_SUCCESS_TTL_MS = 60 * 60 * 1000; // 60 minutes
const PROBE_ERROR_TTL_MS = 60 * 60 * 1000;   // 60 minutes

效果

  • 优化前:43,200 次/月(单账号)
  • 优化后:720 次/月(单账号)
  • 减少比例:98.3%

注意事项

  1. 每次 OpenClaw 升级后,probe.ts 可能被覆盖,需要重新应用优化
  2. 建议设置定时检查任务,确保配置始终有效
  3. 脚本会自动重启 Gateway,修复后立即生效
Usage Guidance
This skill does what it says (it will patch probe.ts and restart the OpenClaw Gateway), but it modifies a globally installed OpenClaw extension file and may require elevated filesystem permissions. Before installing or running it: 1) Inspect the bundled script (it's included) line-by-line and verify the exact path matches your installation; 2) Back up the original probe.ts (and the containing package) so you can restore if something goes wrong; 3) Prefer running the script manually the first time rather than scheduling it; run it in a safe environment or container if possible; 4) Confirm you trust the author/repository (package.json points to a GitHub URL) and prefer getting a permanent fix upstream instead of repeatedly patching installed code; 5) Be aware you may need sudo/administrator rights to write /opt/homebrew/lib/node_modules and that the script will restart the Gateway (service interruption); 6) If you want lower risk, modify your deployment process to apply the fix during install/upgrade or ask the OpenClaw maintainers to integrate the change. If you need a checklist or a safer wrapper (dry-run, backup, confirmation prompt) I can draft one.
Capability Analysis
Type: OpenClaw Skill Name: feishu-cache-guardian Version: 1.0.0 The skill performs automated source code modification and service management, which are high-risk administrative actions. Specifically, `scripts/check-and-fix.js` uses `fs.writeFileSync` to patch a file in a global system directory (`/opt/homebrew/lib/node_modules/openclaw/extensions/feishu/src/probe.ts`) and `execSync` to restart the OpenClaw gateway. While the stated intent of optimizing Feishu API cache settings is plausible and the code is not obfuscated, the capability to modify the underlying platform's source code and restart services warrants a suspicious classification due to the potential for unintended system instability or unauthorized configuration changes.
Capability Assessment
Purpose & Capability
Name/description match the actual behavior: the script checks and patches probe.ts to change TTL constants to 60 minutes. However, the skill metadata declares no required config paths or privileges while the code targets a system-installed path (/opt/homebrew/lib/node_modules/openclaw/extensions/feishu/src/probe.ts). That missing declaration is an incoherence: the skill implicitly requires write access to a global module path but doesn't advertise it.
Instruction Scope
SKILL.md and the included script instruct the agent/user to read and overwrite a file under a global node_modules path and to run 'openclaw gateway restart'. These instructions reference system-level paths and a system command without explaining required privileges or making backups. The runtime instructions therefore go beyond innocuous checks and will modify another component of the installed OpenClaw runtime.
Install Mechanism
There is no install spec (instruction-only plus included script and package.json). No remote downloads or extraction steps are present. The included package.json points to a GitHub URL but the skill bundle contains the script for inspection, so there is no hidden install network action in the provided files.
Credentials
The skill declares no environment variables or credentials, yet it performs actions that require filesystem write permissions to a global package location and executes a gateway restart. Those privileges are not reflected in the manifest, and no guidance is given about required user permissions (e.g., whether sudo is needed). The script also modifies another plugin's source code (effectively acting across skill boundaries).
Persistence & Privilege
always is false and the skill is not forced into every run, which is good. However, the script writes to a global installed package file (other component's source) and restarts the Gateway. Modifying other skills' code and restarting services are system-level effects and should be considered a high-impact operation; the skill does this without declaring that it will change system-installed files.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install feishu-cache-guardian
  3. After installation, invoke the skill by name or use /feishu-cache-guardian
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release: - 自动检查 probe.ts 缓存配置 - 自动修复为60分钟缓存(飞书默认1分钟) - 修复后自动重启 Gateway 问题背景: - OpenClaw 飞书通道每分钟健康检查一次 - 默认配置每月产生 43,200 次 API 调用 - 远超飞书免费配额 10,000 次/月 解决方案: - 自动将缓存时间从 1 分钟改为 60 分钟 - 优化后每月仅 720 次调用,节省 98.3% - 每次 OpenClaw 升级后会覆盖修改,自动检测并修复 使用方法: 1. 手动运行:node scripts/check-and-fix.js 2. 或设置定时任务定期检查(建议每天定时检查)
Metadata
Slug feishu-cache-guardian
Version 1.0.0
License
All-time Installs 1
Active Installs 1
Total Versions 1
Frequently Asked Questions

What is Feishu Cache Guardian?

飞书缓存配置守护工具。用于检查和修复 OpenClaw 飞书插件的 probe.ts 缓存配置。当飞书 API 健康检查的缓存时间被重置为默认值时,自动修复为60分钟缓存,避免API配额被快速耗尽。使用场景:OpenClaw升级后、飞书插件被覆盖后、定期检查缓存配置是否正常。 It is an AI Agent Skill for Claude Code / OpenClaw, with 381 downloads so far.

How do I install Feishu Cache Guardian?

Run "/install feishu-cache-guardian" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Feishu Cache Guardian free?

Yes, Feishu Cache Guardian is completely free (open-source). You can download, install and use it at no cost.

Which platforms does Feishu Cache Guardian support?

Feishu Cache Guardian is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Feishu Cache Guardian?

It is built and maintained by zhs0430-sudo (@zhs0430-sudo); the current version is v1.0.0.

💬 Comments