topoteretes/cognee

cognee-improve-sessions

Use when working with cognee's session memory or improve() — storing conversation turns, agent traces and feedback with session_id, bridging sessions into the permanent graph, reading an ImproveResult, understanding why an improve stage was skipped or already_completed, or tuning the IMPROVE_* settings.

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

cognee-improve-sessions 是什么?

Use when working with cognee's session memory or improve() — storing conversation turns, agent traces and feedback with session_id, bridging sessions into the permanent graph, reading an ImproveResult, understanding why an improve stage was skipped or already_completed, or tuning the IMPROVE_* settings.

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

按客户端选择安装入口

怎么接入你的 Agent?

  1. 定位完整 Skill 目录

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

  2. 交给你正在用的 Agent

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

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

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

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

安装并检查 cognee-improve-sessions

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

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

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

来源原文与资料状态

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

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

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

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

来源 description(原文)

Use when working with cognee's session memory or improve() — storing conversation turns, agent traces and feedback with session_id, bridging sessions into the permanent graph, reading an ImproveResult, understanding why an improve stage was skipped or already_completed, or tuning the IMPROVE_* settings.

查看源文件章节 / Source sections
  • 原文:Session memory and improve()
  • 原文:Use it
  • 原文:Writing session memory
  • 原文:What improve() does: nine stages, in order
  • 原文:Reading the result
  • 原文:How remember() triggers improve
  • 原文:Settings (`IMPROVE_*`, `cognee/modules/improve/config.py`)
  • 原文:Pitfalls
  • 原文:How it works
  • 原文:Extending it
原文:Session memory and improve()

cognee has two kinds of memory: - **Session memory**: a fast cache of conversation turns, agent traces, and feedback, keyed by `session_id`. Writing is instant, with no LLM extraction. - **The permanent graph**: what `remember()` builds without a session. `improve()` connects them. It bridges session content into the graph and enriches the graph itself. `remember()` calls it automatically, so most users never call it directly. ```python import cognee # Session write: returns immediately; improve() bridges it in the background await cognee.remember("User prefers dark mode.", session_id="chat_1") # Session-aware query: session cache first, then the graph results = await cognee.recall("What does the user prefer?", session_id="chat_1") # Bridge sessions into a dataset's graph explicitly result = await cognee.improve(dataset="main_dataset", session_ids=["chat_1"]) print(result.status, result.stage_summary()) await cognee.wait_for_background_tasks() # before a script exits ```

原文:Writing session memory

| What | How | |---|---| | A fact or note | `remember(text, session_id=...)` (stored as a Q&A entry with the text as the answer) | | A Q&A turn | `recall(query, session_id=...)` with a completion search type saves the turn itself; or `remember(cognee.QAEntry(question=..., answer=...), session_id=...)` | | An agent step | `remember(cognee.TraceEntry(origin_function=..., status="success", ...), session_id=...)`, or the `@cognee.agent_memory(save_session_traces=True)` decorator | | Pin a session to a project / node set | `node_set=[...]` on the first `QAEntry`/`TraceEntry` (or as a kwarg on any session `remember`) pins it; later writes repeat or omit it, a different set raises `cognee.SessionNodeSetConflictError` (HTTP 409). `improve()` keeps the set on everything it bridges, so `recall(node_name=[...])` scopes to the project | | Feedback on an answer | `remember(cognee.FeedbackEntry(qa_id=..., feedback_score=...), session_id=...)` or `cognee.session.add_feedback(session_id, qa_id, feedback_text=..., feedback_score=...)` | | Read a session | `cognee.session.get_session(session_id, last_n=...)` | Requirements: `CACHING=true` (default). The cache backend is `CACHE_BACKEND`, one of `sqlite` (default), `postgres`, `redis`, `tapes`. Sessions expire after `SESSION_TTL_SECONDS` (default 7 days).

原文:What improve() does: nine stages, in order

Every run goes through the same ordered stages (`cognee/modules/improve/registry.py`). Each stage checks a gate before it spends any LLM or embedding cost, and reports one `StageResult`. | # | Stage | What it does | Runs when | |---|---|---|---| | 1 | `feedback_weights` | Adjusts the weight of graph elements that rated answers used | `session_ids` given; adapter supports feedback weights | | 2 | `persist_session_qa` | Turns session Q&A into graph content (node set `user_sessions_from_cache`) | `session_ids` given. **The only fatal stage** | | 3 | `persist_agent_traces` | Turns agent-trace feedback into graph content | `session_ids` given | | 4 | `extract_agent_context` | Drafts agent-profile lessons from traces | `session_ids`, `CACHING` + `AUTO_FEEDBACK`, an LLM | | 5 | `distill_sessions` | Distills session learnings into the graph | `session_ids`, an LLM | | 6 | `update_user_preferences` | Folds rated turns into per-user preferences | `session_ids`, `PERSONALIZATION_ENABLED=true` (default false) | | 7 | `build_truth_subspace` | Builds the truth subspace from distilled learnings | `session_ids`, `build_truth_subspace=True`, a Ladybug graph | | 8 | `review_conflicts` | Reviews dated source facts and stores conflicts | on by default (`review_conflicts=False` or `IMPROVE_REVIEW_CONFLICTS=false` turns it off), an LLM, edge evidence | | 9 | `global_context_index` | Bucket and root summaries for global questions; also the rows dataset routing scores an unscoped search on | on by default (`build_global_context_index=False` or `IMPROVE_GLOBAL_CONTEXT_INDEX=false` turns it off) | Stages 1–7 need `session_ids`; 8–9 work on the graph alone. The order matters: 4 feeds 5, 5 feeds 7, and 7 runs before 8. `extraction_tasks` / `enrichment_tasks` are deprecated and removed in the next release: they still run, as a `custom_tasks` stage after the others, scoped by `node_name`, `data`, `node_type`, `vector_db_config` and `graph_db_config`. Without custom tasks those options are ignored. Both cases warn with a `FutureWarning`; use `run_custom_pipeline()` instead.

