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) SetRecursiveFileSuggest(enabled bool) error {
26 cfg, err := LoadConfig()
27 if err != nil {
28 return err
29 }
30 cfg.RecursiveFileSuggest = &enabled
31 return SaveConfig(cfg)
32}
33
34func (configSettingsStore) SetRespectGitignore(enabled bool) error {
35 cfg, err := LoadConfig()
36 if err != nil {
37 return err
38 }
39 cfg.RespectGitignore = &enabled
40 return SaveConfig(cfg)
41}
42
43func (configSettingsStore) SetReasoning(level string) error {
44 cfg, err := LoadConfig()
45 if err != nil {
46 return err
47 }
48 cfg.Reasoning = provider.NormalizeReasoning(level)
49 return SaveConfig(cfg)
50}
51
52func (configSettingsStore) SetTheme(name string) error {
53 cfg, err := LoadConfig()
54 if err != nil {
55 return err
56 }
57 if name == "auto" {
58 name = ""
59 }
60 cfg.Theme = name
61 return SaveConfig(cfg)
62}
63
64// AutoSwarmEnabled reads the current auto-swarm flag from config.
65// Used by the swarm_spawn tool at call time to gate execution.
66func AutoSwarmEnabled() bool {
67 cfg, err := LoadConfig()
68 if err != nil {
69 return false
70 }
71 return cfg.AutoSwarmEnabled != nil && *cfg.AutoSwarmEnabled
72}
73
74// AutoSwarmSystemAddendum is appended to the system prompt when
75// auto-swarm is enabled, so the model knows it may delegate to
76// background sub-agents without the user having to mention the tool
77// by name. Kept short so it doesn't bloat the cached prompt prefix.
78const AutoSwarmSystemAddendum = `Auto-swarm is enabled. You have a swarm_spawn tool that forks background sub-agents working in parallel in this same working directory.
79
80Use 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.
81
82Do 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.
83
84When 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.`