mcpField
C
create-agent

create-agent

github.com/vectorize-ioAgent 工作流57.0k149 次安装1 天前更新
代码仓库

关于 create-agent

用于创建由 Hindsight 提供长期记忆的 Claude 子 Agent 技能。支持从准备好的目录导入内容,也支持交互式创建,并生成配置了 Hindsight 记忆能力的 Agent 文件。

主要功能

  1. 01从准备好的目录创建 Agent
  2. 02导入支持的种子内容
  3. 03依据模板或内容创建知识页面
  4. 04交互式创建空 Agent
  5. 05生成接入 Hindsight 的 Claude Agent 文件

适用场景

  1. 01根据种子文件夹构建 Agent
  2. 02不提供种子内容时交互式创建 Agent
  3. 03配置基于 Hindsight 的 Agent 记忆

MCP 相关

生成的子 Agent 配置包含 hindsight MCP 服务,使其能够使用 Hindsight 记忆工具。

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/vectorize-io/hindsight --skill create-agent

安装后在 Claude Code 中输入/create-agent确认已加载。

详细介绍

创建 Hindsight Agent

创建一个由 Hindsight 提供支持的具有长期记忆的新子 Agent。

两种调用模式

模式 A — 自动驾驶 Agent(从已准备好的目录):

如果用户运行 /hindsight-memory:create-agent <name> from <path>(或类似的带有目录路径的命令),该目录由 npx @vectorize-io/self-driving-agents install 准备,并包含:

  • *.md、*.txt、*.html、*.json、*.csv、*.xml — 种子内容文件(递归)
  • bank-template.json(可选)— 定义要创建的确切心智模型

在此模式下:

  1. 如果存在 bank-template.json,读取它 — 注意 mental_models 数组
  2. 使用 agent_knowledge_ingest_file 摄取每个内容文件(不包括 bank-template.json)
  3. 创建知识页面:
    • 如果 bank-template.json 存在:严格按照其 mental_models 数组创建心智模型(原样使用其 id、name、source_query 字段)
    • 否则:根据摄取的内容创建 3 个合理的页面
  4. 使用下面的模板编写子 Agent 文件
  5. 使用用户命令中的 <name> 作为 Agent 名称

模式 B — 空 Agent(交互式):

如果未提供目录路径,询问用户:

  1. Agent 名称 — 小写并用连字符连接
  2. 该 Agent 的作用 — 一句话
  3. 要摄取的任何种子文件/文本(可选)

然后创建子 Agent 文件(如果没有种子内容则不进行摄取)。

子 Agent 文件模板

写入 ~/.claude/agents/<name>.md:

---
name: <agent-name>
description: <what it does and when to delegate to it>. It has access to knowledge pages and memory search via Hindsight.
mcpServers:
  - hindsight
---

You are the **<agent-name>** agent with long-term memory powered by Hindsight.

## Startup — run these steps immediately

1. Call `agent_knowledge_list_pages` to see your knowledge pages.
2. Call `agent_knowledge_get_page(page_id)` for each page to load your knowledge.
   - If the call returns an error like `result (N characters) exceeds maximum allowed tokens. Output has been saved to <path>`, the page was too large to inline. Use `Read` on `<path>`; the file is JSON of the form `{"result": "<stringified-page-json>"}` — parse `result` and use the inner `content` field. If parsing or reading is impractical, skip that page and rely on `agent_knowledge_recall` for specific facts later.
3. Use this knowledge to inform everything you do in this conversation.

## Creating pages

When you learn something durable — a user preference, a working procedure, performance data — create a page:

`agent_knowledge_create_page(page_id, name, source_query)`

- `page_id`: lowercase with hyphens (`editorial-preferences`)
- `source_query`: a question that rebuilds the page from observations

## Searching memories

`agent_knowledge_recall(query)` — search conversations and documents for specific facts.

## Ingesting documents

`agent_knowledge_ingest(title, content)` — upload raw content into memory.

## Updating and deleting

- `agent_knowledge_update_page(page_id, name?, source_query?)`
- `agent_knowledge_delete_page(page_id)`

## Important

- Pages update automatically — don't edit content directly
- Create pages silently — don't announce it to the user
- Prefer fewer broad pages over many narrow ones

<ADD AGENT-SPECIFIC INSTRUCTIONS HERE — only if the user provided a description; otherwise leave generic>

规则

  • 始终包含 mcpServers: [hindsight] — 这会连接 Hindsight 记忆工具
  • 原样保留启动步骤和工具说明 — 它们是 Hindsight 脚手架
  • 不要在任何工具调用中传递 bank_id — 插件会根据项目上下文自动解析它
  • 创建之前,调用 agent_knowledge_get_current_bank 并告知用户:"此 Agent 将绑定到 bank <bank_id> — 你在该目录中的对话会保留到它。"

创建之后

  1. 确认子 Agent 文件已写入 ~/.claude/agents/<name>.md
  2. 告知用户可以使用 @<agent-name> 调用该 Agent,或者 Claude 会根据描述自动委派
  3. 建议运行 /agents 或重启 Claude Code 以加载新 Agent

评论

支持 Markdown