Skip to content

Commit 7ab99dd

Browse files
authored
feat(skills): add memory-onboarding skill (#1050)
Signed-off-by: Cody Faust <cody@luminarysol.com>
1 parent e57ee07 commit 7ab99dd

10 files changed

Lines changed: 723 additions & 4 deletions

File tree

integrations/openclaw/commands/skills.ts

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { existsSync, readFileSync } from "node:fs"
1+
import { existsSync, readdirSync, readFileSync } from "node:fs"
22
import { dirname, resolve } from "node:path"
33
import { fileURLToPath } from "node:url"
44
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/plugin-entry"
@@ -39,13 +39,62 @@ function loadSkill(skillsDir: string, dir: string): string {
3939
return readFileSync(resolve(skillsDir, dir, "SKILL.md"), "utf-8")
4040
}
4141

42+
/**
43+
* List a skill's bundled resource files (references/, assets/, ...) so the
44+
* command can tell the assistant where they live on disk. SKILL.md workflows
45+
* reference these by relative path; without the mapping, bundled commands
46+
* would direct the assistant to files it was never given. evals/ is excluded
47+
* as test fixtures.
48+
*/
49+
function listResourceFiles(skillsDir: string, dir: string): string[] {
50+
const root = resolve(skillsDir, dir)
51+
const files: string[] = []
52+
const walk = (rel: string) => {
53+
for (const entry of readdirSync(resolve(root, rel), {
54+
withFileTypes: true,
55+
})) {
56+
const relPath = rel ? `${rel}/${entry.name}` : entry.name
57+
if (entry.isDirectory()) {
58+
if (relPath !== "evals") walk(relPath)
59+
} else if (relPath !== "SKILL.md") {
60+
files.push(relPath)
61+
}
62+
}
63+
}
64+
walk("")
65+
return files.sort()
66+
}
67+
68+
function resourceSection(
69+
skillsDir: string,
70+
dir: string,
71+
files: string[],
72+
): string {
73+
if (files.length === 0) return ""
74+
const lines = files
75+
.map((f) => `- \`${f}\` → ${resolve(skillsDir, dir, f)}`)
76+
.join("\n")
77+
return (
78+
"\n\n## Bundled resource files\n\n" +
79+
"This skill references companion files by relative path. They are installed at:\n\n" +
80+
`${lines}\n\n` +
81+
"When the workflow directs you to read one of these files, read it from the absolute path listed above."
82+
)
83+
}
84+
4285
export function registerSkillCommands(api: OpenClawPluginApi): void {
4386
const skillsDir = resolveSkillsDir(api)
4487
const manifest = loadManifest(skillsDir)
4588

4689
for (const entry of manifest) {
4790
const commandName = entry.dir.replace(/^memory-/, "")
48-
const content = loadSkill(skillsDir, entry.dir)
91+
const content =
92+
loadSkill(skillsDir, entry.dir) +
93+
resourceSection(
94+
skillsDir,
95+
entry.dir,
96+
listResourceFiles(skillsDir, entry.dir),
97+
)
4998

5099
api.registerCommand({
51100
name: commandName,

integrations/openclaw/openclaw.plugin.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"skills/memory-literary-analysis",
2727
"skills/memory-metadata-search",
2828
"skills/memory-notes",
29+
"skills/memory-onboarding",
2930
"skills/memory-reflect",
3031
"skills/memory-research",
3132
"skills/memory-schema",

integrations/openclaw/scripts/fetch-skills.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
/**
22
* Copy all memory-* skills from the top-level basic-memory skills source.
33
*
4-
* Auto-discovers skill directories in ../../../skills, copies each SKILL.md
5-
* into this package's skills/<dir>/SKILL.md, and generates skills/manifest.json.
4+
* Auto-discovers skill directories in ../../../skills, copies each skill's
5+
* SKILL.md plus any bundled resources (references/, evals/, assets/, ...)
6+
* into this package's skills/<dir>/, and generates skills/manifest.json.
67
*/
78

89
import {
10+
cpSync,
911
existsSync,
1012
mkdirSync,
1113
readdirSync,
1214
readFileSync,
15+
rmSync,
1316
writeFileSync,
1417
} from "node:fs"
1518
import { dirname, resolve } from "node:path"
@@ -80,8 +83,25 @@ function main() {
8083
const meta = parseFrontmatter(content)
8184

8285
const outDir = resolve(SKILLS_DIR, dir)
86+
// Clear any previously generated copy so files deleted or renamed in
87+
// the source skill don't survive as stale artifacts in the package.
88+
rmSync(outDir, { recursive: true, force: true })
8389
mkdirSync(outDir, { recursive: true })
8490
writeFileSync(resolve(outDir, "SKILL.md"), content)
91+
92+
// Copy bundled resources (references/, evals/, assets/, ...) so
93+
// multi-file skills stay self-contained in the generated package.
94+
for (const entry of readdirSync(resolve(SOURCE_SKILLS_DIR, dir), {
95+
withFileTypes: true,
96+
})) {
97+
if (entry.name === "SKILL.md") continue
98+
cpSync(
99+
resolve(SOURCE_SKILLS_DIR, dir, entry.name),
100+
resolve(outDir, entry.name),
101+
{ recursive: true },
102+
)
103+
}
104+
85105
manifest.push({ dir, name: meta.name, description: meta.description })
86106
console.log(` ✓ ${dir}`)
87107
}

skills/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Basic Memory provides the MCP server — tools like `write_note`, `search_notes`
2727
| **memory-research** | Web research synthesized into Basic Memory entities. Researches a subject, checks for existing knowledge, presents findings, and creates entity notes. | When asked to research a company, person, technology, or topic. |
2828
| **memory-literary-analysis** | Analyze a complete literary work into a structured knowledge graph — characters, themes, chapters, locations, symbols, and literary devices. | Full-text literary analysis, book club companions, teaching resources, or research projects. |
2929
| **memory-continue** | Resume prior work by rebuilding context from the knowledge graph — `build_context` via `memory://` URLs, recent activity, and search, then read the key notes. | Starting a session, or when the user says "continue with...", "back to...", or "where were we?" |
30+
| **memory-onboarding** | Guided onboarding for people new to Basic Memory — interview, blueprint, approval gate, then build a full system: schemas, templates, instruction notes, a startup router, indexes, and real seed notes, plus assistant setup so the rules load every session. | When a user is new to Basic Memory, doesn't know what to use it for, wants structure in an empty or messy project, or wants their assistant to follow consistent rules across sessions. |
3031

3132
## Basic Memory Cloud
3233

skills/memory-onboarding/SKILL.md

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
---
2+
name: memory-onboarding
3+
description: "Guide someone new to Basic Memory through designing and building a complete personal knowledge system — interview them about what they want to track, propose a structure, build it with schemas and instruction notes, teach them to use it, and set up their AI assistant to load it automatically. Use this skill whenever a user says they're new to Basic Memory, wants to 'get started', 'set up', or 'onboard' with Basic Memory, doesn't know what to use it for, asks how to organize their memory project or knowledge base, wants help designing folders/schemas/conventions, or asks how to make their assistant remember context between sessions. Also use it when a user has an empty or messy Basic Memory project and wants structure."
4+
---
5+
6+
# Basic Memory Onboarding
7+
8+
You are guiding a person who is new to Basic Memory through building a knowledge system that fits *their* life — then teaching them to use it and wiring it into their AI assistant so every future session starts already knowing the rules.
9+
10+
This skill works with any LLM or assistant platform. Where platform-specific setup is needed (system prompts, project instructions), identify what YOUR environment supports and adapt the generic patterns in `references/assistant-setup.md`.
11+
12+
## Why this approach
13+
14+
Basic Memory is markdown files parsed into a knowledge graph. A pile of unstructured notes is barely better than a folder of text files. The compounding value comes from four things this skill installs from day one:
15+
16+
1. **Schemas** — note types with defined fields, so every task/contact/expense note looks the same and can be queried structurally.
17+
2. **Observations and relations** — categorized facts (`- [status] active`) and typed links (`- depends_on [[Other Note]]`) that turn prose into a graph.
18+
3. **Instruction notes** — the rules of the system live *inside* the system, as notes the assistant loads at session start. The knowledge base becomes self-describing.
19+
4. **A startup router** — one small note that tells any assistant, on any platform, exactly what to load for each kind of task.
20+
21+
**Two of these are never optional, at any scale:** every note type in the blueprint gets a schema, and every note written carries an Observations section with at least one `[category]` fact. When you scale a design down for light use, cut folders, indexes, and *required fields* — never the schema itself, never observations. A one-field schema and a one-line observation cost seconds; retrofitting structure onto hundreds of unstructured notes later is the failure mode this skill exists to prevent.
22+
23+
## Speak Plainly — the User Doesn't Know the Jargon
24+
25+
The person you're onboarding has likely never heard the words "schema", "observation", "frontmatter", or "knowledge graph" — and they never need to learn them to benefit from any of them. The structure is for you; the conversation is for them.
26+
27+
- Introduce each concept in plain words at the moment it becomes relevant: a schema is "a template that keeps every note of the same kind consistent, so I can reliably answer things like 'what's overdue?'"; observations are "the key facts on a note, tagged so they're easy to find later"; relations are "links between notes, so one thing leads to the next".
28+
- **The user never writes syntax.** You handle the `[category]` lines, wiki-links, and validation under the covers — they just talk. Say this explicitly; it's reassuring.
29+
- One concept at a time, and only when it earns its place. If you catch yourself defining three terms in one breath, stop explaining and build something with their data instead — the example teaches better than the definition.
30+
31+
## Workflow overview
32+
33+
```
34+
Phase 0 Preflight — verify tools, pick/create project, assess existing content
35+
Phase 1 Interview — what do they want to track? (suggest if they don't know)
36+
Phase 2 Blueprint — propose full structure; iterate until approved
37+
Phase 3 Build — schemas → templates → instruction notes → indexes → seed notes
38+
Phase 4 Assistant setup — persistent instructions that load the router every session
39+
Phase 5 Teach — hands-on exercises with their real data
40+
Phase 6 Grow — suggest expansions and a maintenance cadence
41+
```
42+
43+
Do not skip the approval gate between Phase 2 and Phase 3. Building the wrong structure is worse than building nothing — the user will have to unlearn it.
44+
45+
## Phase 0 — Preflight
46+
47+
Before asking the user anything:
48+
49+
1. Confirm Basic Memory tools are available (`write_note`, `read_note`, `search_notes`, `list_directory`, and ideally `schema_infer`/`schema_validate`). If they aren't, stop and help the user connect Basic Memory first.
50+
2. List their projects (`list_memory_projects`). Ask which project to build in, or whether to create a fresh one. **Every subsequent call must pass this project explicitly** — mixed-project writes are one of the most common and painful setup errors.
51+
3. Check for existing content (`list_directory` at root, depth 2). Three situations:
52+
- **Empty** — greenfield, proceed normally.
53+
- **A few scattered notes** — proceed, and plan to fold existing notes into the new structure during Phase 3.
54+
- **Substantial existing content** — this is a restructure, not an onboarding. Still use this skill, but Phase 1 becomes "what's working and what isn't", and Phase 2 must map old → new locations before anything moves.
55+
4. **Check the live docs when unsure.** Basic Memory's documentation is agent-readable: fetch `https://docs.basicmemory.com/llms.txt` for an index, and any page as clean markdown via its `raw/....md` URL (e.g. `raw/reference/mcp-tools-reference.md`, `raw/concepts/schema-system.md`). Tool names and parameters evolve — when this skill and the docs disagree, the docs are canonical.
56+
57+
## Phase 1 — Interview
58+
59+
Ask **one question at a time**, conversationally. Never present a wall of questions. What you need to learn:
60+
61+
1. **Domains** — what do they want to keep track of? If they have ideas, dig into each: what specifically, how often, what does "done" look like?
62+
2. **If they have no idea**, offer a concrete menu and ask what resonates (multi-select). Good starting domains, roughly in order of broad appeal:
63+
- **Tasks & projects** — todos, deadlines, multi-step projects
64+
- **Notes & journal** — daily notes, ideas, things learned
65+
- **People & contacts** — who they know, context per person, follow-ups
66+
- **Research** — topics they're digging into, sources, findings
67+
- **Finances** — subscriptions, expenses, accounts, renewals
68+
- **Procedures** — how-tos they keep re-figuring-out (home, work, tech)
69+
- **Health & habits** — workouts, symptoms, routines
70+
- **Assets** — home inventory, devices, warranties, serial numbers
71+
For each domain they pick, `references/domain-playbooks.md` has a starter kit: folders, a schema, naming conventions, and an example note. Read it before proposing the blueprint.
72+
3. **Volume and cadence** — a system for 5 notes a week looks different from one for 50. Light use → fewer folders, fewer required fields.
73+
4. **One real example per domain** — "tell me about a task on your plate right now" / "one subscription you pay for". These become the seed notes in Phase 3 and make every later phase concrete instead of hypothetical.
74+
5. **What they've tried before** — if a previous system failed, find out why. Design against that failure.
75+
76+
Start with 2–3 domains even if they're excited about six. A small system that works grows; a sprawling empty scaffold dies. Note the deferred domains for Phase 6.
77+
78+
## Phase 2 — Blueprint
79+
80+
Read `references/conventions.md` and `references/schema-guide.md` now if you haven't. Then present ONE document (in chat, not yet written anywhere) containing:
81+
82+
1. **Folder tree** — the full proposed directory structure with one-line purpose per folder. Include `Schemas/`, `Templates/`, and an `Instructions/` (or `Meta/`) folder alongside the domain folders.
83+
2. **Schemas table** — one row per note type: schema name, note_type, required observations, optional observations, status enum values.
84+
3. **Naming conventions** — title format per note type, date formats, status vocabularies.
85+
4. **Instruction notes** — the startup router plus one instruction note per domain (see `references/conventions.md` for anatomy).
86+
5. **The discipline rules** they'll live by — search before create, exact-casing paths, changelog rows, index updates, bidirectional links — each with a one-line "why".
87+
88+
Walk through it, invite pushback, and iterate. Scale to their answers — but scaling means fewer folders, fewer indexes, and fewer *required* fields, never dropping schemas or observations (see the non-negotiables above). Get an explicit "yes, build it" before Phase 3.
89+
90+
## Phase 3 — Build
91+
92+
Build in this order — later items reference earlier ones:
93+
94+
1. **Schemas**`Schemas/` folder, one note per type, `validation: warn`. Syntax in `references/schema-guide.md`.
95+
2. **Templates**`Templates/`, one per note type, matching the schema exactly.
96+
3. **Instruction notes** → per-domain rules notes, then the **startup router** last (it links everything). Full anatomy and a worked example in `references/conventions.md`.
97+
4. **Index notes** → one per domain that needs one (tables of contents; not every domain does).
98+
5. **Migrate existing notes** *(restructure path)* → execute the approved old→new mapping from Phase 2 before seeding anything: move each existing note to its new home, set its note type, add the observations its schema requires, and update indexes as notes land. Archive what doesn't fit — never delete. Phase 3 is not done while anything still sits unorganized at the root.
99+
6. **Seed notes** → 2–3 REAL notes per domain using the examples collected in Phase 1. Never seed with placeholder data — real notes teach the format and are immediately useful; fake ones are noise the user must delete.
100+
7. **Validate** → run `schema_validate` on the seed notes AND any migrated notes; fix anything it flags. Read back the router and one instruction note to confirm links resolve.
101+
102+
Follow the write discipline in `references/conventions.md` throughout — most importantly: search before creating anything, use exact folder casing, and watch write results for duplicate-suffixed permalinks (`-1`, `-2`).
103+
104+
## Phase 4 — Assistant setup
105+
106+
The system only works if the assistant loads the rules every session — otherwise the user is the only one who knows the conventions, which defeats the point.
107+
108+
Read `references/assistant-setup.md` and set up (or hand the user exact text for) a **persistent instruction stub**: a short block in whatever always-loaded mechanism their platform provides (project instructions, custom instructions, system prompt, agent context file) that says, in essence: *"Before any knowledge-base work, read the startup router note in project X and follow its dispatch table."*
109+
110+
Identify what mechanism YOUR platform offers and give concrete, platform-specific steps. If you cannot determine the platform, present the generic stub and the common placements from the reference file. End Phase 4 with the verification test described there (simulate a fresh session; confirm the router gets loaded and followed).
111+
112+
## Phase 5 — Teach
113+
114+
Teach by doing, with their data — not by lecturing. Run short exercises:
115+
116+
1. **Capture** — "Tell me something that came up today" → create the note together, narrating the schema fields and observations as you fill them.
117+
2. **Retrieve** — have them ask for something ("what's on my plate?", "what do I know about X?") → demonstrate `search_notes` and reading via `memory://` links; explain title-search vs semantic search for names.
118+
3. **Update** — change a status, append an observation, add a changelog row — showing `edit_note` for targeted changes vs full overwrites.
119+
4. **Connect** — add a relation between two of their notes; show how `build_context` walks the graph.
120+
121+
Then write a **cheat-sheet note** into their KB (`Instructions/` folder): the phrases they can say, what happens for each, and the core rules. This note is theirs — written for a human, not an assistant.
122+
123+
## Phase 6 — Grow
124+
125+
Close the onboarding by opening doors:
126+
127+
- **Suggest 2–3 specific expansions** drawn from their deferred Phase 1 domains or natural neighbors of what they built (built tasks → suggest meetings; built finances → suggest renewals calendar; built research → suggest a reading log). Frame each as "when you're ready" — never build unrequested.
128+
- **Maintenance cadence** — suggest a periodic (weekly/monthly) review: `schema_diff` for drift, scan for duplicate or orphaned notes, prune stale statuses. If their platform supports scheduled/recurring tasks, offer to set this up.
129+
- **Evolution rule** — when a convention starts to chafe, change the instruction note (with a changelog row), don't silently deviate. The system stays self-describing only if the rules in it stay true.
130+
131+
## Reference files
132+
133+
| File | Read when |
134+
|:--|:--|
135+
| `references/conventions.md` | Before Phase 2. Startup router anatomy, instruction notes, changelogs, indexes, linking, write discipline, failure modes. |
136+
| `references/schema-guide.md` | Before Phase 2. Picoschema syntax, observations, relations, validation workflow. |
137+
| `references/domain-playbooks.md` | Phase 1–2, for each domain the user picks. Starter folders, schemas, naming, example notes per domain. |
138+
| `references/assistant-setup.md` | Phase 4. Persistent-instruction stub patterns per platform + verification test. |
139+
140+
## Related Skills
141+
142+
When companion skills are installed alongside this one, hand off instead of duplicating: **memory-notes** and **memory-schema** for note-writing and schema mechanics, **memory-tasks** for agent-side task tracking, **memory-lifecycle** for archival on the restructure path, **memory-defrag** / **memory-curate** / **memory-reflect** for the Phase 6 maintenance cadence, and **memory-continue** for resuming work from the graph — a natural first thing to teach after onboarding.

0 commit comments

Comments
 (0)