session

session is a skill for Claude Code, Codex from xiaobei930/cc-best. It costs 24 tokens per session (1,091 once invoked), scanned A, original, MIT.

A session-lifecycle guide for preserving useful project knowledge and managing the amount of conversation context available to a coding agent.

In plain words
What is it for?
Use it to load previous context, save debugging patterns and project knowledge, and compress context when changing tasks or reaching a limit.
Why use it?
Long coding sessions can lose earlier details or run out of context; this guide helps compress completed work and record reusable solutions.

Skill for Claude CodeCodex

Part of the cc-best plugin — 19 skills, 44 commands, 8 agents, 20 hooks shipped together

Install

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.

agentmods
npx agentmods add skills/xiaobei930/cc-best/session
Any agent
npx skills add xiaobei930/cc-best --skill session
Clone the repo
git clone --depth 1 https://github.com/xiaobei930/cc-best

Made for: Claude Code, Codex.

Or install cc-best, the plugin that ships this one along with the rest of its 19 skills, 44 commands, 8 agents, 20 hooks.

Wrote 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.

agentmods badge for session

README.md
[![agentmods](https://agentmods.dev/badge/skills/xiaobei930/cc-best/session.svg)](https://agentmods.dev/skills/xiaobei930/cc-best/session)
Your own site
<a href="https://agentmods.dev/skills/xiaobei930/cc-best/session"><img src="https://agentmods.dev/badge/skills/xiaobei930/cc-best/session.svg" alt="Measured on agentmods" height="20"></a>
Per session 24 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,091 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.00024 $0.01091
Opus 5 $0.00012 $0.00545
Sonnet 5 $0.00005 $0.00218
Haiku 4.5 $0.00002 $0.00109

Measured yesterday against content hash 83aa92eef14d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

session 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 yesterday.

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.

skills/session/SKILL.md · 125 lines

How it starts

The opening of the file, as written. The whole thing — 125 lines — stays where its author put it; the contents beside it link to each section on GitHub.

会话生命周期管理

本技能提供 Claude Code 会话的生命周期管理策略,整合持续学习和上下文压缩。

会话生命周期

会话开始 ──→ 工作阶段 ──→ 检查点 ──→ 会话结束
    │           │           │           │
    │           │           │           └─→ 提取模式 (/learning)
    │           │           └─→ 上下文压缩 (/cc-best:compact-context)
    │           └─→ 持续工作
    └─→ 加载上次上下文

策略选择

场景 推荐策略 子技能
上下文接近限制 策略性压缩 /cc-best:compact-context
完成重要任务节点 主动压缩 /cc-best:compact-context
会话结束时 提取可复用模式 /learning
解决了复杂问题 记录解决方案 /learning
发现项目特定知识 记录到知识库 /learning

子技能

1. learning(持续学习)

适用场景

  • 会话结束时提取模式
  • 记录调试技巧
  • 保存项目特定知识
  • 积累可复用解决方案

使用方式/learning 或参阅 skills/learning/SKILL.md

2. compact(上下文压缩)

适用场景

  • 上下文接近限制时
  • 完成阶段性任务后
  • 切换工作主题前
  • 需要释放上下文空间

使用方式/cc-best:compact-context 或参阅 skills/compact/SKILL.md

最佳实践

何时压缩

  1. 主动压缩 - 完成一个功能模块后
  2. 被动压缩 - 系统提示上下文接近限制
  3. 切换压缩 - 准备切换到不同任务前

何时记录

  1. 立即记录 - 解决问题后立即记录
  2. 定期回顾 - 会话结束前检查值得记录的内容
  3. 增量更新 - 发现新知识时更新已有记录

会话别名 | Session Aliases

为会话设置语义化标签,便于快速查找和恢复。

别名管理

在会话元数据中记录语义化标签:

{
  "name": "feature-login-page",
  "sessionPath": "memory-bank/progress.md",
  "tags": ["feature", "frontend"],
  "created": "2026-02-24 14:30:00",
  "summary": "实现登录页面 - PM/Lead/Dev 已完成"
}

存储位置: ~/.claude/session-aliases.json(全局,跨项目共享)

标签分类系统

前缀 含义 示例
feature-* 功能开发 feature-login-page
bugfix-* 缺陷修复 bugfix-auth-timeout
refactor-* 重构改进 refactor-api-layer
explore-* 技术探索 explore-new-framework

跨会话恢复

当使用 /cc-best:catchup 恢复时:

  1. 读取上次会话的 alias 信息
  2. 加载对应的 progress.md 状态
  3. 显示上次会话的关键决策摘要

别名操作

  • 保存: 会话结束时自动提示或通过 /cc-best:checkpoint 手动触发
  • 查找: 通过 /cc-best:catchup --alias <name> 快速恢复指定会话
  • 清理: 超过 30 天未使用的别名自动标记为过期

Read the full file on GitHub · 125 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

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.

  1. yesterday First seen · 125 lines · 24 tokens per session scan A 83aa92eef14d

Subscribe to this mod's changes

session is a skill published in the GitHub repository xiaobei930/cc-best (50 stars, last pushed 2mo ago), licensed MIT. It adds 24 tokens to every session and 1,091 once invoked, about $0.0001 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-09-03.

Related

Other skills, from other repositories

rtk-optimizer

Wrap high-verbosity shell commands with RTK to reduce token consumption. Use when running git log, git diff, cargo test, pytest, or other verbose CLI output that wastes context window tokens.

FlorianBruniaux/claude-code-ultimate-guide · 44 tokens

catchup

Restore context after /clear by summarizing recent work and project state.

FlorianBruniaux/claude-code-ultimate-guide · 16 tokens

session-save

Save the current session state (decisions, modified files, current status, and next steps) to a handoff file for later resume.

FlorianBruniaux/claude-code-ultimate-guide · 31 tokens

handoff-create

Generate a structured handoff document from the current session. Captures scope, relevant files with line numbers, key discoveries, work completed, current status, next steps, and code snippets. Use before ending a session or handing work to another agent.

FlorianBruniaux/claude-code-ultimate-guide · 53 tokens

handoff-update

Update an existing handoff document with current session progress. Applies section-specific merge rules: append-only for Work Done (never deletes history), replace for Status and Next Steps, merge for Files and Discoveries. Falls back to creating a new handoff if no source file is found.

FlorianBruniaux/claude-code-ultimate-guide · 60 tokens

handoff-resume

Load a handoff document and resume work from where a previous session left off. Parses scope, file references, completed work, and next steps, then confirms understanding before proceeding.

FlorianBruniaux/claude-code-ultimate-guide · 40 tokens