OpenClaw Feishu Quota Guard
Use when a user wants OpenClaw itself to diagnose or fix Feishu/Lark quota burn caused by heartbeats, health checks, webhook probes, or overly expensive back...
Like a lobster shell, security has layers — review code before you run it.
License
SKILL.md
OpenClaw Feishu Quota Guard
Use this skill when OpenClaw is connected to Feishu/Lark and a user reports that free quota or paid API budget is draining unexpectedly.
This skill is based on a short Bilibili video about OpenClaw + Feishu quota burn and cross-checked against current OpenClaw docs. The likely failure mode is not "chat usage" itself, but background traffic:
- OpenClaw heartbeat runs that still hit a cloud model
- Feishu webhook or custom gateway health probes that accidentally trigger model work
Read references/source-notes.md only if you need the exact source-backed assumptions.
Quick Start
- Run the bundled fixer in the native shell for that machine:
- macOS/Linux:
bash scripts/run-once.sh --dry-run - Windows PowerShell:
powershell -ExecutionPolicy Bypass -File scripts/run-once.ps1 --dry-run - Any OS with Python:
python scripts/apply_feishu_quota_fix.py --dry-run
- macOS/Linux:
- If the summary only reports official/current OpenClaw heartbeat settings, run the same command without
--dry-run. - If the summary reports custom webhook or gateway health routes, keep the automatic heartbeat fix and then inspect those files manually.
- Restart the relevant process and verify from logs that repeated probes no longer trigger expensive model calls.
Default behavior of the bundled fixer
The bundled fixer makes only safe automatic changes to standard OpenClaw config:
agents.defaults.heartbeat.every = "1h"agents.defaults.heartbeat.lightContext = trueagents.defaults.heartbeat.isolatedSession = true- if
targetis missing, settarget = "none"
If you want a full stop instead of throttling, run:
bash scripts/run-once.sh --mode disable
On Windows:
powershell -ExecutionPolicy Bypass -File scripts/run-once.ps1 --mode disable
That sets:
agents.defaults.heartbeat.every = "0m"
Workflow
1. Confirm the topology first
Do not patch blindly.
- If the install uses the bundled/current Feishu plugin, treat this as a heartbeat-cost problem first.
- If the install uses a webhook bridge or custom gateway, inspect the health route before touching heartbeat settings.
Useful search terms:
channels.feishu@openclaw/feishuheartbeatHEARTBEAT.mdconnectionModewebhookverificationTokenhealthgateway
2. Fix path A: reduce or cheapen OpenClaw heartbeat work
Use this path for the official/current plugin, or anytime logs show scheduled heartbeat runs causing the spend.
Focus on:
~/.openclaw/openclaw.jsonor the workspace config the user actually runsagents.defaults.heartbeatagents.list[].heartbeatHEARTBEAT.md
Preferred order of fixes:
- First run the bundled fixer in throttle mode. It applies the lowest-risk cost reduction settings supported by current OpenClaw heartbeat docs.
- If heartbeat is not needed, disable it or make the heartbeat prompt effectively empty.
OpenClaw docs say an effectively empty
HEARTBEAT.mdskips the heartbeat run and saves API calls. - If heartbeat is needed, lower frequency first.
Safe first move: change
everyfrom a short interval to1hor longer. - Reduce token and context cost.
Prefer
lightContext: true,isolatedSession: truewhen appropriate, and avoid sending heartbeat output anywhere unless the user really wants it. - Route heartbeat away from an expensive cloud model. If the install supports a separate heartbeat model, use a cheap or local model for heartbeat-only checks.
- Keep
HEARTBEAT.mdtiny. A bloated checklist wastes tokens every run.
When editing configs manually, prefer minimal changes like:
{
"agents": {
"defaults": {
"heartbeat": {
"every": "1h",
"lightContext": true,
"target": "none"
}
}
}
}
Only add a heartbeat-specific local model if the config format in that install already supports it.
3. Fix path B: stop Feishu/webhook health probes from touching the model
Use this path for older installs, custom bridges, or any codebase where /health, /ready, or webhook verification ends up invoking OpenClaw chat/model logic.
Goal: liveness checks must return a cheap static success unless the user explicitly wants an end-to-end synthetic test.
Preferred order of fixes:
- Do not auto-patch arbitrary app code unless the relevant route is obvious and isolated.
- Separate liveness from end-to-end checks.
/healthshould usually return a static200 OKplus lightweight process info. - If a real downstream check is required, cache the successful result. A 24-hour cache is a good default for "bot still works" validation when the alternative is paying every minute.
- Never let Feishu verification or heartbeat probes call the main chat pipeline.
- If a custom bridge currently pings the model every 60 seconds, patch that route first before changing user-facing chat behavior.
For route handlers, acceptable outcomes are:
- static
ok - cached status object
- cheap local state check
Avoid:
- calling the main message handler
- creating a new OpenClaw chat turn
- invoking the paid model just to answer a health probe
4. Verify after the patch
After editing:
- Restart the OpenClaw gateway, plugin host, or custom bridge.
- Watch logs for 3-5 minutes.
- Confirm one of these outcomes:
- heartbeat frequency dropped to the intended interval
/healthstill gets hit, but no model invocation follows- quota burn rate stops climbing abnormally
If the user is on Docker, check container logs rather than assuming host paths.
Guardrails
- Do not change unrelated chat routing.
- Do not remove webhook verification unless the user is intentionally leaving webhook mode.
- Prefer the smallest patch that stops repeated paid calls.
- If the system mixes official Feishu config with custom gateway code, patch the custom health route first and then review heartbeat settings.
- If the bundled fixer already solved the standard heartbeat cost issue, say so clearly and stop there unless custom webhook code still appears in the scan.
Files
10 totalComments
Loading comments…
