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.
npx agentmods add skills/humanerd-drew/opencode-drewgent/memory-md-cleanupnpx skills add humanerd-drew/opencode-drewgent --skill memory-md-cleanupgit clone --depth 1 https://github.com/humanerd-drew/opencode-drewgentWrote 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.
[](https://agentmods.dev/skills/humanerd-drew/opencode-drewgent/memory-md-cleanup)<a href="https://agentmods.dev/skills/humanerd-drew/opencode-drewgent/memory-md-cleanup"><img src="https://agentmods.dev/badge/skills/humanerd-drew/opencode-drewgent/memory-md-cleanup.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00047 | $0.03844 |
| Opus 5 | $0.00023 | $0.01922 |
| Sonnet 5 | $0.00009 | $0.00769 |
| Haiku 4.5 | $0.00005 | $0.00384 |
Grade A, and why
memory-md-cleanup 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 3d 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.
How it starts
The opening of the file, as written. The whole thing — 209 lines — stays where its author put it; the contents beside it link to each section on GitHub.
MEMORY.md Cleanup
~/.{{AGENT_NAME_LOWER}}/P2-hippocampus/memories/MEMORY.md hits 8K char cap when auto-accumulated + user entries pile up. Manual cleanup needed — auto-cleanup is NOT implemented (growth-2026.md "분기별 메모리 정리 자동화" is TODO).
Trigger
- System prompt shows
[98% — 7,901/8,000 chars]or similar near-cap status - User says "메모리 정리" / "MEMORY.md 정리"
Steps
1. Read current state
content = open('~/.{{AGENT_NAME_LOWER}}/P2-hippocampus/memories/MEMORY.md').read()
print(f'chars: {len(content)}, cap usage: {len(content)/8000*100:.1f}%, entries (§): {content.count(chr(167))}')
2. Check for concurrent writes
MEMORY.md.lock mtime 5분+ stale이 아니면 wait. 그 외 진행.
3. Classify entries
Cut (resolved/one-time):
- "follow-up" / "patched" / "fixed" / "완료" / "✅" 단어 등장
- 다른 entry가 미참조하는 historical event
- system prompt active docs (SELF 모델, KANBAN_INDEX, architecture-dataflow)에서 미참조
Keep (operational/active):
- system prompt active docs에서 참조되는 facts
- port / path / plist label / version / token / CF account 같은 operasional numbers
- 다음 session에 적용될 trigger pattern (self-critique framing, cron infra, mock patterns)
- ongoing incident 핵심 findings (resolve되기 전)
4. Present options via mcp_clarify
H1: aggressive — cut all candidates (0 risk, max headroom) H2: conservative — cut 1~2 largest만 H3: increase cap (8000→12000, config edit, 매 session inject 비용 증가)
User timeout → best judgement = H1. 0 risk, 가장 많은 buffer, follow-up으로 추가 trim 가능.
5. Write new file with mcp_write_file
- Line 1:
[YYYY-MM-DD cleanup: H{N}, removed {N} entries (~{chars} saved). Active entries preserved.] - Following: original format — entry line +
§on its own line as separator
6. Fix stale cross-references
제거된 entry를 참조하는 warning이 다른 entry에 남아있으면 patch로 정리. 예: "⚠️ bot.py의 M2.7 호출은 6/1 follow-up patch로 M3 통일됨" — 제거된 follow-up entry를 가리키던 warning을 resolved 상태로 update.
7. Verify
content = open('~/.{{AGENT_NAME_LOWER}}/P2-hippocampus/memories/MEMORY.md').read()
assert len(content) < 8000, f'still over cap: {len(content)}'
print(f'OK: {len(content)} chars ({len(content)/8000*100:.1f}% of 8K cap)')
What ships with it
1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
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.
- 3d ago First seen · 209 lines · 47 tokens per session scan A 93a4ee87ba59
memory-md-cleanup is a skill published in the GitHub repository humanerd-drew/opencode-drewgent (2 stars, last pushed 1mo ago), licensed MIT. It adds 47 tokens to every session and 3,844 once invoked, about $0.0002 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.
Other skills, from other repositories
llm-wiki
The foundational knowledge distillation pattern for building and maintaining an AI-powered Obsidian wiki. Based on Andrej Karpathy's LLM Wiki architecture. Use this skill whenever the user wants to understand the wiki pattern, set up a new knowledge base, or needs guidance on the three-layer architecture (raw sources…
wiki-lint
Audit and maintain the health of the Obsidian wiki. Use this skill when the user wants to check their wiki for issues, find orphaned pages, detect contradictions, identify stale content, fix broken wikilinks, or perform general maintenance on their knowledge base. Also triggers on "clean up the wiki", "what needs…
wiki-query
Answer questions by searching the compiled Obsidian wiki. Use this skill when the user asks a question about their knowledge base, wants to find information across their wiki, asks "what do I know about X", "find everything related to Y", or wants synthesized answers with citations from their wiki pages. Also use when…
wiki-update
Sync the current project's knowledge into the Obsidian wiki. Use this skill from any project when the user says "update wiki", "sync to wiki", "save this to my wiki", "update obsidian", or wants to distill what they've been working on into their knowledge base. This is the cross-project skill that lets you push…
hermes-history-ingest
Ingest Hermes agent history into the Obsidian wiki. Use this skill when the user wants to mine their past Hermes sessions for knowledge, import their /.hermes folder, extract insights from previous Hermes conversations, or says things like "process my Hermes history", "add my Hermes memories to the wiki", "ingest…
memory-bridge
Browse and compare wiki knowledge by which AI tool originally produced it. Use this skill when the user says "/memory-bridge", "browse codex memory", "what did codex know about X", "show me claude knowledge", "cross-tool memory", "what does hermes know that claude doesn't", "show me knowledge from ", "compare my AI…