Skip to content

feat(prompt-builder): load AGENTS.md from profile home alongside project context (#104640) - #104761

Open
ericmaddox wants to merge 1 commit into
NousResearch:mainfrom
ericmaddox:feature/profile-home-agents-md-104640
Open

ericmaddox wants to merge 1 commit into
NousResearch:mainfrom
ericmaddox:feature/profile-home-agents-md-104640

Conversation

@ericmaddox

Copy link
Copy Markdown
Contributor

What does this PR do?

Resolves #104640.

A profile configured for a specific operational role (reviewer, implementer, domain specialist) often defines an operating contract (how reviews are decided, output formats, persona-specific constraints).

Previously, agent/prompt_builder.py only loaded AGENTS.md from the directory chain between the git root and the session's working directory (_agents_md_directory_chain), and loaded SOUL.md alone from the profile home (HERMES_HOME). As a result, an operating contract placed at <profile home>/AGENTS.md was never loaded into the prompt when working in repositories or directories outside the profile home.

Changes Made

  • agent/prompt_builder.py:
    • Added load_profile_agents_md(context_length, home_override) to look for AGENTS.override.md, AGENTS.md, and agents.md in HERMES_HOME (or home_override).
    • Updated build_context_files_prompt() to load profile AGENTS.md alongside project context and SOUL.md, deduplicating if the working directory already loaded identical instructions.
  • tests/agent/test_prompt_builder.py:
    • Added unit tests for loading AGENTS.md and AGENTS.override.md from profile home.
    • Added unit tests for loading profile AGENTS.md concurrently with project-level AGENTS.md.
    • Added unit tests for deduplication when cwd matches the profile home.

Related Issue

Fixes #104640

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)

Checklist

  • 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/ and all relevant tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Windows 11

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint area/profiles Multi-profile isolation, HERMES_HOME scoping sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Sep 7, 2026
@alt-glitch

Copy link
Copy Markdown
Contributor

This was generated by AI during triage.

Related: #66155, #23331 and #52580 are open PRs that also load AGENTS.md from HERMES_HOME, each with different precedence (fallback-only vs global vs profile-first). This PR loads the profile file alongside the cwd chain. Flagging the cluster so a maintainer can settle the precedence model once.

@ericmaddox
ericmaddox force-pushed the feature/profile-home-agents-md-104640 branch from 9a579d0 to 924cf3a Compare September 10, 2026 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/profiles Multi-profile isolation, HERMES_HOME scoping comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P3 Low — cosmetic, nice to have sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Load AGENTS.md from the profile home, not only from the working directory's chain

2 participants