Skip to content

docs: document AGENTS.md/ZERO.md and plugin manifest format - #522

Merged
kevincodex1 merged 4 commits into
Gitlawb:mainfrom
PierrunoYT:docs/document-agents-md-and-plugins
Jul 5, 2026
Merged

docs: document AGENTS.md/ZERO.md and plugin manifest format#522
kevincodex1 merged 4 commits into
Gitlawb:mainfrom
PierrunoYT:docs/document-agents-md-and-plugins

Conversation

@PierrunoYT

@PierrunoYT PierrunoYT commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds an "Extending Zero" section to README.md documenting the AGENTS.md/ZERO.md/.zero/AGENTS.md project-instructions lookup chain (git root → cwd, 8 KiB/file, 32 KiB total)
  • Documents the plugin.json manifest fields (tools, hooks, prompts, skills) and the two discovery paths (~/.config/zero/plugins/*/plugin.json, <repo>/.zero/plugins/*/plugin.json)
  • Notes that MCP servers and standalone skills share the same extension points

Closes #521

Test plan

  • Read through the rendered README section for accuracy against internal/agent/system_prompt.go and internal/plugins/plugins.go
  • Maintainer review for tone/placement

Summary by CodeRabbit

  • Documentation
    • Added an “Extending Zero” section explaining how project instructions are discovered and appended from local configuration files (general-to-specific order, with per-file and total size limits).
    • Documented support for a global personal ZERO.md that applies across workspaces.
    • Expanded plugin discovery/management guidance for user-scope and project-scope manifests, including declared capabilities, and clarified how MCP servers and standalone markdown skills reuse the same extension points.

Copilot AI review requested due to automatic review settings July 5, 2026 14:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an “Extending Zero” section to the README to document how project instruction files are injected into the system prompt and how plugins are discovered/configured, addressing the documentation gap described in #521.

Changes:

  • Documented the project-instructions lookup chain for AGENTS.md / ZERO.md / .zero/AGENTS.md, including size caps.
  • Added a brief overview of plugin discovery paths and the plugin.json extension blocks (tools, hooks, prompts, skills).
  • Mentioned MCP servers and standalone skills in the context of extensibility.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md Outdated
Comment on lines +298 to +301
Plugins are discovered from `~/.config/zero/plugins/<name>/plugin.json`
(user scope) and `<repo>/.zero/plugins/<name>/plugin.json` (project scope),
and managed with `zero plugins`. A manifest can declare:

Comment thread README.md Outdated
Comment thread README.md
`permission` of `allow`, `prompt`, or `deny`)
- `hooks` — commands run on `beforeTool`, `afterTool`, `sessionStart`, or
`sessionEnd`
- `prompts` and `skills` — additional prompt/skill files
Comment thread README.md
Comment on lines +308 to +310
MCP servers (`zero mcp`) and standalone markdown skills (`zero skills`) use
the same extension points and can also be wired up outside of a plugin
manifest.
@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 193c5eec-958e-43cb-9b6c-3bdec9c58f0a

📥 Commits

Reviewing files that changed from the base of the PR and between 3de85f3 and 5a102ef.

📒 Files selected for processing (1)
  • README.md
✅ Files skipped from review due to trivial changes (1)
  • README.md

Walkthrough

Adds README documentation for project and personal instruction injection, plugin manifest discovery, supported manifest fields, and the shared extension points used by MCP servers and skills.

Changes

Extending Zero documentation

Layer / File(s) Summary
Extending Zero section
README.md
Documents the AGENTS.md/ZERO.md lookup order, size caps, user-scoped ZERO.md handling, plugin discovery paths, supported manifest fields, and reuse by zero mcp and zero skills.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Possibly related PRs

  • Gitlawb/zero#436: Also updates README.md, so it may overlap with other documentation changes in the same area.
  • Gitlawb/zero#475: Implements the user-scoped ZERO.md prompt injection behavior that this README now documents.

