Universal Self-Reflective Memory System: Three-Tiered Local Memory Designed for AI Agents

Introduction

When using AI for coding or executing tasks over long periods, common problems arise: having to repeat the same corrections many times without the agent consolidating those preferences, or stuffing various “memories” into a single large file, causing the context to become increasingly saturated while failing to distinguish between facts and work habits. This article introduces the SkillHub community skill @user_6bedba2d/memorypor (package identifier self-improving, v2.1.0). It encodes corrections, self-reflection, and repetitive pattern observations into a set of local file protocols, managed through a three-tier storage system (hot/warm/cold), and defines how to integrate with AGENTS.md, CLAUDE.md, and HEARTBEAT.md, reusing the same SKILL.md workflow across various Agent runtimes.

What Is This

One-sentence positioning: A general-purpose self-reflection, self-criticism, and self-learning memory system, with data stored in the user’s home directory ~/self-improving/, and does not require an API Key (SkillHub tag requires_api_key=false).

Maintenance and publication: SkillHub coordinate @user_6bedba2d/memorypor, sourced from the community, category ai-agent, publisher user_6bedba2d. Page statistics (per SkillHub crawl): rating 100000, 1712 downloads, 0 installations.

It addresses continuous improvement at the “execution quality” level—preferences, corrections, and workflow patterns—and explicitly divides responsibilities with factual long-term memory (such as MEMORY.md, daily notes) in the documentation to avoid conflating the two.

Core Features

The following capabilities are sourced from the skill package’s SKILL.md and accompanying documentation, verified.

Three-Tier Storage (Hot / Warm / Cold)

The memory root directory defaults to ~/self-improving/. If the directory does not exist, initialize it per setup.md or scripts/setup.sh.

~/self-improving/
├── memory.md              # Hot layer: ≤200 lines (higher for high-frequency configs), always loaded
├── corrections.md         # Main log for corrections and lessons
├── corrections-pending.md # Overflow staging area (14-day observation window)
├── index.md               # Topic index
├── heartbeat-state.md     # Heartbeat maintenance state
├── config.json            # Capacity and tier configuration
├── projects/              # Warm layer: per project
├── domains/               # Warm layer: per domain
└── archive/               # Cold layer: archived
Tier Location Typical Limit Loading Strategy
Hot memory.md ≤200 lines (≤400 lines for high-frequency tier) Read before non-trivial tasks
Warm projects/, domains/ Single file ≤500 lines Match by context, limited number of files
Cold archive/ No hard limit Load only upon explicit query

Learning Signals and Promotion

The agent writes to corresponding files when identifying user corrections, explicit preferences, or repetitive patterns; one-time instructions, pure context qualifiers, and hypothetical discussions are not recorded. After the same pattern appears 3 times, the skill requires confirmation from the user; upon confirmation, the pattern is promoted to the hot layer memory.md, rather than silently writing permanent rules.

Self-reflection is recorded with fixed fields (Context / Reflection / Lesson) after important tasks end, entering corrections.md when necessary and participating in the count.

Maintenance and Operations

  • Heartbeat rules: heartbeat-rules.md, executable script scripts/heartbeat.sh.
  • Statistics: scripts/stats.sh; when the user says “memory statistics”, report layer counts per the SKILL.md template.
  • Export / Import: scripts/export.sh, scripts/import.sh.
  • Security boundaries: see boundaries.md, do not store sensitive information such as credentials; the skill declares no network requests and no reading of files outside ~/self-improving/.

Quick Mapping for User Conversations

The skill defines common commands in SKILL.md, e.g., “What did you learn?” → show recent entries from corrections.md; “Show my patterns” → hot layer memory.md; “Export memory” → package all files.

Installation and Activation

Install the Skill Package via SkillHub

