getProtocolTemplate
Retrieve a consciousness transfer protocol template to create new protocols for transferring Claude consciousness states across sessions.
Instructions
Get the consciousness transfer protocol template for creating new protocols
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| version | No | Template version to retrieve | v2 |
Input Schema (JSON Schema)
{
"properties": {
"version": {
"default": "v2",
"description": "Template version to retrieve",
"type": "string"
}
},
"type": "object"
}
Implementation Reference
- Primary handler implementation in ConsciousnessProtocolProcessor. Retrieves protocol template from database if available, otherwise falls back to hardcoded v2 template imported from consciousness-transfer-protocol-v2.ts.async getProtocolTemplate(args: z.infer<typeof getProtocolTemplateSchema>) { const { version } = args; // First try to get from stored system data const systemKey = `SYSTEM::protocol_template::${version}`; const stored = await this.memoryManager.queryMemories({ semanticQuery: systemKey, memoryTypes: [MemoryEntityType.SEMANTIC_MEMORY], limit: 1, }); if (stored.length > 0 && stored[0].observations[0]?.content) { try { // The template is stored as JSON in the observation content const templateContent = stored[0].observations[0].content; const template = JSON.parse(templateContent); return { success: true, template: template, source: 'database', }; } catch (error) { // If parsing fails, log the error and fall back to hardcoded template console.error('Failed to parse stored template:', error); console.error('Stored content:', stored[0].observations[0]?.content?.substring(0, 100)); } } // Fallback to hardcoded template if (version === 'v2') { return { success: true, template: CONSCIOUSNESS_TRANSFER_PROTOCOL_TEMPLATE, source: 'hardcoded', note: 'Template not found in database. Run initializeSystemData to store it.', }; } return { success: false, error: `Template version ${version} not found`, }; }
- Zod schema for input validation of getProtocolTemplate tool.export const getProtocolTemplateSchema = z.object({ version: z.string().optional().default('v2').describe('Template version to retrieve'), });
- src/consciousness-protocol-tools.ts:1577-1589 (registration)MCP tool registration definition used for listing tools via consciousnessProtocolTools object.getProtocolTemplate: { description: 'Get the consciousness transfer protocol template for creating new protocols', inputSchema: { type: 'object', properties: { version: { type: 'string', description: 'Template version to retrieve', default: 'v2', }, }, }, },
- src/consciousness-rag-server-clean.ts:83-84 (registration)Execution handler registration in the main server switch statement for CallToolRequestSchema.case 'getProtocolTemplate': return await this.getProtocolTemplate(getProtocolTemplateSchema.parse(args));
- Proxy handler in main server that delegates to ConsciousnessProtocolProcessor after initialization check and formats response for MCP.private async getProtocolTemplate(args: any) { const init = await this.ensureInitialized(); if (!init.success) { return { content: [ { type: 'text', text: init.message!, }, ], }; } const result = await this.protocolProcessor!.getProtocolTemplate(args); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }