Documentation
¶
Overview ¶
Package prompts builds the default coding-agent system prompt.
It mirrors upstream core/system-prompt.js as of Pi 0.87.1: an untagged preamble, then tagged sections in upstream order (tools, rules, docs, addendum, project_context, skills, cwd). The model receives this text, so it matches upstream byte for byte apart from the product name and the documentation location (divergence D22). BuildDefaultPrompt's callers pass the same inputs upstream's agent session collects: selected tools, their prompt snippets and guidelines, context files, and skills.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildDefaultPrompt ¶
BuildDefaultPrompt renders the system prompt.
func BuildSystemPromptSections ¶
func BuildSystemPromptSections(o Options) ai.OrderedSections
BuildSystemPromptSections retains the ordered, independently replaceable prompt sections.
func DefaultToolSnippets ¶
DefaultToolSnippets are the built-in tool summaries used in the system prompt.
func DiffSystemPromptSections ¶
func DiffSystemPromptSections(previous, current ai.OrderedSections) ai.OrderedSections
DiffSystemPromptSections returns replacements in current order, followed by removals in previous order. A nil value removes a section from the transcript.
Types ¶
type Options ¶
type Options struct {
// Cwd is the working directory shown to the model.
Cwd string
// Tools are the selected tool names in the order the model sees them.
Tools []string
// ToolHints maps a tool name to its prompt snippet. Upstream lists only
// tools that have a snippet.
ToolHints map[string]string
// ToolGuidelines maps a tool name to its prompt guidelines. Guidelines of
// selected tools become rules, deduplicated in tool order.
ToolGuidelines map[string][]string
// PromptGuidelines are rules that do not belong to one tool.
PromptGuidelines []string
// Skills lists discovered skills.
Skills []Skill
// CustomPrompt is an agent definition's body. AppendMode decides its role.
CustomPrompt string
// AppendSystemPrompt is appended as an addendum after the configured preamble.
AppendSystemPrompt string
// ContextFiles are the loaded AGENTS.md and CLAUDE.md files.
ContextFiles []struct{ Path, Content string }
// PigDocsPath is the local documentation bundle synced by pigdocs. Empty
// uses the standard config-root location.
PigDocsPath string
// AppendMode is "append" (default: CustomPrompt becomes the addendum
// section) or "replace" (CustomPrompt replaces the preamble, and the tools,
// rules, and docs sections are omitted, as upstream does for a custom
// system prompt).
AppendMode string
}
Options configures BuildDefaultPrompt.