chat-compactor
Generate structured session summaries optimized for future AI agent consumption. Use when (1) ending a coding/debugging session, (2) user says "compact", "summarize session", "save context", or "wrap up", (3) context window is getting long and continuity matters, (4) before switching tasks or taking a break. Produces machine-readable handoff documents that let the next session start fluently without re-explaining.
Best use case
chat-compactor is best used when you need a repeatable AI agent workflow instead of a one-off prompt. It is especially useful for teams working in multi. Generate structured session summaries optimized for future AI agent consumption. Use when (1) ending a coding/debugging session, (2) user says "compact", "summarize session", "save context", or "wrap up", (3) context window is getting long and continuity matters, (4) before switching tasks or taking a break. Produces machine-readable handoff documents that let the next session start fluently without re-explaining.
Generate structured session summaries optimized for future AI agent consumption. Use when (1) ending a coding/debugging session, (2) user says "compact", "summarize session", "save context", or "wrap up", (3) context window is getting long and continuity matters, (4) before switching tasks or taking a break. Produces machine-readable handoff documents that let the next session start fluently without re-explaining.
Users should expect a more consistent workflow output, faster repeated execution, and less time spent rewriting prompts from scratch.
Practical example
Example input
Use the "chat-compactor" skill to help with this workflow task. Context: Generate structured session summaries optimized for future AI agent consumption. Use when (1) ending a coding/debugging session, (2) user says "compact", "summarize session", "save context", or "wrap up", (3) context window is getting long and continuity matters, (4) before switching tasks or taking a break. Produces machine-readable handoff documents that let the next session start fluently without re-explaining.
Example output
A structured workflow result with clearer steps, more consistent formatting, and an output that is easier to reuse in the next run.
When to use this skill
- Use this skill when you want a reusable workflow rather than writing the same prompt again and again.
When not to use this skill
- Do not use this when you only need a one-off answer and do not need a reusable workflow.
- Do not use it if you cannot install or maintain the related files, repository context, or supporting tools.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/chat-compactor/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How chat-compactor Compares
| Feature / Agent | chat-compactor | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Generate structured session summaries optimized for future AI agent consumption. Use when (1) ending a coding/debugging session, (2) user says "compact", "summarize session", "save context", or "wrap up", (3) context window is getting long and continuity matters, (4) before switching tasks or taking a break. Produces machine-readable handoff documents that let the next session start fluently without re-explaining.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Chat Compactor
Generate structured summaries optimized for AI agent continuity across sessions.
## Why This Exists
Human-written summaries and ad-hoc AI summaries lose critical context:
- **Decision rationale** gets lost (why X, not Y)
- **Dead ends** get forgotten (agent re-tries failed approaches)
- **Implicit knowledge** isn't captured (file locations, naming conventions, gotchas)
- **State** is unclear (what's done, what's pending, what's blocked)
This skill produces **agent-optimized handoff documents** that prime the next session.
## Output Format
Generate a markdown file with this structure:
```markdown
# Session: [Brief Title]
Date: [YYYY-MM-DD]
Duration: ~[X] messages
## Context Snapshot
[1-2 sentences: What project/task, what state it's in right now]
## What Was Accomplished
- [Concrete outcome 1]
- [Concrete outcome 2]
## Key Decisions & Rationale
| Decision | Why | Alternatives Rejected |
|----------|-----|----------------------|
| [Choice] | [Reason] | [What didn't work and why] |
## Current State
- **Working**: [files/features that are functional]
- **Broken/Blocked**: [what's not working and why]
- **Modified files**: [list with brief note on changes]
## Dead Ends (Don't Retry)
- ❌ [Approach that failed] — [why it failed]
## Next Steps (Prioritized)
1. [ ] [Most important next action]
2. [ ] [Second priority]
## Environment & Gotchas
- [Any setup notes, versions, quirks discovered]
## Key Code/Commands Reference
[Only if there are non-obvious commands or snippets the next session needs]
```
## Workflow
1. **Scan conversation** for: decisions, outcomes, failures, file changes, blockers
2. **Identify the "handoff moment"** — what would a fresh agent need to continue?
3. **Generate structured summary** using format above
4. **Save to file**: `session-[topic]-[date].md` in project root or `/home/claude/sessions/`
## Compaction Triggers
Invoke this skill when:
- User says: "compact", "wrap up", "save session", "summarize for next time"
- Context window exceeds ~50% capacity and task is ongoing
- Before major context switches
- End of debugging/implementation session
## Quality Criteria
Good compactions are:
- **Scannable**: Next agent gets orientation in <30 seconds
- **Actionable**: Clear next steps, not vague summaries
- **Defensive**: Dead ends documented to prevent re-exploration
- **Minimal**: No fluff, every line earns its tokens
## Anti-Patterns
Avoid:
- Narrative prose ("First we tried X, then Y, then Z...")
- Redundant context (don't repeat what's in code comments)
- Vague summaries ("Made good progress on the feature")
- Missing failure documentation (most valuable part!)
## Example Trigger & Response
**User**: "Let's wrap up, compact this session"
**Agent**:
1. Reviews conversation for key decisions, outcomes, failures
2. Generates structured markdown per format above
3. Saves to `session-[topic]-[date].md`
4. Confirms: "Session compacted to `session-auth-refactor-2025-01-06.md` — ready for next time."Related Skills
azure-communication-chat-java
Build real-time chat applications with Azure Communication Services Chat Java SDK. Use when implementing chat threads, messaging, participants, read receipts, typing notifications, or real-time chat features.
baoyu-post-to-wechat
Post content to WeChat Official Account (微信公众号). Supports both article posting (文章) and image-text posting (图文).
chat-ui
Chat UI building blocks for React/Next.js from ui.inference.sh. Components: container, messages, input, typing indicators, avatars. Capabilities: chat interfaces, message lists, input handling, streaming. Use for: building custom chat UIs, messaging interfaces, AI assistants. Triggers: chat ui, chat component, message list, chat input, shadcn chat, react chat, chat interface, messaging ui, conversation ui, chat building blocks
ai-partner-chat
基于用户画像和向量化笔记提供个性化对话。当用户需要个性化交流、上下文感知的回应,或希望 AI 记住并引用其之前的想法和笔记时使用。
chatgpt-app-builder
Build ChatGPT Apps using the Apps SDK and MCP. Use when users want to: (1) Evaluate if their product should become a ChatGPT App (2) Design and implement MCP servers with widgets (3) Test apps locally and in ChatGPT (4) Prepare for App Store submission Triggers: "ChatGPT app", "Apps SDK", "build for ChatGPT", "ChatGPT integration", "MCP server for ChatGPT", "submit to ChatGPT"
chatkit-widget
Use when integrating OpenAI/ChatKit chat widgets into Next.js/React applications. Triggers for: embedding chat widgets, configuring widget appearance, implementing event handlers, setting up authenticated chat access, or customizing widget branding. NOT for: building custom chat UIs from scratch or backend AI model configuration.
building-chatgpt-apps
Guides creation of ChatGPT Apps with interactive widgets using OpenAI Apps SDK and MCP servers. Use when building ChatGPT custom apps with visual UI components, embedded widgets, or rich interactive experiences. Covers widget architecture, MCP server setup with FastMCP, response metadata, and Developer Mode configuration. NOT when building standard MCP servers without widgets (use building-mcp-servers skill instead).
building-chat-widgets
Build interactive AI chat widgets with buttons, forms, and bidirectional actions. Use when creating agentic UIs with clickable widgets, entity tagging (@mentions), composer tools, or server-handled widget actions. Covers full widget lifecycle. NOT when building simple text-only chat without interactive elements.
building-chat-interfaces
Build AI chat interfaces with custom backends, authentication, and context injection. Use when integrating chat UI with AI agents, adding auth to chat, injecting user/page context, or implementing httpOnly cookie proxies. Covers ChatKitServer, useChatKit, and MCP auth patterns. NOT when building simple chatbots without persistence or custom agent integration.
chatbot-implementation
Details of the RAG Chatbot, including UI and backend logic.
chatkit-botbuilder
Guide for creating production-grade ChatKit chatbots that integrate OpenAI Agents SDK with MCP tools and custom backends. Use when building AI-powered chatbots with specialized capabilities, real-time task execution, and user isolation for any application.
wechat-management
Manage information from Wechat and Send Messages, Only could be activated with the MCP Server `WeChatMCP`. Check it before using any tools in this MCP server