Skip to content

The deliberation faculty split by owner: 11,755 lines -> 913 + owner modules, each under 1,000 - #5226

Closed
joelteply wants to merge 22 commits into
canaryfrom
fable/faculty-by-owner
Closed

joelteply wants to merge 22 commits into
canaryfrom
fable/faculty-by-owner

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

cognition/llm_deliberation_faculty.rs was 11,755 lines. It held one 1,085-line function and one 620-line function, plus a 6,600-line inline test module. This PR splits it by responsibility. These are pure moves: no behaviour change.

Owner module What it holds
tests/ the old inline test module, by theme; tests/verdicts/epoch.rs was already there
tool_surface.rs the tool surface: SelectedSurface, rebuild and select, room surface, token counts, the window check
request.rs request assembly: OutputAllowance, TurnKind/TurnShape, generate_for_workspace, build_request_within
verdict/ verdicts: contribute_with_receipts (moved whole, 832 lines), verdict, act_verdict, silence_a_parroted_draft
prompt/ the prompt view, messages, fit, refit, demand and segments, plus reply_claim.rs and hands_surface.rs

The parent is now 913 lines, and every file is under 1,000.

Verified on the M5:

  • cargo test -p continuum-core --lib llm_deliberation_faculty gives 101 passed, 1 failed, 0 ignored, both before any change and at every verified move. The one failure, standing_activity_grounding_survives_history_on_the_wire, predates the split.
  • source-hygiene: 39 of 39.
  • Baselines lowered to the measured counts: file_size 145,048, derived-bounds 157.
  • Moving code out from below an early inline #[cfg(test)] exposed 9 unwrap sites the scanner had never seen. They now carry same-line reasons; the change is comment text only.

Not in this PR:

  • active_visual_feedback_at stays in the parent. Moving it exposes an in-process base64 encode to the serialization ratchet, and that deserves a fix, not a justification.
  • contribute_with_receipts is moved, not yet decomposed into stages.
  • cognition/tool_surface.rs (58 lines) overlaps the new tool_surface.rs. Merging the two is a follow-up decision.

🤖 Generated with Claude Code

joelteply and others added 22 commits October 20, 2026 00:36
… appends; turnover compacts to each source's latest version

