Add session documentation system (migration + MCP tools)

Phase 1-2 complete: Database schema + 9 MCP tools for session docs

Database Changes (migration 016):
- session_notes table (accomplishments, decisions, gotchas, etc.)
- session_plans table (plan mode plans with lifecycle tracking)
- project_documentation table (persistent project docs)
- sessions.documentation column (auto-generated markdown)
- HNSW indexes for semantic search across all doc types

MCP Tools Added (session-docs.ts):
1. session_note_add - Add structured notes to session
2. session_notes_list - List notes by type
3. session_plan_save - Save plan with embedding
4. session_plan_update_status - Track plan lifecycle
5. session_plan_list - List session plans
6. project_doc_upsert - Create/update project docs
7. project_doc_get - Get specific doc by type
8. project_doc_list - List all project docs
9. session_documentation_generate - Auto-generate markdown

Replaces: CLAUDE.md files, ~/.claude/plans/ directory

Next: Update session-start/end scripts for temp file management

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Christian Gick
2026-01-19 10:13:57 +02:00
parent afce0bd3e5
commit 3745a13eaf
5 changed files with 926 additions and 0 deletions

View File

@@ -49,6 +49,17 @@ import {
buildRecord,
sessionCommitLink,
} from './tools/sessions.js';
import {
sessionNoteAdd,
sessionNotesList,
sessionPlanSave,
sessionPlanUpdateStatus,
sessionPlanList,
projectDocUpsert,
projectDocGet,
projectDocList,
sessionDocumentationGenerate,
} from './tools/session-docs.js';
// Create MCP server
const server = new Server(
@@ -476,6 +487,82 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
);
break;
// Session Documentation
case 'session_note_add':
result = await sessionNoteAdd({
session_id: a.session_id,
note_type: a.note_type,
content: a.content,
});
break;
case 'session_notes_list':
result = JSON.stringify(
await sessionNotesList({
session_id: a.session_id,
note_type: a.note_type,
}),
null,
2
);
break;
case 'session_plan_save':
result = await sessionPlanSave({
session_id: a.session_id,
plan_content: a.plan_content,
plan_file_name: a.plan_file_name,
status: a.status,
});
break;
case 'session_plan_update_status':
result = await sessionPlanUpdateStatus({
plan_id: a.plan_id,
status: a.status,
});
break;
case 'session_plan_list':
result = JSON.stringify(
await sessionPlanList({
session_id: a.session_id,
status: a.status,
}),
null,
2
);
break;
case 'project_doc_upsert':
result = await projectDocUpsert({
project: a.project,
doc_type: a.doc_type,
title: a.title,
content: a.content,
session_id: a.session_id,
});
break;
case 'project_doc_get':
result = JSON.stringify(
await projectDocGet({
project: a.project,
doc_type: a.doc_type,
}),
null,
2
);
break;
case 'project_doc_list':
result = JSON.stringify(
await projectDocList({
project: a.project,
}),
null,
2
);
break;
case 'session_documentation_generate':
result = await sessionDocumentationGenerate({
session_id: a.session_id,
});
break;
default:
throw new Error(`Unknown tool: ${name}`);
}