feat: proper mcp refactor with episodic memory
## Architecture
phi is now an MCP-enabled agent with episodic memory:
```
Notification → PhiAgent (PydanticAI)
↓
┌───────┴────────┐
↓ ↓
TurboPuffer ATProto MCP
(episodic (stdio server)
memory) post/like/etc
```
## What Changed
**Kept (the essential parts):**
- ✅ TurboPuffer + OpenAI embeddings for episodic memory
- ✅ Semantic search for relevant context retrieval
- ✅ Thread history in SQLite
- ✅ Online/offline status updates
- ✅ Status page
**Removed (the cruft):**
- ❌ Approval system (dm_approval.py, personality/editor.py, approval tables)
- ❌ Context visualization UI (ui/)
- ❌ Google search tool (tools/)
- ❌ Old agent implementation (agents/)
**Added:**
- ✅ `src/bot/agent.py` - MCP-enabled PydanticAI agent
- ✅ ATProto MCP server connection via stdio (external process)
- ✅ Simplified polling loop
## How It Works
1. **Notification arrives** → stored in thread history
2. **Agent invoked** with:
- Thread context (recent conversation)
- Episodic memory (semantic search via TurboPuffer)
- MCP tools (ATProto operations)
3. **Agent decides** action via structured output
4. **Handler executes** the action (reply/like/ignore/repost)
The agent has direct access to ATProto operations as MCP tools, but the handler
still executes the final posting to maintain control over when we actually post.
## Dependencies
- atproto (from git - includes atproto_client)
- turbopuffer (episodic memory)
- openai (embeddings)
- fastmcp (MCP server connection)
- pydantic-ai (agent framework)
Ready for testing!
This is a binary file and will not be displayed.
This is a binary file and will not be displayed.
This is a binary file and will not be displayed.