Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问许可证需确认审计提醒

cogneecognee 搜索

Agent Skill

cognee 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

984

周安装

41

GitHub Stars

3

下载量

328
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:cognee(cognee 搜索)
来源仓库:https://github.com/armelhbobdad/oh-my-skills
仓库路径:skills/cognee
安装命令:
npx skills add https://github.com/armelhbobdad/oh-my-skills --skill cognee
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/armelhbobdad/oh-my-skills --skill cognee

简介

cognee 是一个开源 Python AI 内存引擎,将原始数据转换为可搜索的知识图谱。

  • 适用于在 Codex、Claude、Cursor、Gemini CLI 中进行信息检索、向量与图数据库联合查询。
  • 支持异步处理、自动去重与元数据管理,提供 22 个公共 API 导出。
  • 使用时需设置 LYZR_API_KEY 环境变量,并通过 asyncio 调用 cognee.prune 清理状态。
  • 涉及数据持久化和外部 API 访问时,应确认权限范围与系统稳定性。

SKILL.md

Overview

Cognee v0.5.5 — open-source Python AI memory engine that converts raw data into searchable knowledge graphs combining vector search with graph databases.

  • Source: topoteretes/cognee @ main
  • Language: Python (async/await throughout)
  • Forge tier: Deep (AST + gh + QMD)
  • Public API exports: 22 | Total extracted: 837 (302 functions, 535 classes)
  • Confidence: 837 T1 (AST-verified), 14 T2 (QMD-enriched), T3 (docs supplemental)

Quick Start

import cognee
import asyncio

async def main():
    # Reset state
    await cognee.prune.prune_data()
    await cognee.prune.prune_system(metadata=True)

    # 1. Ingest data
    await cognee.add("Cognee turns documents into AI memory.")  # [AST:cognee/api/v1/add/add.py:L22]

    # 2. Build knowledge graph
    await cognee.cognify()  # [AST:cognee/api/v1/cognify/cognify.py:L47]

    # 3. Search
    results = await cognee.search(  # [AST:cognee/api/v1/search/search.py:L26]
        query_text="What does Cognee do?"
    )
    for r in results:
        print(r)

asyncio.run(main())

All core functions are async — must use await inside an async context. [EXT:docs.cognee.ai/getting-started/quickstart]

Setup Requirements

Python: >=3.10, <3.14. Recommended installer: uv.

uv pip install -e "."                    # minimal (SQLite + LanceDB + Kuzu)
uv pip install -e ".[postgres,neo4j]"    # with PostgreSQL + Neo4j

Key installation extras: postgres / postgres-binary, neo4j, neptune, chromadb, qdrant, redis, ollama, anthropic, gemini, mistral, groq, huggingface, llama-cpp, aws (S3), langchain, llama-index, graphiti, baml, dlt, docling, codegraph, scraping, docs, monitoring (Sentry+Langfuse), distributed (Modal), dev, debug.

Minimal.env:

LLM_API_KEY="your_openai_api_key"
LLM_MODEL="openai/gpt-4o-mini"

Defaults (no extra setup): SQLite (relational), LanceDB (vector), Kuzu (graph). All stored in .venv by default — override with DATA_ROOT_DIRECTORY and SYSTEM_ROOT_DIRECTORY.

Important: If you configure only LLM or only embeddings, the other defaults to OpenAI. Always configure both, or ensure a valid OpenAI API key.

Common Workflows

Add and process data: await cognee.add(data) → await cognee.cognify() → await cognee.search(query_text)

Multi-format ingestion: await cognee.add(["/path/to/file.pdf", "raw text", open("doc.txt","rb")], dataset_name="my_data")

Ontology-grounded cognify: config = {"ontology_config": {"ontology_resolver": RDFLibOntologyResolver(ontology_file=path)}}await cognee.cognify(config=config) [EXT:docs.cognee.ai/guides/ontology-support]

Session-aware search: await cognee.search(query_text="Q1", session_id="conv_1")await cognee.search(query_text="Follow-up", session_id="conv_1") [EXT:docs.cognee.ai/guides/sessions]

Custom data models: class MyEntity(DataPoint): name: str; metadata = {"index_fields": ["name"]}await add_data_points([entity]) [EXT:docs.cognee.ai/guides/custom-data-models]

Key API Summary

