@basicmemory/openclaw-basic-memory 0.23.2 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +24 -7
  2. package/bm-client.ts +107 -7
  3. package/dist/bm-client.d.ts +33 -1
  4. package/dist/bm-client.js +77 -6
  5. package/dist/index.js +9 -1
  6. package/dist/tools/edit-note.js +8 -1
  7. package/dist/tools/list-memory-projects.js +23 -5
  8. package/dist/tools/list-workspaces.js +3 -1
  9. package/dist/tools/memory-provider.js +2 -1
  10. package/dist/tools/read-note.js +18 -3
  11. package/dist/tools/search-notes.js +3 -1
  12. package/dist/tools/write-note.js +65 -5
  13. package/index.ts +9 -1
  14. package/openclaw.plugin.json +2 -0
  15. package/package.json +1 -1
  16. package/scripts/fetch-skills.ts +87 -36
  17. package/scripts/setup-bm.sh +4 -1
  18. package/skills/manifest.json +31 -16
  19. package/skills/memory-agents/SKILL.md +170 -0
  20. package/skills/memory-capture/SKILL.md +7 -5
  21. package/skills/memory-comark/SKILL.md +204 -0
  22. package/skills/memory-comark/references/components.md +740 -0
  23. package/skills/memory-continue/SKILL.md +11 -1
  24. package/skills/memory-curate/SKILL.md +32 -39
  25. package/skills/memory-defrag/SKILL.md +106 -57
  26. package/skills/memory-ingest/SKILL.md +14 -3
  27. package/skills/memory-lifecycle/SKILL.md +21 -21
  28. package/skills/memory-literary-analysis/SKILL.md +258 -28
  29. package/skills/memory-metadata-search/SKILL.md +29 -4
  30. package/skills/memory-notes/SKILL.md +69 -17
  31. package/skills/memory-okf/SKILL.md +135 -0
  32. package/skills/memory-onboarding/SKILL.md +2 -2
  33. package/skills/memory-onboarding/references/assistant-setup.md +8 -0
  34. package/skills/memory-onboarding/references/conventions.md +3 -3
  35. package/skills/memory-onboarding/references/domain-playbooks.md +1 -1
  36. package/skills/memory-onboarding/references/schema-guide.md +3 -3
  37. package/skills/memory-quest/SKILL.md +129 -0
  38. package/skills/memory-quest/agents/openai.yaml +9 -0
  39. package/skills/memory-reflect/SKILL.md +125 -44
  40. package/skills/memory-research/SKILL.md +9 -15
  41. package/skills/memory-schema/SKILL.md +29 -21
  42. package/skills/memory-tasks/SKILL.md +36 -10
  43. package/tools/edit-note.ts +15 -1
  44. package/tools/list-memory-projects.ts +24 -5
  45. package/tools/list-workspaces.ts +3 -1
  46. package/tools/memory-provider.ts +2 -1
  47. package/tools/read-note.ts +22 -3
  48. package/tools/search-notes.ts +3 -1
  49. package/tools/write-note.ts +94 -4
  50. package/skills/memory-ci-capture/SKILL.md +0 -56
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: memory-capture
3
- description: "Capture the current state of a working thread or conversation into a single coherent Basic Memory note — synthesize where it landed, don't append a log. On re-capture, rewrite the same note in place instead of duplicating. Use mid-thread or end-of-thread when decisions, insights, or context are worth preserving."
3
+ description: "Capture a working thread's current state into one coherent Basic Memory note; on re-capture, rewrite it in place. Use mid- or end-of-thread when decisions, insights, or context are worth keeping."
4
4
  ---
5
5
 
6
6
  # Memory Capture
@@ -51,13 +51,13 @@ To rewrite the same note on re-capture instead of duplicating, key the note to a
51
51
  search_notes(query="<thread topic>", project="<project>")
