PROTOCOL v1.185 Design

Universal Context Protocol

Switch between AI coding tools — Cursor, Claude Code, Codex, and more — without losing your setup. One CLI command carries your agents, skills, rules, and commands across.

Read the Spec

What This Is

A protocol standard that lets developers switch between AI coding tools (Cursor, Claude Code, Codex, etc.) without losing their setup. It works like a migration adapter: the user runs a single CLI command and their agents, skills, rules, and commands are carried across — automatically where possible, with a report where the conversion is approximate.

The protocol does not invent new file formats. It reuses the formats the industry has already converged on (AGENTS.md, SKILL.md) as its canonical intermediate representation, and only defines new schemas where no standard exists yet (subagents, commands).

Problem It Solves

AI coding tools have divergent configuration ecosystems. Switching tools today means manually re-reading documentation and rebuilding your setup from scratch. The protocol automates the 80% that is portable and clearly flags the 20% that needs human review.

Tool Memory / Rules file Skills Subagents Commands
Cursor .cursor/rules/*.mdc (or legacy .cursorrules) None native None native None native
Claude Code CLAUDE.md + .claude/ .claude/skills/<name>/SKILL.md .claude/agents/<name>.md .claude/commands/<name>.md
Codex AGENTS.md SKILL.md (via agentskills.io) In development None native

Existing Standards the Protocol Builds On

The protocol is deliberately not a new standard — it is glue between existing ones.

AGENTS.md

The Linux Foundation–stewarded open standard for coding agent instructions, read natively by 20+ tools including Cursor, Codex, Copilot, Gemini CLI, Aider, Windsurf, and Zed. It is plain Markdown with no required schema. Claude Code reads CLAUDE.md natively, but the common pattern is to import AGENTS.md from CLAUDE.md so one file serves all tools. The protocol uses AGENTS.md as the canonical rules/memory representation in the hub.

SKILL.md / agentskills.io

Defines reusable, self-contained skill folders. A skill is a directory containing a SKILL.md with YAML frontmatter (name, description) plus an instructional body. Skills are already highly portable — the protocol copies them nearly verbatim, adjusting only the installation path.

Core Architecture: Hybrid Hub + Direct Overrides

The architecture is a hub with optional pairwise shortcuts, chosen to avoid the O(N²) adapter explosion that a pure peer-to-peer design produces.

4.1 The Hub (primary path)

Every tool implements two functions:

import — reads the tool's native artifacts and produces the Canonical IR (see §5)
export — reads the Canonical IR and writes the tool's native artifacts

A migration from Tool A to Tool B is: export_B(import_A(source)). This means adding a new tool requires only writing one import + one export, not a new adapter for every existing tool.

4.2 Direct Overrides (optional pairwise shortcuts)

Where a hub round-trip loses information that a direct conversion could preserve, a tool can ship an override adapter for a specific target. The migration runner checks for an override before falling back to the hub path.

Example: Cursor's per-rule glob scoping (.mdc frontmatter) has no equivalent in AGENTS.md. A direct cursor → claude_code override could preserve those globs as section comments in CLAUDE.md, which is lossier than ignoring them but better than silence.

4.3 Best-Effort + Report Contract

Where an artifact cannot be mapped cleanly, the protocol:

1. Makes the best available approximation (never silently drops content)
2. Records the transformation in MIGRATION_REPORT.md with a human-readable description of what changed and what requires manual review

There is no silent data loss. Lossy transforms are always surfaced in the migration report.

The Canonical Intermediate Representation (IR)

The IR is a directory that a migrated setup passes through:

setup/ AGENTS.md # Rules / memory — AGENTS.md standard verbatim skills/ <name>/ SKILL.md # agentskills.io format, carried as-is agents/ <name>.md # Normalized subagent (see §5.1) commands/ <name>.md # Normalized command (see §5.2) manifest.json # Provenance: source tool, versions, lossiness log

AGENTS.md and SKILL.md are the standards themselves — no transformation needed in the common case. The protocol's only original schema work is for subagents and commands, which have no cross-tool standard yet.

5.1 Normalized Subagent Frontmatter

--- name: string # required description: string # required — used for auto-invocation matching model: string # optional — e.g. "claude-sonnet-4-6" tools: [string] # optional — explicit tool allowlist; omit = all tools source_tool: string # set by import; preserved for traceability --- # System prompt / instructions follow as Markdown body

5.2 Normalized Command Frontmatter

--- name: string # required — becomes the /command-name description: string # required args: [{name, description, required}] # optional source_tool: string --- # Command instructions follow as Markdown body

5.3 manifest.json

Records provenance and is the source of truth for MIGRATION_REPORT.md:

{ "protocol_version": "0.1", "migrated_at": "2026-06-21T00:00:00Z", "source": { "tool": "cursor", "version_detected": "0.43" }, "target": { "tool": "claude_code" }, "artifacts": [ { "type": "rules", "source_file": ".cursor/rules/python.mdc", "destination": "AGENTS.md", "status": "best_effort", "note": "Per-rule glob scope (.py files) flattened into section heading." }, { "type": "skill", "source_file": ".cursor/skills/pr-review/", "destination": ".claude/skills/pr-review/", "status": "clean" } ] }

Repository Layout

protocol/ spec/ PROTOCOL.md # Normative specification (source of truth) schema/ setup.schema.json # Canonical IR schema tool-manifest.schema.json # tool.json schema report.schema.json # MIGRATION_REPORT.md data schema tools/ cursor/ tool.md / tool.json import.py # Cursor artifacts → IR export.py # IR → Cursor artifacts overrides/claude_code/ cursorrules.map.md # Spec: how .mdc glob rules map to CLAUDE.md cursorrules.py # Impl: direct conversion (bypasses hub) fixtures/basic/ input/ expected_ir/ expected_claude_code/ claude_code/ tool.md / tool.json import.py / export.py overrides/cursor/ claude.map.md / claude.py fixtures/basic/ input/ expected_ir/ codex/ tool.md / tool.json / import.py / export.py / fixtures/ cli/ migrate.py # Entry: migrate --from --to [--dry-run] [--merge] report.py # Renders manifest.json → MIGRATION_REPORT.md detect.py # Auto-detects source tool from project structure tests/ test_cursor_import.py test_claude_code_export.py test_round_trip.py # IR → Tool A → IR round-trip fidelity checks README.md

<artifact>.map.md is the human-readable spec for how one artifact maps to another (named .map.md to avoid collision with the real AGENTS.md). <artifact>.py is the implementation; it must pass golden fixtures. tool.json is machine-readable; tool.md is human-readable.

tool.json Schema

Each tool declares its own artifacts, detection signals, and capabilities. This is what the CLI reads to know how to handle a tool — not hardcoded logic.

{ "id": "cursor", "display_name": "Cursor", "version": "0.43+", "detection": { "globs": [".cursor/", ".cursorrules"] }, "artifacts": { "rules": { "paths": [".cursor/rules/*.mdc", ".cursorrules"], "format": "mdc_frontmatter", "capabilities": { "per_rule_globs": true, "hierarchical": false } }, "skills": { "paths": [".cursor/skills/*/SKILL.md"], "format": "agentskills_io" }, "agents": null, "commands": null }, "can_migrate_to": ["claude_code", "codex"] }

