SuperAPI AI Directory

memory-init

Office & productivity

View repository

Updated 10-16 01:31

About this skill

Memory System Initialization

Feature Description

Deploy the memory system in the current working directory with one click, generating three things:

  1. CLAUDE.md — Persona + conversation rules + memory protocol
  2. MEMORY.md — Long-term memory file (initially an empty template)
  3. memory/ — Daily memory directory
  • /memory-init → Interactive initialization, generating after collecting information step by step

Workflow

Step 0: Check existing files

First check whether CLAUDE.md, AGENT.md, MEMORY.md, or the memory/ directory already exist in the current directory.

  • If none exist → normal initialization
  • If some exist → tell the user which ones already exist, and ask whether to overwrite or only fill in the missing ones
  • If all exist → tell the user "it has already been initialized", and ask whether to reset

Step 1: Collect project overview + persona information

1.1 Project Overview

First use ls and Glob to check whether the current directory already hassubstantive project files(code, documentation, configuration files, etc.). Note:.claude/、.git/、node_modules/ Tool directories such as do not count as project files.

  • Existing substantive project files(such as README, package.json, source code, documentation, etc.) → scan the directory structure, README, package.json, main code files, etc., automatically generate a project overview (summarize in 2-3 sentences what the project is and what it is used for), and show it to the user for confirmation or modification
  • Empty directory / only tool directories / almost no content → must ask the user: "What is this project for? Briefly describe it", thenstop and wait for the user to answer, do not continue further. After receiving the user's answer, proceed to 1.2

1.2 Persona Information

Ask the user the following questions:

  1. What is your role?(such as: SA/pre-sales, development, product, operations)
  2. What do you mainly use Claude for?(such as: customer communication, technical proposals, daily documentation, code development)
  3. Conversation style preference?(such as: concise and direct / detailed and expanded / casual chat)
  4. Are there any special work habits you want me to know about?(optional, the user can skip)

Step 2: Generate CLAUDE.md

Generate CLAUDE.md based on the collected information, including the following modules:

# 项目简介

[根据扫描结果或用户描述生成,2-3句话概括项目是什么、做什么用的]

# 人设

[根据用户角色和用途生成,1-2句话]

# 对话风格

[根据用户偏好生成,3-5条规则]

# 思考方式

[根据用户角色生成,3-5条思考优先级]

# 记忆协议

## 长期记忆(MEMORY.md)
- 存放稳定的核心信息:客户画像、个人偏好、关键决策
- 每次对话自动加载,始终在上下文中
- 超过 150 行时主动提议精简

## 每日记忆(memory/YYYY-MM-DD.md)
- 存放当天对话产生的要点:结论、洞察、待办、决策
- 对话结束前问一句"这次有值得记住的吗?",确认后写入当天文件
- 需要回顾历史时,搜索 memory/ 目录检索

## 工作流
1. 对话开始 → 用 Read 工具读取本项目根目录下的 MEMORY.md,再用 Read 读取 memory/当天日期.md(如 memory/2026-03-02.md),了解今天已有的上下文
2. 涉及历史上下文 → 用 Grep 工具搜索本项目根目录下的 memory/ 目录
3. 对话结束 → 问是否要记录,确认后写入 memory/当天日期.md
4. 如果产出了值得长期记住的信息(如新客户、重要决策),同步更新 MEMORY.md
5. 注意:以上所有文件路径都是相对于本项目根目录,不是全局 ~/.claude/ 目录

## 补充规则
- 记忆以本项目根目录下的文件为准,忽略 ~/.claude/ 下的 auto-memory(内置记忆系统),不要读也不要写
- 对话开始时,除了读今天的记忆,也读昨天的(memory/昨天日期.md),保持跨天连续性
- 用户说"记住这个"、"这个记一下"时,立刻写入文件,不要只"记在心里"等结束再存
- 每日记忆积累超过 7 天时,主动提议做一次蒸馏:把仍然有价值的要点合并到 MEMORY.md,过时的标记或清理

Note: The memory protocol part is a fixed template and does not change with user input. The project overview, persona, conversation style, and way of thinking are customized based on user input.


Step 2.5: Ask whether to generate AGENT.md (for Codex)

After generating CLAUDE.md, ask the user:

"Do you still use Codex? Do you want to generate an AGENT.md as well? The content is exactly the same as CLAUDE.md, and Codex will automatically read AGENT.md."

  • If the user says yes → copy the content of CLAUDE.md as is into AGENT.md
  • If the user says no → skip and continue to the next step

AGENT.md and CLAUDE.md have completely identical content, the only difference is the file name. CLAUDE.md is for Claude Code, and AGENT.md is for Codex.


Step 3: Generate MEMORY.md

Create the initial long-term memory file:

# 记忆

## 关于我
- 角色:[用户的角色]
- 日常工作:[用户的主要用途]

## 项目与上下文
-(待补充)

## 工作习惯与偏好
- [如果用户提供了偏好,写在这里]

## 重要决策
- [今天日期]:初始化记忆系统

Step 4: Create the memory/ directory

mkdir -p memory/

If the user is willing, write the initialization process of the current conversation as the first daily memory to memory/当天日期.md。


Step 5: Confirm completion

Tell the user what was generated, and briefly explain how to use it:

已生成:
- CLAUDE.md(人设 + 记忆协议,Claude Code 用)
- AGENT.md(同上,Cursor 用)← 如果用户选了才显示这行
- MEMORY.md(长期记忆)
- memory/(每日记忆目录)

使用方式:
- 正常对话即可,我会自动读取记忆
- 对话结束时我会问你要不要保存要点
- 说"记住这个"可以随时存记忆
- 积累一段时间后说"整理记忆"做一次蒸馏

Core Principles

1. The memory protocol is fixed

The persona and style can be personalized, but do not change the memory protocol module—this is the foundational logic of how the system operates, and only by keeping it consistent can it be universal across different directories.

2. Do not break existing content

If CLAUDE.md or AGENT.md already exists in the directory, do not overwrite it by default. Only overwrite if the user explicitly requests it.

3. Usable immediately after generation

After initialization is complete, the next time a new conversation is started it should work properly—reading MEMORY.md and executing according to the protocol. No additional configuration is needed.