The owner's rule, given when a retried write after a lost answer turned
out to record twice. Reading the write path showed more than that: a
tool call may append several journal lines with nothing joining them, so
a crash between them leaves part of a call in the books. The plan now
says what the code does today and the rule that replaces it: a call's
lines commit together under a closing line, every write carries a
request key, a repeat returns the answer first given, and a failed write
is on record. It is a journal feature, built as its own unit before the
remote door.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Its first task failed at once with "model does not exist or you lack
access". The table keeps the row and the note says to try again at the
next batch. The delegation log gains the GL.iNet research line.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The owner wants Let's Encrypt swappable. Every candidate speaks ACME,
so the app knows the protocol only and takes the authorities to try
from the relay service; a swap is a server-side change, and the tests
fail over between two configurations.
docs/routing.md: Muse Code lists muse-ember-1.0 as of today, so
run-only tasks go to it, as the owner asked on 2026-11-09.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The relay answers for wanderbooks.link itself: every name is at the
relay, and a proof code is the one an app just handed in, so nothing is
stored per user. The owner doubted that a certificate per installation
is what Let's Encrypt is for; the plan now carries what Tailscale, Home
Assistant Cloud, Plex and Let's Encrypt's own pages say, the one denial
found, and the fallback authorities.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A design, nothing built. The detached host is what makes packaging hard
on each system, and the people the product is for use chat products in a
browser. So the app's window becomes the host (a tab per open company,
agents reach a company only while it is open), and web assistants reach
the app through a relay on wanderbooks.link that routes by name and
cannot read traffic, the app holding its own certificate.
The owner's decisions of 2026-11-20 are D-77 to D-82; D-83 to D-86 are
proposed and wait for him. The bookkeeping rules do not change: the
window still only reads, and every entry still goes through the tools.
The delegation log gains the nine research and reading tasks behind it.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The AppImage launcher sets APPIMAGE (the image's file) and APPDIR (where
it is mounted) for the program it starts, and every program that one
starts inherits both: a terminal, an editor, an agent's app. The host's
start, the agent's pointer file, the host's check for a replaced program
and `update` each read APPIMAGE and believed it whenever it named a file.
So a wanderbooks run from inside another app's AppImage took that app's
image for its own:
- it started that image as the host, and the books never opened ("the
books server keeps failing to start");
- `connect` would have written that image into the agent's pointer file;
- `wanderbooks update` replaced that app's file with wanderbooks.
Found by the batch's gate: the_host_outlives_the_app_scope_that_started_it
passes its own environment on (the other tests clear it), and this gate
ran in a session started from an AppImage app. The first and the third
are reproduced by two new tests, which fail without this change (the
update test read an ELF header where the other app's file had been).
The rule now (start.rs INVARIANT 6, from the AppImage documentation's
"Environment variables"): the image is this program's own only when
APPIMAGE is an absolute file, APPDIR an absolute folder, and the running
executable's file is inside APPDIR, compared as resolved paths. One
function decides (`own_appimage`), and all four readers ask it. The host
is handed APPDIR beside APPIMAGE, and neither unless both are its own.
No books and no figure are touched. The tests that pretend to be an
AppImage now set APPDIR as a launcher does; translocation.rs used a bare
APPIMAGE to stand in for a macOS path, the very thing this closes, and
names the program's folder as the mount.
The failing test's message now lists the lines that did arrive, which is
what showed the host was refused rather than slow.
Not checked against a built AppImage (none has been built with this
change): the first trial of one shows `update` and a restart find the
image.
Co-Authored-By: Claude <noreply@anthropic.com>
The viewer was the last crate with arithmetic of its own on amounts. With
it at zero, `just kernel-only` runs the detector over all eleven crates,
and it now fails when a folder under crates/ is not in its list, so a new
crate cannot do money arithmetic of its own from the day it is added.
Why it matters for the books: the proofs (Kani, Lean) are about the
kernel. A sum or a product computed anywhere else is one they say nothing
about, and rust_decimal's own operators either panic or round without
saying so. Bar item 1 of AGENTS.md is now a property the compiler checks
for the whole workspace, not a rule to remember.
Checked on main after the merge: the detector reads 0 places and 0
waivers for ledger-gui, the crate's whole test suite passes in one run
(300 passed, 0 failed, 1 ignored), clippy with warnings denied and fmt
are clean.
docs/proofs/k-u12.md is the account: the 183 places by crate, the rule
each kind followed, and the decision for every site that was not a plain
sum or sign.
Co-Authored-By: Claude <noreply@anthropic.com>
ledger-import, ledger-package and ledger-mcp join kernel_only_crates:
the detector reads 0 for each on main, their suites pass and clippy is
clean, so the lint part of `just check` now refuses a new raw Decimal
operator or rust_decimal method in ten of the eleven crates. ledger-gui
is the one left.
The delegation log has the task's line.
Co-Authored-By: Claude <noreply@anthropic.com>
Ten places, now zero, and both crates join kernel_only_crates so the lint
part of `just check` holds them there.
ledger-store (8): a disposal's preview adds the asset's posted runs and
takes book value and gain or loss by subtraction; an attested receipt is
compared with the entry's debits; an older settlement's remainder is the
document's total less what was recorded. Each called rust_decimal's own
checked_add or checked_sub, which rounds where the exact answer needs
more than 96 bits and says nothing. They call the kernel's now
(kernel::total_of, Amount::checked_add and checked_sub): exact, or the
refusal each of these places already had (too_large, or no figure to
compare). Two unary minuses go through money::neg. Posted lines are
bounded (BS-entry-3, BS-entry-4), so no figure in real books changes.
ledger-config (2): a member's "50%" is divided by a hundred through
Amount::checked_div (the raw `/` computed the same quotient), and the
members' shares are added by kernel::total_of. Shares that cannot be
added exactly are refused with a sentence saying to write them with
fewer places, where the raw sum would have rounded them and then
compared the rounded figure with one. ledger-core's own check of the
same setting already did this.
Checked: the detector reads 0 for both; both crates' suites pass (682
tests); clippy with -D warnings.
Co-Authored-By: Claude <noreply@anthropic.com>
AGENTS.md's bar says money arithmetic lives in the kernel and nowhere
else, because the proofs are about the kernel only and because a raw
operator panics where rust_decimal's own methods round silently. Nothing
checked it, and 210 places in ledger-core broke it.
`just kernel-only` runs scripts/raw-decimal-arith.sh over the crates
named in kernel_only_crates and fails on the first place found; the lint
part of `just check` runs it. The list is ledger-core, now at zero, and
the four outer crates that never had a place (ledger-cli, ledger-host,
ledger-reader, ledger-vault). The other six join as K-U12 brings each to
zero.
docs/proofs/k-u11.md is the unit's account: what was measured, what each
group of sites became, what exact arithmetic refused and why, and what
the detector does not show (that a site calls the right kernel function;
the tests and a reading of every long figure carry that).
Co-Authored-By: Claude <noreply@anthropic.com>
The triage marked exact Decimal arithmetic and the tie rule as in
flight; both are on main. It now says what each closed, the one figure
a new foreign line can book differently (the exact product's cent,
10500000099.89 where the double rounding booked .90; posted lines are
not recomputed), and what the checks found that the workers' own runs
did not: an exact division that accepted a rounded quotient, the six
review findings, and the Kani cover the tie change made unreachable.
The comment in add_line_fx said a 20-place product past 7.9e8 rounds
twice; since K-U10 the kernel holds that product in 256 bits and rounds
once. The K-U1 note's open edge points at the unit that closed it.
Three lines in the delegation log: the two hard implementations and the
review.
Co-Authored-By: Claude <noreply@anthropic.com>
The rule (BS-partner-1, bookspec's Apportion) is that leftover cents go
to the largest remainders, ties to the earlier part. The engine ranked
the difference of quotients rounded at Decimal's 28th digit, so an exact
tie went where that digit sent it: 20.00 by 4/1/1 came out 13.33 / 3.34 /
3.33. It now ranks the exact remainder, whole x weight - part x total,
and gives 13.34 / 3.33 / 3.33. The owner decided for the exact ranking on
2026-11-09 (D-76, recorded here).
What moves: no golden, nothing between two parts or by equal weights, at
most a cent a part elsewhere (tests/kernel_bridge/ties.rs measures it).
Of the engine's splits only the K-1 worksheet's share of contributed
property divides by a total that is not one; a convention's split and the
frozen close rule already ranked exactly. Posted splits are not
recomputed.
Changed in the merge:
- The ranking's two products are the rounding ones (checked_mul_rounded).
The kernel's checked_mul is exact or refused since K-U10a, and would
refuse a split by weights of 27 places; the split is made, ranked by
the nearest figures Decimal holds. A test splits by thirds, sevenths,
ninths and elevenths at 27 and 28 places, both signs.
- Kani failed the unit as it came: with the exact ranking a part whose
share is exact never takes a leftover unit (5 by 2/3/5 is 1, 2, 2, where
i64's truncated quotients gave 2, 1, 2), so the cover "a part exactly
one step above its truncated share" could not be reached. The harness
split_by_weights_within_one_step now asserts the strict bound and that
an exact share takes no unit; both covers are reached.
- docs/verification.md also takes K-U10a's account (sums and products
exact or refused), which closes the edges it listed as pinned.
Co-Authored-By: Claude <noreply@anthropic.com>
rust_decimal rounds a sum or a product whose exact figure needs more than
its 96-bit mantissa or 28 places, and says nothing. The kernel's Amount
for Decimal now refuses instead: checked_add, checked_sub and checked_mul
return the exact figure or None. Two products keep their meaning under
their own names: checked_mul_rounded (a proportional share by a weight of
many places, a rounded figure by construction) and
checked_mul_round_to_step (a foreign amount at a rate: the exact product,
held in 256 bits, rounded once). checked_div_exact no longer accepts a
rounded quotient that happens to multiply back.
Within the line cap (10^15, ten places) sums and differences are the old
ones to the character, and no golden moves. One figure a new line can
book does move, the one the old double rounding got wrong: a foreign
amount at a rate whose exact product passes 96 bits (1050000010.0000000001
x 9.9999999999) books 10500000099.89, the exact product's cent, where it
booked 10500000099.90. A line already posted is not recomputed: replay
reads the booked amount.
Reviewed before merging by a second model, which sampled the 256-bit
arithmetic (no wrong figure) and found the properties proved soundness
only. They now prove the other direction too, from the rational alone:
nothing Decimal could hold is refused. One refusal is new and stated: a
product that is not exact, rounded to a step of 27 or 28 places.
docs/proofs/k-u10.md has the whole account.
Co-Authored-By: Claude <noreply@anthropic.com>
The independent review of K-U10 found the bridge properties proved one
direction only. They compared the kernel with an expectation built from
rust_decimal's own result, so they showed a figure returned is exact, and
could not show that an exact figure is never refused. Each of add,
subtract, multiply and exact division is now also Some exactly when the
rational result is a Decimal (a mantissa under 2^96 at a scale of 0 to
28), decided from the rational alone. All hold: no change to the kernel.
Also from the review:
- the FX product rounded once is checked at steps of every scale, not 0 to
3 places, and a None is accepted only at the two bounds the code states;
- one refusal the docs did not state is now stated and pinned: a product
that is not exact, at a step of 27 or 28 places, is None though its
rounded figure can be a Decimal (the one rounding needs two places
below the step and Decimal ends at 28). No currency's step is near it;
- running totals are checked over thousands of lines, and the first
refusal is pinned (line 7,923 of the largest ten-place amount, where
rust_decimal drops a place and rounds);
- three stale sentences: percent_of's product is exact or refused since
this unit (only its division rounds), the header of allocate.rs, and
the table in docs/proofs/k-u10.md, which now records the review.
Co-Authored-By: Claude <noreply@anthropic.com>
MIT, BSD and ISC ask that the copyright notice itself travel with a copy,
not only the licence's words. For 70 of the crates the program links,
cargo-about could give only the licence's standard text, whose copyright
line is a placeholder ("Copyright (c) <year> <copyright holders>"):
the crate's own licence file is a compound one it cannot match (chrono
and libm put two licences in one file, aws-lc's is 316 lines of several,
the windows crates indent theirs), or the crate was packaged with no
licence file at all (egui, objc2, wasmi and 32 more).
scripts/notices-packaged.py reads cargo-about's output, finds every
section with such a placeholder, and adds a part to the file: the licence
files those crates were packaged with, whole, each distinct text once
under the crates that carry it, and for the 35 packaged with none the
repository their manifest names. It reads the crates where cargo has them
(cargo metadata, locked and offline), so the text still depends on
Cargo.lock alone; two runs are byte-identical. The file grows from 551 KB
to 707 KB. The test for `wanderbooks licenses` now asks for a copyright
line that only a compound file holds.
Co-Authored-By: Claude <noreply@anthropic.com>
Every MIT, Apache, BSD and ISC crate and every bundled font asks that its
notice travel with a copy of the binary. THIRD-PARTY-NOTICES.txt is
generated from the lock file (cargo-about) and the font licences, compiled
into the program and printed by `wanderbooks licenses`; the lint part of
`just check` fails when it is out of date.
Checked before merging: the accepted list equals deny.toml's; two runs are
byte-identical; the check exits 1 on a changed file and 0 after
regenerating; no path or user name in the text; the three ledger-cli test
files pass (licenses 4, hostile_args 6, one_executable 9); fmt and clippy
clean.
Co-Authored-By: Claude <noreply@anthropic.com>
cargo-about is run with --offline so the notices text is the same on
every machine: it reads only the files each crate was packaged with, and
never looks in a crate's repository for a licence file the package left
out. Today the two give the same text, byte for byte. The cost is that
every crate in Cargo.lock has to be in the local registry, every
platform's included, so a failure now says to run `cargo fetch --locked`.
The check is not seconds: it reads every crate's files for licence text,
about two minutes of wall clock. docs/testing.md says so.
Co-Authored-By: Claude <noreply@anthropic.com>
The notices must reach the person holding the binary, not only the
repository: THIRD-PARTY-NOTICES.txt is compiled in with include_str!,
so `wanderbooks licenses` prints the program's version line and then
every crate's and font's licence without opening books or reading a
file. A closed pipe (`| head`) is ignored, not a panic.
Tests check the version line, the notices required in the output, that
the bytes after the header are exactly the repository's file, and that
the mode takes no arguments and must come first like every other.
Docs: the testing table says what `just notices` writes and how
`notices-check` fails on a stale file; the architecture's list of modes
names licenses.
Co-Authored-By: DeepSeek V4.1 Flash
`Amount::checked_div_exact` promises the exact quotient or nothing: "never
a rounded share". On Decimal it checked the quotient by multiplying back,
but with rust_decimal's own product, which rounds. A rounded quotient
times the divisor rounds back to the dividend (10 / 3 is 3.333...3 at 28
places, and 3.333...3 x 3 is held as 10), so a third, a seventh and a
ninth all passed as exact.
No figure in the books was wrong: the one caller divides a basis-point
product by 10,000, which is always exact. The contract was broken for
the next caller. The check now multiplies back exactly (K-U10's
`exact_mul`), so a rounded quotient is refused.
The bridge gets the property (a quotient returned, times the divisor, is
the dividend as a rational) and the named cases. The FX rounding
property also takes steps of 5 and 25 units, whose half steps sit one
place below the step: the wide product keeps that digit real.
Co-Authored-By: Claude <noreply@anthropic.com>
bookspec proves its laws (the trial balance, the accounting equation,
posted is forever) for every state its steps reach. The engine has 119
public commands and the model 14 steps, and nothing said which command is
which step, so "every reachable state" read wider than it was.
docs/command-steps.md is that map, command by command: 71 are the
`record` step (they change how the books are kept and no figure), 11 are
one step, 19 are several steps run as one, 17 are the doors a journal is
replayed through, and one, `renumber_account`, is no step at all.
What the map shows that was not written down before:
- A renumber changes the chart's codes and the model has no step for it.
- Four doors apply a journaled change without a check the model's step
requires (a draft dated in a closed period, a period overlapping
another, a reversal dated before its original). Books replayed from an
old journal can therefore be outside the model's reachable states. The
laws resting on distinct codes, acceptable entries and known accounts
still hold by reading their proofs; no theorem says so yet.
- The registers (assets, schedules, recurring entries, payroll runs) have
proved arithmetic and no model of how they change over time.
- No proof ties a Rust command to its step: bookspec's examples and the
differential test do, and the page lists what that test does not reach.
Each closes with Lean in bookspec; the triage (P2.5) lists them.
tests/command_steps.rs keeps the map whole: a command with no row, a row
with no command, a step the model does not have, or a new command marked
as no step without being added to the pinned list fails the build.
Co-Authored-By: Claude <noreply@anthropic.com>
rust_decimal's checked_add and checked_mul return None only when the
integer part overflows. When the exact result needs more than 96 bits of
mantissa, or a scale past 28, they round it and return Some: MAX + 0.4 is
Some(MAX) (K-U4), 0.01 + 792281625142643375935439503.35 is ...503.4
(K-U8), 1050000010.0000000001 x 9.9999999999 is 10500000099.895 where the
exact product is 10500000099.89499999999999999999 (K-U1), and
123456789.0123456789 squared loses its last digits (K-U3). The kernel's
contract is exact or None, and BS-ledger-1 says a product the arithmetic
cannot hold MUST be refused.
impl Amount for Decimal now runs rust_decimal's operation and checks, in
256-bit integers (kernel/decimal_exact.rs), that the figure equals the
exact sum or product as a rational; otherwise None. It builds no rounded
figure of its own, and an exact result is returned as rust_decimal gave
it, scale and all, so nothing exact moves. Comparing values is complete
where the K-U10 row's "result scale fell below the operands'" test is not:
100 x 0.3333333333333333333333333333 is exact with a full-scale mantissa
past 96 bits (trailing zeros), and percent_of computes it for every
ratio. checked_sub is rust_decimal's subtraction under the same check
(the trait default gave -0 for 0 - 0). Money::checked_add and
checked_sub go through Amount; sum_exact*, add_exact and sub_exact already
did.
Two products could not simply become exact, and the suite found both:
- Shares multiply a cent amount by a many-place percent
(33.333333333333333333333333333, 27 places) and then divide, which
rounds anyway (spec_cash_flow's government payment). They use the new
Amount::checked_mul_rounded, rust_decimal's own product, so every share
is the figure it always was.
- A foreign amount at a rate (fx_booked) rounds once, from the exact
product: Amount::checked_mul_round_to_step holds it in 256 bits, cuts it
only as far as Decimal needs with a sticky digit for what was cut, and
rounds with round_step. The one posted-range figure that moves is the
one the old double rounding got wrong: 1050000010.0000000001 x
9.9999999999 books 10500000099.89, the exact product's cent, not
10500000099.90.
checked_div and checked_div_exact are unchanged. Inherent
Decimal::checked_* calls outside the kernel are listed in
docs/proofs/k-u10.md and not converted.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The detector, run again on the three crates K-U9 touched: ledger-gui
123 places of money arithmetic outside the kernel (was 137),
ledger-import 18 (was 22), ledger-package 13 (unchanged: its sums are
totals, not display rounding).
Co-Authored-By: Claude <noreply@anthropic.com>
Three crates each rounded an amount for display in their own way, and
the viewer computed its percentages in f64. Money is never a float, not
for a ratio either (AGENTS.md's first rule), and a figure shown should
not depend on which renderer drew it.
- `ledger_import::format::round_display(amount, places)`: half away
from zero through the kernel's `round_places`, never a negative zero.
The reports' text, the PDFs, the spreadsheet, the CPA package's text
and the viewer's formatting all call it.
- The viewer's percentages (`fmt::pct_change`, the Profit page, the
reports' change and share-of-income columns) are the kernel's
`percent_of` on Decimals.
What a reader sees differently, by principle and not by accident:
- `compact` rounds half away from zero like every other figure:
1,250,000 reads $1.3M (was $1.2M), 10,500 reads $11k (was $10k).
- A change against a base that is zero or negative shows no percentage
("—"), where it used to show one with a misleading sign: from a loss
of 100 to a loss of 50 is not "50% down".
No booked figure moves and no golden changed. One fix on merge: the
demo books' platform fee is a booked amount, so it uses the kernel's
rounding with the rule it always had (a half to the even cent), not the
display rounding the branch had put there; the demo books are unchanged.
Shown on main: clippy clean on the three crates; ledger-import's unit
tests 44 passed and spec_import, labels, templates 91 passed;
ledger-package 49 passed; the viewer's unit tests 62 passed, and
display_rounding, view_model, sidenav, spec_gui, odd_cent 59 passed;
ledger-core's bookspec checks 78 passed (the worker's one failure there
was its old base, which lacked the pin at bookspec 79cb439).
Co-Authored-By: Claude <noreply@anthropic.com>
Nothing checked what the program is built from. `just deny` now does, in
the lint part of `just check` and weekly in scheduled.yml (an advisory
is published when it is, not when we push), from one file, deny.toml:
- advisories: no crate in the lock file with a known vulnerability
(RustSec), none yanked; an unmaintained crate is refused when it is
one of our own direct dependencies. Two advisories are lived with,
each with its reason and date: the quick-xml 0.38 that typst's
citation reader brings, which no XML from outside reaches.
- licences: the permissive ones, plus MPL-2.0 for one unchanged crate
(option-ext) and CDLA-Permissive-2.0 for Mozilla's root certificates.
No font licence is allowed, so a crate that carries fonts is refused
and every font we ship is a file here beside its licence. A crate
offering only a copyleft licence is refused.
- sources: crates.io and the bookspec repository, nothing else.
- bans: no dependency by wildcard version.
The crates are marked `publish = false` (one line in the workspace,
inherited by all eleven): they are parts of one program, not libraries
for crates.io, and with that cargo-deny accepts their path dependencies
on each other.
cargo-deny 0.20.2 is a build tool pinned in mise.toml, not a dependency
of the program.
Shown: `just deny` prints advisories ok, bans ok, licenses ok, sources
ok on this tree.
Co-Authored-By: Claude <noreply@anthropic.com>
One page (plan/2026-11-09_TRIAGE.md) of what is missing or not as the
manual promises, each item with how it is known, what closes it and who
does it. The engine's numbers are not in question; the gaps are in what
the gates did not see: a red Windows gate nobody read, 210 places in
ledger-core and 201 in the outer crates that do money arithmetic outside
the kernel, Decimal sums that round silently, a tie between shares that
went where the 28th digit sent it (the owner's decision D-76: the
earlier part, exactly), no supply-chain gate, no third-party notices in
the packages, and a Lean model of 14 steps against about 100 commands.
docs/routing.md: Muse Code still lists no Ember (19:30 MST).
Co-Authored-By: Claude <noreply@anthropic.com>
5544a3e66 split the `check` job into five parts on five runners; the
page still said one job runs `just check`. It now names the parts, how
to run one here, and that the lint part fails when the workflow's list
is not the justfile's.
Co-Authored-By: Claude <noreply@anthropic.com>
Tests encode the display rules: half away from zero, no negative zero, no percent of a zero or negative base, plus a scoped source check that no round_dp or float conversion remains in the money display paths. view_model's pct_change(-100, -50) expectation moves from Some(50.0) to None under the new rule. docs/proofs/display.md is the unit note (no Kani, no Lean for display, per the audit).
Co-Authored-By: Muse Wonder 1.0
`just prove` ran its 97 fast harnesses under one 30-minute `timeout` and
nothing else. On a machine busy with other builds the run was ended with
exit 124 and no harness named, so a proof that failed could not be told
from a proof that was only slow, and the answer was to run it again and
hope. A gate that cannot say which is not a gate.
Now each harness has its own cap (Kani's --harness-timeout,
KANI_HARNESS_CAP, 900 s: the fast harnesses each take under four minutes
on a busy machine, the longer ones are in kani_slow under their own
caps), the whole set's cap is KANI_FAST_CAP (1800 s as before), and a
run that does not verify every harness lists each one that failed, each
that ran past its cap, and each that never finished.
No proof changes: the caps bound how long a harness may take, not what
it must show, and the count of verified harnesses and the cover check
are as they were.
Checked: the report read against a real run in which one harness passed
and one hit a 15 s cap (the second named as past its cap); and
`KANI_FAST_CAP=2 just _kani fast` exits 1 naming all 97 as not finished.
A full `just prove` is the batch's gate.
Co-Authored-By: Claude <noreply@anthropic.com>
The audit took a cent for every currency, so a JPY close (split in whole
yen) was checked a hundred times too finely, and a code with no minor
unit too coarsely. The unit now comes from the one helper the split
itself uses. Before the true-up, a last-absorbs close's last member may
carry half a unit for each of the others (BS-partner-1 statement 6), so
the bound is max(u, (n-1)u/2), derived and marked so, not one unit.
Co-Authored-By: Claude <noreply@anthropic.com>
Muse Ember was released today and the Muse Code provider does not list it
yet; only OpenCode does. The owner's rule: do not take the OpenCode
listing, check the Muse Code provider before each batch of delegations,
and route run-only work to Ember once it is there. Until then run-only
tasks stay on the scout row.
Co-Authored-By: Claude <noreply@anthropic.com>
The owner's rule from 2026-11-09: delegated work is routed by what the
task is (scouting, running things, bulk implementation, hard
implementation, review), not by a random draw, and the routing is
adjusted from evidence. `docs/routing.md` is the current table with the
exact provider and model ids; `docs/delegation-log.md` gets one line per
task once it is verified or abandoned.
One row is open: the plan names Muse Ember through Muse Code for run-only
tasks, and that provider does not list it here (OpenCode does). The file
says so, and those tasks go to the scout row until the owner chooses.
Co-Authored-By: Claude <noreply@anthropic.com>
A failure a property test once found is kept as a seed and replayed on
every run: that is what makes a fixed bug stay fixed. Proptest finds
the seed file from the test's source path and says nothing when the
file is not there, so a seed file left behind by a moved test is never
read again, silently.
Four findings, one cause:
- The kernel bridge's three recorded failures (the constructive split
with a short remainder, and two cash-application cases) sat in
tests/kernel_bridge.proptest-regressions. Since 0cf013b57 the bridge
is a folder (tests/kernel_bridge/main.rs), and a folder test reads
tests/proptest-regressions/main.txt. The three had not been replayed
since. Moved there.
- K-U8 found a control-total case (a sum that touches Decimal's top,
f = [0, -1, -79228162514264337593543950335, 0, 5]) and the seed was
never checked in; it lay untracked in the unit's worktree. Added as
tests/proptest-regressions/control.txt, where control.rs reads it.
- ledger-mcp's proptest-regressions/local_files.txt recorded failures
of a module removed in b26c099a6 (files reach the books as uploads
by hash now). No test can read it. Removed.
- Nothing checked any of this. tests/seed_files.rs walks every crate
and fails when a seed file has no property test that reads it.
How the reading rule was established, not assumed: a marker line in
each candidate file, and proptest's "unparsable line" warning names
the file it really opens.
With the seeds back, the bridge passes whole (101 tests), so nothing
had regressed behind the gap. The guard was red before the move (it
named both orphans) and is green after: 21 seed files, each read by a
property test.
Co-Authored-By: Claude <noreply@anthropic.com>
split_by_weights_into's largest-remainder policy ranked the leftover
cents by the rounded quotient's remainder (Decimal keeps 28 significant
digits), so an exact tie was decided by the quotient's last digit, not
given to the earlier part as apportion's docs and bookspec's Lean model
(Apportion.lean: remW = x*w % W, ties to the earlier member) say.
20.00 by 4/1/1 over 6 gave 13.33, 3.34, 3.33 where the exact tie of
remainders (0.02 over 6 each) belongs to the first: 13.34, 3.33, 3.33.
It now ranks the exact integer remainder whole x weight - part x total
(the quantity share_floor_with returns), sign-flipped for a negative
total so the order stays the share's own. The parts still sum to the
whole and each is within one step; only which part takes a tied cent
changes. Stored entries never move (posted is forever); a report
recomputed for a past period can move a cent between parties.
The finding test is flipped into the law (ties_go_to_the_earlier_part),
the bridge's ranking property now includes ties, and the spec block,
k-u3.md and verification.md say ties go to the earlier part, exactly.
This branch is held: the owner decides whether the cents may move
(see tests/kernel_bridge/ties.rs for what it moves).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Before a count is trued up, check_split flagged any drift beyond one unit. BS-partner-1 statement 6 allows a legacy last-absorbs close more than that with four or more members, so the audit raised a false finding on legitimate legacy books.
The rule does not state an audit bound; this bound is DERIVED from statement 6's per-member facts, and the derivation is in check_split's spec block: with n members and unit u, each member but the last was rounded to within u/2, and the last absorbed the sum of those roundings, so |e_last| <= (n-1)*u/2. Floored at u (statement 6's allowance for each run break and each per-close close), the pre-true-up bound is B(n) = max(u, (n-1)*u/2): 1.5 units with four members, 2 with five. A drift of exactly B(n) is legitimate and not flagged; past it is. After the true-up, statement 5's strict bound still holds: a drift of a unit or more is flagged.
WB-ledger-16 invariant 8 now states B(n) and marks it derived.
Tests: a_legacy_last_absorbs_close_drifts_by_member_count_before_its_true_up (BS-partner-1 statement 6 before the true-up, statement 5 after it; WB-ledger-16 invariant 8): four- and five-member closes at their largest legitimate drift are not flagged, one unit past it they are, and after the true-up the strict >= unit bound holds.
Co-Authored-By: Muse Wonder 1.0
audit::closes took its unit as minor_units().unwrap_or(2), while the members allocation splits at allocation_places() (minor_units().unwrap_or(MAX_LINE_SCALE)). For a currency code with no minor unit the audit therefore checked a split made at the finest a line carries against a cent: far looser than the split it checks, so real drift passed.
Add Currency::allocation_unit(), the one helper that turns allocation_places() into an amount, and take the audit's unit from it, so the split and its check cannot drift apart (BS-partner-1 statement 4: the allocation is the split to the base currency's smallest unit). A JPY close is now checked at a whole yen.
Test: a_jpy_close_is_checked_at_the_allocations_unit (BS-partner-1 statement 4, WB-ledger-16 invariant 8).
Co-Authored-By: Muse Wonder 1.0
K-U7 and K-U8 found the same thing from two sides: the integer model's
subtraction negated the subtrahend first, so x - i64::MIN was refused
where it fits. K-U7 assumed the minimum away and asserted the refusal;
K-U8 made i64 and i32 subtract natively. With both merged the
assumption goes: the harness ranges over the whole i64 domain, minimum
included, and asserts -1 - i64::MIN = i64::MAX.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Three identities the books rest on are kernel functions now, proved
rather than only summed: an aging's five buckets add to the document
total (aging_total), a control account's difference from its documents
and unattached lines (control_difference), and the K-1 reconciliation's
total (reconciliation_total). Kani proves each, None exactly on
overflow; bridge properties check them against an exact integer
reference and the replaced chains on 20,000 cases, scale included; law
46 in bookspec's Lean. The CPA package's aging now refuses a total past
exact arithmetic instead of panicking. The harnesses found the integer
model's subtraction negating first, so x - MIN was refused where it fits;
i64 and i32 now use the native subtraction.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Net pay is gross less the withholdings and deductions, now one kernel
fold (net_pay) with the plan's totals through the kernel's checked
totals; payroll_remit_plan refuses a total past exact arithmetic instead
of panicking. Proved: Kani (net pay equals gross less the deductions,
None exactly when a running difference overflows, the plan balances for
an employee), bridge properties against an exact integer reference at
every prefix, and law 45 in bookspec's Lean for any number of employees.
No figure moves; every golden unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Kani net_pay_none_iff_a_prefix_overflows proves what the doc claimed:
None exactly when some running difference leaves the i64 range, else
the exact i128 result. It found that i64's Amount::checked_sub negates
first, so a deduction of i64::MIN (no negation) is refused where the
difference would fit (-1 - i64::MIN). Conservative, and Decimal's range
is symmetric, so the engine is unaffected; the harness assumes it away
and asserts the refusal at the fixed case; the kernel doc says so.
- payroll_plan_balances: covers that the assumes did not already force
(net of one unit, payables holding employer shares alone, federal or
state posted); the harness doc says it rebuilds the plan on i64 rather
than calling payroll_entry_plan, and what that does and does not prove.
- Docs name the Lean theorems that carry any number of employees
(payroll_run_net_eq, payroll_run_plan_balances) where they had
claimed it.
- Bridge: compare to_string as well as value (Decimal equality ignores
scale); a strategy near Decimal::MAX/MIN where the reference also
returns None, which required the reference to check every running
difference as the kernel's fold does, not only the last.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The tightened harnesses assert Some whenever every i128 prefix fits in i64.
That found the default Amount::checked_sub refusing x - MIN on i32/i64 where
the difference fits; both now use the native subtraction. The bridge pins
aging_total(0,0,0,0,MAX) to Some(MAX), bounds the rounded figures to one
unit of the exact value, and covers scales 0..=28. Two smaller worksheet
harnesses (nine terms on i32, seven on i32) found no verdict in 400 s and
300 s: recorded, no harness.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Kani proves, on arbitrary i64s with an exact i128 specification, that
aging_total is the sum of its five buckets, control_difference is
balance - documents - unattached and vanishes exactly when the account
agrees with its subledger, and reconciliation_total is beginning + gain
+ without - distributed; in-range figures always total (law 45). The
book/tax worksheet statement did not finish in the solver (500 s at nine
terms, 110 s at seven), so Lean's reconciliation_identity carries it and
a bridge property checks it on i64 and Decimal; written down in
docs/proofs/k-u8.md rather than weakened.
The bridge compares i64 against Decimal and Decimal against an
independent exact i128 reference over the whole mantissa range, pins the
Decimal edges (each overflowing step is None, never a panic), and checks
the kernel against the three hand-written chains it replaced, as strings
including scale, on 20,000 random Decimals: identical. The reference
also shows rust_decimal rounds an add to a coarser scale wherever the
exact result needs more than 96 bits at the operands' scale (K-U4's
finding, wider than the MAX edge); pinned as a canary for K-U10.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Each claim's Checked line names the examples that now run it on the engine, and
the example for each option wanderbooks did not pick, which is skipped. Two
claims say what the engine does not: BS-partner-16's pick states what the books
do by convention at a close, since no command closes a period at a change of
shares, and BS-asset-9's is the books' convention, not an engine default (a
contributed asset's 704(c) method is unset until a command gives one), so no
example shows either pick apart.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The two-employee payroll_plan_balances timed out in CBMC: over 80
minutes at full CPU, killed with no result (sixteen symbolic figures
into eight totals and check_lines). The earlier note's 297.6s figure
came from a misattributed background result and is withdrawn here;
the harness as committed had never verified.
One employee reaches every plan line, both FICA shares on both sides,
net_pay and check_lines, and verifies in 62.0s (65.6s wall). Lean's
payroll_plan_balances carries the plan at its totals for any number
of employees, since a run's totals are sums of the same eight
figures. The bound and why are written in the harness and the note.
Co-Authored-By: Muse Wonder 1.0