Skip to main content

Agent21

Agent21 是一个项目级 AI 编程代理配置同步 CLI。团队只维护一套工程配置, 即可在 Claude Code、Codex CLI、Cursor、OpenCode 和 Pi 之间同步使用:

  • AGENTS.md:项目指令
  • .agents/skills/:项目 Skills
  • .mcp.json:MCP 服务配置(可选)

Agent21 只管理当前项目,不修改用户的全局 Agent 配置。

当前版本:0.1.1(Alpha)。建议先提交现有项目文件,再执行首次同步。

安装

需要 Python 3.11 或更高版本。

使用 uv(推荐):

uv tool install agent21

或使用 pip:

python -m pip install agent21

确认安装成功:

agent21 --version

快速开始

进入需要统一配置的项目:

cd /path/to/your/project
agent21 init --agents claude,codex,cursor,opencode,pi --mode auto --yes

init 会创建 Agent21 配置目录、缺失的 AGENTS.md.agents/skills/,并复用 已有内容。可选的 .mcp.json 仅在项目已经提供时使用。

随后编辑项目的权威配置,并预览同步计划:

agent21 sync --dry-run

确认计划后执行同步,再检查项目健康状态:

agent21 sync
agent21 doctor

以后修改 AGENTS.md.agents/skills/.mcp.json 后,重新运行 agent21 sync 即可。

常用命令

命令 用途
agent21 init 在当前项目初始化权威配置和 manifest
agent21 sync --dry-run 校验并预览同步计划,不写入文件
agent21 sync 将权威配置同步到已启用且本机可用的 Agent
agent21 doctor 只读检查配置、漂移、Skills、MCP、锁和中断事务
agent21 skill install <source> 从本地目录或显式 Git URL 安装项目 Skill
agent21 skill list 列出 Agent21 管理的项目 Skills
agent21 skill remove <name> 删除未被修改的托管 Skill
agent21 --help 查看完整命令帮助

初始化时可以只启用团队实际使用的 Agent:

agent21 init --agents codex,cursor --mode auto --yes

同步模式支持:

  • auto:平台支持时使用符号链接,否则复制(推荐)
  • copy:始终复制
  • symlink:始终使用符号链接

初始化后也可以编辑 .agents/config.yaml 调整启用的 Agent、同步模式和权威源路径。

管理项目 Skills

本地 Skill 目录必须包含根文件 SKILL.md

agent21 skill install path/to/my-skill
agent21 skill list
agent21 skill remove my-skill

也可以安装显式 Git URL,并按需指定名称:

agent21 skill install https://github.com/example/my-skill.git --name my-skill

Agent21 只复制并记录 Skill 内容,不执行 Skill 代码,也不保存 Git 凭证。

Agent 支持范围

Agent 项目指令 Skills MCP
Claude Code 兼容同步 兼容同步 原生读取 .mcp.json
Codex CLI 原生读取 原生读取 转换为 .codex/config.toml
Cursor 原生读取 原生读取 转换为 .cursor/mcp.json
OpenCode 原生读取 原生读取 暂不支持
Pi 原生读取 原生读取 暂不支持

Agent21 不会安装这些 Agent。同步时,已启用但本机找不到可执行文件的 Agent 会被明确标记为 skipped

安全与冲突处理

  • 不覆盖未由 Agent21 管理的冲突文件。
  • sync --dry-run 在写入前展示已校验的计划。
  • 同步通过事务写入;失败时避免留下部分更新。
  • manifest 记录托管产物及摘要,doctor 可发现手工修改造成的漂移。
  • 诊断输出不会回显 MCP 密钥值,但 .mcp.json 仍应按项目的凭证策略妥善管理。

遇到问题时,先运行:

agent21 doctor
agent21 --help

如果问题仍然存在,请在 GitHub Issues 提交可复现步骤; 安全问题请遵循 SECURITY.md,不要公开提交凭证或漏洞细节。

开发与贡献

README 面向 CLI 使用者。开发环境、测试设计、适配器验证和发布流程分别维护在:

项目采用 MIT License

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agent21-0.1.1.tar.gz (278.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agent21-0.1.1-py3-none-any.whl (37.5 kB view details)

Uploaded Python 3

File details

Details for the file agent21-0.1.1.tar.gz.

File metadata

  • Download URL: agent21-0.1.1.tar.gz
  • Upload date:
  • Size: 278.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for agent21-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5cf27f0c5225893c78571568566d24025a4b6f4a9e3a375cba99f760aec02290
MD5 fb18b947d5d1f45f5d55879e79c7a7b4
BLAKE2b-256 d556ee8f766ca699678f87e1422ce390f87042ae61f20c2fd45afc5f6ba42dd4

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent21-0.1.1.tar.gz:

Publisher: release.yml on jeweis/agent21

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agent21-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: agent21-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 37.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for agent21-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 940cbbc26c01d253d77d5f94d7e36115fe66c8a04951cece4fb5e82affc05455
MD5 66d811074356159f9fe568ccd989b756
BLAKE2b-256 999ead8d1235a9e0ea5d8fdc84c0b0fa9c0ca1433897f4c70ae3bceac5adae49

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent21-0.1.1-py3-none-any.whl:

Publisher: release.yml on jeweis/agent21

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page