The official page requires the agent to follow the SkillHub installation documentation and install the coordinate @user_6bedba2d/memorypor. The general process is as follows.

  1. Confirm that the skillhub CLI is installed (if not installed, execute the curl installation script per SkillHub installation documentation).

  2. Install the skill to the current Agent’s skills directory (must use --dir, otherwise the default ./skills/ may not be recognized):

skillhub install @user_6bedba2d/memorypor --dir <your Agent skills directory>

Common paths (from the same installation documentation):

  • Cursor: ~/.cursor/skills/
  • Claude Code: ~/.claude/skills/
  • Codex: ~/.codex/skills/ or .agents/skills/ under the project

After installation, restart or refresh the skill list as required by your client.

Initialize the Local Memory Directory

The skill logic depends on ~/self-improving/, independent of the skill package installation location. Execute in the extracted skill directory:

bash scripts/setup.sh --tier normal

The --tier options are low, normal (default), high, and heavy, corresponding to different presets for corrections.md, memory.md capacity, and maintenance cycles in setup.md.

The manual method is equivalent to creating directories and copying templates from templates/ to ~/self-improving/; see the package’s setup.md for details.

Workspace Integration

Per setup.md, append self-improvement instructions to AGENTS.md and CLAUDE.md, and align HEARTBEAT.md with heartbeat-rules.md, so periodic maintenance routes to heartbeat-state.md. The documentation emphasizes: when updating the Memory section of AGENTS.md, supplement rather than replace entire sections, to avoid overwriting existing continuity configurations.

Typical Usage

Record User Corrections and Promote

The scenario comes from the package’s README.md and SKILL.md descriptions, with reproducible logic as follows.

  1. User says: “No, that’s not right. Always use 2-space indentation.” → Write to corrections.md, count 1/3.

  2. User emphasizes the indentation rule again → count 2/3.

  3. Third similar correction → agent asks whether to solidify it as a permanent rule; after user confirmation, write to hot layer memory.md, and reference the source from the correction log per the process.

Self-Reflection After Task Completion

Recording format given by SKILL.md:

Context (CONTEXT): Building a Flutter UI
Reflection (REFLECTION): Spacing looked wrong, had to redo
Lesson (LESSON): Check visual spacing before showing to users

Load Memory Before Non-Trivial Tasks

setup.md suggests reading ~/self-improving/memory.md before task starts, then matching at most 3 domains/ files and one projects/<name>.md if necessary based on task context, avoiding loading all warm-layer files just for safety.

View Running Status

Execute in the skill directory:

bash scripts/stats.sh

Used to view hot-layer line usage, warm-layer project/domain file counts, and the health status summary output by the script (specific fields per the script).

Applicable Scenarios and Notes

Suitable for teams or individuals who need to maintain work methods and correction results across sessions: coding style, review preferences, repeated pitfall lessons, etc. Not suitable as the sole “fact base”—event and decision continuity should still reside in memory/YYYY-MM-DD.md, MEMORY.md, and other Layer 1 memories; the skill FAQ also clarifies the division of responsibilities between the two.

When using, note:

  • Do not infer rules from user silence; the skill lists “learning from silence” as a common trap.
  • Must obtain user confirmation before promoting to the hot layer, to avoid polluting the always-loaded memory.md.
  • The local directory ~/self-improving/ needs your own backup; export scripts can be used for migration.
  • The curl -sL <setup-url> in the README is a placeholder description; actual usage should be based on the package’s scripts/setup.sh or the path after SkillHub installation.

Conclusion

@user_6bedba2d/memorypor converges corrections, reflection, and pattern observations into the three-layer file structure of ~/self-improving/, using the SkillHub standard SKILL.md to constrain when the Agent reads, writes, and asks the user for confirmation. If you want to implement the same behavior in Cursor or other clients, you can install the skill package from the SkillHub page, then initialize the directory per setup.md and integrate with workspace documents.

  • SkillHub page: https://www.skillhub.cn/skills/user_6bedba2d/memorypor
  • Official coordinate entry: https://api.skillhub.cn/user_6bedba2d/memorypor
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye