Memory bloat audit
A drop-in self-improving memory + operations harness for AI agents (OpenClaw / Hermes / Claude Code / Codex). Layered memory, autonomous drift-fixing loop, evals, and one-command DR. Templates + scripts, no secrets.
npx -y skills add Walliiee/agent-harness --skill memory-bloat-auditAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Mon/Wed/Fri invariant check of the memory system. Catches stale daily files (compact didn't fire), freehand writes (memory-capture bypassed), stuck promote-queue entries (review backlog), and structural gaps (a workspace never migrated). Single rolled-up Drift incident on any violation.
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
3.8 KB, 888 tokens by cl100k_base, as published. Nobody here has run it
memory-bloat-audit — invariant enforcement for the memory system
Same compound pattern as [[cron-thin-trigger-skill-does-work]]'s cron-wrapper-audit but for the memory architecture. Catches drift between the documented memory-system design and reality.
When this runs
- Primary: cron.
ai.openclaw.memory-bloat-audit.plistfires Mon/Wed/Fri 22:45 — aftermemory-promoteat 22:00 andsession-cleanupeod at 22:30, so it sees the post-graduation state. - Wrapper: through
skill-wrapper --skill memory-bloat-audit --agent main --trigger cron.
Invariants (v1)
| Invariant | Test | Likely cause when it fires |
|---|---|---|
stale-daily | Daily file age > 8d, no <!-- mc:compacted --> marker, has bullet content | compact's safety guard skipped a file with content but no wiki pointers — needs retro-promote (or legacy backfill) |
freehand-write | Today's daily file has bullets but no <!-- mc:v1 --> marker | something bypassed memory-capture (defense-in-depth duplicate of memory-capture-audit) |
stuck-queue | promote-queue.md has ## YYYY-MM-DD entry > 14d old in the ## Queue section | the user hasn't reviewed the queue; backlog signal |
wiki-empty | a configured workspace's wiki/ has < 5 entries | a never-migrated workspace; sentinel for a missing one-shot migration |
Future invariants (not in v1): wiki size cap, one-fact-one-home jaccard check, QMD freshness lag.
What it does
- Walk all configured workspaces (see
${OPENCLAW_HOME}/config/agents.map) and apply each invariant. - Print a summary line:
[memory-bloat-audit] today=YYYY-MM-DD inv1=N inv2=N ... total=N. - List violations grouped by invariant.
- If violations > 0 AND
--emit-incident: emit a single rolled-up Drift incident (source=memory-bloat-audit,type=memory-invariant-violation,severity=med,key=memory-bloat-audit-YYYY-MM-DD) listing every violation with the recommended fix path.
Exit codes
0— clean1— one or more violations (incident emitted in cron mode)2— script-level error
Inputs
--emit-incident— emit Drift incident on violation. Default off; the plist passes it.--dry-run— skip the actualincident emitcall even with--emit-incident. Test-friendly.--verbose/-v— log each violation as encountered, not just in the final summary.
Files
- Script:
${OPENCLAW_HOME}/bin/memory-bloat-audit(Python, ~210 lines) - Plist:
$HOME/Library/LaunchAgents/ai.openclaw.memory-bloat-audit.plist - This spec:
${OPENCLAW_HOME}/skills/memory-bloat-audit/SKILL.md
Fix paths
The audit ships fix paths in its incident body so future-me doesn't have to reverse-engineer the resolution:
stale-daily→bin/memory-promote-sweep --window 14to harvest, thenbin/memory-compact-sweep --apply.freehand-write→ re-run today's writes throughmemory-capture; rewrite file with fingerprint stamps.stuck-queue→ reviewmemory/promote-queue.md; follow the in-file promote/drop/defer instructions.wiki-empty→ one-shot migration viamemory-importtargeting the affected workspace.
Related
- [[memory-promote]], [[memory-compact]], [[memory-capture]] — the skills whose work this audit verifies.
incident-emit— Drift pipeline receiver of violations.cron-wrapper-audit— sibling invariant enforcer for the cron pattern.