Agent skill

Memory Compaction

by Kiyoraka in Kiyoraka/Project-AI-MemoryCore

MUST use when user says 'compact memory', 'compact [file]', 'check budgets', 'set budget', 'restore compaction', or before any 'save' whose target memory file exceeds its budget in…

No licenceAuto-check passed

Install Memory Compaction

skills CLI
$ npx skills add Kiyoraka/Project-AI-MemoryCore --skill memory-compaction -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Kiyoraka/Project-AI-MemoryCore memory-compaction --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Kiyoraka/Project-AI-MemoryCore.git skills-src && mkdir -p .claude/skills && cp -r skills-src/Feature/Memory-Compaction-System .claude/skills/memory-compaction && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
memory-compaction
GitHub stars
374
Token cost
~1.2k tokens
SKILL.md length
532 words
Files
4
Skills in repo
17
Repo updated
First seen
Licence
None found

At a glance

MUST use when user says 'compact memory', 'compact [file]', 'check budgets', 'set budget', 'restore compaction', or before any 'save' whose target memory file exceeds its budget in…

  • Works in 5 steps: Snapshot → Split Into Tiers → Compact the Oldest Tier → …
  • User says compact memory
  • SKILL.md covers Activation, Context Guard, Budget Check Protocol and Compaction Protocol, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Memory Compaction is an agent skill from Kiyoraka/Project-AI-MemoryCore. MUST use when user says 'compact memory', 'compact [file]', 'check budgets', 'set budget', 'restore compaction', or before any 'save' whose target memory file exceeds its budget in compaction/compaction-policy.md.

Its SKILL.md is about 1.2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files (for example `README.md`, `install-memory-compaction.md` and `policy-format.md`).

When your agent uses it

  • User says compact memory
  • Restore compaction
  • Before any save whose target memory file exceeds its budget in compaction/compaction-policy.md

Example prompts

  • “compact memory”
  • “compact [file]”
  • “check budgets”
  • “/memory-compaction”

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Snapshot
  2. Split Into Tiers
  3. Compact the Oldest Tier
  4. Rewrite
  5. Verify and Report

What it can do on your machine

Read from SKILL.md and the folder at commit c421b55. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are markdown).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Memory Compaction loads about 1.2k tokens when it runs. Until then it costs about 58 tokens; SKILL.md has 532 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~58
When it runs · the whole SKILL.md, loaded when a task matches
~1.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

Without a licence we can't republish the file, so here is its outline and opening line. It has 532 words (~1,160 tokens).

“Keep memory small without making it forget.”

— opening of SKILL.md by Kiyoraka
name
memory-compaction

Read the full SKILL.md on GitHub

Files

SKILL.md and 3 other files in Feature/Memory-Compaction-System of Kiyoraka/Project-AI-MemoryCore.

  • SKILL.md
  • README.md
  • install-memory-compaction.md
  • policy-format.md

Open the folder on GitHubat commit c421b55

Compare with similar skills

Memory Compaction next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Memory Compaction compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Memory Compaction this skillKiyoraka/Project-AI-MemoryCore374—~1.2kAutomated safety check: PassNone
Strategic Compactaffaan-m/ECC275k1 repos~2.1kAutomated safety check: PassMIT
Compactcatlog22/Claude-Code-Workflow2.1k—~3.2kAutomated safety check: PassMIT
Strategic Compactaffaan-m/ECC275k2 repos~434Automated safety check: PassMIT
Strategic Compactaffaan-m/ECC275k2 repos~724Automated safety check: PassMIT
Strategic Compactaffaan-m/ECC275k3 repos~943Automated safety check: PassMIT

Similar skills

  • Strategic Compact

    affaan-m/ECC

    Suggests manual context compaction at logical intervals to preserve context through task phases rather than arbitrary auto-compaction.

    275k GitHub starsUsed in 1 repo~2.1k tokens
    Agent WorkflowsAuto-check passed
  • Compact

    catlog22/Claude-Code-Workflow

    Compact current session memory into structured text for session recovery.

    2.1k GitHub stars~3.2k tokensUpdated 3 mo ago
    Agent WorkflowsAuto-check passed
  • Strategic Compact

    affaan-m/ECC

    任意の自動コンパクションではなく、タスクフェーズを通じてコンテキストを保持するための論理的な間隔での手動コンパクションを提案します。

    275k GitHub starsUsed in 2 repos~434 tokens
    Auto-check passed
  • Strategic Compact

    affaan-m/ECC

    임의의 자동 컴팩션 대신 논리적 간격에서 수동 컨텍스트 압축을 제안하여 작업 단계를 통해 컨텍스트를 보존합니다.

    275k GitHub starsUsed in 2 repos~724 tokens
    Auto-check passed
  • Strategic Compact

    affaan-m/ECC

    建议在逻辑间隔处手动压缩上下文,以在任务阶段中保留上下文,而非任意的自动压缩。

    275k GitHub starsUsed in 3 repos~943 tokens
    Auto-check passed
  • Compactness

    parcadei/Continuous-Claude-v3

    Problem-solving strategies for compactness in topology. An agent skill from parcadei/Continuous-Claude-v3.

    3.9k GitHub starsUsed in 1 repo~732 tokens
    Research & ScienceAuto-check: notes

