← Back to templates

Agent Memory

ai

Persistent memory layer for AI agents — store context, decisions, and learnings across sessions.

Collections

Memories

Persistent facts, preferences, and context

Schema Fields

content:stringtype:stringconfidence:numbersource:stringtags:arrayexpires_at:string

Sessions

Conversation and task sessions

Schema Fields

started_at:stringended_at:stringsummary:stringoutcome:stringtask_type:stringuser_id:string

Tool Usage

Record of tool calls and their outcomes

Schema Fields

tool_name:stringinput:objectoutput:objectresult:stringduration_ms:numbererror:string

Relationships

memories
recalled_in
sessionsMemory was recalled during session
memories
created_by
sessionsMemory was created during session
tools
used_in
sessionsTool was used in session
memories
informed_by
memoriesMemory informed by another memory

Quick Start

Create the collections using the Rekor CLI:

rekor collections upsert memories --workspace agent-brain --schema @memories.json

Full Schema (JSON)

Copy the complete template definition:

{
  "collections": [
    {
      "id": "memories",
      "name": "Memories",
      "description": "Persistent facts, preferences, and context",
      "icon": "lightbulb",
      "color": "#f59e0b",
      "json_schema": {
        "type": "object",
        "required": [
          "content",
          "type"
        ],
        "properties": {
          "content": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "fact",
              "preference",
              "context",
              "decision",
              "learning"
            ]
          },
          "confidence": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "source": {
            "type": "string"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      }
    },
    {
      "id": "sessions",
      "name": "Sessions",
      "description": "Conversation and task sessions",
      "icon": "message-circle",
      "color": "#3b82f6",
      "json_schema": {
        "type": "object",
        "required": [
          "started_at"
        ],
        "properties": {
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "ended_at": {
            "type": "string",
            "format": "date-time"
          },
          "summary": {
            "type": "string"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "completed",
              "abandoned",
              "escalated",
              "ongoing"
            ]
          },
          "task_type": {
            "type": "string"
          },
          "user_id": {
            "type": "string"
          }
        }
      }
    },
    {
      "id": "tools",
      "name": "Tool Usage",
      "description": "Record of tool calls and their outcomes",
      "icon": "wrench",
      "color": "#8b5cf6",
      "json_schema": {
        "type": "object",
        "required": [
          "tool_name",
          "result"
        ],
        "properties": {
          "tool_name": {
            "type": "string"
          },
          "input": {
            "type": "object"
          },
          "output": {
            "type": "object"
          },
          "result": {
            "type": "string",
            "enum": [
              "success",
              "failure",
              "partial"
            ]
          },
          "duration_ms": {
            "type": "number"
          },
          "error": {
            "type": "string"
          }
        }
      }
    }
  ],
  "relationships": [
    {
      "type": "recalled_in",
      "source": "memories",
      "target": "sessions",
      "description": "Memory was recalled during session"
    },
    {
      "type": "created_by",
      "source": "memories",
      "target": "sessions",
      "description": "Memory was created during session"
    },
    {
      "type": "used_in",
      "source": "tools",
      "target": "sessions",
      "description": "Tool was used in session"
    },
    {
      "type": "informed_by",
      "source": "memories",
      "target": "memories",
      "description": "Memory informed by another memory"
    }
  ]
}