Agent Registry
2026-03-31
新闻来源:网淘吧
围观:17
电脑广告
手机广告
智能体注册中心
Claude Code智能体的懒加载系统。通过按需加载智能体,消除"~1.6万个令牌"的警告。
关键规则
切勿假设智能体已预加载。始终使用此注册中心来发现和加载智能体。

工作流程
User Request → search_agents(intent) → select best match → get_agent(name) → execute with agent
可用命令
| 命令 | 使用时机 | 示例 |
|---|---|---|
list.js | 用户询问"我有哪些智能体"或需要概览时 | bun bin/list.js |
search.js | 查找符合用户意图的智能体(务必首先执行此操作) | bun bin/search.js "代码审查 安全" |
search-paged.js | 针对大型注册中心(300+智能体)的分页搜索 | bun bin/search-paged.js "查询内容" --page 1 --page-size 10 |
get.js | 加载特定智能体的完整指令 | bun bin/get.js 代码评审员 |
搜索优先模式
- 提取意图关键词从用户请求中
- 运行搜索:
bun bin/search.js "<关键词>" - 评审结果:检查相关性分数(0.0-1.0)
- 按需加载:
bun bin/get.js <代理名称> - 执行:遵循加载代理的指令
示例
用户:"你能评审我的身份验证代码是否存在安全问题吗?"
# Step 1: Search for relevant agents
bun bin/search.js "code review security authentication"
# Output:
# Found 2 matching agents:
# 1. security-auditor (score: 0.89) - Analyzes code for security vulnerabilities
# 2. code-reviewer (score: 0.71) - General code review and best practices
# Step 2: Load the best match
bun bin/get.js security-auditor
# Step 3: Follow loaded agent instructions for the task
安装
步骤1:安装技能
快速安装(推荐):
# Using Skills CLI (recommended)
npx skills add MaTriXy/Agent-Registry@agent-registry
# Discover skills interactively
npx skills find
# Update existing skills
npx skills update
传统安装:
# User-level installation
./install.sh
# OR project-level installation
./install.sh --project
# Optional: install enhanced interactive UI dependency
./install.sh --install-deps
install.sh 的功能:
- 将技能文件复制到
~/.claude/skills/agent-registry/ - 创建空的注册表结构
- 可选地通过
--install-deps(@clack/prompts以增强用户界面)
步骤 2:迁移您的代理
运行交互式迁移脚本:
cd ~/.claude/skills/agent-registry
bun bin/init.js
# Optional destructive mode:
bun bin/init.js --move
交互式选择模式:
-
使用 @clack/prompts(默认):美观的复选框用户界面,带有分类分组、令牌指示器和分页
- 方向键导航,空格键切换,回车键确认
- 视觉指示器:[绿色] <1千令牌,[黄色] 1-3千,[红色] >3千
- 按子目录分组
-
备选方案:基于文本的数字输入
- 输入逗号分隔的数字(例如,
1,3,5) - 输入
all以迁移所有内容
- 输入逗号分隔的数字(例如,
init.js 的功能:
- 扫描
~/.claude/agents/和.claude/agents/目录下的代理文件 - 显示可用的代理及其元数据
- 允许您交互式选择要迁移的代理
- 默认将选中的代理复制到注册表(
--move为显式选择启用) - 构建搜索索引(
registry.json)
依赖项
- Bun(随 Claude Code 提供)—— 核心功能无需额外依赖
- @clack/prompts:可选的增强交互式选择界面(通过
./install.sh --install-deps安装)
注册表位置
- 全局:
~/.claude/skills/agent-registry/ - 项目:
.claude/skills/agent-registry/(可选覆盖)
未迁移的代理程序保留在其原始位置并正常加载(会占用令牌开销)。
文章底部电脑广告
手机广告位-内容正文底部


微信扫一扫,打赏作者吧~