Feishu Cache Guardian
飞书缓存配置守护工具。用于检查和修复 OpenClaw 飞书插件的 probe.ts 缓存配置。当飞书 API 健康检查的缓存时间被重置为默认值时,自动修复为60分钟缓存,避免API配额被快速耗尽。使用场景:OpenClaw升级后、飞书插件被覆盖后、定期检查缓存配置是否正常。
MIT-0 · Free to use, modify, and redistribute. No attribution required.
⭐ 0 · 169 · 1 current installs · 1 all-time installs
MIT-0
Security Scan
OpenClaw
Suspicious
medium confidencePurpose & 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.
What to consider before installing
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.Like a lobster shell, security has layers — review code before you run it.
Current versionv1.0.0
Download zipapi-quotacachefeishulatestoptimization
License
MIT-0
Free to use, modify, and redistribute. No attribution required.
SKILL.md
Feishu Cache Guardian - 飞书缓存守护
背景
OpenClaw 的飞书通道每分钟会执行一次健康检查,调用 probeFeishu() 函数获取机器人信息。如果没有缓存机制,每月会产生约 43,200 次 API 调用,远超飞书免费配额的 10,000 次/月。
郑工长的优化方案添加了缓存机制:
- 成功响应缓存 60 分钟
- 失败响应缓存 60 分钟
问题:每次 OpenClaw 升级都会覆盖 probe.ts 文件,导致优化失效。
功能
本技能提供自动检查和修复功能:
- 检查
probe.ts的缓存配置是否为 60 分钟 - 如果被重置为默认值,自动修复
- 修复后自动重启 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%
注意事项
- 每次 OpenClaw 升级后,probe.ts 可能被覆盖,需要重新应用优化
- 建议设置定时检查任务,确保配置始终有效
- 脚本会自动重启 Gateway,修复后立即生效
Files
3 totalSelect a file
Select a file to preview.
Comments
Loading comments…