52
52
  ```
53
53
  3. **If a match is found:**
54
- - Read the existing note (use the full permalink returned by search)
54
+ - Read the existing note as JSON (use the full permalink returned by search) and keep its `checksum`
55
55
  - Synthesize a new version that integrates the latest understanding from the conversation
56
- - Overwrite via `write_note` with `overwrite=True` (same title, same `thread_id` if used, same directory)
56
+ - Overwrite via `write_note` with `overwrite=True` and `expected_checksum` set to that checksum (same title, same `thread_id` if used, same directory). A `NOTE_REVISION_CONFLICT` error means another session changed the note since you read it: read it again and re-synthesize
57
57
  4. **If no match is found:**
58
58
  - Synthesize the note from the conversation
59
59
  - If you have a thread id, pass `metadata={"thread_id": "<thread-id>"}` to `write_note` (it surfaces as a custom frontmatter field)
60
- - Save it
60
+ - Save it. If `write_note` lists similar existing notes, check whether one of them is this thread's note before keeping the new one
61
61
 
62
62
  ## Synthesis Rules
63
63
 
@@ -150,7 +150,8 @@ write_note(
150
150
  project="<project>"
151
151
  )
152
152
 
153
- # Overwrite an existing note (same path)
153
+ # Overwrite an existing note (same path), only the revision you read
154
+ existing = read_note(identifier="<full-permalink>", output_format="json", project="<project>")
154
155
  write_note(
155
156
  title="<same title>",
156
157
  content="<new content>",
@@ -158,6 +159,7 @@ write_note(
158
159
  tags=["..."],
159
160
  metadata={"thread_id": "<same thread-id>"}, # omit if no stable id
160
161
  overwrite=True,
162
+ expected_checksum=existing["checksum"],
161
163
  project="<project>"
162
164
  )
163
165
  ```
