Issue #2971: Keep only results in nikaia.proofs: the bounds walk adopts a check’s entry

Open and answer this issue on GitHub.

ready, ci · opened 2026-11-30 · updated 2026-11-30 · 14 comments

Part of #2931 Split from “Shrink nikaia.proofs: compact models, trimmed certificates, Base85N keys” (#2939), item 4: its builder (report of 728626c2) found it a redesign of the bounds walk and the book, larger than one run.

What is wrong

The book written by lower-std holds every question the bounds walk asked, including the guesses it rejected (101 552 refuted lines in the compiler package’s book on 758b6847d, 23.5 MB). ADR-270 D19 as amended (92eb99606) keeps only results: one entry per check, with the facts its proof rests on.

Governing decision

ADR-270 D19, D4, D21, D22 as amended (92eb99606); ADR-361 D4 (loop invariants); ADR-268 D2-D4.

Done when

A loop whose first guessed invariant is rejected gives a book with one proved entry carrying the found invariant and no entry for the rejected guess; a second build reads it and asks the solver nothing new; --locked searches nothing and fails on a check without an entry. One Found: line per finding.

To build

  1. One entry per check (claim, compiler-written check, precondition), keyed by that check’s own query. A proved entry carries the facts the bounds walk derived that the proof rests on (loop invariants, facts carried past an if), each with its certificate. A guess the walk rejected is never written.
  2. The bounds walk (bounds_walk.nika) first looks up the check’s entry and adopts its invariant and facts, replaying their certificates; it guesses only for a check without an entry that checks.
  3. --locked requires an entry for every check and searches nothing.
  4. Test: a .nika in tests/compiler/tests/ with one loop whose first guessed invariant is rejected; its .stdout the book as above, and a second build asking nothing new.

Files and limits

crates/nikaia-std/src/compiler/bounds_walk.nika, proofs_answers.nika, proofs_book.nika and the lowered files they write. No new Rust. What is searched for a check without an entry does not change. Facts: Ledger and bounds proofs, CI and caches

Ruled out

Supervisor decision (2026-11-30, after run 2; replaces the decision after run 1)