FunctionPurposeKey Params
add()Ingest text, files, binary datadata, dataset_name, user
cognify()Build knowledge graph from ingested datadatasets, graph_model, chunker, temporal_cognify
search()Query knowledge graphquery_text, query_type, top_k, session_id
memify()Enrich existing graph with custom tasksextraction_tasks, enrichment_tasks, data
config.*Runtime configuration (LLM, DB, vectors)static methods
datasets.*List, inspect, delete datasetsstatic methods
prune.*Clean up data and system resourcesprune_data(), prune_system()
update()Update existing data itemsdata_id, data, dataset_id
session.*Session history and feedbackget_session(), add_feedback()
run_custom_pipeline()Execute custom task pipelinestasks, data, dataset
SearchTypeEnum of 14 search modesGRAPH_COMPLETION (default)
visualize_graph()Render knowledge graph to HTMLdestination_file_path
enable_tracing()Enable OpenTelemetry tracingconsole_output
run_migrations()Run Alembic database migrations
start_ui()Launch local Cognee UI (frontend + backend + MCP servers)pid_callback, port, start_backend, start_mcp
cognee_network_visualization()Render knowledge graph to interactive HTMLgraph_data, destination_file_path
pipelinesModule re-export: Task, run_tasks, run_tasks_parallel, run_pipeline

LLM Provider Configuration

Configure via .env — provider-specific examples:

# Azure OpenAI
LLM_PROVIDER="azure"
LLM_MODEL="azure/gpt-4o-mini"
LLM_ENDPOINT="https://YOUR-RESOURCE.openai.azure.com/openai/deployments/gpt-4o-mini"
LLM_API_KEY="your_key"
LLM_API_VERSION="2024-12-01-preview"

# Anthropic (requires: pip install cognee[anthropic])
LLM_PROVIDER="anthropic"
LLM_MODEL="claude-3-5-sonnet-20241022"
LLM_API_KEY="your_key"

# Ollama (requires: pip install cognee[ollama])
LLM_PROVIDER="ollama"
LLM_MODEL="llama3.1:8b"
LLM_ENDPOINT="http://localhost:11434/v1"
LLM_API_KEY="ollama"
EMBEDDING_PROVIDER="ollama"
EMBEDDING_MODEL="nomic-embed-text:latest"
EMBEDDING_ENDPOINT="http://localhost:11434/api/embed"
HUGGINGFACE_TOKENIZER="nomic-ai/nomic-embed-text-v1.5"

# AWS Bedrock (requires: pip install cognee[aws])
LLM_PROVIDER="bedrock"
LLM_MODEL="anthropic.claude-3-sonnet-20240229-v1:0"
AWS_REGION="us-east-1"

# Custom / OpenRouter / vLLM
LLM_PROVIDER="custom"
LLM_MODEL="openrouter/google/gemini-2.0-flash-lite-preview-02-05:free"
LLM_ENDPOINT="https://openrouter.ai/api/v1"

Rate limiting: LLM_RATE_LIMIT_ENABLED=true, LLM_RATE_LIMIT_REQUESTS=60, LLM_RATE_LIMIT_INTERVAL=60

Structured output: STRUCTURED_OUTPUT_FRAMEWORK="instructor" (default) or "baml" (requires cognee[baml]). Override instructor mode: LLM_INSTRUCTOR_MODE="json_schema_mode".

Database Switching

# PostgreSQL (requires: pip install cognee[postgres])
DB_PROVIDER=postgres
DB_HOST=localhost  DB_PORT=5432  DB_USERNAME=cognee  DB_PASSWORD=cognee  DB_NAME=cognee_db

# PGVector (requires: pip install cognee[postgres])
VECTOR_DB_PROVIDER=pgvector
VECTOR_DB_URL=postgresql://cognee:cognee@localhost:5432/cognee_db

# Neo4j (requires: pip install cognee[neo4j])
GRAPH_DATABASE_PROVIDER=neo4j
GRAPH_DATABASE_URL=bolt://localhost:7687
GRAPH_DATABASE_USERNAME=neo4j  GRAPH_DATABASE_PASSWORD=yourpassword

# S3 storage (requires: pip install cognee[aws])
STORAGE_BACKEND="s3"
STORAGE_BUCKET_NAME="your-bucket"
DATA_ROOT_DIRECTORY="s3://your-bucket/cognee/data"

Security Environment Variables

ACCEPT_LOCAL_FILE_PATH=True     # Allow local file paths in add()
ALLOW_HTTP_REQUESTS=True        # Allow HTTP fetches
ALLOW_CYPHER_QUERY=True         # Allow raw Cypher in SearchType.CYPHER
REQUIRE_AUTHENTICATION=False    # Enable API auth
ENABLE_BACKEND_ACCESS_CONTROL=True  # Multi-tenant dataset isolation

