Initialize the memory system. Auto-triggered when the hook reports the memory system is not initialized.
Initialize the Engram memory system for the current project.
Trigger this skill when:
memory-remember, memory-recall, memory-status) is requested but .claude/memory-settings.json does not existAsk the user which preset they want:
Or offer custom configuration.
Show the default file names and ask if the user wants to change them:
memory_preferences.md (User/Project/Character preferences)
memory_conversations.md (Conversation history)
memory_longterm.md (Long-term memories)
en — English CLAUDE.md section (default)zh — Chinese CLAUDE.md sectionstrong — 回覆前預設先用 memory-recall 檢查一次記憶 / Check memories before responding by defaultweak — 判斷話題可能涉及過去時才搜尋 / Search only when a topic may involve past context (default)Create .claude/memory-settings.json with the chosen settings:
{
"preset": "<chosen-preset>",
"files": {
"preferences": "<preferences-filename>",
"conversations": "<conversations-filename>",
"longterm": "<longterm-filename>"
},
"language": "<en|zh>",
"search_mode": "<strong|weak>"
}
Copy the template files from the plugin's templates/presets/<preset>/ directory to the project root. The plugin root is available via ${CLAUDE_PLUGIN_ROOT} or can be found by locating the engram plugin directory.
Read each template file and write it to the project root with the configured file names.
Replace {DATE} placeholders with the current date (run date '+%Y-%m-%d' via Bash to get it).
Read the CLAUDE.md section template from the plugin's templates/ directory:
zh: read from templates/claude-md-section-zh.mden: read from templates/claude-md-section-en.mdReplace the following placeholders with the actual configured values:
{PREFS_FILE} → preferences file name{CONVOS_FILE} → conversations file name{LONGTERM_FILE} → longterm file name{PRESET} → chosen preset name{VERSION} → plugin version from .claude-plugin/plugin.json{SEARCH_MODE_INSTRUCTION} → resolved based on search_mode and language. Emit as a standalone paragraph (no numbered prefix):**Strict search mode**: By default, check memories with the \memory-recall` skill before responding; skip only when the topic is clearly unrelated to history (greetings, pure computation, etc.).`**Judgment-based search**: When you judge that a topic may involve past discussions or established preferences, search with the \memory-recall` skill before responding.`**嚴格搜尋模式**:回覆前預設先用 \memory-recall` skill 檢查一次記憶;只有話題明顯與歷史無關(打招呼、純粹計算等)時才略過。`**判斷式搜尋**:當你判斷話題可能涉及過去討論或既有偏好時,先用 \memory-recall` skill 搜尋後再回覆。`Then apply to CLAUDE.md in the project root:
<!-- ENGRAM:START -->: Replace everything between <!-- ENGRAM:START --> and <!-- ENGRAM:END --> (inclusive) with the new resolved contentThe @{PREFS_FILE} reference inside the section causes Claude Code to auto-load preferences into context on every session start.
If .claude/memory-settings.json already exists:
.claude/memory-settings.json with the new valuesAsk the user: "Would you like to add or modify any sections in the preferences template?"
If yes, guide through customization — adding new sections, renaming existing ones, or removing irrelevant ones.
Ask the user: "Would you like to fill in your initial preferences now?"
If yes, walk through each section and populate the preferences file with the user's answers.
Display a summary of what was created:
Engram Memory System Initialized!
Preset: <preset>
Language: <language>
Search mode: <search_mode>
Files created/updated:
- <preferences-file> (preferences — auto-loaded via @ reference in CLAUDE.md)
- <conversations-file> (conversation history)
- <longterm-file> (long-term memories)
- .claude/memory-settings.json (configuration)
- CLAUDE.md (memory instructions + preferences auto-load)
The memory system is now active. I will:
- See your preferences every session via the @-reference in CLAUDE.md
- Save new preferences and decisions as I discover them
- Record conversation summaries at natural endpoints
- Search past memories when a topic relates to previous context