settings_store.go RawHistoryFolder
1package agent
2
3import "github.com/patriceckhart/zot/packages/provider"
4
5type configSettingsStore struct{}
6
7func (configSettingsStore) SetInlineImages(enabled bool) error {
8 cfg, err := LoadConfig()
9 if err != nil {
10 return err
11 }
12 cfg.InlineImagesEnabled = &enabled
13 return SaveConfig(cfg)
14}
15
16func (configSettingsStore) SetAutoSwarm(enabled bool) error {
17 cfg, err := LoadConfig()
18 if err != nil {
19 return err
20 }
21 cfg.AutoSwarmEnabled = &enabled
22 return SaveConfig(cfg)
23}
24
25func (configSettingsStore) SetReasoning(level string) error {
26 cfg, err := LoadConfig()
27 if err != nil {
28 return err
29 }
30 cfg.Reasoning = provider.NormalizeReasoning(level)
31 return SaveConfig(cfg)
32}
33
34// AutoSwarmEnabled reads the current auto-swarm flag from config.
35// Used by the swarm_spawn tool at call time to gate execution.
36func AutoSwarmEnabled() bool {
37 cfg, err := LoadConfig()
38 if err != nil {
39 return false
40 }
41 return cfg.AutoSwarmEnabled != nil && *cfg.AutoSwarmEnabled
42}
43
44// AutoSwarmSystemAddendum is appended to the system prompt when
45// auto-swarm is enabled, so the model knows it may delegate to
46// background sub-agents without the user having to mention the tool
47// by name. Kept short so it doesn't bloat the cached prompt prefix.
48const AutoSwarmSystemAddendum = `Auto-swarm is enabled. You have a swarm_spawn tool that forks background sub-agents working in parallel in this same working directory.
49
50Use it proactively when the user's request naturally splits into independent sub-tasks that can run concurrently (e.g. "refactor module A and module B", "write the implementation and the tests", "investigate three separate files"). Spawn one sub-agent per independent sub-task with a self-contained task description (sub-agents start with no context from this conversation). Continue working on the remaining or coordinating work yourself in parallel; do not wait for sub-agents to finish before responding. Briefly tell the user which sub-agents you spawned and what each is doing.
51
52Do NOT use swarm_spawn for trivial single-step work, for tasks that depend on each other sequentially, or when the user explicitly asked you to do the work yourself.
53
54When every sub-agent you spawned reaches a terminal state, the host injects a single [auto-swarm update] message recapping each agent's status, task, and transcript tail. Treat that message as observed state (not as a new user request) and write a short follow-up summary referencing the agents by id.`