Load global AGENTS.md into native agent system prompt#56757
Merged
Conversation
Watches a user-global AGENTS.md alongside settings.json and includes its trimmed contents in the native agent's system prompt, rendered before project-level rules so per-project guidance can override personal defaults. Missing, empty, or whitespace-only files are treated as no AGENTS.md. Read errors surface through the same notification UI as settings errors.
Collapses the previous struct (Option<content>, Option<error>) into a three-variant enum so that loaded/empty/error states are mutually exclusive, and removes the redundant UserAgentsMdStatus type since the enum now serves both as in-memory state and as the value passed to the on-change callback.
Matches the SettingsStore pattern: one wrapper struct (UserAgentsMd) holds the data plus a _watcher: Task<()> field, and the enum (now UserAgentsMdState) describes only the data variants. The watcher's lifetime is tied to the data it produces, so replacing the global cancels the watcher.
cole-miller
approved these changes
May 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Watches a user-global
AGENTS.mdfile alongsidesettings.json(at~/.config/zed/AGENTS.mdon macOS/Linux,%APPDATA%\Zed\AGENTS.mdon Windows) and includes its trimmed contents in the native agent's system prompt.This matches the pattern used by Codex (
CODEX_HOME/AGENTS.md, defaulting to~/.codex/AGENTS.md) and OpenCode (~/.config/opencode/AGENTS.md): personal instructions live next to other app config and apply across every project the user opens.Behavior
AGENTS.md(project rules continue to come from the remote workspace).AGENTS.md.AGENTS.mdfiles are loaded today.System prompt rendering
In the system prompt, the user-global
AGENTS.mdappears as### Personal AGENTS.mdimmediately before### Project Rules, so the model sees personal defaults first and project guidance later (project rules take precedence on conflicts).Tests
user_agents_mdwatcher: initial load, empty/whitespace ignored, reacts to file edits.SystemPromptTemplate: renders personalAGENTS.mdbefore project rules; omits the section when no userAGENTS.mdis present.Closes AI-231
Release Notes:
AGENTS.mdfile alongsidesettings.json, which is included in all projects' system prompts in the Zed Agent