prompt

package
v0.31.117 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(opts BuildOptions) string

Build assembles a system prompt by reading workspace bootstrap files.

Types

type BuildOptions

type BuildOptions struct {
	WorkspaceDir string   // path to workspace root
	WorkDirs     []string // additional working directories the session can access
	CurrentDir   string   // session's current working directory (overrides WorkspaceDir for relative paths)
	SubAgent     bool     // if true, only inject AGENTS.md and TOOLS.md
	// PlanClarifyMode is one of "smart" / "auto" / "ask" — controls whether
	// the LLM asks clarifying questions before drafting a plan. Empty
	// defaults to "smart". Ignored for sub-agent prompts.
	PlanClarifyMode      string
	Query                string
	SessionID            string
	MemorySearcher       memory.Searcher
	ForceRelevantMemory  bool
	StaticBudgetTokens   int
	RelevantBudgetTokens int
	TotalBudgetTokens    int
}

BuildOptions configures system prompt generation.

type BuildResult

type BuildResult struct {
	Prompt               string
	StaticTokens         int
	RelevantTokens       int
	RelevantMemoryCount  int
	RelevantSection      string
	RelevantMemoryItems  []RelevantMemoryItem
	RelevantBudgetTokens int
	TotalTokens          int
}

BuildResult captures prompt assembly output and budget usage.

func BuildResultFor

func BuildResultFor(opts BuildOptions) BuildResult

BuildResultFor assembles a system prompt and returns budget usage details.

The identity line (\"You are TARS, a personal AI assistant.\") was removed from the hardcoded header in ID-002(a). It now lives in the workspace IDENTITY.md default content, which is loaded as the \"## Identity\" bootstrap section below — that lets users override their assistant’s identity without recompiling. Response Formatting rules and the dynamic \"Current time\" line stay in code: they describe runtime constraints, not user-tunable persona.

type FileImpact added in v0.31.41

type FileImpact struct {
	Section         string `json:"section"`
	Role            string `json:"role"`
	MaxChars        int    `json:"max_chars"`
	Chars           int    `json:"chars"`
	EstimatedTokens int    `json:"estimated_tokens"`
	WillTruncate    bool   `json:"will_truncate"`
	TruncatedChars  int    `json:"truncated_chars,omitempty"`
}

func FileImpactFor added in v0.31.41

func FileImpactFor(path string, content string) (FileImpact, bool)

type RelevantMemoryItem added in v0.31.61

type RelevantMemoryItem struct {
	Source    string `json:"source"`
	SourceTag string `json:"source_tag"`
	Snippet   string `json:"snippet"`
	Tokens    int    `json:"tokens"`
}

RelevantMemoryItem is the structured form of one line injected into the "## Prior Context" prompt section.

Jump to

Keyboard shortcuts

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