Show HN: LIBR tracing with source ledger rows and byte-exact PDF verification
摘要
标题:Show HN: LIBR tracing with source ledger rows and byte-exact PDF verification。项目 / 工具:LIBR 作为确定性账本状态机 —— 工程笔记,隔离 LIBR 式追踪可通过有序账本重放确定性计算呈现。状态机每一步重放一笔有序交易:输入包含先前可追踪余额、当前账户余额、交易金额和排序模式;过渡后可追踪余额 = min (先前可追踪余额,账户余额后)。后存款不自动恢复先前减少的可追踪额(LIBR 假设)。状态变量包括账户余额、可追踪余额、耗竭事件、排序模式、源存款。不变式:可追踪余额不超账户余额、不超源主张、不恢复耗竭后增加。后存款不恢复、确定性重放。示例账本含合成 CSV,有红 dip、后薪资存款等。排序模式:账本顺序(--ordering ledger)、主张有利(--ordering best case)、保守反方(--ordering worst case)、中性基线(产品默认)。公共仓库:纯 Python CLI、合成账本 CSV、零余额耗竭测试、后存款不恢复测试、多源存款边缘案例。产品边界:私有产品在公共原语外增加认证工作区、语句摄入、调和、材料账本选择、可审查工作纸、源出处、SHA-256 快照完整性、字节检查、单主张导出护栏。运行本地:需 Python 3.10+,CLI 打印材料追踪事件。相关资源:LIBR Guide、White Paper、样例工作纸、Clio 集成、文件验证。工程笔记仅技术反馈,非法律意见。
荐读理由
你能把这个Python CLI复制进AI工程项目里,用--ordering参数切换ledger/best-case/worst-case模式,精确重播带相同日存款提款的合成账本,快速对比trace变化,避免后期调试时猜‘如果我按不同顺序追回’的坑。
原文
LIBR as a Deterministic Ledger State Machine
An engineering note on replaying ordered financial transactions to preserve balance dips, same-day assumptions, and non-replenishment behavior.
Public engineering note Synthetic data only Deterministic calculation demo Not legal advice
Open Public Repo Read LIBR Guide View Synthetic Workpaper
State transition card
Each ledger step replays one ordered transaction against running state.
State inputs: - prior traceable balance - current account balance - transaction amount - ordering mode Transition: traceable_after = min(traceable_before, account_balance_after) Boundary: later deposits do not automatically restore a previously reduced traceable amount under the selected LIBR assumption.
Replay one ordered transaction against running traceable balance.
After a dip: traceable_after = min(traceable_before, account_balance_after).
Later deposits do not automatically restore prior trace under the LIBR assumption.
Purpose
Why this artifact exists
The full Exit Protocol product remains private. This public engineering note isolates one narrow technical claim: LIBR-style tracing can be represented as deterministic replay over an ordered ledger.
The companion repository uses synthetic CSV fixtures and regression tests so developers, forensic accountants, and diligence reviewers can inspect the calculation model directly. The artifact is for technical feedback — not legal conclusions, expert opinions, or product completeness claims.
Visual Module
LIBR replay state machine
Synthetic fixture only. Each ordered transaction advances account balance and traceable balance under explicit LIBR assumptions.
Swipe horizontally if the diagram extends beyond the screen.
stateDiagram-v2
[*] --> Baseline
Baseline --> ClaimOpen: separate-property deposit
ClaimOpen --> Replay: chronological replay
Replay --> DipDetected: withdrawal below trace level
DipDetected --> TraceReduced: cap at lowest intermediate balance
TraceReduced --> Replay: continue replay
Replay --> LaterDeposit: later deposit
LaterDeposit --> HoldTrace: balance rises
HoldTrace --> Replay
Model
State machine representation
LIBR tracing is stateful ledger math. Each transaction advances account balance and traceable balance together. Reviewers can inspect the replay path rather than inferring results from narrative summaries.
Source depositClaim opens
Ordered replayLedger walk
Balance dipTrace ceiling drops
Same-day orderMode applied
SnapshotInspectable output
State variables
account_balance — running cash balance after each transaction
traceable_balance — candidate separate-property trace under LIBR
depletion_events — points where traceable balance is reduced by a dip
ordering_mode — same-day tie-break assumption
source_deposit — separate-property claim anchor for the replay
Transitions
deposit — may increase account balance; separate deposits may increase provisional trace
withdrawal — reduces account balance and may trigger a dip
same-day reorder — resequences ambiguous intraday rows
balance dip — traceable balance capped by account balance
report snapshot — frozen state for inspection and tests
Invariants
Trace never exceeds account
traceable balance cannot exceed the account balance after any step.
Trace never exceeds source claim
traceable balance cannot exceed the separate-property amount being traced.
Non-replenishment after dip
later deposits do not automatically restore a traceable amount previously reduced by a dip.
Deterministic replay
same inputs and same ordering mode produce the same outputs on every run.
Example Ledger
Synthetic replay with a balance dip
Illustrative rows only. The public repository includes a fuller synthetic CSV and regression fixtures.
Swipe horizontally to view all ledger columns on tablet widths.
| Date | Event | Account Balance | Traceable Balance | State Note |
|---|---|---|---|---|
| Jan 1 | Opening balance | $5,000 | — | Baseline community/pre-existing funds |
| Jan 3 | Separate-property deposit | $105,000 | $100,000 | Source deposit opens traceable claim |
| Feb 10 | Withdrawal | $45,000 | $45,000 | Red dip: trace capped by account balance |
| Mar 1 | Later salary deposit | $65,000 | $45,000 | Account rises; traceable balance unchanged |
| Date | Event | Account Balance | Traceable Balance | State Note |
|---|---|---|---|---|
| Jan 1 | Opening balance | $5,000 | — | Baseline community/pre-existing funds |
| Jan 3 | Separate-property deposit | $105,000 | $100,000 | Source deposit opens traceable claim |
| Feb 10 | Withdrawal | $45,000 | $45,000 | Red dip: trace capped by account balance |
| Mar 1 | Later salary deposit | $65,000 | $45,000 | Account rises; traceable balance unchanged |
Red dip: A red dip occurs when the account balance falls below the claimed separate-property amount, reducing the candidate traceable amount under the selected LIBR assumption.
Ordering Modes
Same-day ordering assumptions
Bank statements often lack reliable intraday timestamps. When multiple rows share a date, ordering changes the replay path. These modes expose calculation assumptions for review — they are not legal conclusions.
Ledger order
Public repo: --ordering ledger. Preserves CSV order within each date. Baseline deterministic replay.
Claimant-favorable
Public repo: --ordering best_case. Deposits before withdrawals on same day. Exit Protocol product maps to maximize strategy.
Opposing-counsel conservative
Public repo: --ordering worst_case. Withdrawals before deposits on same day. Exit Protocol product maps to minimize strategy.
Neutral baseline
Exit Protocol product uses a court-balanced neutral strategy for default replay when same-day ambiguity exists.
Public Repository
What the public repo demonstrates
**
Dependency-free Python
Standalone calculator with no Django dependency.
Synthetic ledger fixture
CSV commingled-account sample for public inspection.
**
Same-day ordering modes
ledger, best_case, and worst_case CLI switches.
**
Zero-balance depletion test
Regression coverage for full account depletion.
**
Replenishment fallacy test
Later deposits do not restore depleted trace.
**
Multiple source deposits
Edge-case fixture for added separate-property inflows.
**
CLI execution
Print material trace events from the command line.
**
Reproducible output
Same fixture and mode yield the same trace on rerun.
Product Boundary
What Exit Protocol adds beyond the public artifact
The repository proves the calculation primitive. The product wraps that primitive in a review workflow:
Authenticated case workspace
Private matter context with role boundaries.
Statement ingestion
Selected financial records normalized into ledger rows.
Reconciliation
Opening, activity, and closing balances tested before tracing.
Material ledger selection
Rows surfaced for attorney and expert inspection.
Attorney-reviewable workpaper
Structured export — not legal advice or an expert report.
Source provenance
Supporting rows linked to selected statements or exports.
SHA-256 snapshot integrity
Fingerprint of calculation state at export time.
Final file hash verification
Post-export byte check for generated workpapers.
V1 single-claim export guard
Default workpaper path scoped to one claim per account.
Run Locally
Inspect the calculation artifact
Requires Python 3.10+. No third-party packages.
git clone https://github.com/Vinaygond/libr-state-machine-demo.git
cd libr-state-machine-demo
python -m unittest discover -s tests
python libr.py examples/minimal_dip_ledger.csv
python libr.py examples/synthetic_ledger.csv --ordering ledger
python libr.py examples/synthetic_ledger.csv --ordering best_case
python libr.py examples/synthetic_ledger.csv --ordering worst_case
python libr.py examples/minimal_dip_ledger.csv --json
The CLI prints material trace events from the synthetic fixture. Compare ordering modes to see how same-day ambiguity changes replay output.
Professional boundary. This engineering note is educational and product-oriented. It is not legal advice, not an expert opinion, not a court filing, and not a guarantee of admissibility. LIBR and related tracing doctrines are jurisdiction-specific and fact-dependent. Attorneys and retained experts must review all source records, assumptions, calculations, and conclusions.
Related Resources
Continue diligence review
LIBR GuidePlain-language methodology for commingled-account tracing. White PaperArchitecture, methodology, and V1 scope statement. Sample WorkpaperSynthetic attorney-reviewable LIBR export. Clio IntegrationSelected-document workflow for Clio Manage. Verify a FileCheck generated export integrity against stored hashes. Public RepoSource, fixtures, and regression tests on GitHub.
这条对你有帮助吗?