Update documentation: reflect Layer 3.5 completion

Updated README.md and ARCHITECTURE.md to document Layer 3.5
(Integrated Profile) implementation.

README.md changes:
- Updated header to reflect Layers 1-3.5 complete
- Added Layer 3.5 feature section
- Added get_profile to MCP tools list
- Added Layer 3.5 usage examples with sample output
- Updated architecture overview with Layer 3.5
- Added design philosophy explanation

ARCHITECTURE.md changes:
- Updated layer overview diagram with Layer 3.5
- Added comprehensive Layer 3.5 section:
  - Purpose and problem solved
  - Data model (UserProfile, TraitScore)
  - Integration logic (5 extraction methods)
  - Caching strategy with update triggers
  - Usage patterns for AI
  - Design philosophy
- Updated implementation strategy (Phase 3.5)
- Updated code organization to reflect current structure
- Updated version metadata

Layer 3.5 provides unified user profile by integrating
Layers 1-3 data, implementing "internal complexity,
external simplicity" design philosophy.
This commit is contained in:
Claude
2025-11-06 06:58:58 +00:00
parent cb46185aa3
commit 427943800e
2 changed files with 192 additions and 8 deletions

View File

@@ -2,7 +2,7 @@
AI memory system with psychological analysis for Claude via MCP. AI memory system with psychological analysis for Claude via MCP.
**Current: Layers 1-3 Complete** - Memory storage, AI interpretation, and personality analysis. **Current: Layers 1-3.5 Complete** - Memory storage, AI interpretation, personality analysis, and integrated profile.
## Features ## Features
@@ -22,6 +22,12 @@ AI memory system with psychological analysis for Claude via MCP.
- 📈 **Pattern Recognition**: Analyzes memory patterns to build user profile - 📈 **Pattern Recognition**: Analyzes memory patterns to build user profile
- 💾 **Historical Tracking**: Save and compare analyses over time - 💾 **Historical Tracking**: Save and compare analyses over time
### Layer 3.5: Integrated Profile
- 🎯 **Essential Summary**: Unified view of personality, interests, and values
- 🤖 **AI-Optimized**: Primary tool for AI to understand the user
-**Smart Caching**: Auto-updates only when necessary
- 🔍 **Flexible Access**: Detailed data still accessible when needed
### General ### General
- 🛠️ **MCP Integration**: Works seamlessly with Claude Code - 🛠️ **MCP Integration**: Works seamlessly with Claude Code
- 🧪 **Well-tested**: Comprehensive test coverage - 🧪 **Well-tested**: Comprehensive test coverage
@@ -79,6 +85,9 @@ claude mcp add aigpt /path/to/aigpt/target/release/aigpt server
- `save_user_analysis` - Save Big Five personality analysis - `save_user_analysis` - Save Big Five personality analysis
- `get_user_analysis` - Retrieve latest personality profile - `get_user_analysis` - Retrieve latest personality profile
### Layer 3.5: Integrated Profile (1 tool)
- `get_profile` - **Primary tool**: Get integrated user profile with essential summary
## Usage Examples in Claude Code ## Usage Examples in Claude Code
### Layer 1: Simple Memory ### Layer 1: Simple Memory
@@ -112,6 +121,30 @@ save_user_analysis({
get_user_analysis() get_user_analysis()
``` ```
### Layer 3.5: Integrated Profile (Recommended)
```
# Get essential user profile - AI's primary tool
get_profile()
# Returns:
{
"dominant_traits": [
{"name": "openness", "score": 0.8},
{"name": "conscientiousness", "score": 0.7},
{"name": "extraversion", "score": 0.4}
],
"core_interests": ["Rust", "architecture", "design", "system", "memory"],
"core_values": ["simplicity", "efficiency", "maintainability"],
"key_memory_ids": ["01H...", "01H...", ...],
"data_quality": 0.85
}
```
**Usage Pattern:**
- AI normally uses `get_profile()` to understand the user
- For specific details, AI can call `get_memory(id)`, `list_memories()`, etc.
- Profile auto-updates when needed (10+ memories, new analysis, or 7+ days)
## Big Five Personality Traits ## Big Five Personality Traits
- **Openness**: Creativity, curiosity, openness to new experiences - **Openness**: Creativity, curiosity, openness to new experiences
@@ -133,9 +166,15 @@ Multi-layer system design:
- **Layer 1** ✅ Complete: Pure memory storage - **Layer 1** ✅ Complete: Pure memory storage
- **Layer 2** ✅ Complete: AI interpretation with priority scoring - **Layer 2** ✅ Complete: AI interpretation with priority scoring
- **Layer 3** ✅ Complete: Big Five personality analysis - **Layer 3** ✅ Complete: Big Five personality analysis
- **Layer 3.5** ✅ Complete: Integrated profile (unified summary)
- **Layer 4** 🔵 Planned: Game systems and companion features - **Layer 4** 🔵 Planned: Game systems and companion features
- **Layer 5** 🔵 Future: Distribution and sharing - **Layer 5** 🔵 Future: Distribution and sharing
**Design Philosophy**: "Internal complexity, external simplicity"
- Layers 1-3 handle detailed data collection and analysis
- Layer 3.5 provides a simple, unified view for AI consumption
- Detailed data remains accessible when needed
See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for details. See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for details.
## Documentation ## Documentation

View File

@@ -21,6 +21,9 @@ aigptは、独立したレイヤーを積み重ねる設計です。各レイヤ
│ Layer 4a: Game Systems │ 🔵 Planned │ Layer 4a: Game Systems │ 🔵 Planned
│ (Ranking, rarity, XP, visualization) │ │ (Ranking, rarity, XP, visualization) │
├─────────────────────────────────────────┤ ├─────────────────────────────────────────┤
│ Layer 3.5: Integrated Profile │ ✅ Complete
│ (Unified summary for AI consumption) │
├─────────────────────────────────────────┤
│ Layer 3: User Evaluation │ ✅ Complete │ Layer 3: User Evaluation │ ✅ Complete
│ (Big Five personality analysis) │ │ (Big Five personality analysis) │
├─────────────────────────────────────────┤ ├─────────────────────────────────────────┤
@@ -171,6 +174,127 @@ pub struct UserAnalysis {
--- ---
## Layer 3.5: Integrated Profile
**Status**: ✅ **Complete**
### Purpose
Layer 1-3のデータを統合し、本質のみを抽出した統一プロファイル。「内部は複雑、表面はシンプル」の設計哲学を実現。
### Problem Solved
Layer 1-3は独立して動作するが、バラバラのデータをAIが毎回解釈する必要があった。Layer 3.5は統合された1つの答えを提供し、効率性とシンプルさを両立。
### Data Model
```rust
pub struct UserProfile {
// 性格の本質Big Five上位3特性
pub dominant_traits: Vec<TraitScore>,
// 関心の核心最頻出トピック5個
pub core_interests: Vec<String>,
// 価値観の核心高priority メモリから抽出、5個
pub core_values: Vec<String>,
// 重要メモリID証拠、上位10個
pub key_memory_ids: Vec<String>,
// データ品質0.0-1.0、メモリ数と分析有無で算出)
pub data_quality: f32,
pub last_updated: DateTime<Utc>,
}
pub struct TraitScore {
pub name: String, // "openness", "conscientiousness", etc.
pub score: f32, // 0.0-1.0
}
```
### Integration Logic
**1. Dominant Traits Extraction**
- Big Fiveから上位3特性を自動選択
- スコアでソート
**2. Core Interests Extraction**
- メモリコンテンツから頻度分析
- AI interpretationは2倍の重み
- 上位5個を抽出
**3. Core Values Extraction**
- priority_score >= 0.7 のメモリから抽出
- 価値関連キーワードをフィルタリング
- 上位5個を抽出
**4. Key Memories**
- priority_scoreでソート
- 上位10個のIDを保持証拠として
**5. Data Quality Score**
- メモリ数: 50個で1.0(それ以下は比例)
- 性格分析あり: +0.5
- 加重平均で算出
### Caching Strategy
**Storage**: SQLite `user_profiles` テーブル1行のみ
**Update Triggers**:
1. 10個以上の新しいメモリ追加
2. 新しい性格分析の保存
3. 7日以上経過
**Flow**:
```
get_profile()
キャッシュ確認
更新必要? → No → キャッシュを返す
↓ Yes
Layer 1-3から再生成
キャッシュ更新
新しいプロファイルを返す
```
### MCP Tools
- `get_profile` - **Primary tool**: Get integrated profile
### Usage Pattern
**通常使用(効率的)**:
```
AI: get_profile()を呼ぶ
→ ユーザーの本質を理解
→ 適切な応答を生成
```
**詳細確認(必要時)**:
```
AI: get_profile()で概要を把握
→ 疑問がある
→ get_memory(id)で詳細確認
→ list_memories()で全体確認
```
### Design Philosophy
**"Internal complexity, external simplicity"**
- 内部: 複雑な分析、頻度計算、重み付け
- 表面: シンプルな1つのJSON
- AIは基本的にget_profile()のみ参照
- 柔軟性: 詳細データへのアクセスも可能
**Efficiency**:
- 頻繁な再計算を避ける(キャッシング)
- 必要時のみ更新(スマートトリガー)
- AI が迷わない1つの明確な答え
---
## Layer 4a: Game Systems ## Layer 4a: Game Systems
**Status**: 🔵 **Planned** **Status**: 🔵 **Planned**
@@ -264,6 +388,16 @@ pub struct Companion {
- [x] `get_user_analysis` tool - [x] `get_user_analysis` tool
- [x] Historical tracking support - [x] Historical tracking support
### Phase 3.5: Layer 3.5 ✅ (Complete)
- [x] UserProfile data structure
- [x] Integration logic (traits, interests, values)
- [x] Frequency analysis for topic extraction
- [x] Value keyword extraction
- [x] Data quality scoring
- [x] Caching mechanism (user_profiles table)
- [x] Smart update triggers
- [x] `get_profile` MCP tool
### Phase 4: Layers 4-5 (Next) ### Phase 4: Layers 4-5 (Next)
- [ ] Game mechanics (Layer 4a) - [ ] Game mechanics (Layer 4a)
- [ ] Companion system (Layer 4b) - [ ] Companion system (Layer 4b)
@@ -337,16 +471,27 @@ pub struct Companion {
``` ```
src/ src/
├── core/ # Layer 1: Pure storage ├── core/
├── ai/ # Layer 2: AI features (future) │ ├── memory.rs # Layer 1: Memory struct
├── evaluation/ # Layer 3: User diagnosis (future) │ ├── store.rs # Layer 1-3.5: SQLite operations
├── game/ # Layer 4a: Game systems (future) │ ├── analysis.rs # Layer 3: UserAnalysis (Big Five)
├── companion/ # Layer 4b: Companion (future) │ ├── profile.rs # Layer 3.5: UserProfile (integrated)
└── mcp/ # MCP server (all layers) │ ├── error.rs # Error types
│ └── mod.rs # Module exports
├── mcp/
│ ├── base.rs # MCP server (all layers)
│ └── mod.rs # Module exports
├── lib.rs # Library root
└── main.rs # CLI application
``` ```
**Future layers**:
- Layer 4a: `src/game/` - Game systems
- Layer 4b: `src/companion/` - Companion features
- Layer 5: `src/distribution/` - Sharing mechanisms
--- ---
**Version**: 0.2.0 **Version**: 0.2.0
**Last Updated**: 2025-11-06 **Last Updated**: 2025-11-06
**Current Status**: Layers 1-3 Complete, Layer 4 Planned **Current Status**: Layers 1-3.5 Complete, Layer 4 Planned