CogSession
概览
作者提供的说明(英文原文)
Session memory for AI coding agents: records decisions and dead ends, flags what went stale.
它能帮你做什么
我们还没有为它写通俗的介绍。下面是我们从注册中心读取到的事实。
- 连接方式: 在你的电脑上运行
- 传输方式: stdio
- 分类: 开发者工具
安装
选择你使用的 AI 应用,然后复制设置。
通过 2/2 项检查 · 在你的电脑上运行
第一步:你用哪个 AI?
选择你用的应用,步骤会显示在下方。
可连接 Claude,但需要先准备
需要先在电脑上安装 Python (uv)(只需一次) · 仅限电脑上的 Claude 应用(Windows 或 Mac),网页和手机不可用
打开电脑版 Claude 应用的设置文件
SettingsDeveloperEdit Config
粘贴这些设置并保存文件
{ "mcpServers": { "cogsession": { "command": "uvx", "args": [ "cogsession" ] } } }退出 Claude 再重新打开
试一试
用 CogSession 告诉我你能帮我做什么,然后做一件给我看✓ 如果 Claude 说正在使用 CogSession,或回答中出现 CogSession 的工具名称,就表示连接成功
菜单名称已于 2026年11月11日 对照 Anthropic 帮助页面核实 · 你的界面可能因版本略有不同
ChatGPT 暂时无法连接 CogSession
CogSession 需要安装在你的电脑上,而 ChatGPT 只能连接在网上运行的服务器
你可以改用这些方式
A · 使用能连接 CogSession 的应用
- 需要先在电脑上安装 Python (uv)(只需一次) · 仅限电脑上的 Claude 应用(Windows 或 Mac),网页和手机不可用
- 需要先在电脑上安装 Python (uv)(只需一次)
- 需要先在电脑上安装 Python (uv)(只需一次)
- 需要先在电脑上安装 Python (uv)(只需一次)
B · 开发者工具 类中能连接 ChatGPT 的其他服务器
从同类中使用较多的里挑选,仅限用地址即可连接、无需密钥的
- Sentry✓ ChatGPT
- Front-End Checklist✓ ChatGPT
- Compiler Explorer✓ ChatGPT
可连接 Claude Code,但需要先准备
需要先在电脑上安装 Python (uv)(只需一次)
打开终端
Mac:按 Command+空格,输入 Terminal · Windows:打开 PowerShell
粘贴这条命令并按 Enter
claude mcp add cogsession -- uvx cogsession在 Claude Code 中输入 /mcp
应能看到 CogSession 在列表中并显示已连接
试一试
用 CogSession 告诉我你能帮我做什么,然后做一件给我看✓ 如果 Claude Code 说正在使用 CogSession,或回答中出现 CogSession 的工具名称,就表示连接成功
菜单名称已于 2026年11月11日 对照 Anthropic 帮助页面核实 · 你的界面可能因版本略有不同
可连接 Cursor,但需要先准备
需要先在电脑上安装 Python (uv)(只需一次)
在 Cursor 中以 Agent 模式打开 AI 聊天
试一试
用 CogSession 告诉我你能帮我做什么,然后做一件给我看✓ 如果 Cursor 说正在使用 CogSession,或回答中出现 CogSession 的工具名称,就表示连接成功
菜单名称已于 2026年11月11日 对照 Cursor 帮助页面核实 · 你的界面可能因版本略有不同
可连接 VS Code,但需要先准备
需要先在电脑上安装 Python (uv)(只需一次)
在 VS Code 中以 Agent 模式打开 AI 聊天
试一试
用 CogSession 告诉我你能帮我做什么,然后做一件给我看✓ 如果 VS Code 说正在使用 CogSession,或回答中出现 CogSession 的工具名称,就表示连接成功
菜单名称已于 2026年11月11日 对照 VS Code 帮助页面核实 · 你的界面可能因版本略有不同
开发者专用:终端命令和 JSON 设置
安装在电脑上
Claude Code
claude mcp add cogsession -- uvx cogsessionClaude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"cogsession": {
"command": "uvx",
"args": [
"cogsession"
]
}
}
}Cursor (~/.cursor/mcp.json)
{
"mcpServers": {
"cogsession": {
"command": "uvx",
"args": [
"cogsession"
]
}
}
}VS Code (mcp.json)
{
"servers": {
"cogsession": {
"type": "stdio",
"command": "uvx",
"args": [
"cogsession"
]
}
}
}这些设置是根据作者在注册中心的条目生成的。如果 README 的写法不同,请以 README 为准。
一览
哪些应用可以使用它
依据这个服务器的连接方式和各应用自己的文档,检查于 2026年11月10日。
在你的电脑上运行,适用于
ClaudeGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatRaycast
它能做什么
它在你的电脑上运行;安装后,工具列表会显示在你的 AI 应用中。
基础检查i
我们检查的是任何人都能看到的信息;我们没有阅读代码。不适用的检查项不计入总数。 · 检查于 2026年11月11日
- ✓ 通过
作者与仓库一致
注册名称已通过 GitHub 账户 premanand8800 验证,该账户拥有此仓库
- ✓ 通过
仍在维护
代码最后更新于18天前
- … 尚未检查
有许可证
我们还没有从 GitHub 读取这个仓库
- – 不适用
端点有响应
它在你的电脑上运行,没有互联网端点
- – 不适用
使用 OAuth 登录
在你的电脑上运行,改用本地设置
- … 尚未检查
工具描述中没有隐藏指令
它在你的电脑上运行;我们只能读取互联网端点的工具列表
讨论
提问、分享技巧或报告无法使用。按“有帮助”数量排序。
用户评价
还没有评价
与“开发者工具”中的其他服务器比较i
- 星标数多于此分类中其他 5751 个服务器的 69%
- 发布到注册中心的时间比此分类中其他 5751 个服务器的 32% 更新
- 基础检查结果等于或优于此分类中其他 5751 个服务器的 100%
与注册中心里这个分类中所有活跃的服务器比较。只有当发布者拥有该仓库时,星标数才计入。
常见问题
CogSession 安全吗?
它在 2 项适用的基础检查中通过了 2 项。我们没有阅读代码。在添加密钥或令牌之前,请先看看这个服务器要求哪些权限,并使用只具备所需权限的密钥。
它需要哪些密钥或代码?
注册中心没有列出必需的密钥,不过有些服务器会在首次使用时要求你登录。
它在我的电脑上运行还是在云端?
它在你的电脑上运行。你的 AI 应用会在需要时启动它,数据不会经过作者的服务器(除非它自己调用在线服务)。
它还在维护吗?
GitHub 仓库最后更新于18天前,最新版本(0.1.0)于2个月前进入注册中心。
哪些应用可以使用它?
支持 MCP 的应用,例如 Claude Desktop、Claude Code、Cursor 和 VS Code。你的电脑上还需要有 Python (uv)。
有什么可以替代它?
同一分类中有:REA, Netdata, Front-End Checklist
替代选择
同一分类中其他作者的服务器,按星标数排序。
如何看卡片:↓ 每周下载量i★ GitHub 星标i三大支柱:评价 · 检查 · 使用情况i更新 = 最新版本发布到注册中心的时间i
Netdata
Real-time infrastructure monitoring with metrics, logs, alerts, and ML-based anomaly detection.
Front-End Checklist
Review frontend code and live pages against 386 quality-gated web development rules.
作者的 README
打开 README
按原文从作者的仓库复制。PopNx MCP 没有审查或背书其内容。HTML、图片和脚本已被移除。链接会离开本站。
🌳 CogSession
Session memory for AI coding agents. Your agent forgets everything when the context window fills. CogSession remembers the parts worth keeping, and tells you when they stop being true.
The problem
Session 1 (context fills) → Session 2 starts fresh → Session 3 starts fresh
Everything lost. Repeats the mistakes. Starts blind again.
You explain the codebase again. The agent tries the approach that already failed. The constraint you agreed on in session 1 is gone by session 3.
The usual answer is "write better notes", which fails for the same reason all documentation fails: it is true when written and nobody notices when it stops being true.
What CogSession does
Three things, and the third is the one that does not exist elsewhere.
1. It records without being asked. A session opens on its own. Decisions, dead ends, assumptions and errors are written as they happen, each stamped with the local time and the repo state it happened at (main@a1b2c3d+2, where +2 is dirty files).
2. It makes that searchable without loading it. Every session keeps a session.md: append-only, one block per event, every entry line self-describing. So one grep answers a question without pulling a file into context.
grep -A4 "dead_end" .cogsessions/*/session.md # what already failed
grep "2026-08-27 01:" .cogsessions/*/session.md # what happened that hour grep "main@a1b2c3d" .cogsessions/*/session.md # what happened at that commit
3. It tells you when what you wrote stops being true. Record a claim with the command that *proves* it. When the files it watches change, the proof is re-run:
[CogSession] 1 claim(s) no longer hold:
✗ the composite key includes the tenant column expected '1', got '0' asserted in: PR description, line 26 proof: grep -c 'UNIQUE (a, b, c)' migrations/007_schema.sql
No model judgement involved. It stores the command that proved something and re-runs it. Silence means everything still holds.
Why the third one matters
Every expensive failure in three weeks of daily use reduced to one sentence: *something was true when it was written and stopped being true.* A pull request description explaining a schema the code no longer had. A comment naming a constraint that moved. A test asserting a shape the implementation had dropped. A docstring contradicting its own function.
An agent cannot notice that from a transcript. A human notices it in review, which is the expensive place. A stored proof notices it for free.
Is this the thing you are looking for?
You are probably here because of one of these:
- Claude Code hit its context limit and the next session knows nothing about the last one
- Your agent retried an approach that already failed, because nothing recorded that it failed
- A constraint you agreed on in one session was gone three sessions later
- You keep re-explaining the same codebase at the start of every session
- A comment, a doc or a PR description described the code as it used to be, and review caught it rather than you
The first four are what any agent-memory tool is for. The fifth is the one CogSession was actually built to solve, and it is the reason for the claims feature above.
How this differs from just writing notes
Notes go stale silently. That is the entire problem, and no amount of discipline fixes it, because the failure is not that you forgot to write something down — it is that what you wrote stopped being true and nothing told you.
A claim is a note with a proof attached. When the proof stops passing, you hear about it.
How this differs from your agent's built-in memory
Built-in memory decides what to keep. This records what happened, in a plain file you own, in your repo's directory, greppable with tools you already have. It works the same whether the agent is Claude Code today or something else next year, because the output is markdown and JSONL rather than a vendor's store.
What a session looks like on disk
.cogsessions/
├── sess_001_discover/ │ ├── session.md ← greppable timeline, every entry timestamped + git-stamped │ ├── handoff.md ← the brief the next session reads first │ ├── claims.json ← assertions with the commands that prove them │ ├── dead_ends.md ← what failed and why, so it is not retried │ ├── assumptions.md ← what was assumed but never verified │ ├── tasks.json ← done / remaining / blocked │ ├── decisions.json ← flagged when made under high context pressure │ ├── environment.json ← the commands that restore a working state │ ├── architecture.mermaid← auto-generated dependency diagram │ └── session_log.jsonl ← append-only machine log ├── sess_002_auth/ (parent: sess_001) └── sess_003_payments/ (parent: sess_001, sibling of sess_002)
Sessions form a tree, like branches, because work does. session_tree shows it; session_log is a git log --oneline across all of them.
Requirements
- Python 3.11+
uvfor the install script- An MCP-capable agent. Built against Claude Code; also usable from Codex (see below)
gitis optional. Without it the journal recordsno-gitand stays useful
Install
pip install cogsession # or: uv tool install cogsession
cogsession-admin install
Two commands on purpose. The first installs the MCP server; the second wires the hooks, which is what makes CogSession record without being asked. A package cannot write to ~/.claude/settings.json on its own, so without the second command you get eleven tools you must call by hand and none of the recording.
cogsession-admin install backs up your settings first, adds the six hooks alongside anything already there, and will not overwrite a status line you already set.
Installing from a clone instead (for working on CogSession itself)
git clone https://github.com/premanand8800/cogsession.git
cd cogsession uv sync uv run cogsession-admin install --repo .
--repo points the hooks at your checkout through uv, so edits take effect without reinstalling.
The installer syncs dependencies with uv, registers the MCP server with Claude Code, and writes the hooks that let it observe a session without being asked. It touches ~/.claude/settings.json and nothing inside your projects.
It will not write to a file git tracks. The handoff goes to CLAUDE.local.md, which is auto-loaded the same way CLAUDE.md is but never committed. If that filename happens to be tracked in your repo, CogSession refuses to write rather than dirtying your tree, and tells you where the handoff is on disk instead. Add .cogsessions/ to your .gitignore.
The tools
Eleven MCP tools, in four groups:
| Group | Tools |
|---|---|
| Lifecycle | session_init · session_checkpoint · session_load · session_status |
| Recording | session_update |
| Searching | session_search · session_log · session_tree · session_diagram |
| Claims | claim_record · claim_check |
Plus six hooks (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PreCompact, SessionEnd) that do the recording you never have to ask for.
What it does *not* do
Worth saying plainly, because it is the first thing people assume:
CogSession does not store your conversations. It reads the transcript only to measure how full the context window is. What it keeps is conclusions — decisions, dead ends, assumptions, claims — plus the mechanical events from the hooks. That is deliberate: a memory made of every word said is a memory nobody re-reads. But it does mean the quality of a session's memory depends on things being recorded as they are decided.
Usage
Start of every session: nothing. The SessionStart hook opens a session and loads the previous handoff on its own. Tracking that depends on someone remembering to turn it on is tracking that silently does not happen.
Name the session when you know what it is about — the focus line is the only part a tool cannot infer:
session_update(type="focus", content="auth module")
session_init still exists for a session you want to start deliberately, or to attach to a parent:
session_init(project_root="/your/project", focus="auth module")
session_load(project_root="/your/project") # load a previous handoff by hand
Throughout the session:
session_update(type="decision", content="Use python-jose for JWT", reasoning="Handles RS256 edge cases")
session_update(type="dead_end", content="Using httpx for auth", why_failed="Breaks streaming in /login", use_instead="Use requests library") session_update(type="assumption", content="users table has hashed_password column", risk_level="HIGH", how_to_verify="Run \\d users in psql") session_update(type="task_complete", content="Build /register endpoint") session_update(type="task_add", content="Build /refresh endpoint") session_update(type="danger_zone", content="Don't touch middleware.py — custom CORS order line 45") session_status(context_pct=67)
At 70-80% context:
session_checkpoint(context_pct=78, one_liner="Built JWT auth. Refresh token next.")
Look something up without loading anything. Every session keeps a session.md: append-only, one block per event, each header carrying its own local timestamp, event type, and the repo state it happened at (branch@commit+dirty). So one grep answers a question:
grep -n -A4 "dead_end" .cogsessions/<session>/session.md # what already failed
grep -n "2026-08-27 01:" .cogsessions/ /session.md # what happened that hour grep -n "main@a1b2c3d" .cogsessions/ /session.md # what happened at that commit
Every entry line is self-describing, which is what makes a bare grep useful: a match tells you when, what kind, and against which state of the code, with no need to scroll for context. Tool calls are deliberately left out — hundreds per session would bury the decisions someone is actually searching for; they stay in session_log.jsonl.
Scan history like `git log`:
session_log() # newest first, all sessions
session_log(type_filter="dead_end") # what has already failed here
when what repo session 2026-08-27 01:43:57 +0545 error master@3d4d1fd+2 sess_20260827_... 2026-08-27 01:43:57 +0545 dead_end master@3d4d1fd+1 sess_20260827_...
Scan, then grep the journal for the entry that matters. The commit id is the join back to real git log, so a decision can be lined up with the state of the code that produced it.
Claims — for anything you write down that could go stale:
claim_record(
claim="the composite key includes the tenant column", verified_by="grep -c 'UNIQUE (a, b, c)' migrations/007_schema.sql", expect="1", watches=["migrations/007_schema.sql"], asserted_in="PR description, line 26", ) claim_check() # re-runs the proofs whose files moved
A claim stores the *command that proved it*, not a note about how to check it. When the file changes, the next session is told which statements stopped being true, where they were asserted, and how they were checked.