Skip to main content

Module system_prompt

Module system_prompt 

Source
Expand description

Unified system-prompt assembly.

Every agent-loop entry point (CLI run / loop, HTTP API, TUI) calls assemble_system_prompt to build the final system prompt from a channel-prepared base. This is the single maintenance point for the “common” prompt structure; channels only differ in how they source the base (e.g. CLI --append-system-prompt, HTTP append_system_prompt request field) and fold that into base before calling.

Layer order (stable → volatile, to maximise prefix-cache hits):

  1. # Project context — AGENTS.md + CLAUDE.md at workspace root
  2. base — default_system_prompt() + 6 memory layers (already assembled in Config::from_env) + any channel append_system_prompt
  3. # Available skills — skill_index()
  4. ## Sub-agents enabled + sub-agent usage note — only when sub_agent_enabled (the Agent tool is registered in parallel by multi::register_subagent_if_enabled)

Structs§

AssembledPrompt
Owned, structured view of an assembled system prompt.
PromptSegments
Per-bucket substrings of an AssembledPrompt. Each field is the exact text that contributes to that breakdown bucket; join order matches AssembledPrompt::full.

Functions§

assemble_system_prompt
Assemble the final system prompt for an agent run.