prompt

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package prompt assembles the system prompt the loop sends.

Until this existed, core.Tool.PromptGuidelines was a field nothing read and the loop sent the system prompt verbatim — so a tool could declare guidance the model never saw. A golden of the assembled prompt built through the real tool resolver needs a real assembler to build it. Build is that assembler.

Index

Constants

View Source
const BaseInstructions = `` /* 275-byte string literal not displayed */

BaseInstructions is the built-in opening section.

Deliberately short. Everything specific to what the agent can actually do comes from the resolved tool set, which is the part that changes; a long fixed preamble is tokens paid on every request to say things the tool descriptions already say.

Variables

View Source
var UniversalGuidelines = []string{
	"Do not guess at file contents or APIs; read them.",
	"Report what you actually did, including what failed.",
}

UniversalGuidelines are appended after the per-tool ones.

Last because they are the weakest: a per-tool guideline is specific advice about a tool the model is looking at, and burying it under general exhortations is how it stops being read.

Functions

func Build

func Build(system string, active []core.Tool) string

Build assembles the prompt from the base prompt and the tools that are active — after the policy resolved them, never the registry: the guidelines the model sees must describe the tools it has.

A non-empty system prompt replaces the built-in base and the built-in UNIVERSAL guidelines, and nothing else. The tools' guidelines are not built-in text: they travel with the tool and describe how to use what the model has been given, so they follow a custom prompt as they follow the built-in one — otherwise every embedder with its own prompt has to re-render them by hand.

Types

type Section

type Section string

Section names a block of the assembled prompt. The order of this declaration is the order they appear, and the golden pins it.

const (
	SectionBase       Section = "base"
	SectionTools      Section = "tools"
	SectionGuidelines Section = "guidelines"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL