360 Secure SkillHub
360 安全技能中心

Ledger Project Expense Entry

面向快速记账:从简短自然语言消息中解析项目、消费内容、金额及可选日期、币种、流向和标签,默认流向为支出、币种为人民币、日期取 Asia/Taipei 当天;写入前检查分类目录并给出标签建议,缺少金额时提一个简短澄清问题,再调用本地脚本把条目追加到账目 JSONL,并回复月文件路径与一行摘要。

shing19
shing19
热度 33.68
最近更新 2026-05-11 17:38:33
分类:效率依赖:代码执行 / 读写文件应用场景:财务 / 数据处理 / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add ledger-project-expense-entry
Metadata
name
ledger-project-expense-entry
description
Record natural-language project expense messages into ledger JSONL. Use when user sends "项目+支出" directly (e.g., "OpenClaw 服务器 89"), wants quick记账, or asks to append project spending. Default to expense and CNY unless user explicitly says otherwise.

Ledger Project Expense Entry

Use this skill for fast bookkeeping from short natural-language messages.

Defaults

  • direction: default 支出
  • currency: default CNY
  • date: default today (Asia/Taipei)

Only change defaults if user explicitly provides different values.

Parse target

Extract from message:

  • project (项目名)
  • description (消费内容)
  • amount (number)
  • optional date
  • optional currency
  • optional direction (收入/支出)
  • optional tags

If project and description are both present, build description as:

  • <project> - <description>

If only one exists, use that field directly.

If amount is missing, ask one short clarification question.

Write command

IMPORTANT: Get today's date (YYYY-MM-DD) first, for determining which month file to write to.

# Get today's date in Asia/Taipei timezone
CURRENT_DATE=$(TZ='Asia/Taipei' date +%Y-%m-%d)

Then append via existing script:

python3 projects/scripts/add_ledger_entry.py \
  --data-root projects/data \
  --date "$CURRENT_DATE" \
  --direction <支出|收入> \
  --amount <number> \
  --currency <CNY|USD|JPY|...> \
  --description <project-description> \
  --tags <tag1,tag2,...> \
  --source manual \
  --batch manual

Category catalog (must check before writing)

Before each write, check:

  • projects/docs/CATEGORY_CATALOG.md

Selection policy:

  • Prefer existing values from catalog (tags/major_category/type/currency).
  • If user gives a new tag not in catalog and meaning is clear, write it; otherwise ask one short confirmation.
  • If uncertain, keep optional fields empty rather than inventing noisy labels.

Tag suggestion rules

  • If user gives tags, use them directly.
  • If user does not give tags:
    • project/infra/subscription/domain/server -> 开发成本 / 服务器 / 域名 / 通讯网络 (pick the closest one)
    • meal/drink -> 外卖 / 下馆子 / 饮料零食
    • ride/transport -> 打车 / 交通卡 / 火车 / 飞机
  • If still uncertain, keep tags empty.

Response format

After appending, reply with:

  • month file path
  • one-line summary: 日期 | 流向 | 金额币种 | 描述