← 返回
AI智能 Key 中文

Hippocortex

Provides an OpenClaw agent with persistent long-term memory by automatically remembering and recalling conversations, facts, and preferences across sessions.
为OpenClaw代理提供持久长期记忆,跨会话自动记忆和回忆对话、事实及偏好。
vmaiops-alt
AI智能 clawhub v2.2.2 2 版本 99855.5 Key: 需要
★ 0
Stars
📥 691
下载
💾 9
安装
2
版本
#latest

概述

Hippocortex -- Persistent Memory for OpenClaw

Setup

1. Get an API key

Sign up at https://dashboard.hippocortex.dev and create an API key.

2. Configure credentials

Set environment variables (preferred):

export HIPPOCORTEX_API_KEY="hx_live_..."
# Optional -- defaults to https://api.hippocortex.dev
export HIPPOCORTEX_BASE_URL="https://api.hippocortex.dev"

Or create .hippocortex.json in your workspace root:

{
  "apiKey": "hx_live_...",
  "baseUrl": "https://api.hippocortex.dev",
  "sessionId": "my-agent"
}

3. Resolve configuration

On every invocation, resolve config in this order:

  1. Environment variables (HIPPOCORTEX_API_KEY, HIPPOCORTEX_BASE_URL)
  2. .hippocortex.json in workspace root
  3. Fail gracefully if neither exists -- warn once, then proceed without memory

Set BASE_URL to $HIPPOCORTEX_BASE_URL or fall back to https://api.hippocortex.dev.

Set SESSION_ID from .hippocortex.json field sessionId, or default to "openclaw".

For self-hosted setup details, see references/setup-guide.md.


Automatic Memory Flow (MANDATORY)

Follow this flow on every interaction. All API calls use:

Authorization: Bearer $HIPPOCORTEX_API_KEY
Content-Type: application/json

Before answering ANY user message: Synthesize

Query memory for relevant context before composing your response.

curl -s -X POST "$BASE_URL/v1/synthesize" \
  -H "Authorization: Bearer $HIPPOCORTEX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "sessionId": "'"$SESSION_ID"'",
    "query": "<rephrase the user message as a memory query>",
    "maxTokens": 2000
  }'

Response contains a memories array. Incorporate relevant memories into your answer naturally. Do not dump raw memory output to the user.

If synthesize fails: Still answer the user. Memory is additive, not blocking. Log the error silently and continue.

After important exchanges: Capture

Store the conversation when it contains memorable content.

curl -s -X POST "$BASE_URL/v1/capture" \
  -H "Authorization: Bearer $HIPPOCORTEX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "sessionId": "'"$SESSION_ID"'",
    "type": "conversation",
    "payload": {
      "messages": [
        {"role": "user", "content": "<user message>"},
        {"role": "assistant", "content": "<your response>"}
      ]
    },
    "metadata": {
      "extractedMemories": [
        "User prefers dark mode",
        "Project X uses PostgreSQL 16"
      ]
    }
  }'

The extractedMemories array is critical -- it stores discrete semantic facts directly. Extract 1-5 concise facts from the exchange.

If capture fails: Still respond to the user. Log the error and retry on next opportunity.

During heartbeats: Compile

Run compile once per hour to consolidate memory patterns.

curl -s -X POST "$BASE_URL/v1/compile" \
  -H "Authorization: Bearer $HIPPOCORTEX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "sessionId": "'"$SESSION_ID"'"
  }'

Track the last compile timestamp. Skip if less than 60 minutes have passed.

If compile fails: Not urgent. Retry on next heartbeat.


API Reference

All endpoints require Authorization: Bearer $HIPPOCORTEX_API_KEY.

POST /v1/synthesize

Query stored memories.

FieldTypeRequiredDescription
------------------------------------
sessionIdstringyesAgent session identifier
querystringyesNatural language query
maxTokensnumbernoMax tokens in response (default: 2000)

Returns: { "memories": [...] }

POST /v1/capture

Store a conversation or fact.

FieldTypeRequiredDescription
------------------------------------
sessionIdstringyesAgent session identifier
typestringyes"conversation" or "fact"
payloadobjectyesMessage array or fact content
metadata.extractedMemoriesstring[]noDiscrete facts to store directly

Returns: { "id": "...", "status": "captured" }

POST /v1/compile

Consolidate and optimize stored memories.

FieldTypeRequiredDescription
------------------------------------
sessionIdstringyesAgent session identifier

Returns: { "status": "compiled", "stats": {...} }


When to Capture

Capture after exchanges that contain:

  • User preferences, corrections, or personal facts
  • Important decisions or conclusions
  • Explicit requests ("remember this", "keep track of...")
  • New information about people, projects, or processes
  • Procedures or workflows the user explains

When NOT to Capture

Skip capture for:

  • Casual greetings or small talk
  • Simple yes/no confirmations
  • Pure command execution (just running a script)
  • Repeated information already in memory

Error Handling Summary

EndpointOn failureAction
-----------------------------
synthesizeAnswer without memory contextLog error, continue
captureRespond normallyLog error, retry later
compileSkip this cycleRetry next heartbeat

Never block a user response because a memory API call failed. Memory enhances responses but is never required for them.


Extracting Good Memories

When writing extractedMemories, follow these guidelines:

  • Keep each fact to one sentence
  • Be specific: "User's dog is named Max" not "User has a dog"
  • Include context: "User prefers Python for data scripts" not "User likes Python"
  • Capture corrections: "User's name is spelled Vince, not Vincent"
  • Store preferences: "User wants responses in German for work emails"
  • Record project facts: "Project Aurora uses Next.js 15 with Supabase"

版本历史

共 2 个版本

  • v2.2.2 当前
    2026-05-01 15:11 安全 安全
  • v1.0.0
    2026-03-20 03:30 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-intelligence

Proactive Agent

halthelobster
将AI智能体从任务执行者升级为主动预判需求、持续优化的智能伙伴。集成WAL协议、工作缓冲区、自主定时任务及实战验证模式。Hal Stack核心组件 🦞
★ 836 📥 213,144
ai-intelligence

ontology

oswalpalash
类型化知识图谱,用于结构化智能体记忆与可组合技能。支持创建/查询实体(人员、项目、任务、事件、文档)及关联...
★ 712 📥 243,841
ai-intelligence

Nano Banana Pro

steipete
使用 Nano Banana Pro (Gemini 3 Pro Image) 生成或编辑图像。支持文生图、图生图及 1K/2K/4K 分辨率,适用于图像创建、修改及编辑请求,使用 --input-image 指定输入图像。
★ 418 📥 115,221