feat(core,mcp,gui): never apply a legal rule past what wanderbooks knows

Stephen (2026-10-13): when what wanderbooks knows is stale, check the
date, research it or ask the owner or CPA, and update the rule for
everyone with a pull request (best) or an issue (worst).

- ledger_core::rules: a registry of rules set by law that change over
  time. Each says the years it's known for, its rules.md entry, its
  vendored official source, and a review date. stale_rules(today) is
  pure; the engine has no clock.
- The 1099 threshold is the first: $600 through 2025, $2,000 in 2026,
  then indexed for inflation (26 U.S.C. §6041(h)). default_threshold
  and vendor_1099_report now return Result; for 2027+ they refuse with
  LedgerError::RuleNotKnown, whose message says what to do: get the
  figure from the official source or the owner/CPA, pass it explicitly,
  then open a PR (or issue) at github.com/swaits/wanderbooks. Before,
  2027+ silently used $2,000.
- MCP: books.vendor_1099 relays that refusal; books.digest gains
  stale_rules; the server instructions tell the agent the procedure (and
  how to handle control-account conflicts: explain, never renumber).
  The CPA package writes a NOT-INCLUDED note instead of a guessed 1099
  worksheet.
- Viewer: "Needs attention" shows each stale rule with a ready prompt
  for the agent; the 1099 page explains instead of guessing.

Review date for the 1099 rule: 2026-11-01, when the IRS usually
publishes next year's inflation adjustments (CONVENTION, marked as such
in the registry).

Tests: an_unknown_year_threshold_is_never_guessed,
dated_rules_go_stale_on_their_review_date (dates passed in, so no clock
in the test), MCP stdio: 2027 refused with guidance, explicit threshold
accepted, digest carries stale_rules (asserted date-independently).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GWVo7x3UHw5kwCUaWxiejX
This commit is contained in:
swaitsandClaude Opus 5.5 committed 2026-10-13 14:07:22 -06:00
1 parent e2bebce051
commit df38dcccf9
15 files changed
+349 -47

No files matched your search

+10 -4
View File
@@ -107,9 +107,13 @@ below.
accounts (required); the three sections always sum to their net change.
Disposal gains/losses move from operating to investing automatically.
- `books.digest { since: "2026-10-01" }`
→ `{ entries_posted: [...], totals_by_account: [...] }`. The human review
surface: "what did the AI do with my books lately." The digest is the
answer to "trust, but verify."
→ `{ entries_posted: [...], totals_by_account: [...], stale_rules: [...] }`.
The human review surface: "what did the AI do with my books lately." The
digest is the answer to "trust, but verify." `stale_rules` lists legal
amounts wanderbooks may no longer know as of today (`{ name,
known_through, catalog, source, why }`): research the current value or
ask the human, then update it upstream (pull request or issue at
github.com/swaits/wanderbooks).
## Tools — fixed assets
@@ -220,7 +224,9 @@ whether a W-9 is on file.
takes `vendor` too; bills and their payments are tagged automatically.
- `books.vendor_1099 { year, threshold? }` → `{ year, threshold, vendors:
[{ vendor_id, name, form_1099?, tin_on_file, paid, reportable }],
missing_w9, notes }`.
missing_w9, notes }`. For a year whose threshold wanderbooks doesn't know
(after 2026 until the indexed amount is added) it refuses with what to
do; pass `threshold` explicitly once the figure is confirmed.
## Tools — receipts & documents
+7
View File
@@ -40,6 +40,13 @@ human to confirm or overturn; nothing else is.
- When an authority changes (the IRS revises a publication; a statute is
amended), add the new text beside the old with its effective date. Rules
that depend on dates (1099 thresholds) must say which text applies when.
- Rules that change with the law are registered in
`crates/ledger-core/src/rules.rs` with the years they are known for and
a review date. Past what it knows, the engine refuses rather than
guesses; from the review date, the MCP digest and the viewer flag the
rule. Whoever updates one (human or agent) vendors the new official
text here, extends the rule, and sends the change upstream: a pull
request at https://github.com/swaits/wanderbooks (best), or an issue.
## Open: sources we could not verify
+7 -3
View File
@@ -289,9 +289,13 @@ years after 2026, indexed to inflation and rounded to the nearest $100
(§6041(h)). Card payments are reported on Form 1099-K, not 1099-NEC/MISC.
Attorneys' gross proceeds stay at $600 (not modeled).
**Enforced:** `form1099::default_threshold`. **Open:** for 2027 and later
the indexed amount is not yet published; the engine must not silently
assume $2,000 (see the open-questions list in the strategy note).
**Enforced:** `form1099::default_threshold`, a dated rule
(`ledger_core::rules::THRESHOLD_1099`, known through 2026, review from
2026-11-01). For a later year the engine refuses with `RuleNotKnown`
rather than guess; the MCP digest and the viewer's "Needs attention" list
flag the rule once it is due (DECISION, Stephen, 2026-10-13). **Checked:**
`an_unknown_year_threshold_is_never_guessed`,
`dated_rules_go_stale_on_their_review_date`, MCP stdio test.
## B-20 Every transaction has supporting documents; records are kept