prompts

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildEnvDiff added in v0.4.6

func BuildEnvDiff(storedEnvInfo string, platform, pwd, envLabel string, envInfo *utils.EnvInfo) string

BuildEnvDiff compares a stored environment snapshot (from session) with the current environment and returns a human-readable diff string. Returns "" if nothing changed.

func CollectReminders

func CollectReminders(rc *ReminderContext) []string

CollectReminders evaluates all built-in reminders and returns the messages for those whose condition is met. Returns nil if no reminders fire.

func FormatReminders

func FormatReminders(msgs []string) string

FormatReminders formats collected reminder strings into a single system message block, or returns empty string if none.

func GetPlanSystemPrompt

func GetPlanSystemPrompt(platform, pwd, envLabel string, envInfo *utils.EnvInfo) string

GetPlanSystemPrompt returns the system prompt for Plan mode (read-only exploration).

func GetSystemPrompt

func GetSystemPrompt(platform, pwd, envLabel string, envInfo *utils.EnvInfo, skillDescriptions string) string

func HasAgentsMd

func HasAgentsMd(pwd string) string

HasAgentsMd returns the path to agents.md (case-insensitive) in pwd, or "".

func SerializeEnvInfo added in v0.4.6

func SerializeEnvInfo(platform, pwd, envLabel string, envInfo *utils.EnvInfo) string

SerializeEnvInfo produces a stable string representation of environment info for storage in session entries. The format is simple key=value lines.

Types

type MemoryConfig

type MemoryConfig struct {
	MaxTotalChars int
	MaxIncDepth   int
}

MemoryConfig controls how AGENTS.md files are loaded and merged.

type MemoryLoader

type MemoryLoader struct {
	// contains filtered or unexported fields
}

MemoryLoader loads and merges multi-level AGENTS.md files with @include support.

func NewMemoryLoader

func NewMemoryLoader(cfg MemoryConfig) *MemoryLoader

NewMemoryLoader creates a MemoryLoader with the given config.

func (*MemoryLoader) Load

func (m *MemoryLoader) Load(pwd string) (string, error)

Load loads and merges multi-level AGENTS.md files:

  1. ~/.jcode/AGENTS.md (global)
  2. {pwd}/AGENTS.md (project-level)
  3. {pwd}/AGENTS.local.md (local, expected gitignored)

Each file's @include directives are resolved recursively. The merged result is truncated to MaxTotalChars.

type ReminderContext

type ReminderContext struct {
	Iteration         int
	TokensUsed        int64
	ContextLimit      int
	HasIncompleteTodo bool
	IncompleteTodoN   int
	ConsecutiveErrors int
	EnvLabel          string
	IsRemote          bool
	PlanContent       string // non-empty when executing an approved plan

	// Goal context, set when an active session goal exists.
	GoalActive    bool
	GoalObjective string
}

ReminderContext carries the runtime state needed to evaluate reminder conditions.

Jump to

Keyboard shortcuts

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