Agent-MemGC
⚡ High-performance linter, cache-layout optimizer, and garbage collector for AI agent instruction files (AGENTS.md, CLAUDE.md, .cursorrules) in Rust.
Install / Use
claude mcp add ronitgupta138 -- npx -y github:ronitgupta138/Agent-MemGCIf the server publishes to npm under a different name, use that package instead — check the repo README.
MCP Server
Model Context Protocol server
Quality Score
Category
AI & Machine LearningSupported Platforms
Our assessment of Agent-MemGC
Agent-MemGC scores 81/100 on our quality scale, 734th of 967 AI & Machine Learning skills we index.
Its MCP Server is 7.5 KB long, well organised into 17 sections with 9 code examples: a thorough specification that gives an agent plenty to work with.
It has 3 GitHub stars, so there is little community track record yet; judge it on its content.
Maintenance, license and trust
- The repository was last updated today, so Agent-MemGC is actively maintained.
- It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 92/100, with 1 caution from licensing, adoption, age or documentation. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands.
Automated pattern scan on 2026-10-19. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.
Agent-MemGC compared with similar skills
All 4 of these similar skills score higher than Agent-MemGC; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| Agent-MemGC (this skill)by ronitgupta138 | 81 | 3 | today | MCP Server |
| claude-memby thedotmack | 100 | 101.7k | today | CLAUDE.md |
| Agent-Reachby Panniantong | 100 | 99.2k | 3d ago | CLAUDE.md |
| Understand-Anythingby Egonex-AI | 100 | 86.9k | 6d ago | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 75.9k | 1d ago | CLAUDE.md |
Frequently asked questions
- How do I install Agent-MemGC?
- Run
claude mcp add ronitgupta138 -- npx -y github:ronitgupta138/Agent-MemGC. The install tabs above show the steps for each supported agent. - Which AI agents does Agent-MemGC work with?
- It is written for Claude Code, Claude Desktop, Cursor and OpenAI Codex, as a MCP Server file. Other agents that read the same format can often use it too.
- Is Agent-MemGC safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. It is MIT-licensed and scores 92/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is Agent-MemGC still maintained?
- The repository was last updated today, so Agent-MemGC is actively maintained.
Skill content
View source on GitHub███╗ ███╗ ███████╗ ███╗ ███╗ ██████╗ ██████╗
████╗ ████║ ██╔════╝ ████╗ ████║ ██╔════╝ ██╔════╝
██╔████╔██║ █████╗ ██╔████╔██║ ██████ ██║ ███╗ ██║
██║╚██╔╝██║ ██╔══╝ ██║╚██╔╝██║ ╚═════ ██║ ██║ ██║
██║ ╚═╝ ██║ ███████╗ ██║ ╚═╝ ██║ ╚██████╔╝ ╚██████╗
╚═╝ ╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝
The Linter, Cache-Layout Optimizer & Generational Garbage Collector for AI Agent Instructions
Audit, clean, and deduplicate your AI instructions. Detects dead file paths, resolves contradictory rules, and eliminates prompt-cache-busting bloat.
Built for CLAUDE.md (Claude Code), AGENTS.md (Hermes Agent / OpenCode), .cursorrules (Cursor), and long-term memory files.
🎯 The Problem: Instruction Rot & Cache Invalidation
As developers collaborate with AI coding agents, project instructions degrade over weeks into unmaintainable technical debt:
- Dead File Path References (30%+): Referenced paths (
src/utils/auth.ts,scripts/build.sh) were deleted or renamed weeks ago, triggering agent hallucination loops. - Semantic Contradictions: Conflicting rules added across separate turns ("Keep components synchronous" vs "Use async server actions everywhere").
- Prompt Cache Destruction: Putting volatile dates, timestamps, or session IDs at the top of instruction files breaks Anthropic and OpenAI KV-cache prefix hits, doubling agent API token bills.
- Context Bloat: Accumulates transient debugging notes and duplicated rules that waste 400–1,500 tokens on every turn.
agent-memgc delivers a compiler-grade static analysis engine in pure Rust that audits, fixes, and compacts agent instructions in < 15ms.
⚡ Architectural Blueprint
+-----------------------------------------------------------------------------------+
| Target Project: [AGENTS.md | CLAUDE.md | .cursorrules] |
+-----------------------------------------------------------------------------------+
|
| `agent-memgc check` / `agent-memgc fix`
v
+-----------------------------------------------------------------------------------+
| `agent-memgc` Systems Engine |
| |
| [ Rule MGC001: Dead Path Verification ] |
| - Scans all backticked paths (`src/utils/auth.ts`, `scripts/build.sh`) |
| - Cross-references against live Git index and workspace filesystem |
| - Flags: "Warning: `src/old_api.py` referenced on line 42 does not exist." |
| |
| [ Rule MGC002: Semantic Contradiction Detector ] |
| - Detects diametrically opposing directives (tabs vs spaces, sync vs async) |
| |
| [ Rule MGC003: Prompt-Cache Layout Optimizer ] |
| - Analyzes token ordering: static architectural facts vs volatile guidelines |
| - Relocates volatile timestamps and session IDs to preserve KV-cache prefixes |
| |
| [ Rule MGC004: Token Bloat & Duplication Pruning ] |
| - Deduplicates identical or near-verbatim instruction rules |
| - Computes exact token savings: "Saved ~420 tokens per request" |
+-----------------------------------------------------------------------------------+
|
v
+-----------------------------------------------------------------------------------+
| High-Contrast Terminal HUD & Auto-Fix |
| - Emits clean, contradiction-free, cache-optimized output |
+-----------------------------------------------------------------------------------+
🛠️ CLI Quickstart
1. Installation
Install directly via Cargo:
cargo install agent-memgc
2. Audit Instruction Files
# Check your project's AGENTS.md or CLAUDE.md
agent-memgc check AGENTS.md
# Output structured findings as JSON for CI/CD gates
agent-memgc check CLAUDE.md --json
3. Automatically Fix & Optimize
# Preview changes and estimated token savings without modifying disk
agent-memgc fix AGENTS.md --dry-run
# Automatically clean dead references, deduplicate rules, and optimize cache ordering
agent-memgc fix AGENTS.md
4. Health Grade & Quality Score
agent-memgc stats AGENTS.md
🔌 Model Context Protocol (MCP) Integration
agent-memgc runs as a native stdio Model Context Protocol (MCP) server for Claude Desktop, Cursor, and Hermes Agent.
Configuration (claude_desktop_config.json)
{
"mcpServers": {
"agent-memgc": {
"command": "agent-memgc",
"args": ["mcp"]
}
}
}
Available MCP Tools
lint_instructions: Audits instruction files for dead paths, contradictions, and cache invalidations.fix_instructions: Automatically rewrites files to prune dead references and optimize cache layout.lint_raw_prompt: Evaluates in-memory system prompts before dispatch to prevent conflicting constraints.
🧪 Verification & Benchmarks
Run the automated test suite:
cargo test
running 6 tests
test test_dead_path_detection ... ok
test test_semantic_contradiction_detection ... ok
test test_cache_layout_volatile_prefix_detection ... ok
test test_redundancy_and_duplicate_detection ... ok
test test_fixer_removes_dead_paths_and_duplicates ... ok
test test_mcp_tool_catalog ... ok
test result: ok. 6 passed; 0 failed; 0 ignored; finished in 0.04s
- Execution Latency:
< 12msacross 1,000 lines of Markdown instructions. - Average Token Reduction:
35% – 55%reduction in instruction token bloat.
📜 License
MIT License. Designed and engineered by Ronit Gupta.
Related Skills
claude-mem
101.7kPersistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More
Agent-Reach
99.2kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
Understand-Anything
86.9kGraphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.
headroom
75.9kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