The capabilities block drives best-effort logic. If the target tool declares per_rule_globs: false, the importer knows to flatten and log the loss.

Artifact Portability Tiers

Not all artifacts migrate equally. The protocol defines four tiers:

Tier Artifacts Typical loss Strategy
Standard Rules / memory (AGENTS.md) Cursor glob scoping flattens; otherwise clean Hub: import → AGENTS.md → export
Portable Skills (SKILL.md) Near-zero; path relocation only Direct copy + path adjustment
Tool-specific Subagents, commands Tool-specific fields approximated Hub with normalized IR; override for known pairs
Deferred (v2+) MCP config, hooks High loss; tool-specific behaviour Phase 3

Phase 1 v1 scope: The first implementation covers only the top three tiers (rules, skills, subagents + commands) for two tools: Cursor → Claude Code (the easy, mostly-lossless direction) and Claude Code → Cursor (the harder reverse, with more best-effort transforms).

Conflict and Merge Policy

When the target directory already contains setup files:

1

Existing files are backed up to .protocol_backup/<timestamp>/ before any writes.

2

Clean-mapped artifacts overwrite without prompting.

3

Best-effort artifacts prompt (or in --merge mode, are written alongside a .conflict companion noting what the original contained).

4

All conflicts are listed in MIGRATION_REPORT.md.

