Session To Memory — Development skill for Claude Code
A Claude Code skill that distills long-term memories from saved session transcripts — reads only what the user actually typed, shows a preview, and writes only after explicit confirmation.
How to install Session To Memory
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open unfallenwill/session-to-memory and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Session To Memory does
A Claude Code skill that distills long-term memories from saved session transcripts — reads only what the user actually typed, shows a preview, and writes only after explicit confirmation. 从 Claude Code 会话文件生成长期记忆:只读用户亲口说过的话,先预览、确认后才写入。
Alternatives in Development
- Powercontext — Agent memory: long-term memory & agent memory handoff 1.4k ★
- Mem0 Chrome Extension — OpenMemory Chrome Extension: Long-term memory for ChatGPT, Claude, Perplexity, Grok etc 671 ★
- Scope Recall Hermes — Local long-term memory for Hermes, Codex, Claude Code, WorkBuddy and dsh agents: one SQLite store, source-back 438 ★
README
session-to-memory
一个个人斜杠命令:从 Claude Code 的会话文件里**用户自己说过的话**提炼出长期记忆,先给预览,经确认后写进那个项目的记忆目录。
用法
/session-to-memory --list 列出当前项目最近的会话,挑一个
/session-to-memory <会话文件.jsonl>… 抽取、提炼、出预览(不写任何文件)
/session-to-memory ~/.claude/projects/<项目目录>/ 处理这个项目目录下的全部会话
/session-to-memory --write 确认:全部写入
/session-to-memory --write 1 3 只写编号 1、3 的记忆
/session-to-memory --delete D1 只删编号 D1 的旧记忆
预览之后也可以直接回复「全部写入」或「写入 1 3」。「好的」「继续」不算确认。
写进哪个项目:会话文件在 `~/.claude/projects/<项目目录>/` 下,就写进那个项目的记忆目录,不管当前在哪个项目;导出或拷贝出来的会话文件,写进当前项目。
它怎么工作
- 抽取(
scripts/extract.py):会话文件是 JSONL,绝大多数记录不是用户的话。工具结果、框架通知、粘贴的内容、其他代理发来的消息都混在里面(多数也存成user记录),同一条消息还会出现好几遍。脚本只留下用户自己说的、用!运行的命令、在提问对话框里的回答,按时间排好、去重,写成不长的摘要。最大的会话文件(约 60 MB)0.2 秒跑完,原文不进对话。 - 提炼(模型,按
SKILL.md的规则):读摘要和已有的记忆,写一份计划:新增或更新哪些记忆、删哪些、哪些拿不准。每条都要附一句用户原话作依据。 - 预览(
scripts/memory_store.py check):核对计划——依据的那句话确实在会话里用户自己的话中;格式、链接、索引;有没有凭据。有问题就不出预览。它不写任何文件。 - 写入(
apply):要带上check给出的确认码。文件在前、索引在后,中途失败就恢复原状。
测试
python3 -I tests/run_tests.py
只碰两样东西:`tests/make_fixtures.py` 造出来的假会话,和练习项目 `-tmp-session-to-memory-test`(`~/.claude/projects/-tmp-session-to-memory-test`,每次运行都会清空重建,运行完删掉)。不会碰任何真实的记忆目录。
已知的边界
- 会话文件的格式只在本机的 Claude Code 2.1.335(Linux)上核实过;换了版本,抽取的结果要用预览里的「认出的用户消息」核对一遍。
- 提炼由模型完成,记什么、记多少条取决于模型,而且故意偏保守:对话里已经写进仓库文件的决定不记。脚本能保证的是:每条都有用户原话作依据、没有凭据、格式正确、不经确认不写。
- 粘贴进来的内容默认不进摘要;只有粘贴、没有用户自己话的消息不会留下。
- 一次只能处理一个项目的会话。
- 用户直接回复「全部写入」的那一轮,Claude Code 会照常弹权限确认(执行技能、运行脚本);用
/session-to-memory --write确认则不会。 - 预览之后一直没有确认的,摘要会留在
/tmp下一个只有本人可读的临时目录(session-to-memory-…)里,重启后消失。
Related Skills
Recall.En
{user_name} is searching their own long-term memory. Those memories are dated observations: things they said,
Sw Publish
Prepares one accepted Jira story change with identity checks, a dry-run and conflict stops, and executes it on
Lore Plugin
Claude Code plugin for persistent long-term memory via Lore. Auto-ingests session transcripts and exposes read
Manage Delete
Permanently delete a file. Requires explicit confirm=true on a second invocation — first call shows a preview
Transcripto
Index your coding-agent transcripts, keep only the turns you actually typed, and grade them. Local, stdlib-onl
Vir
Distills your Claude Code sessions into an Obsidian vault you own. Filters out agent output, keeps what you ac
Related Agents
Bkit Design Brainstorm Ideate 2
Senior architect proposing 2-3 design approaches for best long-term shape, with explicit trade-offs.
Media Namer
Names a finished demo video or screenshot with an explicit title from what it actually shows - the area of the
Trust
Checks whether a website shows who is behind it and backs up its claims. Reads saved pages only.