resume
Restore previous project context and conversation state when starting a new session with Claude Infinite Context.
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)Core implementation of the resume tool: retrieves the latest project state from Redis, validates active files exist, formats the state into a markdown context summary, and returns it for conversation injection.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)Helper function that formats the project state into a structured Markdown document for resuming context in the conversation, including overview, architecture, tasks, 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 for 'resume', listed in ListToolsRequestSchema handler with description and empty input schema (no parameters required).{ 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 (handler)MCP CallToolRequestSchema handler for 'resume' tool: delegates execution to ProjectBrain.resume() and formats response as MCP content.case 'resume': { const result = await this.brain.resume(); return { content: [{ type: 'text', text: result }], }; }
- src/index.ts:80-83 (schema)Input schema for resume tool: empty object (no required parameters).inputSchema: { type: 'object', properties: {}, },