← 返回
未分类

Memory Tiers

Tiered memory management for AI agents — LRU cache for context. Hot/warm/cold tiers with automatic promotion, demotion, and access tracking.
AI代理层级记忆管理 — 采用LRU缓存管理上下文。热、温、冷三层,支持自动升级、降级和访问追踪。
chrisrobison
未分类 clawhub v0.1.0 1 版本 99333.3 Key: 无需
★ 0
Stars
📥 149
下载
💾 0
安装
1
版本
#latest

概述

Memory Tiers

A tiered memory system for AI agents. Like CPU cache hierarchy, but for your context window.

Architecture

MEMORY.md (Tier 1 — Hot)          ← Always loaded, ~100 lines max
  ↕ promote (accessed) / demote (stale 7+ days)
memory/tier2-recent.md (Warm)     ← On-demand, last 30 days
  ↕ promote / demote (stale 30+ days)
memory/tier3-archive.md (Cold)    ← Search only, deep history
  ↕
memory/YYYY-MM-DD.md (Raw)        ← Immutable daily logs

Scripts

All scripts are in scripts/ relative to this SKILL.md.

Track Memory Access

Scans session transcripts for memory file reads/writes/searches. Run regularly.

node scripts/track.js                    # scan last 24h
node scripts/track.js --since 72         # scan last 72 hours

Output: Updates state/access-log.json with per-file and per-section access data.

Run Maintenance

Promotes/demotes sections between tiers based on access patterns.

node scripts/maintain.js --dry-run       # preview changes
node scripts/maintain.js                 # apply changes
node scripts/maintain.js --demote-days-t1 5   # custom T1 demotion threshold

Rules:

  • Tier 1 sections not accessed in 7 days → demote to Tier 2
  • Tier 2 sections not accessed in 30 days → demote to Tier 3
  • Tier 2/3 sections accessed in last 24h → promote to Tier 1

Manual Promote/Demote

Move a specific section between tiers.

node scripts/promote.js --list                           # show all sections
node scripts/promote.js --section "LARC" --from 3 --to 1  # promote
node scripts/promote.js --section "TextWeb" --from 1 --to 2 # demote

Health Report

Show current tier sizes, staleness, and recommendations.

node scripts/report.js                   # pretty-printed
node scripts/report.js --json            # machine-readable

Heartbeat Integration

Add to your heartbeat routine (every few hours):

## Memory Maintenance
1. Run `node <skill_dir>/scripts/track.js` to update access tracking
2. Run `node <skill_dir>/scripts/maintain.js --dry-run` to check for needed changes
3. If changes look good, run without --dry-run
4. Run `node <skill_dir>/scripts/report.js` to verify health

State Files

  • state/access-log.json — Per-file and per-section access timestamps and counts
  • state/maintenance-log.json — History of maintenance actions taken

Tier Rules

RuleThresholdAction
-------------------------
T1 staleNot accessed 7 daysDemote to T2
T2 staleNot accessed 30 daysDemote to T3
T2/T3 accessedAccessed in last 24hPromote to T1
T1 over limit>100 linesDemote lowest-access sections
Daily logNever modified after day endsSource of truth

File Conventions

Tier files should have these headers:

# MEMORY.md — Working Memory (Tier 1)
<!-- last_maintained: YYYY-MM-DD -->
<!-- tier: 1 — hot context -->

Sections use ## or ### headers. The maintenance scripts parse these to identify movable units.

The ## Index → Deeper Tiers section in MEMORY.md should always be last — it provides pointers to content in lower tiers.

版本历史

共 1 个版本

  • v0.1.0 当前
    2026-05-12 06:13 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-intelligence

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,363 📥 319,046
security-compliance

Skill Vetter

spclaudehome
AI智能体技能安全预审工具。安装ClawdHub、GitHub等来源技能前,检查风险信号、权限范围及可疑模式。
★ 1,219 📥 266,855
ai-intelligence

self-improving agent

pskoett
捕获经验教训、错误和纠正,以实现持续改进。使用时机:(1)命令或操作意外失败;(2)用户纠正……
★ 4,062 📥 799,937