Skip to content

feat(config): implement profile config inheritance from default#20964

Draft
frap129 wants to merge 6 commits into
NousResearch:mainfrom
frap129:feature/config-inheritance-20270
Draft

feat(config): implement profile config inheritance from default#20964
frap129 wants to merge 6 commits into
NousResearch:mainfrom
frap129:feature/config-inheritance-20270

Conversation

@frap129

@frap129 frap129 commented May 7, 2026

Copy link
Copy Markdown

What does this PR do?

Allow profile configs to automatically inherit from ~/.hermes/config.yaml (default profile), eliminating the need to duplicate shared configuration across N profiles. Profiles now contain only overrides.

Backward compatible: existing profiles with full configs are unaffected (no inheritance comment header = standalone behavior preserved).

Related Issue

Fixes #20270

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • hermes_constants: add get_default_config_path() helper
  • config.py: add _should_inherit() detection (comment header / inherit:false flag)
  • config.py: add _is_override() and _compute_overrides_only() helpers
  • config.py: extend load_config() with inherit_from param and _AUTO_INHERIT sentinel
  • config.py: update save_config() to write only overrides for inherited profiles
  • config.py: enhance show_config() with Profile section and (override)/(inherited) tags
  • config.py: add _tag() helper with subkey-level accuracy for nested values
  • main.py: add --inherits/--no-inherit boolean toggle to profile create
  • profiles.py: add INHERITANCE_SKELETON_YAML and FULL_CONFIG_SKELETON_YAML templates
  • profiles.py: update create_profile() to accept inherits parameter
  • tests: add 7 config inheritance tests + 4 profile inheritance tests

How to Test

  1. Create a new profile using the flag --inherit
  2. Verify an template config.yaml was made w/ no content
  3. Switch to new profile
  4. Check model (or any easily viewable config option) and verify it matches the default profile, even though none was set in config.yaml

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Arch Linux

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

For New Skills

  • This skill is broadly useful to most users (if bundled) — see Contributing Guide
  • SKILL.md follows the standard format (frontmatter, trigger conditions, steps, pitfalls)
  • No external dependencies that aren't already available (prefer stdlib, curl, existing Hermes tools)
  • I've tested the skill end-to-end: hermes --toolsets skills -q "Use the X skill to do Y"

Screenshots / Logs

…Research#20270)

Allow profile configs to automatically inherit from ~/.hermes/config.yaml
(default profile), eliminating the need to duplicate shared configuration
across N profiles. Profiles now contain only overrides.

Changes:
- hermes_constants: add get_default_config_path() helper
- config.py: add _should_inherit() detection (comment header / inherit:false flag)
- config.py: add _is_override() and _compute_overrides_only() helpers
- config.py: extend load_config() with inherit_from param and _AUTO_INHERIT sentinel
- config.py: update save_config() to write only overrides for inherited profiles
- config.py: enhance show_config() with Profile section and (override)/(inherited) tags
- config.py: add _tag() helper with subkey-level accuracy for nested values
- main.py: add --inherits/--no-inherit boolean toggle to profile create
- profiles.py: add INHERITANCE_SKELETON_YAML and FULL_CONFIG_SKELETON_YAML templates
- profiles.py: update create_profile() to accept inherits parameter
- tests: add 7 config inheritance tests + 4 profile inheritance tests

Backward compatible: existing profiles with full configs are unaffected
(no inheritance comment header = standalone behavior preserved).
@frap129 frap129 changed the title feat(config): implement profile config inheritance from default (#20270) feat(config): implement profile config inheritance from default May 7, 2026
@alt-glitch alt-glitch added type/feature New feature or request P2 Medium — degraded but workaround exists area/config Config system, migrations, profiles comp/cli CLI entry point, hermes_cli/, setup wizard labels May 7, 2026
frap129 added 5 commits May 10, 2026 12:05
…detection

Replace the '# This profile inherits' string scan in _should_inherit()
with an explicit inherit: true YAML key check. The comment heuristic
was fragile and not a proper configuration mechanism. Backward
compatible — existing profiles without the inherit flag remain
standalone.
Replace the comment-only inheritance skeleton with an explicit
inherit: true YAML key. Update standalone template to include
inherit: false. Remove the misleading 'hermes config set --profile
--no-inherit' instruction which doesn't exist as a command.
Rename test_should_inherit_with_comment_header to
test_should_inherit_with_explicit_true and update the test fixture
to use inherit: true instead of a comment header.
Document the config inheritance feature:
- New 'Config inheritance' section covering how inheritance works
  (inherit: true/false YAML key), creation flags, saving/viewing
  overrides, opt-out flow, and use cases
Add inherited profile config as a new resolution layer between CLI
arguments and the default config.yaml. Add a tip box linking to
the new Config Inheritance section in profiles.md.
@GoatG33k

Copy link
Copy Markdown

Thanks for doing this!

Seconding this PR, as the lack of inheritance right now leads to extremely confusing behavior between restarts when trying to configure Docker containers – especially when trying to maintain env vars to propagate from ~/.hermes/.env for multiple profiles.

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

Labels

area/config Config system, migrations, profiles comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Profile config inheritance from default

3 participants