Skip to content

Commit 5429f88

Browse files
authored
Merge pull request #126 from nowledge-co/dev_0611
feat(openclaw): add agent behavioral skill + directive guidance (0.6.12)
2 parents 69b63d3 + 146f053 commit 5429f88

7 files changed

Lines changed: 101 additions & 17 deletions

File tree

nowledge-mem-openclaw-plugin/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
All notable changes to the Nowledge Mem OpenClaw plugin will be documented in this file.
44

5+
## [0.6.12] - 2026-03-15
6+
7+
### Added
8+
9+
- **Agent behavioral skill**: the plugin now registers a `skills/memory-guide/SKILL.md` skill via the OpenClaw manifest `skills[]` array. OpenClaw auto-discovers it and presents it to the agent as an available skill. The skill teaches the agent when and how to search, save, explore connections, browse timelines, fetch past conversations, and use Working Memory. This is the single biggest change for memory recall quality: agents now receive structured guidance before their first memory interaction, rather than relying on tool descriptions alone.
10+
11+
### Changed
12+
13+
- **Behavioral guidance is now directive**: the always-on system hint now says "Before answering questions about prior work, decisions, dates, people, preferences, or plans: search with memory_search" instead of the previous "When prior context would improve your response, search." This matches the imperative pattern that LLMs follow most reliably, and explicitly notes "natural language queries, not file paths" to prevent confusion with OpenClaw's built-in file-based memory guidance.
14+
515
## [0.6.11] - 2026-03-15
616

717
### Changed

nowledge-mem-openclaw-plugin/CLAUDE.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ src/
4545
forget.js - memory deletion by ID or search
4646
thread-search.js - search past conversations by keyword
4747
thread-fetch.js - fetch full messages from a thread with pagination
48-
openclaw.plugin.json - manifest + config schema (version, uiHints, configSchema)
48+
skills/
49+
memory-guide/
50+
SKILL.md - agent behavioral skill: when/how to search, save, explore memory (auto-discovered by OpenClaw)
51+
openclaw.plugin.json - manifest + config schema (version, uiHints, configSchema, skills)
4952
~/.nowledge-mem/openclaw.json - optional user config file (overrides OpenClaw settings when present)
5053
```
5154

@@ -69,10 +72,14 @@ openclaw.plugin.json - manifest + config schema (version, uiHints, configSchema)
6972
### Diagnostics
7073
- `nowledge_mem_status` - show effective config (mode, apiUrl, apiKey set, sessionContext, sessionDigest, etc.), backend connectivity, and version. No parameters.
7174

75+
## Skill Surface
76+
77+
- `skills/memory-guide/SKILL.md` - agent behavioral skill auto-discovered by OpenClaw via manifest `skills[]`. Teaches the agent when/how to search, save, explore connections, fetch threads, and use Working Memory. Read on-demand when the agent identifies a memory-related task.
78+
7279
## Hook Surface
7380

74-
- `before_prompt_build` (always-on) - behavioral guidance in system-prompt space: brief note telling agent to save/search proactively. Adjusts when sessionContext is on to avoid redundant searches.
75-
- `before_prompt_build` (sessionContext) - session context: Working Memory + `searchRich()` with `relevanceReason` in context
81+
- `before_prompt_build` (always-on) - directive behavioral guidance in system-prompt space: tells agent to search before answering questions about prior work/decisions/preferences, and to save decisions/learnings proactively. Explicitly notes semantic search (not file paths) to counter OpenClaw's hardcoded memory section. Adjusts when sessionContext is on to avoid redundant searches.
82+
- `before_prompt_build` (sessionContext) - session context: Working Memory + `searchRich()` memories with `relevanceReason`. Note: does NOT inject thread snippets — threads are available via `memory_search` tool and `nowledge_mem_thread_fetch`.
7683
- `agent_end` - thread capture + LLM triage/distillation (requires `sessionDigest: true`)
7784
- `after_compaction` - thread append
7885
- `before_reset` - thread append

nowledge-mem-openclaw-plugin/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ If you manage config manually, or you want to verify what the installer selected
6262
}
6363
```
6464

