Skip to content

feat(virtual-mcp): attach files and skills to agents as knowledge#3948

Open
rafavalls wants to merge 2 commits into
mainfrom
rafavalls/agent-file-attachments
Open

feat(virtual-mcp): attach files and skills to agents as knowledge#3948
rafavalls wants to merge 2 commits into
mainfrom
rafavalls/agent-file-attachments

Conversation

@rafavalls

@rafavalls rafavalls commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

What is this contribution about?

Adds a Files and skills section to agent settings so users can attach reference material an agent always has access to. Files upload to the org filesystem (the Library's home volume under knowledge/, persistent and mounted into every agent sandbox), and users can also pick existing recent Library files or any Claude Code skill folder (reusing the existing hasSkill detection). Selections are stored on metadata.knowledge and surfaced to the agent in a <knowledge> system-prompt block that lists each item's exact sandbox path and inlines small text documents. The settings sections were also reordered to Connections → Instructions → Files and skills → Sub-agents, and the Sub-agents description moved under its title.

Screenshots/Demonstration

Agent settings now show a "Files and skills" section with an "Add" dropdown (Upload file / Select file or folder / Select skill), file-type icons, and drag-and-drop.

How to Test

  1. Run bun run dev, open an agent's settings, and in Files and skills upload a .md file (or drag-drop).
  2. Confirm it appears in the Library under home/knowledge/, and that "Select file or folder" / "Select skill" list recent Library files and org skills.
  3. Start a fresh chat with that agent and ask what files it has — it should list the file with its sandbox path and the inlined contents.

Migration Notes

No database migrations. metadata.knowledge is a new optional field on the existing virtual-MCP metadata (loose schema).

Review Checklist

  • PR title is clear and descriptive
  • Changes are tested and working
  • Documentation is updated (if needed)
  • No breaking changes

Summary by cubic

Adds a “Files and skills” section to agent settings so you can attach Library files/folders and Claude Code skills. Attached items are stored in the org Library and surfaced to the model via a <knowledge> block appended to served instructions with exact sandbox paths.

  • New Features

    • Upload or pick recent Library files/folders and skills; drag-and-drop supported. Uploads land in home/knowledge/.
    • Selections are saved on metadata.knowledge using KnowledgeFile (exported in packages/mesh-sdk); skills are detected via hasSkill across home and public sets.
    • Served instructions include a <knowledge> block that lists each item with its sandbox path (via orgFsSandboxPath); the agent reads files directly (no content inlining).
    • Settings order updated: Connections → Instructions → Files and skills → Sub-agents; Sub-agents help text moved under the title.
    • Limits: max upload 25 MB. No database migrations.
  • Bug Fixes

    • Knowledge now ships in served instructions for all run paths (cluster and sandbox-daemon), replacing the previous cluster-only prompt addition.

Written for commit 6823561. Summary will update on new commits.

Review in cubic

rafavalls and others added 2 commits June 16, 2026 02:32
Add a "Files and skills" section to agent settings where users upload
files or pick existing Library files/skills. Items are stored in the org
filesystem (home volume + public skill sets), recorded on
metadata.knowledge, and surfaced to the agent in a <knowledge> system
prompt block that lists each item's sandbox path and inlines small text
docs. Also reorders the settings sections (Connections, Instructions,
Files and skills, Sub-agents) and tidies the Sub-agents description.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The knowledge block was only added in the cluster system-prompt assembler,
so agents running through the sandbox/desktop daemon (which assembles its
own prompt) never saw their attached files. Fold the knowledge inventory
into the agent's served instructions via the passthrough client's
getInstructions(), and have the /mcp/virtual-mcp endpoint serve those
instructions, so both run paths get it uniformly. The block now lists each
item's exact sandbox mount path (files are mounted into the agent fs), so
the agent can read them directly; drop the cluster-only inlining.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rafavalls rafavalls force-pushed the rafavalls/agent-file-attachments branch from b5509fb to 6823561 Compare June 16, 2026 05:48
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