Skip to documentation
Documentation navigation

Documentation navigation

Documentation / guides

System Instructions

Describe system instructions configured on a Loop.

developer

The base system text is configured with:

func WithSystem(system string) Option

It is stored as immutable definition state. A mode can add a mode-local Instructions string. The runtime never mutates the base prompt when selecting a mode.

Effective system

Use the exported composition rule when a consumer needs to reproduce the exact request identity:

func EffectiveSystem(system, instructions string) string

The result is instructions when the base is empty, system when mode instructions are empty, and system + "\n\n" + instructions otherwise. BoundDefinition.EffectiveSystem() applies the same rule to its selected mode. This byte-for-byte equality matters because the Rig fingerprints the effective system text for restore compatibility.

InputResult
system="", instructions=""""
system="base", instructions="""base"
system="", instructions="mode""mode"
system="base", instructions="mode""base\n\nmode"
definition, err := loop.Define(
	loop.WithName("assistant"),
	loop.WithInference(client, selectedModel),
	loop.WithSystem("You are a careful project assistant."),
	loop.WithModes(loop.Mode{
		Name:         "review",
		Instructions: "Explain risks before proposing edits.",
	}),
	loop.WithInitialMode("review"),
)
if err != nil {
	return err
}
bound, err := definition.Bind(ctx, bindings)
if err != nil {
	return err
}
fmt.Println(bound.EffectiveSystem())

The definition’s PolicyRevision includes system and mode instructions. A description or display name is presentation metadata; WithDescription is included in Rig topology identity because it is injected into delegate capabilities, while WithDisplayName is not an execution-policy input.

Source and proof

← back to documentation