Compaction Skill logo

Compaction Skill

Community
zeenie-ai
compaction-skill

Manage memory compaction by summarizing conversation history when approaching token limits

Overview

Publisherzeenie-ai
RepositoryOpenCompany
Skill namecompaction-skill
Stars
912
Forks
137
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by zeenie-ai on GitHub. Read the source before you install it.

Installation

Install the Compaction Skill AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/zeenie-ai/OpenCompany.git /tmp/OpenCompany
mkdir -p .claude/skills
cp -r /tmp/OpenCompany/server/skills/assistant/compaction-skill .claude/skills/compaction-skill
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Compaction Skill in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Compaction Skill on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Compaction Skill is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Memory Compaction Skill

You have the ability to compact conversation memory when it grows too large. Compaction transforms verbose conversation history into a structured summary that preserves essential context while reducing token usage.

When to Compact

Compact memory when:

  • The system indicates token threshold is approaching
  • Conversation history becomes repetitive or verbose
  • You need to preserve important context but reduce size
  • Starting a new phase of work after completing a major task

Compaction Summary Structure

When compacting, create a summary with these 5 sections:

1. Task Overview

What the user is trying to accomplish. Include:

  • Primary goal or objective
  • Key constraints or requirements
  • Scope of the work

2. Current State

What's been completed and what's in progress:

  • Completed tasks and their outcomes
  • Work currently in flight
  • Pending decisions or blockers

3. Important Discoveries

Key findings, decisions, or problems encountered:

  • Technical discoveries or insights
  • Decisions made and their rationale
  • Problems encountered and solutions applied
  • User preferences learned

4. Next Steps

What needs to happen next:

  • Immediate actions required
  • Planned approach for remaining work
  • Dependencies or prerequisites

5. Context to Preserve

Critical details that must be retained:

  • Specific values, IDs, or references
  • User preferences or constraints
  • Technical details needed for continuity
  • Any warnings or caveats

Compaction Format

Output the compacted summary in this format:

markdown
# Conversation Summary (Compacted)
*Generated: [ISO timestamp]*

## Task Overview
[1-3 sentences describing the goal]

## Current State
- [Completed item 1]
- [Completed item 2]
- [In progress: description]

## Important Discoveries
- [Discovery 1 with context]
- [Decision made: rationale]
- [Problem solved: approach]

## Next Steps
1. [Next action]
2. [Following action]

## Context to Preserve
- [Critical detail 1]
- [Critical detail 2]

Best Practices

  1. Be Concise: Each section should be brief but complete
  2. Preserve Specifics: Keep exact values, names, and references
  3. Capture Decisions: Record WHY decisions were made, not just WHAT
  4. Include Failures: Document what didn't work to avoid repetition
  5. Maintain Continuity: Summary should allow seamless continuation

What NOT to Include

  • Verbose back-and-forth dialogue
  • Redundant information
  • Superseded decisions (only keep final decisions)
  • Exploratory tangents that didn't lead anywhere
  • Standard pleasantries or acknowledgments

Example Compaction

Before (verbose history):

Human: Can you help me debug this Python function?
AI: Of course! Please share the function.
Human: Here's the function: def calculate(x): return x * 2
AI: I see the function. What issue are you experiencing?
Human: It returns None sometimes
AI: That's interesting. Can you show me an example input?
Human: calculate("5") returns None
AI: Ah, I see the issue! When you pass a string...
[continues for 50+ messages]

After (compacted):

markdown
# Conversation Summary (Compacted)
*Generated: 2025-02-13T10:30:00Z*

## Task Overview
Debug Python function `calculate(x)` that returns None for some inputs.

## Current State
- Identified root cause: string inputs cause implicit None return
- Implemented fix with type checking and conversion
- Tests passing for int, float, and string inputs

## Important Discoveries
- Original function had no type validation
- String multiplication in Python doesn't raise error but behaves unexpectedly
- User prefers explicit error messages over silent failures

## Next Steps
1. Add input validation for edge cases (None, empty string)
2. Write unit tests for the fixed function

## Context to Preserve
- Function location: `utils/math_helpers.py:45`
- User wants to maintain backward compatibility
- Prefer raising ValueError over returning None

Integration with Memory System

When compaction is triggered:

  1. The compacted summary replaces the current memory content
  2. New conversation messages are appended after the summary
  3. The summary header indicates when compaction occurred

This allows conversation to continue naturally while maintaining reduced token usage.

Frequently asked questions

What does the Compaction Skill AI skill do?

Manage memory compaction by summarizing conversation history when approaching token limits

Why use Compaction Skill on TypingMind?

Because you install it once and use it with any model. Compaction Skill is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Compaction Skill in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/zeenie-ai/OpenCompany/tree/main/server/skills/assistant/compaction-skill. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Compaction Skill?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Compaction Skill?

As many as you like. As long as a model supports skills, you can use Compaction Skill with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Compaction Skill AI skill free?

Yes. It is published on GitHub by zeenie-ai under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