Add project_archives table and MCP tools (CF-264)

- Created migration 009: project_archives table with semantic search
- Implemented archives.ts: archiveAdd, archiveSearch, archiveList, archiveGet
- Registered archive tools in index.ts and tools/index.ts
- Archive types: session, research, audit, investigation, completed, migration
- Uses project_key (TEXT) FK to projects table
- Tested: archive_add and archive_list working correctly

Replaces filesystem archives with database-backed storage.
Eliminates context pollution from Glob/Grep operations.

Task: CF-264
Session: session_20260119111342_66de546b

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Christian Gick
2026-01-19 11:38:48 +02:00
parent a868dd40ec
commit 1231835e02
4 changed files with 391 additions and 0 deletions

View File

@@ -63,6 +63,7 @@ import {
sessionProductivityAnalytics,
sessionPatternDetection,
} from './tools/session-docs.js';
import { archiveAdd, archiveSearch, archiveList, archiveGet } from './tools/archives.js';
// Create MCP server
const server = new Server(
@@ -597,6 +598,41 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
);
break;
// Archives
case 'archive_add':
result = await archiveAdd({
project: a.project,
archive_type: a.archive_type,
title: a.title,
content: a.content,
original_path: a.original_path,
file_size: a.file_size,
archived_by_session: a.archived_by_session,
metadata: a.metadata,
});
break;
case 'archive_search':
result = await archiveSearch({
query: a.query,
project: a.project,
archive_type: a.archive_type,
limit: a.limit,
});
break;
case 'archive_list':
result = await archiveList({
project: a.project,
archive_type: a.archive_type,
since: a.since,
limit: a.limit,
});
break;
case 'archive_get':
result = await archiveGet({
id: a.id,
});
break;
default:
throw new Error(`Unknown tool: ${name}`);
}