agent: builder model: opus max_turns: 150 budget_usd: 40 —

Brief: a comptime binding reads a reflected field and calls a function over it; T? crosses (#1087, #1019 step 3c’s base)

Facts: Traps already met

Score: #1019 step 3c (name: per field while building, NK1311, NK1312) rests on this: a name: function’s wire names must be known while building. S=A, O=~2.5M tokens, C=~2M tokens; checker and build-time runner (check_core_comptime.nika, comptime_tree.nika, dump.nika, build_values.nika). Runs after j4 (members[S]), on files j4 does not touch.

Problem (probe both with target/fast/nikaia run at your start, in your scratchpad)

struct Contact {
	name: String,
	age: i64 = 7,
}

fn shout(s: String) -> String {
	return f"{s}!"
}

fn wire(f: meta::Field) -> String {
	return f"{f.name}"
}

fn show[T: Struct]() {
	for f in T::fields {
		comptime a = f.name
		comptime b = shout(f.name)
		comptime c = wire(f)
		println(f"{a} {b} {c}")
	}
}

fn main() {
	show[Contact]()
}

Today (architect’s probe, 2026-10-31): NK1127 on all three: a “A comptime has to be computed while the program is built” (check_core_comptime.nika:363), b and c “This compiler couldn’t build the program that computes it, which is this compiler’s fault” (COMPTIME_NOT_LOWERED, comptime_tree.nika comptime_computed, ComptimeRan::DidNotBuild). Wanted: name name! name then age age! age.

fn pick(b: bool) -> String? {
	if b { return "x" }
	return null
}

comptime P: String? = pick(true)

fn main() {
	println(P ?? "-")
}

Today: NK1127 “Its type String? can’t be handed back from the program that computes it” (dump.nika NO_FORM, comptime_tree.nika:769). Wanted: x.

Decision (no owner decision needed)

Locations

To build

  1. In an unrolled turn over T::fields, a comptime binding reads the turn’s field: f.name, f.attribute(X)?.value (an attribute with a field; a fieldless attribute is #1086, not yours), and shout(f.name). Test tests/compiler/tests/a_comptime_reads_the_reflected_field.nika + .stdout.
  2. comptime c = wire(f), a function over meta::Field, is computed while building. Test tests/compiler/tests/a_comptime_calls_a_function_over_a_field.nika + .stdout (the first probe above, plus a field with @Name("full_name") as in a_function_takes_a_reflected_field.nika).
  3. T? crosses: tests/compiler/tests/a_comptime_option_crosses.nika + .stdout (the second probe with pick(true) and pick(false), and in a turn comptime w: String? = wire_name(f) where wire_name returns null for one field by its name and the attribute’s value or f.name otherwise, printed with w ?? "-"). An existing test whose .stderr pinned String? as uncrossable is updated (name it in Body:). One commit per step or one for all; the last says Fixes #1087, Part: #1019.

Done when

The new tests pass through nikaia test (one program alone: docs/builder-facts.md, Traps already met), each failed once on the compiler without your change (say so under Tests:); a_function_takes_a_reflected_field, reflected_field_ty, every comptime_* test and the grammar_* tests still pass; lower-std fixpoint clean; the cheap checks of Rules. Changelog: one line.

Stop and report if

the turn’s field cannot reach the build-time run without a change to the run’s host interface in Rust (crates/nikaia/src/; say which function and what it must carry, Needs: architect decision); an edit outside check_*.nika, comptime_*.nika, build_values.nika, dump.nika, grammar_decode.nika, emit_*.nika, crates/nikaia/src/comptime_run.rs, their lowered files and the new tests; a form beyond Part II 10.2/10.3; an error in another agent’s file. Stop about 15 turns before max_turns, commit what is finished and report partial.

Not yours, never stage: every file git status shows modified or untracked at your start, and every docs/briefs/* file except your report.

Run 2 (architect, 2026-10-31): steps 2 and 3 only

Run 1 (report j5-1019-comptime-field.md.run1.report.md, commit 417abcf) built step 1 for f.name and shout(f.name) (CheckFacts.turn_comptime_values, keyed "<start>:<type>:<field>"; the emitter reads it by walk.specialising/at_field), and stopped on two things outside its files. What changed:

Rules (CLAUDE.md; this block is pasted into every brief, also a fix-forward)

Report (at most 15 lines, to exactly /home/user/Nikaia/docs/briefs/tools/j5-1019-comptime-field.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 or red <check>: your cheap checks, never none, which cuts the batch, j4 2026-10-31), 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 (redesign) for a brief with Shape: redesign and no Convert: line). 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 process event such as another session resetting or rewriting your files is no Found:, it goes under Needs: (m3a 2026-10-28); 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:, nor a test’s expected .stdout/.stderr taken from what the program really prints where the brief’s sketch of it was short or wrong, b934 2026-10-29: say so in Body:, nor a lowering that follows the ADR governing it where the brief’s expected lowering contradicts that ADR, b933 2026-10-29: name the ADR in Body:, nor a lowering other than the brief’s where rustc cannot take the brief’s, b1029 2026-10-31: say why in Body:, nor re-keying an allow-list entry (KNOWN) whose hash changed for the same program and the same reason, b-fixforward-sweep2 2026-10-28: say so in Body:, nor an existing test’s expected .stdout/.stderr updated because your change rightly changes the message it prints, b1012b 2026-10-31: name the test 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_01UVxJDvLe1uS47UcqA9y1U2

This site is open source. Improve this page.