---
name: memory-shrink
description: 当 context 使用率超过 75% 时自动存档记忆，释放空间。适用于：用户要求"记忆瘦身"、"清理 context"、或收到 heartbeat 告警时触发。
---

# Memory Shrink

当 context 使用率超过阈值时自动存档，释放空间。

## 触发条件

- 收到 heartbeat 告警
- 用户明确要求"记忆瘦身"、"清理 context"
- session_status 显示 context > 75%

## 执行流程

### 1. 检查 context 使用率

运行 `session_status` 获取 context 比例。

### 2. 决策

| 使用率 | 动作 |
|--------|------|
| > 90% | 强制存档，跳过所有其他操作 |
| 75-90% | 存档非必要记忆，继续工作 |
| < 75% | 正常工作 |

### 3. 存档操作

调用 `memory_search` 查找可删除内容，然后更新 memory 文件。

## 保留规则

以下内容**必须保留**：
- 未完成任务的进度
- 团队成员当前状态
- 正在进行中的讨论

## 删除规则

以下内容**可删除**：
- 已完成任务的详细记录（保留摘要即可）
- 过时的会话历史
- 已过期/取消的任务

## 脚本

参考 `scripts/shrink.sh` 执行存档。

## 输出

完成后汇报：
- 存档了多少内容
- 当前 context 使用率
- 是否有待处理任务


---
Source attribution: modbender
Original project: https://github.com/modbender/skill-library-mcp/blob/d9c8fe903b5b4e82237dbe8d0df8567783022e18/data/memory-shrink/SKILL.md
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Mega AI Hub.

## Upstream license notice

MIT License

Copyright (c) 2025 skill-library-mcp contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



# Mega AI Hub resource metadata

Creator / publisher: modbender
Original project: https://github.com/modbender/skill-library-mcp/blob/d9c8fe903b5b4e82237dbe8d0df8567783022e18/data/memory-shrink/SKILL.md
Attribution basis: Source repository record

Fields of work: Development & Engineering, Sales, Customer Support
Roles: Customer Success Manager, DevOps / SRE, Technical Support
Specialties: Backend
Tools: Mcp
Country applicability: Country not specified
Classification basis: Source catalog labels
Instruction SHA-256: 6c10bfe36ad606359f0c5d6c7d39daab918b08c80b4ddac3f3da6fdae7efc316
