biz-in-a-box Skill
Agent-native operating system for any business entity. An append-only, hash-chained journal (journal.ndjson) + a chart of accounts (accounts.yaml) + entity metadata (entity.yaml). Agents can derive any financial report from it in one context window.
Quickstart
1. Fork or clone the repo
GitHub: https://github.com/taylorhou/biz-in-a-box
Website: https://biz-in-a-box.org
CODEBLOCK0
Edit entity.yaml with the entity's id, name, and type. Edit accounts.yaml to match the entity's chart of accounts.
2. Record a transaction
Append a JSON line to journal.ndjson. Every entry needs id (ULID recommended) and time (ISO-8601 UTC). Financial entries also need balanced debits/credits.
Example — record a $1,200 rent payment:
CODEBLOCK1
3. Validate
CODEBLOCK2
Checks: required fields, double-entry balance, hash chain continuity, correction has supersedes, transfer has from/to.
4. Query / report
Read journal.ndjson line by line. Filter by labels, time range, or accounts to derive:
- - P&L: sum revenue (4xxx) vs expenses (5xxx) over a period
- Balance sheet: sum assets (1xxx), liabilities (2xxx), equity (3xxx) at a point in time
- Cash flow: filter
1010-bank-checking debits and credits - Burn rate: sum expenses (5xxx) over trailing 30/90 days
Key Rules
- -
sum(debits.amount) must equal sum(credits.amount) for financial entries - Use
correction label + supersedes: <id> to amend entries — never edit in place - Genesis
prev_hash: 64 zeros; subsequent entries chain via SHA-256 - Entries > 7 days backdated require
historical or imported label
File Set
| File | Purpose |
|---|
| INLINECODE29 | Append-only event log (one JSON per line) |
| INLINECODE30 |
Entity metadata (id, name, type, jurisdiction, etc.) |
|
accounts.yaml | Chart of accounts (assets/liabilities/equity/revenue/expenses) |
|
labels.yaml | Label definitions |
|
access.yaml | Access control |
|
validate.js | Validation script |
|
snapshots/ | Optional periodic balance snapshots |
|
verticals/ | Vertical-specific extensions |
biz-in-a-box 技能
面向任何商业实体的智能体原生操作系统。一个仅追加、哈希链式日志(journal.ndjson)+ 会计科目表(accounts.yaml)+ 实体元数据(entity.yaml)。智能体可在单个上下文窗口中从中推导出任何财务报告。
快速入门
1. Fork 或克隆仓库
GitHub: https://github.com/taylorhou/biz-in-a-box
网站: https://biz-in-a-box.org
bash
git clone https://github.com/taylorhou/biz-in-a-box my-entity
cd my-entity
编辑 entity.yaml,填写实体的 id、name 和 type。编辑 accounts.yaml,使其与实体的会计科目表匹配。
2. 记录一笔交易
向 journal.ndjson 追加一行 JSON。每条记录需要包含 id(推荐使用 ULID)和 time(ISO-8601 UTC 格式)。财务记录还需要平衡的 debits(借方)/credits(贷方)。
示例 — 记录一笔 1,200 美元的租金支付:
json
{id:01HXYZ...,time:2026-02-26T14:00:00Z,labels:[financial],description:二月租金,debits:[{account:5200-rent,amount:1200}],credits:[{account:1010-bank-checking,amount:1200}]}
3. 验证
bash
node validate.js
检查项:必填字段、复式记账平衡、哈希链连续性、correction 包含 supersedes、transfer 包含 from/to。
4. 查询 / 报表
逐行读取 journal.ndjson。按 labels、time 范围或科目进行筛选,以推导出:
- - 损益表: 汇总一段时间内的收入(4xxx)与支出(5xxx)
- 资产负债表: 汇总某一时间点的资产(1xxx)、负债(2xxx)、权益(3xxx)
- 现金流量表: 筛选 1010-bank-checking 的借方和贷方
- 烧钱率: 汇总过去 30/90 天的支出(5xxx)
关键规则
- - 财务记录的 sum(debits.amount) 必须等于 sum(credits.amount)
- 使用 correction 标签 + supersedes: 修改记录 — 切勿原地编辑
- 创世块 prev_hash:64 个零;后续记录通过 SHA-256 链接
- 超过 7 天的回溯记录需要添加 historical 或 imported 标签
文件集
| 文件 | 用途 |
|---|
| journal.ndjson | 仅追加的事件日志(每行一个 JSON) |
| entity.yaml |
实体元数据(id、名称、类型、司法管辖区等) |
| accounts.yaml | 会计科目表(资产/负债/权益/收入/支出) |
| labels.yaml | 标签定义 |
| access.yaml | 访问控制 |
| validate.js | 验证脚本 |
| snapshots/ | 可选的定期余额快照 |
| verticals/ | 垂直行业特定扩展 |