compress

compress is a command for coding agents from jasonhnd/life_OS. It costs 21 tokens per session (506 once invoked), scanned A, original, Apache-2.0.

A command for shortening a long conversation by archiving older, lower-value messages while keeping recent messages and important decisions. It saves the archived material so it can be recovered.

In plain words
What is it for?
Use it when a conversation has become too long, optionally focusing the retained material on a topic or keyword.
Why use it?
It reduces the amount of conversation context that must be carried forward. It helps retain decisions, plans, and other important information while setting aside exploratory discussion.

Command

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.

agentmods
npx agentmods add commands/jasonhnd/life_os/compress
Clone the repo
git clone --depth 1 https://github.com/jasonhnd/life_OS

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 compress

README.md
[![agentmods](https://agentmods.dev/badge/commands/jasonhnd/life_os/compress.svg)](https://agentmods.dev/commands/jasonhnd/life_os/compress)
Your own site
<a href="https://agentmods.dev/commands/jasonhnd/life_os/compress"><img src="https://agentmods.dev/badge/commands/jasonhnd/life_os/compress.svg" alt="Measured on agentmods" height="20"></a>
Per session 21 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 506 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00021 $0.00506
Opus 5 $0.00010 $0.00253
Sonnet 5 $0.00004 $0.00101
Haiku 4.5 $0.00002 $0.00051

Measured 4d ago against content hash c723c2b55653, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

compress scanned grade A with 0 findings 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 4d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

docs/history/v1.10-command-surfaces/scripts/commands/compress.md · 47 lines

What it actually says

/compress · 上下文压缩

⚠️ Backup mode (v1.7.3.1). 主要路径是自动触发:context > 70% 或 user 说"太长/压缩"时 ROUTER 会主动建议+执行。这个命令是给"我想精确控制"或"自动 detection 漏了"的备份。详见 hosts/CLAUDE.md → Auto-Trigger Rules → Compress auto-suggest。

User invoked: /compress $ARGUMENTS

你要做的(按顺序)

  1. 盘点当前 conversation context 用量:估算总 turn 数 + 大致 token 数。

  2. 识别可归档内容

    • 早于 last 5 turn 的 debug / 探索性消息
    • $ARGUMENTS (focus 关键词) 无关的部分
    • 已被后续 turn 取代或修正的内容
  3. 必须保留

    • last 5 turn(无条件)
    • 任何提到 SOUL / DREAM / 决策 / 长期规划的 turn
    • $ARGUMENTS focus 直接相关的所有 turn
  4. 写 compression 档案

    • 创建 meta/compression/<sid>-compress-<timestamp>.md
    • 内容:被归档的 turns 摘要(每条 1-2 句)+ 完整原文(可恢复)
  5. 报告给用户(必含):

    📦 压缩完成
      原 turn 数:N
      保留:M
      归档到:meta/compression/<file>
      释放估计:~X tokens
      保留的关键决策:[列表]
    

Anti-pattern

  • 不要假装压缩了 — 必须真写归档文件
  • 不要丢决策记录 — SOUL / DREAM / 规划相关的 turn 永远保留
  • 不要没有 focus 时全压 — 默认保守保留 last 10 turn
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. 4d ago First seen · 47 lines · 21 tokens per session scan A c723c2b55653

Subscribe to this mod's changes

compress is a command published in the GitHub repository jasonhnd/life_OS (5 stars, last pushed 27d ago), licensed Apache-2.0. It adds 21 tokens to every session and 506 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.