- name
SKILL.md
ไฟล์สกิลยังคงอยู่ในรีโพซิทอรีของผู้เผยแพร่
วางคำสั่งที่คัดลอกไว้ในเทอร์มินัล คำสั่งจะติดตั้ง SKILL.md นี้ลงในเอเจนต์ตัวนั้น
npx skills add topoteretes/cognee --skill cognee-improve-sessions -a cursor -yวางคำสั่งที่คัดลอกไว้ในเทอร์มินัล คำสั่งจะติดตั้ง SKILL.md นี้ลงในเอเจนต์ตัวนั้น
npx skills add topoteretes/cognee --skill cognee-improve-sessions -a claude-code -yวางคำสั่งที่คัดลอกไว้ในเทอร์มินัล คำสั่งจะติดตั้ง SKILL.md นี้ลงในเอเจนต์ตัวนั้น
npx skills add topoteretes/cognee --skill cognee-improve-sessions -a codex -yวางคำสั่งที่คัดลอกไว้ในเทอร์มินัล คำสั่งจะติดตั้ง SKILL.md นี้ลงในเอเจนต์ตัวนั้น
npx skills add topoteretes/cognee --skill cognee-improve-sessions -a grok -yส่งข้อความที่คัดลอกไว้ในแชต Grok Bot แล้ว Bot จะดึง SKILL.md นี้จาก GitHub และเพิ่มลงในสกิลที่ Bot ทุกตัวของคุณใช้ร่วมกัน
Install this skill: https://github.com/topoteretes/cognee/tree/HEAD/.agents/skills/cognee-improve-sessionsจากผู้เผยแพร่
cognee has two kinds of memory:
session_id. Writing is instant, with no LLM
extraction.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.
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
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).
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.
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.
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:
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.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.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.IMPROVE_*, cognee/modules/improve/config.py)There is no debounce timer: held-back entries wait for the next
remember() with that session, or an explicit improve().
improve(dataset) often does nothing. Without session_ids,
only stages 8–9 can run, and both are off by default. Result: every
stage skipped. That is expected, not an error.node_set fixes it for the session; a different set is a 409, start a
new session instead. Bridged Q&A, traces and lessons carry the set, user
preferences never do. The guarantee holds within one worker process (an
in-process lock); with several workers, send a session's writes to one.
Example: examples/guides/session_node_sets.py.remember(..., session_id=...) goes to the bound
dataset; naming another one (dataset_id, or a dataset_name other than
the main_dataset default) raises ValueError (HTTP 409 on
POST /api/v1/remember, 400 on /remember/entry). Start a new session
for another dataset. The turn's Q&A vector is written to that dataset's own
vector store, where its recalls read it.DATASET_QUEUE_MAX_CONCURRENT, default 6, per process), so it waits
while that many datasets are busy, and the first write to a new dataset
provisions the dataset's databases (one database per dataset on
pgvector/Postgres, a container with neo4j_community). If those
databases cannot be bound, the write raises instead of storing the turn.remember(QAEntry/TraceEntry/ FeedbackEntry, session_id=...) stores the entry but never starts an
improve. Call improve(session_ids=[...]) yourself.cognify(): improves, cognify, add and forget on one dataset
run one at a time, and improves sharing a session also wait for each
other. A background call returns at once and waits inside its task. The
lock is per process only; multiple API workers do not share it.improve() resolves the dataset once (creating it if the name is new),
waits for the dataset's lock and then for every
session:<user>:<session_id> claim, probes the graph adapter's capabilities, and
runs the stages with one frozen ImproveRunInputs. Each stage is a gate
plus a call into existing pipelines plus a result mapping. Stages never own
retries or ordering.
Watermarks keep repeat runs cheap:
The improve operation row is written when the run finishes: failed if any
stage errored (a retry is never gated off), noop if nothing ran.
cognee/api/v1/improve/improve.py (HTTP:
routers/get_improve_router.py; CLI: cognee/cli/commands/improve_command.py)cognee/modules/improve/ (stages.py,
registry.py, stage.py, result.py, inputs.py, capabilities.py,
config.py, watermarks.py, constants.py)cognee/infrastructure/locks/session_lock.pycognee/infrastructure/session/
(session_manager.py, session_persist_watermark.py,
feedback_detection.py); cache backends in
cognee/infrastructure/databases/cache/cognee/api/v1/remember/remember.py,
cognee/api/v1/remember/auto_improve_debounce.pycognee/memory/entries.pycognee/infrastructure/background_tasks.pyExamples: examples/guides/improve_quickstart.py, sessions.py,
session_distillation.py, review_conflicts.py, global_context_index.py,
agent_memory_quickstart.py, and
examples/advanced_guides/remember_recall_improve_example.py.
Adding a stage:
BaseStage in cognee/modules/improve/stages.py. Set name,
needs_sessions, and fatal (leave it False; exactly one fatal stage
is enforced at import). Implement gate() (return a skip reason
constant, or None, before any LLM/embedding cost) and run() (call
existing pipeline code, return a StageResult).DEFAULT_STAGES in registry.py at the right position.
The order is pinned by cognee/tests/unit/modules/improve/test_registry_order.py;
update it deliberately.already_completed (graph-wide stages can stamp the improve row with the
helpers in watermarks.py, as conflict review does).cognee/tests/unit/modules/improve/ (gates, results, config) and
cognee/tests/unit/api/v1/improve/ (orchestration, queue, router).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
---name: cognee-improve-sessionsdescription: Use when working with cognee's session memory or improve() — storing conversation turns, agent traces and…---# .agents/skills/cognee-improve-sessions/SKILL.mdภาพรวม
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.
FAQ
ดาวน์โหลด .agents/skills/cognee-improve-sessions/SKILL.md จากผู้เผยแพร่ หรือคัดลอกพาธแล้วเปิดรีโพซิทอรี PlugMCP แสดงรายการสกิลเท่านั้น ไม่ได้โฮสต์ไฟล์
ผู้เผยแพร่เก็บไว้ที่ https://github.com/topoteretes/cognee
Claude, Cursor, Codex และ Grok Build อ่าน SKILL.md ที่คุณเพิ่มจากรีโพซิทอรีของผู้เผยแพร่ได้ ส่วน Grok Bot จะติดตั้งให้เมื่อคุณส่งลิงก์โฟลเดอร์ GitHub ของสกิลในแชต
IMPROVE_STAGES_DISABLED is validated.persist_session_qaValueErrorremember(text, session_id=...)
with CACHING=false only logs a warning and stores nothing; typed entries
raise RuntimeError. An explicit improve(session_ids=...) then fails in
the fatal stage.improve() raises (HTTP 409)
and the error carries .improve_result. In background mode it is recorded
on result.error instead. Other stages failing only mark themselves
errored; HTTP still returns 200, so check status.cognee.serve(url), a background improve is
fire-and-forget: status stays running and there is no polling.cognee/modules/session_bridge/ is gone (only stale __pycache__ may be
left). The bridging now lives in the improve stages; some test names still
say "session_bridge".