Skip to content
This repository was archived by the owner on Feb 15, 2026. It is now read-only.

Commit 5e7db06

Browse files
committed
Add validate-memo skill and hooks integration
- Add new validate-memo skill with full documentation - Update hooks.json with PreToolUse validation hook - Update PLUGIN.md with hooks integration section - Update README.md with optional validation setup - Document default observation categories and usage
1 parent f853fee commit 5e7db06

4 files changed

Lines changed: 359 additions & 1 deletion

File tree

PLUGIN.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,76 @@ Add to your `.claude/settings.json`:
5252

5353
---
5454

55+
## Memo Validation with basic-memory-hooks
56+
57+
For consistent, machine-readable memos, integrate with [basic-memory-hooks](https://github.com/basicmachines-co/basic-memory-hooks) - a validation service that catches LLM formatting inconsistencies and fixes them automatically.
58+
59+
### Quick Start
60+
61+
```bash
62+
# 1. Clone and install
63+
cd ~/code
64+
gh repo clone basicmachines-co/basic-memory-hooks
65+
cd basic-memory-hooks
66+
uv sync # or: pip install -e .
67+
68+
# 2. Start the validation server
69+
uv run python -m basic_memory_hooks
70+
71+
# 3. Verify it's running
72+
curl http://localhost:8000/health
73+
# Returns: {"status":"healthy"}
74+
```
75+
76+
### How It Works
77+
78+
When you create memos using `/remember`, `/research`, or write notes directly, the validation server:
79+
80+
1. **Validates frontmatter** - Ensures title and type exist
81+
2. **Fixes observation format** - Converts `- fact:` to `- [fact]`
82+
3. **Removes duplicate sections** - Merges multiple `## Observations` blocks
83+
4. **Validates categories** - Checks against allowed observation types
84+
5. **Orders relations** - Primary relations before secondary
85+
86+
### Example Validation
87+
88+
```bash
89+
curl -X POST http://localhost:8000/validate \
90+
-H "Content-Type: application/json" \
91+
-d '{
92+
"title": "My Memo",
93+
"content": "---\ntitle: My Memo\ntype: memo\n---\n\n# My Memo\n\n## Observations\n\n- [fact] Something learned\n- [decision] Choice made\n- [technique] Approach used"
94+
}'
95+
```
96+
97+
Response:
98+
```json
99+
{
100+
"success": true,
101+
"content": "...",
102+
"errors": [],
103+
"warnings": [],
104+
"metadata": {"hooks_run": ["validate_frontmatter", "format_observations", ...]}
105+
}
106+
```
107+
108+
### Default Observation Categories
109+
110+
| Required | Optional |
111+
|----------|----------|
112+
| fact | insight |
113+
| decision | question |
114+
| technique | idea |
115+
| | requirement |
116+
| | problem |
117+
| | solution |
118+
119+
Custom categories can be configured in `.basic-memory/format.md`.
120+
121+
See the **validate-memo** skill for complete documentation.
122+
123+
---
124+
55125
## Slash Commands
56126

57127
User-invoked commands for explicit interaction with Basic Memory.
@@ -142,6 +212,26 @@ Produces a report with:
142212

143213
Model-invoked capabilities that Claude uses automatically based on context.
144214

215+
### validate-memo
216+
217+
Validates and fixes memo formatting using basic-memory-hooks before saving.
218+
219+
**Triggers when:**
220+
- Creating memos via `/remember` or `/research`
221+
- Writing structured notes with observations
222+
- Content needs format validation
223+
224+
**Prerequisites:**
225+
- basic-memory-hooks server running at `http://localhost:8000`
226+
227+
**How it works:**
228+
1. Sends memo content to validation API
229+
2. Checks against project format configuration
230+
3. Auto-fixes formatting issues (observation format, duplicates)
231+
4. Returns validated content or error details
232+
233+
**Best for:** Ensuring consistent, machine-readable knowledge capture.
234+
145235
### knowledge-capture
146236

147237
Automatically captures insights, decisions, and learnings into structured notes.
@@ -249,6 +339,10 @@ Research topics thoroughly and produce structured reports saved to Basic Memory.
249339

250340
Automated behaviors that enhance the Basic Memory workflow.
251341

342+
### PreToolUse: write_note
343+
344+
Before saving a note, prompts validation against the hooks server if running.
345+
252346
### PostToolUse: write_note
253347

254348
Confirms when notes are saved to Basic Memory.
@@ -295,6 +389,7 @@ basic-memory-plugins/
295389
│ ├── edit-note/
296390
│ ├── edit-note-local/
297391
│ ├── knowledge-organize/
392+
│ ├── validate-memo/ # NEW: Memo validation
298393
│ └── research/
299394
├── hooks/
300395
│ └── hooks.json # Hook definitions
@@ -308,5 +403,6 @@ basic-memory-plugins/
308403

309404
- [Basic Memory Documentation](https://docs.basicmemory.io)
310405
- [Basic Memory GitHub](https://github.com/basicmachines-co/basic-memory)
406+
- [Basic Memory Hooks](https://github.com/basicmachines-co/basic-memory-hooks)
311407
- [Model Context Protocol](https://modelcontextprotocol.io)
312408
- [Claude Code Plugins](https://code.claude.com/docs/en/plugins)

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Skills, commands, and hooks for [Basic Memory](https://github.com/basicmachines-
2424
- `knowledge-organize` - Maintain and organize the knowledge graph
2525
- `research` - Research topics using web search and save to memory
2626
- `edit-note` - Edit existing notes in the knowledge base
27+
- `validate-memo` - Validate memo formatting before saving
2728

2829
**Commands:**
2930
- `/remember` - Capture knowledge from the current conversation
@@ -34,12 +35,38 @@ Skills, commands, and hooks for [Basic Memory](https://github.com/basicmachines-
3435
- `/research` - Research a topic and save findings
3536

3637
**Hooks:**
37-
- Automatic context loading at conversation start
38+
- Pre-write validation (with [basic-memory-hooks](https://github.com/basicmachines-co/basic-memory-hooks))
39+
- Post-write confirmation
40+
- End-of-conversation `/remember` suggestion
41+
42+
## Optional: Memo Validation
43+
44+
For consistent, machine-readable memos, add [basic-memory-hooks](https://github.com/basicmachines-co/basic-memory-hooks):
45+
46+
```bash
47+
# Clone and install
48+
gh repo clone basicmachines-co/basic-memory-hooks
49+
cd basic-memory-hooks
50+
uv sync
51+
52+
# Start validation server
53+
uv run python -m basic_memory_hooks
54+
55+
# Verify
56+
curl http://localhost:8000/health
57+
```
58+
59+
The plugin will automatically validate memos when the hooks server is running.
3860

3961
## Requirements
4062

4163
- [Basic Memory](https://github.com/basicmachines-co/basic-memory) MCP server must be configured
4264
- Claude Code CLI
65+
- (Optional) [basic-memory-hooks](https://github.com/basicmachines-co/basic-memory-hooks) for validation
66+
67+
## Documentation
68+
69+
See [PLUGIN.md](./PLUGIN.md) for full documentation.
4370

4471
## License
4572

hooks/hooks.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
{
22
"hooks": {
3+
"PreToolUse": [
4+
{
5+
"matcher": "mcp__basic-memory__write_note",
6+
"hooks": [
7+
{
8+
"type": "prompt",
9+
"prompt": "Before saving this note to Basic Memory, validate it using the validate-memo skill if the hooks server is running at http://localhost:8000. Check the content against the project's format configuration to catch and fix any formatting issues. If validation fails with errors, fix the content before proceeding."
10+
}
11+
]
12+
}
13+
],
314
"PostToolUse": [
415
{
516
"matcher": "mcp__basic-memory__write_note",

0 commit comments

Comments
 (0)