业务KPI监控,支持阈值警报。集成QuickBooks Online、Google Sheets和CSV导出,追踪应收账款账龄、现金跑道、收入增长。
KPI 警报系统 Skill. 自动KPI 监测,并附有商业财务健康阈值警报.是一项面向实际任务的技能,主要用于QBO, Google Sheets 或 CSV 输出的Pulls 数据,评价规则,并向Te 发出火灾警报.。它将相关步骤、工具调用和结果整理方式集中到统一流程中,帮助使用者更快完成目标并减少重复操作。
实际使用前应先确认任务范围、数据来源、运行环境、必要权限和关键参数,再依据技能说明逐步执行;若输入条件不完整,应先补齐信息或采用保守配置,避免因错误假设导致结果偏离需求。
执行过程中需要关注工具调用是否成功、接口或依赖是否可用、输出格式是否符合预期,并对异常提示、缺失字段和边界情况进行处理;涉及批量任务时,还应保存进度,避免中断后重复操作。
面向企业财务健康状况的自动化 KPI 监控与阈值警报系统。支持从 QuickBooks Online(QBO)、Google Sheets 或 CSV 导出文件中拉取数据,执行规则评估,并向 Telegram / Slack / 邮件发送警报。
| KPI | 说明 | 典型警报阈值 |
|---|---|---|
| AR Aging(30/60/90+ 天) | 按账龄分组的未收应收账款 | 90+ 天余额 >$X,或占总 AR 比例 >30% |
| Cash Runway(现金跑道) | 按当前烧钱速率可维持的月数 | <3 个月为红色,<6 个月为黄色 |
| Monthly Burn Rate(月度烧钱率) | 每月净现金流支出 | >$X/月,或超出预算 Y% |
| Revenue Growth(MoM/QoQ)(营收增长率,环比/同比) | 相较上一周期的营收趋势 | <0% 触发警报,<5% 触发警告 |
| Gross Margin %(毛利率 %) | (Revenue - COGS) / Revenue | 低于目标值 X% |
| Net Income / Loss(净利润 / 净亏损) | 利润表最终结果 | 连续 N 个月为负 |
| DSO(Days Sales Outstanding,应收账款周转天数) | AR / (Revenue / 30) | >45 天为黄色,>60 天为红色 |
| Current Ratio(流动比率) | Current Assets / Current Liabilities | <1.2 触发警报 |
| Quick Ratio(速动比率) | (Cash + AR) / Current Liabilities | <1.0 触发警报 |
| Payroll % of Revenue(薪资占营收比例) | 薪资成本占总收入的比例 | >X% 触发警报 |
为客户端或事务所创建一个 YAML 配置文件:
# kpi-config-clientname.yaml
client: "Acme Corp"
alert_channels:
- type: telegram
target: "@irfan_dm" # 或频道 ID
- type: slack
webhook: "https://hooks.slack.com/services/..."
- type: email
to: "imussa@precisionledger.io"
kpis:
ar_aging_90plus:
label: "AR 90+ Days"
source: qbo # 或 sheets、csv
threshold_red: 15000
threshold_yellow: 8000
message: "AR aging 90+ days is ${value} — collections action needed"
cash_runway_months:
label: "Cash Runway"
source: qbo
threshold_red: 3
threshold_yellow: 6
direction: below # 当数值低于阈值时触发警报(默认为 above)
message: "Cash runway is {value} months — review burn rate immediately"
revenue_growth_mom:
label: "MoM Revenue Growth"
source: sheets
sheet_id: "1BxiM..."
tab: "P&L Summary"
cell_range: "C5"
threshold_red: -5
threshold_yellow: 0
direction: below
message: "Revenue growth is {value}% MoM — investigate pipeline"
gross_margin_pct:
label: "Gross Margin %"
source: qbo
threshold_red: 30
threshold_yellow: 40
direction: below
message: "Gross margin at {value}% — below target of 40%"
# 拉取当月利润表摘要 qbo report pl --period this-month --format json > /tmp/pl-current.json # 拉取应收账款账龄报告 qbo report ar-aging --format json > /tmp/ar-aging.json # 拉取资产负债表以计算流动性比率 qbo report balance-sheet --period this-month --format json > /tmp/bs-current.json
# 读取已命名的数据范围 gog sheets read --id SHEET_ID --range "KPI Dashboard!B2:C20"
将导出文件置于统一路径,并在配置中引用:
source: csv file: "/tmp/monthly-export-2026-03.csv" column: "AR_90plus" row_filter: "Month=March"
核心算法(Python 伪代码供参考):
def evaluate_kpi(config, value):
direction = config.get("direction", "above")
if direction == "above":
if value >= config["threshold_red"]:
return "RED", config["message"].format(value=value)
elif value >= config["threshold_yellow"]:
return "YELLOW", config["message"].format(value=value)
else: # below
if value <= config["threshold_red"]:
return "RED", config["message"].format(value=value)
elif value <= config["threshold_yellow"]:
return "YELLOW", config["message"].format(value=value)
return "GREEN", None
def run_kpi_check(config_path):
config = load_yaml(config_path)
alerts = []
for kpi_id, kpi_config in config["kpis"].items():
value = fetch_kpi_value(kpi_config) # 从 QBO / Sheets / CSV 拉取
status, message = evaluate_kpi(kpi_config, value)
if status in ["RED", "YELLOW"]:
alerts.append({
"kpi": kpi_config["label"],
"status": status,
"value": value,
"message": message
})
return alerts
Telegram 消息格式:
🚨 KPI ALERT — Acme Corp Date: March 15, 2026 🔴 AR 90+ Days: $18,500 → Collections action needed immediately 🟡 Gross Margin: 38% → Below 40% target — review COGS ✅ Cash Runway: 8.2 months ✅ Revenue Growth: +4.2% MoM Run by: Sam Ledger / PrecisionLedger
Slack 格式(含附件):
{
"attachments": [
{
"color": "#ff0000",
"title": "🔴 AR 90+ Days — $18,500",
"text": "Collections action needed. 90+ day bucket exceeds $15,000 threshold.",
"footer": "KPI Alert System | PrecisionLedger",
"ts": 1742076000
}
]
}
月度 KPI 检查(每月 1 日上午 9 点 CST):
{
"name": "Monthly KPI Check — Acme Corp",
"schedule": {
"kind": "cron",
"expr": "0 9 1 * *",
"tz": "America/Chicago"
},
"payload": {
"kind": "agentTurn",
"message": "Run KPI alert check for Acme Corp using kpi-config-acme.yaml. Pull QBO AR aging and P&L, evaluate thresholds, and send alerts to the configured channels."
},
"sessionTarget": "isolated",
"delivery": {
"mode": "announce"
}
}
周度现金跑道检查(每周一上午 8 点 CST):
{
"name": "Weekly Cash Runway Check",
"schedule": {
"kind": "cron",
"expr": "0 8 * * 1",
"tz": "America/Chicago"
},
"payload": {
"kind": "agentTurn",
"message": "Check cash runway and burn rate for all active clients. Alert if any client is below 6 months runway."
},
"sessionTarget": "isolated"
}
“为我的客户 TechStartup LLC 配置 KPI 警报。当应收账款账龄达 90 天、烧钱率超过 $40k/月,或现金跑道低于 4 个月时,在 Telegram 上通知我。”
“立即对 Acme Corp 执行一次 KPI 检查,并告诉我哪些阈值已被突破。”
“将 TechStartup 的毛利率警报阈值更新为:黄色预警线设为 45%,红色警戒线设为 35%。”
“为所有活跃客户生成一份周度 KPI 汇总报告,并发布至 #weekly-metrics Telegram 频道。”
Runway (months) = Current Cash Balance / Average Monthly Burn Rate Average Monthly Burn = (Cash 3 months ago - Cash today) / 3
DSO = (Accounts Receivable / Revenue) × 30
Net Burn = Total Cash Outflows - Total Cash Inflows (monthly) Gross Burn = Total Cash Outflows only (monthly)
Current Ratio = Current Assets / Current Liabilities
90+ Day Concentration = AR 90+ days / Total AR × 100 Alert when concentration > 20%
适用于管理多个客户的事务所:
# master-kpi-config.yaml
clients:
- name: "Acme Corp"
config: "./clients/acme/kpi-config.yaml"
qbo_realm: "123456789"
- name: "TechStartup LLC"
config: "./clients/techstartup/kpi-config.yaml"
qbo_realm: "987654321"
- name: "Retail Co"
config: "./clients/retailco/kpi-config.yaml"
data_source: csv
csv_path: "/data/retailco/monthly-export.csv"
循环处理模式示例:
“检查 master-kpi-config.yaml 中所有客户的 KPI 阈值,并将警报汇总为一条 Telegram 消息,按客户分组呈现。”
| 层级 | 工具 |
|---|---|
| 数据拉取(QBO) | qbo-automation 技能 |
| 数据拉取(Sheets) | gog 技能 |
| 警报推送(Telegram) | message 工具(channel=telegram) |
| 调度 | cron 工具 |
| 存储 | workspace/clients/ |
| 配置格式 | YAML(kpi-config- |
| 颜色 | 含义 | 响应时效 |
|---|---|---|
| 🔴 RED | 阈值被严重突破 — 必须立即采取行动 | 当日内 |
| 🟡 YELLOW | 进入预警区间 — 需密切监控 | 48 小时内 |
| ✅ GREEN | 处于可接受范围内 | 无需操作 |
KPI Alert System — PrecisionLedger 技能 v1.0.0
相关专题
热门下载
相关下载
精品课程
共86课时 | 27.3万人学习
共18课时 | 6.1万人学习
共31课时 | 4.9万人学习