Memory

Memory Audit — DDIA+DDD System Health Check

Try it

Audit and repair agent memory systems using DDIA reliability + DDD bounded-context analysis. Triggers when memory feels stale, bloated, inconsistent, or duri...

What it does

Audit and repair agent memory systems using DDIA reliability + DDD bounded-context analysis. Triggers when memory feels stale, bloated, inconsistent, or during periodic health checks.

The skill document

Memory Audit — 记忆系统架构审计与修复

当记忆系统出现膨胀、不一致、查询质量差、架构耦合等问题时,用软件工程视角系统化诊断和修复。

When to Trigger

  • MEMORY.md 或 AGENTS.md 超过 500 行 / 15KB
  • 搜索返回重复结果或无关结果
  • 日志文件缺少 Front Matter
  • 项目状态与实际脱节
  • 定期健康检查(建议每月一次)

Core Framework

Dual lens:

  1. DDIA (Designing Data-Intensive Applications) — 可靠性/可扩展性/可维护性
  2. DDD (Domain-Driven Design) — 有界上下文/聚合根/防腐层

Five problem domains:

核心问题典型症状
Schema无Schema约束,自由文本退化字段不一致,无法程序化解析
Consistency多存储间状态脱节MEMORY.md写了旧模型,实际已换
Query无去重、无联合搜索搜出重复,漏掉归档
Lifecycle无GC、无过期标记历史项目堆积,噪音淹没信号
Coupling配置/运维/理论混杂改一处牵一片,token浪费

Workflow

Phase 0: Scope & Baseline

python3 scripts/audit_baseline.py --workspace . --report /tmp/audit-baseline.json

Collect: file counts, line counts, Front Matter coverage, duplication rate, staleness score.

Phase 1: Diagnosis (5 domains × N checks)

python3 scripts/audit_diagnose.py --baseline /tmp/audit-baseline.json --output /tmp/audit-report.md

Each finding → priority bucket (P0-P4):

  • P0 data integrity (broken/dangerous)
  • P1 consistency (drift/misalignment)
  • P2 query capability (search quality)
  • P3 architecture decoupling (coupling/bloat)
  • P4 knowledge systematization (advanced)

Phase 2: Execute Fixes (by priority)

Work P0 → P4 sequentially. Each fix:

  1. Write script/tool
  2. Execute
  3. Verify (must pass before next)
  4. Record trace

Phase 3: Validate

python3 scripts/audit_validate.py --report /tmp/audit-report.md

Phase 4: Handoff

  • Update IMPLEMENT.md with completed items
  • Update MEMORY.md if project status changed
  • Log to daily memory
  • Record trace via trace_logger

Key Scripts

ScriptSourcePurpose
audit_baseline.pythis skillCollect workspace metrics
audit_diagnose.pythis skillGenerate prioritized findings
audit_validate.pythis skillVerify fixes passed
memory_gc.pyworkspaceSemi-auto GC scan → suggestions
staleness_check.pyworkspaceDetect stale entries (>60d)
unified_search.pyworkspaceCross-store federated search
knowledge_graph.pyworkspaceNode/edge graph from memory
gen_references_index.pyworkspaceAuto-generate INDEX.md

Adapting to Other Workspaces

This skill assumes an OpenClaw-style workspace:

workspace/
  MEMORY.md          # long-term semantic memory
  AGENTS.md          # operational handbook
  SOUL.md            # persona/behavior rules
  TOOLS.md           # ops reference
  IMPLEMENT.md       # task tracker
  memory/*.md        # daily episodic logs
  references/*.md    # archived source materials
  traces/            # agent execution traces
  docs/              # migrated detailed docs

For other layouts, adapt audit_baseline.py path constants.

See Also

  • references/audit-checklist.md — Full 15-item checklist
  • references/ddia-ddd-mapping.md — Theory mapping
  • assets/audit-report-template.md — Report template

Related skills

Audit and maintain OpenClaw-style long-term memory. Use for MEMORY.md cleanup, daily-note digestion, duplicate detection, stale-memory review, and promoting...

17 installs

Audit a principal AI agent or coordinator bot: review memory, learnings, recent errors, installed skills, operational risks, delegation posture, and propose...

9 installs

Audit a design system for consistency, coverage, and quality. Use when asked to audit a design system, review a component library, assess design token covera...

Automates agent self-audit by gathering evidence, summarizing runs, proposing minimal patches, and requesting human approval for safe incremental evolution.

11 installs1 stars

Audit agentic framework directories, prompt systems, skills, planner files, workflow guidance, memory-like files, configs, and agent-facing documentation for...

2 installs

Use at the end of any session that discovered durable knowledge (architecture decisions, root causes, setup gotchas, workflow changes, security findings, reu...

4 installs