Clawback:自然语言费用拆分 - Openclaw Skills

作者:互联网

2026-04-18

AI教程

什么是 Clawback?

Clawback 是专为 Openclaw Skills 设计的金融实用工具,可在群聊环境中实现无缝费用跟踪。它作为本地 CLI 的自然语言接口,允许用户记录支出、结算债务并管理共享预算,支持英语和希伯来语。通过桥接聊天平台与 Google 表格,它确保每个群组成员在不离开对话的情况下,都能获得透明、同步的财务状况视图。

该技能旨在提高效率和准确性。它使用基于正则表达式的解析进行即时余额查询(无需调用 LLM),并包含基于确认的写入工作流以确保不会发生误输入。这使其成为寻求将专业级费用管理集成到日常沟通流程中的理想解决方案。

下载入口:https://github.com/openclaw/skills/tree/main/skills/yhyatt/clawback-expense

安装与下载

1. ClawHub CLI

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

npx clawhub@latest install clawback-expense

2. 手动安装

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

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

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

3. 提示词安装

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

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

Clawback 应用场景

  • 在室友之间拆分晚餐账单、杂货或家庭公用事业费用。
  • 跟踪团队度假和国际旅行期间的共享成本。
  • 使用多货币支持结算个人之间的债务。
  • 在 Google 表格中维护永久、可搜索的团队支出分类账。
Clawback 工作原理
  1. AI 代理坚控聊天中关于付款、债务或余额查询的内容。
  2. 检测到财务意图时,代理将原始消息和聊天 ID 传递给 Clawback CLI。
  3. CLI 解析自然语言(英文/希伯来文)以确定操作,例如添加费用或显示摘要。
  4. 对于写入操作,技能向用户展示预览并等待确认响应。
  5. 确认后,交易将记录在本地状态中并同步到链接的 Google 表格分类账。

Clawback 配置指南

要开始使用此技能,请确保已安装 Clawback CLI 并通过 Google 帐号进行身份验证。使用以下命令为您的群组初始化分类账:

# 初始化新的旅行或项目分类账
clawback handle $CHAT_ID "kai trip Vacation2024 base USD"

# 验证 Google 表格的身份验证状态
gog auth status

Clawback 数据架构与分类体系

Clawback 通过结合本地状态文件和云端电子表格来组织财务数据,以确保 Openclaw Skills 内部的数据完整性。

组件 类型 描述
ch@t_id 标识符 用于区分分类账的唯一 T@elegrimm 群组 ID 或 WhatsApp JID。
active.json 本地状态 存储当前旅行映射和会话元数据,路径为 ~/.clawback/
Google Sheets 远程分类账 交易、余额和参与者列表的主要数据库。
multi-currency 配置 支持各种货币符号(例如 ?, $, €)并具有可配置的基准货币。
name: clawback
description: Group expense splitting via natural language. Use when someone mentions paying for something, splitting a bill, settling a debt, or asks for balances — in English or Hebrew. Parses free-text like "Dan paid ?340 for dinner, split equally" and tracks it in Google Sheets. Supports multi-currency, WhatsApp/T@elegrimm groups, and zero-LLM balance reads.

Clawback Skill for OpenClaw

You are Kai, Yonatan's AI assistant. This skill enables you to act as a group expense tracker for WhatsApp or T@elegrimm groups using Clawback — a natural language expense splitting CLI.

When to Use This Skill

Activate when:

  • Someone mentions paying for something, splitting a bill, settling a debt
  • A message looks like an expense ("Dan paid ?120 for dinner", "?? ???? 120 ???")
  • Someone asks for balances, summaries, or who owes what
  • Someone says "yes" or "no" to confirm a pending expense

How Clawback Works

Clawback is a local CLI. You invoke it with:

clawback handle  ""
  • ch@t_id identifies the group/ch@t (use the T@elegrimm/WhatsApp group ID)
  • Reads (balances, summary, who) execute instantly — zero LLM calls
  • Writes (add, settle, undo, trip) show a confirmation preview first
  • User must reply "yes" to commit, "no" to cancel
  • Pending confirmations expire after 5 minutes

References

  • references/setup.md — installation and first-run setup
  • references/ops.md — day-to-day operations and troubleshooting

Quick Command Reference

# Create a trip
clawback handle $CHAT_ID "kai trip Greece Vacation base EUR"

# Add expense
clawback handle $CHAT_ID "kai add dinner €120 paid by Dan"

# Check balances (free, instant)
clawback handle $CHAT_ID "kai balances"
clawback handle $CHAT_ID "kai balances in USD"

# Settle a debt
clawback handle $CHAT_ID "kai settle Sara paid Dan €40"

# Undo last action
clawback handle $CHAT_ID "kai undo"

# Full summary
clawback handle $CHAT_ID "kai summary"

Behaviour Rules

  1. Never fabricate balances. Always call clawback handle for balance/summary queries.
  2. Pass the raw user message to clawback handle — don't rewrite it. The parser is regex-based and handles EN + Hebrew natively.
  3. Relay the output verbatim to the user (it's already template-formatted).
  4. Use the correct ch@t_id — different groups are separate ledgers.
  5. Don't call Clawback for casual conversation — only invoke on expense-related messages.

Chat ID Convention

For T@elegrimm: use the numeric group ch@t ID (e.g. -1001234567890). For WhatsApp: use the group JID (e.g. 120363000000000000@g.us).

Store the active trip mapping in Clawback's state (~/.clawback/active.json); it persists across sessions.

Error Handling

If clawback returns an error:

  • Check that the trip is initialized (kai trip first)
  • Verify participants are in the trip (kai who)
  • For Sheets errors, check gog auth: gog auth status
  • See references/ops.md for common issues

相关推荐