原文:Reading the result

`improve()` returns an `ImproveResult`, and so do `POST /api/v1/improve`, the CLI, and `RememberResult.improve`. - `result.status`: `completed`, `errored` (any stage errored), `skipped` (every stage skipped), or `running` (background, not finished). - `result.stages`: one `StageResult` per stage, with `stage`, `status` (`completed` / `already_completed` / `skipped` / `errored`), `reason`, `error`, `counts`, `duration_ms`. - `result.stage("distill_sessions")`, `result.stage_summary()`. - `await result.wait()` finishes a background run (no-op otherwise). **Skip and no-op reasons:** | Reason | Meaning / fix | |---|---| | `no_session_ids` | Session stage, no `session_ids` passed | | `disabled_by_config` | Listed in `IMPROVE_STAGES_DISABLED` | | `opt_in_disabled` | Pass `build_truth_subspace=True` | | `turned_off` | An on-by-default stage was switched off: conflict review by `review_conflicts=False` or `IMPROVE_REVIEW_CONFLICTS=false`, the global context index by `build_global_context_index=False` or `IMPROVE_GLOBAL_CONTEXT_INDEX=false` | | `personalization_disabled` | Set `PERSONALIZATION_ENABLED=true` | | `auto_feedback_disabled` | Stage 4 needs `CACHING=true` and `AUTO_FEEDBACK=true` | | `no_llm_configured` | Stages 4, 5, 8 draft text with an LLM; none configured | | `edge_evidence_disabled` | Conflict review needs `EDGE_EVIDENCE_ENABLED=true` | | `backend_unsupported` | The graph adapter lacks the feature (feedback weights, truth subspace) | | `session_manager_unavailable` | The session cache is not reachable | | `aborted_by_fatal_stage` | Stage 2 failed, so the rest did not run | | `budget_exhausted` | An earlier stage failed because the LLM budget is exhausted (a 402); the rest would fail the same way. Top up, then run improve again | | `no_new_entries`, `no_new_trace_steps`, `no_new_facts`, `no_writes_since_last_improve` | With status `already_completed`: nothing new since the last run |

原文:How remember() triggers improve

- **Without a session:** `add`, then `cognify`, then a foreground `improve()`. Its outcome is on `result.improve` / `result.improve_error`. A failed improve never marks the remember as errored. - **With `session_id`:** the text is cached, then a background `improve(dataset, session_ids=[session_id])` starts if the debounce allows it. `result.improve` fills in only after `await result` or `wait_for_background_tasks()`. - `self_improvement=False` turns it off per call; `IMPROVE_AUTO_ENABLED=false` turns it off everywhere and overrides `self_improvement=True`. - An application embedding cognee can decline one automatic improve before it starts: `cognee.modules.improve.register_auto_improve_admission(check)` registers one async check that `remember()` awaits on both paths. Returning a reason string skips the improve and sets `result.improve_skipped` (`result.improve` stays `None`); the data is stored either way. A check that raises allows the improve. Explicit `improve()` calls are never gated.

原文:Settings (`IMPROVE_*`, `cognee/modules/improve/config.py`)

| Env var | Default | Meaning | |---|---|---| | `IMPROVE_AUTO_ENABLED` | `true` | Automatic improve after `remember()` | | `IMPROVE_DEBOUNCE_ENTRIES` | `1` | Session auto-improve fires after this many new entries | | `IMPROVE_DEBOUNCE_SECONDS` | `0` | ...or this many seconds since the last one. Seconds alone (entries left at 1) means time-only | | `IMPROVE_STAGES_DISABLED` | empty | CSV of stage names to skip | | `IMPROVE_FEEDBACK_ALPHA` | `0.1` | Feedback learning rate, in (0, 1] | | `IMPROVE_REVIEW_CONFLICTS` | `true` | Review fact conflicts, including automatic improve; an explicit `review_conflicts` argument overrides it | | `IMPROVE_EFFECTIVE_DATE_KEY` | `effective_date` | Document metadata key holding the source date | There is no debounce timer: held-back entries wait for the next `remember()` with that session, or an explicit `improve()`.

文件 SHA256:10abbe568dc5664d4795014bd4fd95baa16ba71b9630047553b4068f2249fc09

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

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

Use when working with cognee's session memory or improve() — storing conversation turns, agent traces and feedback with session_id, bridging sessions into the permanent graph, reading an ImproveResult, understanding why an improve stage was skipped or already_completed, or tuning the IMPROVE_* settings.

查看历史简介来源

历史收录数据

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

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

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