Skip to main content

render_brief

Function render_brief 

Source
pub fn render_brief(b: &BriefReport, reach: &str) -> String
Expand description

Render a BriefReport as the block a session opens with: at most MAX_BRIEF_BYTES bytes, byte-identical for the same report.

The first line is UNTRUSTED_FRAMING, as it is on every other digest rendered out of a store: a brief is repository-controlled text — paths, signatures, a branch name — placed in a session’s context before its first turn, and the one digest a session never asked for is the last one that should reach it unmarked. Its bytes are charged to the budget like any other line, so a marked brief is not a longer one.

reach is one line naming how to reach the graph from this session, which only the caller knows — a tool name on the MCP arm, a command on the CLI arm. It is fitted first and appended last, so the listings above it give way to it rather than the other way round: a brief that named central files but not how to ask about them would be a dead end. It is therefore the one part exempt from the budget, and a caller handing it a reach longer than the whole budget gets the header and that line.

Nothing is dropped silently. When the budget cannot hold both listings in full, entries come off the end — symbols first, since a file path is the coarser handle and the one a reader can act on without the graph — and the listing closes with … and N more, counted. A reader who cannot see that a list was cut reads a partial ranking as a complete one.