setup
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBasic Memory setup
Basic Memory 配置流程
Run a short, adaptive interview (~2-3 minutes) and then write the configuration.
Be conversational and skip questions whose answer is already obvious from
context (e.g. if shows a single local project and no cloud
workspaces, don't ask about cloud/teams — just confirm). Suggest a sensible default
for every question so the user can accept with one word. Don't do any writes until
the interview is done and you've confirmed the plan.
list_memory_projects运行一个简短的自适应引导流程(约2-3分钟),然后写入配置。保持对话式风格,跳过那些从上下文可明显推断出答案的问题(例如,如果显示只有一个本地项目且无云工作区,则无需询问云/团队相关问题——直接确认即可)。为每个问题提供合理的默认选项,用户只需一个词即可确认。在引导流程完成并确认配置方案前,不要执行任何写入操作。
list_memory_projectsPrerequisite check
前置检查
First confirm the Basic Memory MCP server is connected — call
. If that tool isn't available or errors, Basic Memory isn't
wired into Claude Code yet. Stop and walk the user through it first (everything
below depends on it):
list_memory_projects- Install it: (or
uv tool install basic-memory), versionpip install basic-memory.>= 0.19.0 - Connect it: , then restart the session so the MCP server loads.
claude mcp add basic-memory -- uvx basic-memory mcp
Re-check before continuing — don't start the interview until
it succeeds.
list_memory_projects首先确认Basic Memory MCP服务器已连接——调用。如果该工具不可用或报错,说明Basic Memory尚未接入Claude Code。请先引导用户完成连接步骤(后续所有操作均依赖于此):
list_memory_projects- 安装插件:(或
uv tool install basic-memory),版本要求pip install basic-memory。>= 0.19.0 - 连接插件:,然后重启会话以加载MCP服务器。
claude mcp add basic-memory -- uvx basic-memory mcp
继续前请重新检查——确保调用成功后再启动引导流程。
list_memory_projectsInterview
引导流程
Ask only what you can't infer. Cover:
-
Focus / how you'll use it. "What will this project mostly be — code/dev, research, writing, knowledge capture, planning, or a mix?" This answer is load-bearing, not small talk: it drives the folder structure you suggest (step 4) and is stored so the SessionStart brief can surface it, keeping capture matched to the use-case. Don't let it evaporate — if you infer it from context instead of asking, still say the use-case you assumed and the structure it implies, and let the user correct it in one word.
-
Project mapping. "Do you already have a Basic Memory project for this, or should I create one?"
- Existing → show and let them pick. That name becomes
list_memory_projects().primaryProject - New → propose a name (default: this repo's directory name) and create it with
.
create_memory_project- Local project (default): path defaults to ; any connected Basic Memory server can create it.
~/basic-memory/<name>/ - Cloud project (the user wants capture in a cloud workspace): pass the
selector (a slug from
workspace) and a cloud-style path likelist_workspaces, and create it with a cloud-connected MCP server. A purely local server (/<name>) treats the path as a local directory and fails to create it (e.g. read-onlyuvx basic-memory mcp). When both a local and a cloud server are connected, route creation and the schema seeding through the cloud one, and pin/to the new project'sprimaryProjectUUID (collision-proof across workspaces).external_id
- Local project (default): path defaults to
- Existing → show
-
Cloud / teams (skip if there are no extra workspaces). Run. If the user belongs to more than one workspace, they likely have a team workspace alongside their personal/default one. Use
list_workspacesto see the projects in each (note: project names collide across workspaces, so always use the workspace-qualified name, e.g.list_memory_projects, or themy-team-2/notesUUID — never a bare name).external_id- Read from the team (recommended): ask which team projects to pull into the
session brief for recall. Store their qualified names in . These are read-only — recall reads across them; nothing is written to them. Cap: the SessionStart brief reads only the first 6 shared projects per session (a latency/output bound), in list order. If the user wants more than six, order the most relevant first and tell them the rest are configured but not read each session.
secondaryProjects - Share target (optional): if the user wants a place to publish notes to the
team via , add it to
/basic-memory:shareasteamProjects. Sharing is always a manual gesture — auto-capture never writes to a team project."<qualified-name>": { "promoteFolder": "shared" }
Keepa project the user owns for their own capture; team projects are for reading and deliberate sharing only.primaryProject - Read from the team (recommended): ask which team projects to pull into the
session brief for recall. Store their qualified names in
-
Placement — learn or suggest (depends on the project's state). The goal is a shortstring (3-6 lines) telling you where new notes go. How you get it depends on whether the project already has notes:
placementConventions- Existing project with notes → learn. Inspect it: for the folder layout, sample a few notes per folder (and, where a folder holds recurring typed notes, you may run
list_directoryto see their shape). Summarize the real conventions — folder-by-topic layout, naming style, the observation categories they favor. Infer from their actual notes; don't impose.schema_infer - New or empty project → suggest (there's nothing to learn yet). Propose a
light structure that fits the focus from step 1 — 3-5 optional top-level
folders, no deep taxonomy — and be explicit that it's a starting point, not a
scaffold: notes work fine without it and structure can stay emergent. Don't
create empty folders; folders appear as notes land in them. Let the user edit
or decline in one word.
Either way, keep it short and store the result as . The SessionStart brief surfaces it (alongside
placementConventions), so this is what makes your captures land where the user expects — without it, placement is guesswork.captureFolder
- Existing project with notes → learn. Inspect it:
-
Schemas. "I'll add schemas for session checkpoints, decisions, and tasks so I can find them precisely later — okay?" (See "Seed the schemas" below.)
-
How active should I be? (output style) "Want me to proactively capture — search the graph before recalling, write material decisions as typed notes, and cite permalinks? Or keep it quiet (just the session brief, the PreCompact checkpoint, andon demand)?" Enabling it sets
/basic-memory:remember. Default to enabled; leave it off for a recall-only, low-noise setup. (This is the single knob for how proactive the assistant is — the hooks always run regardless.)outputStyle: "basic-memory" -
Shared skills (optional, default yes). "Want the full Basic Memory toolkit — the sharedskills (
memory-*,memory-notes,memory-tasks,memory-research,memory-schema, …)? I can install them alongside this plugin." These are the canonical, framework-agnostic skills (the same set OpenClaw bundles). This plugin ships only the Claude-Code-specific glue and pulls the shared set on demand — it doesn't vendor its own copies. (See "Install the shared skills" below.)memory-defrag
仅询问无法从上下文推断的问题,需覆盖以下内容:
-
使用场景/用途。“这个项目主要用于什么场景——代码开发、研究、写作、知识捕获、规划,还是混合场景?”这个答案至关重要,并非闲聊:它将决定你建议的文件夹结构(步骤4),并会被存储以便SessionStart提示调用,确保捕获内容与使用场景匹配。不要忽略这一步——如果从上下文推断出场景,仍需告知用户你假设的场景及其对应的结构,并允许用户用一个词进行修正。
-
项目映射。“你是否已为此项目创建过Basic Memory项目,还是需要我新建一个?”
- 已有项目 → 调用并让用户选择。所选名称将设为
list_memory_projects()。primaryProject - 新建项目 → 提议一个名称(默认:当前仓库的目录名),并通过创建。
create_memory_project- 本地项目(默认):路径默认为;任何已连接的Basic Memory服务器均可创建。
~/basic-memory/<name>/ - 云项目(用户希望在云工作区中捕获内容):传入选择器(来自
workspace的slug)和类似list_workspaces的云风格路径,并通过云连接的MCP服务器创建。纯本地服务器(/<name>)会将路径视为本地目录,创建可能失败(例如只读的uvx basic-memory mcp目录)。当同时连接本地和云服务器时,通过云服务器完成项目创建和schema初始化,并将/绑定到新项目的primaryProjectUUID(跨工作区无冲突)。external_id
- 本地项目(默认):路径默认为
- 已有项目 → 调用
-
云/团队协作(若无额外工作区则跳过)。调用。如果用户属于多个工作区,他们可能拥有一个团队工作区和个人/默认工作区。使用
list_workspaces查看每个工作区中的项目(注意:项目名称在不同工作区可能重复,因此始终使用工作区限定名称,例如list_memory_projects,或my-team-2/notesUUID——切勿使用裸名称)。external_id- 读取团队项目(推荐):询问要将哪些团队项目纳入会话提示以进行召回。将其限定名称存储在中。这些项目为只读——召回时会跨项目读取,但不会向其写入任何内容。上限:SessionStart提示每次会话仅读取前6个共享项目(受延迟/输出限制),按列表顺序排列。如果用户选择超过6个,需将最相关的项目排在前面,并告知用户其余项目已配置但不会在每次会话中读取。
secondaryProjects - 共享目标(可选):如果用户希望通过将笔记发布到团队,可将其添加到
/basic-memory:share中,格式为teamProjects。共享始终是手动操作——自动捕获绝不会向团队项目写入内容。"<qualified-name>": { "promoteFolder": "shared" }
请将设为用户拥有的个人捕获项目;团队项目仅用于读取和主动共享。primaryProject - 读取团队项目(推荐):询问要将哪些团队项目纳入会话提示以进行召回。将其限定名称存储在
-
存储规范——学习或建议(取决于项目状态)。目标是生成一个简短的字符串(3-6行),告知新笔记的存储位置。获取方式取决于项目是否已有笔记:
placementConventions- 已有笔记的项目 → 学习。检查项目结构:调用查看文件夹布局,每个文件夹抽样查看几个笔记(如果文件夹包含重复类型的笔记,可调用
list_directory查看其结构)。总结实际的存储规范——按主题划分的文件夹布局、命名风格、偏好的分类方式。根据用户的实际笔记进行推断,不要强加规范。schema_infer - 新项目或空项目 → 建议(尚无内容可学习)。根据步骤1确定的使用场景,提出一个轻量化的结构——3-5个可选顶级文件夹,无需深层分类体系,并明确说明这只是起点,并非固定框架:笔记无需结构也能正常使用,结构可逐步形成。不要创建空文件夹;文件夹会在笔记存入时自动生成。允许用户用一个词编辑或拒绝建议。
无论哪种方式,都要保持内容简短,并将结果存储为。SessionStart提示会调用该内容(连同
placementConventions),这是确保捕获内容存放在用户预期位置的关键——若无此配置,存储位置将只能靠猜测。captureFolder
- 已有笔记的项目 → 学习。检查项目结构:调用
-
Schema设置。“我将添加会话检查点、决策和任务的schema,以便后续精准查找——可以吗?”(请参阅下方“初始化schema”部分。)
-
主动程度?(输出风格)。“你希望我主动捕获内容——召回前搜索图谱、将重要决策写入类型化笔记并引用永久链接?还是保持静默(仅提供会话提示、PreCompact检查点,以及按需调用)?”启用主动捕获会设置
/basic-memory:remember。默认启用;若仅需召回功能、低干扰配置则关闭。(这是控制助手主动程度的唯一开关——钩子始终会运行。)outputStyle: "basic-memory" -
共享技能(可选,默认启用)。“你需要完整的Basic Memory工具包——共享的技能(
memory-*、memory-notes、memory-tasks、memory-research、memory-schema等)吗?我可以将它们与该插件一同安装。”这些是标准的、框架无关的技能(与OpenClaw捆绑的技能集相同)。该插件仅包含Claude-Code特定的适配代码,会按需调用共享技能集——不会自带副本。(请参阅下方“安装共享技能”部分。)memory-defrag
Apply (after confirming the plan)
应用配置(确认方案后)
1. Seed the schemas
1. 初始化schema
The plugin ships seed schemas at — that's two directories up
from this skill's directory, then (this skill is at
). Read , , and there.
<plugin>/schemas/schemas/<plugin>/skills/setup/session.mddecision.mdtask.mdFor each one:
- Check whether the chosen project already has a schema for that type
(with
search_notes, or trymetadata_filters={"type": "schema"}). If it exists, skip it — never overwrite a schema the user may have customized.read_note("schemas/<name>") - Otherwise write it with , routed to
write_note(pass it asprimaryProject, or asprojectif it's anproject_idUUID):external_id- ,
directory="schemas",note_type="schema"= the schema's title (Session / Decision / Task).title - = the markdown body only — everything after the
contentfrontmatter block (the---heading and the prose).# Session - = the schema's structured frontmatter as a nested dict:
metadata,entity, the fullversionmap, andschema(keep its nestedsettings, and pass enum values as JSON arrays, e.g.frontmatter).["open","resumed","closed"] - Do not put the schema's frontmatter inside
---. On the cloud write path that nested YAML is silently coerced to the stringcontent(basic-memory-cloud#1000), corrupting'[object Object]'/schema. Thesettingsparam round-trips correctly on both local and cloud. After seeding, verify one note withmetadata—read_note(..., output_format="json", include_frontmatter=true)/schemamust come back as nested objects, not strings.settings
插件在目录下提供了初始schema——路径为当前技能目录向上两级,然后进入(当前技能位于)。读取其中的、和。
<plugin>/schemas/schemas/<plugin>/skills/setup/session.mddecision.mdtask.md针对每个schema:
- 检查所选项目是否已存在该类型的schema(调用并设置
search_notes,或尝试调用metadata_filters={"type": "schema"})。若已存在则跳过——切勿覆盖用户可能已自定义的schema。read_note("schemas/<name>") - 否则通过写入,目标为
write_note(传入primaryProject参数,若为projectUUID则传入external_id):project_id- ,
directory="schemas",note_type="schema"= schema的标题(Session / Decision / Task)。title - = markdown 正文部分——
contentfrontmatter块之后的所有内容(---标题及正文)。# Session - = schema的结构化frontmatter,以嵌套字典形式传入:
metadata、entity、完整的version映射,以及schema(保留其嵌套的settings,枚举值以JSON数组形式传入,例如frontmatter)。["open","resumed","closed"] - 不要将schema的frontmatter放入
---中。在云写入路径中,嵌套YAML会被静默转换为字符串content(basic-memory-cloud#1000),导致'[object Object]'/schema损坏。settings参数在本地和云路径均可正确往返。初始化后,调用metadata验证一个笔记——read_note(..., output_format="json", include_frontmatter=true)/schema必须以嵌套对象形式返回,而非字符串。settings
2. Install the shared skills (if the user opted in)
2. 安装共享技能(若用户选择启用)
First, guard against clobbering a source checkout. If already exists,
is tracked in git, and holds directories, you're inside the skills' own
source repo (e.g. itself) — the install would overwrite the working
copy with published versions. In that case skip the install and tell the user
the skills are already present as source; don't run the command. Quick check:
./skillsmemory-*basic-memorygit ls-files skills/ | grep -q memory- && echo "source repo - skip install"Otherwise, run from the project root:
npx skills add basicmachines-co/basic-memory --path skillsThis installs the canonical skills into the user's skills directory — the
single source of truth, shared with OpenClaw. The plugin does not vendor copies;
it relies on this shared set. If / the CLI isn't available, point the
user at the manual install in the top-level .
memory-*npxskillsskills/README.md首先防止覆盖源码检出。如果已存在、被git跟踪,且包含目录,则当前处于技能的源码仓库中(例如本身)——安装操作会用发布版本覆盖工作副本。这种情况下跳过安装,告知用户技能已作为源码存在;不要运行安装命令。快速检查命令:
./skillsmemory-*basic-memorygit ls-files skills/ | grep -q memory- && echo "source repo - skip install"否则,从项目根目录运行:
npx skills add basicmachines-co/basic-memory --path skills此命令会将标准的技能安装到用户的技能目录中——这是与OpenClaw共享的唯一可信源。该插件不会自带副本;依赖此共享技能集。如果/ CLI不可用,请引导用户查看顶级目录中的手动安装说明。
memory-*npxskillsskills/README.md3. Write settings
3. 写入设置
Build the block from the interview:
basicMemoryjson
{
"basicMemory": {
"primaryProject": "<chosen>",
"secondaryProjects": [],
"captureFolder": "sessions",
"rememberFolder": "bm-remember",
"recallTimeframe": "3d",
"preCompactCapture": "extractive",
"placementConventions": "<learned or suggested summary, or null>",
"teamProjects": {}
},
"outputStyle": "basic-memory"
}Only include if the user opted in. Ask whether this is a team
default (write/merge into , suggest committing it) or
personal (). Merge into any existing file —
read it, add/replace only the keys above, preserve everything else. Use compact,
valid JSON.
outputStyle.claude/settings.json.claude/settings.local.jsonWriting the block is also what stops the SessionStart hook's first-run
nudge — the config's presence is the signal that setup has run.
basicMemory根据引导流程构建配置块:
basicMemoryjson
{
"basicMemory": {
"primaryProject": "<chosen>",
"secondaryProjects": [],
"captureFolder": "sessions",
"rememberFolder": "bm-remember",
"recallTimeframe": "3d",
"preCompactCapture": "extractive",
"placementConventions": "<learned or suggested summary, or null>",
"teamProjects": {}
},
"outputStyle": "basic-memory"
}仅当用户选择启用时才包含。询问用户这是团队默认配置(写入/合并到,建议提交到git)还是个人配置()。合并到现有文件中——读取文件内容,仅添加/替换上述键,保留其他所有内容。使用紧凑、有效的JSON格式。
outputStyle.claude/settings.json.claude/settings.local.json写入配置块也会停止SessionStart钩子的首次运行提示——配置的存在是已完成设置的信号。
basicMemory4. Smoke-test the wiring
4. 连通性冒烟测试
Before you close, prove recall actually resolves — this catches a misnamed project,
missing cloud credentials, or a ref that doesn't route, while the user is still here
to fix it. Run the same structured query the SessionStart hook runs, via the CLI it
uses ( / / ):
basic-memorybmuvx basic-memory- Primary: against
… tool search-notes --type schema --page-size 5— useprimaryProjectfor a UUID,--project-id <uuid>otherwise. It should return the three schemas you just seeded.--project <ref> - One shared project (only if is non-empty): a
secondaryProjectsquery against the first ref. It just needs to return cleanly —--type decision --status openis fine; an error means the ref doesn't route.0 results
If a query errors, or the primary returns nothing, surface it and fix the project
ref before closing — don't let the next session's brief come up empty.
结束前,请验证召回功能是否正常——这可以在用户在场时发现项目名称错误、缺失云凭证或路由引用无效等问题。运行SessionStart钩子使用的结构化查询,通过其使用的CLI(//):
basic-memorybmuvx basic-memory- 主项目:针对运行
primaryProject——若为UUID则使用… tool search-notes --type schema --page-size 5,否则使用--project-id <uuid>。应返回刚才初始化的三个schema。--project <ref> - 一个共享项目(仅当非空时):针对第一个引用运行
secondaryProjects查询。只需返回结果正常即可——--type decision --status open没问题;报错意味着引用路由无效。0 results
如果查询报错,或主项目返回空结果,请告知用户并修复项目引用后再结束——不要让下一次会话的提示内容为空。
Close
结束
Confirm what you did in a few lines: the project mapping, which schemas were seeded
vs. already present, whether placement was learned or suggested, the smoke-test
result, and whether the output style is on.
Then handle activation based on the output style:
- Output style enabled → it's fixed at session start, so the full capture reflexes only take effect next session. Prompt the user to restart the session (start a new Claude Code session) to activate them. Be precise so it doesn't read as "nothing works yet": recall is already live this session (the SessionStart hook's prompt ran), and the PreCompact checkpoint works now too — only the proactive-capture reflexes wait for the restart.
- Output style off → no restart needed; the hooks already run.
End with: "Done — I'll use this from the next message. Run
anytime to see what I'm tracking."
/basic-memory:status用几句话确认已完成的操作:项目映射情况、哪些schema是新初始化的/已存在、存储规范是学习而来还是建议的、冒烟测试结果,以及输出风格是否启用。
然后根据输出风格处理激活:
- 输出风格已启用 → 该设置在会话启动时生效,因此完整的捕获触发功能需等到下一次会话。提示用户重启会话(启动新的Claude Code会话)以激活功能。请明确说明,避免用户误解为“当前无法使用”:本次会话中召回功能已生效(SessionStart钩子的提示已运行),PreCompact检查点也已可用——仅主动捕获触发功能需等待重启。
- 输出风格已关闭 → 无需重启;钩子已在运行。
最后告知用户:“完成——从下一条消息开始我将使用此配置。随时运行查看我正在跟踪的内容。”",
/basic-memory:status