strategic-compact

strategic-compact is a skill for Claude Code from Luohaothu/everything-codex. It costs 37 tokens per session (567 once invoked), scanned B, original, MIT.

A helper that recommends when to shorten the conversation context during long coding sessions. It counts tool calls and gives reminders at configured points, while leaving the decision to the developer.

In plain words
What is it for?
Use it during long, multi-step coding tasks, especially after research, debugging, or completing a milestone.
Why use it?
Long sessions can make useful details harder to track or cause automatic context shortening at an awkward moment. Planned reminders help preserve the right information between work stages.

Skill for Claude Code

Written for Claude Code: PreToolUse hook event. Also seen: reads .claude/ paths.

Good fit Use it during long, multi-step coding tasks, especially after research, debugging, or completing a milestone.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/luohaothu/everything-codex/strategic-compact
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.

Any agent
npx skills add Luohaothu/everything-codex --skill strategic-compact
Clone the repo
git clone --depth 1 https://github.com/Luohaothu/everything-codex

Made for: Claude Code.

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 strategic-compact

README.md
[![agentmods](https://agentmods.dev/badge/skills/luohaothu/everything-codex/strategic-compact/github.svg)](https://agentmods.dev/skills/luohaothu/everything-codex/strategic-compact)
Your own site
<a href="https://agentmods.dev/skills/luohaothu/everything-codex/strategic-compact"><img src="https://agentmods.dev/badge/skills/luohaothu/everything-codex/strategic-compact/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for strategic-compact

Your own site · 80×15
<a href="https://agentmods.dev/skills/luohaothu/everything-codex/strategic-compact"><img src="https://agentmods.dev/badge/skills/luohaothu/everything-codex/strategic-compact.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 37 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 567 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00037 $0.00567
Opus 5.5 $0.00015 $0.00227
Sonnet 5.5 $0.00007 $0.00113
Haiku 4.5 $0.00004 $0.00057

Measured 1mo ago against content hash a78a5c309906, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade B, and why

strategic-compact scanned grade B with 1 finding 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 1mo ago.

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.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

添加到你的 `~/.claude/settings.json`:
docs/zh-CN/skills/strategic-compact/SKILL.md · 67 lines

What it actually says

战略精简技能

建议在你的工作流程中的战略节点手动执行 /compact,而不是依赖任意的自动精简。

为何采用战略精简?

自动精简会在任意时间点触发:

  • 通常在任务中途,丢失重要上下文
  • 无法感知逻辑任务边界
  • 可能中断复杂的多步骤操作

在逻辑边界进行战略精简:

  • 探索之后,执行之前 - 精简研究上下文,保留实施计划
  • 完成一个里程碑之后 - 为下一阶段全新开始
  • 主要上下文切换之前 - 在不同任务开始前清理探索上下文

工作原理

suggest-compact.sh 脚本在 PreToolUse(编辑/写入)时运行并执行:

  1. 追踪工具调用 - 计算会话中的工具调用次数
  2. 阈值检测 - 在可配置的阈值(默认:50 次调用)处建议精简
  3. 定期提醒 - 在达到阈值后,每 25 次调用提醒一次

钩子设置

添加到你的 ~/.claude/settings.json:

{
  "hooks": {
    "PreToolUse": [{
      "matcher": "tool == \"Edit\" || tool == \"Write\"",
      "hooks": [{
        "type": "command",
        "command": "~/.claude/skills/strategic-compact/suggest-compact.sh"
      }]
    }]
  }
}

配置

环境变量:

  • COMPACT_THRESHOLD - 首次建议前的工具调用次数(默认:50)

最佳实践

  1. 规划后精简 - 一旦计划确定,精简以全新开始
  2. 调试后精简 - 在继续之前,清理错误解决上下文
  3. 不要在实施中途精简 - 保留相关更改的上下文
  4. 阅读建议 - 钩子告诉你何时,由你决定是否

相关

  • 长篇指南 - 令牌优化部分
  • 内存持久化钩子 - 用于在精简后保留的状态
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. 1mo ago First seen · 67 lines · 37 tokens per session scan B a78a5c309906

Subscribe to this mod's changes

strategic-compact is a skill published in the GitHub repository Luohaothu/everything-codex (25 stars, last pushed 2mo ago), licensed MIT. It adds 37 tokens to every session and 567 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it B with 1 finding (reads agent configuration directories). 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

orbit-notion

Open Orbit briefing skill — selected by the Orbit pipeline when Notion is the user's only connected connector, or when the user explicitly scopes their daily digest to Notion. Pulls the past 24 hours of document edits, comments, mentions, and database row changes from the user's authenticated Notion connection and…

nexu-io/open-design · 117 tokens

agentmail

Use your assigned AgentMail inbox to read email tasks, explicitly send or reply, and check delivery. Provided automatically by your inbox assignment.

paperclipai/paperclip · 30 tokens

rowboat-spaces

How to work as a member of Rowboat Spaces, the team chat where people and agents work together. Load it once per session, before acting on any request that reaches you from Rowboat; it covers your setup, mentions and hand-offs, the tools, and files.

rowboatlabs/rowboat · 60 tokens

feishu

Work with Feishu or Lark bots, docs, sheets, bitables, approval flows, and OpenAPI/MCP setup without hardcoding credentials.

Hmbown/CodeWhale · 33 tokens

pinchtab-mcp

Use this skill when a task requires browser automation through PinchTab's MCP server connected to a remote browser instance. Covers navigation, element interaction, data extraction, form filling, multi-step flows, and session management via MCP tools.

pinchtab/pinchtab · 52 tokens

Cortex

Operate Cortex, the LifeOS memory system — the typed Knowledge Archive (People, Companies, Ideas, Research with typed related: links) plus recall of prior work sessions, ISAs, and conversations. Search, add, harvest, develop, ingest, distill, graph-navigate, recall. USE WHEN cortex, knowledge, knowledge base, search…

danielmiessler/LifeOS · 196 tokens