65-
By default the agent gets 10 tools on demand, a short always-on system hint, and end-of-session capture. Working Memory injection is optional and controlled by `sessionContext`.
65+
By default the agent gets 10 tools on demand, a behavioral skill that teaches it when to search and save, a short always-on system hint, and end-of-session capture. Working Memory injection is optional and controlled by `sessionContext`.
6666

6767
### Remote mode
6868

@@ -115,7 +115,7 @@ flowchart TD
115115

116116
### When Each Tool Gets Called
117117

118-
The behavioral hook nudges the agent to **search before answering** and **save after deciding**. Here's when each tool fires:
118+
The behavioral skill and always-on hook nudge the agent to **search before answering** and **save after deciding**. Here's when each tool fires:
119119

120120
| Scenario | Tool | What happens |
121121
|----------|------|--------------|
@@ -322,7 +322,7 @@ Honest answers to common questions about how the memory system works.
322322

323323
**Does the agent always search before answering?**
324324

325-
No. The behavioral guidance nudges the agent to search, but doesn't force it. This is a deliberate tradeoff: forcing a search on every turn would add latency and cost for messages that don't need past context (like "hello" or "thanks"). In practice, modern LLMs follow behavioral guidance reliably for knowledge-related questions. If guaranteed recall matters for your use case, enable `sessionContext: true`. That injects relevant memories at prompt time, before the agent even processes your message.
325+
The plugin uses two layers to drive recall. First, a behavioral skill (auto-discovered by OpenClaw) teaches the agent when and how to use memory tools. Second, a short always-on system hint reminds it to "search before answering questions about prior work, decisions, dates, people, preferences, or plans." In practice, modern LLMs follow this directive guidance reliably for knowledge-related questions. For messages that don't need past context (like "hello" or "thanks"), the agent skips the search, which is the right tradeoff. If guaranteed recall matters for your use case, enable `sessionContext: true`. That injects relevant memories at prompt time, before the agent even processes your message.
326326

327327
**What stops the agent from saving duplicate memories?**
328328