Suggested reviewers: kevincodex1, Vasanthdev2004

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: documenting AGENTS.md/ZERO.md behavior and the plugin manifest format.
Linked Issues check ✅ Passed The README update covers the instruction lookup chain, size caps, plugin schema fields, and both discovery paths requested by #521.
Out of Scope Changes check ✅ Passed The added MCP and skills notes stay within the documented extension model and support the same plugin extension points.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Vasanthdev2004 Vasanthdev2004 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fact-checked the whole thing against the code, since that's what matters for docs — and it holds up. This one was clearly written from the source, not guessed:

  • The AGENTS.md/ZERO.md/.zero/AGENTS.md chain, git-root-down-to-cwd with first-match-per-directory, general-to-specific, 8 KiB/file and 32 KiB total — all match system_prompt.go exactly.
  • The manifest fields (tools/hooks/prompts/skills, and tool command/args/inputSchema/permission) match the structs in plugins.go.
  • The hook events beforeTool/afterTool/sessionStart/sessionEnd are exactly the four HookEvent constants. (The standalone zero hooks system has a couple more, but those aren't manifest hooks, so scoping the plugin docs to these four is correct.)
  • The permission nuance is right, and it's the easy one to get wrong: allow really is clamped to prompt unless manifest auto-approval was opted into at load time — toolSafety's comment says exactly that.
  • Discovery paths match: <configHome>/zero/plugins (user) and <cwd>/.zero/plugins (project).

Two trivial things, take or leave: the project path is technically <cwd>/.zero/plugins, not the repo root — only matters if someone runs from a subdirectory — and ~/.config/zero/plugins is the Linux form of the user config dir (macOS/Windows differ). #475 just documented that same location as config.UserConfigDir()/zero, so matching that phrasing would keep the two consistent. Neither blocks.

Waiving the issue-approved gate here — this documents already-shipped features rather than proposing new work, so there's nothing for the issue-first policy to gate. CI's green.

Accurate and useful. Approving.

PierrunoYT and others added 2 commits July 5, 2026 16:34
Add an "Extending Zero" section to the README covering the
AGENTS.md/ZERO.md project-instructions lookup chain and the
plugin.json manifest fields, neither of which were previously
documented outside the source.

Closes Gitlawb#521

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- Correct project-scope plugin discovery to <cwd>/.zero/plugins, not
  the repo root.
- Clarify that user-scope plugin discovery always resolves under
  ~/.config regardless of OS, separate from config.UserConfigDir()
  (which is OS-aware and used for the per-user ZERO.md file).
- Document the per-user ZERO.md guidelines file added in Gitlawb#475.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@PierrunoYT
PierrunoYT force-pushed the docs/document-agents-md-and-plugins branch from ad87f29 to 3de85f3 Compare July 5, 2026 14:35
@PierrunoYT
PierrunoYT requested a review from Copilot July 5, 2026 14:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.

Comment thread README.md
Comment on lines +292 to +294
the git root down to your current working directory (checked in that order
per directory). Files are injected general-to-specific, capped at 8 KiB per
file and 32 KiB total.
Comment thread README.md Outdated
Comment thread README.md
Comment on lines +303 to +307
scope — `$XDG_CONFIG_HOME` or `~/.config` on every OS, independent of the
`config.UserConfigDir()` path used above) and `<cwd>/.zero/plugins/<name>/plugin.json`
(project scope — resolved from the current working directory, not the repo
root), and managed with `zero plugins`. A manifest can declare:

Comment thread README.md
Comment on lines +308 to +310
- `tools` — custom tools (`command`, `args`, `inputSchema`, and a
`permission` of `prompt` or `deny`; `allow` is honored only when manifest tool
auto-approval is enabled)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@kevincodex1

Copy link
Copy Markdown
Contributor

@coderabbitai please do a full code review approve if its all good

@kevincodex1 kevincodex1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
gh pr diff 522 --repo Gitlawb/zero

Length of output: 2025


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Search for AGENTS.md / ZERO.md loading logic ==="
rg -n "AGENTS.md|ZERO.md" --type=go -g '!README.md' -C3 | head -150

echo "=== Search for size caps (8192, 32768, KiB) ==="
rg -n "8192|32768|8 \* 1024|32 \* 1024" --type=go -C3 | head -100

echo "=== Search for plugin.json discovery ==="
rg -n "plugin.json|plugins/" --type=go -C3 | head -150

