resume
Restore previous session context to continue work without losing progress. Loads saved checkpoints to maintain project continuity across sessions.
Instructions
Load the last checkpoint at session start. Returns formatted context to inject into the conversation.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/core/ProjectBrain.ts:188-212 (handler)The core handler function for the 'resume' tool. Loads project state from Redis, validates active files, formats resume context using helper, logs progress, and returns formatted string.async resume(): Promise<string> { const sessionId = this.ensureInitialized(); try { logger.info('Resuming from last checkpoint', { sessionId }); const state = await this.redis.getState(sessionId); // Validate active files still exist const validatedFiles = await this.filterExistingFilesWithCache(state.active_context.active_files); // Format context for Claude const formatted = this.formatStateForResume(state, validatedFiles); logger.info('Resume completed', { version: state.meta.version, activeFiles: validatedFiles.length, }); return formatted; } catch (error) { logger.error('Resume failed', { error, sessionId }); throw new Error(`Resume failed: ${error}`); } }
- src/core/ProjectBrain.ts:217-286 (helper)Private helper that formats the loaded ProjectState into a comprehensive markdown resume context, including project overview, architecture, task, files, changes, decisions, and metadata.private formatStateForResume(state: ProjectState, validatedFiles: string[]): string { const sections: string[] = []; sections.push('# Project Context Resume'); sections.push(''); // Overview if (state.project_context.overview) { sections.push('## Overview'); sections.push(state.project_context.overview); sections.push(''); } // Architecture if (state.project_context.architecture) { sections.push('## Architecture'); sections.push(state.project_context.architecture); sections.push(''); } // Current task if (state.active_context.current_task) { sections.push('## Current Task'); sections.push(state.active_context.current_task); sections.push(''); } // Active files if (validatedFiles.length > 0) { sections.push('## Active Files'); validatedFiles.forEach((file) => sections.push(`- ${file}`)); sections.push(''); } // Recent changes if (state.project_context.recent_changes.length > 0) { sections.push('## Recent Changes'); state.project_context.recent_changes.slice(0, 5).forEach((change) => { sections.push(`### ${new Date(change.timestamp).toLocaleString()}`); sections.push(change.summary); if (change.files.length > 0) { sections.push(`Files: ${change.files.join(', ')}`); } sections.push(''); }); } // Active decisions if (state.active_context.active_decisions.length > 0) { sections.push('## Active Decisions'); state.active_context.active_decisions.forEach((decision) => { const status = decision.status === 'decided' ? '✓' : '?'; sections.push(`${status} ${decision.question}`); if (decision.decision) { sections.push(` → ${decision.decision}`); } }); sections.push(''); } // Metadata sections.push('---'); sections.push( `Last checkpoint: ${new Date(state.meta.last_checkpoint).toLocaleString()}` ); sections.push(`Version: ${state.meta.version}`); sections.push(`Token budget used: ${state.meta.token_budget_used.toLocaleString()}`); return sections.join('\n'); }
- src/index.ts:76-84 (registration)MCP tool registration in ListToolsRequestSchema handler: defines 'resume' tool name, description, and schema (no input arguments).{ name: 'resume', description: 'Load the last checkpoint at session start. Returns formatted context to inject into the conversation.', inputSchema: { type: 'object', properties: {}, }, },
- src/index.ts:137-142 (registration)Tool call dispatcher in CallToolRequestSchema handler: switch case for 'resume' that invokes ProjectBrain.resume() and returns result as MCP text content.case 'resume': { const result = await this.brain.resume(); return { content: [{ type: 'text', text: result }], }; }