Skip to main content
Glama

aiana_memory_export

Export stored memory records as JSONL data from the semantic memory layer. Filter by project to organize exported memories.

Instructions

Export all stored memories as an array of memory records (JSONL-compatible). Optionally filter by project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectNoExport only memories for this project.

Implementation Reference

  • Actual implementation of exportMemories in the adapter. Uses Qdrant scroll API with pagination to fetch all memories, optionally filtered by project. Converts Qdrant points to MemoryRecord format and returns the complete array.
    async exportMemories(project?: string): Promise<MemoryRecord[]> {
      await ready;
    
      const filter = project
        ? { must: [{ key: "project", match: { value: project } }] }
        : undefined;
    
      const records: MemoryRecord[] = [];
      let offset: string | undefined = undefined;
    
      // Paginate through all points using Qdrant scroll API
      while (true) {
        const body: Record<string, unknown> = {
          limit: 250,
          with_payload: true,
          with_vector: false,
        };
        if (filter) body.filter = filter;
        if (offset) body.offset = offset;
    
        const result = await qdrantRequest<{
          result: {
            points: Array<{ id: string; payload: QdrantPoint["payload"] }>;
            next_page_offset?: string;
          };
        }>(qdrantUrl, qdrantApiKey, "POST", `/collections/${COLLECTION}/points/scroll`, body);
    
        const points = result.result?.points ?? [];
        for (const p of points) {
          records.push({
            id: p.id,
            content: p.payload.content,
            project: p.payload.project,
            memoryType: p.payload.memoryType as MemoryRecord["memoryType"],
            sessionId: p.payload.sessionId,
            timestamp: p.payload.timestamp,
            metadata: p.payload.metadata,
          });
        }
    
        const next = result.result?.next_page_offset;
        if (!next || points.length === 0) break;
        offset = next;
      }
    
      return records;
    },
  • Layer wrapper function exportMemories that delegates to the adapter. Accepts an optional project filter parameter and passes it through to adapter.exportMemories.
    /**
     * Export all memories, optionally filtered to a project.
     */
    export async function exportMemories(
      adapter: AianaAdapter,
      project?: string,
    ): Promise<MemoryRecord[]> {
      return adapter.exportMemories(project);
    }
  • src/app.ts:114-126 (registration)
    Tool registration for aiana_memory_export. Defines the tool name, description, input schema (optional project filter), and the execute handler that calls layers.memories.exportMemories.
    {
      name: "aiana_memory_export",
      description:
        "Export all stored memories as an array of memory records (JSONL-compatible). Optionally filter by project.",
      inputSchema: {
        type: "object",
        properties: {
          project: { type: "string", description: "Export only memories for this project." },
        },
      },
      execute: async (args) =>
        layers.memories.exportMemories(adapter, args.project as string | undefined),
    },
  • MemoryRecord interface defining the structure of exported memory records including id, content, project, memoryType, sessionId, timestamp, score, and metadata fields.
    export interface MemoryRecord {
      id: string;
      content: string;
      project?: string;
      memoryType: "note" | "preference" | "pattern" | "insight" | "conversation";
      sessionId?: string;
      timestamp: string; // ISO 8601
      score?: number;    // populated during semantic search
      metadata?: Record<string, unknown>;
    }

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/git-fabric/aiana'

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