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 PreviewMode ¶ added in v0.31.131
type PreviewMode string
PreviewMode distinguishes how the prior-context preview was constructed.
- PreviewModeDefault: ranked recall against opts.Query (same logic as the live LLM prompt path)
- PreviewModeRecent: opts.Query was empty, so the preview shows recent experiences/memory entries as a discoverability fallback
const ( PreviewModeDefault PreviewMode = "default" PreviewModeRecent PreviewMode = "recent" )
type PriorContextPreview ¶ added in v0.31.131
type PriorContextPreview struct {
Mode PreviewMode `json:"mode"`
Section string `json:"section"`
Items []RelevantMemoryItem `json:"items"`
BelowThreshold []RelevantMemoryItem `json:"below_threshold_items"`
RecentFallback []RelevantMemoryItem `json:"recent_fallback_items"`
RelevantTokens int `json:"relevant_tokens"`
RelevantBudgetTokens int `json:"relevant_budget_tokens"`
}
PriorContextPreview is the structured payload backing the console's "Prior" panel. Unlike BuildResult, it never feeds the LLM prompt — the extra fields (BelowThreshold, RecentFallback) exist to help users understand *why* the live recall produced no results.
func BuildPriorContextPreview ¶ added in v0.31.131
func BuildPriorContextPreview(opts BuildOptions, budgetTokens int) PriorContextPreview
BuildPriorContextPreview produces the preview for the console panel. When opts.Query is empty it falls back to the most recent experiences / MEMORY.md entries so the panel has something to display; the live LLM prompt path explicitly does not do this fallback.
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.