fd97ba2d817afced013783c64104231ce333b677
Core changes: - Add AI interpreter module for content interpretation and priority scoring - Extend Memory struct with interpreted_content, priority_score (f32: 0.0-1.0), and user_context - Implement automatic memory pruning based on priority scores - Add capacity management (default: 100 memories max) - Create comprehensive design documentation Technical details: - Changed priority_score from u8 (1-100) to f32 (0.0-1.0) for better AI compatibility - Add create_memory_with_ai() method for AI-enhanced memory creation - Implement get_memories_by_priority() for priority-based sorting - Score evaluation criteria: emotional impact, user relevance, novelty, utility Philosophy: This implements a "psychological priority memory system" where AI interprets and evaluates memories rather than storing raw content. Inspired by how human memory works - interpreting and prioritizing rather than perfect recording.
aigpt - AI Memory System with Psychological Priority
AI記憶装置(心理優先記憶システム)。ChatGPTのメモリ機能を参考にしながら、AIによる解釈と心理判定を加えた新しいメモリストレージシステムです。
コンセプト
従来の「会話 → 保存 → 検索」ではなく、「会話 → AI解釈 → 保存 → 検索」を実現。 AIが記憶を解釈し、重要度を0.0-1.0のスコアで評価。優先度の高い記憶を保持し、低い記憶は自動的に削除されます。
機能
- AI解釈付き記憶: 元のコンテンツとAI解釈後のコンテンツを保存
- 心理判定スコア: 0.0-1.0のfloat値で重要度を評価
- 優先順位管理: スコアに基づく自動ソートとフィルタリング
- 容量制限: 最大100件(設定可能)、低スコアから自動削除
- メモリのCRUD操作: メモリの作成、更新、削除、検索
- ChatGPT JSONインポート: ChatGPTの会話履歴からメモリを抽出
- stdio MCP実装: Claude Desktop/Codeとの簡潔な連携
- JSONファイル保存: シンプルなファイルベースのデータ保存
インストール
- Rustをインストール(まだの場合):
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- プロジェクトをビルド:
cargo build --release
- バイナリをパスの通った場所にコピー(オプション):
cp target/release/aigpt $HOME/.cargo/bin/
- Claude Code/Desktopに追加
# Claude Codeの場合
claude mcp add aigpt $HOME/.cargo/bin/aigpt server
# または
claude mcp add aigpt $HOME/.cargo/bin/aigpt serve
使用方法
ヘルプの表示
aigpt --help
MCPサーバーとして起動
# MCPサーバー起動 (どちらでも可)
aigpt server
aigpt serve
ChatGPT会話のインポート
# ChatGPT conversations.jsonをインポート
aigpt import path/to/conversations.json
Claude Desktop/Codeへの設定
-
Claude Desktopの設定ファイルを開く:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
- macOS:
-
以下の設定を追加:
{
"mcpServers": {
"aigpt": {
"command": "/Users/syui/.cargo/bin/aigpt",
"args": ["server"]
}
}
}
提供するMCPツール一覧
- create_memory - 新しいメモリを作成
- update_memory - 既存のメモリを更新
- delete_memory - メモリを削除
- search_memories - メモリを検索
- list_conversations - インポートされた会話を一覧表示
ツールの使用例
Claude Desktop/Codeで以下のように使用します:
メモリの作成
MCPツールを使って「今日は良い天気です」というメモリーを作成してください
メモリの検索
MCPツールを使って「天気」に関するメモリーを検索してください
会話一覧の表示
MCPツールを使ってインポートした会話の一覧を表示してください
データ保存
- デフォルトパス:
~/.config/syui/ai/gpt/memory.json - JSONファイルでデータを保存
- 自動的にディレクトリとファイルを作成
データ構造
{
"memories": {
"uuid": {
"id": "uuid",
"content": "元のメモリー内容",
"interpreted_content": "AI解釈後のメモリー内容",
"priority_score": 0.75,
"user_context": "ユーザー固有のコンテキスト(オプション)",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z"
}
},
"conversations": {
"conversation_id": {
"id": "conversation_id",
"title": "会話のタイトル",
"created_at": "2024-01-01T00:00:00Z",
"message_count": 10
}
}
}
心理判定スコアについて
0.0-1.0のfloat値で重要度を表現:
- 0.0-0.25: 低優先度(忘れられやすい)
- 0.25-0.5: 中優先度
- 0.5-0.75: 高優先度
- 0.75-1.0: 最高優先度(重要な記憶)
評価基準:
- 感情的インパクト (0.0-0.25)
- ユーザーとの関連性 (0.0-0.25)
- 新規性・独自性 (0.0-0.25)
- 実用性 (0.0-0.25)
開発
# 開発モードで実行
cargo run -- server
# ChatGPTインポートのテスト
cargo run -- import json/conversations.json
# テストの実行
cargo test
# フォーマット
cargo fmt
# Lintチェック
cargo clippy
トラブルシューティング
MCPサーバーが起動しない
# バイナリが存在するか確認
ls -la ~/.cargo/bin/aigpt
# 手動でテスト
echo '{"jsonrpc": "2.0", "method": "tools/list", "id": 1}' | aigpt server
Claude Desktopでツールが見つからない
- Claude Desktopを完全に再起動
- 設定ファイルのパスが正しいか確認
- ログファイルを確認:
~/Library/Logs/Claude/mcp-server-aigpt.log
インポートが失敗する
# JSONファイルの形式を確認
head -100 conversations.json | jq '.[0] | keys'
ライセンス
MIT
Description
Languages
Rust
100%