@@ -29,16 +29,17 @@ type Prompt struct {
2929}
3030
3131type PromptDat struct {
32− Provider string
33− Model string
34− Config config.Config
35− WorkingDir string
36− IsGitRepo bool
37− Platform string
38− Date string
39− GitStatus string
40− ContextFiles []ContextFile
41− AvailSkillXML string
32+ Provider string
33+ Model string
34+ Config config.Config
35+ WorkingDir string
36+ IsGitRepo bool
37+ Platform string
38+ Date string
39+ GitStatus string
40+ ContextFiles []ContextFile
41+ GlobalContextFiles []ContextFile
42+ AvailSkillXML string
4243}
4344
4445type ContextFile struct {
@@ -147,22 +148,27 @@ func expandPath(path string, store *config.ConfigStore) string {
147148 return path
148149}
149150
150−func (p *Prompt) promptData(ctx context.Context, provider, model string, store *config.ConfigStore) (PromptDat, error) {
151− workingDir := cmp.Or(p.workingDir, store.WorkingDir())
152− platform := cmp.Or(p.platform, runtime.GOOS)
153−
151+// loadContextFiles loads and deduplicates context files from a list of paths.
152+func loadContextFiles(paths []string, store *config.ConfigStore) map[string][]ContextFile {
154153 files := map[string][]ContextFile{}
155−
156− cfg := store.Config()
157− for _, pth := range cfg.Options.ContextPaths {
154+ for _, pth := range paths {
158155 expanded := expandPath(pth, store)
159156 pathKey := strings.ToLower(expanded)
160157 if _, ok := files[pathKey]; ok {
161158 continue
162159 }
163− content := processContextPath(expanded, store)
164− files[pathKey] = content
160+ files[pathKey] = processContextPath(expanded, store)
165161 }
162+ return files
163+}
164+
165+func (p *Prompt) promptData(ctx context.Context, provider, model string, store *config.ConfigStore) (PromptDat, error) {
166+ workingDir := cmp.Or(p.workingDir, store.WorkingDir())
167+ platform := cmp.Or(p.platform, runtime.GOOS)
168+
169+ cfg := store.Config()
170+ contextFiles := loadContextFiles(cfg.Options.ContextPaths, store)
171+ globalContextFiles := loadContextFiles(cfg.Options.GlobalContextPaths, store)
166172
167173 // Discover and load skills metadata.
168174 var availSkillXML string
@@ -217,8 +223,11 @@ func (p *Prompt) promptData(ctx context.Context, provider, model string, store *
217223 }
218224 }
219225
220− for _, contextFiles := range files {
221− data.ContextFiles = append(data.ContextFiles, contextFiles...)
226+ for _, files := range contextFiles {
227+ data.ContextFiles = append(data.ContextFiles, files...)
228+ }
229+ for _, files := range globalContextFiles {
230+ data.GlobalContextFiles = append(data.GlobalContextFiles, files...)
222231 }
223232 return data, nil
224233}