memory-guardian

AI自我优化的记忆skills

5rbdmak7f-alt
開発者 5rbdmak7f-alt
生産性 · MulanPSL-2.0 · Python · 更新日: 3 months ago
3
スター
0
Forks
コミュニティ
BBB
安全性:
優秀
A
品質:

name: memory-guardian description: > Agent workspace memory lifecycle management via 10 MCP tools + batch maintenance. Manages MEMORY.md, memory/ directory, meta.json, quality gate, Bayesian decay, case lifecycle, and compaction. Use when: (1) Installing or configuring memory-guardian, (2) Running scheduled or on-demand memory maintenance, (3) Diagnosing memory bloat, quality anomalies, or case invalidation, (4) Writing, querying, or archiving memories, (5) Reviewing or retiring judgment cases, (6) Checking quality gate state or L3 confirmations. Triggers on: memory_status, memory_decay, memory_ingest, memory_compact, quality_check, case_query, case_review, run_batch, memory_sync, meta.json, MEMORY.md, memory-guardian.

memory-guardian

Workspace memory lifecycle system. Dual-layer Bayesian decay + four-state quality gate + case lifecycle + compaction.

Design Principles

  1. Check status before any writememory_status first
  2. Dry-run before apply — preview destructive operations
  3. Default behavior > toggles — workspace defaults from MG_WORKSPACE
  4. Write ordering > content correctness — sequence matters
  5. Observable but not brittle — signal degradation → WARNING, not crash
  6. Single source of truth — all defaults in mg_schema/meta_defaults.py

MCP Tools (10)

workspace defaults from MG_WORKSPACE env var; only non-default params listed.

Query

Write

Audit

Batch

Workflows

New Installation

  1. memory_status → confirm references.complete: true
  2. If false, create missing files per the missing list, re-verify
  3. Create cron task (see signal-loop.md for cron template)
  4. Manually trigger once to verify

Daily Maintenance (cron)

run_batch(skip_compact=true) runs automatically. Includes:

Diagnostics

D1: Memory bloatmemory_compact(dry_run=true) → apply if needed → see compaction.md

D2: Quality anomalyquality_check(layer="all") → see error_recovery.md

D3: Case invalidationcase_query(filter="stale")case_review(action="retire"|"active"|"unfreeze") → see case-management.md

Signal Loop (v0.4.6)

Dual-layer access signals feed the decay engine:

Agent must append to access_log.jsonl after each memory_get call. See signal-loop.md for integration code.

References

Load on demand per scenario:

CLI Fallback

When MCP unavailable, CLI path relative to skill dir:

python3 scripts/memory_guardian.py <command> [--workspace <path>]

Commands: status, ingest, bootstrap, snapshot, run, violations, migrate

🔓 サインインしてさらに解放
GitHub でサインイン