nowledge-mem-openclaw-plugin/openclaw.plugin.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"id": "openclaw-nowledge-mem",
3-
"version": "0.6.11",
3+
"version": "0.6.12",
44
"kind": "memory",
5+
"skills": ["skills/memory-guide"],
56
"uiHints": {
67
"sessionContext": {
78
"label": "Session context injection",

nowledge-mem-openclaw-plugin/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nowledge/openclaw-nowledge-mem",
3-
"version": "0.6.11",
3+
"version": "0.6.12",
44
"type": "module",
55
"description": "Nowledge Mem memory plugin for OpenClaw, local-first personal knowledge base",
66
"author": {
@@ -16,6 +16,7 @@
1616
},
1717
"files": [
1818
"src",
19+
"skills",
1920
"README.md",
2021
"CHANGELOG.md",
2122
"CLAUDE.md",
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
name: nowledge-mem-guide
3+
description: >
4+
Cross-AI personal knowledge graph memory (Nowledge Mem). Stores memories from this tool,
5+
Claude Code, Cursor, browser capture, imported documents, and more. Use when: (1) the user
6+
asks about prior work, decisions, preferences, people, dates, plans, or todos, (2) the user
7+
references something discussed before or says "remind me" / "what did we decide" / "what was
8+
I working on", (3) the conversation produces a decision, preference, plan, or learning worth
9+
keeping, (4) the user wants to browse recent activity or explore how ideas connect, (5) the
10+
user asks about a past conversation or wants to find a specific thread.
11+
---
12+
13+
# Nowledge Mem
14+
15+
## Search (memory_search)
16+
17+
Use natural language queries. This is semantic search, not file search.
18+
19+
- "database choice for task events" (not "MEMORY.md" or file paths)
20+
- "meeting with Sarah about API redesign"
21+
- "deployment procedure for production"
22+
23+
Results include `matchedVia` (scoring breakdown), `importance`, `labels`, `sourceThreadId`.
24+
25+
When results include `relatedThreads`, use `nowledge_mem_thread_fetch` with the `threadId` for full conversation context. Start with a small page; fetch more via `offset` + `limit` only when needed.
26+
27+
Bi-temporal filters narrow results by time:
28+
29+
- `event_date_from` / `event_date_to` — when the fact happened
30+
- `recorded_date_from` / `recorded_date_to` — when it was saved
31+
32+
## Save (nowledge_mem_save)
33+
34+
Save proactively when the conversation produces a decision, preference, plan, procedure, learning, or important context. Do not wait to be asked.
35+
36+
Structure saves:
37+
38+
- `unit_type`: fact | preference | decision | plan | procedure | learning | context | event
39+
- `labels`: lowercase-hyphenated topic tags
40+
- `importance`: 0.0-1.0 (most: 0.5; key decisions/preferences: 0.7-0.9)
41+
- `event_start` / `event_end`: ISO dates when temporal
42+
43+
Skip trivial exchanges, greetings, and meta-conversation about memory itself.
44+
45+
## Connections (nowledge_mem_connections)
46+
47+
Pass a `memoryId` from search results to explore related memories, evolution chains, and source documents. Edge types: EVOLVES, CRYSTALLIZED_FROM, SOURCED_FROM, MENTIONS.
48+
49+
## Timeline (nowledge_mem_timeline)
50+
51+
Browse recent activity grouped by day. Filter by `event_type` or exact `date_from` / `date_to` range.
52+
53+
## Threads (nowledge_mem_thread_search + nowledge_mem_thread_fetch)
54+
55+
Find past conversations by keyword, then progressively fetch messages. Threads span all sources: this tool, other AI tools, browser capture, imports.
56+
57+
## Working Memory (nowledge_mem_context)
58+
59+
Read the user's daily briefing (priorities, active projects, flags). Patch a specific section with `patch_section` + `patch_content`/`patch_append` when the conversation updates a priority or resolves a flag.
60+
61+
## Important
62+
63+
- Search uses natural language queries, not file paths. Never search for "MEMORY.md" or "memory/*.md".
64+
- When `relatedThreads` appear in results, they often contain the most useful context.
65+
- Use tools directly; do not tell the user to "check your memory."

nowledge-mem-openclaw-plugin/src/hooks/behavioral.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,22 @@
1515
const BASE_GUIDANCE = [
1616
"<nowledge-mem-guidance>",
1717
"You have access to the user's personal knowledge graph (Nowledge Mem).",
18-
"When the conversation produces something worth keeping — a decision made, a preference stated,",
19-
"something learned, a plan formed, a useful discovery — save it with nowledge_mem_save. Don't wait to be asked.",
20-
"When prior context would improve your response, search with memory_search.",
21-
"memory_search also returns relevant past conversation snippets alongside memories.",
22-
"When a memory has a sourceThreadId, fetch the full conversation with nowledge_mem_thread_fetch.",
18+
"Before answering questions about prior work, decisions, dates, people, preferences, or plans:",
19+
"search with memory_search using natural language queries (not file paths).",
20+
"memory_search returns memories with scores, labels, and relevant past conversation snippets.",
21+
"When results include a sourceThreadId, use nowledge_mem_thread_fetch for full conversation context.",
22+
"When the conversation produces a decision, preference, plan, or learning, save it with nowledge_mem_save.",
2323
"</nowledge-mem-guidance>",
2424
].join("\n");
2525

2626
const SESSION_CONTEXT_GUIDANCE = [
2727
"<nowledge-mem-guidance>",
2828
"You have access to the user's personal knowledge graph (Nowledge Mem).",
2929
"Relevant memories and your Working Memory have already been injected into this prompt.",
30-
"Use memory_search only when you need something specific beyond what was auto-recalled.",
31-
"When the conversation produces something worth keeping — a decision made, a preference stated,",
32-
"something learned, a plan formed, a useful discovery — save it with nowledge_mem_save. Don't wait to be asked.",
33-
"When a memory has a sourceThreadId, fetch the full conversation with nowledge_mem_thread_fetch.",
30+
"Use memory_search when you need something specific beyond what was auto-recalled (natural language queries, not file paths).",
31+
"memory_search also returns relevant past conversation snippets alongside memories.",
32+
"When results include a sourceThreadId, use nowledge_mem_thread_fetch for full conversation context.",
33+
"When the conversation produces a decision, preference, plan, or learning, save it with nowledge_mem_save.",
3434
"</nowledge-mem-guidance>",
3535
].join("\n");
3636

0 commit comments

Comments
 (0)