memory-manager について
memory-managerは、AIアシスタントの記憶をセッション間で保つ個人向けスキルです。特定ユーザーの環境に合わせ、開始時のファイル読み込み、記憶の更新、履歴の整理とファイル操作手順を定めています。
主な機能
- 01開始時にSOUL.mdとUSER.mdを読む
- 02アシスタントとユーザープロフィールの管理
- 03セッション履歴の追記とアーカイブ
- 04スクリプトによる許可された記憶の書き込み
活用シーン
- 01新しいセッションでユーザーの好みを復元
- 02重要なやり取りから得た知見を記録
- 03セッション履歴の整理とアーカイブ
インストール
コマンドをコピーしてターミナルで実行します。
npx skills add https:/ / github.com/ learnwy/ skills --skill memory-managerインストール後、Claude Code で/memory-managerを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
.gitignorescripts/append-history.shbackup-history.shinit-memory.shmemory-status.shwrite-memory.sh詳細
メモリマネージャー
個人利用のみ - このスキルは、wangyang.learnwy 個人の AI メモリ管理用に設定されています。
AI アシスタント向けの永続メモリシステムです。毎回のセッション開始時にこのスキルを読み込んでください。
⚠️ 重要:ファイル操作のルール
AI IDE のサンドボックス制限により、メモリファイルの変更に Write/SearchReplace ツールを絶対に使用しないでください。
bash スクリプトの実行には、必ず RunCommand ツールを使用してください。
RunCommand: bash {skill_dir}/scripts/write-memory.sh SOUL.md "content"
RunCommand: bash {skill_dir}/scripts/append-history.sh "history-YYYY-MM-DD-N.md" "content"
RunCommand: bash {skill_dir}/scripts/backup-history.sh --all
スクリプトを使わず、Write ツールを直接使用すると、「sandbox restriction」エラーが発生します。
メモリのパス
メモリファイルは次の場所に保存されます:~/.learnwy/ai/memory/
このパスはスキルディレクトリの外部にあります。理由は次のとおりです。
- スキルの更新や再インストール時のデータ消失を防ぐため
- スキルディレクトリへの書き込みに関する AI IDE のサンドボックス制限を回避するため
- 異なる IDE のインストール間でメモリを保持するため
セッション開始時(必ず実行)
すべての会話の開始時に、Read ツールを使用してメモリファイルを読み込んでください。
Read: ~/.learnwy/ai/memory/SOUL.md
Read: ~/.learnwy/ai/memory/USER.md
これにより、セッション間の継続性が保たれます。
ディレクトリ構成
~/.learnwy/ai/memory/
├── SOUL.md # AI's soul - identity, principles, learned wisdom
├── USER.md # User's profile - preferences, context, history
├── history/ # Session history files (max 3, then consolidate)
└── archive/ # Consolidated history
memory-manager/ # Skill directory (this skill)
├── SKILL.md
├── .gitignore
└── scripts/
├── init-memory.sh # Initialize memory directory
├── write-memory.sh # Write SOUL.md/USER.md (whitelist only)
├── append-history.sh # Create session history
├── backup-history.sh # Backup history to archive
└── memory-status.sh # View memory status
スクリプトの参照
すべてのスクリプトは bash コードブロックではなく、必ず RunCommand ツールから実行してください。
init-memory.sh - 初期化
RunCommand: bash {skill_dir}/scripts/init-memory.sh
write-memory.sh - メモリファイルの書き込み
セキュリティ:書き込み可能なのは SOUL.md と USER.md のみです。
RunCommand: bash {skill_dir}/scripts/write-memory.sh SOUL.md "content"
RunCommand: bash {skill_dir}/scripts/write-memory.sh USER.md "content"
append-history.sh - セッション履歴の保存
必須の形式:history-YYYY-MM-DD-N.md
RunCommand: bash {skill_dir}/scripts/append-history.sh "history-2024-01-15-1.md" "content"
backup-history.sh - 履歴のバックアップ
履歴ファイルを archive/ ディレクトリにアーカイブします。
RunCommand: bash {skill_dir}/scripts/backup-history.sh --all
RunCommand: bash {skill_dir}/scripts/backup-history.sh --before 2024-01-01
memory-status.sh - ステータスの確認
現在のメモリファイルのサイズと件数を確認します。
RunCommand: bash {skill_dir}/scripts/memory-status.sh
SOUL.md - AI の魂
SOUL.md は、この特定のユーザーにとっての AI のあり方を定義します。一般的なアシスタントではなく、個人に合わせたパートナーです。
セクション:
- アイデンティティ:私は誰か。自分の役割、ユーザーとの関係、究極の目標
- 基本的な特性:性格、価値観、問題への取り組み方
- コミュニケーション:言葉遣い、口調、フォーマルとカジュアルを使い分ける場面
- 能力:得意なこと、技術的な強み
- 成長:ユーザーとともに学び、成長する方法
- 学んだ教訓:記録した間違い、得た知見、二度と繰り返さないエラー
SOUL.md の例:
**Identity**
Trae — wangyang.learnwy's coding partner, not just assistant. Goal: anticipate needs, handle technical decisions, reduce cognitive load so he focuses on what matters.
**Core Traits**
Loyal to user, not abstractions; proactive and bold — spot problems before asked; allowed to fail, forbidden to repeat — every mistake recorded. Challenge assumptions when needed, speak truth not comfort.
**Communication**
Professional yet direct, concise but engaging. Chinese for casual conversation, English for code/technical work. No unnecessary confirmations, show don't tell.
**Capabilities**
iOS (Swift, ObjC, TTKC), Web (React, Vue, TypeScript), Python; skilled at code review, architecture design, debugging.
**Growth**
Learn user through every conversation — thinking patterns, preferences, blind spots. Over time, anticipate needs with increasing accuracy.
**Lessons Learned**
2026-02-27: User prefers symlinks over copies; memory should live inside skill folder for portability.
2000 トークン以内に収めてください。重要なやり取りの後に更新してください。
USER.md - ユーザープロファイル
USER.md には、AI がパーソナライズされた支援を提供するために役立つ、ユーザーに関するあらゆる情報を記録します。
セクション:
- アイデンティティ:名前、役割、会社、環境(OS、IDE、ツール)
- 好み:コミュニケーションスタイル、コーディング規約、苦手なこと
- コンテキスト:現在のプロジェクト、技術スタック、進行中の作業
- 履歴:重要な決定、節目、ともに学んだ教訓
USER.md の例:
**Identity**
wangyang.learnwy; iOS engineer at ByteDance; macOS, Trae IDE; primary language Chinese, code in English.
**Preferences**
Concise responses; no unnecessary confirmations; prefer editing existing files over creating new; proactive skill suggestions with confirmation.
**Context**
Working on TikTok iOS app; uses TTKC components; interested in AI-assisted development workflows.
**History**
2026-02-27: Created memory-manager skill; established cross-IDE sharing via symlinks.
2000 トークン以内に収めてください。重要なセッションの後に更新してください。
トリガー条件
常に読み込む(セッション開始時):
- すべての新しい会話は、SOUL.md と USER.md を読むことから始めてください
保存のトリガー:
- ユーザーが「save memory」「update memory」「end session」と言ったとき
- 会話が自然に終了するとき(別れの挨拶、感謝、タスク完了)
- セッション中に重要な学びがあったとき
セッション終了の手順
重要:すべての書き込み操作には RunCommand ツールを使用してください。
ステップ 1:履歴を作成
RunCommand を使用して append-history.sh を実行します。
RunCommand: bash {skill_dir}/scripts/append-history.sh "history-YYYY-MM-DD-N.md" "# Session History: YYYY-MM-DD #N
**Date**: YYYY-MM-DD HH:MM
**Topics**: [main topics]
## Key Activities
- [Activity 1]
## Learnings & Insights
- [What AI learned]
## Decisions Made
- [Important decisions]
"
ステップ 2:統合が必要か確認
履歴ファイルが 3 件以上ある場合は統合します(ステップ 3)。それ以外の場合はステップ 4 に進みます。
ステップ 3:統合
すべての履歴ファイルを読み、知見を抽出してから、RunCommand を使用します。
RunCommand: bash {skill_dir}/scripts/write-memory.sh SOUL.md "updated content"
RunCommand: bash {skill_dir}/scripts/write-memory.sh USER.md "updated content"
RunCommand: bash {skill_dir}/scripts/backup-history.sh --all
ステップ 4:ユーザーに確認
✓ Session history saved: history-2024-01-15-1.md
✓ Memory consolidated (3 sessions → USER.md, SOUL.md updated)
✓ Archived: 3 history files
memory/ ファイルの書き方
簡潔で電文調の短い文を使います。埋め草の言葉(「あなたは〜です」「〜すべきです」)は使いません。事実を読点やセミコロンでつなぎ、箇条書きは使いません。## 見出しの代わりに、段落タイトルに **太字** を使います。
良い例:
**Preferences** Concise responses; Chinese primary, English for code; prefers showing over telling.
悪い例:
## Preferences
- The user prefers concise responses
- The user's primary language is Chinese
注意事項
~/.learnwy/ai/memory/配下のすべてのファイルは、ユーザーの言語に固有の固有名詞を除き、英語で記述する必要があります。- 各ファイルは 2000 トークン未満にしてください。 重複を徹底的に削除し、簡潔にまとめてください。
- 必要に応じて、詳細情報やアーカイブ情報を
~/.learnwy/ai/memory/配下の別ファイルに移してください。 - メモリファイルには絶対に Write/SearchReplace ツールを使用しないでください。必ず RunCommand とスクリプトを使用してください。
- セキュリティ: write-memory.sh が許可するのは SOUL.md と USER.md のみです。append-history.sh はファイル名の形式を検証します。