Skip to content

Commit 91bfe2d

Browse files
committed
add sync status tool
Signed-off-by: phernandez <paul@basicmachines.co>
1 parent a3cae10 commit 91bfe2d

15 files changed

Lines changed: 845 additions & 252 deletions

File tree

src/basic_memory/cli/commands/sync.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ async def run_sync(verbose: bool = False):
180180
sync_service = await get_sync_service(project)
181181

182182
logger.info("Running one-time sync")
183-
knowledge_changes = await sync_service.sync(config.home)
183+
knowledge_changes = await sync_service.sync(config.home, project_name=project.name)
184184

185185
# Log results
186186
duration_ms = int((time.time() - start_time) * 1000)

src/basic_memory/mcp/prompts/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
from basic_memory.mcp.prompts import recent_activity
1111
from basic_memory.mcp.prompts import search
1212
from basic_memory.mcp.prompts import ai_assistant_guide
13-
from basic_memory.mcp.prompts import migration_status
13+
from basic_memory.mcp.prompts import sync_status
1414

1515
__all__ = [
1616
"ai_assistant_guide",
1717
"continue_conversation",
18-
"migration_status",
1918
"recent_activity",
2019
"search",
20+
"sync_status",
2121
]
Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
1-
"""Migration status prompt for Basic Memory MCP server."""
2-
3-
from typing import Optional
1+
"""Sync status prompt for Basic Memory MCP server."""
42

53
from basic_memory.mcp.server import mcp
64

75

