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 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/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<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="Reviewed on agentmods" width="80" 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.1 | $0.00047 | $0.03844 |
| Opus 5.5 | $0.00019 | $0.01538 |
| Sonnet 5.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 1mo 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.
- 1mo 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 (3 stars, last pushed 3mo ago), licensed MIT. It adds 47 tokens to every session and 3,844 once invoked, about $0.0002 per session on Opus 5.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
Explain and apply the foundational LLM Wiki architecture and knowledge-management strategy. Use for setup, architecture, schema, or organization decisions; operational ingest/query/lint work uses dedicated skills.
wiki-lint
Audit wiki health: broken links, orphans, contradictions, stale content, lifecycle and tag issues. Use for maintenance or health checks. Default is report-only; use wiki-dedup for page-identity merges.
wiki-export
Export the Obsidian wiki graph to JSON, GraphML, Neo4j Cypher, Postgres/SQL, HTML, or OKF bundles. Use when transferring or visualizing wiki data in external tools; wiki-import handles the reverse direction.
wiki-status
Report wiki ingestion/completeness state, pending source delta, structural insights, or maintenance equilibrium. Use for remaining-work/status questions, hubs and bridges, or whether maintenance skills still have pending changes. wiki-digest summarizes learned knowledge instead.
wiki-query
Search and synthesize answers from the compiled Obsidian wiki, including cited and multi-hop answers. Use for questions about existing wiki knowledge or fast index-only lookups. Supports named-vault routing such as wiki-query @work; not for ingesting new sources.
cross-linker
Find and add missing cross-references between wiki pages. Use when pages are disconnected or after large ingestion. This modifies pages to add links; use wiki-lint for report-oriented structural auditing.