---
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: 5700
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**: 5,700 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

While you work, an observer (a second agent) watches what your agent reads, edits and runs, and writes short notes about what mattered. Those notes are called observations. When a session ends, the observer writes a summary. When the next session starts, your agent gets a compact index of the observations that matter for this project and fetches full details only when it needs them.

So the next session starts where the last one left off: 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 seeds memory as you work. To front-load a whole repo in one pass instead, run `/learn-codebase` (~5 minutes on a typical repo, optional).

## Where data lives

Your memory lives in ~/.claude-mem on this machine: the SQLite database, vector index, logs and settings. `npx claude-mem uninstall` removes it.

What leaves the machine:

- What the observer reads goes to the model you chose to run it: your Claude plan unless you picked another provider (Codex, OpenRouter, Gemini, or the claude-mem observer on CMEM Pro).
- During install, cmem.ai gets only your email and optional note if you share them when the installer asks (it's optional and asked once), and a numbers-only usage summary (observation counts and token totals; no prompts, paths, or project names) when setup creates a sign-in link. Nothing else goes to cmem.ai unless you sign in and turn on something that uses it (cloud sync, CMEM Pro's hosted observer, a provider that runs through your cmem.ai account) or choose to upload your prompts during browser setup.
- Anonymous usage analytics (telemetry) are on by default. Turn them off with `npx claude-mem telemetry disable`, or set `DO_NOT_TRACK=1`.


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