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 ¶
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 ¶
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 ¶
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.