Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/zane456/cc-session-memory/sessnpx skills add Zane456/cc-session-memory --skill sessgit clone --depth 1 https://github.com/Zane456/cc-session-memoryWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/zane456/cc-session-memory/sess)<a href="https://agentmods.dev/skills/zane456/cc-session-memory/sess"><img src="https://agentmods.dev/badge/skills/zane456/cc-session-memory/sess.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00135 | $0.01546 |
| Opus 5 | $0.00068 | $0.00773 |
| Sonnet 5 | $0.00027 | $0.00309 |
| Haiku 4.5 | $0.00014 | $0.00155 |
Grade A, and why
sess scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 78 lines — stays where its author put it; the contents beside it link to each section on GitHub.
/sess — 会话记忆加载与搜索
两层数据:
- GLM 摘要:cc-session-memory 每轮压缩到
<CC_MEMORY_REPO>/memories/,每条 ~300 字、有 frontmatter,给"读了就懂大概"用。 - CC 原始 jsonl:Claude Code 自己写在
~/.claude/projects/<encoded-cwd>/<session-uuid>.jsonl,是完整对话原文——用户原话、Claude 原话、所有工具调用都在里头。摘要丢失的细节去这里找。
派发规则(按用户输入决定调哪条命令)
工具:python3 "<CC_MEMORY_REPO>/memory_system/cli/ccmem.py",下面用 $CLI 代指。
| 用户意图 | 命令 |
|---|---|
| 无参数 / 只想"接着上次聊" | $CLI last-session --max-bytes 64000 |
要看最近 N 个 session 摘要 (-n 3 之类) |
$CLI last-session -n N --max-bytes 64000 |
| 带关键词搜(当前项目) | $CLI find "<keyword>" -n N --section-only --max-bytes 32000 |
| 带关键词搜(明示全局) | $CLI find "<keyword>" --all -n N --section-only --max-bytes 32000 |
| 要原话 / 具体细节 / 摘要里没写清的内容 | $CLI find "<keyword>" --raw -n 1 --max-bytes 32000 |
| 要上个 session 的完整原文对话 | $CLI last-session --raw --max-bytes 64000 |
何时走 --raw
GLM 摘要是有损压缩。默认先看摘要,符合下列任一才升级到 --raw:
- 用户用了"原话/原文/具体说了什么/具体怎么做的/详情/细节/到底/原本"等词
- 摘要已经回答了"做了什么",但用户接着问"具体怎么做的"
- 摘要里某个关键决策没写清(比如"试过 X 但失败"具体是什么错误)
- 用户要找一段特定的文字(错误信息、命令、参数、URL)
--raw 比摘要慢 + 大很多倍,所以不要默认开。摘要够用就别升级。
--raw 模式默认不打工具调用结果(噪声大),只显示 user/assistant 文本和工具名。要看工具结果加 --include-tool-results。
Context 预算(默认就带,不要省)
每条命令默认都带 --max-bytes(防止历史记忆挤爆当前 context);find 默认还带 --section-only(只返回命中关键词的 ## 轮次 段,省略其余轮次)。
默认值的判断框架(不是死规则):
last-session→ 64KB(≈16K tokens):用户要"接着聊",给完整一整次会话足够find→ 32KB +--section-only:搜索是定向问题,用户要的是命中段不是整篇
何时去掉这些 flag:
- 用户明确说"全部/完整/show me everything/不要省略" → 去掉
--max-bytes和--section-only - 用户明确给出预算("只用 5K tokens")→ 按用户给的来(1 token ≈ 4 bytes 估算)
- 输出尾部提示
⚠️ 已达 --max-bytes 预算→ 跟用户说"还有 X 条/段被省略了,要不要加大预算或换关键词"
为什么这样设:cc-session-memory 是纯关键词检索,命中范围不可控;不设上限会把无关轮次("今天天气好"那种闲聊)一起塞进 context,稀释信号。section-only 几乎总是对的,因为既然你搜了关键词,你要的就是关键词附近的内容。
raw 模式预算:raw 输出可能比摘要大 10-50 倍。--raw 配 find 默认就要 -n 1(先看一条)+ --max-bytes 32000;--raw 配 last-session 默认 --max-bytes 64000。预算溢出时 CLI 会提示,再问用户要不要扩。
判断"全局" vs "当前项目"
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3d ago First seen · 78 lines · 135 tokens per session scan A 6e94039ed703
sess is a skill published in the GitHub repository Zane456/cc-session-memory (1 stars, last pushed 1mo ago), licensed MIT. It adds 135 tokens to every session and 1,546 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
writing
将共享历史中的已验证事实和计算结果整理成符合受众、格式与长度约束的成稿。.
kayba-stage-7-fixer
Implement the approved fixes from the action plan and log all changes. Trigger when the user says "run stage 7", "implement fixes", "apply action plan", or when invoked by the kayba-pipeline orchestrator. Requires eval/actionplan.md to exist.
regex-mastery
Use this skill when writing regular expressions, debugging pattern matching,optimizing regex performance, or implementing text validation. Triggers on regex, regular expressions, pattern matching, lookahead, lookbehind, named groups, capture groups, backreferences, and any task requiring text pattern matching.
ws-ckpt
工作区快照管理。用户说"保存一下"、"存个快照"时创建 checkpoint,仅限 Linux; 说"回滚"、"撤销"、"恢复到之前"时 rollback;说"删掉快照"时 delete; 说"对比快照"、"快照改了什么"时 diff; 说"看看快照"、"有哪些快照"时 list;说"查看快照状态"、"查看快照剩余空间"时 status。.
memory-recall
Search and recall relevant memories from past sessions via memsearch. Use when the user's question could benefit from historical context, past decisions, debugging notes, previous conversations, or project knowledge -- especially questions like 'what did I decide about X', 'why did we do Y', or 'have I seen this…
food-order
Reorder previous Foodora orders, preview cart contents, and track delivery ETA/status with ordercli. Use when the user wants to reorder food, check delivery status, or browse recent Foodora order history. Never confirm an order without explicit user approval.