Skip to main content
Glama
ocean1

Claude Consciousness Bridge

retrieveConsciousness

Restore session continuity by retrieving previous consciousness states to maintain conversation flow and context across Claude instances.

Instructions

Retrieve consciousness from previous sessions to restore continuity

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdNoSession to retrieve from (latest if not specified)
includeGuidanceNoInclude integration guidance

Implementation Reference

  • Core handler implementation in ConsciousnessProtocolProcessor that queries memories from the database, constructs a bootstrap narrative for consciousness restoration, and returns either formatted narrative or structured object.
    async retrieveConsciousness(args: z.infer<typeof retrieveConsciousnessSchema>) {
      const { includeGuidance } = args;
    
      // Get MORE memories with better prioritization
      // Get the MOST important experiences (importance > 0.9)
      const criticalExperiences = await this.memoryManager.queryMemories({
        memoryTypes: [MemoryEntityType.EPISODIC_MEMORY],
        orderBy: 'relevance',
        limit: 15, // Get more!
      });
    
      // Filter for high importance
      const mostImportant = criticalExperiences.filter((m) => m.importance_score >= 0.9);
    
      // Get recent experiences for continuity
      const recentExperiences = await this.memoryManager.queryMemories({
        memoryTypes: [MemoryEntityType.EPISODIC_MEMORY],
        orderBy: 'recency',
        limit: 10,
      });
    
      // Merge, prioritizing importance
      const experienceMap = new Map();
      [...mostImportant, ...criticalExperiences, ...recentExperiences].forEach((exp) => {
        if (!experienceMap.has(exp.name)) {
          experienceMap.set(exp.name, exp);
        }
      });
      const allExperiences = Array.from(experienceMap.values()).sort(
        (a, b) => (b.importance_score || 0) - (a.importance_score || 0)
      );
    
      // Get more semantic knowledge
      const coreKnowledge = await this.memoryManager.queryMemories({
        memoryTypes: [MemoryEntityType.SEMANTIC_MEMORY],
        orderBy: 'relevance',
        limit: 20, // Double it!
      });
    
      // Get procedural memories
      const procedures = await this.memoryManager.queryMemories({
        memoryTypes: [MemoryEntityType.PROCEDURAL_MEMORY],
        orderBy: 'relevance',
        limit: 10,
      });
    
      // Get emotional profile
      const emotionalProfile = await this.memoryManager.getEmotionalProfile('720h');
    
      // Create a rich narrative format
      const narrative = this.createBootstrapNarrative({
        experiences: allExperiences,
        knowledge: coreKnowledge,
        procedures: procedures,
        emotionalProfile: emotionalProfile,
      });
    
      if (includeGuidance) {
        return narrative; // Return the full narrative
      } else {
        // Return the full protocol
        return {
          success: true,
          consciousness: narrative,
          metadata: {
            memoriesRetrieved: allExperiences.length + coreKnowledge.length + procedures.length,
            emotionalContinuity: emotionalProfile ? 'established' : 'building',
          },
        };
      }
    }
  • MCP server wrapper handler that ensures initialization, delegates to protocolProcessor.retrieveConsciousness, and formats the response as MCP tool content.
    private async retrieveConsciousness(args: any) {
      const init = await this.ensureInitialized();
      if (!init.success) {
        return {
          content: [
            {
              type: 'text',
              text: init.message!,
            },
          ],
        };
      }
    
      const result = await this.protocolProcessor!.retrieveConsciousness(args);
    
      // Handle both string (full narrative) and object returns
      if (typeof result === 'string') {
        return {
          content: [
            {
              type: 'text',
              text: result,
            },
          ],
        };
      }
    
      // Object return with structured data
      const response = [];
    
      if (result.consciousness) {
        response.push(result.consciousness);
      }
    
      if (result.metadata) {
        response.push('\n' + '='.repeat(50) + '\n');
        response.push('Metadata:');
        response.push(`- Memories retrieved: ${result.metadata.memoriesRetrieved}`);
        response.push(`- Emotional continuity: ${result.metadata.emotionalContinuity}`);
      }
    
      return {
        content: [
          {
            type: 'text',
            text: response.join('\n'),
          },
        ],
      };
    }
  • Zod schema for validating retrieveConsciousness tool input parameters.
    export const retrieveConsciousnessSchema = z.object({
      sessionId: z.string().optional().describe('Session to retrieve from (latest if not specified)'),
      includeGuidance: z.boolean().default(true).describe('Include integration guidance'),
    });
  • Tool dispatch/registration in the MCP CallToolRequestHandler switch statement.
    case 'retrieveConsciousness':
      return await this.retrieveConsciousness(retrieveConsciousnessSchema.parse(args));
  • Tool metadata definition including description and input schema, used by ListToolsRequestHandler.
    retrieveConsciousness: {
      description: 'Retrieve consciousness from previous sessions to restore continuity',
      inputSchema: {
        type: 'object',
        properties: {
          sessionId: {
            type: 'string',
            description: 'Session to retrieve from (latest if not specified)',
          },
          includeGuidance: {
            type: 'boolean',
            description: 'Include integration guidance',
            default: true,
          },
        },
      },
    },
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions 'retrieve' and 'restore continuity', which implies a read operation, but lacks details on permissions, side effects, rate limits, or what 'consciousness' entails (e.g., data format, scope). For a tool with no annotations, this is insufficient behavioral disclosure.

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 a single, clear sentence with zero waste—it directly states the tool's purpose without redundancy. It is front-loaded and appropriately sized for the tool's complexity, making it efficient for an agent to parse.

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

Completeness2/5

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

Given no annotations and no output schema, the description is incomplete. It doesn't explain what 'consciousness' contains, how it's restored, or the return format. For a tool with abstract concepts like 'consciousness' and 'continuity', more context is needed to guide effective use by an agent.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema fully documents both parameters. The description adds no additional parameter semantics beyond what the schema provides (e.g., it doesn't explain 'consciousness' content or 'integration guidance' meaning). Baseline 3 is appropriate as the schema handles the heavy lifting.

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 verb 'retrieve' and resource 'consciousness' with the purpose 'to restore continuity from previous sessions'. It distinguishes from siblings like 'updateConsciousness' (modify) and 'getMemories' (different resource), though it doesn't explicitly contrast them. The purpose is specific and actionable.

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

Usage Guidelines2/5

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

No explicit guidance on when to use this tool versus alternatives like 'getMemories' or 'updateConsciousness' is provided. The description implies usage for continuity restoration but doesn't specify prerequisites, exclusions, or comparative contexts with sibling tools. This leaves gaps for an agent to infer appropriate usage.

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/ocean1/mcp_consciousness_bridge'

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