diff --git a/.gitignore b/.gitignore index 810a41c..8bc33b7 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ __pycache__/ *.pyc .venv/ .claude-session/ +*.bak +*.bak.* +memory-db-ssl/ diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..7c0a8e6 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,37 @@ +# Matrix AI Agent + +Matrix bot with memory, voice, RAG, and Confluence collaboration. + +## Deployment +- **VM:** matrix.agiliton.internal +- **Path:** /opt/matrix-ai-agent/ +- **Deploy:** `agiliton-deploy matrix-ai-agent` +- **Jira project:** MAT + +## Architecture +- `bot.py` — Main Matrix bot (131KB, E2EE, memory-aware) +- `voice.py` — LiveKit voice integration +- `agent.py` — Pipecat voice agent +- `memory-service/` — FastAPI service for encrypted memory storage (pgvector) +- `confluence-collab/` — Confluence collaboration MCP server +- `article_summary/` — Article summarization + TTS + +## Docker Services +- `bot` — Main bot process +- `agent` — Voice agent (host networking) +- `memory-service` — Memory API (port 8090, connects as `memory_app` with RLS) +- `memory-db` — pgvector/pg17 with SSL + Row-Level Security + +## Memory Encryption (MAT-107) +- Per-user Fernet encryption: `HMAC-SHA256(master_key, user_id)` key derivation +- Encrypted fields: `fact`, `chunk_text`, `summary` +- Embeddings unencrypted (required for vector search) +- RLS policies enforce user isolation at DB level +- `memory_app` role for queries, `memory` owner for DDL/health +- SSL between memory-service and memory-db + +## Secrets +All in `.env` (gitignored). Key vars: +- `MEMORY_ENCRYPTION_KEY` — Master key for memory encryption +- `MEMORY_APP_PASSWORD` — Restricted DB role password +- `MATRIX_BOT_PASSWORD`, `LITELLM_API_KEY`, `ELEVENLABS_API_KEY`, etc.