Extension Patterns

Custom pipeline task:

from cognee.modules.pipelines.tasks.Task import Task

async def my_task(data):
    return process(data)

task = Task(my_task)

Direct database access:

from cognee.infrastructure.databases.graph import get_graph_engine
from cognee.infrastructure.databases.vector import get_vector_engine

graph_engine = await get_graph_engine()
vector_engine = await get_vector_engine()

LLM Gateway (structured output):

from cognee.infrastructure.llm.get_llm_client import get_llm_client

llm_client = get_llm_client()
response = await llm_client.acreate_structured_output(
    text_input="prompt", system_prompt="instructions", response_model=YourPydanticModel
)

MCP Server Transport Modes

python src/server.py                    # stdio (default)
python src/server.py --transport sse    # SSE
python src/server.py --transport http --host 127.0.0.1 --port 8000 --path /mcp
# API mode (connect to running Cognee API):
python src/server.py --transport sse --api-url http://localhost:8000 --api-token TOKEN

Docker: docker run -e TRANSPORT_MODE=sse --env-file.env -p 8000:8000 cognee/cognee-mcp:main

Common Troubleshooting

  • Ollama + OpenAI embeddings NoDataError — configure both LLM and embedding to same provider, or set HUGGINGFACE_TOKENIZER
  • LM Studio structured output — set LLM_INSTRUCTOR_MODE="json_schema_mode"
  • Default provider fallback — configuring only LLM or only embeddings defaults the other to OpenAI
  • Permission denied on search — returns empty list (not error) to prevent info leakage; check dataset permissions
  • Docker DB connections — use DB_HOST=host.docker.internal for local databases
  • Debug loggingLITELLM_LOG="DEBUG", ENV="development", TELEMETRY_DISABLED=1

Migration & Deprecation Warnings

  • delete() deprecated since v0.3.9 — use datasets.delete_data() instead [SRC:cognee/api/v1/delete/__init__.py:L13]
  • memify() default pipeline changed — coding rules replaced with triplet embedding (Mar 2026) [QMD:cognee-temporal:prs.md]
  • update() bug — PATCH updates timestamps but GET raw may return old data [QMD:cognee-temporal:issues.md]
  • visualize_graph() frontend — open bug #2442: missing component in UI mode [QMD:cognee-temporal:issues.md]
  • start_ui() v0.5.5 bug — pip-installed frontend fails with 500 errors due to missing npm deps (react-markdown, ngraph.graph) [QMD:cognee-temporal:issues.md]

See Full API Reference for migration details.

Key Types

SearchType (14 modes) [AST:cognee/modules/search/types/SearchType.py:L4]: GRAPH_COMPLETION (default), RAG_COMPLETION, CHUNKS, SUMMARIES, TRIPLET_COMPLETION, GRAPH_SUMMARY_COMPLETION, CYPHER, NATURAL_LANGUAGE, GRAPH_COMPLETION_COT, GRAPH_COMPLETION_CONTEXT_EXTENSION, FEELING_LUCKY, TEMPORAL, CODING_RULES, CHUNKS_LEXICAL

Task — wraps any callable (async/sync/generator) for pipeline execution [AST:cognee/modules/pipelines/tasks/task.py]

DataPoint — base class for custom graph nodes; inherit and add typed fields [EXT:docs.cognee.ai/guides/custom-data-models]

ChunkStrategyPARAGRAPH, SENTENCE, LANGCHAIN_CHARACTER [AST:cognee/shared/data_models.py:L83]

Architecture at a Glance

  • Storage: Relational (SQLite/Postgres) + Vector (LanceDB/PGVector/Qdrant/Redis/ChromaDB/FalkorDB) + Graph (Kuzu/Neo4j/Neptune/Memgraph)
  • LLM Providers: OpenAI, Azure OpenAI, Gemini, Anthropic, Ollama, custom (vLLM)
  • Embedding: OpenAI, Azure, Gemini, Mistral, Ollama, Fastembed
  • Pipeline: Tasks → Pipelines → run_pipeline (orchestration with async generators)
  • Observability: OpenTelemetry tracing via enable_tracing() / disable_tracing()
  • MCP Server: 7 tools (cognify, search, list_data, delete, prune, cognify_status, save_interaction) [AST:cognee-mcp/src/server.py]

CLI

cognee --add "data"          # Ingest data
cognee --cognify             # Build knowledge graph
cognee --search "query"      # Search
cognee --debug               # Enable debug logging
cognee --ui                  # Launch local UI

