← Browse

@kimyx0207/claude-memory-3layer

A

A cross-session memory system that automatically extracts, stores, and loads knowledge across Claude Code sessions.

skillclaude

Install

agr install @kimyx0207/claude-memory-3layer --target claude

Writes 7 files into .claude/skills/, pinned to git-3e425425.

  • .claude/skills/claude-memory-3layer/.gitignore
  • .claude/skills/claude-memory-3layer/LICENSE
  • .claude/skills/claude-memory-3layer/README.md
  • .claude/skills/claude-memory-3layer/README_CN.md
  • .claude/skills/claude-memory-3layer/SKILL.md
  • .claude/skills/claude-memory-3layer/install.ps1
  • .claude/skills/claude-memory-3layer/install.sh

Document

Three-Layer Memory System for Claude Code

A cross-session memory system that automatically extracts, stores, and loads knowledge across Claude Code sessions.

Metadata

name: claude-memory-3layer
version: 1.0.0
description: Three-layer memory system — knowledge graph + daily notes + tacit knowledge
author: LaojinAI
license: MIT
min_claude_code_version: 2.1.0
context: fork

Trigger Words

  • memory system
  • three layer memory
  • 三层记忆
  • cross session memory
  • 跨会话记忆

What It Does

The Problem

Claude Code forgets everything between sessions. Official CLAUDE.md requires manual maintenance. Official auto-memory (v2.1.59+) brilliantly solves knowledge discovery, but lacks lifecycle management, git tracking, and team sharing.

The Solution

A management layer that complements official auto-memory. Three specialized memory layers, each serving a different purpose:

LayerFormatPurposeAuto-loaded
Layer 1JSONKnowledge graph with lifecycle management✅ Last 10 active
Layer 2MarkdownDaily notes (what happened today)✅ Last 3 days
Layer 3MarkdownTacit knowledge (hard-won experience)✅ Full file

Key Features

  • Zero dependencies — Pure Python stdlib, works everywhere
  • Auto-extract — PostToolUse hook captures knowledge automatically
  • Auto-load — SessionStart hook injects context seamlessly
  • Lifecycle managementstatus field (active/superseded) keeps knowledge fresh
  • Git-trackable — All files in project directory, not hidden in ~/.claude/
  • Token-efficient — ~1500 tokens budget, <1% of 200K context window
  • Compatible — Works alongside official auto-memory (v2.1.59+)

Installation

# One-line install (Unix/macOS)
curl -fsSL https://raw.githubusercontent.com/KimYx0207/claude-memory-3layer/main/install.sh | bash

# Windows PowerShell
irm https://raw.githubusercontent.com/KimYx0207/claude-memory-3layer/main/install.ps1 | iex

# Manual install
git clone https://github.com/KimYx0207/claude-memory-3layer.git
cd claude-memory-3layer && ./install.sh

Commands

CommandDescription
/memory-reviewReview recent memories, extract patterns, suggest permanent rules
/memory-statusShow memory system status and statistics

File Structure

.claude/
├── hooks/
│   ├── memory_loader.py      # SessionStart: load three layers
│   ├── memory_extractor.py   # PostToolUse: extract knowledge
│   ├── session_state.py      # Session lifecycle management
│   └── pre_compact.py        # PreCompact: save before compression
├── memory/
│   ├── MEMORY.md             # Layer 3: tacit knowledge
│   ├── memory/               # Layer 2: daily notes
│   │   └── YYYY-MM-DD.md
│   └── areas/                # Layer 1: knowledge graph
│       └── topics/
│           └── <topic>/
│               └── items.json
└── commands/
    ├── memory-review.md      # /memory-review command
    └── memory-status.md      # /memory-status command

Trustgrade A

  • passBody integrity

    Whether the stored document is plausibly the kind of file the artifact declares, rather than something fetched by mistake.

  • passType matchnot applicable to this artifact type

    Whether the artifact is really the kind of thing its metadata claims it is.

  • passFreshness

    How long since the source repository was last pushed to.

  • passPrompt injection

    Scans the artifact's own text for instructions aimed at your agent rather than at you.

  • passLicense

    Whether the source repository declares an SPDX license permissive enough to redistribute.

How the grade is calculated

Each check contributes 0 points when it passes, 1 when it warns, and 2 when it fails. The total maps to a letter:

  • Aevery check passed
  • Bone warning
  • Ctwo warnings
  • Dprompt injection or body integrity failed, or three warnings
  • Fone of those failed, and something else is wrong

These are automated hygiene checks, not a security audit, and not a dependency or vulnerability scan. A grade of A means nothing was flagged — not that the artifact is safe.

Versions

  • git-3e425425c0932026-07-31