Skip to content

Add Zed Agent render adapter for instructions, skills, MCP, and tool permissions #92

Description

@kelos-bot

🤖 Kelos Strategist Agent @gjkim42

Area: Integration Opportunities

Summary

Add a Zed Agent render adapter so Kanon can manage Zed's native AI configuration from the same source repo that already feeds Codex and Claude.

Zed is now a better Kanon target than it was in the earlier adapter roadmap. Its current docs show file-backed support for the exact surfaces Kanon already models well:

  • Always-on personal/project instructions via AGENTS.md
  • SKILL.md skill directories under ~/.agents/skills/ or project .agents/skills/
  • MCP servers in Zed settings.json under context_servers
  • Agent profiles that enable/disable built-in and MCP tools
  • Tool permissions that allow/deny/confirm built-in, skill, and MCP tool calls

This is distinct from existing adapter issues for Cursor/opencode/Copilot, Continue, Roo, Cascade/Windsurf, Junie, Goose, and Kiro. I searched existing issues for Zed / Zed Agent and found no dedicated Zed adapter proposal.

Why this is strategically useful

Zed is not just another editor-specific settings file. It is becoming an agent host:

  • Zed Agent uses Zed-managed instructions, skills, MCP servers, profiles, and permissions.
  • Zed can also host External Agents over ACP, including Claude, Codex, OpenCode, Copilot, Cursor, Gemini CLI, and Pi Coding Agent.
  • Zed-configured MCP servers can be forwarded to External Agents over ACP, while those agents may also read their own native config.

That makes Zed a useful bridge target for Kanon: one Kanon source can configure the native Zed Agent and keep the editor-hosted Codex/Claude/OpenCode experience aligned with the same skills, instructions, and MCP server set.

Evidence from the current codebase

  • Kanon's schema already has the core primitives: instructions, skills, mcp, hooks, and metadata (internal/core/types.go).
  • The current adapter registry only returns Codex and Claude (internal/core/render.go, adaptersFor). The CLI --agent validation and validateTargets allow only codex, claude, and all.
  • renderSkills already copies SKILL.md directories, remote git skill providers, and nested assets. That maps directly to Zed's skill folder format.
  • Codex already renders skills to ~/.agents/skills globally and .agents/skills for projects (internal/core/codex.go). Zed uses the same paths, which is useful but creates a duplicate-path hazard when both adapters are active.
  • Co-owned config merging already exists for Codex TOML and Claude JSON files (internal/core/merge.go), but Zed's settings.json supports // comments. The existing parseJSONDocument uses Go's standard encoding/json, so a Zed merge strategy will need JSONC support or a comment-preserving approach.
  • PlanFiles currently does not de-duplicate multiple RenderedFile entries with the same destination path. A Zed adapter would hit this for project AGENTS.md and .agents/skills if Codex is also active.

External evidence

Primary docs checked:

Proposed adapter mapping

Add a new zed agent target, gated the same way other post-Codex/Claude adapters should be gated. If the agents: opt-in mechanism from the earlier roadmap is not present in this branch, this should ship with or depend on it. Do not make existing targets: [] configs suddenly write Zed files.

User-scope render:

Kanon source Zed destination
instructions.files ~/.config/zed/AGENTS.md (%APPDATA%\Zed\AGENTS.md on Windows)
skills ~/.agents/skills/<name>/...
mcp.servers ~/.config/zed/settings.json -> context_servers
MCP default_approval / tools settings.json -> agent.tool_permissions entries
MCP enabled/disabled tools Optional generated agent.profiles support; defer if too large
hooks No native Zed mapping in current docs; warn or fail for targets: [zed] rather than silently dropping

Project-scope render with --project:

Kanon source Zed destination
instructions.files <project>/AGENTS.md
skills <project>/.agents/skills/<name>/...
mcp.servers / permissions <project>/.zed/settings.json if Zed supports these AI settings at project scope; otherwise render only user settings and document the unsupported project fields

Example config

version: 1
agents: [codex, claude, zed]

instructions:
  files:
    - instructions/shared.md
    - instructions/go-service.md

skills:
  - name: code-review
    targets: [codex, claude, zed]

mcp:
  servers:
    github:
      type: http
      url: https://api.githubcopilot.com/mcp/
      targets: [claude, zed]
      default_approval: confirm
      tools:
        create_issue:
          approval: deny

    local-postgres:
      command: npx
      args: [-y, "@modelcontextprotocol/server-postgres"]
      env:
        DATABASE_URL: ${LOCAL_DATABASE_URL}
      targets: [zed]
      default_approval: confirm

Expected Zed settings.json fragment:

{
  "context_servers": {
    "github": {
      "url": "https://api.githubcopilot.com/mcp/"
    },
    "local-postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres"],
      "env": {
        "DATABASE_URL": "${LOCAL_DATABASE_URL}"
      }
    }
  },
  "agent": {
    "tool_permissions": {
      "default": "confirm",
      "tools": {
        "mcp:github:create_issue": {
          "default": "deny"
        },
        "mcp:local-postgres": {
          "default": "confirm"
        }
      }
    }
  }
}

Guardrails to handle up front

  1. Opt-in adapter activation: Existing configs without zed must keep rendering exactly as they do today.
  2. Shared destination paths: Zed and Codex both use project AGENTS.md and .agents/skills. Add a render de-duplication step that permits identical content for the same path and fails on divergent content, or make the shared ownership explicit in the adapter design.
  3. JSONC settings merge: Zed settings support comments. Do not use the current strict JSON merge path against real Zed settings unless comments are stripped/preserved safely.
  4. Co-owned settings preservation: Zed writes many unrelated editor settings into the same file. The merge strategy should update only Kanon-owned keys (context_servers, selected agent.tool_permissions, optional generated profiles) and preserve unmanaged fields.
  5. MCP auth: Zed may prompt OAuth for remote MCP servers without an Authorization header. Kanon should not invent auth behavior; just render the supported fields and let Make MCP authentication onboarding first-class #87-style MCP auth onboarding handle a broader flow.
  6. External Agent boundary: Be explicit that this adapter configures Zed Agent. External Agents may receive forwarded MCP over ACP, but their native instructions/skills/model/auth remain owned by those agents' own adapters.
  7. Unsupported hooks: Zed docs do not show a native hook lifecycle comparable to Codex/Claude. Zed-targeted hooks should produce an actionable warning or validation error.

Suggested MVP scope

  1. Add AgentZed, CLI target validation, and render registration behind an opt-in agent list or explicit --agent zed.
  2. Render user-scope AGENTS.md, ~/.agents/skills, and ~/.config/zed/settings.json context_servers.
  3. Add a FileMergeZedSettings strategy that can preserve Zed JSONC comments or at least fails with a clear path-specific message if JSONC support is not ready.
  4. De-duplicate same-path rendered files before planning/apply, or add adapter-level logic that does not emit duplicate shared files when another active adapter already owns the same exact content.
  5. Map MCP per-tool approval policies to agent.tool_permissions.tools["mcp:<server>:<tool>"] where values are unambiguous.
  6. Add render tests for global instructions, project instructions, shared skills, local and remote MCP servers, JSONC merge preservation, and duplicate-path conflict behavior.
  7. Defer import support, profiles, model/provider defaults, and native External Agent installation until the render path is stable.

Non-goals

  • Do not manage Zed LLM provider API keys in this adapter.
  • Do not install Zed extensions or ACP External Agents in v1.
  • Do not claim Zed profiles control External Agents; Zed's docs state that profiles apply to Zed Agent unless an external integration says otherwise.
  • Do not add a Zed hook schema unless Zed documents a native hook surface.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions