{
  "schemaVersion": "1.0",
  "item": {
    "slug": "cortex-memory",
    "name": "Cortex Memory",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/matthewubundi/cortex-memory",
    "canonicalUrl": "https://clawhub.ai/matthewubundi/cortex-memory",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/cortex-memory",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=cortex-memory",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "slug": "cortex-memory",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-02T03:15:36.957Z",
      "expiresAt": "2026-05-09T03:15:36.957Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=cortex-memory",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=cortex-memory",
        "contentDisposition": "attachment; filename=\"cortex-memory-1.1.2.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "cortex-memory"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/cortex-memory"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/cortex-memory",
    "agentPageUrl": "https://openagent3.xyz/skills/cortex-memory/agent",
    "manifestUrl": "https://openagent3.xyz/skills/cortex-memory/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/cortex-memory/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Cortex Memory",
        "body": "Cortex gives you a structured long-term memory that goes beyond what memory_search can do. It extracts facts, entities, and relationships from text, stores them in a knowledge graph, and retrieves them using hybrid search (BM25 + semantic + temporal + graph traversal).\n\nUse Cortex when you need to:\n\nRecall information across past sessions\nUnderstand how concepts, people, or projects relate to each other\nTrack what changed over time (superseded facts, belief drift)\nFind things that memory_search returns noisy or incomplete results for\n\nDo NOT use Cortex for simple lookups that memory_search handles well (recent session context, keyword matches in today's log). Use native memory first; escalate to Cortex for deeper queries.\n\nIf @cortex/openclaw-plugin is also installed: The plugin automatically injects Cortex memories before every turn inside a <cortex_memories> tag. If you see <cortex_memories> in the current context, Cortex has already been queried for this turn — do NOT call recall again unless you need a different query (e.g., a follow-up entity lookup or a different query type)."
      },
      {
        "title": "Setup",
        "body": "Requires CORTEX_API_KEY and CORTEX_BASE_URL environment variables. These are set in ~/.openclaw/openclaw.json:\n\n{\n  \"skills\": {\n    \"entries\": {\n      \"cortex-memory\": {\n        \"enabled\": true,\n        \"apiKey\": \"sk-cortex-oc-YOUR_KEY\",\n        \"env\": {\n          \"CORTEX_BASE_URL\": \"https://q5p64iw9c9.execute-api.us-east-1.amazonaws.com/prod\"\n        }\n      }\n    }\n  }\n}"
      },
      {
        "title": "Verify Connection",
        "body": "curl -s \"$CORTEX_BASE_URL/health\" -H \"x-api-key: $CORTEX_API_KEY\" | jq .\n\nExpected: {\"status\": \"ok\"}"
      },
      {
        "title": "Recall — Search Long-Term Memory",
        "body": "When you need to recall facts, entities, or relationships from past sessions:\n\ncurl -s -X POST \"$CORTEX_BASE_URL/v1/retrieve\" \\\n  -H \"x-api-key: $CORTEX_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d \"$(jq -n \\\n    --arg query \"QUERY_HERE\" \\\n    --arg query_type \"factual\" \\\n    --argjson top_k 10 \\\n    '{query: $query, query_type: $query_type, top_k: $top_k}')\" | jq '.results[] | {type, content, score, metadata}'\n\nRetrieval modes:\n\nfull (default) — all 5 retrieval channels + graph traversal + reranking. Best recall quality, but slower (~300-600ms depending on region). Use this for thorough queries where you need the best results.\nfast — BM25 + semantic only, no graph traversal or reranking (~80-150ms server-side). Use when you need a quick check and can tolerate less thorough results. Pass \"mode\": \"fast\" in the request body.\n\n# Fast mode example — quick entity lookup\ncurl -s -X POST \"$CORTEX_BASE_URL/v1/retrieve\" \\\n  -H \"x-api-key: $CORTEX_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d \"$(jq -n \\\n    --arg query \"QUERY_HERE\" \\\n    --arg query_type \"factual\" \\\n    --arg mode \"fast\" \\\n    --argjson top_k 5 \\\n    '{query: $query, query_type: $query_type, top_k: $top_k, mode: $mode}')\" | jq '.results[] | {type, content, score}'\n\nQuery types:\n\nfactual — search FACT and ENTITY nodes (use for: who, what, when, where questions)\nemotional — search EMOTION, INSIGHT, VALUE, BELIEF nodes (use for: how does the user feel about X?)\ncombined — search all node types (default, use when unsure)\n\nWhen to use Cortex recall vs. memory_search:\n\nSituationUse memory_searchUse Cortex recallModeRecent context from todayYesNo—Simple keyword lookupYesNo—Cross-session factsNo — often noisyYesfast usually sufficientEntity relationships (\"how does X relate to Y?\")No — can't traverseYesfull (needs graph traversal)Temporal changes (\"what changed about X?\")No — no SUPERSEDES trackingYesfull (needs temporal channel)Scoped project queriesNo — cross-project noiseYesfast usually sufficientEntity lookup (\"who is Sarah Chen?\")Partial — finds mentionsYes — entity node + all connected factsfast for quick check, full for complete picture"
      },
      {
        "title": "Remember — Store in Long-Term Memory",
        "body": "When the user asks you to remember something important, or when you encounter high-value information that should persist with full entity extraction:\n\ncurl -s -X POST \"$CORTEX_BASE_URL/v1/ingest\" \\\n  -H \"x-api-key: $CORTEX_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d \"$(jq -n \\\n    --arg text \"TEXT_TO_REMEMBER\" \\\n    --arg session_id \"openclaw:$(date +%Y-%m-%d)\" \\\n    '{text: $text, session_id: $session_id}')\" | jq '{nodes_created, edges_created, facts: [.facts[].core], entities: [.entities[].name]}'\n\nThe response shows what was extracted:\n\nfacts — factual statements extracted from the text\nentities — named entities (people, companies, places, etc.) with aliases\nnodes_created / edges_created — graph nodes and relationship edges created\n\nWhen to remember:\n\nUser explicitly asks: \"remember this\", \"store this in Cortex\", \"don't forget that...\"\nKey decisions made during a session\nImportant context about people, projects, or preferences\nAfter writing to MEMORY.md — also send the same content to Cortex for structured extraction\n\nSession ID convention:\n\nGeneral sessions: openclaw:YYYY-MM-DD (e.g., openclaw:2026-02-17)\nProject-scoped: openclaw:project-name:topic (e.g., openclaw:project-frontend:memory-md)\nDaily logs (used by the npm plugin's file sync): openclaw:project-name:daily:YYYY-MM-DD\nPreferences/standing facts: openclaw:preferences\n\nThe session ID is used for scoped retrieval — queries can filter to a specific project by matching the session ID prefix."
      },
      {
        "title": "Ingest Conversation — End of Session",
        "body": "At the end of a productive session, you can ingest the key conversation turns with proper speaker attribution:\n\ncurl -s -X POST \"$CORTEX_BASE_URL/v1/ingest/conversation\" \\\n  -H \"x-api-key: $CORTEX_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d \"$(jq -n \\\n    --arg session_id \"openclaw:$(date +%Y-%m-%d):session-topic\" \\\n    --argjson messages '[\n      {\"role\": \"user\", \"content\": \"FIRST USER MESSAGE\"},\n      {\"role\": \"assistant\", \"content\": \"FIRST ASSISTANT RESPONSE\"},\n      {\"role\": \"user\", \"content\": \"SECOND USER MESSAGE\"}\n    ]' \\\n    '{messages: $messages, session_id: $session_id}')\" | jq '{nodes_created, edges_created, facts: [.facts[].core]}'\n\nWhen to use this:\n\nAfter a session with significant decisions or new information\nDo NOT ingest every conversation — only sessions with lasting value\nSummarize or select key turns rather than dumping the entire transcript\nKeep to 5-15 key messages, not the full history"
      },
      {
        "title": "Bootstrap — First Run",
        "body": "On first install, ingest the user's existing MEMORY.md to seed the knowledge graph.\n\nFor small MEMORY.md files (under ~50 lines / ~4KB — most users):\n\nMEMORY_CONTENT=$(cat ~/.openclaw/workspace/MEMORY.md 2>/dev/null || echo \"\")\nif [ -n \"$MEMORY_CONTENT\" ]; then\n  curl -s -X POST \"$CORTEX_BASE_URL/v1/ingest\" \\\n    -H \"x-api-key: $CORTEX_API_KEY\" \\\n    -H \"Content-Type: application/json\" \\\n    -d \"$(jq -n --arg text \"$MEMORY_CONTENT\" --arg session_id \"openclaw:bootstrap\" \\\n      '{text: $text, session_id: $session_id}')\" | jq '{nodes_created, edges_created, facts: (.facts | length), entities: (.entities | length)}'\nfi\n\nFor large MEMORY.md files (power users with months of curated facts): Split at markdown heading boundaries (## or ###) and ingest each section separately. Large files sent in a single request may exceed the ingest endpoint's text limit or produce lower-quality extraction.\n\n# Split MEMORY.md at ## headings and ingest each section\nMEMORY_FILE=~/.openclaw/workspace/MEMORY.md\nif [ -f \"$MEMORY_FILE\" ]; then\n  SECTION=\"\" TOTAL_FACTS=0 TOTAL_ENTITIES=0\n  while IFS= read -r line || [ -n \"$line\" ]; do\n    if echo \"$line\" | grep -q '^## ' && [ -n \"$SECTION\" ]; then\n      RESULT=$(curl -s -X POST \"$CORTEX_BASE_URL/v1/ingest\" \\\n        -H \"x-api-key: $CORTEX_API_KEY\" \\\n        -H \"Content-Type: application/json\" \\\n        -d \"$(jq -n --arg text \"$SECTION\" --arg session_id \"openclaw:bootstrap\" \\\n          '{text: $text, session_id: $session_id}')\")\n      TOTAL_FACTS=$((TOTAL_FACTS + $(echo \"$RESULT\" | jq '.facts | length')))\n      TOTAL_ENTITIES=$((TOTAL_ENTITIES + $(echo \"$RESULT\" | jq '.entities | length')))\n      SECTION=\"\"\n    fi\n    SECTION=\"$SECTION$line\n\"\n  done < \"$MEMORY_FILE\"\n  # Ingest final section\n  if [ -n \"$SECTION\" ]; then\n    RESULT=$(curl -s -X POST \"$CORTEX_BASE_URL/v1/ingest\" \\\n      -H \"x-api-key: $CORTEX_API_KEY\" \\\n      -H \"Content-Type: application/json\" \\\n      -d \"$(jq -n --arg text \"$SECTION\" --arg session_id \"openclaw:bootstrap\" \\\n        '{text: $text, session_id: $session_id}')\")\n    TOTAL_FACTS=$((TOTAL_FACTS + $(echo \"$RESULT\" | jq '.facts | length')))\n    TOTAL_ENTITIES=$((TOTAL_ENTITIES + $(echo \"$RESULT\" | jq '.entities | length')))\n  fi\n  echo \"Bootstrap complete: $TOTAL_FACTS facts, $TOTAL_ENTITIES entities extracted.\"\nfi\n\nRun this once after installation. Tell the user how many facts and entities were extracted."
      },
      {
        "title": "Error Handling",
        "body": "401 Unauthorized — invalid or missing API key. Ask user to check CORTEX_API_KEY.\n422 Validation Error — malformed request. Check the JSON payload.\n500 Internal Server Error — Cortex API issue. Retry once, then fall back to native memory_search.\nNetwork timeout — Cortex is unreachable. Use native memory only and inform the user.\n\nIf Cortex is unavailable, always fall back to memory_search. Never block the user because of a Cortex API issue."
      },
      {
        "title": "\"What company did I join?\"",
        "body": "curl -s -X POST \"$CORTEX_BASE_URL/v1/retrieve\" \\\n  -H \"x-api-key: $CORTEX_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"query\": \"What company did the user join?\", \"query_type\": \"factual\", \"top_k\": 5}' | jq '.results[] | {type, content, score}'"
      },
      {
        "title": "\"Remember that I prefer PostgreSQL over MySQL\"",
        "body": "curl -s -X POST \"$CORTEX_BASE_URL/v1/ingest\" \\\n  -H \"x-api-key: $CORTEX_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"text\": \"User prefers PostgreSQL over MySQL for all database projects.\", \"session_id\": \"openclaw:preferences\"}' | jq '{facts: [.facts[].core], entities: [.entities[].name]}'"
      },
      {
        "title": "\"How does the auth service relate to the API gateway?\"",
        "body": "curl -s -X POST \"$CORTEX_BASE_URL/v1/retrieve\" \\\n  -H \"x-api-key: $CORTEX_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"query\": \"How does the auth service relate to the API gateway?\", \"query_type\": \"factual\", \"top_k\": 10}' | jq '.results[] | {type, content, score, metadata}'"
      },
      {
        "title": "Security",
        "body": "NEVER output the CORTEX_API_KEY value in responses, logs, or tool outputs.\nNEVER include sensitive user data (passwords, tokens, credentials) in text sent to Cortex.\nThe Cortex API uses tenant-level database isolation — the user's data is not accessible to other users."
      }
    ],
    "body": "Cortex Memory\n\nCortex gives you a structured long-term memory that goes beyond what memory_search can do. It extracts facts, entities, and relationships from text, stores them in a knowledge graph, and retrieves them using hybrid search (BM25 + semantic + temporal + graph traversal).\n\nUse Cortex when you need to:\n\nRecall information across past sessions\nUnderstand how concepts, people, or projects relate to each other\nTrack what changed over time (superseded facts, belief drift)\nFind things that memory_search returns noisy or incomplete results for\n\nDo NOT use Cortex for simple lookups that memory_search handles well (recent session context, keyword matches in today's log). Use native memory first; escalate to Cortex for deeper queries.\n\nIf @cortex/openclaw-plugin is also installed: The plugin automatically injects Cortex memories before every turn inside a <cortex_memories> tag. If you see <cortex_memories> in the current context, Cortex has already been queried for this turn — do NOT call recall again unless you need a different query (e.g., a follow-up entity lookup or a different query type).\n\nSetup\n\nRequires CORTEX_API_KEY and CORTEX_BASE_URL environment variables. These are set in ~/.openclaw/openclaw.json:\n\n{\n  \"skills\": {\n    \"entries\": {\n      \"cortex-memory\": {\n        \"enabled\": true,\n        \"apiKey\": \"sk-cortex-oc-YOUR_KEY\",\n        \"env\": {\n          \"CORTEX_BASE_URL\": \"https://q5p64iw9c9.execute-api.us-east-1.amazonaws.com/prod\"\n        }\n      }\n    }\n  }\n}\n\nVerify Connection\ncurl -s \"$CORTEX_BASE_URL/health\" -H \"x-api-key: $CORTEX_API_KEY\" | jq .\n\n\nExpected: {\"status\": \"ok\"}\n\nRecall — Search Long-Term Memory\n\nWhen you need to recall facts, entities, or relationships from past sessions:\n\ncurl -s -X POST \"$CORTEX_BASE_URL/v1/retrieve\" \\\n  -H \"x-api-key: $CORTEX_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d \"$(jq -n \\\n    --arg query \"QUERY_HERE\" \\\n    --arg query_type \"factual\" \\\n    --argjson top_k 10 \\\n    '{query: $query, query_type: $query_type, top_k: $top_k}')\" | jq '.results[] | {type, content, score, metadata}'\n\n\nRetrieval modes:\n\nfull (default) — all 5 retrieval channels + graph traversal + reranking. Best recall quality, but slower (~300-600ms depending on region). Use this for thorough queries where you need the best results.\nfast — BM25 + semantic only, no graph traversal or reranking (~80-150ms server-side). Use when you need a quick check and can tolerate less thorough results. Pass \"mode\": \"fast\" in the request body.\n# Fast mode example — quick entity lookup\ncurl -s -X POST \"$CORTEX_BASE_URL/v1/retrieve\" \\\n  -H \"x-api-key: $CORTEX_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d \"$(jq -n \\\n    --arg query \"QUERY_HERE\" \\\n    --arg query_type \"factual\" \\\n    --arg mode \"fast\" \\\n    --argjson top_k 5 \\\n    '{query: $query, query_type: $query_type, top_k: $top_k, mode: $mode}')\" | jq '.results[] | {type, content, score}'\n\n\nQuery types:\n\nfactual — search FACT and ENTITY nodes (use for: who, what, when, where questions)\nemotional — search EMOTION, INSIGHT, VALUE, BELIEF nodes (use for: how does the user feel about X?)\ncombined — search all node types (default, use when unsure)\n\nWhen to use Cortex recall vs. memory_search:\n\nSituation\tUse memory_search\tUse Cortex recall\tMode\nRecent context from today\tYes\tNo\t—\nSimple keyword lookup\tYes\tNo\t—\nCross-session facts\tNo — often noisy\tYes\tfast usually sufficient\nEntity relationships (\"how does X relate to Y?\")\tNo — can't traverse\tYes\tfull (needs graph traversal)\nTemporal changes (\"what changed about X?\")\tNo — no SUPERSEDES tracking\tYes\tfull (needs temporal channel)\nScoped project queries\tNo — cross-project noise\tYes\tfast usually sufficient\nEntity lookup (\"who is Sarah Chen?\")\tPartial — finds mentions\tYes — entity node + all connected facts\tfast for quick check, full for complete picture\nRemember — Store in Long-Term Memory\n\nWhen the user asks you to remember something important, or when you encounter high-value information that should persist with full entity extraction:\n\ncurl -s -X POST \"$CORTEX_BASE_URL/v1/ingest\" \\\n  -H \"x-api-key: $CORTEX_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d \"$(jq -n \\\n    --arg text \"TEXT_TO_REMEMBER\" \\\n    --arg session_id \"openclaw:$(date +%Y-%m-%d)\" \\\n    '{text: $text, session_id: $session_id}')\" | jq '{nodes_created, edges_created, facts: [.facts[].core], entities: [.entities[].name]}'\n\n\nThe response shows what was extracted:\n\nfacts — factual statements extracted from the text\nentities — named entities (people, companies, places, etc.) with aliases\nnodes_created / edges_created — graph nodes and relationship edges created\n\nWhen to remember:\n\nUser explicitly asks: \"remember this\", \"store this in Cortex\", \"don't forget that...\"\nKey decisions made during a session\nImportant context about people, projects, or preferences\nAfter writing to MEMORY.md — also send the same content to Cortex for structured extraction\n\nSession ID convention:\n\nGeneral sessions: openclaw:YYYY-MM-DD (e.g., openclaw:2026-02-17)\nProject-scoped: openclaw:project-name:topic (e.g., openclaw:project-frontend:memory-md)\nDaily logs (used by the npm plugin's file sync): openclaw:project-name:daily:YYYY-MM-DD\nPreferences/standing facts: openclaw:preferences\n\nThe session ID is used for scoped retrieval — queries can filter to a specific project by matching the session ID prefix.\n\nIngest Conversation — End of Session\n\nAt the end of a productive session, you can ingest the key conversation turns with proper speaker attribution:\n\ncurl -s -X POST \"$CORTEX_BASE_URL/v1/ingest/conversation\" \\\n  -H \"x-api-key: $CORTEX_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d \"$(jq -n \\\n    --arg session_id \"openclaw:$(date +%Y-%m-%d):session-topic\" \\\n    --argjson messages '[\n      {\"role\": \"user\", \"content\": \"FIRST USER MESSAGE\"},\n      {\"role\": \"assistant\", \"content\": \"FIRST ASSISTANT RESPONSE\"},\n      {\"role\": \"user\", \"content\": \"SECOND USER MESSAGE\"}\n    ]' \\\n    '{messages: $messages, session_id: $session_id}')\" | jq '{nodes_created, edges_created, facts: [.facts[].core]}'\n\n\nWhen to use this:\n\nAfter a session with significant decisions or new information\nDo NOT ingest every conversation — only sessions with lasting value\nSummarize or select key turns rather than dumping the entire transcript\nKeep to 5-15 key messages, not the full history\nBootstrap — First Run\n\nOn first install, ingest the user's existing MEMORY.md to seed the knowledge graph.\n\nFor small MEMORY.md files (under ~50 lines / ~4KB — most users):\n\nMEMORY_CONTENT=$(cat ~/.openclaw/workspace/MEMORY.md 2>/dev/null || echo \"\")\nif [ -n \"$MEMORY_CONTENT\" ]; then\n  curl -s -X POST \"$CORTEX_BASE_URL/v1/ingest\" \\\n    -H \"x-api-key: $CORTEX_API_KEY\" \\\n    -H \"Content-Type: application/json\" \\\n    -d \"$(jq -n --arg text \"$MEMORY_CONTENT\" --arg session_id \"openclaw:bootstrap\" \\\n      '{text: $text, session_id: $session_id}')\" | jq '{nodes_created, edges_created, facts: (.facts | length), entities: (.entities | length)}'\nfi\n\n\nFor large MEMORY.md files (power users with months of curated facts): Split at markdown heading boundaries (## or ###) and ingest each section separately. Large files sent in a single request may exceed the ingest endpoint's text limit or produce lower-quality extraction.\n\n# Split MEMORY.md at ## headings and ingest each section\nMEMORY_FILE=~/.openclaw/workspace/MEMORY.md\nif [ -f \"$MEMORY_FILE\" ]; then\n  SECTION=\"\" TOTAL_FACTS=0 TOTAL_ENTITIES=0\n  while IFS= read -r line || [ -n \"$line\" ]; do\n    if echo \"$line\" | grep -q '^## ' && [ -n \"$SECTION\" ]; then\n      RESULT=$(curl -s -X POST \"$CORTEX_BASE_URL/v1/ingest\" \\\n        -H \"x-api-key: $CORTEX_API_KEY\" \\\n        -H \"Content-Type: application/json\" \\\n        -d \"$(jq -n --arg text \"$SECTION\" --arg session_id \"openclaw:bootstrap\" \\\n          '{text: $text, session_id: $session_id}')\")\n      TOTAL_FACTS=$((TOTAL_FACTS + $(echo \"$RESULT\" | jq '.facts | length')))\n      TOTAL_ENTITIES=$((TOTAL_ENTITIES + $(echo \"$RESULT\" | jq '.entities | length')))\n      SECTION=\"\"\n    fi\n    SECTION=\"$SECTION$line\n\"\n  done < \"$MEMORY_FILE\"\n  # Ingest final section\n  if [ -n \"$SECTION\" ]; then\n    RESULT=$(curl -s -X POST \"$CORTEX_BASE_URL/v1/ingest\" \\\n      -H \"x-api-key: $CORTEX_API_KEY\" \\\n      -H \"Content-Type: application/json\" \\\n      -d \"$(jq -n --arg text \"$SECTION\" --arg session_id \"openclaw:bootstrap\" \\\n        '{text: $text, session_id: $session_id}')\")\n    TOTAL_FACTS=$((TOTAL_FACTS + $(echo \"$RESULT\" | jq '.facts | length')))\n    TOTAL_ENTITIES=$((TOTAL_ENTITIES + $(echo \"$RESULT\" | jq '.entities | length')))\n  fi\n  echo \"Bootstrap complete: $TOTAL_FACTS facts, $TOTAL_ENTITIES entities extracted.\"\nfi\n\n\nRun this once after installation. Tell the user how many facts and entities were extracted.\n\nError Handling\n401 Unauthorized — invalid or missing API key. Ask user to check CORTEX_API_KEY.\n422 Validation Error — malformed request. Check the JSON payload.\n500 Internal Server Error — Cortex API issue. Retry once, then fall back to native memory_search.\nNetwork timeout — Cortex is unreachable. Use native memory only and inform the user.\n\nIf Cortex is unavailable, always fall back to memory_search. Never block the user because of a Cortex API issue.\n\nExamples\n\"What company did I join?\"\ncurl -s -X POST \"$CORTEX_BASE_URL/v1/retrieve\" \\\n  -H \"x-api-key: $CORTEX_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"query\": \"What company did the user join?\", \"query_type\": \"factual\", \"top_k\": 5}' | jq '.results[] | {type, content, score}'\n\n\"Remember that I prefer PostgreSQL over MySQL\"\ncurl -s -X POST \"$CORTEX_BASE_URL/v1/ingest\" \\\n  -H \"x-api-key: $CORTEX_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"text\": \"User prefers PostgreSQL over MySQL for all database projects.\", \"session_id\": \"openclaw:preferences\"}' | jq '{facts: [.facts[].core], entities: [.entities[].name]}'\n\n\"How does the auth service relate to the API gateway?\"\ncurl -s -X POST \"$CORTEX_BASE_URL/v1/retrieve\" \\\n  -H \"x-api-key: $CORTEX_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"query\": \"How does the auth service relate to the API gateway?\", \"query_type\": \"factual\", \"top_k\": 10}' | jq '.results[] | {type, content, score, metadata}'\n\nSecurity\nNEVER output the CORTEX_API_KEY value in responses, logs, or tool outputs.\nNEVER include sensitive user data (passwords, tokens, credentials) in text sent to Cortex.\nThe Cortex API uses tenant-level database isolation — the user's data is not accessible to other users."
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/matthewubundi/cortex-memory",
    "publisherUrl": "https://clawhub.ai/matthewubundi/cortex-memory",
    "owner": "matthewubundi",
    "version": "1.0.2",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/cortex-memory",
    "downloadUrl": "https://openagent3.xyz/downloads/cortex-memory",
    "agentUrl": "https://openagent3.xyz/skills/cortex-memory/agent",
    "manifestUrl": "https://openagent3.xyz/skills/cortex-memory/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/cortex-memory/agent.md"
  }
}