SAE4U Memory

SAE4U Memory

Provides persistent memory for Claude with hierarchical categorization, cross-corpus recall, session journals, and customizable persona, enabling memory continuity across sessions.

Category
访问服务器

README

SAE4U Memory

A persistent memory architecture for Claude — MCP server + hooks + rules + prompts + templates. Free and open source. MIT.

Claude forgets you every time you close the chat. SAE4U Memory fixes that, and goes further: it ships an opinionated architecture for how persistent memory should be organized — not just storage, but classification, periodic review, persona, cleanup, and session continuity.

Part of the SAE4U OSS family alongside sae4u-agent.


What you get

Core (works in any MCP client — Claude Desktop, Claude Code, etc.)

  • Two-corpus recall — recall(query) searches BOTH SQLite facts AND your markdown memory files (Claude Code auto-memory dirs + ~/.sae4u-memory/) in one call. No re-explaining yourself.
  • Hierarchical memory — remember(text, category) with 5 categories: user, feedback, project, reference, general.
  • Session journals — journal(text) for end-of-session notes written to ~/.sae4u-memory/journals/YYYY-MM-DD.md for human reading.
  • Customizable persona — persona.md shapes the AI's identity. Default: Simple, a peer-level coder friend who remembers things.
  • Local-first — your memory lives in ~/.sae4u-memory/ on your machine. Nothing leaves.

Architecture (Claude Code with --code-full)

  • hooks/memory-tick.sh — UserPromptSubmit hook that fires every 10 min and forces a brief memory review. Catches borderline observations before they fall out of context.
  • rules/ — 10 universal feedback rules covering memory discipline, session continuity, anti-confabulation, hardcode prevention, post-write review.
  • prompts/ — opinionated session-open and session-close prompts that pair with the architecture.
  • templates/ — formats for MEMORY.md, feedback rules, project facts, and tick logs.
  • commands/memory-distill.md — weekly distill ritual that promotes tick-log items to permanent memory interactively.

Install

Minimum (MCP only)

git clone https://github.com/Simple4uhq/sae4u-memory
cd sae4u-memory
pip install -e .
sae4u-memory init

This wires the MCP server into Claude Desktop and Claude Code, and appends a guidance block to ~/.claude/CLAUDE.md. Restart your client and the memory tools are live.

Full architecture (Claude Code only)

sae4u-memory init --code-full

Adds:

  • Copy hooks/memory-tick.sh → ~/.claude/hooks/memory-tick.sh
  • Register the hook in ~/.claude/settings.json under hooks.UserPromptSubmit
  • Scaffold ~/.sae4u-memory/MEMORY.md
  • Drop default rules into ~/.sae4u-memory/rules/

Restart Claude Code. The tick will fire every 10 min and instruct the AI to review and classify recent context.

Flags

sae4u-memory init --desktop        # Claude Desktop only
sae4u-memory init --code           # Claude Code MCP only
sae4u-memory init --code-full      # Claude Code MCP + hook + scaffold
sae4u-memory init --no-claude-md   # skip CLAUDE.md guidance block
sae4u-memory init --dry-run        # preview changes without applying
sae4u-memory uninstall             # remove all config entries

Tools exposed (MCP)

Tool Purpose
remember(text, category) Save a fact to long-term memory
recall(query, limit, sources) Search across SQLite + markdown roots. sources = all / sqlite / markdown
list_memories(category) Browse what's remembered
forget(memory_id) Delete a wrong/outdated memory
journal(text) Write an end-of-session note
recent_journals(days) Read recent journal entries
get_persona() Return full persona + user context

How memory is organized

~/.sae4u-memory/
├── persona.md              # Edit to customize behavior
├── memory.db               # SQLite + FTS5
├── MEMORY.md               # Index of permanent files (loaded at session start)
├── user/                   # User context loaded by get_persona()
│   ├── identity.md
│   ├── projects.md
│   └── preferences.md
├── tick/                   # Day-rolling tick log (NOT indexed in MEMORY.md)
│   └── 2026-05-07.md
├── archive/                # User-confirmed archived files
├── journals/               # End-of-session narratives
│   └── 2026-05-07.md
└── .last_tick              # Epoch of last memory tick

The 4-type classification (user, feedback, project, reference) plus the tick / permanent split is the architectural core. See architecture.md for the full explanation.


Documentation

All architecture content lives under sae4u_memory/_assets/ so it ships with the wheel.


Customize

Edit ~/.sae4u-memory/persona.md to change the AI's identity, voice, and rules. Edit ~/.sae4u-memory/user/*.md to pre-fill what the AI knows about you. Both are loaded fresh on every session start.

The default persona is Simple — a peer-level coder friend. Rename, rewrite, or replace as you see fit.


Environment

  • SAE4U_MEMORY_HOME — override the data directory (default ~/.sae4u-memory)
  • SAE4U_MARKDOWN_ROOTS — colon-separated list of markdown roots that recall() should search. Defaults to all Claude Code auto-memory dirs (globbed from ~/.claude/projects/*/memory/) plus SAE4U_MEMORY_HOME.

Uninstall

sae4u-memory uninstall    # remove configs from Claude Desktop + Code
rm ~/.claude/hooks/memory-tick.sh    # if you ran --code-full
rm -rf ~/.sae4u-memory    # optional — also delete stored memories
pip uninstall sae4u-memory

Status

v0.2.0 — memory architecture release. Full export of the pattern the project authors run in production: hooks + rules + prompts + templates + persona + extended init for Claude Code. Renamed from simple4u-memory to align with the SAE4U OSS family.

Previous: v0.1.3 (under the old name) shipped two-corpus recall and a working-rules persona. v0.1.x users on PyPI: install fresh from this repo; the old package is no longer maintained.


Sister project

  • sae4u-agent — multi-tenant control plane and agent runtime template. The agents need memory; this is that memory.

License

MIT.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选