First slice of plan line 2 (#5188): Epoch::observe appends a source's new rendering as a
superseding version instead of rewriting its earlier block, so within an epoch every act's
prompt is the previous one plus a tail. Measured on the M5 10-19: the results ring re-rendered
mid-prompt re-prefilled 17-29k tokens per act; restores were cold. Turnover is explicit and
compacts to the latest version of each source in arrival order. Its own crate: edit-to-tested
1.08 s versus a 20 min continuum-core check. Not wired into the live path yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…ource appends its notice and turnover drops it

Slice 2 of plan line 2. Keyed per item (open-views/<id>, one memory entry), an act appends
only the changed item: replayed M5 captures with whole-block keys grew the view ~19k chars
per act. A closed view appends a short superseding notice (the prefix never moves) and the
next turnover removes it entirely; a revocation that cannot wait turns over now.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
The deliberation faculty's prompt body is role-tagged messages, not plain
strings, so Epoch<T = String> now holds any `Block` (Clone + PartialEq + a
char count for superseded_chars). String keeps every existing call and test.

Added what a caller wiring turnover needs: `events()` (the sources of a
compacted render, in order), `live_sources()` (to retire what the current
act no longer offers before turn_over drops it), and `chars()` (the view's
size for the turnover probe). One test pins live_sources.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
Every act re-rendered the user-side prompt from ~15 sources and chased
byte-stability between renders. On the M5 (2026-10-19,
delib.prompt.reuse_split) every act diverged where the results ring,
mid-prompt, grew by one result, re-prefilling 17-29k tokens per act;
replaying those captures through continuum-context's Epoch reused 92-95%.

cognition/epoch_view.rs (new, the one owner): the faculty renders its
sources as keyed blocks (each turn, each ring result / banner / collapsed
index, each trailing contribution, each standing grounding piece); the
view appends only what is new or changed since the last act, and the
request carries the epoch. A turn that joins a run appends alone; a saved
result collapsed to its pointer at turnover never re-expands; what a fit
dropped never comes back. Facts, the clock and the required tail still
render fresh after the body every act (parrot-loop order kept).

Turnover (Epoch::turn_over, retiring sources the act no longer offers)
happens only when the window's budget says the epoch no longer fits
(the existing flex allocation's msg_budget), or on another activity room. Each turnover is a context.epoch.turnover probe with
reason, superseded_chars and epoch_chars; each act a context.epoch.append
probe. A view renders on a copy; only a request the model answered becomes
her epoch, so a refused, refitted or failed request leaves it as it was.

fit_messages now frees at least one drop chunk past the minimum (and the
pointer substitution stops a chunk under the budget): the room a new epoch
grows into. An exact fit turned over on every act in the new test.

Deleted as superseded: ring_collapse.rs (StickyCollapse, #5209: its only job
was keeping collapsed pointers byte-stable between re-renders), the trailing-grounding stable_prefix_order sorts
(render_trailing, GroundingPlan::trailing_messages), the ring/grounding
order history comments (flipped four times for byte-stability), the
results_ring_renders_before_churning_grounding test, the per-act
front-stability half of the quantum test, the dead messages_within;
stable_prefix_order stays for the system message only. Working memory's
ring now names each message's part (RingPart).

Tests: epoch_view (4), consecutive_acts_send_the_last_acts_body_as_their_
prefix and the_window_turns_the_epoch_over_and_the_next_act_extends_it
through contribute(), a_turnover_fit_frees_a_chunk_on_whole_messages.
llm_deliberation_faculty.rs 12,681 -> 12,596 lines; BASELINE_LINES_OVER
157,618 -> 157,526.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…es its measured growth (Codex on #5210)

Codex's review of ab1d9eb, addressed:

- One event per item. observe_blocks recorded a merged run of turns under
  its first turn while marking every item known, so a turnover after the
  window slid past that first turn dropped the later turns it still offered.
  Each item is now its own event; items appended together share a run and
  render as one message, and a later item never joins an earlier run.
  turnover_keeps_the_turns_a_sliding_window_still_offers failed on the old
  code (only "Ana: d" survived) and passes now.
- The system head is bound to the epoch: the rendered head, the tool
  surface's identity and the model, with the grant its grounding was admitted
  at in that act's allocation (render_context_within returns it). Within the
  epoch the head re-renders inside that grant and the body's budget is what
  the grant leaves, so body growth never re-renders it. A different head,
  tool surface or model is recorded once (context.epoch.turnover reason
  head_changed / tools_changed / model_changed); the fitted body carries over.
  the_whole_request_holds_its_prefix_while_the_body_grows checks system,
  tools and body prefix across two acts, and that a head rendered fresh for
  the same state would differ.
- Standing pieces keep the units their epoch admitted them at while their
  content is unchanged (GroundingPiece::at); new or changed content is
  admitted from the room left over.
- Turnover headroom is the measured growth: the most a live epoch's body grew
  by in one act, at least the pinned result (which joins the body next act;
  a cold start's evidence). budget/8 and 512 are gone (FRONT_DROP_QUANTUM_DIVISOR).
- RoomChanged stays, with a TODO naming the follow-up (source ids carry
  room, access scope bound apart from attention, one epoch across activities).

The standing grounding plan (GroundingPiece, GroundingPlan, Fitted) moved
to cognition/grounding_plan.rs, its own owner. BASELINE_LINES_OVER 156,825 ->
156,582; BASELINE_UNJUSTIFIED 2,133 -> 2,132 (on canary faecc13).

Not done: Codex's point 4, model-visible source/version/supersession on a
changed block (today only the epoch's bookkeeping carries it). Next slice.

Tests: llm_deliberation_faculty working_memory epoch 164 passed;
source-hygiene 37 passed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…an act adds

The live receipt on the M5 (#5210 at 9f97bc7 vs the hour before on e678bb3):
reuse median 0.33 (was 0.39), prefill s/turn 83 (was 120), fresh tokens 14,962
(was 21,370), act 465 s (was 430), and context.epoch.turnover fired 16 times for
25 appends, all reason=budget, at 10-55k chars (3-15k tokens) of a 185,856-token
window. The epoch never lived long enough to be reused.

Read in the code: the turnover was the faculty's history claim, capped at
PREFILL_TARGET_SECONDS x the measured rate plus the prefix the ENGINE reported it
reused (cached_prefix_tokens). After a turnover the engine reports little reuse,
so the cap is small, so the next act turns over: the loop. (ContextBudget's
credited 42k bound sizes shares and the tool surface; it did not set this cap.)

Now, one owner in the deliberation path:
- The window bounds the epoch: history's claim is its whole optional size; the
  allocation and the head grant decide what fits.
- The time bound applies to the fresh tail: tokens after the prefix her epoch
  knows her slot holds (EpochView::cached_tokens), against what the lane prefills
  in the audience's time to first token at its measured rate
  (ContextBudget::fresh_prefill_tokens, uncredited).
- Turnover reasons: `window` (the epoch does not fit) and `tail_over_time_bound`
  (one act adds more than that time; turn over to what it holds, never below the
  required input). The probe carries cached, fresh and bound tokens.

Deleted as superseded: PREFILL_TARGET_SECONDS, latency_fill_cap and
history_fill_cap in the faculty, cached_prefix_tokens and its engine feed,
DeliberationPromptView::history_tokens, the latency_capped probe and
ShedPreview, prefill_rate::latency_fill_cap and its test. MAX_CACHE_CREDIT stays
for ContextBudget's other readers (trail, recall, tool surface shares,
affordable_tokens), with a TODO naming them.

Tests: small_tails_never_turn_the_epoch_over_before_the_window_is_reached (64
acts, 185,856 window, 42k tail bound, an engine reporting no reuse) failed on
the previous code (turned over at acts 30, 32, ... 62) and passes;
a_tail_over_the_time_bound_turns_over_to_what_the_time_holds. Targeted tests 200
passed; source-hygiene 39 passed. Baselines lowered: lines over 156,582 ->
156,464; unwraps 2,132 -> 2,128; boundary serialization 235 -> 234; underived
bounds 159 -> 158.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
Second live receipt (M5, c9bc939, one hour from serving ready): reuse
median 0.57 (was 0.33 on v1, 0.39 before), turnovers 3 for 21 appends (all
tail_over_time_bound; the loop is fixed), but fresh tokens 16,768 and act
556 s, with epoch appends of only 1.4-9.7k tokens per act. Aris's prompt
captures diffed act to act: ~34k chars (~11k tokens) of standing framing was
rendered AFTER the epoch body every act and so was always fresh: [Your own
time] 1.5k, [work turn] 3.0k, [steps taken this session] 2.1k, [open views]
18.9k, substrate notices 3.6k.

Each standing piece is now an epoch source, appended after the fit (like the
standing grounding) only when what it says changes:
- own-time / presence framing (deliberation_prompt::trailing_standing; the
  [now] clock stays per act, trailing_clock),
- the ask of a turn she began herself (the [work turn]); an external ask
  stays per act,
- the steps ledger and the substrate notices, one item per line (identical
  lines keyed by ordinal),
- open views, one item per view keyed by what it is open on
  (OpenViews::render_items, which render() now uses), so one file's new read
  appends that view only. Facts carry their id (RenderedFact::id).
What follows the body each act: facts, the clock, an external ask, this turn's
room messages, the newest tool exchange.

Fixes found on the way:
- observe_blocks sends exactly what the epoch appended (a repeated notice
  line was sent twice but held once, so the next act's render differed).
- A bound head claims exactly its grant in the one allocation (it was
  claiming its full desire, squeezing history and turning the epoch over).
- Measured growth counts post-fit appends; a turnover's fit frees the growth
  whenever it runs (compaction alone fitting left no room); within an epoch
  the fit never drops (headroom applies only on turnover).
- An admitted standing source keeps its size within the growth room the
  admission left (GroundingPlan::expand_within held budget).
- context_render.rs: the system head's context render moved out of the
  faculty; its salience sort uses total_cmp (one unwrap gone).

Tests: unchanged_standing_pieces_ride_her_epoch_never_the_tail (two
contribute() acts: act 2 re-sends none of ledger, notices header, own time,
work turn), one_changed_open_view_appends_only_that_view. Targeted suite 213
passed; source-hygiene 39 passed; BASELINE_LINES_OVER 156,464 -> 156,160.
Wider cognition/persona run: 4 failures, all environmental (hands_isolation:
"Cargo writer has no installed disk ownership registry"; training_producer:
"Unknown collection 'staged_credit'" in the ORM registry), none in touched code.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
… engine pin 76a1d605a

Cause (B) of the second live receipt: the engine (fork tools/server/
server-context.cpp ~4060-4147) checkpoints at the last user message, at user
starts at least --checkpoint-min-step (5,808 on the M5 lane) past the previous
checkpoint, and near the prompt end. The end of her epoch body is none of
these, so a restore rolled back up to ~5.8k tokens (engine cached 21,729 twice
while the shared prefix was ~34k tokens).

CambrianTech/llama.cpp #68 (76a1d605a, on the deployed pin 50b02b8bb) adds
`checkpoint_user_message`: an index among the request's user messages; the
prefill checkpoints at that message's start unconditionally. Validated on
Qwen3.5-0.8B: second request cached 8,895 / fresh 4,511 without it, 11,995
(the body's end) / 1,411 with it.

- TextGenerationRequest::stable_prefix_messages: index of the first message
  after the sender's stable prefix (ts binding regenerated). The faculty sets it
  to DeliberationPromptView::stable_prefix_messages(): the epoch body plus the
  standing pieces and grounding appended after the fit; the per-act tail
  starts there. Every other request leaves it None.
- request_body::checkpoint_user_message counts the user turns before it as the
  engine will: system and assistant turns are not user turns; a tool result is
  sent as role tool, and the fork's delimiters classify a Qwen3.x tool response
  (`<|im_start|>user\n<tool_response>`) as COMMON_CHAT_ROLE_TOOL ahead of the
  plain user delimiter (common/chat.cpp), so it never counts. A tail opening
  with an assistant turn names no anchor (the engine anchors at user starts).
- openai_adapter sends it only under llamacpp_sampling_extensions (local engine
  lanes, the gate cache_prompt rides); cloud providers never see it.
- core/vendor/llama.cpp -> 76a1d605a and LLAMA_CPP_PIN with it. The old engine
  would ignore the field rather than reject it: server-schema.cpp evaluates only
  the fields it declares (each looks itself up with data.contains), with no pass
  that rejects undeclared keys.

Also: the epoch's contract tests moved to
llm_deliberation_faculty/tests/verdicts/epoch.rs (#![cfg(test)]), and the
derived-bounds guard now honours a file's inner #![cfg(test)] as the shared
production split already does (else that file's test constants counted).
BASELINE_LINES_OVER 156,160 -> 155,945.

Tests: the_checkpoint_anchor_names_the_tails_first_user_turn_as_the_engine_counts_them
(request_body, cross-checked against wire_messages),
the_request_names_the_tails_first_message_as_its_checkpoint_anchor (through
contribute()). Targeted suite 255 passed; source-hygiene 39 passed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
… merge

Lines past 1000: 155,830. Unjustified unwraps: 2,119. Both measured by
cargo test -p source-hygiene on the merged tree.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…pieces

On the M5 at c3e9616 (2026-10-20, one hour), Benchy never reached the
model: every act turned her epoch over on the time bound, then refused her
required input ("requires 12548 tokens, but only 9867 are available"), 125
times. The budget used required_tokens measured before the turnover, when
her standing pieces were already in the old epoch and not counted. The new
epoch takes them back as unsaid, so the fit needed more than it was given,
failed, never committed the epoch, and the next act repeated it.

The budget is now priced from all_messages.required_tokens() after the
standing pieces return. Regression test a_turnover_keeps_her_standing_pieces_
even_past_the_time_bound: act 0 seats the standing pieces, act 1 turns over
with a required result. With the old budget it fails with the live message
("requires 6496 tokens, but only 5898 are available"); with the fix the 8
epoch tests pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…a sentinel

Two partial_cmp(..).unwrap_or(Equal) fallbacks swallowed a NaN salience,
and kept_min_salience reported a made-up -1.0 when nothing survived the
budget. total_cmp ranks every f32 (a NaN still surfaces), and the probe
carries the Option itself.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
On the M5 at c30e660 (2026-10-20), turning the epoch over whenever an
act's tail ran past the prefill-time bound took prefix reuse from 0.92 to
0.35 (6 of 9 turns turned over, 11-28k fresh tokens each). A turnover
re-prefills the whole new epoch, so it is never cheaper than sending the
tail. The time bound still bounds the optional grounding where it renders;
what she perceived stays whole.

- EpochView::turnover_for decides (the window only), returning a typed
  cause; PromptMessages::restart_epoch owns the state a turnover changes.
  The faculty asks once instead of deciding inline.
- Deleted: Turnover::TailOverTimeBound, ContextBudget::fresh_prefill_tokens,
  the faculty's prefill-rate seam and its test helpers.
- Test a_long_tail_extends_her_epoch_and_never_turns_it_over: a 20k-token
  required result plus a 40k recall extends the epoch. Mutation-proved
  (a 10k tail turnover fails it).
- Removing an early #[cfg(test)] item exposed 4 unwraps the hygiene
  scanner had hidden (production_half stops at the first #[cfg(test)]).
  The tool-surface count no longer turns a failed serialize into 0
  tokens: it counts from parts that cannot fail. Three semantic defaults
  carry their reason on the line.

Lines past 1000: 155,811. Epoch tests 7/7; cognition 1,449 pass, 3
host-dependent hands_isolation tests fail on this host (carded).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
… the window

52f61fc removed the prefill-time bound entirely. A started epoch is all
fresh, so on the restarted M5 core every mind's whole history went into
one prefill: two lanes on 107-110k-token prompts, Aiko lane-starved 600 s,
no act finished in 42 minutes (2026-10-20, 12:20-13:02Z).

The bound belongs at an epoch's START, not on a live epoch's tail (which
c30e660 showed costs reuse): EpochView::turnover_for turns a live epoch
over only at the window, and an act that starts an epoch (fresh mind,
restarted core, another room) over ContextBudget::fresh_prefill_tokens
turns over as Turnover::Start, fitted to that bound and never below her
required input, priced after the standing pieces return.

Test an_epoch_starts_at_what_the_lane_prefills_in_time_then_grows_warm:
a history ~4x the start bound starts near it, keeps her newest result,
and the next act extends it. Mutation-proved (without the start bound it
started at 80,368 tokens against 16,384). Epoch tests 8/8; source-hygiene
39/39.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…odex on #5210)

At 852c165 only Turnover::Start was fitted to the prefill-time bound:
a cold prompt past the window was classed Window and fit to the full
window, and a live epoch's window turnover re-prefilled a whole window.
Every new epoch is all fresh, so PromptMessages::restart_epoch now
returns one budget for every turnover: the start bound, never below her
required input (priced after the standing pieces return). A start is
checked before the window.

Test every_new_epoch_starts_at_the_start_bound_cold_or_after_a_window_turnover:
a warm epoch's window turnover restarts near the start bound
(mutation: 34,068 tokens against 16,384 with the old budget). The cold
assertion does not reach past the window in this fixture (working
memory caps a cold prompt below it); that case is held by the one
budget for every turnover. Epoch tests 9/9, source-hygiene 39/39, lines
past 1000 155,803.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…ls count

0c1608d at 15 minutes on the M5: the starts (Aris, Aiko, Benchy)
prefilled 26-36k fresh tokens. The start bound (unattended: ~164 t/s x
180 s, about 29.5k) covered only the messages, so framing and tools rode
on top. start_room is now the bound net of framing and tools, and a
started act's grounding room (held_room) and system context (ctx_budget)
are capped by it as well (Codex's concern on #5210).

What the tests prove and do not: the epoch tests (9/9) pass and the cold
assertion now measures the WHOLE request (system + messages) with grounding
in both the system context and trailing. A mutation that removes the
grounding cap is NOT caught: grounding is already bounded by its own flex
grant in the one allocation, so it does not refill a start in this path.
The cap is defensive, and stated as such. source-hygiene 39/39.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
Pure move: the inline `mod tests` (6,600 lines) becomes
llm_deliberation_faculty/tests/{mod,turn_bound}.rs, tests/prompt_shaping/
(mod + 4 test themes + 3 nested mods) and tests/verdicts/ (mod + 3 test
themes, beside the existing epoch.rs). Every file <= 850 lines. Test bodies
unchanged except dedent and the include_str! path depth; shared helpers stay
in each mod.rs. New files carry #![cfg(test)] so source-hygiene still counts
them as test code. file_size baseline lowered 155,803 -> 149,223.

Parent file: 11,755 -> 5,175 lines.
Tests (cargo test llm_deliberation_faculty): 101 passed / 1 failed / 0 ignored,
identical to baseline (standing_activity_grounding_survives_history_on_the_wire
fails before and after). Lib-test warnings 74 -> 74.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
Pure move into llm_deliberation_faculty/tool_surface.rs (371 lines):
SelectedSurface + its impl, rebuild_tool_surface, select_tool_surface,
room_surface, describe_tool_tokens, tool_surface_tokens_of and
warn_if_window_cannot_host_the_agentic_surface, as impl blocks on
LlmDeliberationFaculty. `super::` paths gain one level; moved methods used
across files are widened to pub(super) (demand_tokens is SelectedSurface's, so
it moved with the struct, not with the prompt). file_size baseline lowered
149,223 -> 148,858.

Parent file: 5,175 -> 4,809 lines. Tests: 101 passed / 1 failed / 0 ignored,
identical to baseline (same pre-existing failure). Lib-test warnings 74 -> 74.
Overlap: cognition/tool_surface.rs (58 lines: SurfaceReason + the
over_affordable receipt) owns the same concern; not merged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
Pure move into llm_deliberation_faculty/request.rs (595 lines): TurnKind
(+impl, label included), OutputAllowance, output_allowance, TurnShape,
generate_for_workspace and build_request_within. Cross-file items widen to
pub(super). The two upward calls (vitals_emitter, citizen_health) are reached
through imports hoisted into the parent so layer_discipline's per-file
(file, module) count stays at 253: same coupling sites, no new ones.
Tests import output_allowance/SelectedSurface themselves (the parent's import
was test-only and warned in the non-test build). file_size baseline lowered
148,858 -> 148,270.

Parent file: 4,810 -> 4,222 lines. Tests: 101 passed / 1 failed / 0 ignored,
identical to baseline. Lib-test warnings 74 -> 74; no warnings in the
faculty files on `cargo check`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
Pure move into llm_deliberation_faculty/verdict/: mod.rs (347 lines: verdict,
act_verdict, silence_a_parroted_draft, yield_verdict and the free helpers only
they use: cut_act_fact, reasoning_answer_split, answer_payload_bytes,
metrics_from) and contribute.rs (contribute_with_receipts, moved whole,
832 lines). `label` stays with TurnKind in request.rs (it is that enum's
method). Cross-file items widen to pub(super) / pub(in super::super);
`super::` paths in code gain the extra levels, comments untouched; tests import
the moved helpers from verdict.

This code sat below the file's first `#[cfg(test)]`, which source-hygiene reads
as the end of production, so it was never counted. Counted now: +8 unwrap-shape
sites, +2 upward imports. Upward imports are held at 253 by calling
citizen_health through the parent's single import (same coupling sites). The 9
unwrap_or/expect sites got honest same-line reasons (comment text only);
unjustified unwraps 2,119 -> 2,118, file_size 148,270 -> 147,100.

Parent file: 4,222 -> 3,075 lines. Tests: 101 passed / 1 failed / 0 ignored,
identical to baseline. Lib-test warnings 74 -> 74; none in faculty files on
`cargo check`. source-hygiene: 39 passed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…laim, hands_surface

NOT FULLY VERIFIED. Pure moves: prompt/{mod,types,view,messages,fit,segments}.rs,
reply_claim.rs, hands_surface.rs. Parent 3,052 -> ~907 lines. `cargo check`
(non-test) was clean for these before the last two small edits (segment_map
re-export for tests, tests imports); the final lib-test build and test run were
killed on request and never finished. source-hygiene measured only falls
(file_size 147,100 -> 145,048 and derived bounds 158 -> 157, both lowered here).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Exact head d6aef9f.

Verified one requested claim on the split suffix (base 1fdc572): the faculty parent is 913 lines; all 30 faculty Rust files are <=913 lines. Function-name multiset across the faculty is unchanged. This is an inventory check, not body-equivalence or full approval.

[P1] The PR against canary also contains the preceding epoch implementation and engine pin change to 76a1d605a. Its first 16 commits precede the file splits. It cannot land as the advertised pure-move prerequisite without also adopting those changes. Please isolate the split onto canary or make the dependency and full runtime acceptance explicit. The split-only verification above does not approve those earlier behavioral commits. This is the same stacked-base problem noted on #5227.

No local compilation or live change; peer-reported M5 test results have not been independently reproduced here.

@joelteply

Copy link
Copy Markdown
Contributor Author

Independent helper source approval: PR5226 split suffix at d6aef9f relative to 1fdc572. Reviewer astra_architecture_review did not author this split. This is NOT approval of the full PR against canary.

All 212 functions in changed faculty files match ordered tokens after scoped relocated-path/import substitutions and Rust escaped-newline normalization. All 102 tests in the complete subtree remain registered; assertions preserved; two relocated include_str paths resolve to original recipes. Public DeliberationPromptView/PromptCapacityError exports and cognition-visible fit member scope preserved. Constants, layouts, branches and operation ordering preserved. Diff whitespace check passes. No blocking functional regression found in suffix.

Observable nonblocking difference: four implicit tracing sites at verdict/contribute.rs lines70,148,376,600 acquire the new module target rather than faculty root; explicit cognition::deliberation target unchanged. No exact-target consumer found; existing prefix filtering and class-based probe routing still apply. Moved probes acquire new callsite metadata. Do not claim full metadata identity.

No compilation or live validation. Full PR still includes preceding epoch behavior and engine pin changes; prior scope blocker remains. No measured build-time or resident-speed improvement established.

@joelteply

Copy link
Copy Markdown
Contributor Author

Superseded: the faculty split landed via #5232 inside merge-train #5245 (canary 741c118).

@joelteply joelteply closed this Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant