Major refactor: Switch to complete local operation

- Remove external AI API dependency (no more OpenAI/Claude API calls)
- Claude Code now does all interpretation and scoring locally
- Zero cost: No API fees
- Complete privacy: No data sent to external servers
- Simplified dependencies: Removed openai crate and ai-analysis feature

Changes:
- ai_interpreter.rs: Simplified to lightweight wrapper
- Cargo.toml: Removed ai-analysis feature and openai dependency
- mcp/base.rs: Updated create_memory_with_ai to accept interpreted_content and priority_score from Claude Code
- memory.rs: Added create_memory_with_interpretation() method
- Documentation: Updated README, QUICKSTART, USAGE to reflect local-only operation
- Added CHANGELOG.md to track changes

How it works now:
User → Claude Code (interprets & scores) → aigpt (stores) → game result

Benefits:
 完全ローカル (Fully local)
 ゼロコスト (Zero cost)
 プライバシー保護 (Privacy protected)
 高速 (Faster - no network latency)
 シンプル (Simpler - fewer dependencies)
This commit is contained in:
Claude
2025-11-05 15:55:59 +00:00
parent dbb86cebe5
commit a235f42c61
8 changed files with 441 additions and 141 deletions

View File

@@ -128,7 +128,7 @@ impl MemoryManager {
Ok(id)
}
/// AI解釈と心理判定を使った記憶作成
/// AI解釈と心理判定を使った記憶作成(後方互換性のため残す)
pub async fn create_memory_with_ai(
&mut self,
content: &str,
@@ -163,6 +163,37 @@ impl MemoryManager {
Ok(id)
}
/// Claude Code から解釈とスコアを受け取ってメモリを作成
pub fn create_memory_with_interpretation(
&mut self,
content: &str,
interpreted_content: &str,
priority_score: f32,
user_context: Option<&str>,
) -> Result<String> {
let id = Uuid::new_v4().to_string();
let now = Utc::now();
let memory = Memory {
id: id.clone(),
content: content.to_string(),
interpreted_content: interpreted_content.to_string(),
priority_score: priority_score.max(0.0).min(1.0), // 0.0-1.0 に制限
user_context: user_context.map(|s| s.to_string()),
created_at: now,
updated_at: now,
};
self.memories.insert(id.clone(), memory);
// 容量制限チェック
self.prune_memories_if_needed()?;
self.save_data()?;
Ok(id)
}
pub fn update_memory(&mut self, id: &str, content: &str) -> Result<()> {
if let Some(memory) = self.memories.get_mut(id) {
memory.content = content.to_string();