Skip to content

Commit 545052a

Browse files
committed
docs(integrations): document OpenClaw note metadata
Signed-off-by: Beru <beru@lastguru.lv>
1 parent 54a3f1e commit 545052a

3 files changed

Lines changed: 62 additions & 14 deletions

File tree

integrations/openclaw/CLAUDE.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,12 @@ read_note(identifier="decisions/auth-strategy", project="backend")
198198
### `write_note`
199199
**Purpose**: Create new notes in the knowledge graph
200200
**When to use**: When users share important information, make decisions, or want to save insights for later
201-
**Best practices**: Use clear titles, organize in appropriate folders, structure with headings
201+
**Best practices**: Use clear titles, organize in appropriate folders, structure the Markdown body with headings, and pass frontmatter through the dedicated parameters instead of embedding YAML in `content`
202+
203+
**Frontmatter parameters**:
204+
- `tags`: A string array or comma-separated string
205+
- `note_type`: The note type stored as `type`; defaults to `note`
206+
- `metadata`: Additional frontmatter fields, including nested objects
202207

203208
**Examples**:
204209
```
@@ -231,6 +236,12 @@ We chose JWT tokens with refresh token rotation.
231236
write_note(
232237
title="Client Meeting - February 8, 2024",
233238
folder="meetings",
239+
tags=["client", "planning"],
240+
note_type="Meeting",
241+
metadata={
242+
"status": "complete",
243+
"attendees": ["John", "Sarah"],
244+
},
234245
content="""
235246
# Client Meeting - February 8, 2024
236247
@@ -256,6 +267,7 @@ write_note(
256267
**Purpose**: Modify existing notes incrementally
257268
**When to use**: To add updates, fix information, or organize existing content
258269
**Operations**: append, prepend, find_replace, replace_section
270+
**Frontmatter updates**: Pass `metadata` to merge custom frontmatter fields in the same call. Provided keys replace existing values, unrelated fields remain unchanged, and nested objects are supported.
259271

260272
**Examples**:
261273
```
@@ -276,6 +288,7 @@ edit_note(
276288
identifier="weekly-review",
277289
operation="replace_section",
278290
section="## This Week",
291+
metadata={"status": "review", "progress": {"completed": 4, "total": 6}},
279292
content="""## This Week
280293
- Completed API authentication
281294
- Client meeting went well

integrations/openclaw/MEMORY_TASK_FLOW.md

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,10 @@ This fallback behavior keeps tasks discoverable even if the graph index is stale
104104
write_note(
105105
title="migrate-auth-routes",
106106
folder="tasks",
107-
content="""---
108-
title: migrate-auth-routes
109-
type: Task
110-
status: active
111-
current_step: 1
112-
---
113-
114-
## Context
107+
note_type="Task",
108+
tags=["auth", "migration"],
109+
metadata={"status": "active", "current_step": 1},
110+
content="""## Context
115111
Starting auth route migration.
116112

117113
## Plan
@@ -122,12 +118,35 @@ Starting auth route migration.
122118
123119
### Advance a task
124120
125-
- Update plan checkboxes with `edit_note` + `replace_section`
126-
- Bump step with `edit_note` + `find_replace` (for `current_step`)
121+
Update the plan and its frontmatter state together:
122+
123+
```
124+
edit_note(
125+
identifier="tasks/migrate-auth-routes",
126+
operation="replace_section",
127+
section="## Plan",
128+
metadata={"current_step": 2},
129+
content="""## Plan
130+
- [x] Implement middleware
131+
- [ ] Add tests"""
132+
)
133+
```
127134
128135
### Complete a task
129136
130-
Use `edit_note` (`find_replace`) to change `status: active` to `status: done`.
137+
Record the outcome while setting the structured status field:
138+
139+
```
140+
edit_note(
141+
identifier="tasks/migrate-auth-routes",
142+
operation="append",
143+
metadata={"status": "done"},
144+
content="""
145+
146+
## Outcome
147+
Migration completed and verified."""
148+
)
149+
```
131150
132151
## Operational Tips
133152

integrations/openclaw/README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ All tools accept an optional `project` parameter for cross-project operations.
161161
| `memory_get` | Read a specific note by title or path |
162162
| `search_notes` | Search the knowledge graph directly |
163163
| `read_note` | Read a note by title, permalink, or `memory://` URL |
164-
| `write_note` | Create or update a note |
165-
| `edit_note` | Append, prepend, find/replace, or replace a section |
164+
| `write_note` | Create or overwrite a note with optional tags, note type, and custom frontmatter metadata |
165+
| `edit_note` | Append, prepend, replace content, and merge custom frontmatter metadata |
166166
| `delete_note` | Delete a note |
167167
| `move_note` | Move a note to a different folder |
168168
| `build_context` | Navigate the knowledge graph — follow relations and connections |
@@ -172,6 +172,22 @@ All tools accept an optional `project` parameter for cross-project operations.
172172
| `schema_infer` | Analyze notes and suggest a schema |
173173
| `schema_diff` | Detect drift between schema and actual usage |
174174

175+
Use the dedicated frontmatter parameters when creating structured notes:
176+
177+
```
178+
write_note(
179+
title="auth-middleware-rollout",
180+
folder="tasks",
181+
note_type="Task",
182+
tags=["auth", "rollout"],
183+
metadata={"status": "active", "current_step": 2},
184+
content="""## Context
185+
Rolling JWT middleware to all API routes."""
186+
)
187+
```
188+
189+
`edit_note` accepts `metadata` alongside any edit operation, so content and frontmatter state can be updated in one call. Metadata keys supplied by the caller are merged into existing frontmatter; unrelated fields remain unchanged.
190+
175191
## Slash commands
176192

177193
| Command | Description |

0 commit comments

Comments
 (0)