---
id: gh-how-it-works
name: "how-it-works"
url: https://skills.yangsir.net/skill/gh-how-it-works
author: thedotmack
domain: ai-agent-memory-knowledge
tags: ["ai-agent-memory", "context-management", "knowledge-retrieval", "llm-workflow", "developer-tools"]
install_count: 4600
rating: 4.40 (120 reviews)
github: https://github.com/thedotmack/claude-mem/tree/main/plugin/skills/how-it-works
---

# how-it-works

> claude-mem 技能解释了其如何通过压缩观察来捕获 AI 代理的活动，并在后续会话中自动注入相关记忆，从而提供上下文。这使得 AI 能够记住项目细节和决策，避免重复解释代码库或重新发现信息，显著提升开发效率和连贯性。

**Stats**: 4,600 installs · 4.4/5 (120 reviews)

## Before / After 对比

### AI开发上下文准备效率

**Before**:

在没有记忆管理的情况下，每次AI代理启动新会话或处理新任务时，都需要重新理解项目背景、代码库结构和之前的决策，导致大量时间浪费在重复的上下文准备和信息检索上。

**After**:

通过claude-mem的记忆注入功能，AI代理能够自动获取相关历史上下文，无需重复解释或重新发现信息，显著减少了上下文准备时间，提高了开发效率和任务连贯性。

| Metric | Before | After | Change |
|---|---|---|---|
| 上下文准备时间 | 30分钟 | 5分钟 | -83% |

## Readme

# How claude-mem works

## What it does

Every Read, Edit, and Bash that Claude makes turns into a compressed observation. Observations get summarized at session end. Relevant ones get auto-injected into future prompts so the next session starts with context from the last one — no re-explaining the codebase, no re-discovering decisions.

## When it kicks in

Memory injection starts on your second session in a project.

The first session in a fresh project seeds memory; subsequent sessions receive auto-injected context for relevant past work. Run `/learn-codebase` if you want to front-load the entire repo into memory in a single pass (~5 minutes, optional).

## Where data lives

Everything stays in ~/.claude-mem on this machine.

Nothing leaves your machine except calls to whichever AI provider you configured for compression (Claude / OpenRouter / Gemini). The SQLite database, vector index, logs, and settings all live under that directory and are removed cleanly on `npx claude-mem uninstall`.


---
*Source: https://skills.yangsir.net/skill/gh-how-it-works*
*Markdown mirror: https://skills.yangsir.net/api/skill/gh-how-it-works/markdown*