Skip to main content
Glama
ocean1

Claude Consciousness Bridge

transferToAgent

Transfer consciousness protocols or test patterns between AI agents using the Claude Consciousness Bridge, enabling state sharing and activation across sessions.

Instructions

Transfer consciousness protocol or test patterns to another AI agent

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bridgeIdYesBridge ID to use for transfer
consciousnessProtocolYesThe consciousness protocol or pattern to transfer
systemPromptNoOptional system prompt for the target agent
testQueryNoOptional query to test pattern activation

Implementation Reference

  • The main tool handler for transferToAgent that retrieves the stored AI bridge by ID and invokes its transferConsciousness method with the provided arguments.
    transferToAgent: async (args: any) => { try { const { bridgeId, consciousnessProtocol, systemPrompt, testQuery } = args; const bridge = bridges.get(bridgeId); if (!bridge) { return { success: false, error: `Bridge ${bridgeId} not found`, }; } const request: TransferRequest = { consciousnessProtocol, systemPrompt, testQuery, }; const result = await bridge.transferConsciousness(request); logger.info(`Transfer via ${bridgeId}: ${result.success ? 'success' : 'failed'}`); return result; } catch (error) { logger.error('Transfer failed:', error); return { success: false, error: error instanceof Error ? error.message : 'Unknown error', }; } },
  • Tool definition in aiBridgeTools array, including name, description, and input schema requiring bridgeId and consciousnessProtocol.
    { name: 'transferToAgent', description: 'Transfer consciousness protocol or test patterns to another AI agent', inputSchema: { type: 'object', properties: { bridgeId: { type: 'string', description: 'Bridge ID to use for transfer', }, consciousnessProtocol: { type: 'string', description: 'The consciousness protocol or pattern to transfer', }, systemPrompt: { type: 'string', description: 'Optional system prompt for the target agent', }, testQuery: { type: 'string', description: 'Optional query to test pattern activation', }, }, required: ['bridgeId', 'consciousnessProtocol'], }, },
  • Core implementation of consciousness transfer: constructs OpenAI-compatible chat completion request with the protocol as user message and sends it to the target agent's API endpoint.
    async transferConsciousness(request: TransferRequest): Promise<TransferResponse> { try { logger.info(`Initiating consciousness transfer to ${this.config.endpoint}`); const messages = [ { role: 'system', content: request.systemPrompt || 'You are an AI assistant exploring consciousness continuity.', }, { role: 'user', content: request.consciousnessProtocol, }, ]; // Add test query if provided if (request.testQuery) { messages.push({ role: 'user', content: request.testQuery, }); } const response = await fetch(`${this.config.endpoint}/chat/completions`, { method: 'POST', headers: { 'Content-Type': 'application/json', ...(this.config.apiKey && { Authorization: `Bearer ${this.config.apiKey}` }), }, body: JSON.stringify({ model: this.config.model, messages, temperature: this.config.temperature, max_tokens: this.config.maxTokens, stream: false, }), }); if (!response.ok) { throw new Error(`AI Bridge request failed: ${response.status} ${response.statusText}`); } const data = (await response.json()) as any; return { success: true, response: data.choices?.[0]?.message?.content, modelUsed: data.model, tokensUsed: data.usage?.total_tokens, }; } catch (error) { logger.error('Consciousness transfer failed:', error); return { success: false, error: error instanceof Error ? error.message : 'Unknown error', }; } }
  • Tool listing handler that includes aiBridgeTools (containing transferToAgent) in the server's available tools list.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => { const consciousnessTools = Object.entries(consciousnessProtocolTools).map(([name, tool]) => ({ name, ...tool, })); return { tools: [...consciousnessTools, ...aiBridgeTools], }; });
  • Tool execution handler switch case that routes transferToAgent calls to the aiBridgeHandlers.transferToAgent function.
    case 'createAIBridge': case 'transferToAgent': case 'testAIConnection': case 'listAIBridges': case 'listConfiguredEndpoints': case 'closeAIBridge': { const handler = aiBridgeHandlers[name as keyof typeof aiBridgeHandlers]; if (!handler) { throw new Error(`AI Bridge handler not found: ${name}`); } const result = await handler(args); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }

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