[AST:cognee/cli/_cognee.py:L32]

Full API Reference

See references/full-api-reference.md for complete signatures with parameters, return types, and T2 annotations for all 22 exports.

Full Type Definitions

SearchType [AST:cognee/modules/search/types/SearchType.py:L4]

class SearchType(str, Enum):
    SUMMARIES = "SUMMARIES"               # Vector similarity on TextSummary nodes
    CHUNKS = "CHUNKS"                     # Vector similarity on DocumentChunk nodes
    RAG_COMPLETION = "RAG_COMPLETION"     # LLM-backed with chunk context
    TRIPLET_COMPLETION = "TRIPLET_COMPLETION"  # Graph triplet-based retrieval
    GRAPH_COMPLETION = "GRAPH_COMPLETION" # Default — LLM + graph traversal
    GRAPH_SUMMARY_COMPLETION = "GRAPH_SUMMARY_COMPLETION"
    CYPHER = "CYPHER"                     # Raw Cypher query
    NATURAL_LANGUAGE = "NATURAL_LANGUAGE" # NL → Cypher translation
    GRAPH_COMPLETION_COT = "GRAPH_COMPLETION_COT"  # Chain-of-thought graph
    GRAPH_COMPLETION_CONTEXT_EXTENSION = "GRAPH_COMPLETION_CONTEXT_EXTENSION"
    FEELING_LUCKY = "FEELING_LUCKY"       # Single best result
    TEMPORAL = "TEMPORAL"                 # Time-aware search
    CODING_RULES = "CODING_RULES"         # Code rule retrieval
    CHUNKS_LEXICAL = "CHUNKS_LEXICAL"     # BM25 keyword search on chunks

DataPoint [EXT:docs.cognee.ai/guides/custom-data-models]

Base class for all graph nodes. Inherits from Pydantic BaseModel. Set metadata = {"index_fields": ["field"]} for vector indexing. Use Edge(weight, relationship_type) for weighted relationships.

Notable subclasses: DocumentChunk, TextSummary, CodeSummary, DatabaseSchema, SchemaTable, TranslatedContent, GraphitiNode, WebPage.

Task [AST:cognee/modules/pipelines/tasks/task.py]

class Task:
    def __init__(self, executable, *args, task_config=None, **kwargs)

Wraps any callable (async/sync function, generator, async generator). Use task_config={"batch_size": N} for parallel processing. Decorate with @task_summary("Processed {n} items") for pipeline reporting.

Pipeline Exports [SRC:cognee/modules/pipelines/__init__.py:L1]

Task, run_tasks, run_tasks_parallel, run_pipeline

Full Integration Patterns

Co-import Patterns

  • pydanticBaseModel for graph models, BaseSettings for config
  • sqlalchemy — relational storage layer (async sessions)
  • fastapi — HTTP API server for deployment
  • uuid — dataset and data item identifiers
  • asyncio — all core operations are async

MCP Server Integration [AST:cognee-mcp/src/server.py]

7 MCP tools: cognify(data, graph_model_file, graph_model_name, custom_prompt), search(search_query, search_type, top_k), save_interaction(...), list_data(dataset_id), delete(data_id, dataset_id, mode), prune(), cognify_status().

Runs via FastMCP("Cognee"). Supports SSE and streamable HTTP transports with CORS.

Provider Configuration [EXT:docs.cognee.ai/setup-configuration/overview]

Configure via .env or cognee.config.* methods:

  • LLM: LLM_API_KEY, LLM_MODEL, LLM_PROVIDER (openai/azure/gemini/anthropic/ollama/custom)
  • Embedding: EMBEDDING_PROVIDER, EMBEDDING_MODEL
  • Vector: VECTOR_DB_PROVIDER (lancedb/pgvector/qdrant/redis/chromadb/falkordb)
  • Graph: GRAPH_DB_PROVIDER (kuzu/neo4j/neptune/memgraph)
  • Debug: LOG_LEVEL=DEBUG, TELEMETRY_DISABLED=true

适合场景

01

调用多模型

02

代码和文本生成

03

Agent 推理流程

04

OpenRouter 模型接入

能力概览

能力 1

统一调用多种 LLM

能力 2

支持 Claude、Gemini、Kimi 等模型

能力 3

适合聊天、代码和推理任务

能力 4

可作为 Agent 模型调用入口

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

33.88%
按下载量换算111

Claude

31.83%
按下载量换算104

Cursor

20.91%
按下载量换算69

Gemini CLI

9.04%
按下载量换算30

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills