@centerforagenticai/agent-definitions

中文文档
0.2.0发布于 2026/10/13MITTypeScriptES Module近 30 天下载 3789

One file format for coding-agent definitions: schema, parser, conformance suite, linter and converters.

原始使用文档
文档目录7 节
  1. A minimal definition
  2. Parse a definition
  3. Command line
  4. Glossary
  5. Development
  6. Documents
  7. Status

Agent Definitions

One file format for coding-agent definitions. A definition is a Markdown file with YAML frontmatter. The frontmatter says what the agent is for and what it may do. The body is its instructions.

The same file is meant to load in pi-delegate, pi-fabric and pi-prompt-graph, and to work as a Claude Code subagent file. Converters import files from other tools and export to them, with a report of what each target could not keep.

This repository holds the schema, parser, validation, discovery rules, conformance suite, linter, converters and a pi-durable adapter, published as @centerforagenticai/agent-definitions. docs/format.md describes the file layout, fields, defaults and diagnostics.

npm install @centerforagenticai/agent-definitions

A minimal definition

---
name: reviewer
description: Use after a change passes its tests, to review one bounded diff for defects.
---
You review one change. Report each defect with the file, the line and a case that fails.

name, description and a body make a complete definition. Every other field is optional and has a written default.

Parse a definition

import {
  checkIsolation,
  checkRuntime,
  parseDefinition,
} from "@centerforagenticai/agent-definitions";
import schema from "@centerforagenticai/agent-definitions/schema.json" with { type: "json" };

const parsed = parseDefinition(source, { origin: "project", file: "agents/reviewer.md" });
if (!parsed.ok) {
  for (const diagnostic of parsed.diagnostics) console.error(diagnostic.path, diagnostic.message);
} else {
  const isolation = checkIsolation({
    definition: parsed.definition.workspace.isolation,
    requested: "worktree",
  });
  const runtime = checkRuntime(parsed.definition, {
    runtime: "pi-delegate",
    knownKeys: ["defaultProgress"],
  });
  console.log(parsed.definition, parsed.diagnostics, isolation, runtime, schema.$id);
}

parseDefinition normalizes defaults and compatibility spellings. It returns ok: false exactly when a diagnostic has severity error. See docs/format.md for all fields, diagnostic paths, policy checks, and defaults.

Command line

The package installs the agent-definitions command.

npx @centerforagenticai/agent-definitions lint .pi/agents
npx @centerforagenticai/agent-definitions convert --from claude-code --to agent-definitions .claude/agents/reviewer.md

lint checks files before a runtime loads them. convert is a dry run unless you pass --write, and it prints the lowering report.

Glossary

  • Agent definition: the reusable file that describes one agent. Not a "role".
  • Brief: the input a caller sends for one task.
  • Run: one execution of an agent definition.
  • Actor: a long-lived running agent created from a definition. Runs and actors use the same file; the caller chooses.
  • Model role: a name such as role:reviewer that selects a model and effort only. The runtime's model configuration resolves it. Always write "model role", never a bare "role".
  • User role: access control for the people who use an application. Not related to agent definitions.
  • Runtime: a program that loads definitions and runs agents, such as pi-delegate, Fabric or Claude Code.
  • Adapter: the code that connects one runtime to this format.
  • Lowering report: the list an exporter writes of every field the target format dropped or weakened.

Development

Use Node 24. Run npm install, then npm run check. It runs lint, the format check, the typecheck, the tests with coverage, the build and a package smoke test. CI runs the same command.

Documents

Status

Version 0.1 shipped the schema, parser, validation, discovery and conformance suite. Version 0.2 adds the agent-definitions command with lint and convert, converters for Claude Code, Codex, GitHub Copilot, Gemini CLI, OpenCode and pi-agents, and the pi-durable subpath.

版本与发布记录

@centerforagenticai/agent-definitions 共发布 3 个版本,首次发布于 2026/10/12;过去 12 个月发布了 3 个版本。

版本发布日期距今
0.2.0latest2026/10/1327 天前
0.1.02026/10/1228 天前
0.0.0-stage2026/10/1228 天前

关于 @centerforagenticai/agent-definitions 的常见问题

@centerforagenticai/agent-definitions 是什么?

One file format for coding-agent definitions: schema, parser, conformance suite, linter and converters.

如何安装 @centerforagenticai/agent-definitions?

在项目目录运行 npm install @centerforagenticai/agent-definitions,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 agent-definitions,可以用 npx agent-definitions 直接运行。

@centerforagenticai/agent-definitions 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@centerforagenticai/agent-definitions 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@centerforagenticai/agent-definitions 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=24。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@centerforagenticai/agent-definitions 可以商用吗?

@centerforagenticai/agent-definitions 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@centerforagenticai/agent-definitions 的下载量有多少?

根据 npm 官方下载统计,@centerforagenticai/agent-definitions 在 2026/10/10 – 2026/11/08 这 30 天内被下载 3,789 次,日均约 126 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@centerforagenticai/agent-definitions 还在维护吗?

最新版本 0.2.0 发布于 2026/10/13(27 天前);至今共发布 3 个版本,其中过去 12 个月发布了 3 个;首次发布于 2026/10/12。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。