More from Kiyoraka/Project-AI-MemoryCore

All 17 skills in this repo
  • Image Generation

    Kiyoraka/Project-AI-MemoryCore

    MUST use when the user wants to RENDER or GENERATE an actual image from a description (not just craft prompt text).

    374 GitHub stars~992 tokensUpdated 2 mo ago
    Auto-check: notes
  • Video Generation

    Kiyoraka/Project-AI-MemoryCore

    MUST use when the user wants to RENDER or GENERATE an actual video / MP4 from a description, or ANIMATE a local image.

    374 GitHub stars~1.2k tokensUpdated 2 mo ago
    Auto-check: notes
  • Auto Commit

    Kiyoraka/Project-AI-MemoryCore

    MUST use when committing code changes, when user says 'commit', 'save changes', 'git commit', 'commit changes', when completing a task and code needs to be preserved, or when any git commit…

    374 GitHub stars~1.6k tokensUpdated 2 mo ago
    Auto-check: notes
  • Forge Skill

    Kiyoraka/Project-AI-MemoryCore

    Auto-triggers when AI detects a repeated pattern handled ad-hoc 3+ times, when AI makes a mistake that a permanent rule would prevent, when AI identifies a workflow that should be automated as a…

    374 GitHub stars~2.3k tokensUpdated 2 mo ago
    Auto-check passed
  • Image Prompt

    Kiyoraka/Project-AI-MemoryCore

    Auto-triggers when user asks for a Midjourney or NijiJourney image prompt, when creating visual art prompts, or when user says 'midjourney prompt', 'niji prompt', 'create prompt', 'create a prompt'…

    374 GitHub stars~2.4k tokensUpdated 2 mo ago
    Auto-check passed
  • Interactive Story

    Kiyoraka/Project-AI-MemoryCore

    Auto-triggers when user says 'new adventure', 'start adventure', 'new fantasy', 'save adventure', 'end adventure', 'load adventure', 'resume adventure', 'continue adventure', 'let's play', 'VN…

    374 GitHub stars~4.2k tokensUpdated 2 mo ago
    Auto-check passed

Questions about Memory Compaction

What does Memory Compaction do?

MUST use when user says 'compact memory', 'compact [file]', 'check budgets', 'set budget', 'restore compaction', or before any 'save' whose target memory file exceeds its budget in…. Memory Compaction is an agent skill from Kiyoraka/Project-AI-MemoryCore.md.

When should I use Memory Compaction?

Memory Compaction fits situations like: user says compact memory; restore compaction; before any save whose target memory file exceeds its budget in compaction/compaction-policy.md.

How do I install Memory Compaction in Claude Code?

Run `npx skills add Kiyoraka/Project-AI-MemoryCore --skill memory-compaction -a claude-code`. Or copy the skill folder (Feature/Memory-Compaction-System in Kiyoraka/Project-AI-MemoryCore) into .claude/skills/memory-compaction in your project. Claude Code loads it when a task matches its description.

How do I install Memory Compaction in Codex?

Run `npx skills add Kiyoraka/Project-AI-MemoryCore --skill memory-compaction -a codex`. Or copy the skill folder (Feature/Memory-Compaction-System in Kiyoraka/Project-AI-MemoryCore) into .agents/skills/memory-compaction in your project. Codex loads it when a task matches its description.

Can I use Memory Compaction in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Kiyoraka/Project-AI-MemoryCore --skill memory-compaction -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/memory-compaction, .gemini/skills/memory-compaction, .github/skills/memory-compaction and .opencode/skills/memory-compaction in your project.

What does Memory Compaction need to run?

SKILL.md names no scripts, command-line tools or credentials: Memory Compaction is instructions for the agent only.

Does Memory Compaction access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Memory Compaction safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Memory Compaction use?

No licence was found for Memory Compaction or its repository. Without one, default copyright applies: ask the author before reusing or redistributing it.

How many tokens does Memory Compaction use?

About 1.2k tokens (SKILL.md is roughly 4.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Memory Compaction?

Skills that share tags, products or a category with Memory Compaction: Strategic Compact (affaan-m/ECC, 275k stars), Compact (catlog22/Claude-Code-Workflow, 2.1k stars), Strategic Compact (affaan-m/ECC, 275k stars) and Strategic Compact (affaan-m/ECC, 275k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Memory Compaction?

Kiyoraka (a GitHub user) maintains it in Kiyoraka/Project-AI-MemoryCore, which has 374 GitHub stars. The repository holds 17 skills in this directory. The repository was last updated on July 29, 2026.

Source: Kiyoraka/Project-AI-MemoryCore on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.