@@ -0,0 +1,204 @@
1
+ ---
2
+ name: memory-comark
3
+ description: "Write Basic Memory notes that render as charts, tables, boards, and live views with `::bm-*` Comark components. Use when a note reads better as a figure or board, or already has `::bm-*` directives."
4
+ ---
5
+
6
+ # Memory Comark
7
+
8
+ Basic Memory notes can carry small, safe components written as Comark block
9
+ directives (`::bm-bars{...}` … `::`). Basic Memory Cloud draws them in Notes, the
10
+ Wiki, and shared pages. Everywhere else (a local editor, GitHub, an agent's raw
11
+ read) the same Markdown still reads as an ordinary list, table, or paragraph, so
12
+ a component never hides content.
13
+
14
+ Use a component when its shape says more than a sentence or a list would. Keep
15
+ prose primary: one figure per idea, at most two per section, with a sentence
16
+ between them that says what the figure shows.
17
+
18
+ The full vocabulary, every prop, and every data grammar are in
19
+ [references/components.md](references/components.md). Read it before using a
20
+ component you have not used before.
21
+
22
+ ## Pick a component
23
+
24
+ Most notes need only these. The reference has the rest (39 in total).
25
+
26
+ | You want to show | Use |
27
+ | --- | --- |
28
+ | One or a few headline numbers | `bm-stat` |
29
+ | A comparison of a few values | `bm-bars` |
30
+ | A short ranked list | `bm-rank` |
31
+ | A small data table | `bm-table` |
32
+ | Progress toward a whole | `bm-meter` |
33
+ | A trend without axes | `bm-spark` |
34
+ | Steps that drop off | `bm-funnel` |
35
+ | A task list | `bm-check` |
36
+ | Work in lanes (now, next, later) | `bm-kanban` |
37
+ | Events in order | `bm-timeline` |
38
+ | A framed claim or summary | `bm-frame` |
39
+ | A short path (`a → b → c`) | `bm-flow` |
40
+ | A real graph, sequence, or state machine | a fenced ```mermaid block (not a component) |
41
+
42
+ If nothing fits, write prose or a plain Markdown table. Never invent a
43
+ component: an unknown name such as `::bm-pie` is not drawn and shows as raw text.
44
+
45
+ ## Write a component
46
+
47
+ Every component opens with `::bm-name{attributes}` on its own line and closes
48
+ with `::` on its own line.
49
+
50
+ ```markdown
51
+ The queue rewrite more than doubled steady-state throughput.
52
+
53
+ ::bm-bars{title="Throughput" caption="Before and after the queue rewrite"}
54
+ - Before: 42/s
55
+ - **After: 96/s**
56
+ ::
57
+ ```
58
+
59
+ Rules that matter:
60
+
61
+ - **Data goes in the body as Markdown**, not in an attribute: `- label: value`
62
+ rows, a table for grids. **Bold** marks the current or chosen row, *italic*
63
+ recedes, ` — note` adds a side note.
64
+ - **Attribute values are double-quoted and cannot contain `"`.** There is no
65
+ escape. Inside a `query`, quote phrases with single quotes:
66
+ `query="search 'queue rewrite'"`.
67
+ - **Task state stays in Markdown.** Use `- [ ]` and `- [x]` inside `bm-check` and
68
+ `bm-kanban`; people can tick boxes from the rendered note.
69
+ - **Never put HTML, scripts, styles, or classes in a note**, and never wrap a
70
+ component in a code fence (a fenced block stays literal code).
71
+ - **Use only registered props.** An unknown attribute produces `prop-unknown`
72
+ in a warning frame with the original source and registered props; it is never
73
+ silently dropped.
74
+
75
+ A checklist and a board:
76
+
77
+ ```markdown
78
+ ::bm-check{title="Launch"}
79
+ - [x] Freeze the schema
80
+ - [ ] Write the migration note — due Friday
81
+ ::
82
+
83
+ ::bm-kanban{title="Roadmap"}
84
+ ### Now
85
+ - **Billing page**
86
+ - [ ] Usage emails
87
+
88
+ ### Next
89
+ - *Partner portal*
90
+ ::
91
+ ```
92
+
93
+ ## Live views over the knowledge base
94
+
95
+ A component with a `query` attribute shows current data from the project it
96
+ lives in. Prefer a live view to a hand-copied number when the note describes its
97
+ own knowledge base, because copied counts go stale.
98
+
99
+ ```markdown
100
+ ::bm-stat{label="Open decisions" query="notes | where type == decision and status == open | count"}
101
+ ::
102
+
103
+ ::bm-bars{title="Open decisions by owner" query="notes | where type == decision and status != done | group owner | sort count desc"}
104
+ ::
105
+
106
+ ::bm-table{title="Due soon" query="notes | where tags contains infra and due < 2026-10-15 | fields title, owner, due | sort due"}
107
+ ::
108
+
109
+ ::bm-timeline{title="Recent edits" query="activity 7d"}
110
+ ::
111
+
112
+ ::bm-rank{title="Related notes" query="search 'checksum conflict' | limit 5"}
113
+ ::
114
+ ```
115
+
116
+ A pipeline reads left to right: a source (`notes`, `search 'phrase'`,
117
+ `activity 7d|30d`), then optional stages in order: `where`, `group`, `count` or
118
+ `sum field`, `fields`, `sort`, `limit` (1–50). The reference lists every
119
+ operator and which components accept which shapes.
120
+
121
+ Shapes that work:
122
+
123
+ - **Charts, ranks, and bars need a number per row**: add `group field`, `count`,
124
+ or `sum field`, or use a `search` source.
125
+ - **Sparks, KPIs, and plots need several rows** (`group`, `daily`, or `search`),
126
+ not a single `count`.
127
+ - **`bm-table` takes `fields`**; `bm-timeline` takes `activity` without `daily`;
128
+ `bm-activity` takes `activity 30d | daily`.
129
+
130
+ Semantics to state honestly in the surrounding prose:
131
+
132
+ - `notes` views are exact counts over indexed frontmatter. Search views are
133
+ ranked and bounded; call them matches, never "all".
134
+ - `!=` keeps notes that lack the field. `group` puts notes without the field in
135
+ a `none` group.
136
+ - Frontmatter numbers are stored as text; comparisons and sums treat decimal text
137
+ as numbers and ignore everything else.
138
+
139
+ ### Check the rendered result before you quote it
140
+
141
+ In Basic Memory Cloud, `read_note(view="text")` returns the note as a reader
142
+ sees it: every component as plain Markdown, with live queries run now. Read it
143
+ back after writing a live view and confirm the view has rows before you state a
144
+ number in prose. A query over a field no note has renders an empty view.
145
+
146
+ Elsewhere, only the browser runs the query, so run the equivalent read yourself
147
+ (for example `search_notes` with metadata filters; see the
148
+ memory-metadata-search skill).
149
+
150
+ A live chart's body is its **snapshot**: the rows readers see when live data
151
+ cannot load. A new live view can leave the body empty; people fill it with
152
+ **Freeze snapshot** in the editor. If you add snapshot rows yourself, label them
153
+ as a snapshot in prose and keep them in the chart's row grammar.
154
+
155
+ ## Edit a note that already has components
156
+
157
+ - Change one component with `edit_note` (`find_replace` on its directive line or
158
+ rows). Do not rewrite the whole note to change one value.
159
+ - The rich editor normalizes formatting when a person edits the note: attribute
160
+ order changes and YAML blocks come back as JSON. Values survive; do not fight
161
+ the formatting.
162
+ - Keep the closing `::` lines. A block with a body but no close produces
163
+ `directive-unclosed`; the opener and YAML props appear in a warning while
164
+ following Markdown stays visible. Add the close at the intended boundary in
165
+ source; the editor never guesses it. Standalone leaves with no body remain
166
+ valid, though new components should use explicit closes.
167
+
168
+ ## When a component shows an error
169
+
170
+ A broken component renders a coded problem and a fix inside its own frame; the
171
+ rest of the note still renders. In Basic Memory Cloud, `write_note` and
172
+ `edit_note` list these problems under **Component problems** in their result
173
+ (they never block the write), so fix them right away with `edit_note`. `comark(7)` in the manual
174
+ (`memory://man/comark(7)`) is a quick reference to the syntax and codes. The
175
+ codes you will meet most:
176
+
177
+ | Code | Meaning | Fix |
178
+ | --- | --- | --- |
179
+ | `prop-unknown` | A prop the component does not accept | Remove it or use a registered prop from the warning or reference |
180
+ | `directive-unclosed` | A block with a body is missing its close | Add `::` at the intended boundary in Markdown source |
181
+ | `query-measure` | The chart has no number per row | Add `group`, `count`, or `sum`, or use `search` |
182
+ | `query-series` | A trend from one value | Use `group`, `daily`, or `search` with `limit` ≥ 2 |
183
+ | `query-escaped-quote` | `\"` inside a query | Use single quotes inside the query |
184
+ | `query-field` / `query-operator` | Bad field name or operator | Fields are `[A-Za-z0-9_-]` with dotted paths; ops are `== != < <= > >= contains` |
185
+ | `query-stage-order` | Stages out of order | `where`, `group`, `count`/`sum`, `fields`, `sort`, `limit` |
186
+ | `chart-body-empty` | No rows in the body | Add `- label: value` rows |
187
+ | `chart-body-number` | A row without a number | Every row needs a numeric value |
188
+
189
+ Unknown props preserve the original directive and data through nearby rich
190
+ edits. Closed malformed components can use a reviewed agent replacement and
191
+ undo; missing-close repairs require source editing. Canonical validation and
192
+ strict export reject malformed source until repaired. Never author internal
193
+ recovery nodes such as `bm-problem`. Check component names and props against the
194
+ reference.
195
+
196
+ ## Checklist
197
+
198
+ 1. Does a figure beat a sentence here? If not, write the sentence.
199
+ 2. Is the component name and every prop in the reference?
200
+ 3. Is data in the body as Markdown rows or a table, with no `"` inside values?
201
+ 4. For a live view: does the pipeline give the shape this component needs, and
202
+ did you check the numbers with a read of your own?
203
+ 5. Is there prose around the figure saying what it shows and whether a count is
204
+ exact or a ranking?