当前位置: 首页 > Skill >

KPI Alert System

KPI Alert System

KPI Alert System

业务KPI监控,支持阈值警报。集成QuickBooks Online、Google Sheets和CSV导出,追踪应收账款账龄、现金跑道、收入增长。

1.1.0 2026.11.22 305
获取Skill文件查看使用说明
作 者:沈知 许可证: 更新时间:2026.11.22
本文目录展开

KPI Alert System Skill

Automated KPI monitoring with threshold alerts for business financial health. Pulls data from QBO, Google Sheets, or CSV exports, evaluates rules, and fires alerts to Telegram/Slack/email.

Supported KPIs

KPI Description Typical Alert Threshold
AR Aging (30/60/90+) Outstanding receivables by age bucket >$X in 90+ days, or >30% of AR
Cash Runway Months of runway at current burn <3 months = red, <6 months = yellow
Monthly Burn Rate Net cash outflow per month >$X/month or >Y% above budget
Revenue Growth (MoM/QoQ) Revenue trend vs prior period <0% = alert, <5% = warning
Gross Margin % (Revenue - COGS) / Revenue <X% below target
Net Income / Loss P&L bottom line Negative for N consecutive months
DSO (Days Sales Outstanding) AR / (Revenue / 30) >45 days = yellow, >60 = red
Current Ratio Current Assets / Current Liabilities <1.2 = alert
Quick Ratio (Cash + AR) / Current Liabilities <1.0 = alert
Payroll % of Revenue Payroll costs as % of top line >X% = alert

Setup Steps

1. Define Your KPI Config

Create a YAML config file for the client or firm:

# kpi-config-clientname.yaml
client: "Acme Corp"
alert_channels:
  - type: telegram
    target: "@irfan_dm"  # or channel 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  # or 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  # alert when BELOW threshold (default: 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%"

2. Data Source Integration

QuickBooks Online (via QBO Automation skill)

# Pull P&L summary for current month
qbo report pl --period this-month --format json > /tmp/pl-current.json

# Pull AR aging
qbo report ar-aging --format json > /tmp/ar-aging.json

# Pull balance sheet for liquidity ratios
qbo report balance-sheet --period this-month --format json > /tmp/bs-current.json

Google Sheets (via gog skill)

# Read a named range
gog sheets read --id SHEET_ID --range "KPI Dashboard!B2:C20"

CSV / Excel Export

Place exports at a consistent path and reference in config:

source: csv
file: "/tmp/monthly-export-2026-03.csv"
column: "AR_90plus"
row_filter: "Month=March"

3. KPI Evaluation Logic

Core algorithm (Python pseudocode for reference):

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)  # pulls from 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

4. Alert Formatting

Telegram message format:

🚨 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 format (with attachments):

{
  "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
    }
  ]
}

5. Scheduling with OpenClaw Cron

Monthly KPI check (1st of month, 9 AM 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"
  }
}

Weekly cash runway check (every Monday, 8 AM 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"
}

Example Prompts

Setup

"Set up KPI alerts for my client TechStartup LLC. Alert me on Telegram when AR aging hits 90 days, burn rate exceeds $40k/month, or runway drops below 4 months."

Manual Check

"Run a KPI check on Acme Corp right now and tell me which thresholds are breached."

Threshold Adjustment

"Update the gross margin alert for TechStartup to yellow at 45% and red at 35%."

Report Generation

"Generate a weekly KPI summary for all active clients and post to the #weekly-metrics Telegram channel."

KPI Calculation Reference

Cash Runway

Runway (months) = Current Cash Balance / Average Monthly Burn Rate
Average Monthly Burn = (Cash 3 months ago - Cash today) / 3

Days Sales Outstanding (DSO)

DSO = (Accounts Receivable / Revenue) × 30

Burn Rate

Net Burn = Total Cash Outflows - Total Cash Inflows (monthly)
Gross Burn = Total Cash Outflows only (monthly)

Current Ratio

Current Ratio = Current Assets / Current Liabilities

AR Aging Concentration Risk

90+ Day Concentration = AR 90+ days / Total AR × 100
Alert when concentration > 20%

Multi-Client Monitoring Pattern

For firms managing multiple clients:

# 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"

Loop pattern:

"Check KPI thresholds for all clients in master-kpi-config.yaml. Consolidate alerts into one Telegram message grouped by client."

