关于 create-agent
用于创建由 Hindsight 提供长期记忆的 Claude 子 Agent 技能。支持从准备好的目录导入内容,也支持交互式创建,并生成配置了 Hindsight 记忆能力的 Agent 文件。
主要功能
- 01从准备好的目录创建 Agent
- 02导入支持的种子内容
- 03依据模板或内容创建知识页面
- 04交互式创建空 Agent
- 05生成接入 Hindsight 的 Claude Agent 文件
适用场景
- 01根据种子文件夹构建 Agent
- 02不提供种子内容时交互式创建 Agent
- 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(可选)— 定义要创建的确切心智模型
在此模式下:
- 如果存在
bank-template.json,读取它 — 注意mental_models数组 - 使用
agent_knowledge_ingest_file摄取每个内容文件(不包括 bank-template.json) - 创建知识页面:
- 如果
bank-template.json存在:严格按照其mental_models数组创建心智模型(原样使用其id、name、source_query字段) - 否则:根据摄取的内容创建 3 个合理的页面
- 如果
- 使用下面的模板编写子 Agent 文件
- 使用用户命令中的
<name>作为 Agent 名称
模式 B — 空 Agent(交互式):
如果未提供目录路径,询问用户:
- Agent 名称 — 小写并用连字符连接
- 该 Agent 的作用 — 一句话
- 要摄取的任何种子文件/文本(可选)
然后创建子 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>— 你在该目录中的对话会保留到它。"
创建之后
- 确认子 Agent 文件已写入
~/.claude/agents/<name>.md - 告知用户可以使用
@<agent-name>调用该 Agent,或者 Claude 会根据描述自动委派 - 建议运行
/agents或重启 Claude Code 以加载新 Agent
评论
支持 Markdown