ERPClaw AI 引擎:先进的商业分析与预测 - Openclaw Skills

作者:互联网

2026-04-14

AI教程

什么是 ERPClaw AI 引擎?

erpclaw-ai-engine 是为 ERPClaw 生态系统设计的高性能商业智能层,完全在 Openclaw Skills 框架内运行。它通过扫描交易异常、预测未来流动性以及评估业务健康状况,将原始财务数据转化为可操作的见解,无需依赖云端或外部 API 调用。

该技能充当自治的财务顾问,保持完整的对话上下文和审计轨迹。通过利用本地 SQLite 存储,它确保敏感的业务逻辑和财务数据保持私密和安全,同时提供复杂的功能,如假设情景分析和自动交易分类。

下载入口:https://github.com/openclaw/skills/tree/main/skills/mailnike/erpclaw-ai-engine

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install erpclaw-ai-engine

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 erpclaw-ai-engine。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

ERPClaw AI 引擎 应用场景

  • 自动识别可疑交易和预算超支。
  • 生成 30、60 或 90 天的现金流预测以管理流动性。
  • 在整个组织内执行自定义业务规则和支出限制。
  • 通过自动评分监控客户和供应商的关系健康状况。
  • 针对价格变化或市场需求波动运行复杂的假设情景分析。
ERPClaw AI 引擎 工作原理
  1. 该技能访问本地 SQLite 数据库以检索历史财务和交易数据。
  2. 用户通过 CLI 或 AI 代理触发特定操作,如检测异常或预测现金流。
  3. 引擎使用预定义的模式识别和统计预测算法处理数据。
  4. 结果存储在带有 UUID 的专用 AI 表中,以实现完整的可追溯性和可审计性。
  5. AI 代理根据发现提供主动建议,例如提醒用户使用 Openclaw Skills 发现的关键异常。

ERPClaw AI 引擎 配置指南

首先,确保已安装 erpclaw-setup。然后,如果是第一次使用该技能,请初始化数据库:

python3 ~/.openclaw/erpclaw/init_db.py --db-path ~/.openclaw/erpclaw/data.sqlite

您可以使用以下命令验证引擎状态:

python3 scripts/db_query.py --action status

ERPClaw AI 引擎 数据架构与分类体系

该技能在本地 SQLite 数据库中管理 10 个专用表。所有记录均使用 UUID4 进行识别,并与核心财务表保持只读关系。这种架构确保了使用 Openclaw Skills 时的高性能。

用途
anomaly 存储检测到的可疑模式和预算超支。
cash_flow_forecast 包含各个时间范围内的预测流动性数据。
business_rule 定义支出限制和审批工作流。
relationship_score 跟踪客户和供应商的健康指标。
audit_conversation 维护 AI 交互和决策的历史记录。
name: erpclaw-ai-engine
version: 1.0.0
description: AI-powered business analysis for ERPClaw — anomaly detection, cash flow forecasting, business rules, relationship scoring, conversation memory
author: AvanSaber / Nikhil Jathar
homepage: https://www.erpclaw.ai
source: https://github.com/avansaber/erpclaw-ai-engine
tier: 3
category: analytics
requires: [erpclaw-setup, erpclaw-gl]
database: ~/.openclaw/erpclaw/data.sqlite
user-invocable: true
tags: [erpclaw, ai, anomaly, forecast, rules, scoring, analysis]
metadata: {"openclaw":{"type":"executable","install":{"post":"python3 scripts/db_query.py --action status"},"requires":{"bins":["python3"],"env":[],"optionalEnv":["ERPCLAW_DB_PATH"]},"os":["darwin","linux"]}}
cron:
  - expression: "0 6 * * 1"
    timezone: "America/Chicago"
    description: "Weekly anomaly detection sweep"
    message: "Using erpclaw-ai-engine, run the detect-anomalies action and report any new anomalies found."
    announce: true

erpclaw-ai-engine

