agentleFS
YehudaFrankelYehudaFrankel/clankbrain/.claude/skills/strategic-compact/SKILL.md

strategic-compact

Skill16 starsChanged 7 months agoMITView on GitHub

Evaluates whether context should be compacted and guides through safe compaction that preserves all memory. Prevents the context-limit mid-task problem. Triggers on \"should I compact?\" or \"compact now?\" or \"context getting long\" or when session is large.

68 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use configure-ecc, ralphinho-rfc-pipeline and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • royaluniondesign-sysSkill

    configure-ecc

    Interactive installer for Everything Claude Code — guides users through selecting and installing skills and rules to user-level or project-level directories, verifies paths, and optionally optimizes installed files.

    Also in 11 projects that use this

  • junimnjwSkill

    ralphinho-rfc-pipeline

    RFC-driven multi-agent DAG execution pattern with quality gates, merge queues, and work unit orchestration.

    Also in 11 projects that use this

  • InfopibeSkill

    everything-claude-code

    Also in 11 projects that use this

  • TironFoxSkill

    openclaw-persona-forge

    为 OpenClaw AI Agent 锻造完整的龙虾灵魂方案。根据用户偏好或随机抽卡, 输出身份定位、灵魂描述(SOUL.md)、角色化底线规则、名字和头像生图提示词。 如当前环境提供已审核的生图 skill,可自动生成统一风格头像图片。 当用户需要创建、设计或定制 OpenClaw 龙虾灵魂时使用。 不适用于:微调已有 SOUL.md、非 OpenClaw 平台的角色设计、纯工具型无性格 Agent。 触发词:龙虾灵魂、虾魂、OpenClaw 灵魂、养虾灵魂、龙虾角色、龙虾定位、 龙虾剧本杀角色、龙虾游戏角色、龙虾 NPC、龙虾性格、龙虾背景故事、 lobster soul、lobster character、抽卡、随机龙虾、龙虾 SOUL、gacha。

    Also in 5 projects that use this

  • royaluniondesign-sysSkill

    content-hash-cache-pattern

    Cache expensive file processing results using SHA-256 content hashes — path-independent, auto-invalidating, with service layer separation.

    Also in 15 projects that use this

  • loulanyueSkill

    nuxt4-patterns

    Nuxt 4 app patterns for hydration safety, performance, route rules, lazy loading, and SSR-safe data fetching with useFetch and useAsyncData.

    Also in 9 projects that use this

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 5 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 64 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Allowed Tools: Read, Bash

    line 12
  2. Distinctive:

    Before saving memory to your storage system

    line 28
  3. Very specific:

    Before running /learn to capture session patterns

    line 29
  4. Very specific:

    Run /learn to extract lessons to .claude/memory/lessons.md

    line 37
  5. Distinctive:

    Verify memory loaded by checking that project status was mentioned in first response

    line 48
  6. Distinctive:

    If memory didn't auto-load: run your session start command manually

    line 49
  7. Distinctive:

    After compact, full project context available within 1-2 messages

    line 57

“Common” is measured: kept by at least 6 in 10 of the 64 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Skill: strategic-compact

Trigger: "should I compact?" or "compact now?" or "context getting long" or when session is large

Description: Evaluates whether context should be compacted and guides through safe compaction that preserves all memory. Prevents the context-limit mid-task problem.

Allowed Tools: Read, Bash


When to Suggest Compaction

Suggest compacting when ANY of these are true:

  • Context usage reaches 40% — hard trigger, don't wait for slowdown
  • Session has 60+ back-and-forth messages
  • User asks about something already resolved earlier in session
  • Responses feel slow or repetitive
  • A major task just completed naturally (good break point)
  • Context limit warning appears

Never compact:

  • Mid-task — always finish current task first
  • Before saving memory to your storage system
  • Before running /learn to capture session patterns

Steps

Before Compacting:

  1. Capture session patterns:
    • Run /learn to extract lessons to .claude/memory/lessons.md
    • Confirm entries were written
  2. Save/push memory to your storage system (GitHub, local, etc.)
  3. Update STATUS.md or equivalent with current progress so it loads on resume
  4. Confirm with user: "Memory saved. Safe to compact — session will resume with full context."

After Compacting:

  • SessionStart hook should auto-load memory (if configured)
  • Verify memory loaded by checking that project status was mentioned in first response
  • If memory didn't auto-load: run your session start command manually

Notes

  • Compaction is safe when memory system is properly set up — that's what it's for
  • The PreCompact hook handles state preservation automatically if configured
  • After compact, full project context available within 1-2 messages
  • Better to compact proactively than to hit context limit mid-task

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.