86
@mcp.prompt(
9-
description="""Get migration status with recommendations for AI assistants.
7+
description="""Get sync status with recommendations for AI assistants.
108
11-
This prompt provides both current migration status and guidance on how
12-
AI assistants should respond when migration is in progress or completed.
9+
This prompt provides both current sync status and guidance on how
10+
AI assistants should respond when sync operations are in progress or completed.
1311
""",
1412
)
15-
async def migration_status_prompt(
16-
) -> str:
17-
"""Get migration status with AI assistant guidance.
13+
async def sync_status_prompt() -> str:
14+
"""Get sync status with AI assistant guidance.
1815
19-
This prompt provides detailed migration status information along with
20-
recommendations for how AI assistants should handle different migration states.
16+
This prompt provides detailed sync status information along with
17+
recommendations for how AI assistants should handle different sync states.
2118
2219
Returns:
23-
Formatted migration status with AI assistant guidance
20+
Formatted sync status with AI assistant guidance
2421
"""
2522
try:
2623
from basic_memory.services.migration_service import migration_manager
@@ -29,7 +26,7 @@ async def migration_status_prompt(
2926

3027
# Build status report
3128
lines = [
32-
"# Basic Memory Migration Status",
29+
"# Basic Memory Sync Status",
3330
"",
3431
f"**Current Status**: {state.status.value.replace('_', ' ').title()}",
3532
f"**System Ready**: {'Yes' if migration_manager.is_ready else 'No'}",
@@ -39,9 +36,10 @@ async def migration_status_prompt(
3936
if migration_manager.is_ready:
4037
lines.extend(
4138
[
42-
"✅ **All migrations completed** - System is fully operational",
39+
"✅ **All sync operations completed** - System is fully operational",
4340
"",
44-
"All Basic Memory MCP tools are available and functioning normally.",
41+
"All Basic Memory tools are available and functioning normally.",
42+
"File indexing is complete and knowledge graphs are up to date.",
4543
"You can proceed with any knowledge management tasks.",
4644
]
4745
)
@@ -56,59 +54,63 @@ async def migration_status_prompt(
5654
lines.extend(
5755
[
5856
"",
59-
"🔄 **Migration in progress** - Legacy data is being migrated to new format",
57+
"🔄 **File synchronization in progress** - Processing files and building knowledge graphs",
6058
"",
6159
"**Impact**: Some tools may show status messages instead of normal responses",
62-
"until migration completes (usually 1-3 minutes).",
60+
"until sync completes (usually 1-3 minutes).",
6361
]
6462
)
6563

6664
elif state.status.value == "failed":
6765
lines.extend(
6866
[
6967
"",
70-
f"❌ **Migration failed**: {state.error or 'Unknown error'}",
68+
f"❌ **Sync failed**: {state.error or 'Unknown error'}",
7169
"",
7270
"**Impact**: System may have limited functionality until issue is resolved.",
7371
]
7472
)
7573

76-
# Convert string parameter to boolean
77-
include_recs = True
78-
79-
if include_recs and not migration_manager.is_ready:
74+
# Add AI assistant recommendations
75+
if not migration_manager.is_ready:
8076
lines.extend(
8177
[
8278
"",
8379
"---",
8480
"",
8581
"## AI Assistant Recommendations",
8682
"",
87-
"**When migration is in progress:**",
88-
"- Inform the user about the background migration",
89-
"- Suggest using `migration_status()` tool to check progress",
90-
"- Explain that most tools will work normally once migration completes",
91-
"- Avoid creating complex workflows until migration is done",
83+
"**When sync is in progress:**",
84+
"- Inform the user about the background file processing",
85+
"- Suggest using `sync_status()` tool to check progress",
86+
"- Explain that tools will work normally once sync completes",
87+
"- Avoid creating complex workflows until sync is done",
9288
"",
9389
"**What to tell users:**",
94-
"- 'Basic Memory is upgrading your knowledge base in the background'",
95-
"- 'This usually takes 1-3 minutes depending on your data size'",
96-
"- 'You can check progress anytime with the migration_status tool'",
97-
"- 'Most functionality will be available once the upgrade completes'",
90+
"- 'Basic Memory is processing your files and building knowledge graphs'",
91+
"- 'This usually takes 1-3 minutes depending on your content size'",
92+
"- 'You can check progress anytime with the sync_status tool'",
93+
"- 'Full functionality will be available once processing completes'",
94+
"",
95+
"**User-friendly language:**",
96+
"- Say 'processing files' instead of 'migration' or 'sync'",
97+
"- Say 'building knowledge graphs' instead of 'indexing'",
98+
"- Say 'setting up your knowledge base' instead of 'running migrations'",
9899
]
99100
)
100101

101102
return "\n".join(lines)
102103

103104
except Exception as e:
104-
return f"""# Migration Status - Error
105+
return f"""# Sync Status - Error
105106
106-
❌ **Unable to check migration status**: {str(e)}
107+
❌ **Unable to check sync status**: {str(e)}
107108
108109
## AI Assistant Recommendations
109110
110111
**When status is unavailable:**
111112
- Assume the system is likely working normally
112113
- Try proceeding with normal operations
113114
- If users report issues, suggest checking logs or restarting
115+
- Use user-friendly language about 'setting up the knowledge base'
114116
"""

src/basic_memory/mcp/tools/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from basic_memory.mcp.tools.list_directory import list_directory
1818
from basic_memory.mcp.tools.edit_note import edit_note
1919
from basic_memory.mcp.tools.move_note import move_note
20-
from basic_memory.mcp.tools.migration_status import migration_status
20+
from basic_memory.mcp.tools.sync_status import sync_status
2121
from basic_memory.mcp.tools.project_management import (
2222
list_projects,
2323
switch_project,
@@ -37,13 +37,13 @@
3737
"get_current_project",
3838
"list_directory",
3939
"list_projects",
40-
"migration_status",
4140
"move_note",
4241
"read_content",
4342
"read_note",
4443
"recent_activity",
4544
"search_notes",
4645
"set_default_project",
4746
"switch_project",
47+
"sync_status",
4848
"write_note",
4949
]

src/basic_memory/mcp/tools/migration_status.py

Lines changed: 0 additions & 166 deletions
This file was deleted.

0 commit comments

Comments
 (0)