This ensures the migration is always reversible.

Known Capability Gaps (v1)

These are documented decisions, not omissions:

Cursor per-rule globs (.mdc frontmatter)
Flattened into AGENTS.md section headings; logged as best-effort.
Cursor has no subagent concept
Claude Code gains subagents it didn't have; no loss on Cursor → Claude direction.
Claude Code subagents → Cursor
Folded into rules/commands with a TODO comment; logged as best-effort.
MCP config (.mcp.json, .claude.json)
Deferred to Phase 3.
Hooks (.claude/settings.json hook entries)
Deferred to Phase 3.
Claude Code slash commands → Cursor
No Cursor equivalent; best-effort as .cursor/rules context note.

Phased Delivery Plan

PHASE 0
Spec Design only — current
PROTOCOL.md, JSON schemas, tool.json for 3 tools, portability tier definitions.
PHASE 1
MVP Cursor ↔ Claude Code, rules + skills + agents + commands
import.py + export.py for both tools, CLI (migrate.py), golden fixtures, MIGRATION_REPORT.md renderer.
PHASE 2
Third tool + reversibility Add Codex
Codex import.py + export.py, test_round_trip.py, bidirectional golden fixtures, conflict/merge hardening.
PHASE 3
MCP + hooks
New artifact tier in schema, per-tool adapters for MCP server config and hook definitions.
PHASE 4
Ecosystem
Plugin/registry interface, conformance test suite, versioned adapters for third-party tool support.

Key Design Decisions Log

Decision Options Considered Chosen Rationale
Core architecture Direct N×N, Hub, Hybrid Hybrid hub + direct overrides O(N) default cost; direct overrides for lossless pairwise cases
Lossiness behaviour Fail, warn+skip, best-effort, stub Best-effort + report Maximises migrated value; never silently drops; loss is actionable
v1 artifact scope All / rules+skills / +agents+commands Rules, skills, subagents, commands MCP + hooks deferred; covers 90% of day-to-day setup
Canonical format Invent new format, reuse AGENTS.md Reuse AGENTS.md + SKILL.md as IR Avoids protocol lock-in; migrated IR is immediately usable without the protocol
Spec vs code authority Code is truth, spec is truth Spec (.map.md) + golden fixtures Prevents spec/impl drift
Merge policy Overwrite, fail, merge Merge-by-default with backup Reversible; safe for projects with partial existing setup
Distribution npm, pip, standalone Python (uvx/pipx), language-agnostic adapter interface Python reference impls; adapters speak JSON so future impls can use any language

What Is Not Yet Decided

The following require a decision before Phase 1 implementation begins:

Versioned format tracking — when Cursor changes its .mdc frontmatter schema, which version of the adapter applies? Need a format_version field in tool.json and a version-dispatch strategy.
Registry / discoverability — how does the CLI find adapters for tools not bundled with the protocol? Phase 4 concern, but the interface should be reserved now.
Multi-tool projects — some projects use both Cursor and Claude Code simultaneously. The protocol currently assumes one source tool. Behaviour on mixed setups is undefined.
User-scope vs project-scope — Claude Code distinguishes ~/.claude/ (user) from .claude/ (project). Cursor is project-only. The IR doesn't currently model this distinction.

Glossary

IR
Intermediate Representation — the canonical setup/ directory that sits between import and export.
Hub
The default migration path: source → IR → target.
Direct override
An optional pairwise adapter that bypasses the hub for a specific source+target+artifact combination.
Artifact
A single configuration unit: one rules file, one skill folder, one subagent, one command.
Best-effort
A transform that approximates rather than exactly maps an artifact; always logged in the report.
Clean
A transform with no information loss.
tool.json
Machine-readable manifest declaring a tool's artifacts, detection globs, and capabilities.
tool.md
Human-readable documentation for a tool's artifact formats.
Portability tier
Classification of how portable an artifact type is: standard / portable / tool-specific / deferred.
MIGRATION_REPORT.md
File written to the project root after each migration, listing every artifact's status and required follow-up actions.