agent: builder model: opus max_turns: 120 budget_usd: 25 —
same_line (compiler lane, Part #557)Score: the bootstrap’s critical path (docs/bootstrap.md, section 2, Critical path: the parser): parser/mod.rs (2,280 Rust lines) is ported as a Nikaia grammar only after #557 steps 1-3; steps 1-2 are on develop (2ca9841, 9545797). Due green by Friday 10-30 evening, else section 5 Risks. S=3, C~6-10 M. Runs in the fix checkout C3, one agent at a time.
If crates/nikaia-compiler/src exists, R0 (#921) has run: read every crates/nikaia-std/src/tools below as crates/nikaia-compiler/src, and nikaia_std::tools:: as nikaia_compiler::.
Owns: crates/nikaia-std/src/tools/emit_grammar.nika, check_grammar.nika, grammar_decode.nika (only if it decodes patterns), emit_pattern.nika and emit_state.nika (only the built-in pattern arms, as step 2 touched them at emit_pattern.nika :117-121, :177; lent from the lowering lane for this brief, C3 runs one agent at a time), crates/nikaia-std/src/grammar.rs (only the new line-break record), crates/nikaia-std/src/lib.rs and std.contracts only if that type needs an entry (as step 2’s text::Span did), new tests under tests/compiler/tests/, the generated tools/lowered/*. Not yours: crates/nikaia/src/parser/mod.rs (the Rust grammar keeps its own extern rule same_line until step 5), grammar_run.rs and build_time.rs (lane 1’s: a change there is a Needs:), everything a move lane owns (docs/bootstrap.md, File ownership).
same_line: the generated parser records by position what its last WS skip held. Tests: a\n[0] and f\n(x) are not an index and not a call (ADR-307 D4); a [0] is.”same_line matches nothing and fails where the whitespace skipped just before it held a line break. The generated parser records, by position, what its last WS skip held, so the answer is a fact about the input and survives backtracking: a branch that fails has written what a branch that succeeds would have.” Part II 10.8’s table (docs/specification/20-nikaia-advance.md :650): same_line binds nothing. ADR-339 D3: no grammar declares a state or an extern rule; the lowering may write both into the generated grammar!./// as a rule, removing grammar! and Trivia) are later briefs, not this one.crates/nikaia/src/parser/mod.rs): same_line :132-141 (i.current_token_start(), then Trivia::began_a_line(at)), the grammar’s state Trivia; :875, extern rule same_line -> (); :880, the recording WS :906-907 (rule WSE = w:multispace1 @ at -> { _state.user().ran(at, w.contains('\n')) }), how an entry builds ParseInput::<Trivia> with ParseContext::<Trivia> :591-600, :658, :737. The record itself is PrTrivia::ran / began_a_line (tools/parser_leaves.nika :68-77, :164-166): a run that starts where the last one ended carries its line break; began_a_line(at) is end == at && newline. The winnow-grammar source (state, extern rule, _state.user(), StateOf) is under ~/.cargo/git/checkouts/winnow-grammar-*/64adce9*/.emit_grammar.nika emit_grammar_over :196 and emit_grammar_body :207 (step 2’s template rules __nikaia_span / __nikaia_here :250-266 are the pattern: a built-in the grammar does not declare itself becomes a template rule, found by emit_writes_a_built_in :50). Today the generated grammar! writes no WS where the grammar declares none: winnow-grammar skips its default whitespace.same_line (and declares no rule of that name) changes; every other generated grammar stays byte for byte. In such a grammar the lowering writes (a) a state of a small record type in nikaia_std::grammar (two fields, end and newline, ran and began_a_line as PrTrivia’s; one type, not a second copy of PrTrivia’s comment logic), (b) a WS that records the run it skipped: the grammar’s own WS renamed (e.g. __nikaia_ws_body) under a WS that binds what it matched @ at and records (at, the bytes hold b'\n'), or, with no own WS, the default whitespace written out the same way, (c) a template rule __nikaia_same_line (an extern rule over a hand-written function after the block, as :132 is), and (d) the entry functions building the parse input with that state. Over Bytes and over text alike (same_line needs no text::Pos, so it is not refused over text).Trivia counts only breaks outside comments, so a /*\n*/ [0] is an index there and not here; the [ stands on a new line, which is what ADR-307 D4 asks. Write this case into the test and name the difference in Body: (step 4 compares the port on every tests/compiler program and must know it).same_line in the checker (check_grammar.nika, beside span/here at :123-126, :196): arity 0, binds nothing; a grammar’s own rule same_line wins. In the lowering as decided above. Tests, each a .nika with its .stdout: tests/compiler/tests/grammar_same_line.nika (a grammar with postfix = name (same_line "[" n "]" | same_line "(" n ")")* over text and over Bytes: a\n[0] and f\n(x) are a name followed by something else, not an index and not a call; a [0] and f (x) are; a backtracking case: an alternative that skips the line break and fails, then one that asks same_line at the same place, gives the same answer); tests/compiler/tests/grammar_same_line_own_ws.nika (a grammar with its own rule WS = (multispace1 | "//" until(line_ending) | "/*" until("*/") "*/")*: a // c\n[0] not an index, a /* c */ [0] an index, a /*\n*/ [0] not an index). Commit grammar: same_line (#557 step 3), Part: #557, together with the lowered files.nikaia test tests/compiler --both-settings (every count as before plus the new tests; emit_* changed, so both settings); it tests filtered on grammar plus the guard set of .claude/agents/builder.md; clippy clean; lower-std fixpoint after the rebase. Changelog: one line for the supervisor under Changelog: (a language change raises the version; you do not).
winnow-grammar cannot carry a state in a generated grammar over input bytes, or its entry functions cannot be handed one (then say what it offers: the decision is the architect’s); a .stdout/.stderr of an existing test changes (a grammar without same_line must lower byte for byte as before); a change in grammar_run.rs, build_time.rs or parser/mod.rs is needed.
Read docs/builder-facts.md.
docs/bootstrap.md section 3)docs/builder-facts.md first. You work in the worktree /home/user/nikaia-fix, not in /home/user/Nikaia (the driver’s builder works there; never edit, build or stage anything in it except your report file). Set up once: cd /home/user/Nikaia && git fetch origin develop && (test -d /home/user/nikaia-fix || git worktree add --detach /home/user/nikaia-fix origin/develop); then cd /home/user/nikaia-fix && git status (another agent of your checkout may have left files: not yours, report them) and git checkout --detach origin/develop if the tree is clean and behind. Build with cargo build --profile fast -p nikaia (incremental on, bootstrap.md section 3; CARGO_INCREMENTAL=0 only under 6 GB free); use only /home/user/nikaia-fix/target/fast/nikaia, never another checkout’s binary.git add <files> only; commit after each step. Push: git fetch origin develop && git rebase origin/develop, rebuild, lower-std once more, commit any lowered file that changed (lowered: regenerate after rebase), then git push origin HEAD:develop; rejected: again, at most three times, then Pushed: rejected. A conflict in tools/lowered/*.rs or tools/lowered.rs is never merged by hand: git checkout --theirs -- <file>, git rebase --continue, rebuild, lower-std, commit. A compiler change is pushed together with its regenerated files, in one commit.lower-std changed, yours and others’ (a compiler change re-lowers other files; that is correct in your tree). Do not edit docs/selfhosting-plan.md, docs/architect.md, docs/priorities.md, docs/bootstrap.md or scripts/self_hosting.py: rows for them go into Body: of your report.cargo fmt, cargo clippy --all-targets -- -D warnings, scripts/pre-push-check.sh, and the gate of .claude/agents/builder.md (#852).CHANGELOG.md, badges; no new NK code. New tests in Nikaia only; never the full suite. No foreground sleep, no polling; scripts in files.NIKAIA_CACHE_LIMIT=2G; at most three checkouts with target/ (C1, C2, C3); if df -h /home/user shows under 4 GB free, delete /home/user/nikaia-fix/target and report blocked. At the end delete /home/user/nikaia-fix/target/debug and /home/user/nikaia-fix/target/release/nikaia-scratch (keep /home/user/nikaia-fix/target/fast for the lane’s next brief) and report GB freed./home/user/Nikaia/docs/briefs/lane-bugs-557b-same-line.md.report.md)Fields of docs/architect.md, Briefs and reports: Result: done|noop|partial|blocked (the bare word alone on that line: Result: done, never a summary after it, which cuts the batch, b869a 2026-10-27; Owner: is a question for the owner or none, never a role), Files, Commit, Body (optional, one paragraph for the commit message), Fixes, Pushed, Tests, Gate (green|red), Deviation, Found, Needs, Changelog, Owner, Disk freed, and for a move Rs2nika: (the kept N of M lines of rs2nika --score, then the three costliest hand edits; none for a task that moves no Rust). none where nothing, and then the bare word: Deviation: none (a note) cuts the batch (batch.nika compares exactly); a note goes into the commit message. Found: is only for a defect outside your change (it cuts the batch); a converter draft that came out wrong is no Found:, it is one of the costliest edits under Rs2nika:, which the converter lane reads (e12-4b 2026-10-27); how you solved your own step goes into the commit message. Deviation: is only a step of the brief built otherwise than written or not built (a choice the brief left to you, such as keep what X needs and say so, is no deviation: it goes into the commit message; nor is building two steps in one commit when every step is built, e12-3a 2026-10-27, nor a step another commit on develop already built, shown by your test failing with that commit’s change reverted, b889 2026-10-27: name the commit in Body:); how you verified (e.g. a test not run against the unfixed compiler) goes under Tests:. A noop says why under Tests: (what was probed), not under Deviation:. Final answer, one line: done <sha>, report <path> (or BLOCKED: ... / PUSH REJECTED ...).
Attribution: Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com Claude-Session: https://claude.ai/code/session_01GFeMqxRbtUMiGVyDMxsvEq