topoteretes/cognee

cognee-migrations

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…

  • SKILL.md 已保存
  • 英文来源资料
  • 安装与运行未实测
先判断是否解决你的问题

cognee-migrations 是什么?

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).

以上为来源原文,中文用途说明尚待整理。

按客户端选择安装入口

怎么接入你的 Agent?

  1. 定位完整 Skill 目录

    打开本项目来源,核对 SKILL.md 及其引用的脚本和资料。

  2. 交给你正在用的 Agent

    在下面选择客户端,展开并复制安装指令,让 Agent 读取来源后选择安装方式。

  3. 确认识别,再做具体任务

    让 Agent 回报安装目录和识别到的名称 cognee-migrations,然后告诉 Agent 你的任务和实际输入,让它先核对触发条件。

展开并复制给 Codex 的安装指令
发送给 Codex

安装并检查 cognee-migrations

请在 Codex 的当前工作环境中安装并检查 cognee-migrations 这个 Skill。

项目身份:topoteretes/cognee / cognee-migrations
来源:https://github.com/topoteretes/cognee/blob/1961133d0c68b450fe8e71941a756371e94f7c04/.agents/skills/cognee-migrations/SKILL.md
已定位的源文件:.agents/skills/cognee-migrations/SKILL.md

1. 先阅读真实 SKILL.md 和它引用的必要文件,确认触发条件、安装方式、依赖与权限;尊重源文件要求的审批步骤。
2. 按当前客户端支持的方式安装完整 Skill 目录,保留已有配置,不只复制一段提示词。涉及缺失凭证、目标目录或权限时先列出缺项并向我确认。
3. 安装后回读实际目录、Skill 名称和识别结果,说明哪些步骤已完成,哪些只是文档检查,不得把安装成功当作任务已经实测。
4. 如来源提供了可安全验证的示例,在我提供所需输入后做一个最小任务;创建、修改、删除、部署或发送内容前,按源文件和我的授权执行。
需要核对时再展开原文

来源原文与资料状态

源文件
已保存 SKILL.md,抓取于 2026-11-23T04:29:48.865Z
中文使用说明
尚待整理,保留英文来源内容
安装与任务测试
本站未执行安装或任务测试
来源复核
已保留来源记录;当前完整用法未逐项人工复核
展开 SKILL.md 原文、章节与历史收录资料

.agents/skills/cognee-migrations/SKILL.md · 抓取时间 2026-11-23T04:29:48.865Z

以下保留源文件的 description、章节及摘录,供核对中文说明;完整文件通过上方链接打开。

抓取成功不代表已完成安装或任务测试。

来源 description(原文)

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).

查看源文件章节 / Source sections
  • 原文:Database migrations
  • 原文:Use it
  • 原文:They run by themselves
  • 原文:Check and repair
  • 原文:A write is blocked
  • 原文:Moving data between systems (not schema migrations)
  • 原文:COGX archives
  • 原文:Pitfalls
  • 原文:How it works
  • 原文:Extending it
  • 原文:A new Alembic revision
  • 原文:A new data migration
  • 原文:Tests
原文: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) |

原文: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.sh` before gunicorn); - on the first write in an SDK or CLI process (`remember`, `add`, `cognify`, `improve`, 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

```bash 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`. - `downgrade` rewrites data and asks for confirmation. It only reverts spans where every migration defines a `down()`, and leaves the relational schema alone unless you pass `--alembic`. - `stamp` changes only the stored data-chain revision, without running anything. Use `stamp base --dataset <id>` and then `upgrade` when a database's data drifted from its stamp (for example after restoring a backup); the chain is idempotent and converges it. - `upgrade` runs even with `ENABLE_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. Since COGX 0.2 every record also carries an optional OMP header, the fields proposed to the Open Memory Protocol exchange group: `origin` (first system and id, kept across copies), `content_hash` (sha256 of the body, for dedupe; distinct from an integrity checksum), `subject`, `semantic_kind` (fact, decision, commitment, procedure, preference, observation, other), `valid_from`/`valid_to` with `invalidated_by`, `evidence[]` (role, ref, confidence), `confidence` (outcome, verified_at, verified_by, score), `version`, `content_type` (the body's format), `tags`, a record `checksum` stamped by the writer, and provenance as `contributors[]` (role, actor, kind, at) with the `accountable` human and `ai_involvement`. The cognee exporter fills what it can read from the graph and declares the rest in the manifest's `coverage` map. The loader keeps the header as one `omp_header` JSON in a data item's external metadata, on Entity nodes and on fact edges, so a re-export preserves it; a chunk re-exports with its document's header. A record with no `origin` originates at its own `external_system`/`external_id`, so a Mem0 memory stays Mem0's. 0.1 archives read unchanged. Use it to back up and restore a dataset, or to copy one to another cognee instance: ```python 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") ```

本段为节选,完整内容见源文件。

文件 SHA256:e72f3a8868ca32ed09345344ae5958ddeb93850427416b735bab5d21ecc78298

仓库许可证记录:Apache-2.0;repository-license-recorded-scope-unverified,查看来源。

SKILL.md原文description · 2026-11-23T04:29:48.865Z

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).

查看历史简介来源

历史收录数据

来源仓库topoteretes/cognee
Skill源路径.agents/skills/cognee-migrations/SKILL.md

安装前请让使用的Agent先读取这个SKILL.md及其所在目录,确认依赖和所需权限。此页不生成未经来源验证的安装命令。

返回 Skills 目录,按任务继续筛选 · MCP与Skills教程与资源