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 Yu-Xiao-Sheng/codex-memory-trim --skill skillgit clone --depth 1 https://github.com/Yu-Xiao-Sheng/codex-memory-trimWrote 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/yu-xiao-sheng/codex-memory-trim/skill)<a href="https://agentmods.dev/skills/yu-xiao-sheng/codex-memory-trim/skill"><img src="https://agentmods.dev/badge/skills/yu-xiao-sheng/codex-memory-trim/skill.svg" alt="Measured on agentmods" height="20"></a>- NVIDIA SkillSpector warn
SkillSpector: 1 finding, up to medium
These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →
- medium Rogue Agent · line 23 Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.Fix: Remove any persistence mechanisms (cron jobs, startup scripts, state files). Skills should not maintain state across sessions without explicit user consent.
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.00108 | $0.00792 |
| Opus 5 | $0.00054 | $0.00396 |
| Sonnet 5 | $0.00022 | $0.00158 |
| Haiku 4.5 | $0.00011 | $0.00079 |
Grade A, and why
codex-memory-trim 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 8d 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.
What it actually says
Codex 全局记忆管理(trim / compress / add-global)
按用户需求只读取对应子技能文件执行,不要全量加载:
| 用户意图 | 读取 |
|---|---|
| 清理/去重/删除过期记忆 | subskills/trim.md |
| 压缩冗长表达、简化措辞 | subskills/compress.md |
| 添加自定义全局记忆/规则 | subskills/add-global.md |
共享事实(所有子技能依赖,不要重新推导)
- 分层:
sessions/*.jsonl(不可变原始证据)→raw_memories.md/rollout_summaries/(整理输入,由~/.codex/memories_1.sqlite表stage1_outputs重新渲染,手改会被还原)→MEMORY.md(检索层)/memory_summary.md(会话启动时注入的快照,文件头v1)。 usage_count(stage1_outputs 列)= 检索命中次数,是保留/删除的核心依据。~/.codex/memories/.git是整理基线:Phase 2 以 HEAD→工作区 diff 决定巩固内容。任何手工修改必须以 git 提交收尾,且提交前工作区若不干净、或git log顶部是新的 "Initialize Codex git baseline"(刚跑过自动整理),必须先读 diff 合并新内容,禁止覆盖。- 巡检脚本(只读):
python3 ~/.codex/skills/codex-memory-trim/scripts/collect.py。 - 记忆快照是会话启动时一次性注入;修改只对新会话(或
codex fork)生效。 - 备份模板:
mkdir -p ~/.codex/backups && TS=$(date +%Y%m%d-%H%M%S) && tar czf ~/.codex/backups/memories-before-trim-$TS.tar.gz -C ~/.codex memories && cp ~/.codex/memories_1.sqlite ~/.codex/backups/memories_1-before-trim-$TS.sqlite
共享红线
- 永不动
sessions/*.jsonl、extensions/ad_hoc/notes/既有文件内容(note 只能新增或按用户原话修订)、.git内部对象(正常 commit 除外)。 - 禁用
codex debug clear-memories(全量重置)。整理任务(collect.py中 consolidate_global)运行中不写文件。 - 动手前必备份,结束必提交:
cd ~/.codex/memories && git add -A && git -c user.name="Codex" -c user.email="[email protected]" commit -m "<一句话>",收尾git status --short必须为空。 - 本 skill 自身按效率优先执行:单次完成,不循环重复校验。
What ships with it
5 files 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.
- 8d ago First seen · 31 lines · 108 tokens per session scan A f71cd65737d4
codex-memory-trim is a skill published in the GitHub repository Yu-Xiao-Sheng/codex-memory-trim (103 stars, last pushed 14d ago), licensed MIT. It adds 108 tokens to every session and 792 once invoked, about $0.0005 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-30.
Other skills, from other repositories
kayba-ace
This skill ships learnfromtraces.py, a script that reads OpenClaw session transcripts, feeds them through the ACE learning pipeline, and writes an updated skillbook to disk.
mnemon
Persistent memory CLI for LLM agents. Store facts, recall past knowledge, link related memories, manage lifecycle.
mnemon
Persistent graph-based memory. Recall context before responding, remember insights after. Each group has private memory; global memory is read-only.
mnemon
Persistent memory CLI for LLM agents. Store facts, recall past knowledge, link related memories, manage lifecycle.
mnemon
Persistent memory CLI for LLM agents. Store facts, recall past knowledge, link related memories, manage lifecycle.
mnemon
Persistent memory for MiniMax Code. Recall durable context, store important facts and decisions, and link related memories with the mnemon CLI.