Skip to content

Commit ae3eeb0

Browse files
committed
add tool prompting and doc updates for strict mode in edit/move, and sync_status tool
Signed-off-by: phernandez <paul@basicmachines.co>
1 parent 602c55f commit ae3eeb0

5 files changed

Lines changed: 208 additions & 130 deletions

File tree

docs/AI Assistant Guide.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,21 @@ read_note("memory://specs/search") # By memory URL
8080
**Incremental editing** (v0.13.0):
8181
```
8282
edit_note(
83-
identifier="Search Design",
83+
identifier="Search Design", # Must be EXACT title/permalink (strict matching)
8484
operation="append", # append, prepend, find_replace, replace_section
8585
content="\n## New Section\nContent here..."
8686
)
8787
```
88+
**⚠️ Important:** `edit_note` requires exact identifiers (no fuzzy matching). Use `search_notes()` first if uncertain.
8889

8990
**File organization** (v0.13.0):
9091
```
9192
move_note(
92-
identifier="Old Note",
93+
identifier="Old Note", # Must be EXACT title/permalink (strict matching)
9394
destination="archive/old-note.md" # Folders created automatically
9495
)
9596
```
97+
**⚠️ Important:** `move_note` requires exact identifiers (no fuzzy matching). Use `search_notes()` first if uncertain.
9698

9799
### Project Management (v0.13.0)
98100

@@ -364,6 +366,20 @@ When creating relations:
364366
- If information seems outdated, suggest `basic-memory sync`
365367
- Use `recent_activity()` to check if content is current
366368

369+
**Strict Mode for Edit/Move Operations:**
370+
- `edit_note()` and `move_note()` require **exact identifiers** (no fuzzy matching for safety)
371+
- If identifier not found: use `search_notes()` first to find the exact title/permalink
372+
- Error messages will guide you to find correct identifiers
373+
- Example workflow:
374+
```
375+
# ❌ This might fail if identifier isn't exact
376+
edit_note("Meeting Note", "append", "content")
377+
378+
# ✅ Safe approach: search first, then use exact result
379+
results = search_notes("meeting")
380+
edit_note("Meeting Notes 2024", "append", "content") # Use exact title from search
381+
```
382+
367383
## Best Practices
368384

369385
1. **Proactively Record Context**

src/basic_memory/mcp/tools/edit_note.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ async def edit_note(
185185
edit_note("Meeting Notes", "append", "\\n- Follow up on action items") # exact title
186186
edit_note("docs/meeting-notes", "append", "\\n- Follow up tasks") # exact permalink
187187
edit_note("docs/Meeting Notes", "append", "\\n- Next steps") # exact folder/title
188-
188+
189189
# If uncertain about identifier, search first:
190190
# search_notes("meeting") # Find available notes
191191
# edit_note("docs/meeting-notes-2025", "append", "content") # Use exact result

src/basic_memory/mcp/tools/move_note.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,13 @@ async def move_note(
232232
Examples:
233233
# Move to new folder (exact title match)
234234
move_note("My Note", "work/notes/my-note.md")
235-
235+
236236
# Move by exact permalink
237237
move_note("my-note-permalink", "archive/old-notes/my-note.md")
238-
238+
239239
# Specify project with exact identifier
240240
move_note("My Note", "archive/my-note.md", project="work-project")
241-
241+
242242
# If uncertain about identifier, search first:
243243
# search_notes("my note") # Find available notes
244244
# move_note("docs/my-note-2025", "archive/my-note.md") # Use exact result

src/basic_memory/services/link_resolver.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ def __init__(self, entity_repository: EntityRepository, search_service: SearchSe
2626
self.entity_repository = entity_repository
2727
self.search_service = search_service
2828

29-
async def resolve_link(self, link_text: str, use_search: bool = True, strict: bool = False) -> Optional[Entity]:
29+
async def resolve_link(
30+
self, link_text: str, use_search: bool = True, strict: bool = False
31+
) -> Optional[Entity]:
3032
"""Resolve a markdown link to a permalink.
31-
33+
3234
Args:
3335
link_text: The link text to resolve
3436
use_search: Whether to use search-based fuzzy matching as fallback

0 commit comments

Comments
 (0)