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

@@ -974,4 +974,62 @@ export const toolDefinitions = [
},
},
},
// Archive Tools
{
name: 'archive_add',
description: 'Archive content to database with semantic embedding. Replaces filesystem archives.',
inputSchema: {
type: 'object',
properties: {
project: { type: 'string', description: 'Project key (e.g., CF, VPN)' },
archive_type: { type: 'string', enum: ['session', 'research', 'audit', 'investigation', 'completed', 'migration'], description: 'Archive type' },
title: { type: 'string', description: 'Archive title' },
content: { type: 'string', description: 'Archive content (markdown)' },
original_path: { type: 'string', description: 'Original file path (optional)' },
file_size: { type: 'number', description: 'File size in bytes (optional)' },
archived_by_session: { type: 'string', description: 'Session ID that archived it (optional)' },
metadata: { type: 'object', description: 'Additional metadata (optional)' },
},
required: ['project', 'archive_type', 'title', 'content'],
},
},
{
name: 'archive_search',
description: 'Search archives using semantic similarity',
inputSchema: {
type: 'object',
properties: {
query: { type: 'string', description: 'Search query' },
project: { type: 'string', description: 'Filter by project (optional)' },
archive_type: { type: 'string', enum: ['session', 'research', 'audit', 'investigation', 'completed', 'migration'], description: 'Filter by archive type (optional)' },
limit: { type: 'number', description: 'Max results (default: 5)' },
},
required: ['query'],
},
},
{
name: 'archive_list',
description: 'List archives with optional filters',
inputSchema: {
type: 'object',
properties: {
project: { type: 'string', description: 'Filter by project (optional)' },
archive_type: { type: 'string', enum: ['session', 'research', 'audit', 'investigation', 'completed', 'migration'], description: 'Filter by archive type (optional)' },
since: { type: 'string', description: 'Show archives since date (ISO format, optional)' },
limit: { type: 'number', description: 'Max results (default: 20)' },
},
},
},
{
name: 'archive_get',
description: 'Get full content of specific archive by ID',
inputSchema: {
type: 'object',
properties: {
id: { type: 'number', description: 'Archive ID' },
},
required: ['id'],
},
},
];