Skip to content

refactor(config): Centralize sub-config definitions and consolidate prompts#448

Merged
edenreich merged 1 commit intomainfrom
refactor/centralize-config-and-prompts
Apr 27, 2026
Merged

refactor(config): Centralize sub-config definitions and consolidate prompts#448
edenreich merged 1 commit intomainfrom
refactor/centralize-config-and-prompts

Conversation

@edenreich
Copy link
Copy Markdown
Contributor

@edenreich edenreich commented Apr 27, 2026

Summary

Two related cleanups that finish the sub-config restructuring started in recent refactors (45e4fb6, aa43e0e, aab481c, a762c64).

Part 1 — Sub-config struct relocation

Move struct definitions out of config/config.go and into their already-existing companion files, matching the pattern of agents.go, mcp.go, prompts.go, pricing.go:

  • ComputerUseConfig + 10 supporting structs → config/computer_use.go
  • ChannelsConfig, TelegramChannelConfig, WhatsAppChannelConfigconfig/channels.go
  • KeybindingsConfig, KeyBindingEntryconfig/keybindings.go

Pure relocation: same field names, tags, types, ordering. No semantic change.

Part 2 — Prompt field consolidation

Eliminate the duplication where every prompt lived in two places: as yaml:"-" string fields scattered across AgentConfig, SystemRemindersConfig, GitCommitMessageConfig, ConversationTitleConfig, InitConfig, and mirrored in PromptsConfig. The two sides were bridged at load time by applyPromptsOverlay.

After this PR, every prompt is read from cfg.Prompts.* (a new top-level sub-config alongside cfg.Channels, cfg.ComputerUse).

Removed:

  • AgentConfig.{SystemPrompt,SystemPromptPlan,SystemPromptRemote,CustomInstructions}
  • AgentConfig.SystemReminders and the SystemRemindersConfig type entirely (folded into PromptsAgentRemindersConfig)
  • GitCommitMessageConfig.SystemPrompt
  • ConversationTitleConfig.SystemPrompt
  • InitConfig (became empty) and its Config.Init field
  • (c *Config) GetSystemPrompt() (was unused)
  • applyPromptsOverlay in cmd/config.go; replaced with cfg.Prompts = *prompts

LoadPrompts now backfills empty fields from DefaultPromptsConfig() so callers always get a fully populated config without an external overlay step.

Env overridesINFER_PROMPTS_* names are unchanged; only their internal targets move to cfg.Prompts.*.

Breaking changes

  • Existing users with agent.system_reminders.enabled or interval in config.yaml will need to move those keys to prompts.yaml under agent.system_reminders.*. Other reminder behavior (defaults to enabled, interval 4) is unchanged.

…rompts on cfg.Prompts

Two related cleanups that finish the sub-config restructuring started in
recent refactors (45e4fb6, aa43e0e, aab481c, a762c64).

Sub-config struct relocation:

Move struct definitions out of config/config.go and into their already-existing
companion files, matching the established pattern (agents.go, mcp.go, prompts.go,
pricing.go all colocate struct + defaults + load/save):

- ComputerUseConfig + 10 supporting structs to config/computer_use.go
- ChannelsConfig, TelegramChannelConfig, WhatsAppChannelConfig to config/channels.go
- KeybindingsConfig, KeyBindingEntry to config/keybindings.go

Pure relocation: same field names, tags, types, ordering.

Prompt field consolidation:

Add cfg.Prompts as a top-level sub-config on Config (matching cfg.Channels,
cfg.ComputerUse). Delete the parallel yaml:"-" string fields that used to be
sprayed across AgentConfig, SystemRemindersConfig, GitCommitMessageConfig,
ConversationTitleConfig, and InitConfig — the duplication was bridged by an
applyPromptsOverlay function that copied each prompt from PromptsConfig into
the scattered field.

After this change, every prompt is read from cfg.Prompts.*. The system reminder
behavior settings (Enabled/Interval) move from cfg.Agent.SystemReminders into
cfg.Prompts.Agent.SystemReminders alongside ReminderText, so all reminder
config lives in prompts.yaml.

Removed:
- AgentConfig.{SystemPrompt,SystemPromptPlan,SystemPromptRemote,CustomInstructions}
- AgentConfig.SystemReminders + SystemRemindersConfig type entirely
- GitCommitMessageConfig.SystemPrompt
- ConversationTitleConfig.SystemPrompt
- InitConfig (struct now empty after removing Prompt) and its Config field
- GetSystemPrompt() method (was unused)
- applyPromptsOverlay function (cmd/config.go); replaced with cfg.Prompts = *prompts

LoadPrompts now backfills empty fields from DefaultPromptsConfig() so callers
always get a fully populated config without an external overlay step.

INFER_PROMPTS_* env override names are unchanged; only their internal targets
move to cfg.Prompts.*. Existing users with agent.system_reminders.{enabled,interval}
in config.yaml will need to move those keys to prompts.yaml under the same path.
@edenreich edenreich merged commit 9979ac7 into main Apr 27, 2026
5 checks passed
@edenreich edenreich deleted the refactor/centralize-config-and-prompts branch April 27, 2026 00:55
ig-semantic-release-bot Bot pushed a commit that referenced this pull request Apr 27, 2026
## [0.104.1](v0.104.0...v0.104.1) (2026-04-27)

### 🐛 Bug Fixes

* **ui:** Restore typing while agent is busy ([#455](#455)) ([92840d6](92840d6)), closes [#410](#410)
* **services:** Trigger auto-compact from gateway-reported tokens ([#454](#454)) ([1fc19dd](1fc19dd))
* **config:** Update model context windows and pricing for current model lineup ([#452](#452)) ([655f9f8](655f9f8))

### ♻️ Code Refactoring

* **config:** Centralize config loading and remove service indirection ([#443](#443)) ([babf173](babf173))
* **config:** Centralize sub-config definitions and consolidate prompts ([#448](#448)) ([9979ac7](9979ac7))
* Extract keybindings configuration to separate file ([#438](#438)) ([6d04195](6d04195))
* **config:** Generate viper defaults via reflection over DefaultConfig() ([#436](#436)) ([85c6e0a](85c6e0a))
* **config:** Make tool prompts configurable via prompts.yaml ([#450](#450)) ([9fc1bb5](9fc1bb5)), closes [#446](#446)
* Move channels to separate channels.yaml config ([#444](#444)) ([aa43e0e](aa43e0e)), closes [#441](#441)
* Move computer_use to a separate config ([#447](#447)) ([a762c64](a762c64)), closes [#444](#444)
* Move prompts to separate prompts.yaml config ([#442](#442)) ([45e4fb6](45e4fb6))
* **config:** Unify sub-configs behind CollectionConfig + utils.{Load,Save}YAML ([#445](#445)) ([aab481c](aab481c))

### 📚 Documentation

* Add directory-structure reference ([#451](#451)) ([95d26f8](95d26f8))

### 👷 CI/CD

* Reduce runs of nix ([acac364](acac364))

### 🧹 Maintenance

* **deps:** Bump modernc.org/sqlite from 1.49.1 to 1.50.0 ([#449](#449)) ([06a535d](06a535d))
* **nix:** Update package to v0.104.0 ([#432](#432)) ([5564697](5564697))
@ig-semantic-release-bot
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.104.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant