Module system_prompt
Expand description
System prompt construction for the agent loop and channel subsystem.
These functions were originally in channels/mod.rs but live here to
break a circular dependency between the channels and agent modules.
Structs§
- Bootstrap
Truncation - Result of applying the per-file bootstrap cap to one workspace file.
Counts at the per-file stage; the whole-prompt budget
(
finalize_system_prompt) may cut further.
Constants§
- BOOTSTRAP_
FILES - Workspace files injected into every system prompt, unconditionally.
- BOOTSTRAP_
MAX_ CHARS - Maximum characters per injected workspace file (matches
OpenClawdefault). - COMPACT_
BOOTSTRAP_ MAX_ CHARS - Per-file cap applied to every injected workspace bootstrap file while the
agent’s runtime profile has
compact_contexton (the default).BOOTSTRAP_MAX_CHARSis the cap when it is off. Shared by the turn paths anddoctorso they report the same budget. - CONDITIONAL_
BOOTSTRAP_ FILES - Bootstrap files injected only under conditions:
BOOTSTRAP.mdonly when present,MEMORY.mdonly when memory is injected.doctorscans both lists. - NATIVE_
TOOLS_ TASK_ FRAMING - NO_
TOOLS_ TASK_ FRAMING
Functions§
- build_
skills_ prompt_ with_ effective_ tools - Render only the skills section against an assembled effective tool surface.
Context-free callers should continue using
crate::skills::skills_to_prompt_with_mode. - build_
system_ prompt - Build the default system prompt.
- build_
system_ prompt_ with_ mode - build_
system_ prompt_ with_ mode_ and_ autonomy - build_
system_ prompt_ with_ mode_ and_ effective_ tools - Build the system prompt with the effective callable tool names supplied by the turn’s assembled registry. The tool descriptions remain separately filtered for the prompt surface, while skill callable metadata uses this name set as its availability source of truth.
- build_
system_ prompt_ with_ tool_ calls - Like
build_system_promptbut acceptsshow_tool_callsto control whether the system prompt instructs the model to hide tool narration. - finalize_
system_ prompt - Apply the final model-visible prompt budget in Unicode scalar values.
- truncate_
bootstrap_ content - Trim and cap
contentexactly as prompt injection does. Returns the text that would be injected and, when the cap applied, the counts.