Basic Memory setup
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 list_memory_projects 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.
Prerequisite check
First confirm the Basic Memory MCP server is connected — call
list_memory_projects. 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):
- Install it:
uv tool install basic-memory (or pip install basic-memory),
version >= 0.19.0.
- Connect it:
claude mcp add basic-memory -- uvx basic-memory mcp, then restart
the session so the MCP server loads.
Re-check list_memory_projects before continuing — don't start the interview until
it succeeds.
Interview
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
list_memory_projects() and let them pick. That name becomes
primaryProject.
- New → propose a name (default: this repo's directory name) and create it with
create_memory_project.
- Local project (default): path defaults to
~/basic-memory/<name>/; any
connected Basic Memory server can create it.
- Cloud project (the user wants capture in a cloud workspace): pass the
workspace selector (a slug from list_workspaces) and a cloud-style path
like /<name>, and create it with a cloud-connected MCP server. A purely
local server (uvx basic-memory mcp) treats the path as a local directory and
fails to create it (e.g. read-only /). When both a local and a cloud server
are connected, route creation and the schema seeding through the cloud one,
and pin primaryProject to the new project's external_id UUID
(collision-proof across workspaces).
Cloud / teams (skip if there are no extra workspaces). Run
list_workspaces. If the user belongs to more than one workspace, they likely
have a team workspace alongside their personal/default one. Use
list_memory_projects to see the projects in each (note: project names collide
across workspaces, so always use the workspace-qualified name, e.g.
my-team-2/notes, or the external_id UUID — never a bare name).
- Read from the team (recommended): ask which team projects to pull into the
session brief for recall. Store their qualified names in
secondaryProjects.
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.
- Share target (optional): if the user wants a place to publish notes to the
team via
/basic-memory:share, add it to teamProjects as
"<qualified-name>": { "promoteFolder": "shared" }. Sharing is always a manual
gesture — auto-capture never writes to a team project.
Keep primaryProject a project the user owns for their own capture; team
projects are for reading and deliberate sharing only.
Placement — learn or suggest (depends on the project's state). The goal is a
short placementConventions string (3-6 lines) telling you where new notes go.
How you get it depends on whether the project already has notes:
- Existing project with notes → learn. Inspect it:
list_directory for the
folder layout, sample a few notes per folder (and, where a folder holds
recurring typed notes, you may run schema_infer to 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.
- 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
placementConventions. The
SessionStart brief surfaces it (alongside captureFolder), so this is what makes
your captures land where the user expects — without it, placement is guesswork.
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, and /basic-memory:remember on demand)?" Enabling it sets
outputStyle: "basic-memory". 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.)
Shared skills (optional, default yes). "Want the full Basic Memory toolkit —
the shared memory-* skills (memory-notes, memory-tasks, memory-research,
memory-schema, memory-defrag, …)? 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.)
Apply (after confirming the plan)
1. Seed the schemas
The plugin ships seed schemas at <plugin>/schemas/ — that's two directories up
from this skill's directory, then schemas/ (this skill is at
<plugin>/skills/setup/). Read session.md, decision.md, and task.md there.
For each one:
- Check whether the chosen project already has a schema for that type
(
search_notes with metadata_filters={"type": "schema"}, or try
read_note("schemas/<name>")). If it exists, skip it — never overwrite a
schema the user may have customized.
- Otherwise write it with
write_note, routed to primaryProject (pass it as
project, or as project_id if it's an external_id UUID):
directory="schemas", note_type="schema", title = the schema's title
(Session / Decision / Task).
content = the markdown body only — everything after the ---
frontmatter block (the # Session heading and the prose).
metadata = the schema's structured frontmatter as a nested dict: entity,
version, the full schema map, and settings (keep its nested frontmatter,
and pass enum values as JSON arrays, e.g. ["open","resumed","closed"]).
- Do not put the schema's
--- frontmatter inside content. On the cloud
write path that nested YAML is silently coerced to the string '[object Object]'
(basic-memory-cloud#1000), corrupting schema/settings. The metadata param
round-trips correctly on both local and cloud. After seeding, verify one note
with read_note(..., output_format="json", include_frontmatter=true) —
schema/settings must come back as nested objects, not strings.
2. Install the shared skills (if the user opted in)
First, guard against clobbering a source checkout. If ./skills already exists,
is tracked in git, and holds memory-* directories, you're inside the skills' own
source repo (e.g. basic-memory 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:
git 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 skills
This installs the canonical memory-* 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 npx / the skills CLI isn't available, point the
user at the manual install in the top-level skills/README.md.
3. Write settings
Build the basicMemory block from the interview:
{
"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 outputStyle if the user opted in. Ask whether this is a team
default (write/merge into .claude/settings.json, suggest committing it) or
personal (.claude/settings.local.json). Merge into any existing file —
read it, add/replace only the keys above, preserve everything else. Use compact,
valid JSON.
Writing the basicMemory block is also what stops the SessionStart hook's first-run
nudge — the config's presence is the signal that setup has run.
4. Smoke-test the wiring
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-memory / bm / uvx basic-memory):
- Primary:
… tool search-notes --type schema --page-size 5 against
primaryProject — use --project-id <uuid> for a UUID, --project <ref>
otherwise. It should return the three schemas you just seeded.
- One shared project (only if
secondaryProjects is non-empty): a
--type decision --status open query against the first ref. It just needs to
return cleanly — 0 results is fine; an error means the ref doesn't route.
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.
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 /basic-memory:status
anytime to see what I'm tracking."
1---2name: setup-33description: Set up the Basic Memory plugin for this project — a short guided interview that configures the project mapping, seeds note schemas, learns or suggests placement conventions, and enables capture reflexes. Use when the user runs /basic-memory:setup, says "set up basic memory", or asks to configure/bootstrap the plugin.4---56# Basic Memory setup78Run a short, adaptive interview (~2-3 minutes) and then write the configuration.9Be conversational and **skip questions whose answer is already obvious** from10context (e.g. if `list_memory_projects` shows a single local project and no cloud11workspaces, don't ask about cloud/teams — just confirm). Suggest a sensible default12for every question so the user can accept with one word. Don't do any writes until13the interview is done and you've confirmed the plan.1415## Prerequisite check1617First confirm the **Basic Memory MCP server is connected** — call18`list_memory_projects`. If that tool isn't available or errors, Basic Memory isn't19wired into Claude Code yet. **Stop and walk the user through it first** (everything20below depends on it):21221. Install it: `uv tool install basic-memory` (or `pip install basic-memory`),23 version `>= 0.19.0`.242. Connect it: `claude mcp add basic-memory -- uvx basic-memory mcp`, then restart25 the session so the MCP server loads.2627Re-check `list_memory_projects` before continuing — don't start the interview until28it succeeds.2930## Interview3132Ask only what you can't infer. Cover:33341. **Focus / how you'll use it.** "What will this project mostly be — code/dev,35 research, writing, knowledge capture, planning, or a mix?" This answer is36 **load-bearing**, not small talk: it drives the folder structure you suggest37 (step 4) and is stored so the SessionStart brief can surface it, keeping capture38 matched to the use-case. Don't let it evaporate — if you infer it from context39 instead of asking, still say the use-case you assumed and the structure it40 implies, and let the user correct it in one word.41422. **Project mapping.** "Do you already have a Basic Memory project for this, or43 should I create one?"44 - Existing → show `list_memory_projects()` and let them pick. That name becomes45 `primaryProject`.46 - New → propose a name (default: this repo's directory name) and create it with47 `create_memory_project`.48 - *Local project* (default): path defaults to `~/basic-memory/<name>/`; any49 connected Basic Memory server can create it.50 - *Cloud project* (the user wants capture in a cloud workspace): pass the51 `workspace` selector (a slug from `list_workspaces`) and a cloud-style path52 like `/<name>`, and create it with a **cloud-connected** MCP server. A purely53 local server (`uvx basic-memory mcp`) treats the path as a local directory and54 fails to create it (e.g. read-only `/`). When both a local and a cloud server55 are connected, route creation *and* the schema seeding through the cloud one,56 and pin `primaryProject` to the new project's `external_id` UUID57 (collision-proof across workspaces).58593. **Cloud / teams** (skip if there are no extra workspaces). Run60 `list_workspaces`. If the user belongs to more than one workspace, they likely61 have a **team** workspace alongside their personal/default one. Use62 `list_memory_projects` to see the projects in each (note: project names collide63 across workspaces, so always use the **workspace-qualified name**, e.g.64 `my-team-2/notes`, or the `external_id` UUID — never a bare name).65 - **Read from the team** (recommended): ask which team projects to pull into the66 session brief for recall. Store their qualified names in `secondaryProjects`.67 These are **read-only** — recall reads across them; nothing is written to them.68 **Cap:** the SessionStart brief reads only the first **6** shared projects per69 session (a latency/output bound), in list order. If the user wants more than70 six, order the most relevant first and tell them the rest are configured but71 not read each session.72 - **Share target** (optional): if the user wants a place to *publish* notes to the73 team via `/basic-memory:share`, add it to `teamProjects` as74 `"<qualified-name>": { "promoteFolder": "shared" }`. Sharing is always a manual75 gesture — auto-capture never writes to a team project.7677 Keep `primaryProject` a project the user owns for their *own* capture; team78 projects are for reading and deliberate sharing only.79804. **Placement — learn or suggest** (depends on the project's state). The goal is a81 short `placementConventions` string (3-6 lines) telling you where new notes go.82 How you get it depends on whether the project already has notes:83 - **Existing project with notes** → *learn*. Inspect it: `list_directory` for the84 folder layout, sample a few notes per folder (and, where a folder holds85 recurring typed notes, you may run `schema_infer` to see their shape).86 Summarize the *real* conventions — folder-by-topic layout, naming style, the87 observation categories they favor. Infer from their actual notes; don't impose.88 - **New or empty project** → *suggest* (there's nothing to learn yet). Propose a89 **light** structure that fits the focus from step 1 — 3-5 optional top-level90 folders, no deep taxonomy — and be explicit that it's a starting point, not a91 scaffold: notes work fine without it and structure can stay emergent. Don't92 create empty folders; folders appear as notes land in them. Let the user edit93 or decline in one word.94 Either way, keep it short and store the result as `placementConventions`. The95 SessionStart brief surfaces it (alongside `captureFolder`), so this is what makes96 your captures land where the user expects — without it, placement is guesswork.97985. **Schemas.** "I'll add schemas for session checkpoints, decisions, and tasks so99 I can find them precisely later — okay?" (See "Seed the schemas" below.)1001016. **How active should I be? (output style)** "Want me to proactively capture —102 search the graph before recalling, write material decisions as typed notes, and103 cite permalinks? Or keep it quiet (just the session brief, the PreCompact104 checkpoint, and `/basic-memory:remember` on demand)?" Enabling it sets105 `outputStyle: "basic-memory"`. Default to enabled; leave it off for a recall-only,106 low-noise setup. (This is the single knob for how proactive the assistant is —107 the hooks always run regardless.)1081097. **Shared skills** (optional, default yes). "Want the full Basic Memory toolkit —110 the shared `memory-*` skills (`memory-notes`, `memory-tasks`, `memory-research`,111 `memory-schema`, `memory-defrag`, …)? I can install them alongside this plugin."112 These are the canonical, framework-agnostic skills (the same set OpenClaw bundles).113 This plugin ships only the Claude-Code-specific glue and pulls the shared set on114 demand — it doesn't vendor its own copies. (See "Install the shared skills" below.)115116## Apply (after confirming the plan)117118### 1. Seed the schemas119The plugin ships seed schemas at `<plugin>/schemas/` — that's **two directories up120from this skill's directory, then `schemas/`** (this skill is at121`<plugin>/skills/setup/`). Read `session.md`, `decision.md`, and `task.md` there.122123For each one:124- Check whether the chosen project already has a schema for that type125 (`search_notes` with `metadata_filters={"type": "schema"}`, or try126 `read_note("schemas/<name>")`). **If it exists, skip it** — never overwrite a127 schema the user may have customized.128- Otherwise write it with `write_note`, routed to `primaryProject` (pass it as129 `project`, or as `project_id` if it's an `external_id` UUID):130 - `directory="schemas"`, `note_type="schema"`, `title` = the schema's title131 (Session / Decision / Task).132 - `content` = the markdown **body only** — everything *after* the `---`133 frontmatter block (the `# Session` heading and the prose).134 - `metadata` = the schema's structured frontmatter as a **nested dict**: `entity`,135 `version`, the full `schema` map, and `settings` (keep its nested `frontmatter`,136 and pass enum values as JSON arrays, e.g. `["open","resumed","closed"]`).137 - **Do not** put the schema's `---` frontmatter inside `content`. On the cloud138 write path that nested YAML is silently coerced to the string `'[object Object]'`139 (basic-memory-cloud#1000), corrupting `schema`/`settings`. The `metadata` param140 round-trips correctly on both local and cloud. After seeding, verify one note141 with `read_note(..., output_format="json", include_frontmatter=true)` —142 `schema`/`settings` must come back as nested objects, not strings.143144### 2. Install the shared skills (if the user opted in)145**First, guard against clobbering a source checkout.** If `./skills` already exists,146is tracked in git, and holds `memory-*` directories, you're inside the skills' own147source repo (e.g. `basic-memory` itself) — the install would overwrite the working148copy with published versions. In that case **skip the install** and tell the user149the skills are already present as source; don't run the command. Quick check:150151```152git ls-files skills/ | grep -q memory- && echo "source repo - skip install"153```154155Otherwise, run from the project root:156157```158npx skills add basicmachines-co/basic-memory --path skills159```160161This installs the canonical `memory-*` skills into the user's skills directory — the162single source of truth, shared with OpenClaw. The plugin does **not** vendor copies;163it relies on this shared set. If `npx` / the `skills` CLI isn't available, point the164user at the manual install in the top-level [`skills/README.md`](../../../../skills/README.md).165166### 3. Write settings167Build the `basicMemory` block from the interview:168169```json170{171 "basicMemory": {172 "primaryProject": "<chosen>",173 "secondaryProjects": [],174 "captureFolder": "sessions",175 "rememberFolder": "bm-remember",176 "recallTimeframe": "3d",177 "preCompactCapture": "extractive",178 "placementConventions": "<learned or suggested summary, or null>",179 "teamProjects": {}180 },181 "outputStyle": "basic-memory"182}183```184Only include `outputStyle` if the user opted in. Ask whether this is a **team185default** (write/merge into `.claude/settings.json`, suggest committing it) or186**personal** (`.claude/settings.local.json`). **Merge** into any existing file —187read it, add/replace only the keys above, preserve everything else. Use compact,188valid JSON.189190Writing the `basicMemory` block is also what stops the SessionStart hook's first-run191nudge — the config's presence is the signal that setup has run.192193### 4. Smoke-test the wiring194Before you close, prove recall actually resolves — this catches a misnamed project,195missing cloud credentials, or a ref that doesn't route, while the user is still here196to fix it. Run the same structured query the SessionStart hook runs, via the CLI it197uses (`basic-memory` / `bm` / `uvx basic-memory`):198199- **Primary:** `… tool search-notes --type schema --page-size 5` against200 `primaryProject` — use `--project-id <uuid>` for a UUID, `--project <ref>`201 otherwise. It should return the three schemas you just seeded.202- **One shared project** (only if `secondaryProjects` is non-empty): a203 `--type decision --status open` query against the first ref. It just needs to204 return *cleanly* — `0 results` is fine; an **error** means the ref doesn't route.205206If a query errors, or the primary returns nothing, surface it and fix the project207ref before closing — don't let the next session's brief come up empty.208209## Close210211Confirm what you did in a few lines: the project mapping, which schemas were seeded212vs. already present, whether placement was learned or suggested, the smoke-test213result, and whether the output style is on.214215Then handle activation based on the output style:216- **Output style enabled** → it's fixed at session start, so the full capture217 reflexes only take effect next session. Prompt the user to **restart the session**218 (start a new Claude Code session) to activate them. Be precise so it doesn't read219 as "nothing works yet": recall is already live this session (the SessionStart220 hook's prompt ran), and the PreCompact checkpoint works now too — only the221 proactive-capture reflexes wait for the restart.222- **Output style off** → no restart needed; the hooks already run.223224End with: *"Done — I'll use this from the next message. Run `/basic-memory:status`225anytime to see what I'm tracking."*