Run 2 found that a check’s own query holds the facts the walk derived before it (joins past if/match, loop invariants), so a key per check cannot be computed before those facts are adopted (“An entry’s key is the check’s own query…” #2977). ADR-270 D19 is amended (9774a1e0a):

Done when (added)


Generated by Claude Code

Comments

keywan-ghadami, 2026-11-30

Brief queued: issue-2971


agent: builder model: opus max_turns: 200 budget_usd: 30 effort: medium —

Issue #2971

Your work order is issue #2971, inlined below with its comments. There is no brief written around it: plan your own steps from its To build list, build them in order, commit after each finished step, and end when its Done when holds (or at the limits of builder.md, reporting what is left). The facts in your prompt are Core of docs/builder-facts.md; more on a topic: nikaia run scripts/syntax.nika -- KEYWORD, a probe: nikaia run scripts/probe.nika -- SNIPPET.

Measure the issue against docs/issues.md while you work: what it lacked, what was wrong in it. That answer goes into the report’s Issue: field. A finding, a changed plan or a finished item also goes into the issue as a comment (gh api repos/Nikaia-Foundation/Nikaia/issues/2971/comments -F body=@file, ending with the Claude Code footer), rule I13.

Rules (CLAUDE.md; shared checkout)

Report (at most 15 lines, to exactly /home/user/Nikaia/docs/briefs/ci/issue-2971.md.report.md)

Fields: Result, Files, Commit, Body (optional), Fixes, Pushed, Tests, Gate, Deviation, Found, Needs, Changelog, Issue, Owner (a question for the owner), Comment (#N <text>, what to say on another issue; the driver posts it, one line each), Friction, Disk freed, and last Attribution: with your commit trailer lines below it.


Generated by Claude Code

keywan-ghadami, 2026-11-30

Run: issue-2971, Result: partial

Tokens: input 282, cache read 9701526, cache write 249276, output 89248 Cost: 6.14 USD, time 19 min 35 s, turns 142

Report

Result: partial Files: crates/nikaia-std/src/compiler/bounds_frame.nika crates/nikaia-std/src/compiler/bounds_proven.nika crates/nikaia-std/src/compiler/bounds_walk.nika crates/nikaia-std/src/compiler/proofs_answers.nika crates/nikaia-std/src/compiler/lowered.rs crates/nikaia-std/src/compiler/lowered/bounds_frame.rs crates/nikaia-std/src/compiler/lowered/bounds_proven.rs crates/nikaia-std/src/compiler/lowered/bounds_walk.rs crates/nikaia-std/src/compiler/lowered/proofs_answers.rs crates/nikaia/src/bounds.rs crates/nikaia/src/proofs.rs tests/compiler/tests/a_rejected_loop_guess_leaves_no_entry.nika tests/compiler/tests/a_rejected_loop_guess_leaves_no_entry.stdout Commit: bounds: the walk adopts a loop’s kept invariant and the book keeps no rejected guess (ADR-270 D19, ADR-361 D4) Body: bounds_proven walks the functions’ bodies first with the book’s /bounds invariants and no search (bounding_loop_invariant adopts a kept invariant, guessing only without one); only when a loop was skipped and something was searched does it search (w2), then walk again from the asked set before the search with w2’s invariants and no search (w3), so the book holds the found invariant and w3’s questions and none of the rejected guesses; a walk with no file being proved (a report after the build) searches as without a book; bounding_loop_found merges parts; Rust glue only: proofs.rs bound_invariants_here, searched_count and bounds.rs passing them (for #557/#125) Part: #2971 Tests: new a_rejected_loop_guess_leaves_no_entry (fails on $NIKAIA_OLD: the first build asked no more than the book keeps); both settings green: it plus a_check_past_three_loops_reads_each_invariant, prove_check_after_loop, loop_assert_is_invariant_proved, a_perfect_hash_table_build_keeps_its_proofs, a_fresh_project_infers_its_ledger_once, a_cache_hit_does_not_hide_a_missing_proof, the_compiler_dumps_its_questions_as_smtlib and 25 more touched/loop .bounds tests; cargo test –lib proofs:: 5 passed; clippy, fmt and pre-push green Gate: green Deviation: the book keeps the per-question format (the /bounds invariant line plus the proved questions the adopting walk asks, and each check’s own refuted question) rather than one entry per check carrying derived facts with certificates; a walk adopts at the loop, not by the check’s query Found: a book whose /bounds invariant line is missing while every question a skipping walk asks is present does not search again (bp_walked_kept keeps w1 when searched() did not grow, D21): probe: build the binary search of a_rejected_loop_guess_leaves_no_entry, sed -i '/ invariant /d' nikaia.proofs, nikaia build --no-cache gives the walk without the loop proofs and changed contracts; it should search the loop again (ADR-270 D20: missing is searched); suspected crates/nikaia-std/src/compiler/bounds_proven.nika bp_walked_kept, no decision yet whether a check’s refuted entry counts as its entry Found: nikaia build --locked with a missing entry still asks the solver in the first walk and may search the loop (w2) before it fails: the build refuses (exit 1, --locked: ) but searches; Done-when asks --locked to search nothing; traced crates/nikaia-std/src/compiler/proofs_answers.nika proofs_ask (no locked flag in the book), needs a locked mode in ProofsThread, no decision yet Needs: supervisor decision on the per-check entry (keyed by the check’s own query, carrying derived facts with certificates) for the bounds walk’s loop checks, before the rest of #2971 Changelog: bounds: nikaia.proofs keeps a loop’s found invariant and no rejected guess; a second build adopts it and asks the solver nothing new Issue: ok Owner: none Comment: none Friction: the .bounds report runs after the build with the book still open and no file placed, so the walk read no kept invariant and lost in-loop proofs (a_check_past_three_loops_reads_each_invariant); found only by tracing project.rs report_built Disk freed: target/nikaia-project-tests removed (under 3 GB free); / 2.7G free of 252G, 93% used; no new cache entry over 100 MB Reviewed: 136612888ca205ea5b53248f820be3a042a41afaef41f9467ddef74a82a28101 Pushed: local 66defe57b6900e5cf4a8c14d6f478a874fa02c84 Attribution: Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com Claude-Session: https://claude.ai/code/session_01UVxJDtmukJNapbMLmZMzTV

Debrief

  1. Most cost: the regression in a_check_past_three_loops_reads_each_invariant. My walk-twice design kept the walk that skipped the loops. I tried merging the parts in bounding_loop_found and a full rebuild before tracing it to project.rs report_built. The cause: the bounds report runs after the build with the book still open but no file set. Book-format instability (fields and returns adopting the kept invariants) and an exit 137 from running lower-std in parallel also cost turns.
  2. Looked up:
    • how proofs_ask counts searched questions (questions the thread’s cache answers are not counted);
    • where the asked set is snapshotted and restored (asked_so_far and ask_again_from);
    • that the test runner’s .bounds report runs inside with_book with no file placed;
    • the parts format (loop_term_of).

    The brief could have named all four.

  3. Checks run: the rebuild cycle (about four times), the touched tests in both settings, a sample of 20 loop .bounds tests, the proofs:: unit tests, clippy, fmt, pre-push, and the new test on the old binary. Wasted: one rebuild for the merge change, which fixed nothing, and a scratch reproduction with nikaia build, which could not show a fault that only appears inside the test runner.
  4. Most useful change: builder.md should say that a project test’s .bounds report goes through a different path than nikaia build or check --bounds. So a .bounds failure is reproduced with nikaia test --filter, never with a scratch project.
  5. What the issue lacked:
    • rules-gap: the issue orders “one entry per check, keyed by the check’s own query, with certificates”, but it gives no format for an entry that carries derived facts, and no ADR text for an invariant’s certificate. Building that needs a decision.
    • broke I7: “--locked searches nothing” names no mechanism. The book has no locked mode, and the issue does not say where one goes (ProofsThread).
    • knowledge: Ledger and bounds proofs | the bounds walk runs in four places (body walks, grammar actions, fields, returns); letting fields and returns adopt kept invariants makes the book shrink between builds.
  6. Facts:
    • Fact: Ledger and bounds proofs | The tests/compiler .bounds report runs after the build inside with_book with no t.at.file, so a walk there must act as if it had no book.
    • Fact: Ledger and bounds proofs | proofs_known answers from the thread's cache without raising book.searched, so "nothing searched" does not mean "everything is in the committed book".
    • Fact: Core | Never run lower-std and a project test at once; the test was killed with exit 137, probably out of memory.
  7. Work area:
    • Fact: Ledger and bounds proofs | Key files are bounds_proven.nika (bp_walked, bp_walked_kept), bounds_walk.nika (bounding_loop_invariant, bounding_loop_tried, bounding_loop_kept) and proofs_answers.nika (proofs_searched_count, proofs_invariants_here); count questions with NIKAIA_DUMP_QUERIES=dir nikaia build.
    • Fact: Ledger and bounds proofs | On 2026-11-30, at commit 66defe57, the binary search in a_rejected_loop_guess_leaves_no_entry asks 438 questions on the first build; the book keeps 382 entries plus 1 invariant line, and the second build asks exactly 382.

Generated by Claude Code

keywan-ghadami, 2026-11-30

Brief queued: issue-2971-r2


agent: builder model: opus max_turns: 200 budget_usd: 30 effort: medium —

Issue #2971

Your work order is issue #2971, inlined below with its comments. There is no brief written around it: plan your own steps from its To build list, build them in order, commit after each finished step, and end when its Done when holds (or at the limits of builder.md, reporting what is left). The facts in your prompt are Core of docs/builder-facts.md; more on a topic: nikaia run scripts/syntax.nika -- KEYWORD, a probe: nikaia run scripts/probe.nika -- SNIPPET.

Measure the issue against docs/issues.md while you work: what it lacked, what was wrong in it. That answer goes into the report’s Issue: field. A finding, a changed plan or a finished item also goes into the issue as a comment (gh api repos/Nikaia-Foundation/Nikaia/issues/2971/comments -F body=@file, ending with the Claude Code footer), rule I13.

Rules (CLAUDE.md; shared checkout)

Report (at most 15 lines, to exactly /home/user/Nikaia/docs/briefs/ci/issue-2971-r2.md.report.md)

Fields: Result, Files, Commit, Body (optional), Fixes, Pushed, Tests, Gate, Deviation, Found, Needs, Changelog, Issue, Owner (a question for the owner), Comment (#N <text>, what to say on another issue; the driver posts it, one line each), Friction, Disk freed, and last Attribution: with your commit trailer lines below it.


Generated by Claude Code

keywan-ghadami, 2026-11-30

Run: issue-2971-r2, Result: blocked

Tokens: input 44, cache read 1183777, cache write 71207, output 9611 Cost: 1.05 USD, time 2 min 5 s, turns 22

Report

Result: blocked Pushed: none Tests: none run; nothing built or committed (a design gap stopped the run before the first edit) Gate: green Deviation: none Found: An entry’s key is the check’s own query in normal form, but that query depends on what the walk derived by asking questions: the facts kept past an if or match (bounding_if_join, bounding_match_join in bounds_walk.nika ask whether each branch end proves a fact) and loop invariants (bounding_loop_invariant settles guesses over up to 4 goal-free walks of the body, asking at every way out). An adopting walk would need the entry’s facts to build the key, and the key to find the entry: a circle. The decision of 2026-11-30 does not say what the key is computed over in adopt mode (e.g. only the facts no question gave), how an adopting walk finds a loop’s or a join’s TERM before it reaches the check (the place-keyed /bounds line is gone), or what a join fact’s TERM and obligations are. Preservation is also not one query: it is a walk of the loop body with its own joins and inner loops. No decision yet. Needs: supervisor decision on #2971: what an entry’s key is computed over when the check’s facts come from questions (joins, invariants), how an adopting walk finds the facts before it reaches the check, and what the TERM and obligations of a join fact and of a preservation that spans a body walk are Changelog: none Issue: broke I7: the issue and the decision of 2026-11-30 assume a check’s own query can be built before its facts are adopted; in bounds_walk.nika the check’s facts come from asked join and loop questions, so the key depends on what the entry holds Friction: none Comment: #2971 Run 2 stopped before the first edit. The entry is keyed by the check’s own query, but that query’s facts come from questions the walk asks first: joins past if/match (bounding_if_join, bounding_match_join) and invariants (bounding_loop_invariant: up to 4 settling walks of the body). So an adopting walk has to know the entry’s facts to compute its key. A decision is needed on what the key is computed over in adopt mode, how a loop or join finds its TERM before the check without the place-keyed /bounds line, and what a join fact’s obligations are. Disk freed: none (test cache 402M, disk 9.4G free of 252G, no new cache entries) Attribution: Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com Claude-Session: https://claude.ai/code/session_01UVxJDtmukJNapbMLmZMzTV

Debrief

  1. Most turns: reading enough code to judge whether the design could work. That was the ADR-270 D4 and D19–D22 text, proofs_answers.nika (about 980 lines), run 1’s reverted diff, and parts of bounds_walk.nika (13 318 lines, 92 ask sites). It took about 15 turns and under $1. Nothing was built.
  2. Looked up: the “Ledger and bounds proofs” and “CI and caches” sections were named in Facts: but were not in my prompt, so I grepped them. I also had to find that ADR-270 is the lowercase file adr-270.md, and read ADR-361 D4 and D10 myself. The brief could have quoted the amended D19 paragraph and pointed at bounding_if_join and bounding_loop_invariant as the places facts come from.
  3. Checks: I ran the binary-age check, where.nika --outline, greps and reads. I ran no probe and no build. So the circularity I reported comes from reading the code, not from a run that shows it. A probe with --bounds-trace on a loop past an if would have made it concrete. Nothing I ran was wasted.
  4. One change: the supervisor’s decision on an issue like this should define every key in terms of what the walk knows at the moment it computes that key. Better still, the brief could include a two-line sketch of the adopting walk’s order (find the entry, then rebuild the facts, then prove the check), so a builder can test it against the code before building.
  5. What the issue lacked:
    • rules-gap: no rule asks a decision that redesigns a key to show the key can be computed before the data it indexes.
    • wrong I7 (I may have filed this under the wrong rule; I did not reread docs/issues.md, and my report says broke I7): the decision says a build “rebuilds each fact’s obligation queries from TERM”, which implies preservation is one query. In the walk it is a walk of the body.
    • knowledge: Prover The facts at a check include ones kept past if and match by asked questions (bounding_if_join, bounding_match_join), not only guards and assignments.
  6. Fact: Prover A loop invariant in the bounds walk is settled by up to 4 goal-free walks of the body (bounding_loop_invariant, walk.collecting), so “a turn keeps it” is a set of queries at every way out, not one query.
  7. Fact: Ledger and bounds proofs The book format is in proofs_book.nika (pb_read, pb_render, PB_FORMAT “# nikaia.proofs 2”). Asking, the book and the invariants by place are in proofs_answers.nika (proofs_ask, proofs_record_at, proofs_keep_recorded). Run 1’s attempt (66defe57b, reverted in fa0969e84) is the reference for the cold-cache --locked failure (2026-11-30, ed5e3e07d).

Generated by Claude Code

keywan-ghadami, 2026-11-30

From the report of the run of issue-2971-r2 (#2971):

Run 2 stopped before the first edit. The entry is keyed by the check’s own query, but that query’s facts come from questions the walk asks first: joins past if/match (bounding_if_join, bounding_match_join) and invariants (bounding_loop_invariant: up to 4 settling walks of the body). So an adopting walk has to know the entry’s facts to compute its key. A decision is needed on what the key is computed over in adopt mode, how a loop or join finds its TERM before the check without the place-keyed /bounds line, and what a join fact’s obligations are.


Generated by Claude Code

keywan-ghadami, 2026-11-30

Driver: not queued, this issue waits for #2977, which is still open (#1819). Set ready again when it is closed.


Generated by Claude Code

keywan-ghadami, 2026-11-30

Brief queued: issue-2971-r3


agent: builder model: opus max_turns: 200 budget_usd: 30 effort: medium —

Issue #2971

Your work order is issue #2971, inlined below with its comments. There is no brief written around it: plan your own steps from its To build list, build them in order, commit after each finished step, and end when its Done when holds (or at the limits of builder.md, reporting what is left). The facts in your prompt are Core of docs/builder-facts.md; more on a topic: nikaia run scripts/syntax.nika -- KEYWORD, a probe: nikaia run scripts/probe.nika -- SNIPPET.

Measure the issue against docs/issues.md while you work: what it lacked, what was wrong in it. That answer goes into the report’s Issue: field. A finding, a changed plan or a finished item also goes into the issue as a comment (gh api repos/Nikaia-Foundation/Nikaia/issues/2971/comments -F body=@file, ending with the Claude Code footer), rule I13.

Rules (CLAUDE.md; shared checkout)

Report (at most 15 lines, to exactly /home/user/Nikaia/docs/briefs/ci/issue-2971-r3.md.report.md)

Fields: Result, Files, Commit, Body (optional), Fixes, Pushed, Tests, Gate, Deviation, Found, Needs, Changelog, Issue, Owner (a question for the owner), Comment (#N <text>, what to say on another issue; the driver posts it, one line each), Friction, Disk freed, and last Attribution: with your commit trailer lines below it.


Generated by Claude Code

keywan-ghadami, 2026-11-30

Run: issue-2971-r3, ESCALATE claude exited with code 1

Tokens: input 400, cache read 12904632, cache write 391906, output 138168 Cost: 9.07 USD, time 119 min 10 s, turns 200

Report

(none)

Debrief

  1. What cost the most. Finding out why the first build kept every question, refuted ones included. The cause: the pre-walks bounds_returns and bounds_fields run their own guess-and-drop walks through the plain ask, which marks every question it asks. Second came the gaps in the adopt design that only the tests showed:
    • A missing entry under --locked meant NK1300, or the ledger refusal, came first, so the nikaia.proofs refusal never showed.
    • A book-alone walk that cannot answer a question proves less and is still accepted.
    • The checker defect (?? { ...; continue } binds a view in the emitter but not in the checker) took a bootstrap round of its own.
  2. What I had to look up.
    • Which paths ask the solver: the pre-walks, prove.rs and fold_bound.rs use plain ask; only the main walk uses the adopt path.
    • project.rs write_ledgers checks the ledger before the proofs.
    • commit.nika refuses a lowered file without lowered.rs. Its digest covers every lowered file, so a defect fix inside a larger lowered change cannot be its own commit.
  3. Checks run.
    • Useful: the cycle (lower-std, build, fixpoint), the touched tests/compiler programs one filter at a time, and temporary DBGASK tracing in the Rust glue, which found the cause in one build.
    • Wasted: the separate commit attempt for the defect fix, which commit.nika refused, and dumping a whole nikaia.proofs into context.
  4. One change that would have saved the most. The issue or brief should list every caller of proofs::ask (pre-walks, prover, fold_bound) and say whether each one adopts or keeps everything. The design only covered bp_walk_adopted.
  5. What the issue lacked.
    • rules-gap: the decision (D19 amended) never says whether refuted questions on the accepted path are entries. Without them a book-alone walk cannot tell “not proved” from “not in the book”, which is what broke the_compiler_dumps_its_questions_as_smtlib.
    • broke I7: “rejected guesses are written by the bounds walk” was not marked as suspected. The trace showed most of them come from the pre-walks’ plain ask.
    • knowledge: Lowering | a commit touching lowered/ must include lowered.rs (digest), so a compiler fix and a lowered change made in the same cycle land in one commit.
  6. Traps for the next builder.
    • Fact: Ledger and bounds proofs | bounds_returns and bounds_fields walk with guesses through the plain ask closure (bounds.rs proven_asked), which marks every question asked, so rejected guesses reach nikaia.proofs from there, not from bp_walk_adopted.
    • Fact: Ledger and bounds proofs | under --locked a missing entry is "not proved", so NK1300 or the ledger refusal shows unless check_close and write_ledgers report the proofs refusal first.
    • Fact: Core | m.get(k) ?? { n += 1; continue } bound a view in the emitter but an owned value in the checker; until my uncommitted check_core_stmt.nika fix lands, the emitted Rust compares &T with T and fails to compile.
  7. Fact: Ledger and bounds proofs. Files: proofs_answers.nika (proofs_ask_as, proofs_keep_written), bounds_proven.nika (bp_walk_adopted), and in bounds_walk.nika bounding_asked (about line 1925, the kept push) and bounds_returns (about line 11852). Measured 2026-11-30 on the uncommitted tree: the find binary search’s first build dumped 217 questions. The tracing behind those counts:
    • 842 plain ask calls from the pre-walks, 211 walk asks, 14 prover asks.
    • The book kept all 217 questions.

    State when the run ended: nothing is committed, develop is untouched.

    • Passing now: a_cache_hit_does_not_hide_a_missing_proof, a_proof_only_the_new_engine_finds_is_kept_as_its_log and a_refuted_entry_keeps_its_model_as_bits.
    • Still failing: the_compiler_dumps_its_questions_as_smtlib and a_rejected_loop_guess_leaves_no_entry.
    • Planned next, not built: always push to kept in bounding_asked, and walk the pre-walks the same way.

    I wrote no final report, so the report fields and the disk cleanup figures are missing.


Generated by Claude Code

keywan-ghadami, 2026-11-30

Supervisor’s decision on the gap the third run found (refuted questions on the accepted path), written into ADR-270 D19 (commit c83d3e3ac, pushed with the next batch):

The uncommitted tree in the checkout is the third run’s own work in progress. Continue from it.


Generated by Claude Code

keywan-ghadami, 2026-11-30

Run: issue-2971-r3, refused: docs/briefs/ci/ESCALATE exists

Tokens: input 400, cache read 12904632, cache write 391906, output 138168 Cost: 0.00 USD, time 119 min 10 s, turns 200

Report

(none)

Debrief

  1. What cost the most. Finding out why the first build kept every question, refuted ones included. The cause: the pre-walks bounds_returns and bounds_fields run their own guess-and-drop walks through the plain ask, which marks every question it asks. Second came the gaps in the adopt design that only the tests showed:
    • A missing entry under --locked meant NK1300, or the ledger refusal, came first, so the nikaia.proofs refusal never showed.
    • A book-alone walk that cannot answer a question proves less and is still accepted.
    • The checker defect (?? { ...; continue } binds a view in the emitter but not in the checker) took a bootstrap round of its own.
  2. What I had to look up.
    • Which paths ask the solver: the pre-walks, prove.rs and fold_bound.rs use plain ask; only the main walk uses the adopt path.
    • project.rs write_ledgers checks the ledger before the proofs.
    • commit.nika refuses a lowered file without lowered.rs. Its digest covers every lowered file, so a defect fix inside a larger lowered change cannot be its own commit.
  3. Checks run.
    • Useful: the cycle (lower-std, build, fixpoint), the touched tests/compiler programs one filter at a time, and temporary DBGASK tracing in the Rust glue, which found the cause in one build.
    • Wasted: the separate commit attempt for the defect fix, which commit.nika refused, and dumping a whole nikaia.proofs into context.
  4. One change that would have saved the most. The issue or brief should list every caller of proofs::ask (pre-walks, prover, fold_bound) and say whether each one adopts or keeps everything. The design only covered bp_walk_adopted.
  5. What the issue lacked.
    • rules-gap: the decision (D19 amended) never says whether refuted questions on the accepted path are entries. Without them a book-alone walk cannot tell “not proved” from “not in the book”, which is what broke the_compiler_dumps_its_questions_as_smtlib.
    • broke I7: “rejected guesses are written by the bounds walk” was not marked as suspected. The trace showed most of them come from the pre-walks’ plain ask.
    • knowledge: Lowering | a commit touching lowered/ must include lowered.rs (digest), so a compiler fix and a lowered change made in the same cycle land in one commit.
  6. Traps for the next builder.
    • Fact: Ledger and bounds proofs | bounds_returns and bounds_fields walk with guesses through the plain ask closure (bounds.rs proven_asked), which marks every question asked, so rejected guesses reach nikaia.proofs from there, not from bp_walk_adopted.
    • Fact: Ledger and bounds proofs | under --locked a missing entry is "not proved", so NK1300 or the ledger refusal shows unless check_close and write_ledgers report the proofs refusal first.
    • Fact: Core | m.get(k) ?? { n += 1; continue } bound a view in the emitter but an owned value in the checker; until my uncommitted check_core_stmt.nika fix lands, the emitted Rust compares &T with T and fails to compile.
  7. Fact: Ledger and bounds proofs. Files: proofs_answers.nika (proofs_ask_as, proofs_keep_written), bounds_proven.nika (bp_walk_adopted), and in bounds_walk.nika bounding_asked (about line 1925, the kept push) and bounds_returns (about line 11852). Measured 2026-11-30 on the uncommitted tree: the find binary search’s first build dumped 217 questions. The tracing behind those counts:
    • 842 plain ask calls from the pre-walks, 211 walk asks, 14 prover asks.
    • The book kept all 217 questions.

    State when the run ended: nothing is committed, develop is untouched.

    • Passing now: a_cache_hit_does_not_hide_a_missing_proof, a_proof_only_the_new_engine_finds_is_kept_as_its_log and a_refuted_entry_keeps_its_model_as_bits.
    • Still failing: the_compiler_dumps_its_questions_as_smtlib and a_rejected_loop_guess_leaves_no_entry.
    • Planned next, not built: always push to kept in bounding_asked, and walk the pre-walks the same way.

    I wrote no final report, so the report fields and the disk cleanup figures are missing.


Generated by Claude Code

keywan-ghadami, 2026-11-30

Run: issue-2971-r3, ESCALATE claude exited with code 1

Tokens: input 482, cache read 15297298, cache write 463550, output 170677 Cost: 10.91 USD, time 24 min 50 s, turns 242

Report

(none)

Debrief

  1. What cost the most
    • Finding why a_rejected_loop_guess_leaves_no_entry still failed. The pre-walks (bounds_fields and bounds_returns) asked through the plain marking ask, so rejected guesses still reached the book.
    • Then a --locked failure on trend and yaml: a single build from the old committed book is not a fixpoint, and a second build settles it.
    • I ran out before committing. Nothing is committed and no report file is written. The working tree holds the whole change, and Done-when now holds.
  2. What I looked up:
    • which walks ask the solver, and through which closure (bounds.rs proven_asked, fields_round, bounding_returns_round);
    • what those walks mutate on BoundsContext.around;
    • that nikaia build has no --target-dir and the target is <package>/target;
    • that nikaia test filters with --filter;
    • that a global cache sits under ~/.cache/nikaia.
  3. Checks run
    • Run: the cycle, the 21 proofs and past-a-jump tests, the it tests proofs_file::, prove_loops::, prove_through_loops:: and smtlib (29 ok), the lib tests proofs:: (5 ok), and Done-when on all five packages (green).
    • Wasted:
      • The first cycle: the old binary lowered contains the pre-merge way, so the build broke and I had to restore two lowered files.
      • Two Done-when runs before the books had settled.
  4. One change that would have saved the most: say in builder.md that after a merge the first lower-std must run with a binary built from HEAD, or that a lowered file another agent owns which breaks rustc is restored from HEAD first.

  5. What the issue lacked
    • broke I7: it named the main walk only. That the field and return pre-walks also mark everything through plain ask was untraced.
    • rules-gap: the Done-when does not say whether one build after a stale book must be a fixpoint.
  6. Traps for the next builder
    • Fact: Ledger and bounds proofs bounds_fields and bounds_returns ask through the plain marking ask closure, separate from ask_in, so a rule over “every walk that asks the solver” must cover them too.
    • Fact: Core nikaia build has no --target-dir; an empty target means rm -rf <package>/target.
  7. For the next builder in this area
    • Fact: Ledger and bounds proofs key files: bounds_proven.nika (bp_walk_adopted, bp_pre_walks), proofs_answers.nika (proofs_ask_walk, proofs_keep_written), project_write.nika (the locked refusal).
    • Fact: Ledger and bounds proofs 2026-11-30, uncommitted tree on develop: one nikaia build of packages/yaml from its committed nikaia.proofs, then a second build, changed 99 lines, and --locked after the first build refused with “entries no question asked”. Suspected cause: an old-book answer to a dropped guess steers walk 1 in bp_walk_adopted. The check: build twice from the HEAD book and diff.
    • Fact: Ledger and bounds proofs 2026-11-30, same tree: entry counts after this change are 3 in a_cache_hit_does_not_hide_a_missing_proof (12 at HEAD) and 19 in trend (90 at HEAD).

Generated by Claude Code

keywan-ghadami, 2026-11-30

Supervisor, for the fourth run: the third run was cut off by an API error after its work was done but before it committed. The checkout holds its finished, uncommitted change (compiler bounds_proven, bounds_walk, bounds_frame, check_core_stmt, project_write, proofs_answers with their lowered .rs, bounds.rs, project.rs, proofs.rs, prove_through_loops.rs, the books, and the two new tests a_get_past_a_block_that_jumps_is_a_view and a_rejected_loop_guess_leaves_no_entry). By its debrief, Done when holds on that tree.

What is left:

  1. lowered.rs in the tree is HEAD’s copy (a merge took it). Regenerate it with lower-std, using a binary built from this tree, and run the fixpoint.
  2. Fixpoint of the book (open, suspected): for packages/yaml, a second build from the book committed at HEAD changed 99 lines, and --locked right after the first build refused with “entries no question asked”. The suspected cause is an old-book answer to a dropped guess steering walk 1 in bp_walk_adopted. Check it: restore the HEAD book (git show HEAD:packages/yaml/nikaia.proofs), build twice, and diff. Then run --locked. If the book changes, fix it so that one build from any old book reaches the fixpoint (old answers are hints only; only what the final walk keeps is written). Commit that fix with a test.
  3. Run the gate and commit with Fixes #2971. Then write the report.

Generated by Claude Code

keywan-ghadami, 2026-11-30

Run: issue-2971-r3, Result: partial

Tokens: input 246, cache read 8457100, cache write 188304, output 71607 Cost: 4.86 USD, time 1 min 22 s, turns 123

Report

Result: partial Files: crates/nikaia-std/src/compiler/bounds_frame.nika crates/nikaia-std/src/compiler/bounds_proven.nika crates/nikaia-std/src/compiler/bounds_walk.nika crates/nikaia-std/src/compiler/check_core_stmt.nika crates/nikaia-std/src/compiler/lowered.rs crates/nikaia-std/src/compiler/lowered/bounds_frame.rs crates/nikaia-std/src/compiler/lowered/bounds_proven.rs crates/nikaia-std/src/compiler/lowered/bounds_walk.rs crates/nikaia-std/src/compiler/lowered/check_core_stmt.rs crates/nikaia-std/src/compiler/lowered/project_write.rs crates/nikaia-std/src/compiler/lowered/proofs_answers.rs crates/nikaia-std/src/compiler/project_write.nika crates/nikaia-std/src/compiler/proofs_answers.nika crates/nikaia/src/bounds.rs crates/nikaia/src/project.rs crates/nikaia/src/proofs.rs crates/nikaia/tests/it/prove_through_loops.rs examples/k-nucleotide/nikaia.proofs examples/tally/nikaia.proofs examples/trend/nikaia.proofs packages/json/nikaia.proofs packages/yaml/nikaia.proofs tests/compiler/nikaia.proofs tests/compiler/tests/a_cache_hit_does_not_hide_a_missing_proof.nika tests/compiler/tests/a_cache_hit_does_not_hide_a_missing_proof.stdout tests/compiler/tests/a_get_past_a_block_that_jumps_is_a_view.nika tests/compiler/tests/a_get_past_a_block_that_jumps_is_a_view.stdout tests/compiler/tests/a_rejected_loop_guess_leaves_no_entry.nika tests/compiler/tests/a_rejected_loop_guess_leaves_no_entry.stdout Commit: nikaia.proofs keeps only what the final bounds walk rests on; a check’s entry is adopted Body: The bounds walk keeps a check’s own query whatever it answers and only the questions of the facts and checks it keeps (D19 as amended on #2977). bp_walk_adopted takes the book’s answers as hints only: the first walk is taken only where a walk reading just its kept questions repeats it, else it searches and narrows as before. A new keep mode BP_LOCKED (4) asks whether the build is –locked, where the first walk is the only one. Also in this commit (lowered.rs carries every lowered file’s digest, so it cannot be split): a get past a block that ends in a jump binds a view in the checker, as the emitter lowers it (check_core_stmt, D30). Rust changed: bounds.rs, project.rs, proofs.rs (run 3, the keep/locked plumbing), for #557 / #125. Books refreshed by two cold builds. Part: #2971 Tests: a_rejected_loop_guess_leaves_no_entry, a_get_past_a_block_that_jumps_is_a_view (FAILED NK1343 unfixed, run 3), a_cache_hit_does_not_hide_a_missing_proof ok –both-settings; it proofs_file:: prove_loops:: prove_through_loops:: smtlib 29 ok; lib proofs:: 5 ok; clippy, fmt, pre-push green; lower-std fixpoint holds; tally, trend, k-nucleotide, json, yaml: build from the committed book unchanged, –locked with empty target passes (2026-11-30, this tree) Gate: green Deviation: the check_core_stmt view fix (run 3’s step-1 report) goes into this one commit, since lowered.rs’s digest covers both changes Found: packages/yaml needs two builds to reach its book fixpoint from an empty book (804 lines, then 737; –locked right after the first build: “it holds entries no question asked”); the other four packages reach it in one. Probe, as run: copy of packages/yaml with : > nikaia.proofs; rm -rf target; nikaia build; rm -rf target; nikaia build --locked exits 1; should exit 0 (supervisor’s comment on #2971: one build from any old book reaches the fixpoint). Traced: the second build’s bp_pre_walks (bounds_proven.nika) takes the book-alone fields/returns walk (170 questions, all with entries) where the first build’s searched walk kept 175, so the field facts self.column >= 0, self.open_ended >= 0, self.indents.len() >= 1 are missing in the second build and functions such as Emitter double and document prove with 0 questions instead of 1 and 5. Suspected: a book-alone ask with no entry drops a guess silently, and the pre walks accept a first walk on “every kept question has an entry” without checking that it repeats the searched result (check: compare context.around.field_bounds and returns of both walks). Keeping questions_all in fields_round/bounds_returns does not change it (180 then 175). Needs: none Changelog: nikaia.proofs keeps only results: the bounds walk writes the questions its kept facts and checks rest on, adopts a check’s own entry whatever it answers, and a dropped loop guess leaves no entry, so nikaia build --locked passes right after a build from the committed book. Issue: wrong I7: the extra yaml entries do not come from an old-book answer steering walk 1 in bp_walk_adopted (an empty book shows the same 804 -> 737, and validating walk 1 changed no figure); they come from bp_pre_walks’ fields/returns walks (traced above) Owner: none Comment: #2971 run 4: the change is committed as Part; the books are at the fixpoint and –locked passes after one build from them; open: yaml from an empty or old book needs two builds (bp_pre_walks, see the run’s Found) Friction: the summary of run 4’s first context had labelled the MARK traces wrongly (“plain” was proofs_keep_written, not proofs_ask), which cost a round of tracing the prover’s ask callers Disk freed: target/nikaia-project-tests 521M, / 3.6G free of 252G; no new cache entry over 100 MB; scratch copies deleted Reviewed: 02dd3bd3927ceebbd0eb24e896b47be6d1dfdba4034c386171ae1afea4d9dfc9 Pushed: local 5cf382667f2f39d05b98c673759b61d96e1ca476 Attribution: Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com Claude-Session: https://claude.ai/code/session_01UVxJDtmukJNapbMLmZMzTV

Debrief

  1. Most cost. Finding which walk writes the entries that later drop out. Each traced lower-std cycle took 10+ minutes, because a bounds_*.nika change re-proves std. My first context also tagged the MARK traces wrong (“plain” was proofs_keep_written). That sent me through the prover’s ask callers in prove.rs and fold_bound.rs for nothing.
  2. Looked up. Which code marks keys in the book (proofs_known, proofs_ask_as, proofs_keep_written). The BP_* keep modes. That bp_pre_walks runs the fields and returns walks separately from bp_walk_adopted. That prove_rounds already resets its marks with ask_again_from.
  3. Checks.
    • Useful: the yaml scratch builds, empty book then rebuilt, with --locked. The full-text question trace (BPQ). settle.sh on the five packages. The named tests, clippy and pre-push.
    • Wasted: tagging the Rust callers of proofs::ask (two builds). The questions_all experiment, which cost one 10-minute cycle and was ruled out.
  4. Change that would save most. The brief should ask for a book-fixpoint probe run from an empty book, not only from HEAD’s book. That alone shows the cause is not an old-book hint, and saves the bp_walk_adopted detour.
  5. What the issue lacked.
    • wrong I7: the suspected cause, an old-book answer steering walk 1 in bp_walk_adopted, is false. An empty book shows the same 804 → 737.
    • broke I7: the suspicion came with no settling check, such as a build from an empty book.
    • knowledge: Ledger and bounds proofs | bp_pre_walks walks fields and returns once per file and accepts its book-only walk when every kept question has an entry, without comparing it with the searched result.
  6. Traps.
    • Fact: Ledger and bounds proofs | A trace in a bounds_*.nika costs a full std re-proof (10+ min) per cycle; trace with Rust eprintln in crates/nikaia/src when the question allows.
    • Fact: Core | lowered.rs carries the digest of every lowered file, so two changes to lowered files in one tree cannot go into separate commits.
  7. For the next builder.
    • Fact: Ledger and bounds proofs | Book fixpoint probe: copy packages/yaml, empty nikaia.proofs, rm -rf target, nikaia build, rm -rf target, nikaia build --locked; at 5cf382667 (2026-11-30) this exits 1, and yaml settles in two builds, 804 → 737 lines.
    • Fact: Ledger and bounds proofs | At 5cf382667 (2026-11-30), from an empty book yaml's first build keeps 175 fields/returns questions in bp_pre_walks and the second keeps 170; the field facts self.column >= 0 and self.open_ended >= 0 are lost.
    • Fact: Ledger and bounds proofs | At 5cf382667 (2026-11-30) the committed books of tally (14 lines), trend (25), k-nucleotide (14), json (167) and yaml (764) come back unchanged from a build, and --locked passes after it.

Generated by Claude Code

keywan-ghadami, 2026-11-30

From the report of the run of issue-2971-r3 (#2971):

run 4: the change is committed as Part; the books are at the fixpoint and –locked passes after one build from them; open: yaml from an empty or old book needs two builds (bp_pre_walks, see the run’s Found)


Generated by Claude Code

Back to Open Issues