echo "=== Search for UserConfigDir usage ==="
rg -n "UserConfigDir" --type=go -C3 | head -100

Length of output: 840


🏁 Script executed:

#!/bin/bash
set -euo pipefail
echo "=== repo root listing ==="
ls -la
echo "=== find files by name ==="
fd -i 'agents.md|zero.md|plugin.json' .
echo "=== detect language ==="
fd -e go | head -5
fd -e ts | head -5
fd -e py | head -5
fd -e rs | head -5

Length of output: 2310


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== AGENTS.md / ZERO.md references in Go code ==="
rg -n "AGENTS\.md|ZERO\.md" --type=go -g '!README*' || true

echo "=== size cap constants ==="
rg -n "8192|32768|8\s*\*\s*1024|32\s*\*\s*1024|MaxFileSize|MaxTotal" --type=go || true

echo "=== plugin.json ==="
rg -n "plugin\.json" --type=go || true

echo "=== UserConfigDir ==="
rg -n "UserConfigDir" --type=go || true

echo "=== plugins dir discovery ==="
rg -n '\.zero/plugins|config/zero/plugins' --type=go || true

Length of output: 694


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "--- test rg basic ---"
rg -n "package main" --type=go internal | head -5

echo "--- search AGENTS ---"
rg -n "AGENTS" -g '*.go' .

echo "--- search plugin.json in whole repo ---"
rg -n "plugin.json" .

echo "--- search ZERO.md in whole repo excluding README ---"
rg -n "ZERO.md" . -g '!README*'

Length of output: 23875


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== system_prompt.go relevant section ==="
sed -n '1,120p' internal/agent/system_prompt.go

echo "=== size caps in system_prompt.go ==="
rg -n "8192|8\*1024|8 \* 1024|32768|32\*1024|32 \* 1024|maxBytes|MaxBytes|cap" internal/agent/system_prompt.go

echo "=== plugins.go discovery paths ==="
sed -n '1,60p' internal/plugins/plugins.go
echo "---"
rg -n "UserConfigDir|\.zero/plugins|func.*[Dd]iscover|func.*[Ll]oad" internal/plugins/plugins.go

Length of output: 7698


🏁 Script executed:

#!/bin/bash
set -euo pipefail
rg -n "SourceUser|SourceProject|plugins.*Root|Roots\s*:=|UserConfigDir" internal/cli --type=go -C2 | grep -i plugin -A2 -B2 | head -100
echo "---direct search---"
rg -n '\.zero.plugins|config.*plugins|plugins.*dir' internal/cli/*.go -i | head -50

Length of output: 9882


🏁 Script executed:

#!/bin/bash
set -euo pipefail
rg -n "func ResolveRoots" -A 40 internal/plugins/*.go

Length of output: 2756


All content in the new README section checks out against the implementation.

@kevincodex1 Reviewed the diff and cross-checked every claim against the implementation — all accurate:

  • Size caps: internal/agent/system_prompt.go confirms maxProjectContextBytes = 8 << 10 (8 KiB/file) and maxProjectContextTotalBytes = 32 << 10 (32 KiB total), matching the doc exactly.
  • Lookup chain: projectContextFiles = []string{"AGENTS.md", "ZERO.md", ".zero/AGENTS.md"} walked from git root to cwd, injected general-to-specific — matches.
  • Personal ZERO.md: userContextFile = "ZERO.md" resolved under config.UserConfigDir()/zero/, injected ahead of project guidelines — matches.
  • Plugin discovery paths: plugins.ResolveRoots() confirms SourceUser$XDG_CONFIG_HOME (or ~/.config)/zero/plugins, SourceProject<cwd>/.zero/plugins (correctly resolved from cwd, not repo root, as the doc notes).
  • Manifest fields (tools, hooks, prompts, skills) and the zero mcp/zero skills note align with internal/plugins/plugins.go and AGENTS.md section 6.

This is a doc-only change (+33/-0) with no code touched, so no correctness/safety/test-coverage risk. Nice work — approving.

[approve]

@kevincodex1
kevincodex1 merged commit 8f3b8f0 into Gitlawb:main Jul 5, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

README doesn't document AGENTS.md/ZERO.md system-prompt injection or plugin manifest format

4 participants