memory-guardian

Cross-platform memory monitoring and cleanup skill for AI development environments

23 stars

Best use case

memory-guardian is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Cross-platform memory monitoring and cleanup skill for AI development environments

Teams using memory-guardian should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/memory-guardian/SKILL.md --create-dirs "https://raw.githubusercontent.com/wangjianjq/Skill/main/.agents/skills/memory-guardian/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/memory-guardian/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How memory-guardian Compares

Feature / Agentmemory-guardianStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Cross-platform memory monitoring and cleanup skill for AI development environments

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Memory Guardian Skill

> 🛡️ **内存守护者** - 跨平台内存监控与清理技能  
> **Memory Guardian** - Cross-platform memory monitoring and cleanup skill

## 功能描述 / Description

此技能用于监控系统物理内存使用情况,当内存使用率过高时向用户发出双语警告,
并提供安全的 Python/Node.js 进程清理功能。

This skill monitors system physical memory usage, alerts users with bilingual warnings
when memory usage is high, and provides safe Python/Node.js process cleanup.

## 使用场景 / Use Cases

- AI 开发工具(如 Antigravity)运行时内存监控
- 长时间开发会话中的内存管理
- 防止系统因内存耗尽而崩溃

## 命令 / Commands

### 检查内存状态

```bash
python .agents/skills/memory-guardian/scripts/monitor.py --check
```

### 启动后台监控

```bash
python .agents/skills/memory-guardian/scripts/monitor.py --daemon
```

### 手动清理进程

```bash
python .agents/skills/memory-guardian/scripts/cleanup.py
```

## 警告阈值 / Thresholds

| 级别 / Level | 内存使用率 / Usage | 行为 / Action |
|-------------|-------------------|---------------|
| 🟢 正常 / Normal | < 70% | 静默 / Silent |
| 🟡 注意 / Notice | 70-80% | 提示 / Notice |
| 🟠 警告 / Warning | 80-90% | 警告 / Warning |
| 🔴 严重 / Critical | ≥ 90% | 严重警告 / Critical |

## 配置 / Configuration

编辑 `config.yaml` 自定义阈值和行为:
Edit `config.yaml` to customize thresholds and behavior:

```yaml
thresholds:
  notice: 70
  warning: 80
  critical: 90
check_interval: 30  # seconds
```

## 依赖 / Dependencies

```
psutil>=5.9.0
plyer>=2.1.0
```

安装依赖 / Install dependencies:

```bash
pip install -r .agents/skills/memory-guardian/scripts/requirements.txt
```

## 注意事项 / Notes

- 仅监控物理内存,不考虑虚拟内存/Swap
- 仅清理 Python 和 Node.js 进程
- 清理操作需要用户确认,不会自动执行
- Only monitors physical RAM, ignores virtual memory/Swap
- Only cleans Python and Node.js processes
- Cleanup requires user confirmation, never automatic