prompt

package
v0.50.1 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildSystemPromptFromDB

func BuildSystemPromptFromDB(ctx context.Context, p DBPromptParams) string

BuildSystemPromptFromDB composes the full system prompt by populating a promptData struct and executing the system template.

Layers:

  1. System prompt — the agent's base system prompt from DB
  2. Tools — always-available tool descriptions (in the template)
  3. Agent soul — per-user identity/personality from memory ProfileStore
  4. User profile — per-user facts/context from memory ProfileStore
  5. Extension prompt sections — stable prompt content owned by plugins
  6. Project context — AGENTS.md files from cwd ancestors

func DefaultAgentSoul

func DefaultAgentSoul() string

DefaultAgentSoul returns the first soul tagged "default" from the builtin registry, used as the fallback persona when an agent has no override in memory.

func DefaultSystemPrompt

func DefaultSystemPrompt() string

DefaultSystemPrompt returns the default system prompt text.

Types

type DBPromptParams

type DBPromptParams struct {
	SystemPrompt      string                    // agent's base system prompt from DB
	AgentSoul         string                    // agent's default soul from DB (fallback for all users)
	Memory            memory.Provider           // active provider for profile loading (may be nil)
	KnowledgeStore    pkgplugins.KnowledgeStore // optional; injects ## Knowledge section when set
	UserID            string                    // auth user ID for profile lookup
	AgentID           string                    // agent ID for profile lookup
	GroupID           string                    // group ID for group memory lookup (D4); mutually exclusive with UserID
	GroupMemory       string                    // pre-loaded group memory content; injected when non-empty
	StellaHome        string
	AgentRoot         string
	ProjectRoot       string // optional project root for local/project-attached runs
	UserRoot          string // per-user writable root
	Sections          []pkgplugins.SystemPromptSection
	Host              sandbox.Host
	SnapshotVersion   int64     // frozen memory version for this session; 0 means current
	SnapshotUpdatedAt time.Time // wall-clock time of the last snapshot advance; used to filter knowledge

	// CurrentSpeaker is retained for compatibility with callers/tests that still
	// populate it, but it is intentionally not rendered into the system prompt.
	// Runtime injects speaker metadata as per-turn message context so reused group
	// runners keep a stable system prefix for prompt caching.
	CurrentSpeaker    memory.CurrentSpeaker
	HasCurrentSpeaker bool
}

DBPromptParams holds the parameters for building a system prompt from DB-backed config.

Jump to

Keyboard shortcuts

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