agent-3md
Exposes an agent's skills as MCP tools, allowing any MCP client to route requests and load skills on demand from a single .3md file.
README
agent.3md: a format for agents in one file
One plain-text 3md file is a whole agent. Plane 0 is the agent (identity,
rules); every other plane is a skill. The frontmatter is the manifest, each
plane's attributes (triggers=, typed inputs=, tool=, cost=) are a
queryable index, and [[z=N|..]] links are the skill dependency graph.
Skills are real. A skill can bind to an actual CLI command (tool=), and
then its typed inputs are that command's arguments, so routing is not "read some
prose," it is route -> fill -> run: pick the skill, fill its inputs, get the
exact command to run.
@plane z=1 label="search" kind=skill triggers="search, find, grep" inputs="pattern:string, path:string" tool="rg --line-number {pattern} {path}"
A tool is optional. Skills that are not command-shaped (web research, a
judgment call, anything the host's own tools handle) carry no tool and are
pure guidance the agent follows with whatever capabilities it has. So a real
agent is usually a mix: some skills run a command, some are a playbook.
The same file is human-readable documentation and a machine-queryable skill index, so the two can never drift. And because skills are addressable planes, an agent loads only the one skill it needs per turn (progressive disclosure) instead of stuffing every skill into context.
Quickstart (2 minutes)
There are two ways in, by design. TypeScript is the reference implementation, the package you embed in an agent; it carries the spec, the validator, and the MCP server. Rust is the default native CLI, a single fast binary for the command line with no runtime to install.
Embed the library (TypeScript, the default for code). It's on the public
npm registry, no token or .npmrc needed:
npm install @corvidlabs/agent3md
import { Agent, validateAgent } from "@corvidlabs/agent3md";
import { readFileSync } from "node:fs";
const src = readFileSync("agent.3md", "utf8");
console.log(validateAgent(src).ok); // true
const agent = new Agent(src);
const top = agent.route("find every TODO")[0].skill; // -> "search"
console.log(agent.command(top.name, { pattern: "TODO", path: "src" }));
// -> rg --line-number 'TODO' 'src' (route -> fill -> run)
Install the CLI (Rust, the default for the command line). A fast native binary, nothing to run it on top of:
cargo install agent3md
agent3md run agent.3md "find every TODO" pattern=TODO path=src # route -> command
agent3md run agent.3md "find every TODO" pattern=TODO path=src --exec # and run it
agent3md validate agent.3md # exit non-zero on errors
Or scaffold and drive it from this repo:
git clone https://github.com/CorvidLabs/agent-3md && cd agent-3md
bun run cli new my-agent # writes a valid starter my-agent.3md (real CLI skills)
bun run validate my-agent.3md # PASS
bun run cli run my-agent.3md "find every TODO" pattern=TODO path=src
bun run mcp my-agent.3md # serve its skills to any MCP client
Why it's good for agents
- Progressive disclosure. The agent loads only the one skill a request needs,
not all of them. On the real 6-skill example that is about 73% fewer tokens
per turn at 100% routing accuracy (
bun run benchmark). With realistic ~300-token skills, loading one instead of dumping the whole file is about 96% fewer per turn at 100 skills (bun run scale). Routing accuracy depends on writing distinct triggers, and the benchmark measures it, it is not assumed. - Flat at scale, honestly. Move the catalog out of the prompt and query it
with a routing tool, and per-turn in-context cost stays roughly flat (about
520 tokens whether the agent has 10 skills or 100,
bun run scale2). That is not free: it costs a tool round-trip per turn plus a catalog that lives in the loader, but it decouples per-turn prompt size from skill count. - One artifact, two readers. Read it as docs; parse it as an index.
- Portable, proven. The same
agent.3mdloads and routes identically in TypeScript, Rust, and Swift (loaders/), each on the canonical 3md parser. Plus a JSON projection (bun run export) for non-3md consumers. - Checkable. A conformance validator + a language-agnostic vector set
(
examples/conformance/) make it checkable, not a vibe.
The spec
SPEC.md defines agent3md/1: manifest frontmatter, the one
identity plane vs skill planes, the skill contract (triggers / typed inputs /
tool command templates / cost / dependency links), the loader contract
(manifest / route / get / resolve / command), and the MUST/SHOULD
conformance rules.
What's here
| file | what |
|---|---|
agent.3md |
the flagship agent (dev): a terminal-first toolbox, identity + 7 skills (6 command-backed + 1 guidance-only) |
SPEC.md |
the agent3md/1 spec |
src/threemd.ts |
the canonical 3md parser (vendored) |
src/runtime.ts |
reference loader: manifest / route / get / resolve / command |
src/validate.ts |
conformance validator (+ examples/invalid/ fixtures) |
src/cli.ts |
agent3md CLI (incl. run [--exec]) |
src/mcp.ts |
MCP server: exposes an agent's skills as MCP tools |
src/export.ts |
JSON manifest projection (agent3md/1) for any consumer |
loaders/rust, loaders/swift |
the same agent loaded via the Rust + Swift parsers |
examples/agents/ |
more real agents (corvid, devops, support); proves generality |
examples/conformance/ |
labeled valid/invalid vectors for any implementation |
src/benchmark.ts, src/scale/ |
token-savings proof, single + scaled + flat |
Try it
bun run demo # load the dev agent, route requests, fetch one skill
bun run run # route -> fill -> command (the real CLI each request maps to)
bun run validate agent.3md # conformance check (exit non-zero on errors)
bun run test # validator conformance suite
bun run benchmark # token savings on the example agent
bun run scale # the savings curve at 10/25/50/100 skills
bun run cli run agent.3md "find every TODO" pattern=TODO path=src
bun run mcp:selftest # spawn the MCP server and call its tools
Use it from any MCP client
Point an MCP-capable agent at the server; its skills appear as tools
(list_skills, route_skill, get_skill, resolve_skill):
{ "command": "bun", "args": ["src/mcp.ts", "agent.3md"] }
Status
Early (v0.x), a working reference kit, not a finished product: the spec, loaders
in TypeScript, Rust, and Swift, a validator with conformance vectors, a CLI, an
MCP server, and a JSON projection. It is a proposed format with no external users
yet, so treat it as a proof of concept you can build on. It was put through an
adversarial review; see docs/ROADMAP-1.0.md for the
findings and what 1.0.0 still needs (typed skill inputs, tool bindings, and real
adopters).
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。