Skip to main content
Glama
coderdeep11

Claude Infinite Context

by coderdeep11

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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}`);
      }
    }
  • 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 }],
      };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses that the tool loads a checkpoint and returns formatted context, but lacks details on behavioral traits like error handling (e.g., what happens if no checkpoint exists), side effects, or performance considerations. The description adds some value by specifying the return action, but it's insufficient for a tool with potential state implications.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is highly concise and front-loaded: two sentences that directly state the tool's action and outcome without waste. Every sentence earns its place by providing essential information, and there is no redundant or verbose content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (state-related with no annotations and no output schema), the description is minimally adequate. It explains what the tool does and its return purpose, but lacks details on the formatted context's structure, error cases, or interaction with siblings like 'checkpoint'. Without annotations or output schema, more behavioral context would improve completeness for safe agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, and schema description coverage is 100%, so no parameter documentation is needed. The description does not add parameter information, which is appropriate. Baseline for 0 parameters is 4, as the description need not compensate for any gaps, and it correctly avoids unnecessary details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Load the last checkpoint at session start' specifies the action (load) and resource (last checkpoint), with context about when it operates (session start). It distinguishes from siblings like 'checkpoint' (create) and 'rollback' (revert), though not explicitly. However, it lacks full sibling differentiation, such as contrasting with 'status'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context: 'at session start' suggests when to use this tool, likely for initialization or recovery. However, it does not provide explicit guidance on when not to use it or alternatives, such as whether to use 'rollback' for different recovery scenarios. No misleading information is present, but the guidance is limited to implied context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/coderdeep11/claude-memory-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server