cognee-migrations
Skill31k starsChanged 2 months agoApache-2.0View on GitHub
Use when dealing with cognee database migrations — understanding when they run automatically, checking or repairing migration state with cognee-cli upgrade/downgrade/stamp/current, a write blocked by a failed migration, authoring a new Alembic (relational schema) revision or a graph/vector data migration, or moving data between systems (relational DB import, memory export/import).
- Reads credentials
Trending
More talk lately.about the whole repository
Who's talking about topoteretes/cognee
- A Hacker News story“Show HN: Cognee – Open-Source AI Memory Layer That Remembers Context”Hacker News · Jun 3, 2025 · 9 points
- @github-trending.bsky.social“🚀 Skyrocketing! 🚀 (200+ new stars) 📦 topoteretes / cognee ⭐ 4,853 (+414) 🗒 Python Memory for AI Agents …”Bluesky · Jun 9, 2025 · 7 likes
- A Hacker News story“Show HN: Auto-optimizing deterministic LLM outputs using knowledge graphs”Hacker News · Apr 22, 2024 · 7 points
- A Hacker News story“Show HN: Cognee – Turn RAG and GraphRAG into custom dynamic semantic memory”Hacker News · Feb 13, 2025 · 6 points
- @github-trending.bsky.social“🚀 Skyrocketing! 🚀 (200+ new stars) 📦 topoteretes / cognee ⭐ 28,581 (+303) 🗒 Python Cognee is the …”Bluesky · Jul 20, 2026 · 5 likes
The biggest 5 of 70 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 70
Talked about on GitHub, Bluesky and Hacker News (70 times).
On GitHub · 50
- Apr 10, 2026[Add App]Cognee — beclab/apps2 reactions
- Nov 15, 2025[Request] Implement Long-term Cross-session Memory through Cognee Integration — lobehub/lobehub2 reactions · 6 comments
- Jun 28, 2026Epic: Cross-project knowledge storage — queryable KB over the board — joelfuller2016/KanbanFlow-v21 reaction · 4 comments
- Nov 20, 2026[spike] Cognee GitHub ingestion vs file memory, Phase 0 measurement only — anchapin/plan-coder0 reactions · 1 comment
- Nov 16, 2026مرشحون جدد للدليل (2026-11-16) — mgrd281/Skill-0 reactions
45 more on GitHub
- Nov 3, 2026feat(connector): add Gitee data-source connector (cognee#6364) — topoteretes/cognee-community0 reactions
- Nov 3, 2026feat(connector): add Atlassian Jira project issues and agile tracking data-source connector (cognee#6466) — topoteretes/cognee-community0 reactions
- Nov 3, 2026feat(connector): add Zendesk support tickets and conversations data-source connector (cognee#6465) — topoteretes/cognee-community0 reactions
- Nov 3, 2026feat(connector): add Trello boards, lists, and cards data-source connector (cognee#6471) — topoteretes/cognee-community0 reactions
- Nov 3, 2026feat(connector): add AtCoder competitive programming data-source connector (cognee#6406) — topoteretes/cognee-community0 reactions
- Nov 3, 2026chore(deps): bump cognee from 0.4.1 to 1.5.0 in /ai-memory-hackathon-2026-02-07 — topoteretes/cognee-hackathons0 reactions
- Oct 30, 2026Bump the pip group across 2 directories with 2 updates — MendyData/agents-towards-production0 reactions
- Oct 29, 2026memory-lab: Cognee — развернуть на PVE и проверить — TeaShaman-cyber/theseus-local-lab0 reactions · 38 comments
- Oct 28, 2026feat(connector): add Trivy security vulnerability and misconfiguration connector — topoteretes/cognee-community0 reactions
- Oct 28, 2026feat(connector): add Traefik reverse proxy routing and middleware topology connector — topoteretes/cognee-community0 reactions
- Oct 26, 2026chore(deps-dev): bump cognee from 1.1.2 to 1.6.5 — TSchonleber/brainctl0 reactions
- Oct 26, 2026feat(connector): add Habitica gamified habits and task management connector — topoteretes/cognee-community0 reactions
- Oct 25, 2026feat(connector): add lemlist outreach and campaigns REST connector — topoteretes/cognee-community0 reactions
- Oct 25, 2026feat(connector): add Jotform form builder and submissions REST connector — topoteretes/cognee-community0 reactions
- Oct 25, 2026feat(connector): add npm package registry public REST API connector — topoteretes/cognee-community0 reactions · 1 comment
- Oct 25, 2026feat(connector): add WooCommerce store catalog and orders connector — topoteretes/cognee-community0 reactions
- Oct 25, 2026feat(connector): add Hardcover books and reading journals GraphQL connector — topoteretes/cognee-community0 reactions
- Oct 25, 2026feat(connector): add Bitrix24 CRM inbound webhook connector — topoteretes/cognee-community0 reactions
- Oct 25, 2026feat(connector): add BigCommerce catalog and orders connector — topoteretes/cognee-community0 reactions
- Oct 23, 2026MEMSYNC — Umbrella: governed synchronization of persistent memories across Cogentia agents — JeanHuguesRobert/cogentia0 reactions
- Oct 22, 2026Memoria que el agente escribe durante la sesión — e2its/myrmion-graphrag0 reactions
- Oct 22, 2026Olvidar y borrar como herramienta — e2its/myrmion-graphrag0 reactions
- Oct 20, 2026fix(storage): explain embedding mismatch recovery — volcengine/OpenViking0 reactions
- Oct 15, 2026[P0][Comparator][Cognee] Execute first local-model external same-harness comparison — MythologIQ-Labs-LLC/agent-memory0 reactions · 3 comments
- Oct 14, 2026feat: add Read.ai connector with OAuth and scoped sync — topoteretes/cognee-community0 reactions
- Oct 13, 2026[Benchmark][Comparators] Expand real same-harness market cohort beyond Mem0, with per-profile peer coverage — MythologIQ-Labs-LLC/agent-memorysays it tested it0 reactions · 9 comments
- Oct 9, 2026feat(linear): implement linear integration - #4699 — topoteretes/cognee-community0 reactions
- Oct 9, 2026feat(connector): add Airtable data-source connector — topoteretes/cognee-community0 reactions
- Oct 8, 2026feat(connector): add Snowflake data-source connector — topoteretes/cognee-community0 reactions · 1 comment
- Oct 8, 2026feat(connector): add Databricks workspace data connector — topoteretes/cognee-community0 reactions · 1 comment
- Oct 8, 2026feat(connector): add Outline Knowledge Base data-source connector — topoteretes/cognee-community0 reactions · 1 comment
- Oct 8, 2026feat(connector): add Appwrite data-source connector — topoteretes/cognee-community0 reactions · 1 comment
- Oct 8, 2026feat(connector): add Ghost CMS data-source connector — topoteretes/cognee-community0 reactions · 1 comment
- Oct 5, 2026feat(connector): add tl;dv meeting data-source connector — topoteretes/cognee-community0 reactions · 1 comment
- Oct 5, 2026feat(connector): add LogRocket MCP data source — topoteretes/cognee-community0 reactions · 1 comment
- Oct 3, 2026Bump the pip group across 2 directories with 2 updates — herominutes/agents-towards-production0 reactions
- Sep 27, 2026[assessment] Competitor assessment 3×7: KIP, mem0, ruflo, MemPalace, [redacted vendor], cognee, agentmemory, [redacted vendor] Agent Memory, Haystack vs ai-memory release/v1.0.0 (level, value, licensing) — alphaonedev/ai-memory-mcp0 reactions · 11 comments
- Sep 24, 2026Reality probe: Cognee #5161 passes local prune tests but the end-to-end claim is contradicted — hippoley/CounterProof0 reactions
- Sep 20, 2026Freshness: cognee v1.5.4 -> v1.6.5 — thoroc/context-radar0 reactions
- Sep 17, 2026📈 AI 开源趋势日报 2026-09-17 — 96loveslife/big_model_radar0 reactions
- Sep 15, 2026[GHSA-fcch-9ph8-q3p4] Cognee thru v0.4.0 contains a critical remote code... — github/advisory-database0 reactions
- Sep 4, 2026Bump cognee from 1.0.9 to 1.5.0 in /testbed/dmas/memory — rustic-ai/dmas-memory0 reactions
- Sep 3, 2026chore(deps): bump cognee from 1.1.0 to 1.5.0 in /cognee-mcp — monk-io/cognee0 reactions
- Sep 3, 2026chore(deps): bump the pip group across 2 directories with 1 update — CorInfinitum/cognee0 reactions
- Sep 3, 2026chore(deps): bump cognee from 0.2.0 to 1.5.0 in /evals/src — AhindraD/cognee0 reactions
On Bluesky · 15
- Jun 9, 2025🚀 Skyrocketing! 🚀 (200+ new stars) 📦 topoteretes / cognee ⭐ 4,853 (+414) 🗒 Python Memory for AI Agents in 5 lines of code — @github-trending.bsky.social7 likes and reposts
- Jul 20, 2026🚀 Skyrocketing! 🚀 (200+ new stars) 📦 topoteretes / cognee ⭐ 28,581 (+303) 🗒 Python Cognee is the open-source AI memory platform for… — @github-trending.bsky.social5 likes and reposts · 1 reply
- Mar 15, 2026🔥 Hot Repo! 🔥 (100+ new stars) 📦 topoteretes / cognee ⭐ 13,644 (+168) 🗒 Python Knowledge Engine for AI Agent Memory in 6 lines of code — @github-trending.bsky.social5 likes and reposts
- Jun 3, 2025Explore the research: arxiv.org/abs/2505.24478 Our GitHub: github.com/topoteretes/... — @vasilijee.bsky.social3 likes and reposts
- Jan 17, 2025What will you build with cognee? Try it out: github.com/topoteretes/... — @vasilijee.bsky.social2 likes and reposts · 1 reply
10 more on Bluesky
- Jan 16, 2025Check it out and let us know what you’ll build 🛠️ github.com/topoteretes/... github.com/milvus-io/mi... @cognee.bsky.social… — @vasilijee.bsky.social2 likes and reposts
- Jul 20, 2026今日のGitHubトレンド topoteretes/cognee CogneeはAIエージェントにセッションをまたいだ永続的な長期記憶を提供するためのオープンソースAIメモリプラットフォームです。… — @dailygithubtrends.bsky.social1 likes and repost
- Jun 27, 2026🎉 Celebrating! 🎉 (500+ new stars) 📦 topoteretes / cognee ⭐ 23,567 (+729) 🗒 Python Cognee is the open-source AI memory platform for… — @github-trending.bsky.social1 likes and repost · 1 reply
- Jun 15, 2026Cognee transforma datos no estructurados en un grafo de conocimiento persistente. plugins para OpenClaw, Claude Code y Hermes Agent.… — @samuel-ferrero.bsky.social1 likes and repost
- Apr 16, 2026🔥 Hot Repo! 🔥 (100+ new stars) 📦 topoteretes / cognee ⭐ 15,589 (+156) 🗒 Python Knowledge Engine for AI Agent Memory in 6 lines of code — @github-trending.bsky.social1 likes and repost
- Jun 19, 2025cognee Memory for AI Agents in 5 lines of code. https://github.com/topoteretes/cognee — @pythonhub.dev1 likes and repost · 1 reply
- Jun 8, 2025今日のGitHubトレンド topoteretes/cognee このリポジトリは、AIエージェント向けの動的なメモリ機能を提供することを目的に作成されました。 従来のRAG(Retrieval Augmented… — @dailygithubtrends.bsky.social1 likes and repost
- Jun 6, 2025今日のGitHubトレンド topoteretes/cognee このリポジトリは、AIエージェントにメモリ機能を持たせるためのライブラリです。… — @dailygithubtrends.bsky.social1 likes and repost
- Jan 21, 2025and try @cognee.bsky.social with LanceDB in our repo: github.com/topoteretes/... — @vasilijee.bsky.social1 likes and repost
- Jun 21, 2026🚀 Skyrocketing! 🚀 (200+ new stars) 📦 topoteretes / cognee ⭐ 18,410 (+361) 🗒 Python Cognee is the open-source AI memory platform for… — @github-trending.bsky.social0 likes and reposts · 1 reply
On Hacker News · 5
- Jun 3, 2025Show HN: Cognee – Open-Source AI Memory Layer That Remembers Context9 points · 2 comments
- Apr 22, 2024Show HN: Auto-optimizing deterministic LLM outputs using knowledge graphs7 points
- Feb 13, 2025Show HN: Cognee – Turn RAG and GraphRAG into custom dynamic semantic memory6 points · 1 comment
- Jan 13, 2025Cognee: Reliable LLM Memory for AI Applications and AI Agents2 points
- Feb 6, 2026Memory for AI agents in 6 lines of code1 point
In this repository17 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- cognee-cliSkill
- cognee-communitySkill
- cognee-custom-graph-modelsSkill
- cognee-custom-pipelinesSkill
- cognee-dockerSkill
- cognee-forgetSkill
- cognee-improve-sessionsSkill
- cognee-ingestionSkill
- cognee-installSkill
- cognee-integrationsSkill
- cognee-performanceSkill
- cognee-permissionsSkill
- cognee-recallSkill
- cognee-serverSkill
- cogneeSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 0 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 25
when you call await cognee.run_migrations().
- Very specific: line 62
If a dataset's data migration failed, writes to that dataset are refused until it succeeds (with access control off, any failure blocks all …
- Very specific: line 90
Use it to back up and restore a dataset, or to copy one to another cognee instance:
- Very specific: line 167
SQLite cannot drop or alter columns in place: use op.batch_alter_table(...).
- Very specific: line 178
Read cognee/modules/migrations/README.md first.
- Very specific: line 180
Write a module in cognee/modules/migrations/versions/ with async def migrate(context) (and optionally async def downgrade(context)).
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Database migrations
cognee has two migration chains, run together:
| Chain | Changes | Lives in | Revision stored in |
| Relational schema (Alembic) | Tables and columns of the relational DB (users, datasets, ACLs, pipeline runs, …) | cognee/alembic/ (alembic.ini is in cognee/) | alembic_version table |
| Graph/vector data | Cross-store data rewrites (re-keying node ids, adding graph columns) across graph DB, vector DB and relational ledger | cognee/modules/migrations/ (registry.py, versions/) | Per dataset: dataset_database.migration_revision (access control on). Globally: global_database_version.global_migration_revision (access control off) |
Use it
They run by themselves
run_migrations() applies the relational chain first, then the data chain.
It runs:
- at API server startup (and in the Docker
entrypoint.shbefore gunicorn); - on the first write in an SDK or CLI process (
remember,add,cognify,improve,memify, memory imports), once per process; - when you call
await cognee.run_migrations().
A fresh database is built by running the whole chain (no stamping). At
head, the first run in each process still does a no-op Alembic upgrade plus
a scan of the per-database revision rows; later calls in the same process
are skipped by an in-memory flag. ENABLE_AUTO_MIGRATIONS=false
turns off all automatic runs; then run cognee-cli upgrade yourself.
Concurrent processes are serialized by a migration lock: a Postgres advisory lock (works across hosts) or a file lock next to the SQLite DB (one host only).
Check and repair
cognee-cli current # stamped revision per database, and the last failure
cognee-cli history # the data chain, newest first
cognee-cli upgrade # relational to head, then data chain to head
cognee-cli upgrade <slug> # data chain up to and including <slug>
cognee-cli upgrade --alembic <rev> # pin the relational target
cognee-cli downgrade <slug|base> [--dataset UUID ...] [--alembic REV] [--force]
cognee-cli stamp <head|base|slug> [--dataset UUID ...] [--force]- The positional revision is always a data-chain slug; relational
targets go through
--alembic. downgraderewrites data and asks for confirmation. It only reverts spans where every migration defines adown(), and leaves the relational schema alone unless you pass--alembic.stampchanges only the stored data-chain revision, without running anything. Usestamp base --dataset <id>and thenupgradewhen a database's data drifted from its stamp (for example after restoring a backup); the chain is idempotent and converges it.upgraderuns even withENABLE_AUTO_MIGRATIONS=false.
A write is blocked
If a dataset's data migration failed, writes to that dataset are refused
until it succeeds (with access control off, any failure blocks all writes).
The server still starts. Run cognee-cli current to see the error, fix the
cause, then cognee-cli upgrade. A failed run is retried on the next start
or write.
Moving data between systems (not schema migrations)
| Goal | Use |
| Turn an existing relational database into a graph | migrate_relational_database(graph_db, schema) (cognee/tasks/ingestion/migrate_relational_database.py), with the source DB set by MIGRATION_DB_PROVIDER / _PATH / _NAME / _HOST / _PORT / _USERNAME / _PASSWORD. Examples: examples/demos/ingestion_and_migration/ |
| Back up a dataset, or move it to another cognee instance | A COGX archive, see below |
| Export a dataset's graph for other tools | await cognee.export(dataset, format=...): "json", "graphml" or "cypher" write a file (one way: cognee can't import them back); "pydantic" (default) returns typed DataPoint objects in memory |
| Import from another memory system (Mem0, Zep/Graphiti, Letta, LangMem) | Build a MemorySource (cognee/modules/migration/sources/) and pass it to await cognee.remember(source, dataset_name=...) |
There is no tool that moves a whole deployment from one database backend to another.
COGX archives
COGX (Cognee eXchange, cognee/modules/migration/cogx.py) is cognee's
portable memory format and the only export format cognee can import back.
An archive is a directory with a manifest.json (COGX version, source
system, the dataset's data-migration revision) and one JSONL file per record
kind (documents, episodes, entities, facts, memories,
memory_blocks), plus nodes.jsonl with the raw graph nodes. The Mem0,
Zep, Letta and LangMem importers also translate into COGX records first.
Use it to back up and restore a dataset, or to copy one to another cognee instance:
from cognee.migration import COGXArchiveSource
await cognee.export("my_dataset", format="cogx", destination="backup_cogx")
await cognee.remember(COGXArchiveSource("backup_cogx"), dataset_name="my_dataset")- A restore defaults to
mode="preserve": the archived graph is written back as-is, with no LLM calls.mode="hybrid"also re-cognifies the raw content;mode="re-derive"ignores the archived graph and extracts again (costs LLM tokens). cognee.push()/cognee-cli pushdoes the same to Cognee Cloud: it exports to COGX, packs it as a.cogx.tar.gzand uploads it, and the receiving instance restores it (preserve mode unless you passmode=).export(..., include_permissions=True)also writespermissions.jsonwith the dataset owner and ACL grants, including password hashes, so the restore recreates working accounts. Treat that archive as a secret.- An archive written by a newer major COGX version is rejected with a
ValueError; upgrade cognee on the importing side.
Pitfalls
- Never regenerate
cognee/alembic/frozen_schema.py. It is the certified base schema the initial revision builds from, pinned bycognee/tests/unit/test_frozen_schema_seal.py. Schema changes ship as new revisions at head. - Never hand-type an Alembic revision id. Hand-typed patterns
(
a1b2c3d4e5f6, …) already collided with a downstream chain that vendors this one (b2c3d4e5f6a7). Generate ids withalembic revision. - Never rename, remove, or reorder a data-chain entry. The slug is what deployed databases store; an unknown stored slug disables the chain for that database.
- A model change and its migration land together. CI's "Migration/Model Lockstep Guard" fails otherwise.
- The relational schema cannot be downgraded below the data-bookkeeping
revisions unless the data chain goes to
basein the same call. alembic.iniis always the packaged one;COGNEE_ALEMBIC_PATHor--alembic-pathonly changes the scripts directory (for vendored chains).
How it works
run_migrations() (cognee/modules/migrations/startup.py) takes the
migration lock, decides fresh vs existing (a users or alembic_version
table exists), runs Alembic in-process on a worker thread, then walks the
data chain per database with runner.run_database_migrations, stamping
after every step. After the chain, it syncs vector-adapter storage when the
recorded cognee_version differs from the library's
(versions/adapter_storage_migration.py, not a chain entry).
- Relational:
cognee/alembic.ini,cognee/alembic/env.py,cognee/alembic/versions/,cognee/alembic/frozen_schema.py - Data chain:
cognee/modules/migrations/(README.mdis the authoring contract;registry.py,migration.py,runner.py,startup.py,versions/) - CLI:
cognee/cli/commands/migrate_command.py
Extending it
A new Alembic revision
cd cognee # the directory with alembic.ini
uv run alembic revision -m "add foo to data"The DB URL comes from the live relational engine, so your normal .env
settings apply. Follow the recent revisions (for example
versions/e7f9a1c3d5b8_add_data_dataset_created_index.py):
- Idempotent and guarded: inspect first (
sa.inspect(op.get_bind())) and skip when the table is missing or the column/index already exists. - Branch on dialect (
conn.dialect.name == "postgresql") for Postgres-only SQL. For Postgres enums usepostgresql.ENUM(..., create_type=False)and create the type up front withcheckfirst. - SQLite cannot drop or alter columns in place: use
op.batch_alter_table(...). - Indexes: plain
CREATE INDEX IF NOT EXISTSinside the migration transaction, notCONCURRENTLY(which releases the version-row lock and lets concurrent workers into the same build). Repair invalid Postgres indexes viapg_index.indisvalid. - A new model module outside the usual import path must be imported in
cognee/alembic/env.py, or autogenerate will not see it.
A new data migration
Read cognee/modules/migrations/README.md first. In short:
- Write a module in
cognee/modules/migrations/versions/withasync def migrate(context)(and optionallyasync def downgrade(context)); step 2 registers them asup=/down=. - Append
Migration(slug=..., cognee_version=..., up=..., down_revision=<previous slug>, down=...)toMIGRATIONSinregistry.py. The chain is validated at import (linear, unique slugs). - Make it idempotent and cheap on empty stores, and crash-safe: re-key derived stores (vectors, ledger) first and rename in the graph last.
- Freeze private copies of any logic you depend on; never import live models that may change later.
Tests
cognee/tests/e2e/migrations/test_migration_model_lockstep.py(+schema_baseline.json): the lockstep CI job.cognee/tests/unit/test_run_migrations.py: single Alembic head, startup behaviour.cognee/tests/unit/test_frozen_schema_seal.py: frozen schema fingerprint.cognee/tests/unit/modules/migrations/: data-chain unit tests.cognee/tests/migrations/test_migration_lockstep.py: data chain against real stores (seed, down, up, verify).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

