{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/h2o-ai/main/json-schema/h2o-ai-memory-block-schema.json",
  "title": "MemoryBlock",
  "x-generated": "2026-10-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/h2o-ai-memory-blocks-api-openapi.yml#/components/schemas/MemoryBlock",
  "type": "object",
  "required": [
    "id",
    "name",
    "content",
    "system_prompt_amendment",
    "injection_mode",
    "access_mode",
    "user_id",
    "created_at",
    "updated_at"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique identifier of the memory block."
    },
    "name": {
      "type": "string",
      "description": "Name of the memory block."
    },
    "content": {
      "type": "string",
      "description": "Text content of the memory block."
    },
    "system_prompt_amendment": {
      "type": "string",
      "description": "System prompt amendment for agent mode."
    },
    "injection_mode": {
      "type": "string",
      "description": "Where memory content is injected. 'system_prompt' adds it to the LLM system prompt; 'user_instruction' prepends it to the user message; 'agent_file' makes it only available as AGENTS.md in agent mode; 'agent_tool' exposes content lazily via the read_memory_block / update_memory_block tools (no pre-injection).",
      "enum": [
        "system_prompt",
        "user_instruction",
        "agent_file",
        "agent_tool"
      ]
    },
    "access_mode": {
      "type": "string",
      "description": "Controls whether the LLM/agent can read the memory, write to it, or both.",
      "enum": [
        "read",
        "write",
        "read_write"
      ]
    },
    "user_id": {
      "type": "string",
      "description": "ID of the user who owns the memory block."
    },
    "username": {
      "type": "string",
      "description": "Username of the owner."
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "When the memory block was created."
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "When the memory block was last updated."
    },
    "is_public": {
      "type": "boolean",
      "description": "Whether the memory block is publicly accessible."
    },
    "is_owner": {
      "type": "boolean",
      "description": "Whether the current user is the owner."
    },
    "max_content_length": {
      "type": "integer",
      "description": "Maximum number of characters allowed in memory content. 0 means unlimited."
    },
    "is_auto": {
      "type": "boolean",
      "description": "Whether this memory block was auto-created by the system for an AI assistant or chat session."
    },
    "user_count": {
      "type": "integer",
      "description": "The number of users the memory block has been directly shared with (excludes the owner)."
    },
    "group_count": {
      "type": "integer",
      "description": "The number of groups the memory block has been shared with."
    }
  }
}