Negative Boundaries — When NOT to Use This Skill

  • Real-time stock/crypto price alerts → use defi-position-tracker or a dedicated market data feed
  • Live BI dashboards (charts, drill-downs) → use Power BI, Looker, or Metabase
  • ERP systems (SAP, Oracle, NetSuite) → requires dedicated API connectors, not this skill
  • Sub-minute alerting (high-frequency trading signals) → wrong latency class
  • PTIN-regulated tax analysis → use qbo-to-tax-bridge (Moltlaunch service only)
  • Client-facing automated reports → requires Irfan approval before sending externally
  • Write operations to QBO → read-only by default; journal entries need explicit approval

Integration Stack

Layer Tool
Data Pull (QBO) qbo-automation skill
Data Pull (Sheets) gog skill
Alerting (Telegram) message tool (channel=telegram)
Scheduling cron tool
Storage workspace/clients//kpi-data/
Config Format YAML (kpi-config-.yaml)

Alert Severity Guide

Color Meaning Response Time
🔴 RED Threshold critically breached — action required Same day
🟡 YELLOW Warning zone — monitor closely Within 48 hours
✅ GREEN Within acceptable range No action needed

KPI Alert System — PrecisionLedger Skill v1.0.0

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,040
PHP日期转时间戳时区偏差怎么解决

在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。

2026.10.24 1,033
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,021
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,021
PHP实现基础文件上传:HTML表单与$_FILES处理流程

在 HTML 表单中设置 enctype="multipart/form-data" ,并在 PHP 后端通过 $_FILES 数组接收文件,调用 move_uploaded_file() 将临时文件移动到目标目录即可完成上传。

2026.09.07 1,019
OpenAI的Jalapeno芯片未落地,教你分辨300兆瓦算力消息

OpenAI计划在SB Energy租赁的数据中心部署约300兆瓦自研Jalapeno推理芯片,但目前双方仍处于洽谈阶段,交易细节与上线时间表均未公布。本文带你按报道原文核实项目所处阶段,厘清芯片发布、电力功率与实际推理算力的边界,并将融资意向与签约、开工、投运节点分开追踪,避免误将规划容量计入现有算力。

2026.12.02 1,016
Skill 文件
  • SKILL.md
    • KPI Alert System Skill
    • Supported KPIs
    • Setup Steps
      • 1. Define Your KPI Config
      • 2. Data Source Integration
        • QuickBooks Online (via QBO Automation skill)
        • Google Sheets (via gog skill)
        • CSV / Excel Export
      • 3. KPI Evaluation Logic
      • 4. Alert Formatting
      • 5. Scheduling with OpenClaw Cron
    • Example Prompts
      • Setup
      • Manual Check
      • Threshold Adjustment
      • Report Generation
    • KPI Calculation Reference
      • Cash Runway
      • Days Sales Outstanding (DSO)
      • Burn Rate
      • Current Ratio
      • AR Aging Concentration Risk
    • Multi-Client Monitoring Pattern
    • Negative Boundaries — When NOT to Use This Skill
    • Integration Stack
    • Alert Severity Guide
  • 项目或源文件

相关 Skill

更多
gspread-sheets gspread-sheets 使用 gspread Python 库通过服务帐号批量读取/写入 Google Sheets,适用于需要读取、写入、更新、清除等操作。
客服数据一体化看板 客服数据一体化看板 客服数据一体化看板生成技能。支持每日/每周自动更新看板,是本技能的核心优势。当用户需要生成客服数据看板、绩效看板、每日数据看板,或将Excel/CSV/Google Sheets/腾讯文档/API数据整合成可视化Dashboard时使用。触发词包括:客服数据看板、数据看板、绩效看板、每日看板、每周看板、Dashboard、dashboard、数据可视化、客服报表。支持输出为HTML网页看板(可配置自动刷新数据源)、Excel报表(含图表)、PPT汇报 slides、腾讯文档智能表格四种格式。
Self-Integration Self-Integration 连接外部应用并执行操作,用于与Slack、Linear、HubSpot、Salesforce、Jira、GitHub、Google Sheets等服务交互,如发送消息、创建任务、同步数据、管理联系人或执行API操作。
Gws Sheets Gws Sheets Google Sheets:读取和写入电子表格
Spreadsheet & Data Wrangling Master Spreadsheet & Data Wrangling Master 完整的电子表格方法论——涵盖数据清洗、转换、分析、仪表板、自动化与报告,支持 CSV、Excel、Google Sheets 等格式。