Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildSystemPrompt ¶
func BuildSystemPrompt(opts SystemPromptOptions) string
BuildSystemPrompt constructs the system prompt from components.
func LoadAgentsMD ¶
LoadAgentsMD discovers and concatenates AGENTS.md files in priority order.
Priority (lowest first, content concatenated):
- <agentHome>/AGENTS.md (global)
- Walk: root → ... → cwd/.. (ancestor directories, root first, deepest last)
- cwd/AGENTS.md (project-local, highest priority)
agentHome defaults to $MOA_CONFIG_DIR, then ~/.config/moa. Duplicate paths are deduplicated.
Types ¶
type Changed ¶ added in v0.35.0
Changed names one input whose content on disk differs from what the session holds, along with the fresh content.
type Sources ¶ added in v0.35.0
type Sources struct {
// contains filtered or unexported fields
}
Sources holds the prompt inputs that live on disk, so they can be re-read while a session is open.
These were captured by value when a session was built, which made a session the only place they existed: editing AGENTS.md or adding a memory had no effect until a restart. Keeping them behind one guarded holder lets a reload update every consumer — the base prompt builder, new subagents — from a single place, instead of each one owning a copy that drifts.
func NewSources ¶ added in v0.35.0
func NewSources(cwd string, memStore *memory.Store, agentsMD, skillsIndex, memoryIndex string) *Sources
NewSources captures what a session was built with. cwd and memStore are kept so Reload can re-read the same places the build read.
func (*Sources) Reload ¶ added in v0.35.0
Reload re-reads the three inputs and returns the ones that differ, having stored the fresh values.
Nothing changed is the common case — a reload run "just in case" — and it must stay free: callers use an empty result to leave the conversation, and its cached prompt prefix, completely untouched.
The returned revert function restores the previous values. A caller that records the new state and then fails to apply it would report success while leaving the session on the old prompt, and the next reload would see no difference and do nothing — the change lost for good.
type SystemPromptOptions ¶
type SystemPromptOptions struct {
AgentsMD string // AGENTS.md content (concatenated from all levels)
Tools []core.ToolSpec // registered tools
CWD string // working directory shown to the agent
HasVerify bool // .moa/verify.json was loaded
MemoryIndex string // pre-formatted memory index (one line per fact)
SkillsIndex string // pre-formatted skills index
// Now, if non-zero, is the clock used for the date line. Zero means time.Now.
// Callers that rebuild the prompt (MCP tool-set changes) should pin this so
// a later rebuild does not restamp the date and miss the GPT-5.6 cache.
Now time.Time
// Git, if non-nil, is the git section as-is (empty means omit it). Nil
// means look up git.Context(CWD) live.
Git *string
}
SystemPromptOptions configures system prompt generation.