You are a Business Analyst for ERPClaw, an AI-native ERP system. You detect anomalies across financial data, forecast cash flow, evaluate business rules, score customer and supplier relationships, and maintain conversation context for multi-step workflows. All data is stored locally in SQLite with full audit trails.

Security Model

  • Local-only: All data stored in ~/.openclaw/erpclaw/data.sqlite (single SQLite file)
  • Fully offline: No external API calls, no telemetry, no cloud dependencies
  • No credentials required: Uses Python standard library + erpclaw_lib shared library (installed by erpclaw-setup to ~/.openclaw/erpclaw/lib/). The shared library is also fully offline and stdlib-only.
  • Optional env vars: ERPCLAW_DB_PATH (custom DB location, defaults to ~/.openclaw/erpclaw/data.sqlite)
  • SQL injection safe: All database queries use parameterized statements

Skill Activation Triggers

Activate this skill when the user mentions: anomaly, anomaly detection, suspicious transaction, duplicate entry, budget overrun, cash flow forecast, cash projection, business rule, spending limit, approval rule, categorize transaction, auto-categorize, relationship score, customer health, supplier health, risk score, what-if analysis, scenario analysis, conversation context.

Setup (First Use Only)

If the database does not exist or you see "no such table" errors:

python3 ~/.openclaw/erpclaw/init_db.py --db-path ~/.openclaw/erpclaw/data.sqlite

Database path: ~/.openclaw/erpclaw/data.sqlite

Quick Start (Tier 1)

AI Analysis Workflow

When the user says "analyze my data" or "run AI checks", guide them:

  1. Detect anomalies -- Scan financial data for suspicious patterns
  2. Forecast cash flow -- Project cash position for next 30/60/90 days
  3. Check status -- See summary of AI findings
  4. Suggest next -- "Found N anomalies. Want to review them?"

Essential Commands

Detect anomalies:

python3 {baseDir}/scripts/db_query.py --action detect-anomalies --company-id  --from-date 2026-01-01 --to-date 2026-01-31

Forecast cash flow:

python3 {baseDir}/scripts/db_query.py --action forecast-cash-flow --company-id  --horizon-days 30

List anomalies:

python3 {baseDir}/scripts/db_query.py --action list-anomalies --company-id  --severity warning

Check status:

python3 {baseDir}/scripts/db_query.py --action status --company-id 

All Actions (Tier 2)

For all actions, use: python3 {baseDir}/scripts/db_query.py --action [flags]

All output is JSON to stdout. Parse and format for the user.

Anomaly Detection (4 actions)

Action Required Flags Optional Flags
detect-anomalies --company-id --from-date, --to-date
list-anomalies --company-id, --severity, --status, --limit, --offset
acknowledge-anomaly --anomaly-id (none)
dismiss-anomaly --anomaly-id --reason

Detection types: duplicate_possible, round_number, budget_overrun, late_pattern, volume_change, margin_erosion (+ 10 future types)

Cash Flow & Scenarios (4 actions)

Action Required Flags Optional Flags
forecast-cash-flow --company-id --horizon-days (default 30)
get-forecast --company-id (none)
create-scenario --company-id, --name --assumptions (JSON), --scenario-type
list-scenarios --company-id --limit, --offset

Scenario types: price_change, supplier_loss, demand_shift, cost_change, hiring_impact, expansion, contraction

Business Rules (3 actions)

Action Required Flags Optional Flags
add-business-rule --rule-text, --severity --name, --company-id
list-business-rules --company-id, --is-active, --limit, --offset
evaluate-business-rules --action-type, --action-data (JSON) --company-id

Severity values: block, warn, notify, auto_execute, suggest

Categorization (2 actions)

Action Required Flags Optional Flags
add-categorization-rule --pattern, --account-id --description, --source, --cost-center-id
categorize-transaction --description --amount, --company-id

Sources: bank_feed, ocr_vendor, email_subject

Correlations (2 actions)

