feat(cursor): Enhance context injection and project registry management

- Updated `context-inject.sh` to refresh context before prompt submission and ensure worker is running.
- Added functionality to register and unregister projects for automatic context updates in `worker-service.ts`.
- Implemented methods to read and write the cursor project registry, allowing for better management of installed hooks.
- Integrated context updates into the `GeminiAgent`, `OpenRouterAgent`, and `SDKAgent` to ensure the latest context is available during sessions.

This update improves the integration of Claude-Mem with Cursor, ensuring that context is consistently updated and accessible across sessions.
This commit is contained in:
Alex Newman
2025-12-29 20:25:16 -05:00
parent 8d485890b9
commit bca6b06919
7 changed files with 319 additions and 95 deletions
+5
View File
@@ -20,6 +20,8 @@ import { SettingsDefaultsManager } from '../../shared/SettingsDefaultsManager.js
import { USER_SETTINGS_PATH } from '../../shared/paths.js';
import type { ActiveSession, ConversationMessage } from '../worker-types.js';
import { ModeManager } from '../domain/ModeManager.js';
import { updateCursorContextForProject } from '../worker-service.js';
import { getWorkerPort } from '../../shared/worker-utils.js';
// OpenRouter API endpoint
const OPENROUTER_API_URL = 'https://openrouter.ai/api/v1/chat/completions';
@@ -536,6 +538,9 @@ export class OpenRouterAgent {
}
});
}
// Update Cursor context file for registered projects (fire-and-forget)
updateCursorContextForProject(session.project, getWorkerPort()).catch(() => {});
}
// Mark messages as processed