cognee-memory

AI知识引擎 - 6行代码实现记忆系统。remember/recall/forget/improve循环,向量+图搜索,支持OpenClaw插件。

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "cognee-memory" with this command: npx skills add smseow001/cognee-memory

Cognee Memory System

AI知识引擎 - 6行代码实现记忆系统

官网: https://cognee.ai
GitHub: https://github.com/topoteretes/cognee
安装: pip install cognee
OpenClaw插件: @cognee/cognee-openclaw


核心API

四大操作

操作功能说明
remember存储记忆永久存储到知识图谱
recall查询记忆自动路由最优搜索策略
forget删除记忆删除过时/错误记忆
improve优化学习持续学习提升准确性

快速开始

Python API

import cognee
import asyncio

async def main():
    # 存储到知识图谱
    await cognee.remember("Cognee turns documents into AI memory.")
    
    # 存储到会话缓存(快速)
    await cognee.remember("User prefers detailed explanations.", session_id="chat_1")
    
    # 查询(自动路由)
    results = await cognee.recall("What does Cognee do?")
    for result in results:
        print(result)
    
    # 删除
    await cognee.forget(dataset="main_dataset")

asyncio.run(main())

CLI

cognee-cli remember "Cognee turns documents into AI memory."
cognee-cli recall "What does Cognee do?"
cognee-cli forget --all
cognee-cli -ui  # 打开本地UI

配置

环境变量

# OpenAI API(必需)
export LLM_API_KEY="your-openai-key"

# 或使用其他LLM提供商
# 见: https://docs.cognee.ai/setup-configuration/llm-providers

# Cognee Cloud(可选)
export COGNEE_SERVICE_URL="https://your-instance.cognee.ai"
export COGNEE_API_KEY="ck_..."

使用场景

1. 客服Agent

用户:"我的发票有问题还没解决"
Cognee追踪:历史交互、失败操作、已解决案例、产品历史
Agent回复:"找到2个上月类似计费案例已解决,问题由支付系统同步延迟导致"

2. SQL Copilot(知识蒸馏)

用户:"如何计算客户留存率?"
Cognee追踪:专家SQL查询、工作流模式、schema结构、成功实现
Agent回复:"高级分析师解决了类似留存查询,这是他们的方案..."

3. 跨会话记忆

# Session 1
await cognee.remember("用户喜欢详细的解释", session_id="user_123")

# Session 2(跨会话查询)
results = await cognee.recall("用户偏好什么?", session_id="user_123")

OpenClaw插件安装

npm install @cognee/cognee-openclaw

插件自动集成:

  • SessionStart → 初始化记忆
  • PostToolUse → 捕获行动
  • UserPromptSubmit → 注入相关上下文
  • PreCompact → 跨上下文保留记忆
  • SessionEnd → 桥接到永久知识图谱

vs 其他记忆系统

功能我们现有Cognee
存储方式文件向量+图双存储
搜索方式关键词语义+关系
学习能力forget+improve
跨Agent不支持共享知识图谱
可视化CLI UI

部署选项

平台说明
Cognee Cloud托管服务
Modal无服务器,GPU自动扩展
Railway简化PaaS
Fly.io边缘部署
Render简单PaaS

示例代码

完整记忆循环

import cognee
import asyncio

async def memory_loop():
    # 1. 学习新知识
    await cognee.remember("用户正在学习Python编程")
    await cognee.remember("用户偏好边做边学的教学方式")
    
    # 2. 查询相关记忆
    results = await cognee.recall("用户的学习偏好是什么?")
    
    # 3. 根据反馈改进
    await cognee.improve("纠正对用户偏好的错误理解")
    
    # 4. 忘记错误记忆
    await cognee.forget("错误的假设")

asyncio.run(memory_loop())

安装状态

  • Python包:✅ 已安装 cognee
  • OpenClaw插件:需额外安装 @cognee/cognee-openclaw

Powered by Cognee | https://cognee.ai

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

ClawRAG - Self-hosted RAG & Memory

Self-hosted RAG engine with hybrid semantic and keyword search, document ingestion, local privacy, and seamless OpenClaw integration via Docker.

Registry SourceRecently Updated
1.5K0Profile unavailable
Automation

Agent Memory System v4

生产级 Agent 记忆系统 — 6维坐标编码 + 语义检索 + 智能压缩

Registry SourceRecently Updated
1130Profile unavailable
Research

MidOS MCP — Knowledge OS for AI Agents

MidOS — The MCP Knowledge OS. 134 tools for knowledge management, multi-agent orchestration, search, planning, and memory. 670K+ vectors, 46K+ chunks, EUREKA...

Registry SourceRecently Updated
3940Profile unavailable
Research

OpenClaw Cortex Memory

Independent skill for Cortex Memory operations in OpenClaw. Use when users ask for cross-session memory continuity, prior decisions, preferences, relationshi...

Registry SourceRecently Updated
630Profile unavailable