Skip to main content

renderContextBlock

@forge/monorepo


@forge/monorepo / backend/src / renderContextBlock

Function: renderContextBlock()

renderContextBlock(sections, nonce): string

Defined in: backend/src/security/prompt-safety.ts:132

Render the context block of a system prompt.

Platform sections keep the plain ## title form — they are the operator's own text and wrapping them would add noise and, worse, teach the model that the envelope is decoration.

Untrusted sections are grouped after the trusted ones, under one preamble. Order matters: the instruction that governs a block has to precede it, and interleaving would put trusted text after an untrusted block where a reader — human or model — cannot tell which side of the boundary it is on.

Parameters

sections

readonly PromptSection[]

nonce

string

Returns

string