MAESTRO: Merge PR #662 - Add save_memory MCP tool for manual memory storage

Adds save_memory MCP tool allowing users to manually save observations
for semantic search. Source changes cherry-picked from PR #662 by
@darconada (build artifact conflicts resolved by direct application).

Closes #645.

Co-Authored-By: darconadalabarga <darconada@arsys.es>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Alex Newman
2026-02-06 04:13:44 -05:00
parent fbcbdfca62
commit 98920bd860
5 changed files with 155 additions and 2 deletions
+28
View File
@@ -2124,6 +2124,34 @@ export class SessionStore {
return stmt.get(id) || null;
}
/**
* Get or create a manual session for storing user-created observations
* Manual sessions use a predictable ID format: "manual-{project}"
*/
getOrCreateManualSession(project: string): string {
const memorySessionId = `manual-${project}`;
const contentSessionId = `manual-content-${project}`;
const existing = this.db.prepare(
'SELECT memory_session_id FROM sdk_sessions WHERE memory_session_id = ?'
).get(memorySessionId) as { memory_session_id: string } | undefined;
if (existing) {
return memorySessionId;
}
// Create new manual session
const now = new Date();
this.db.prepare(`
INSERT INTO sdk_sessions (memory_session_id, content_session_id, project, started_at, started_at_epoch, status)
VALUES (?, ?, ?, ?, ?, 'active')
`).run(memorySessionId, contentSessionId, project, now.toISOString(), now.getTime());
logger.info('SESSION', 'Created manual session', { memorySessionId, project });
return memorySessionId;
}
/**
* Close the database connection
*/