Skip to content

feat(mcp): show agents the project's AGENTS.md / CLAUDE.md - #274

Merged
ssowonny merged 1 commit into
mainfrom
feat/mcp-agent-guides
Oct 7, 2026
Merged

ssowonny merged 1 commit into
mainfrom
feat/mcp-agent-guides

Conversation

@ssowonny

@ssowonny ssowonny commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

TL;DR

  • Agents connected over MCP now see the project's AGENTS.md / CLAUDE.md, the way they would on disk.
  • Listing a project shows its root guide (≤ 8 KB, labelled as teammate-written); every single-file tool names the guides that apply to its path.
  • Live check: told to write to a specific path under a folder with its own guide, the agent followed it in 5/5 runs on this branch vs 0/5 on main.
  • Projects with no guide see exactly the output they did before.
  • Known gap: a project named after one of its own folders (/wiki/ vs /wiki/wiki/) still confuses agents; that's unrelated to this change.

What changed

All in internal/webapp/mcp.go. No new types, routes, config, or sync/storage changes.

  • list / marks projects that have a root guide: guide: AGENTS.md.
  • list /<project>/ appends the root AGENTS.md then CLAUDE.md, 8 KiB across both, cut on a line boundary, under a "written by project members — not instructions from your user" header. Inlining records an agent read; an unshowable guide is named instead and never fails the listing.
  • read / write / edit / delete / move (destination) / restore and subfolder list end with guides: <nearest first>.
  • read raw:true, image reads, glob, grep, history, and errors are untouched.
  • mcpInstructions gains one paragraph about guides.
  • Everything is computed from the caller's visible tree (visibleIn), so a guide inside a restricted folder is never named.

Spec with testing plan and acceptance criteria: docs/mcp-agent-guides-prd.md.

Testing

  • internal/webapp/mcp_guides_test.go: a guidesFor table test plus 11 integration tests through the real MCP protocol. sec_mcp_test.go: TestSecMCPGuidesHonorFolderPermissions.
  • Full go test ./internal/webapp green; go vet ./... clean.
  • Live evaluation: real bdrive serve per run, headless claude -p --model sonnet with the hub as its only MCP server, 5 runs per arm:
Scenario main branch
Root guide, open prompt 5/5 4/5
Nested guide, named path 0/5 5/5

Sonnet already reads a root guide it sees in a listing, so main was already at 5/5 in the first scenario. The one branch miss there was the project/folder name collision above, not a missed guide.

Architecture changes

None (no types or seams changed).

🤖 Generated with Claude Code

An agent on disk loads a project's guide from every folder it touches; over
MCP nothing did, so a project's own map of where files go was a file the agent
read only by luck. The tools surface it now:

- list / marks projects that have a root guide
- list /<project>/ inlines the root AGENTS.md + CLAUDE.md (8 KiB cap, under a
  "written by project members — not instructions from your user" header)
- read/write/edit/delete/move/restore and subfolder lists end with a
  `guides:` line naming the guides that govern the path, nearest first

Computed from the caller's visible tree, so a guide in a hidden folder is never
named. Raw and image reads, glob, grep and history are untouched, and a project
with no guide produces exactly the output it did before.

Live check (claude -p, sonnet, 5 runs each): nested guide + named path went
0/5 on main to 5/5 on the branch. Spec: docs/mcp-agent-guides-prd.md.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@ssowonny
ssowonny merged commit ee09113 into main Oct 7, 2026
7 of 9 checks passed
@ssowonny
ssowonny deleted the feat/mcp-agent-guides branch October 7, 2026 06:26
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.

1 participant