cognee: Instructions file for Claude Code

AGENTS.md

cognee AGENTS.md is an instructions file for Claude Code, Codex, OpenCode from topoteretes/cognee. It costs 2,857 tokens per session, scanned A, original, Apache-2.0.

Development instructions for the Cognee repository, including its folders, build and test commands, runtime settings, and backend support.

In plain words
What is it for?
Use it when navigating Cognee, running tests or checks, organizing new modules, or understanding its command-line tools, API, databases, and multi-user support.
Why use it?
It gives contributors one place to find the project's structure and working conventions before changing code.

Instructions file for Claude CodeCodexOpenCode

Written for Claude Code and Codex and OpenCode: SessionStart hook event, but also the file is AGENTS.md. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions Claude Code.

This is topoteretes/cognee's own configuration. It tells Claude Code, Codex and OpenCode how to work on cognee itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything cognee configures →

About the project

Cognee is an AI memory platform that stores information in a self-hosted knowledge graph so agents can retain context across sessions. It ingests data, connects related information, and helps agents retrieve it for reasoning and actions. The catalogue includes skills and instructions that extend agent workflows around Cognee.

topoteretes/cognee · 33,094 stars · on GitHub · cognee.ai

Reuse

Borrowing it

Nothing to install: this file belongs to topoteretes/cognee. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/topoteretes/cognee/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/topoteretes/cognee

Made for: Claude Code, Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cognee AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/topoteretes/cognee/agents-md/github.svg)](https://agentmods.dev/instructions/topoteretes/cognee/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/topoteretes/cognee/agents-md"><img src="https://agentmods.dev/badge/instructions/topoteretes/cognee/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for cognee AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/topoteretes/cognee/agents-md"><img src="https://agentmods.dev/badge/instructions/topoteretes/cognee/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 2,857 This file is loaded in full into every session.
When invoked 2,857 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.02857 $0.02857
Opus 5.5 $0.01143 $0.01143
Sonnet 5.5 $0.00571 $0.00571
Haiku 4.5 $0.00286 $0.00286

Measured 7d ago against content hash 10637b64b1c6, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

cognee AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 196 lines

How it starts

The opening of the file, as written. The whole thing — 196 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Repository Guidelines

This document summarizes how to work with the cognee repository: how it’s organized, how to build, test, lint, and contribute. It mirrors our actual tooling and CI while providing quick commands for local development.

Design Principles

  1. Don't overengineer: Simple beats complex.
  2. No fallbacks: One correct path, no alternatives.
  3. One way: One way to do things, not many.
  4. Throw errors: Fail fast when the operation's preconditions aren't met. Observability (telemetry, logging) is best-effort and never changes the outcome of the operation.
  5. No backups: Trust the primary mechanism.
  6. Separation of concerns: Each function has a single responsibility.
  7. Be concise but informative: No essays, but the docstrings and comments a reader needs.
  8. No invented limits: Never add a cutoff (max_n, [:k], "older than X") or an expiry (TTL, cooldown, eviction) the task did not ask for — both are silent data loss. If you believe one is unavoidable, stop and ask, stating what would be dropped and why; never add it first and justify it afterwards. Existing bounds (lock leases, recovery floors, batch caps) are deliberate: removing or changing one is the same question.

Methodology: surgical changes only; evidence-based debugging (minimal, targeted logging); fix root causes, not symptoms. Debug like a detective: form the theory of the crime, collect evidence, and change code only once the evidence proves it.

Project Structure & Module Organization

  • cognee/: Core Python library and API.
    • api/: FastAPI application and versioned routers under api/v1/ — memory API (remember, recall, improve, forget), low-level operations (add, cognify, search, delete, update), and supporting routers (datasets, users, permissions, settings, sync, visualize, health, skills, sessions, …). Each router package has a routers/ folder; api/client.py registers them.
    • cli/: CLI entry points and subcommands invoked via cognee / cognee-cli.
    • infrastructure/: Databases, LLM providers, embeddings, loaders, and storage adapters.
    • modules/: Domain logic (graph, retrieval, ontology, users, processing, observability, etc.).
    • tasks/: Reusable tasks (e.g., code graph, web scraping, storage). Extend with new tasks here.
    • eval_framework/: Evaluation utilities and adapters.
    • shared/: Cross-cutting helpers (logging, settings, utils).
    • tests/: Unit, integration, CLI, and end-to-end tests organized by feature.
    • __main__.py: Entrypoint to route to CLI.
  • cognee-mcp/: Model Context Protocol server exposing cognee as MCP tools (SSE/HTTP/stdio). Contains its own README and Dockerfile.
  • cognee-frontend/: Next.js UI for local development and demos.
  • distributed/deploy/: One-click deployment templates (Modal, Fly.io, Railway, Render, Daytona).
  • examples/: Example scripts demonstrating the public APIs and features (graph, code graph, multimodal, permissions, etc.).
  • notebooks/: Jupyter notebooks for demos and tutorials.
  • .agents/skills/: Task-specific agent skills. This is the only copy; add and edit skills here (Codex reads this folder directly).
  • .claude/skills/: Symlink to ../.agents/skills so Claude Code finds the same skills. On Windows clones without symlink support, the SessionStart hook in .claude/settings.json (.claude/hooks/link-skills.sh) replaces it with a directory junction automatically; no manual step is needed. That hook marks the path skip-worktree, so on those clones only, a later change to the .claude/skills entry itself makes git refuse to update it — run git update-index --no-skip-worktree .claude/skills && git checkout -- .claude/skills, then start a new session.
  • cognee/alembic/: Relational (Alembic) schema migrations; alembic.ini is in cognee/. Graph/vector data migrations live in cognee/modules/migrations/.

Read the full file on GitHub · 196 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago Changed · +13 lines · +288 tokens per session 10637b64b1c6
  2. 21d ago Changed · -4 tokens per session acd3d1b57110
  3. 1mo ago Changed · +3 lines · +56 tokens per session 64296788a22f
  4. 1mo ago Changed · +11 lines · +356 tokens per session d79f2550ee0a
  5. 1mo ago Changed · +4 lines · +252 tokens per session 7987bd55f8e3
  6. 2mo ago First seen · 165 lines · 1,909 tokens per session scan A f944240f7850

Subscribe to this mod's changes

cognee AGENTS.md is an instructions file published in the GitHub repository topoteretes/cognee (33,094 stars, last pushed today), licensed Apache-2.0. It adds 2,857 tokens to every session, about $0.0114 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

cognee AGENTS.md compared with instructions from other repositories

cognee AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
cognee AGENTS.mdtopoteretes/cogneeInstructions file33ktodayApache-2.0A2,857Claude Code, Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143ktodayMITA7,461Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA5,516GitHub Copilot
langchain AGENTS.mdlangchain-ai/langchainInstructions file149ktodayMITA4,680Codex, OpenCode
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file274k2d agoMITA4,313Codex, OpenCode