02 / 06 記帳
LedgerLion
本地
A local-first personal bookkeeping and Taiwan-stock public-info reminder agent
帳
Your ledger stays on your machine — and the last-buy day survives the long weekend.

(01) 為什麼Why
資料
Everything lives in a local SQLite file. It solves three things: the privacy worry of cloud bookkeeping, auto-categorisers that never remember your corrections, and shareholder-gift last-buy days miscalculated around long holidays.
(02) 06 項items
它做什麼What it does
-
01
匯入
你 Imports the statements you actually have真正 拿 得到 的 帳單 國泰
世 華、 中國 信託、 玉山 信用卡 CSV、 財政部 電子 發票 CSV、 銀行 對帳 CSV、 文字 型 與 加密 PDF 帳單 (密碼 只 留在 記憶體), 以及 自訂 欄位 的 通用 CSV。 Cathay United, CTBC and E.SUN card CSVs, Ministry of Finance e-invoice CSV, bank statement CSV, text and encrypted PDF statements (the password stays in memory) and a generic CSV with custom columns.
-
02
重複
匯入 Re-import adds zero rows新增 0 筆 去
重、 卡 號 只留 末 四碼、 信用卡 與 電子 發票 同 筆 消費 自動 合併、 外幣 換算、 訂閱 偵測。 Deduplication, card numbers kept to the last four digits, card and e-invoice entries merged, FX conversion and subscription detection.
-
03
修正
一次, Correct once, remembered forever永久 記住 三層
分類: 規則 → 歷史 交易 → 模型。 修正 一次 即 建立 永久 規則, 命中 規則 就不 呼叫 模型。 Three-layer categorisation: rules → history → model. One correction becomes a permanent rule, and a rule hit never calls the model.
-
04
算
對 A trading calendar that gets it right的 交易 日曆 涵
蓋 週末、 國定假日 與 春節, 可 手動 補 登 颱風 假; 推算 最後 過戶 日 與 T + 2 最後 買進 日, 保留 來源 與 計算 過程。 Weekends, national holidays and Lunar New Year, plus manually added typhoon days; it derives the last transfer date and the T+2 last-buy day, keeping sources and every step.
-
05
公開
資料 Public data sources來源 資料
來自 TWSE 與 TPEx OpenAPI (上櫃 股東會 紀念品 需 以 watch add --gift手動 登錄); 公告 改期 會 自動 重 算。 Data from the TWSE and TPEx OpenAPIs (TPEx shareholder gifts are added manually with
watch add --gift); rescheduled announcements are recalculated automatically. -
06
規則
決定 Rules decide, the model only writes提醒, 模型 只寫 文案 紀念品
D- 3 / D- 1、 除權 息 D- 1、 預算 80% / 100%、 每月 摘要 由 固定 規則 決定; LLM 只 負責 文案, 失敗 時 退回 固定 模板。 Gift D-3 / D-1, ex-dividend D-1, budget 80% / 100% and monthly summaries are fixed rules; the LLM only writes the wording and falls back to a template if it fails.
(03) 怎麼
從帳單到提醒From statement to reminder
- 01
匯入Import
CSV、
PDF 或 電子 發票。 CSV, PDF or e-invoices.
- 02
分類Categorise
規則
→ 歷史 → 模型, 低 信心 時 交給 你 review。 Rules → history → model; low confidence goes to your
review. - 03
觀察Watch
watch add追蹤 紀念品 與 除權 息。 watch addtracks gifts and dividends. - 04
推算Calculate
交易
日曆 推出 T + 2 最後 買進 日。 The trading calendar derives the T+2 last-buy day.
- 05
提醒Remind
Web
UI、 Telegram、 Discord 或 iCalendar。 Web UI, Telegram, Discord or iCalendar.
(04) README
快速開始Quick start
Web claude-haiku-5-5
The Web UI needs the access token printed at startup. README measurement (claude-haiku-5-5): ~1.5 s per single categorisation, ~0.9 s for a batch of 3.
cp .env.example .env
docker compose up -d
npm install
npm run db:migrate
npm run build
npm run dev
# Web UI: http://127.0.0.1:3600
npm run cli -- import ./examples/sample-cathay.csv
npm run cli -- watch add 2330 --track gift,dividend --gift "環保隨行杯"
npm run cli -- calc last-buy 2330 --closure-start 2025-11-05
(05) 隱私Privacy
隱私Privacy
- 預設
不 No external model by default — the default provider is local Ollama.呼叫 外部 模型; 預設 提供 者 是 本地 Ollama。 - 啟用
雲端 With a cloud model, only de-identified merchant names, amount ranges and invoice items leave — no dates, accounts or card numbers — and every call is logged in模型 時 只 送 出去 識別 化 的 商家 名、 金額 區間 與 發票 品 項, 不含 日期、 帳戶 或 卡 號; 每次 外 送 都 記錄 在 llm_audit_log。 llm_audit_log. - API
需 The API needs a bearer token and only accepts localhost Host / Origin; Telegram answers whitelisted chats only.Bearer Token, 只 接受 localhost 的 Host / Origin; Telegram 只 回應 白 名單 chat。 - 不
構成 Not investment advice: always confirm dates with TWSE, TPEx, MOPS and the issuer.投資 建議: 日期 請 以 TWSE、 TPEx、 公開 資訊 觀測站 及 發行 公司 公告 為 準。
目前狀態 Status
- Repo
目前 Repo currently private — coming to open source.為 私有, 準備 開源 中。 - README
宣告 README declares the MIT licence.MIT 授權。
想先試用 LedgerLion?Want to try LedgerLion early?
所有