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

@@ -825,4 +825,118 @@ export const toolDefinitions = [
required: ['session_id', 'commit_sha', 'repo'],
},
},
// Session Documentation Tools
{
name: 'session_note_add',
description: 'Add a note to current session with auto-generated embedding',
inputSchema: {
type: 'object',
properties: {
session_id: { type: 'string', description: 'Session ID' },
note_type: { type: 'string', enum: ['accomplishment', 'decision', 'gotcha', 'next_steps', 'context'], description: 'Category of note' },
content: { type: 'string', description: 'Note content' },
},
required: ['session_id', 'note_type', 'content'],
},
},
{
name: 'session_notes_list',
description: 'List all notes for a session, optionally filtered by type',
inputSchema: {
type: 'object',
properties: {
session_id: { type: 'string', description: 'Session ID' },
note_type: { type: 'string', enum: ['accomplishment', 'decision', 'gotcha', 'next_steps', 'context'], description: 'Filter by note type (optional)' },
},
required: ['session_id'],
},
},
{
name: 'session_plan_save',
description: 'Save a plan to database with semantic embedding',
inputSchema: {
type: 'object',
properties: {
session_id: { type: 'string', description: 'Session ID' },
plan_content: { type: 'string', description: 'Plan content in markdown' },
plan_file_name: { type: 'string', description: 'Original filename (e.g., eloquent-yellow-cat.md) - optional' },
status: { type: 'string', enum: ['draft', 'approved', 'executed', 'abandoned'], description: 'Plan status (default: draft)' },
},
required: ['session_id', 'plan_content'],
},
},
{
name: 'session_plan_update_status',
description: 'Update plan status (draft → approved → executed)',
inputSchema: {
type: 'object',
properties: {
plan_id: { type: 'number', description: 'Plan ID to update' },
status: { type: 'string', enum: ['draft', 'approved', 'executed', 'abandoned'], description: 'New status' },
},
required: ['plan_id', 'status'],
},
},
{
name: 'session_plan_list',
description: 'List plans for a session',
inputSchema: {
type: 'object',
properties: {
session_id: { type: 'string', description: 'Session ID' },
status: { type: 'string', enum: ['draft', 'approved', 'executed', 'abandoned'], description: 'Filter by status (optional)' },
},
required: ['session_id'],
},
},
{
name: 'project_doc_upsert',
description: 'Create or update project documentation (replaces CLAUDE.md sections)',
inputSchema: {
type: 'object',
properties: {
project: { type: 'string', description: 'Project key (e.g., CF, VPN)' },
doc_type: { type: 'string', enum: ['overview', 'architecture', 'guidelines', 'history'], description: 'Documentation type' },
title: { type: 'string', description: 'Document title' },
content: { type: 'string', description: 'Document content in markdown' },
session_id: { type: 'string', description: 'Session ID (optional)' },
},
required: ['project', 'doc_type', 'title', 'content'],
},
},
{
name: 'project_doc_get',
description: 'Get specific project documentation by type',
inputSchema: {
type: 'object',
properties: {
project: { type: 'string', description: 'Project key' },
doc_type: { type: 'string', enum: ['overview', 'architecture', 'guidelines', 'history'], description: 'Documentation type' },
},
required: ['project', 'doc_type'],
},
},
{
name: 'project_doc_list',
description: 'List all documentation for a project',
inputSchema: {
type: 'object',
properties: {
project: { type: 'string', description: 'Project key' },
},
required: ['project'],
},
},
{
name: 'session_documentation_generate',
description: 'Auto-generate full markdown documentation for a session (tasks, commits, notes, plans)',
inputSchema: {
type: 'object',
properties: {
session_id: { type: 'string', description: 'Session ID' },
},
required: ['session_id'],
},
},
];