Session memory for AI coding agents: records decisions and dead ends, flags what went stale.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
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.
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.
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.
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:
No model judgement involved. It stores the command that proved something and re-runs it. Silence means everything still holds.
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.
You are probably here because of one of these:
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.
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.
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.
Sessions form a tree, like branches, because work does. session_tree shows it; session_log
is a git log --oneline across all of them.
uv for the install scriptgit is optional. Without it the journal records no-git and stays usefulTwo 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.
--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.
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.
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.
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_init still exists for a session you want to start deliberately, or to
attach to a parent:
Throughout the session:
At 70-80% context:
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/cogsession)<a href="https://allmcps.com/mcp/cogsession"><img src="https://allmcps.com/api/badge/cogsession?style=directory" alt="CogSession on AllMCPs" /></a>