Skip to content

Interface: PrefixGroupBuilder ​

Defined in: builders/prefix-group-builder.ts:12

Fluent builder for run-immutable KV-cache prompt prefix groups (P.prefixGroup(id)).

Defines the shared toolsMode, sharedGrounding, sharedInstructions, and sharedRules pinned in Slot 1 of the 4-slot wire compilation order.

Extends ​

Methods ​

sharedGrounding() ​

ts
sharedGrounding(...sources): PrefixGroupBuilder;

Defined in: builders/prefix-group-builder.ts:36

Appends shared grounding files or inline strings pinned at the top of the wire system prompt in declaration order.

Sources are resolved once at run start and frozen for the lifetime of the run.

Parameters ​

ParameterTypeDescription
...sourcesreadonly MaybeSource<string>[]Grounding sources or strings.

Returns ​

PrefixGroupBuilder

New immutable prefix group builder.


sharedInstructions() ​

ts
sharedInstructions(...sources): PrefixGroupBuilder;

Defined in: builders/prefix-group-builder.ts:47

Appends shared instruction sources or inline strings pinned in the wire system prompt in declaration order.

Appears immediately after sharedGrounding in the compiled wire system prompt.

Parameters ​

ParameterTypeDescription
...sourcesreadonly MaybeSource<string>[]Instruction sources or strings.

Returns ​

PrefixGroupBuilder

New immutable prefix group builder.


sharedRules() ​

ts
sharedRules(rules): PrefixGroupBuilder;

Defined in: builders/prefix-group-builder.ts:58

Binds a shared RulesNode whose globalRules are pinned in the wire system prompt.

Ensures every agent sharing this prefix group sees an identical [GLOBAL_RULES] block.

Parameters ​

ParameterTypeDescription
rulesMaybeBuilder<RulesNode>Compiled RulesNode or P.rules(...) builder.

Returns ​

PrefixGroupBuilder

New immutable prefix group builder.


toAST() ​

ts
toAST(): PrefixGroupNode;

Defined in: ast/ast-builder.ts:20

Compiles the current builder configuration into a deeply frozen passive AST node.

Validates required builder invariants at compilation time and returns an immutable plain-object AST representation containing zero execution methods.

Returns ​

PrefixGroupNode

Deeply frozen passive AST node.

Inherited from ​

AstBuilder.toAST


toolsMode() ​

ts
toolsMode(mode): PrefixGroupBuilder;

Defined in: builders/prefix-group-builder.ts:25

Configures whether wire tools arrays are cached per role ('role-scoped', default) or unified across all roles ('union').

Required to be 'union' when any member agent uses historyMode: 'clone-transcript' forks with differing toolsets.

Parameters ​

ParameterTypeDescription
mode"union" | "role-scoped"Wire tool schema caching mode.

Returns ​

PrefixGroupBuilder

New immutable prefix group builder.

Properties ​

PropertyModifierTypeDescriptionDefined in
idreadonlystringUnique identifier of the prefix group.builders/prefix-group-builder.ts:14

Released under the MIT License.