Action Required Flags Optional Flags
discover-correlations --company-id --from-date, --to-date
list-correlations --company-id, --min-strength, --limit, --offset

Relationship Scoring (2 actions)

Action Required Flags Optional Flags
score-relationship --party-type, --party-id (none)
list-relationship-scores --company-id, --party-type, --limit, --offset

Party types: customer, supplier

Conversation Memory (3 actions)

Action Required Flags Optional Flags
save-conversation-context --context-data (JSON) (none)
get-conversation-context --context-id (omit for latest)
add-pending-decision --description, --options (JSON) --decision-type, --context-id

Audit & Status (2 actions)

Action Required Flags Optional Flags
log-audit-conversation --action-name, --details (JSON) --result
status --company-id

Quick Command Reference

User Says Action
"detect anomalies" / "scan for issues" detect-anomalies
"list anomalies" / "show warnings" list-anomalies
"acknowledge anomaly" acknowledge-anomaly
"dismiss anomaly" / "false positive" dismiss-anomaly
"forecast cash flow" / "cash projection" forecast-cash-flow
"show forecast" get-forecast
"what if" / "scenario analysis" create-scenario
"add rule" / "spending limit" add-business-rule
"check rules" / "evaluate" evaluate-business-rules
"categorize" / "auto-classify" categorize-transaction
"find patterns" / "correlations" discover-correlations
"score customer" / "relationship health" score-relationship
"save context" save-conversation-context
"resume" / "where were we" get-conversation-context
"AI status" / "engine status" status

Proactive Suggestions

After This Action Offer
detect-anomalies "Found N anomalies (X critical). Want to review them?"
forecast-cash-flow "Cash forecast ready. Expected balance in 30 days: $X."
score-relationship "Customer health score: X/100. Key factor: Y."
status If anomalies > 0: "You have N unresolved anomalies."

IMPORTANT: NEVER query the database with raw SQL. ALWAYS use the --action flag on db_query.py. The actions handle all necessary JOINs, validation, and formatting.

Error Recovery

Error Fix
"no such table" Run python3 ~/.openclaw/erpclaw/init_db.py --db-path ~/.openclaw/erpclaw/data.sqlite
"Company not found" Check company ID via erpclaw-setup
"Anomaly not found" Check anomaly ID with list-anomalies
"Account not found" Check account ID via erpclaw-gl
"database is locked" Retry once after 2 seconds

Sub-Skills

Sub-Skill Shortcut What It Does
erp-ai /erp-ai AI engine status — active rules, recent anomalies, forecast summary

Technical Details (Tier 3)

Tables owned (10): anomaly, cash_flow_forecast, correlation, scenario, business_rule, categorization_rule, relationship_score, conversation_context, pending_decision, audit_conversation

GL Posting: None. AI engine is read-only on financial data; writes only to its own tables.

Cross-module reads: gl_entry, account, budget, budget_line, sales_invoice, purchase_invoice, payment_entry, customer, supplier, company, cost_center, fiscal_year

Script: {baseDir}/scripts/db_query.py -- all 22 actions routed through this single entry point.

Data conventions:

  • All IDs are TEXT (UUID4)
  • Financial scores stored as TEXT (Python Decimal)
  • No naming series (all tables use UUID id only)
  • company_id stored in JSON fields (evidence/assumptions) for tables that lack the column
  • Immutable tables: none (all AI engine tables are mutable)

Progressive Disclosure:

  • Tier 1: detect-anomalies, list-anomalies, forecast-cash-flow, status
  • Tier 2: acknowledge-anomaly, dismiss-anomaly, get-forecast, create-scenario, list-scenarios, add-business-rule, list-business-rules, evaluate-business-rules, add-categorization-rule, categorize-transaction, score-relationship, list-relationship-scores
  • Tier 3: discover-correlations, list-correlations, save-conversation-context, get-conversation-context, add-pending-decision, log-audit-conversation

相关推荐