save_session
Save Claude Code development sessions to a database for tracking project conversations, summaries, and git commits to support Architecture Decision Records (ADR) creation.
Instructions
Save a Claude Code development session to the database
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project | Yes | Project name | |
| conversation | Yes | Full conversation text | |
| git_commit | No | Current git commit hash | |
| summary | No | Short session summary |
Implementation Reference
- index.js:58-69 (handler)Tool registration and handler definition for 'save_session' in index.js.
server.registerTool('save_session', { description: 'Save a Claude Code development session to the database', inputSchema: { project: z.string().describe('Project name'), conversation: z.string().describe('Full conversation text'), git_commit: z.string().optional().describe('Current git commit hash'), summary: z.string().optional().describe('Short session summary'), }, }, async (args) => { const id = saveSession(args); return { content: [{ type: 'text', text: `Session saved (ID: ${id})` }] }; }); - db.js:54-59 (handler)Actual implementation of the 'saveSession' function that interacts with the database.
export function saveSession({ project, conversation, git_commit, summary }) { const result = db.prepare( 'INSERT INTO sessions (project, conversation, git_commit, summary) VALUES (?, ?, ?, ?)' ).run(project, conversation, git_commit ?? null, summary ?? null); return result.lastInsertRowid; }