Documentation
¶
Overview ¶
Package sysprompt renders system prompts from embedded templates.
Index ¶
Constants ¶
const ( // ProductName is the name of the product used in prompts and documentation. ProductName = "kodelet" // AgentsMd is the filename for agent-specific documentation. AgentsMd = "AGENTS.md" // ReadmeMd is the filename for README documentation. ReadmeMd = "README.md" // SystemTemplate is the path to the main system prompt template. SystemTemplate = "templates/system.tmpl" // CodexTemplate is the path to the Codex-specific system prompt template. CodexTemplate = "templates/codex.tmpl" )
Variables ¶
var TemplateFS embed.FS
TemplateFS contains the embedded template files for system prompts.
Functions ¶
func RenderRuntimeSections ¶
func RenderRuntimeSections(ctx *PromptContext, renderer *Renderer) []string
RenderRuntimeSections renders system-info, loaded-contexts, and MCP-server sections.
Types ¶
type PromptContext ¶
type PromptContext struct {
WorkingDirectory string
IsGitRepo bool
Platform string
OSVersion string
Date string
// Content contexts (README, AGENTS.md)
ContextFiles map[string]string
// Active context file name (resolved from configured patterns)
ActiveContextFile string
Args map[string]string
DisableFSSearchTools bool
// MCP tools information
MCPExecutionMode string
MCPWorkspaceDir string
MCPServers []string // List of available MCP server names
}
PromptContext holds all variables for template rendering
func BuildRuntimeContext ¶
func BuildRuntimeContext(llmConfig llmtypes.Config, contexts map[string]string) *PromptContext
BuildRuntimeContext creates prompt context configured for runtime section rendering.
func (*PromptContext) WithMCPConfig ¶
func (ctx *PromptContext) WithMCPConfig(executionMode, workspaceDir string) *PromptContext
WithMCPConfig adds MCP configuration to the prompt context
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer provides prompt template rendering capabilities
func NewRendererWithTemplateOverride ¶
NewRendererWithTemplateOverride creates a renderer with custom template overrides. Overrides are keyed by template path (e.g., templates/system.tmpl).
func ResolveRendererForConfig ¶
ResolveRendererForConfig resolves the sysprompt renderer from config.
func (*Renderer) RenderPrompt ¶
func (r *Renderer) RenderPrompt(name string, ctx *PromptContext) (string, error)
RenderPrompt renders a named template with the provided context
func (*Renderer) RenderSystemPrompt ¶
func (r *Renderer) RenderSystemPrompt(ctx *PromptContext) (string, error)
RenderSystemPrompt renders the system prompt
func (*Renderer) RenderTemplate ¶
func (r *Renderer) RenderTemplate(templatePath string, ctx *PromptContext) (string, error)
RenderTemplate renders an arbitrary template with the provided context.